]> git.karo-electronics.de Git - mv-sheeva.git/blob - arch/arm/mach-omap2/board-omap4panda.c
omap4: pandaboard: Fix the init if CONFIG_MMC_OMAP_HS is not set
[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
103 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
104 {
105         int ret = 0;
106         struct platform_device *pdev = container_of(dev,
107                                 struct platform_device, dev);
108         struct omap_mmc_platform_data *pdata = dev->platform_data;
109
110         /* Setting MMC1 Card detect Irq */
111         if (pdev->id == 0)
112                 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
113                                                 MMCDETECT_INTR_OFFSET;
114         return ret;
115 }
116
117 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
118 {
119         struct omap_mmc_platform_data *pdata;
120
121         /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
122         if (!dev) {
123                 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
124                 return;
125         }
126         pdata = dev->platform_data;
127
128         pdata->init =   omap4_twl6030_hsmmc_late_init;
129 }
130
131 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
132 {
133         struct omap2_hsmmc_info *c;
134
135         omap2_hsmmc_init(controllers);
136         for (c = controllers; c->mmc; c++)
137                 omap4_twl6030_hsmmc_set_late_init(c->dev);
138
139         return 0;
140 }
141
142 static struct regulator_init_data omap4_panda_vaux1 = {
143         .constraints = {
144                 .min_uV                 = 1000000,
145                 .max_uV                 = 3000000,
146                 .apply_uV               = true,
147                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
148                                         | REGULATOR_MODE_STANDBY,
149                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
150                                         | REGULATOR_CHANGE_MODE
151                                         | REGULATOR_CHANGE_STATUS,
152         },
153 };
154
155 static struct regulator_init_data omap4_panda_vaux2 = {
156         .constraints = {
157                 .min_uV                 = 1200000,
158                 .max_uV                 = 2800000,
159                 .apply_uV               = true,
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,
165         },
166 };
167
168 static struct regulator_init_data omap4_panda_vaux3 = {
169         .constraints = {
170                 .min_uV                 = 1000000,
171                 .max_uV                 = 3000000,
172                 .apply_uV               = true,
173                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
174                                         | REGULATOR_MODE_STANDBY,
175                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
176                                         | REGULATOR_CHANGE_MODE
177                                         | REGULATOR_CHANGE_STATUS,
178         },
179 };
180
181 /* VMMC1 for MMC1 card */
182 static struct regulator_init_data omap4_panda_vmmc = {
183         .constraints = {
184                 .min_uV                 = 1200000,
185                 .max_uV                 = 3000000,
186                 .apply_uV               = true,
187                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
188                                         | REGULATOR_MODE_STANDBY,
189                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
190                                         | REGULATOR_CHANGE_MODE
191                                         | REGULATOR_CHANGE_STATUS,
192         },
193         .num_consumer_supplies  = 1,
194         .consumer_supplies      = omap4_panda_vmmc_supply,
195 };
196
197 static struct regulator_init_data omap4_panda_vpp = {
198         .constraints = {
199                 .min_uV                 = 1800000,
200                 .max_uV                 = 2500000,
201                 .apply_uV               = true,
202                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
203                                         | REGULATOR_MODE_STANDBY,
204                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
205                                         | REGULATOR_CHANGE_MODE
206                                         | REGULATOR_CHANGE_STATUS,
207         },
208 };
209
210 static struct regulator_init_data omap4_panda_vusim = {
211         .constraints = {
212                 .min_uV                 = 1200000,
213                 .max_uV                 = 2900000,
214                 .apply_uV               = true,
215                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
216                                         | REGULATOR_MODE_STANDBY,
217                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
218                                         | REGULATOR_CHANGE_MODE
219                                         | REGULATOR_CHANGE_STATUS,
220         },
221 };
222
223 static struct regulator_init_data omap4_panda_vana = {
224         .constraints = {
225                 .min_uV                 = 2100000,
226                 .max_uV                 = 2100000,
227                 .apply_uV               = true,
228                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
229                                         | REGULATOR_MODE_STANDBY,
230                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
231                                         | REGULATOR_CHANGE_STATUS,
232         },
233 };
234
235 static struct regulator_init_data omap4_panda_vcxio = {
236         .constraints = {
237                 .min_uV                 = 1800000,
238                 .max_uV                 = 1800000,
239                 .apply_uV               = true,
240                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
241                                         | REGULATOR_MODE_STANDBY,
242                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
243                                         | REGULATOR_CHANGE_STATUS,
244         },
245 };
246
247 static struct regulator_init_data omap4_panda_vdac = {
248         .constraints = {
249                 .min_uV                 = 1800000,
250                 .max_uV                 = 1800000,
251                 .apply_uV               = true,
252                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
253                                         | REGULATOR_MODE_STANDBY,
254                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
255                                         | REGULATOR_CHANGE_STATUS,
256         },
257 };
258
259 static struct regulator_init_data omap4_panda_vusb = {
260         .constraints = {
261                 .min_uV                 = 3300000,
262                 .max_uV                 = 3300000,
263                 .apply_uV               = true,
264                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
265                                         | REGULATOR_MODE_STANDBY,
266                 .valid_ops_mask  =      REGULATOR_CHANGE_MODE
267                                         | REGULATOR_CHANGE_STATUS,
268         },
269 };
270
271 static struct twl4030_platform_data omap4_panda_twldata = {
272         .irq_base       = TWL6030_IRQ_BASE,
273         .irq_end        = TWL6030_IRQ_END,
274
275         /* Regulators */
276         .vmmc           = &omap4_panda_vmmc,
277         .vpp            = &omap4_panda_vpp,
278         .vusim          = &omap4_panda_vusim,
279         .vana           = &omap4_panda_vana,
280         .vcxio          = &omap4_panda_vcxio,
281         .vdac           = &omap4_panda_vdac,
282         .vusb           = &omap4_panda_vusb,
283         .vaux1          = &omap4_panda_vaux1,
284         .vaux2          = &omap4_panda_vaux2,
285         .vaux3          = &omap4_panda_vaux3,
286 };
287
288 static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
289         {
290                 I2C_BOARD_INFO("twl6030", 0x48),
291                 .flags = I2C_CLIENT_WAKE,
292                 .irq = OMAP44XX_IRQ_SYS_1N,
293                 .platform_data = &omap4_panda_twldata,
294         },
295 };
296 static int __init omap4_panda_i2c_init(void)
297 {
298         /*
299          * Phoenix Audio IC needs I2C1 to
300          * start with 400 KHz or less
301          */
302         omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
303                         ARRAY_SIZE(omap4_panda_i2c_boardinfo));
304         omap_register_i2c_bus(2, 400, NULL, 0);
305         omap_register_i2c_bus(3, 400, NULL, 0);
306         omap_register_i2c_bus(4, 400, NULL, 0);
307         return 0;
308 }
309 static void __init omap4_panda_init(void)
310 {
311         omap4_panda_i2c_init();
312         platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
313         omap_serial_init();
314         omap4_twl6030_hsmmc_init(mmc);
315         /* OMAP4 Panda uses internal transceiver so register nop transceiver */
316         usb_nop_xceiv_register();
317         /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
318         if (!cpu_is_omap44xx())
319                 usb_musb_init(&musb_board_data);
320 }
321
322 static void __init omap4_panda_map_io(void)
323 {
324         omap2_set_globals_443x();
325         omap44xx_map_common_io();
326 }
327
328 MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
329         /* Maintainer: David Anders - Texas Instruments Inc */
330         .phys_io        = 0x48000000,
331         .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
332         .boot_params    = 0x80000100,
333         .map_io         = omap4_panda_map_io,
334         .init_irq       = omap4_panda_init_irq,
335         .init_machine   = omap4_panda_init,
336         .timer          = &omap_timer,
337 MACHINE_END