Full support for Ginger Console
[linux-ginger.git] / arch / arm / mach-omap2 / board-zoom2.c
blob882e2d518c8e0e3a1fd9ac89993b533c9da7b307
1 /*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 * Mikkel Christensen <mlc@ti.com>
5 * Modified from mach-omap2/board-ldp.c
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/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/input.h>
16 #include <linux/input/matrix_keypad.h>
17 #include <linux/gpio.h>
18 #include <linux/i2c/twl4030.h>
19 #include <linux/regulator/machine.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
24 #include <plat/common.h>
25 #include <plat/usb.h>
27 #include "mmc-twl4030.h"
28 #include "sdram-micron-mt46h32m32lf-6.h"
29 #include "omap3-opp.h"
31 #include <media/v4l2-int-device.h>
33 #if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
34 #include <media/imx046.h>
35 extern struct imx046_platform_data zoom2_imx046_platform_data;
36 #endif
38 extern void zoom2_cam_init(void);
40 #ifdef CONFIG_VIDEO_LV8093
41 #include <media/lv8093.h>
42 extern struct imx046_platform_data zoom2_lv8093_platform_data;
43 #endif
45 /* Zoom2 has Qwerty keyboard*/
46 static int board_keymap[] = {
47 KEY(0, 0, KEY_E),
48 KEY(1, 0, KEY_R),
49 KEY(2, 0, KEY_T),
50 KEY(3, 0, KEY_HOME),
51 KEY(6, 0, KEY_I),
52 KEY(7, 0, KEY_LEFTSHIFT),
53 KEY(0, 1, KEY_D),
54 KEY(1, 1, KEY_F),
55 KEY(2, 1, KEY_G),
56 KEY(3, 1, KEY_SEND),
57 KEY(6, 1, KEY_K),
58 KEY(7, 1, KEY_ENTER),
59 KEY(0, 2, KEY_X),
60 KEY(1, 2, KEY_C),
61 KEY(2, 2, KEY_V),
62 KEY(3, 2, KEY_END),
63 KEY(6, 2, KEY_DOT),
64 KEY(7, 2, KEY_CAPSLOCK),
65 KEY(0, 3, KEY_Z),
66 KEY(1, 3, KEY_KPPLUS),
67 KEY(2, 3, KEY_B),
68 KEY(3, 3, KEY_F1),
69 KEY(6, 3, KEY_O),
70 KEY(7, 3, KEY_SPACE),
71 KEY(0, 4, KEY_W),
72 KEY(1, 4, KEY_Y),
73 KEY(2, 4, KEY_U),
74 KEY(3, 4, KEY_F2),
75 KEY(4, 4, KEY_VOLUMEUP),
76 KEY(6, 4, KEY_L),
77 KEY(7, 4, KEY_LEFT),
78 KEY(0, 5, KEY_S),
79 KEY(1, 5, KEY_H),
80 KEY(2, 5, KEY_J),
81 KEY(3, 5, KEY_F3),
82 KEY(5, 5, KEY_VOLUMEDOWN),
83 KEY(6, 5, KEY_M),
84 KEY(4, 5, KEY_ENTER),
85 KEY(7, 5, KEY_RIGHT),
86 KEY(0, 6, KEY_Q),
87 KEY(1, 6, KEY_A),
88 KEY(2, 6, KEY_N),
89 KEY(3, 6, KEY_BACKSPACE),
90 KEY(6, 6, KEY_P),
91 KEY(7, 6, KEY_UP),
92 KEY(6, 7, KEY_SELECT),
93 KEY(7, 7, KEY_DOWN),
94 KEY(0, 7, KEY_PROG1), /*MACRO 1 <User defined> */
95 KEY(1, 7, KEY_PROG2), /*MACRO 2 <User defined> */
96 KEY(2, 7, KEY_PROG3), /*MACRO 3 <User defined> */
97 KEY(3, 7, KEY_PROG4), /*MACRO 4 <User defined> */
101 static struct matrix_keymap_data board_map_data = {
102 .keymap = board_keymap,
103 .keymap_size = ARRAY_SIZE(board_keymap),
106 static struct twl4030_keypad_data zoom2_kp_twl4030_data = {
107 .keymap_data = &board_map_data,
108 .rows = 8,
109 .cols = 8,
110 .rep = 1,
113 static struct omap_board_config_kernel zoom2_config[] __initdata = {
116 static struct platform_device zoom2_cam_device = {
117 .name = "zoom2_cam",
118 .id = -1,
121 static struct regulator_consumer_supply zoom2_vaux2_supplies[] = {
123 .supply = "vaux2_1",
124 .dev = &zoom2_cam_device.dev,
128 static struct regulator_consumer_supply zoom2_vaux4_supplies[] = {
130 .supply = "vaux4_1",
131 .dev = &zoom2_cam_device.dev,
135 static struct regulator_consumer_supply zoom2_vmmc1_supply = {
136 .supply = "vmmc",
139 static struct regulator_consumer_supply zoom2_vsim_supply = {
140 .supply = "vmmc_aux",
143 static struct regulator_consumer_supply zoom2_vmmc2_supply = {
144 .supply = "vmmc",
147 /* VAUX2 for camera module */
148 static struct regulator_init_data zoom2_vaux2 = {
149 .constraints = {
150 .min_uV = 2800000,
151 .max_uV = 2800000,
152 .apply_uV = true,
153 .valid_modes_mask = REGULATOR_MODE_NORMAL
154 | REGULATOR_MODE_STANDBY,
155 .valid_ops_mask = REGULATOR_CHANGE_MODE
156 | REGULATOR_CHANGE_STATUS,
158 .num_consumer_supplies = ARRAY_SIZE(zoom2_vaux2_supplies),
159 .consumer_supplies = zoom2_vaux2_supplies,
162 /* VAUX4 for OMAP VDD_CSI2 (camera) */
163 static struct regulator_init_data zoom2_vaux4 = {
164 .constraints = {
165 .min_uV = 1800000,
166 .max_uV = 1800000,
167 .apply_uV = true,
168 .valid_modes_mask = REGULATOR_MODE_NORMAL
169 | REGULATOR_MODE_STANDBY,
170 .valid_ops_mask = REGULATOR_CHANGE_MODE
171 | REGULATOR_CHANGE_STATUS,
173 .num_consumer_supplies = ARRAY_SIZE(zoom2_vaux4_supplies),
174 .consumer_supplies = zoom2_vaux4_supplies,
177 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
178 static struct regulator_init_data zoom2_vmmc1 = {
179 .constraints = {
180 .min_uV = 1850000,
181 .max_uV = 3150000,
182 .valid_modes_mask = REGULATOR_MODE_NORMAL
183 | REGULATOR_MODE_STANDBY,
184 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
185 | REGULATOR_CHANGE_MODE
186 | REGULATOR_CHANGE_STATUS,
188 .num_consumer_supplies = 1,
189 .consumer_supplies = &zoom2_vmmc1_supply,
192 /* VMMC2 for MMC2 card */
193 static struct regulator_init_data zoom2_vmmc2 = {
194 .constraints = {
195 .min_uV = 1850000,
196 .max_uV = 1850000,
197 .apply_uV = true,
198 .valid_modes_mask = REGULATOR_MODE_NORMAL
199 | REGULATOR_MODE_STANDBY,
200 .valid_ops_mask = REGULATOR_CHANGE_MODE
201 | REGULATOR_CHANGE_STATUS,
203 .num_consumer_supplies = 1,
204 .consumer_supplies = &zoom2_vmmc2_supply,
207 /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
208 static struct regulator_init_data zoom2_vsim = {
209 .constraints = {
210 .min_uV = 1800000,
211 .max_uV = 3000000,
212 .valid_modes_mask = REGULATOR_MODE_NORMAL
213 | REGULATOR_MODE_STANDBY,
214 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
215 | REGULATOR_CHANGE_MODE
216 | REGULATOR_CHANGE_STATUS,
218 .num_consumer_supplies = 1,
219 .consumer_supplies = &zoom2_vsim_supply,
222 static struct twl4030_hsmmc_info mmc[] __initdata = {
224 .mmc = 1,
225 .wires = 4,
226 .gpio_wp = -EINVAL,
229 .mmc = 2,
230 .wires = 4,
231 .gpio_wp = -EINVAL,
233 {} /* Terminator */
236 static int zoom2_twl_gpio_setup(struct device *dev,
237 unsigned gpio, unsigned ngpio)
239 /* gpio + 0 is "mmc0_cd" (input/IRQ),
240 * gpio + 1 is "mmc1_cd" (input/IRQ)
242 mmc[0].gpio_cd = gpio + 0;
243 mmc[1].gpio_cd = gpio + 1;
244 twl4030_mmc_init(mmc);
246 /* link regulators to MMC adapters ... we "know" the
247 * regulators will be set up only *after* we return.
249 zoom2_vmmc1_supply.dev = mmc[0].dev;
250 zoom2_vsim_supply.dev = mmc[0].dev;
251 zoom2_vmmc2_supply.dev = mmc[1].dev;
253 return 0;
257 static int zoom2_batt_table[] = {
258 /* 0 C*/
259 30800, 29500, 28300, 27100,
260 26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
261 17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
262 11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
263 8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
264 5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
265 4040, 3910, 3790, 3670, 3550
268 static struct twl4030_bci_platform_data zoom2_bci_data = {
269 .battery_tmp_tbl = zoom2_batt_table,
270 .tblsize = ARRAY_SIZE(zoom2_batt_table),
273 static struct twl4030_usb_data zoom2_usb_data = {
274 .usb_mode = T2_USB_MODE_ULPI,
277 static void __init omap_zoom2_init_irq(void)
279 omap_board_config = zoom2_config;
280 omap_board_config_size = ARRAY_SIZE(zoom2_config);
281 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
282 mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
283 omap3_dsp_rate_table, omap3_l3_rate_table);
284 omap_init_irq();
285 omap_gpio_init();
288 static struct twl4030_gpio_platform_data zoom2_gpio_data = {
289 .gpio_base = OMAP_MAX_GPIO_LINES,
290 .irq_base = TWL4030_GPIO_IRQ_BASE,
291 .irq_end = TWL4030_GPIO_IRQ_END,
292 .setup = zoom2_twl_gpio_setup,
295 static struct twl4030_madc_platform_data zoom2_madc_data = {
296 .irq_line = 1,
299 static struct twl4030_platform_data zoom2_twldata = {
300 .irq_base = TWL4030_IRQ_BASE,
301 .irq_end = TWL4030_IRQ_END,
303 /* platform_data for children goes here */
304 .bci = &zoom2_bci_data,
305 .madc = &zoom2_madc_data,
306 .usb = &zoom2_usb_data,
307 .gpio = &zoom2_gpio_data,
308 .keypad = &zoom2_kp_twl4030_data,
309 .vaux2 = &zoom2_vaux2,
310 .vaux4 = &zoom2_vaux4,
311 .vmmc1 = &zoom2_vmmc1,
312 .vmmc2 = &zoom2_vmmc2,
313 .vsim = &zoom2_vsim,
317 static struct i2c_board_info __initdata zoom2_i2c_boardinfo[] = {
319 I2C_BOARD_INFO("twl4030", 0x48),
320 .flags = I2C_CLIENT_WAKE,
321 .irq = INT_34XX_SYS_NIRQ,
322 .platform_data = &zoom2_twldata,
326 static struct i2c_board_info __initdata zoom2_i2c_boardinfo2[] = {
327 #if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
329 I2C_BOARD_INFO("imx046", IMX046_I2C_ADDR),
330 .platform_data = &zoom2_imx046_platform_data,
332 #endif
333 #ifdef CONFIG_VIDEO_LV8093
335 I2C_BOARD_INFO(LV8093_NAME, LV8093_AF_I2C_ADDR),
336 .platform_data = &zoom2_lv8093_platform_data,
338 #endif
341 static int __init omap_i2c_init(void)
343 omap_register_i2c_bus(1, 2600, zoom2_i2c_boardinfo,
344 ARRAY_SIZE(zoom2_i2c_boardinfo));
345 omap_register_i2c_bus(2, 100, zoom2_i2c_boardinfo2,
346 ARRAY_SIZE(zoom2_i2c_boardinfo2));
347 omap_register_i2c_bus(3, 400, NULL, 0);
348 return 0;
351 extern int __init omap_zoom2_debugboard_init(void);
353 static struct platform_device *zoom2_devices[] __initdata = {
354 &zoom2_cam_device,
357 static void __init omap_zoom2_init(void)
359 omap_i2c_init();
360 platform_add_devices(zoom2_devices, ARRAY_SIZE(zoom2_devices));
361 omap_serial_init();
362 omap_zoom2_debugboard_init();
363 usb_musb_init();
364 zoom2_cam_init();
367 static void __init omap_zoom2_map_io(void)
369 omap2_set_globals_343x();
370 omap2_map_common_io();
373 MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
374 .phys_io = 0x48000000,
375 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
376 .boot_params = 0x80000100,
377 .map_io = omap_zoom2_map_io,
378 .init_irq = omap_zoom2_init_irq,
379 .init_machine = omap_zoom2_init,
380 .timer = &omap_timer,
381 MACHINE_END