blob: d8c70c13953af99508b16b1f07c731ccfcff9c4e [file] [log] [blame]
David Andersb075f582010-08-02 13:18:05 +03001/*
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>
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070023#include <linux/leds.h>
David Andersb075f582010-08-02 13:18:05 +030024#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>
David Andersb075f582010-08-02 13:18:05 +030038#include <plat/usb.h>
39#include <plat/mmc.h>
40#include "hsmmc.h"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070041#include "timer-gp.h"
David Andersb075f582010-08-02 13:18:05 +030042
43
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070044static 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
57static struct gpio_led_platform_data gpio_led_info = {
58 .leds = gpio_leds,
59 .num_leds = ARRAY_SIZE(gpio_leds),
60};
61
62static struct platform_device leds_gpio = {
63 .name = "leds-gpio",
64 .id = -1,
65 .dev = {
66 .platform_data = &gpio_led_info,
67 },
68};
69
70static struct platform_device *panda_devices[] __initdata = {
71 &leds_gpio,
72};
73
David Andersb075f582010-08-02 13:18:05 +030074static 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
81static struct omap_musb_board_data musb_board_data = {
82 .interface_type = MUSB_INTERFACE_UTMI,
83 .mode = MUSB_PERIPHERAL,
84 .power = 100,
85};
86
87static struct omap2_hsmmc_info mmc[] = {
88 {
89 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +000090 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
David Andersb075f582010-08-02 13:18:05 +030091 .gpio_wp = -EINVAL,
92 },
93 {} /* Terminator */
94};
95
96static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
97 {
98 .supply = "vmmc",
99 .dev_name = "mmci-omap-hs.0",
100 },
David Andersb075f582010-08-02 13:18:05 +0300101};
102
103static 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
117static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
118{
119 struct omap_mmc_platform_data *pdata = dev->platform_data;
120
121 pdata->init = omap4_twl6030_hsmmc_late_init;
122}
123
124static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
125{
126 struct omap2_hsmmc_info *c;
127
128 omap2_hsmmc_init(controllers);
129 for (c = controllers; c->mmc; c++)
130 omap4_twl6030_hsmmc_set_late_init(c->dev);
131
132 return 0;
133}
134
135static struct regulator_init_data omap4_panda_vaux1 = {
136 .constraints = {
137 .min_uV = 1000000,
138 .max_uV = 3000000,
139 .apply_uV = true,
140 .valid_modes_mask = REGULATOR_MODE_NORMAL
141 | REGULATOR_MODE_STANDBY,
142 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
143 | REGULATOR_CHANGE_MODE
144 | REGULATOR_CHANGE_STATUS,
145 },
146};
147
148static struct regulator_init_data omap4_panda_vaux2 = {
149 .constraints = {
150 .min_uV = 1200000,
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_VOLTAGE
156 | REGULATOR_CHANGE_MODE
157 | REGULATOR_CHANGE_STATUS,
158 },
159};
160
161static struct regulator_init_data omap4_panda_vaux3 = {
162 .constraints = {
163 .min_uV = 1000000,
164 .max_uV = 3000000,
165 .apply_uV = true,
166 .valid_modes_mask = REGULATOR_MODE_NORMAL
167 | REGULATOR_MODE_STANDBY,
168 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
169 | REGULATOR_CHANGE_MODE
170 | REGULATOR_CHANGE_STATUS,
171 },
172};
173
174/* VMMC1 for MMC1 card */
175static struct regulator_init_data omap4_panda_vmmc = {
176 .constraints = {
177 .min_uV = 1200000,
178 .max_uV = 3000000,
179 .apply_uV = true,
180 .valid_modes_mask = REGULATOR_MODE_NORMAL
181 | REGULATOR_MODE_STANDBY,
182 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
183 | REGULATOR_CHANGE_MODE
184 | REGULATOR_CHANGE_STATUS,
185 },
David Anders191183b2010-10-07 19:36:28 +0000186 .num_consumer_supplies = 1,
David Andersb075f582010-08-02 13:18:05 +0300187 .consumer_supplies = omap4_panda_vmmc_supply,
188};
189
190static struct regulator_init_data omap4_panda_vpp = {
191 .constraints = {
192 .min_uV = 1800000,
193 .max_uV = 2500000,
194 .apply_uV = true,
195 .valid_modes_mask = REGULATOR_MODE_NORMAL
196 | REGULATOR_MODE_STANDBY,
197 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
198 | REGULATOR_CHANGE_MODE
199 | REGULATOR_CHANGE_STATUS,
200 },
201};
202
203static struct regulator_init_data omap4_panda_vusim = {
204 .constraints = {
205 .min_uV = 1200000,
206 .max_uV = 2900000,
207 .apply_uV = true,
208 .valid_modes_mask = REGULATOR_MODE_NORMAL
209 | REGULATOR_MODE_STANDBY,
210 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
211 | REGULATOR_CHANGE_MODE
212 | REGULATOR_CHANGE_STATUS,
213 },
214};
215
216static struct regulator_init_data omap4_panda_vana = {
217 .constraints = {
218 .min_uV = 2100000,
219 .max_uV = 2100000,
220 .apply_uV = true,
221 .valid_modes_mask = REGULATOR_MODE_NORMAL
222 | REGULATOR_MODE_STANDBY,
223 .valid_ops_mask = REGULATOR_CHANGE_MODE
224 | REGULATOR_CHANGE_STATUS,
225 },
226};
227
228static struct regulator_init_data omap4_panda_vcxio = {
229 .constraints = {
230 .min_uV = 1800000,
231 .max_uV = 1800000,
232 .apply_uV = true,
233 .valid_modes_mask = REGULATOR_MODE_NORMAL
234 | REGULATOR_MODE_STANDBY,
235 .valid_ops_mask = REGULATOR_CHANGE_MODE
236 | REGULATOR_CHANGE_STATUS,
237 },
238};
239
240static struct regulator_init_data omap4_panda_vdac = {
241 .constraints = {
242 .min_uV = 1800000,
243 .max_uV = 1800000,
244 .apply_uV = true,
245 .valid_modes_mask = REGULATOR_MODE_NORMAL
246 | REGULATOR_MODE_STANDBY,
247 .valid_ops_mask = REGULATOR_CHANGE_MODE
248 | REGULATOR_CHANGE_STATUS,
249 },
250};
251
252static struct regulator_init_data omap4_panda_vusb = {
253 .constraints = {
254 .min_uV = 3300000,
255 .max_uV = 3300000,
256 .apply_uV = true,
257 .valid_modes_mask = REGULATOR_MODE_NORMAL
258 | REGULATOR_MODE_STANDBY,
259 .valid_ops_mask = REGULATOR_CHANGE_MODE
260 | REGULATOR_CHANGE_STATUS,
261 },
262};
263
264static struct twl4030_platform_data omap4_panda_twldata = {
265 .irq_base = TWL6030_IRQ_BASE,
266 .irq_end = TWL6030_IRQ_END,
267
268 /* Regulators */
269 .vmmc = &omap4_panda_vmmc,
270 .vpp = &omap4_panda_vpp,
271 .vusim = &omap4_panda_vusim,
272 .vana = &omap4_panda_vana,
273 .vcxio = &omap4_panda_vcxio,
274 .vdac = &omap4_panda_vdac,
275 .vusb = &omap4_panda_vusb,
276 .vaux1 = &omap4_panda_vaux1,
277 .vaux2 = &omap4_panda_vaux2,
278 .vaux3 = &omap4_panda_vaux3,
279};
280
281static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
282 {
283 I2C_BOARD_INFO("twl6030", 0x48),
284 .flags = I2C_CLIENT_WAKE,
285 .irq = OMAP44XX_IRQ_SYS_1N,
286 .platform_data = &omap4_panda_twldata,
287 },
288};
289static int __init omap4_panda_i2c_init(void)
290{
291 /*
292 * Phoenix Audio IC needs I2C1 to
293 * start with 400 KHz or less
294 */
295 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
296 ARRAY_SIZE(omap4_panda_i2c_boardinfo));
297 omap_register_i2c_bus(2, 400, NULL, 0);
298 omap_register_i2c_bus(3, 400, NULL, 0);
299 omap_register_i2c_bus(4, 400, NULL, 0);
300 return 0;
301}
302static void __init omap4_panda_init(void)
303{
David Andersb075f582010-08-02 13:18:05 +0300304 omap4_panda_i2c_init();
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -0700305 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
David Andersb075f582010-08-02 13:18:05 +0300306 omap_serial_init();
307 omap4_twl6030_hsmmc_init(mmc);
308 /* OMAP4 Panda uses internal transceiver so register nop transceiver */
309 usb_nop_xceiv_register();
310 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
311 if (!cpu_is_omap44xx())
312 usb_musb_init(&musb_board_data);
313}
314
315static void __init omap4_panda_map_io(void)
316{
317 omap2_set_globals_443x();
318 omap44xx_map_common_io();
319}
320
321MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
322 /* Maintainer: David Anders - Texas Instruments Inc */
323 .phys_io = 0x48000000,
324 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
325 .boot_params = 0x80000100,
326 .map_io = omap4_panda_map_io,
327 .init_irq = omap4_panda_init_irq,
328 .init_machine = omap4_panda_init,
329 .timer = &omap_timer,
330MACHINE_END