blob: 921cde3d79e0e838beb935880e2d4b354072ba76 [file] [log] [blame]
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -07001/*
2 * Board support file for OMAP4430 SDP.
3 *
4 * Copyright (C) 2009 Texas Instruments
5 *
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Based on mach-omap2/board-3430sdp.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080020#include <linux/usb/otg.h>
Abraham Arceb2aa5e52010-05-14 12:05:26 -070021#include <linux/spi/spi.h>
Balaji T K6e30a7d2010-05-12 08:27:30 +000022#include <linux/i2c/twl.h>
23#include <linux/regulator/machine.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070024
25#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070026#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070027#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
Tony Lindgrence491cf2009-10-20 09:40:47 -070031#include <plat/board.h>
32#include <plat/common.h>
33#include <plat/control.h>
34#include <plat/timer-gp.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080035#include <plat/usb.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070036
Abraham Arceb2aa5e52010-05-14 12:05:26 -070037#define ETH_KS8851_IRQ 34
38#define ETH_KS8851_POWER_ON 48
39#define ETH_KS8851_QUART 138
40
41static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
42 {
43 .modalias = "ks8851",
44 .bus_num = 1,
45 .chip_select = 0,
46 .max_speed_hz = 24000000,
47 .irq = ETH_KS8851_IRQ,
48 },
49};
50
51static int omap_ethernet_init(void)
52{
53 int status;
54
55 /* Request of GPIO lines */
56
57 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
58 if (status) {
59 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
60 return status;
61 }
62
63 status = gpio_request(ETH_KS8851_QUART, "quart");
64 if (status) {
65 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
66 goto error1;
67 }
68
69 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
70 if (status) {
71 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
72 goto error2;
73 }
74
75 /* Configuration of requested GPIO lines */
76
77 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
78 if (status) {
79 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
80 goto error3;
81 }
82
83 status = gpio_direction_output(ETH_KS8851_QUART, 1);
84 if (status) {
85 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
86 goto error3;
87 }
88
89 status = gpio_direction_input(ETH_KS8851_IRQ);
90 if (status) {
91 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
92 goto error3;
93 }
94
95 return 0;
96
97error3:
98 gpio_free(ETH_KS8851_IRQ);
99error2:
100 gpio_free(ETH_KS8851_QUART);
101error1:
102 gpio_free(ETH_KS8851_POWER_ON);
103 return status;
104}
105
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700106static struct platform_device sdp4430_lcd_device = {
107 .name = "sdp4430_lcd",
108 .id = -1,
109};
110
111static struct platform_device *sdp4430_devices[] __initdata = {
112 &sdp4430_lcd_device,
113};
114
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700115static struct omap_lcd_config sdp4430_lcd_config __initdata = {
116 .ctrl_name = "internal",
117};
118
119static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700120 { OMAP_TAG_LCD, &sdp4430_lcd_config },
121};
122
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700123static void __init omap_4430sdp_init_irq(void)
124{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700125 omap_board_config = sdp4430_config;
126 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600127 omap2_init_common_hw(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700128#ifdef CONFIG_OMAP_32K_TIMER
129 omap2_gp_clockevent_set_gptimer(1);
130#endif
131 gic_init_irq();
132 omap_gpio_init();
133}
134
Maulik Mankadbce06682010-02-17 14:09:32 -0800135static struct omap_musb_board_data musb_board_data = {
136 .interface_type = MUSB_INTERFACE_UTMI,
137 .mode = MUSB_PERIPHERAL,
138 .power = 100,
139};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000140static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
141 {
142 .supply = "vmmc",
143 },
144 {
145 .supply = "vmmc",
146 },
147 {
148 .supply = "vmmc",
149 },
150 {
151 .supply = "vmmc",
152 },
153 {
154 .supply = "vmmc",
155 },
156};
157
158static struct regulator_init_data sdp4430_vaux1 = {
159 .constraints = {
160 .min_uV = 1000000,
161 .max_uV = 3000000,
162 .apply_uV = true,
163 .valid_modes_mask = REGULATOR_MODE_NORMAL
164 | REGULATOR_MODE_STANDBY,
165 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
166 | REGULATOR_CHANGE_MODE
167 | REGULATOR_CHANGE_STATUS,
168 },
169};
170
171static struct regulator_init_data sdp4430_vaux2 = {
172 .constraints = {
173 .min_uV = 1200000,
174 .max_uV = 2800000,
175 .apply_uV = true,
176 .valid_modes_mask = REGULATOR_MODE_NORMAL
177 | REGULATOR_MODE_STANDBY,
178 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
179 | REGULATOR_CHANGE_MODE
180 | REGULATOR_CHANGE_STATUS,
181 },
182};
183
184static struct regulator_init_data sdp4430_vaux3 = {
185 .constraints = {
186 .min_uV = 1000000,
187 .max_uV = 3000000,
188 .apply_uV = true,
189 .valid_modes_mask = REGULATOR_MODE_NORMAL
190 | REGULATOR_MODE_STANDBY,
191 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
192 | REGULATOR_CHANGE_MODE
193 | REGULATOR_CHANGE_STATUS,
194 },
195};
196
197/* VMMC1 for MMC1 card */
198static struct regulator_init_data sdp4430_vmmc = {
199 .constraints = {
200 .min_uV = 1200000,
201 .max_uV = 3000000,
202 .apply_uV = true,
203 .valid_modes_mask = REGULATOR_MODE_NORMAL
204 | REGULATOR_MODE_STANDBY,
205 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
206 | REGULATOR_CHANGE_MODE
207 | REGULATOR_CHANGE_STATUS,
208 },
209 .num_consumer_supplies = 5,
210 .consumer_supplies = sdp4430_vmmc_supply,
211};
212
213static struct regulator_init_data sdp4430_vpp = {
214 .constraints = {
215 .min_uV = 1800000,
216 .max_uV = 2500000,
217 .apply_uV = true,
218 .valid_modes_mask = REGULATOR_MODE_NORMAL
219 | REGULATOR_MODE_STANDBY,
220 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
221 | REGULATOR_CHANGE_MODE
222 | REGULATOR_CHANGE_STATUS,
223 },
224};
225
226static struct regulator_init_data sdp4430_vusim = {
227 .constraints = {
228 .min_uV = 1200000,
229 .max_uV = 2900000,
230 .apply_uV = true,
231 .valid_modes_mask = REGULATOR_MODE_NORMAL
232 | REGULATOR_MODE_STANDBY,
233 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
234 | REGULATOR_CHANGE_MODE
235 | REGULATOR_CHANGE_STATUS,
236 },
237};
238
239static struct regulator_init_data sdp4430_vana = {
240 .constraints = {
241 .min_uV = 2100000,
242 .max_uV = 2100000,
243 .apply_uV = true,
244 .valid_modes_mask = REGULATOR_MODE_NORMAL
245 | REGULATOR_MODE_STANDBY,
246 .valid_ops_mask = REGULATOR_CHANGE_MODE
247 | REGULATOR_CHANGE_STATUS,
248 },
249};
250
251static struct regulator_init_data sdp4430_vcxio = {
252 .constraints = {
253 .min_uV = 1800000,
254 .max_uV = 1800000,
255 .apply_uV = true,
256 .valid_modes_mask = REGULATOR_MODE_NORMAL
257 | REGULATOR_MODE_STANDBY,
258 .valid_ops_mask = REGULATOR_CHANGE_MODE
259 | REGULATOR_CHANGE_STATUS,
260 },
261};
262
263static struct regulator_init_data sdp4430_vdac = {
264 .constraints = {
265 .min_uV = 1800000,
266 .max_uV = 1800000,
267 .apply_uV = true,
268 .valid_modes_mask = REGULATOR_MODE_NORMAL
269 | REGULATOR_MODE_STANDBY,
270 .valid_ops_mask = REGULATOR_CHANGE_MODE
271 | REGULATOR_CHANGE_STATUS,
272 },
273};
274
275static struct regulator_init_data sdp4430_vusb = {
276 .constraints = {
277 .min_uV = 3300000,
278 .max_uV = 3300000,
279 .apply_uV = true,
280 .valid_modes_mask = REGULATOR_MODE_NORMAL
281 | REGULATOR_MODE_STANDBY,
282 .valid_ops_mask = REGULATOR_CHANGE_MODE
283 | REGULATOR_CHANGE_STATUS,
284 },
285};
286
287static struct twl4030_platform_data sdp4430_twldata = {
288 .irq_base = TWL6030_IRQ_BASE,
289 .irq_end = TWL6030_IRQ_END,
290
291 /* Regulators */
292 .vmmc = &sdp4430_vmmc,
293 .vpp = &sdp4430_vpp,
294 .vusim = &sdp4430_vusim,
295 .vana = &sdp4430_vana,
296 .vcxio = &sdp4430_vcxio,
297 .vdac = &sdp4430_vdac,
298 .vusb = &sdp4430_vusb,
299 .vaux1 = &sdp4430_vaux1,
300 .vaux2 = &sdp4430_vaux2,
301 .vaux3 = &sdp4430_vaux3,
302};
303
304static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
305 {
306 I2C_BOARD_INFO("twl6030", 0x48),
307 .flags = I2C_CLIENT_WAKE,
308 .irq = OMAP44XX_IRQ_SYS_1N,
309 .platform_data = &sdp4430_twldata,
310 },
311};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000312static int __init omap4_i2c_init(void)
313{
314 /*
315 * Phoenix Audio IC needs I2C1 to
316 * start with 400 KHz or less
317 */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000318 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
319 ARRAY_SIZE(sdp4430_i2c_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000320 omap_register_i2c_bus(2, 400, NULL, 0);
321 omap_register_i2c_bus(3, 400, NULL, 0);
322 omap_register_i2c_bus(4, 400, NULL, 0);
323 return 0;
324}
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700325static void __init omap_4430sdp_init(void)
326{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700327 int status;
328
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000329 omap4_i2c_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700330 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700331 omap_serial_init();
Maulik Mankadbce06682010-02-17 14:09:32 -0800332 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
333 usb_nop_xceiv_register();
Santosh Shilimkarae46ec772010-02-16 19:29:20 +0530334 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
335 if (!cpu_is_omap44xx())
336 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700337
338 status = omap_ethernet_init();
339 if (status) {
340 pr_err("Ethernet initialization failed: %d\n", status);
341 } else {
342 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
343 spi_register_board_info(sdp4430_spi_board_info,
344 ARRAY_SIZE(sdp4430_spi_board_info));
345 }
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700346}
347
348static void __init omap_4430sdp_map_io(void)
349{
350 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800351 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700352}
353
354MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
355 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
356 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700357 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700358 .boot_params = 0x80000100,
359 .map_io = omap_4430sdp_map_io,
360 .init_irq = omap_4430sdp_init_irq,
361 .init_machine = omap_4430sdp_init,
362 .timer = &omap_timer,
363MACHINE_END