2 * linux/arch/arm/mach-exynos4/mach-smdk4212.c
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/gpio.h>
13 #include <linux/i2c.h>
14 #include <linux/input.h>
16 #include <linux/mfd/max8997.h>
17 #include <linux/mmc/host.h>
18 #include <linux/platform_device.h>
19 #include <linux/pwm_backlight.h>
20 #include <linux/regulator/machine.h>
21 #include <linux/serial_core.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach-types.h>
26 #include <plat/backlight.h>
27 #include <plat/clock.h>
29 #include <plat/devs.h>
30 #include <plat/exynos4.h>
31 #include <plat/gpio-cfg.h>
33 #include <plat/keypad.h>
34 #include <plat/regs-serial.h>
35 #include <plat/sdhci.h>
39 /* Following are default values for UCON, ULCON and UFCON UART registers */
40 #define SMDK4212_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
41 S3C2410_UCON_RXILEVEL | \
42 S3C2410_UCON_TXIRQMODE | \
43 S3C2410_UCON_RXIRQMODE | \
44 S3C2410_UCON_RXFIFO_TOI | \
45 S3C2443_UCON_RXERR_IRQEN)
47 #define SMDK4212_ULCON_DEFAULT S3C2410_LCON_CS8
49 #define SMDK4212_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
50 S5PV210_UFCON_TXTRIG4 | \
51 S5PV210_UFCON_RXTRIG4)
53 static struct s3c2410_uartcfg smdk4212_uartcfgs
[] __initdata
= {
57 .ucon
= SMDK4212_UCON_DEFAULT
,
58 .ulcon
= SMDK4212_ULCON_DEFAULT
,
59 .ufcon
= SMDK4212_UFCON_DEFAULT
,
64 .ucon
= SMDK4212_UCON_DEFAULT
,
65 .ulcon
= SMDK4212_ULCON_DEFAULT
,
66 .ufcon
= SMDK4212_UFCON_DEFAULT
,
71 .ucon
= SMDK4212_UCON_DEFAULT
,
72 .ulcon
= SMDK4212_ULCON_DEFAULT
,
73 .ufcon
= SMDK4212_UFCON_DEFAULT
,
78 .ucon
= SMDK4212_UCON_DEFAULT
,
79 .ulcon
= SMDK4212_ULCON_DEFAULT
,
80 .ufcon
= SMDK4212_UFCON_DEFAULT
,
84 static struct s3c_sdhci_platdata smdk4212_hsmmc2_pdata __initdata
= {
85 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
86 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
87 #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
89 .host_caps
= MMC_CAP_8_BIT_DATA
,
93 static struct s3c_sdhci_platdata smdk4212_hsmmc3_pdata __initdata
= {
94 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
95 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
98 static struct regulator_consumer_supply max8997_buck1
=
99 REGULATOR_SUPPLY("vdd_arm", NULL
);
101 static struct regulator_consumer_supply max8997_buck2
=
102 REGULATOR_SUPPLY("vdd_int", NULL
);
104 static struct regulator_consumer_supply max8997_buck3
=
105 REGULATOR_SUPPLY("vdd_g3d", NULL
);
107 static struct regulator_init_data max8997_buck1_data
= {
109 .name
= "VDD_ARM_SMDK4212",
113 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
118 .num_consumer_supplies
= 1,
119 .consumer_supplies
= &max8997_buck1
,
122 static struct regulator_init_data max8997_buck2_data
= {
124 .name
= "VDD_INT_SMDK4212",
128 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
133 .num_consumer_supplies
= 1,
134 .consumer_supplies
= &max8997_buck2
,
137 static struct regulator_init_data max8997_buck3_data
= {
139 .name
= "VDD_G3D_SMDK4212",
142 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
143 REGULATOR_CHANGE_STATUS
,
148 .num_consumer_supplies
= 1,
149 .consumer_supplies
= &max8997_buck3
,
152 static struct max8997_regulator_data smdk4212_max8997_regulators
[] = {
153 { MAX8997_BUCK1
, &max8997_buck1_data
},
154 { MAX8997_BUCK2
, &max8997_buck2_data
},
155 { MAX8997_BUCK3
, &max8997_buck3_data
},
158 static struct max8997_platform_data smdk4212_max8997_pdata
= {
159 .num_regulators
= ARRAY_SIZE(smdk4212_max8997_regulators
),
160 .regulators
= smdk4212_max8997_regulators
,
162 .buck1_voltage
[0] = 1100000, /* 1.1V */
163 .buck1_voltage
[1] = 1100000, /* 1.1V */
164 .buck1_voltage
[2] = 1100000, /* 1.1V */
165 .buck1_voltage
[3] = 1100000, /* 1.1V */
166 .buck1_voltage
[4] = 1100000, /* 1.1V */
167 .buck1_voltage
[5] = 1100000, /* 1.1V */
168 .buck1_voltage
[6] = 1000000, /* 1.0V */
169 .buck1_voltage
[7] = 950000, /* 0.95V */
171 .buck2_voltage
[0] = 1100000, /* 1.1V */
172 .buck2_voltage
[1] = 1000000, /* 1.0V */
173 .buck2_voltage
[2] = 950000, /* 0.95V */
174 .buck2_voltage
[3] = 900000, /* 0.9V */
175 .buck2_voltage
[4] = 1100000, /* 1.1V */
176 .buck2_voltage
[5] = 1000000, /* 1.0V */
177 .buck2_voltage
[6] = 950000, /* 0.95V */
178 .buck2_voltage
[7] = 900000, /* 0.9V */
180 .buck5_voltage
[0] = 1100000, /* 1.1V */
181 .buck5_voltage
[1] = 1100000, /* 1.1V */
182 .buck5_voltage
[2] = 1100000, /* 1.1V */
183 .buck5_voltage
[3] = 1100000, /* 1.1V */
184 .buck5_voltage
[4] = 1100000, /* 1.1V */
185 .buck5_voltage
[5] = 1100000, /* 1.1V */
186 .buck5_voltage
[6] = 1100000, /* 1.1V */
187 .buck5_voltage
[7] = 1100000, /* 1.1V */
190 static struct i2c_board_info smdk4212_i2c_devs0
[] __initdata
= {
192 I2C_BOARD_INFO("max8997", 0x66),
193 .platform_data
= &smdk4212_max8997_pdata
,
197 static struct i2c_board_info smdk4212_i2c_devs1
[] __initdata
= {
198 { I2C_BOARD_INFO("wm8994", 0x1a), }
201 static struct i2c_board_info smdk4212_i2c_devs3
[] __initdata
= {
202 /* nothing here yet */
205 static struct i2c_board_info smdk4212_i2c_devs7
[] __initdata
= {
206 /* nothing here yet */
209 static struct samsung_bl_gpio_info smdk4212_bl_gpio_info
= {
210 .no
= EXYNOS4_GPD0(1),
211 .func
= S3C_GPIO_SFN(2),
214 static struct platform_pwm_backlight_data smdk4212_bl_data
= {
216 .pwm_period_ns
= 1000,
219 static uint32_t smdk4212_keymap
[] __initdata
= {
220 /* KEY(row, col, keycode) */
221 KEY(1, 0, KEY_D
), KEY(1, 1, KEY_A
), KEY(1, 2, KEY_B
),
222 KEY(1, 3, KEY_E
), KEY(1, 4, KEY_C
)
225 static struct matrix_keymap_data smdk4212_keymap_data __initdata
= {
226 .keymap
= smdk4212_keymap
,
227 .keymap_size
= ARRAY_SIZE(smdk4212_keymap
),
230 static struct samsung_keypad_platdata smdk4212_keypad_data __initdata
= {
231 .keymap_data
= &smdk4212_keymap_data
,
236 static struct platform_device
*smdk4212_devices
[] __initdata
= {
245 &samsung_device_keypad
,
248 static void __init
smdk4212_map_io(void)
250 clk_xusbxti
.rate
= 24000000;
252 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
253 s3c24xx_init_clocks(clk_xusbxti
.rate
);
254 s3c24xx_init_uarts(smdk4212_uartcfgs
, ARRAY_SIZE(smdk4212_uartcfgs
));
257 static void __init
smdk4212_machine_init(void)
259 s3c_i2c0_set_platdata(NULL
);
260 i2c_register_board_info(0, smdk4212_i2c_devs0
,
261 ARRAY_SIZE(smdk4212_i2c_devs0
));
263 s3c_i2c1_set_platdata(NULL
);
264 i2c_register_board_info(1, smdk4212_i2c_devs1
,
265 ARRAY_SIZE(smdk4212_i2c_devs1
));
267 s3c_i2c3_set_platdata(NULL
);
268 i2c_register_board_info(3, smdk4212_i2c_devs3
,
269 ARRAY_SIZE(smdk4212_i2c_devs3
));
271 s3c_i2c7_set_platdata(NULL
);
272 i2c_register_board_info(7, smdk4212_i2c_devs7
,
273 ARRAY_SIZE(smdk4212_i2c_devs7
));
275 samsung_bl_set(&smdk4212_bl_gpio_info
, &smdk4212_bl_data
);
277 samsung_keypad_set_platdata(&smdk4212_keypad_data
);
279 s3c_sdhci2_set_platdata(&smdk4212_hsmmc2_pdata
);
280 s3c_sdhci3_set_platdata(&smdk4212_hsmmc3_pdata
);
282 platform_add_devices(smdk4212_devices
, ARRAY_SIZE(smdk4212_devices
));
285 MACHINE_START(SMDK4212
, "SMDK4212")
286 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
287 .boot_params
= S5P_PA_SDRAM
+ 0x100,
288 .init_irq
= exynos4_init_irq
,
289 .map_io
= smdk4212_map_io
,
290 .init_machine
= smdk4212_machine_init
,
291 .timer
= &exynos4_timer
,