2 * Copyright (C) 2009 Texas Instruments Inc.
4 * Modified from mach-omap2/board-zoom2.c
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/input.h>
15 #include <linux/input/matrix_keypad.h>
16 #include <linux/gpio.h>
17 #include <linux/i2c/twl.h>
18 #include <linux/regulator/machine.h>
19 #include <linux/regulator/fixed.h>
20 #include <linux/wl12xx.h>
21 #include <linux/mmc/host.h>
22 #include <linux/platform_data/gpio-omap.h>
23 #include <linux/platform_data/omap-twl4030.h>
24 #include <linux/usb/phy.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
32 #include "board-zoom.h"
36 #include "common-board-devices.h"
38 #define OMAP_ZOOM_WLAN_PMENA_GPIO (101)
39 #define OMAP_ZOOM_TSC2004_IRQ_GPIO (153)
40 #define OMAP_ZOOM_WLAN_IRQ_GPIO (162)
42 /* Zoom2 has Qwerty keyboard*/
43 static uint32_t board_keymap
[] = {
49 KEY(0, 7, KEY_LEFTSHIFT
),
61 KEY(2, 7, KEY_CAPSLOCK
),
63 KEY(3, 1, KEY_KPPLUS
),
72 KEY(4, 4, KEY_VOLUMEUP
),
79 KEY(5, 4, KEY_UNKNOWN
),
80 KEY(5, 5, KEY_VOLUMEDOWN
),
86 KEY(6, 3, KEY_BACKSPACE
),
89 KEY(7, 0, KEY_PROG1
), /*MACRO 1 <User defined> */
90 KEY(7, 1, KEY_PROG2
), /*MACRO 2 <User defined> */
91 KEY(7, 2, KEY_PROG3
), /*MACRO 3 <User defined> */
92 KEY(7, 3, KEY_PROG4
), /*MACRO 4 <User defined> */
93 KEY(7, 6, KEY_SELECT
),
97 static struct matrix_keymap_data board_map_data
= {
98 .keymap
= board_keymap
,
99 .keymap_size
= ARRAY_SIZE(board_keymap
),
102 static struct twl4030_keypad_data zoom_kp_twl4030_data
= {
103 .keymap_data
= &board_map_data
,
109 static struct regulator_consumer_supply zoom_vmmc1_supply
[] = {
110 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
113 static struct regulator_consumer_supply zoom_vsim_supply
[] = {
114 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
117 static struct regulator_consumer_supply zoom_vmmc2_supply
[] = {
118 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
121 static struct regulator_consumer_supply zoom_vmmc3_supply
[] = {
122 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
125 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
126 static struct regulator_init_data zoom_vmmc1
= {
130 .valid_modes_mask
= REGULATOR_MODE_NORMAL
131 | REGULATOR_MODE_STANDBY
,
132 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
133 | REGULATOR_CHANGE_MODE
134 | REGULATOR_CHANGE_STATUS
,
136 .num_consumer_supplies
= ARRAY_SIZE(zoom_vmmc1_supply
),
137 .consumer_supplies
= zoom_vmmc1_supply
,
140 /* VMMC2 for MMC2 card */
141 static struct regulator_init_data zoom_vmmc2
= {
146 .valid_modes_mask
= REGULATOR_MODE_NORMAL
147 | REGULATOR_MODE_STANDBY
,
148 .valid_ops_mask
= REGULATOR_CHANGE_MODE
149 | REGULATOR_CHANGE_STATUS
,
151 .num_consumer_supplies
= ARRAY_SIZE(zoom_vmmc2_supply
),
152 .consumer_supplies
= zoom_vmmc2_supply
,
155 /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
156 static struct regulator_init_data zoom_vsim
= {
160 .valid_modes_mask
= REGULATOR_MODE_NORMAL
161 | REGULATOR_MODE_STANDBY
,
162 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
163 | REGULATOR_CHANGE_MODE
164 | REGULATOR_CHANGE_STATUS
,
166 .num_consumer_supplies
= ARRAY_SIZE(zoom_vsim_supply
),
167 .consumer_supplies
= zoom_vsim_supply
,
170 static struct regulator_init_data zoom_vmmc3
= {
172 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
174 .num_consumer_supplies
= ARRAY_SIZE(zoom_vmmc3_supply
),
175 .consumer_supplies
= zoom_vmmc3_supply
,
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 */
184 .enabled_at_boot
= 0,
185 .init_data
= &zoom_vmmc3
,
188 static struct platform_device omap_vwlan_device
= {
189 .name
= "reg-fixed-voltage",
192 .platform_data
= &zoom_vwlan
,
196 static struct wl12xx_platform_data omap_zoom_wlan_data __initdata
= {
197 .board_ref_clock
= WL12XX_REFCLOCK_26
, /* 26 MHz */
200 static struct omap2_hsmmc_info mmc
[] = {
204 .caps
= MMC_CAP_4_BIT_DATA
,
206 .power_saving
= true,
212 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
215 .nonremovable
= true,
216 .power_saving
= true,
221 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_POWER_OFF_CARD
,
224 .nonremovable
= true,
229 static struct omap_tw4030_pdata omap_twl4030_audio_data
= {
230 .voice_connected
= true,
231 .custom_routing
= true,
233 .has_hs
= OMAP_TWL4030_LEFT
| OMAP_TWL4030_RIGHT
,
234 .has_hf
= OMAP_TWL4030_LEFT
| OMAP_TWL4030_RIGHT
,
239 .has_linein
= OMAP_TWL4030_LEFT
| OMAP_TWL4030_RIGHT
,
242 static int zoom_twl_gpio_setup(struct device
*dev
,
243 unsigned gpio
, unsigned ngpio
)
245 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
246 mmc
[0].gpio_cd
= gpio
+ 0;
247 omap_hsmmc_late_init(mmc
);
250 omap_twl4030_audio_data
.jack_detect
= gpio
+ 2;
251 omap_twl4030_audio_init("Zoom2", &omap_twl4030_audio_data
);
256 static struct twl4030_gpio_platform_data zoom_gpio_data
= {
257 .setup
= zoom_twl_gpio_setup
,
260 static struct twl4030_platform_data zoom_twldata
= {
261 /* platform_data for children goes here */
262 .gpio
= &zoom_gpio_data
,
263 .keypad
= &zoom_kp_twl4030_data
,
264 .vmmc1
= &zoom_vmmc1
,
265 .vmmc2
= &zoom_vmmc2
,
269 static int __init
omap_i2c_init(void)
271 omap3_pmic_get_config(&zoom_twldata
,
272 TWL_COMMON_PDATA_USB
| TWL_COMMON_PDATA_BCI
|
273 TWL_COMMON_PDATA_MADC
| TWL_COMMON_PDATA_AUDIO
,
274 TWL_COMMON_REGULATOR_VDAC
| TWL_COMMON_REGULATOR_VPLL2
);
276 if (machine_is_omap_zoom2())
277 zoom_twldata
.audio
->codec
->ramp_delay_value
= 3; /* 161 ms */
279 omap_pmic_init(1, 2400, "twl5030", 7 + OMAP_INTC_START
, &zoom_twldata
);
280 omap_register_i2c_bus(2, 400, NULL
, 0);
281 omap_register_i2c_bus(3, 400, NULL
, 0);
285 static void enable_board_wakeup_source(void)
287 /* T2 interrupt line (keypad) */
288 omap_mux_init_signal("sys_nirq",
289 OMAP_WAKEUP_EN
| OMAP_PIN_INPUT_PULLUP
);
292 void __init
zoom_peripherals_init(void)
296 omap_zoom_wlan_data
.irq
= gpio_to_irq(OMAP_ZOOM_WLAN_IRQ_GPIO
);
297 ret
= wl12xx_set_platform_data(&omap_zoom_wlan_data
);
300 pr_err("error setting wl12xx data: %d\n", ret
);
302 omap_hsmmc_init(mmc
);
304 platform_device_register(&omap_vwlan_device
);
305 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
307 enable_board_wakeup_source();