]> git.karo-electronics.de Git - mv-sheeva.git/blob - arch/arm/mach-omap2/board-omap4panda.c
Merge branch 'pm-hwmods' of ssh://master.kernel.org/pub/scm/linux/kernel/git/khilman...
[mv-sheeva.git] / arch / arm / mach-omap2 / board-omap4panda.c
1 /*
2  * Board support file for OMAP4430 based PandaBoard.
3  *
4  * Copyright (C) 2010 Texas Instruments
5  *
6  * Author: David Anders <x0132446@ti.com>
7  *
8  * Based on mach-omap2/board-4430sdp.c
9  *
10  * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
11  *
12  * Based on mach-omap2/board-3430sdp.c
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2 as
16  * published by the Free Software Foundation.
17  */
18
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/io.h>
23 #include <linux/leds.h>
24 #include <linux/gpio.h>
25 #include <linux/usb/otg.h>
26 #include <linux/i2c/twl.h>
27 #include <linux/regulator/machine.h>
28
29 #include <mach/hardware.h>
30 #include <mach/omap4-common.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34
35 #include <plat/board.h>
36 #include <plat/common.h>
37 #include <plat/control.h>
38 #include <plat/usb.h>
39 #include <plat/mmc.h>
40 #include "hsmmc.h"
41 #include "timer-gp.h"
42
43
44 static struct gpio_led gpio_leds[] = {
45         {
46                 .name                   = "pandaboard::status1",
47                 .default_trigger        = "heartbeat",
48                 .gpio                   = 7,
49         },
50         {
51                 .name                   = "pandaboard::status2",
52                 .default_trigger        = "mmc0",
53                 .gpio                   = 8,
54         },
55 };
56
57 static struct gpio_led_platform_data gpio_led_info = {
58         .leds           = gpio_leds,
59         .num_leds       = ARRAY_SIZE(gpio_leds),
60 };
61
62 static struct platform_device leds_gpio = {
63         .name   = "leds-gpio",
64         .id     = -1,
65         .dev    = {
66                 .platform_data  = &gpio_led_info,
67         },
68 };
69
70 static struct platform_device *panda_devices[] __initdata = {
71         &leds_gpio,
72 };
73
74 static void __init omap4_panda_init_irq(void)
75 {
76         omap2_init_common_hw(NULL, NULL);
77         gic_init_irq();
78         omap_gpio_init();
79 }
80
81 static struct omap_musb_board_data musb_board_data = {
82         .interface_type         = MUSB_INTERFACE_UTMI,
83         .mode                   = MUSB_PERIPHERAL,
84         .power                  = 100,
85 };
86
87 static struct omap2_hsmmc_info mmc[] = {
88         {
89                 .mmc            = 1,
90                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
91                 .gpio_wp        = -EINVAL,
92         },
93         {}      /* Terminator */
94 };
95
96 static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
97         {
98                 .supply = "vmmc",
99                 .dev_name = "mmci-omap-hs.0",
100         },
101         {
102                 .supply = "vmmc",
103                 .dev_name = "mmci-omap-hs.1",
104         },
105 };
106
107 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
108 {
109         int ret = 0;
110         struct platform_device *pdev = container_of(dev,
111                                 struct platform_device, dev);
112         struct omap_mmc_platform_data *pdata = dev->platform_data;
113
114         /* Setting MMC1 Card detect Irq */
115         if (pdev->id == 0)
116                 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
117                                                 MMCDETECT_INTR_OFFSET;
118         return ret;
119 }
120
121 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
122 {
123         struct omap_mmc_platform_data *pdata = dev->platform_data;
124
125         pdata->init =   omap4_twl6030_hsmmc_late_init;
126 }
127
128 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
129 {
130         struct omap2_hsmmc_info *c;
131
132         omap2_hsmmc_init(controllers);
133         for (c = controllers; c->mmc; c++)
134                 omap4_twl6030_hsmmc_set_late_init(c->dev);
135
136         return 0;
137 }
138
139 static struct regulator_init_data omap4_panda_vaux1 = {
140         .constraints = {
141                 .min_uV                 = 1000000,
142                 .max_uV                 = 3000000,
143                 .apply_uV               = true,
144                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
145                                         | REGULATOR_MODE_STANDBY,
146                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
147                                         | REGULATOR_CHANGE_MODE
148                                         | REGULATOR_CHANGE_STATUS,
149         },
150 };
151
152 static struct regulator_init_data omap4_panda_vaux2 = {
153         .constraints = {
154                 .min_uV                 = 1200000,
155                 .max_uV                 = 2800000,
156                 .apply_uV               = true,
157                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
158                                         | REGULATOR_MODE_STANDBY,
159                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
160                                         | REGULATOR_CHANGE_MODE
161                                         | REGULATOR_CHANGE_STATUS,
162         },
163 };
164
165 static struct regulator_init_data omap4_panda_vaux3 = {
166         .constraints = {
167                 .min_uV                 = 1000000,
168                 .max_uV                 = 3000000,
169                 .apply_uV               = true,
170                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
171                                         | REGULATOR_MODE_STANDBY,
172                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
173                                         | REGULATOR_CHANGE_MODE
174                                         | REGULATOR_CHANGE_STATUS,
175         },
176 };
177
178 /* VMMC1 for MMC1 card */
179 static struct regulator_init_data omap4_panda_vmmc = {
180         .constraints = {
181                 .min_uV                 = 1200000,
182                 .max_uV                 = 3000000,
183                 .apply_uV               = true,
184                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
185                                         | REGULATOR_MODE_STANDBY,
186                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
187                                         | REGULATOR_CHANGE_MODE
188                                         | REGULATOR_CHANGE_STATUS,
189         },
190         .num_consumer_supplies  = 2,
191         .consumer_supplies      = omap4_panda_vmmc_supply,
192 };
193
194 static struct regulator_init_data omap4_panda_vpp = {
195         .constraints = {
196                 .min_uV                 = 1800000,
197                 .max_uV                 = 2500000,
198                 .apply_uV               = true,
199                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
200                                         | REGULATOR_MODE_STANDBY,
201                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
202                                         | REGULATOR_CHANGE_MODE
203                                         | REGULATOR_CHANGE_STATUS,
204         },
205 };
206
207 static struct regulator_init_data omap4_panda_vusim = {
208         .constraints = {
209                 .min_uV                 = 1200000,
210                 .max_uV                 = 2900000,
211                 .apply_uV               = true,
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,
217         },
218 };
219
220 static struct regulator_init_data omap4_panda_vana = {
221         .constraints = {
222                 .min_uV                 = 2100000,
223                 .max_uV                 = 2100000,
224                 .apply_uV               = true,
225                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
226                                         | REGULATOR_MODE_STANDBY,
227                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
228                                         | REGULATOR_CHANGE_STATUS,
229         },
230 };
231
232 static struct regulator_init_data omap4_panda_vcxio = {
233         .constraints = {
234                 .min_uV                 = 1800000,
235                 .max_uV                 = 1800000,
236                 .apply_uV               = true,
237                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
238                                         | REGULATOR_MODE_STANDBY,
239                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
240                                         | REGULATOR_CHANGE_STATUS,
241         },
242 };
243
244 static struct regulator_init_data omap4_panda_vdac = {
245         .constraints = {
246                 .min_uV                 = 1800000,
247                 .max_uV                 = 1800000,
248                 .apply_uV               = true,
249                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
250                                         | REGULATOR_MODE_STANDBY,
251                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
252                                         | REGULATOR_CHANGE_STATUS,
253         },
254 };
255
256 static struct regulator_init_data omap4_panda_vusb = {
257         .constraints = {
258                 .min_uV                 = 3300000,
259                 .max_uV                 = 3300000,
260                 .apply_uV               = true,
261                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
262                                         | REGULATOR_MODE_STANDBY,
263                 .valid_ops_mask  =      REGULATOR_CHANGE_MODE
264                                         | REGULATOR_CHANGE_STATUS,
265         },
266 };
267
268 static struct twl4030_platform_data omap4_panda_twldata = {
269         .irq_base       = TWL6030_IRQ_BASE,
270         .irq_end        = TWL6030_IRQ_END,
271
272         /* Regulators */
273         .vmmc           = &omap4_panda_vmmc,
274         .vpp            = &omap4_panda_vpp,
275         .vusim          = &omap4_panda_vusim,
276         .vana           = &omap4_panda_vana,
277         .vcxio          = &omap4_panda_vcxio,
278         .vdac           = &omap4_panda_vdac,
279         .vusb           = &omap4_panda_vusb,
280         .vaux1          = &omap4_panda_vaux1,
281         .vaux2          = &omap4_panda_vaux2,
282         .vaux3          = &omap4_panda_vaux3,
283 };
284
285 static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
286         {
287                 I2C_BOARD_INFO("twl6030", 0x48),
288                 .flags = I2C_CLIENT_WAKE,
289                 .irq = OMAP44XX_IRQ_SYS_1N,
290                 .platform_data = &omap4_panda_twldata,
291         },
292 };
293 static int __init omap4_panda_i2c_init(void)
294 {
295         /*
296          * Phoenix Audio IC needs I2C1 to
297          * start with 400 KHz or less
298          */
299         omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
300                         ARRAY_SIZE(omap4_panda_i2c_boardinfo));
301         omap_register_i2c_bus(2, 400, NULL, 0);
302         omap_register_i2c_bus(3, 400, NULL, 0);
303         omap_register_i2c_bus(4, 400, NULL, 0);
304         return 0;
305 }
306 static void __init omap4_panda_init(void)
307 {
308         omap4_panda_i2c_init();
309         platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
310         omap_serial_init();
311         omap4_twl6030_hsmmc_init(mmc);
312         /* OMAP4 Panda uses internal transceiver so register nop transceiver */
313         usb_nop_xceiv_register();
314         /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
315         if (!cpu_is_omap44xx())
316                 usb_musb_init(&musb_board_data);
317 }
318
319 static void __init omap4_panda_map_io(void)
320 {
321         omap2_set_globals_443x();
322         omap44xx_map_common_io();
323 }
324
325 MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
326         /* Maintainer: David Anders - Texas Instruments Inc */
327         .phys_io        = 0x48000000,
328         .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
329         .boot_params    = 0x80000100,
330         .map_io         = omap4_panda_map_io,
331         .init_irq       = omap4_panda_init_irq,
332         .init_machine   = omap4_panda_init,
333         .timer          = &omap_timer,
334 MACHINE_END