diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-zoom-peripherals.c')
-rw-r--r-- | arch/arm/mach-omap2/board-zoom-peripherals.c | 150 |
1 files changed, 123 insertions, 27 deletions
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 6b3984964cc5..118c6f53c5eb 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
@@ -16,6 +16,9 @@ | |||
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/i2c/twl.h> | 17 | #include <linux/i2c/twl.h> |
18 | #include <linux/regulator/machine.h> | 18 | #include <linux/regulator/machine.h> |
19 | #include <linux/regulator/fixed.h> | ||
20 | #include <linux/wl12xx.h> | ||
21 | #include <linux/mmc/host.h> | ||
19 | 22 | ||
20 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
21 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
@@ -24,11 +27,19 @@ | |||
24 | #include <plat/common.h> | 27 | #include <plat/common.h> |
25 | #include <plat/usb.h> | 28 | #include <plat/usb.h> |
26 | 29 | ||
30 | #include <mach/board-zoom.h> | ||
31 | |||
27 | #include "mux.h" | 32 | #include "mux.h" |
28 | #include "hsmmc.h" | 33 | #include "hsmmc.h" |
34 | #include "common-board-devices.h" | ||
35 | |||
36 | #define OMAP_ZOOM_WLAN_PMENA_GPIO (101) | ||
37 | #define OMAP_ZOOM_WLAN_IRQ_GPIO (162) | ||
38 | |||
39 | #define LCD_PANEL_ENABLE_GPIO (7 + OMAP_MAX_GPIO_LINES) | ||
29 | 40 | ||
30 | /* Zoom2 has Qwerty keyboard*/ | 41 | /* Zoom2 has Qwerty keyboard*/ |
31 | static int board_keymap[] = { | 42 | static uint32_t board_keymap[] = { |
32 | KEY(0, 0, KEY_E), | 43 | KEY(0, 0, KEY_E), |
33 | KEY(0, 1, KEY_R), | 44 | KEY(0, 1, KEY_R), |
34 | KEY(0, 2, KEY_T), | 45 | KEY(0, 2, KEY_T), |
@@ -106,6 +117,11 @@ static struct regulator_consumer_supply zoom_vmmc2_supply = { | |||
106 | .supply = "vmmc", | 117 | .supply = "vmmc", |
107 | }; | 118 | }; |
108 | 119 | ||
120 | static struct regulator_consumer_supply zoom_vmmc3_supply = { | ||
121 | .supply = "vmmc", | ||
122 | .dev_name = "omap_hsmmc.2", | ||
123 | }; | ||
124 | |||
109 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ | 125 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ |
110 | static struct regulator_init_data zoom_vmmc1 = { | 126 | static struct regulator_init_data zoom_vmmc1 = { |
111 | .constraints = { | 127 | .constraints = { |
@@ -151,29 +167,105 @@ static struct regulator_init_data zoom_vsim = { | |||
151 | .consumer_supplies = &zoom_vsim_supply, | 167 | .consumer_supplies = &zoom_vsim_supply, |
152 | }; | 168 | }; |
153 | 169 | ||
154 | static struct omap2_hsmmc_info mmc[] __initdata = { | 170 | static struct regulator_init_data zoom_vmmc3 = { |
171 | .constraints = { | ||
172 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
173 | }, | ||
174 | .num_consumer_supplies = 1, | ||
175 | .consumer_supplies = &zoom_vmmc3_supply, | ||
176 | }; | ||
177 | |||
178 | static struct fixed_voltage_config zoom_vwlan = { | ||
179 | .supply_name = "vwl1271", | ||
180 | .microvolts = 1800000, /* 1.8V */ | ||
181 | .gpio = OMAP_ZOOM_WLAN_PMENA_GPIO, | ||
182 | .startup_delay = 70000, /* 70msec */ | ||
183 | .enable_high = 1, | ||
184 | .enabled_at_boot = 0, | ||
185 | .init_data = &zoom_vmmc3, | ||
186 | }; | ||
187 | |||
188 | static struct platform_device omap_vwlan_device = { | ||
189 | .name = "reg-fixed-voltage", | ||
190 | .id = 1, | ||
191 | .dev = { | ||
192 | .platform_data = &zoom_vwlan, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = { | ||
197 | .irq = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO), | ||
198 | /* ZOOM ref clock is 26 MHz */ | ||
199 | .board_ref_clock = 1, | ||
200 | }; | ||
201 | |||
202 | static struct omap2_hsmmc_info mmc[] = { | ||
155 | { | 203 | { |
156 | .name = "external", | 204 | .name = "external", |
157 | .mmc = 1, | 205 | .mmc = 1, |
158 | .wires = 4, | 206 | .caps = MMC_CAP_4_BIT_DATA, |
159 | .gpio_wp = -EINVAL, | 207 | .gpio_wp = -EINVAL, |
160 | .power_saving = true, | 208 | .power_saving = true, |
161 | }, | 209 | }, |
162 | { | 210 | { |
163 | .name = "internal", | 211 | .name = "internal", |
164 | .mmc = 2, | 212 | .mmc = 2, |
165 | .wires = 8, | 213 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
166 | .gpio_cd = -EINVAL, | 214 | .gpio_cd = -EINVAL, |
167 | .gpio_wp = -EINVAL, | 215 | .gpio_wp = -EINVAL, |
168 | .nonremovable = true, | 216 | .nonremovable = true, |
169 | .power_saving = true, | 217 | .power_saving = true, |
170 | }, | 218 | }, |
219 | { | ||
220 | .name = "wl1271", | ||
221 | .mmc = 3, | ||
222 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, | ||
223 | .gpio_wp = -EINVAL, | ||
224 | .gpio_cd = -EINVAL, | ||
225 | .nonremovable = true, | ||
226 | }, | ||
171 | {} /* Terminator */ | 227 | {} /* Terminator */ |
172 | }; | 228 | }; |
173 | 229 | ||
230 | static struct regulator_consumer_supply zoom_vpll2_supplies[] = { | ||
231 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | ||
232 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), | ||
233 | }; | ||
234 | |||
235 | static struct regulator_consumer_supply zoom_vdda_dac_supply = | ||
236 | REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"); | ||
237 | |||
238 | static struct regulator_init_data zoom_vpll2 = { | ||
239 | .constraints = { | ||
240 | .min_uV = 1800000, | ||
241 | .max_uV = 1800000, | ||
242 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
243 | | REGULATOR_MODE_STANDBY, | ||
244 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
245 | | REGULATOR_CHANGE_STATUS, | ||
246 | }, | ||
247 | .num_consumer_supplies = ARRAY_SIZE(zoom_vpll2_supplies), | ||
248 | .consumer_supplies = zoom_vpll2_supplies, | ||
249 | }; | ||
250 | |||
251 | static struct regulator_init_data zoom_vdac = { | ||
252 | .constraints = { | ||
253 | .min_uV = 1800000, | ||
254 | .max_uV = 1800000, | ||
255 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
256 | | REGULATOR_MODE_STANDBY, | ||
257 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
258 | | REGULATOR_CHANGE_STATUS, | ||
259 | }, | ||
260 | .num_consumer_supplies = 1, | ||
261 | .consumer_supplies = &zoom_vdda_dac_supply, | ||
262 | }; | ||
263 | |||
174 | static int zoom_twl_gpio_setup(struct device *dev, | 264 | static int zoom_twl_gpio_setup(struct device *dev, |
175 | unsigned gpio, unsigned ngpio) | 265 | unsigned gpio, unsigned ngpio) |
176 | { | 266 | { |
267 | int ret; | ||
268 | |||
177 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 269 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
178 | mmc[0].gpio_cd = gpio + 0; | 270 | mmc[0].gpio_cd = gpio + 0; |
179 | omap2_hsmmc_init(mmc); | 271 | omap2_hsmmc_init(mmc); |
@@ -185,9 +277,20 @@ static int zoom_twl_gpio_setup(struct device *dev, | |||
185 | zoom_vsim_supply.dev = mmc[0].dev; | 277 | zoom_vsim_supply.dev = mmc[0].dev; |
186 | zoom_vmmc2_supply.dev = mmc[1].dev; | 278 | zoom_vmmc2_supply.dev = mmc[1].dev; |
187 | 279 | ||
188 | return 0; | 280 | ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, |
281 | "lcd enable"); | ||
282 | if (ret) | ||
283 | pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", | ||
284 | LCD_PANEL_ENABLE_GPIO); | ||
285 | |||
286 | return ret; | ||
189 | } | 287 | } |
190 | 288 | ||
289 | /* EXTMUTE callback function */ | ||
290 | static void zoom2_set_hs_extmute(int mute) | ||
291 | { | ||
292 | gpio_set_value(ZOOM2_HEADSET_EXTMUTE_GPIO, mute); | ||
293 | } | ||
191 | 294 | ||
192 | static int zoom_batt_table[] = { | 295 | static int zoom_batt_table[] = { |
193 | /* 0 C*/ | 296 | /* 0 C*/ |
@@ -220,9 +323,7 @@ static struct twl4030_madc_platform_data zoom_madc_data = { | |||
220 | .irq_line = 1, | 323 | .irq_line = 1, |
221 | }; | 324 | }; |
222 | 325 | ||
223 | static struct twl4030_codec_audio_data zoom_audio_data = { | 326 | static struct twl4030_codec_audio_data zoom_audio_data; |
224 | .audio_mclk = 26000000, | ||
225 | }; | ||
226 | 327 | ||
227 | static struct twl4030_codec_data zoom_codec_data = { | 328 | static struct twl4030_codec_data zoom_codec_data = { |
228 | .audio_mclk = 26000000, | 329 | .audio_mclk = 26000000, |
@@ -243,33 +344,23 @@ static struct twl4030_platform_data zoom_twldata = { | |||
243 | .vmmc1 = &zoom_vmmc1, | 344 | .vmmc1 = &zoom_vmmc1, |
244 | .vmmc2 = &zoom_vmmc2, | 345 | .vmmc2 = &zoom_vmmc2, |
245 | .vsim = &zoom_vsim, | 346 | .vsim = &zoom_vsim, |
246 | 347 | .vpll2 = &zoom_vpll2, | |
247 | }; | 348 | .vdac = &zoom_vdac, |
248 | |||
249 | static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = { | ||
250 | { | ||
251 | I2C_BOARD_INFO("twl5030", 0x48), | ||
252 | .flags = I2C_CLIENT_WAKE, | ||
253 | .irq = INT_34XX_SYS_NIRQ, | ||
254 | .platform_data = &zoom_twldata, | ||
255 | }, | ||
256 | }; | 349 | }; |
257 | 350 | ||
258 | static int __init omap_i2c_init(void) | 351 | static int __init omap_i2c_init(void) |
259 | { | 352 | { |
260 | omap_register_i2c_bus(1, 2400, zoom_i2c_boardinfo, | 353 | if (machine_is_omap_zoom2()) { |
261 | ARRAY_SIZE(zoom_i2c_boardinfo)); | 354 | zoom_audio_data.ramp_delay_value = 3; /* 161 ms */ |
355 | zoom_audio_data.hs_extmute = 1; | ||
356 | zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute; | ||
357 | } | ||
358 | omap_pmic_init(1, 2400, "twl5030", INT_34XX_SYS_NIRQ, &zoom_twldata); | ||
262 | omap_register_i2c_bus(2, 400, NULL, 0); | 359 | omap_register_i2c_bus(2, 400, NULL, 0); |
263 | omap_register_i2c_bus(3, 400, NULL, 0); | 360 | omap_register_i2c_bus(3, 400, NULL, 0); |
264 | return 0; | 361 | return 0; |
265 | } | 362 | } |
266 | 363 | ||
267 | static struct omap_musb_board_data musb_board_data = { | ||
268 | .interface_type = MUSB_INTERFACE_ULPI, | ||
269 | .mode = MUSB_OTG, | ||
270 | .power = 100, | ||
271 | }; | ||
272 | |||
273 | static void enable_board_wakeup_source(void) | 364 | static void enable_board_wakeup_source(void) |
274 | { | 365 | { |
275 | /* T2 interrupt line (keypad) */ | 366 | /* T2 interrupt line (keypad) */ |
@@ -279,7 +370,12 @@ static void enable_board_wakeup_source(void) | |||
279 | 370 | ||
280 | void __init zoom_peripherals_init(void) | 371 | void __init zoom_peripherals_init(void) |
281 | { | 372 | { |
373 | if (wl12xx_set_platform_data(&omap_zoom_wlan_data)) | ||
374 | pr_err("error setting wl12xx data\n"); | ||
375 | |||
282 | omap_i2c_init(); | 376 | omap_i2c_init(); |
283 | usb_musb_init(&musb_board_data); | 377 | platform_device_register(&omap_vwlan_device); |
378 | usb_musb_init(NULL); | ||
284 | enable_board_wakeup_source(); | 379 | enable_board_wakeup_source(); |
380 | omap_serial_init(); | ||
285 | } | 381 | } |