blob: c03d1d56db562b1d4ef9f6fb86ce3da44d7d360e [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>
23#include <linux/gpio.h>
24#include <linux/usb/otg.h>
25#include <linux/i2c/twl.h>
26#include <linux/regulator/machine.h>
27
28#include <mach/hardware.h>
29#include <mach/omap4-common.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
34#include <plat/board.h>
35#include <plat/common.h>
36#include <plat/control.h>
37#include <plat/timer-gp.h>
38#include <plat/usb.h>
39#include <plat/mmc.h>
40#include "hsmmc.h"
41
42
43static void __init omap4_panda_init_irq(void)
44{
45 omap2_init_common_hw(NULL, NULL);
46 gic_init_irq();
47 omap_gpio_init();
48}
49
50static struct omap_musb_board_data musb_board_data = {
51 .interface_type = MUSB_INTERFACE_UTMI,
52 .mode = MUSB_PERIPHERAL,
53 .power = 100,
54};
55
56static struct omap2_hsmmc_info mmc[] = {
57 {
58 .mmc = 1,
59 .wires = 8,
60 .gpio_wp = -EINVAL,
61 },
62 {} /* Terminator */
63};
64
65static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
66 {
67 .supply = "vmmc",
68 .dev_name = "mmci-omap-hs.0",
69 },
70 {
71 .supply = "vmmc",
72 .dev_name = "mmci-omap-hs.1",
73 },
74};
75
76static int omap4_twl6030_hsmmc_late_init(struct device *dev)
77{
78 int ret = 0;
79 struct platform_device *pdev = container_of(dev,
80 struct platform_device, dev);
81 struct omap_mmc_platform_data *pdata = dev->platform_data;
82
83 /* Setting MMC1 Card detect Irq */
84 if (pdev->id == 0)
85 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
86 MMCDETECT_INTR_OFFSET;
87 return ret;
88}
89
90static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
91{
92 struct omap_mmc_platform_data *pdata = dev->platform_data;
93
94 pdata->init = omap4_twl6030_hsmmc_late_init;
95}
96
97static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
98{
99 struct omap2_hsmmc_info *c;
100
101 omap2_hsmmc_init(controllers);
102 for (c = controllers; c->mmc; c++)
103 omap4_twl6030_hsmmc_set_late_init(c->dev);
104
105 return 0;
106}
107
108static struct regulator_init_data omap4_panda_vaux1 = {
109 .constraints = {
110 .min_uV = 1000000,
111 .max_uV = 3000000,
112 .apply_uV = true,
113 .valid_modes_mask = REGULATOR_MODE_NORMAL
114 | REGULATOR_MODE_STANDBY,
115 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
116 | REGULATOR_CHANGE_MODE
117 | REGULATOR_CHANGE_STATUS,
118 },
119};
120
121static struct regulator_init_data omap4_panda_vaux2 = {
122 .constraints = {
123 .min_uV = 1200000,
124 .max_uV = 2800000,
125 .apply_uV = true,
126 .valid_modes_mask = REGULATOR_MODE_NORMAL
127 | REGULATOR_MODE_STANDBY,
128 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
129 | REGULATOR_CHANGE_MODE
130 | REGULATOR_CHANGE_STATUS,
131 },
132};
133
134static struct regulator_init_data omap4_panda_vaux3 = {
135 .constraints = {
136 .min_uV = 1000000,
137 .max_uV = 3000000,
138 .apply_uV = true,
139 .valid_modes_mask = REGULATOR_MODE_NORMAL
140 | REGULATOR_MODE_STANDBY,
141 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
142 | REGULATOR_CHANGE_MODE
143 | REGULATOR_CHANGE_STATUS,
144 },
145};
146
147/* VMMC1 for MMC1 card */
148static struct regulator_init_data omap4_panda_vmmc = {
149 .constraints = {
150 .min_uV = 1200000,
151 .max_uV = 3000000,
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 .num_consumer_supplies = 2,
160 .consumer_supplies = omap4_panda_vmmc_supply,
161};
162
163static struct regulator_init_data omap4_panda_vpp = {
164 .constraints = {
165 .min_uV = 1800000,
166 .max_uV = 2500000,
167 .apply_uV = true,
168 .valid_modes_mask = REGULATOR_MODE_NORMAL
169 | REGULATOR_MODE_STANDBY,
170 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
171 | REGULATOR_CHANGE_MODE
172 | REGULATOR_CHANGE_STATUS,
173 },
174};
175
176static struct regulator_init_data omap4_panda_vusim = {
177 .constraints = {
178 .min_uV = 1200000,
179 .max_uV = 2900000,
180 .apply_uV = true,
181 .valid_modes_mask = REGULATOR_MODE_NORMAL
182 | REGULATOR_MODE_STANDBY,
183 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
184 | REGULATOR_CHANGE_MODE
185 | REGULATOR_CHANGE_STATUS,
186 },
187};
188
189static struct regulator_init_data omap4_panda_vana = {
190 .constraints = {
191 .min_uV = 2100000,
192 .max_uV = 2100000,
193 .apply_uV = true,
194 .valid_modes_mask = REGULATOR_MODE_NORMAL
195 | REGULATOR_MODE_STANDBY,
196 .valid_ops_mask = REGULATOR_CHANGE_MODE
197 | REGULATOR_CHANGE_STATUS,
198 },
199};
200
201static struct regulator_init_data omap4_panda_vcxio = {
202 .constraints = {
203 .min_uV = 1800000,
204 .max_uV = 1800000,
205 .apply_uV = true,
206 .valid_modes_mask = REGULATOR_MODE_NORMAL
207 | REGULATOR_MODE_STANDBY,
208 .valid_ops_mask = REGULATOR_CHANGE_MODE
209 | REGULATOR_CHANGE_STATUS,
210 },
211};
212
213static struct regulator_init_data omap4_panda_vdac = {
214 .constraints = {
215 .min_uV = 1800000,
216 .max_uV = 1800000,
217 .apply_uV = true,
218 .valid_modes_mask = REGULATOR_MODE_NORMAL
219 | REGULATOR_MODE_STANDBY,
220 .valid_ops_mask = REGULATOR_CHANGE_MODE
221 | REGULATOR_CHANGE_STATUS,
222 },
223};
224
225static struct regulator_init_data omap4_panda_vusb = {
226 .constraints = {
227 .min_uV = 3300000,
228 .max_uV = 3300000,
229 .apply_uV = true,
230 .valid_modes_mask = REGULATOR_MODE_NORMAL
231 | REGULATOR_MODE_STANDBY,
232 .valid_ops_mask = REGULATOR_CHANGE_MODE
233 | REGULATOR_CHANGE_STATUS,
234 },
235};
236
237static struct twl4030_platform_data omap4_panda_twldata = {
238 .irq_base = TWL6030_IRQ_BASE,
239 .irq_end = TWL6030_IRQ_END,
240
241 /* Regulators */
242 .vmmc = &omap4_panda_vmmc,
243 .vpp = &omap4_panda_vpp,
244 .vusim = &omap4_panda_vusim,
245 .vana = &omap4_panda_vana,
246 .vcxio = &omap4_panda_vcxio,
247 .vdac = &omap4_panda_vdac,
248 .vusb = &omap4_panda_vusb,
249 .vaux1 = &omap4_panda_vaux1,
250 .vaux2 = &omap4_panda_vaux2,
251 .vaux3 = &omap4_panda_vaux3,
252};
253
254static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
255 {
256 I2C_BOARD_INFO("twl6030", 0x48),
257 .flags = I2C_CLIENT_WAKE,
258 .irq = OMAP44XX_IRQ_SYS_1N,
259 .platform_data = &omap4_panda_twldata,
260 },
261};
262static int __init omap4_panda_i2c_init(void)
263{
264 /*
265 * Phoenix Audio IC needs I2C1 to
266 * start with 400 KHz or less
267 */
268 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
269 ARRAY_SIZE(omap4_panda_i2c_boardinfo));
270 omap_register_i2c_bus(2, 400, NULL, 0);
271 omap_register_i2c_bus(3, 400, NULL, 0);
272 omap_register_i2c_bus(4, 400, NULL, 0);
273 return 0;
274}
275static void __init omap4_panda_init(void)
276{
277 int status;
278
279 omap4_panda_i2c_init();
280 omap_serial_init();
281 omap4_twl6030_hsmmc_init(mmc);
282 /* OMAP4 Panda uses internal transceiver so register nop transceiver */
283 usb_nop_xceiv_register();
284 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
285 if (!cpu_is_omap44xx())
286 usb_musb_init(&musb_board_data);
287}
288
289static void __init omap4_panda_map_io(void)
290{
291 omap2_set_globals_443x();
292 omap44xx_map_common_io();
293}
294
295MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
296 /* Maintainer: David Anders - Texas Instruments Inc */
297 .phys_io = 0x48000000,
298 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
299 .boot_params = 0x80000100,
300 .map_io = omap4_panda_map_io,
301 .init_irq = omap4_panda_init_irq,
302 .init_machine = omap4_panda_init,
303 .timer = &omap_timer,
304MACHINE_END