Commit | Line | Data |
---|---|---|
2885f000 SMK |
1 | /* |
2 | * linux/arch/arm/mach-omap2/board-omap3beagle.c | |
3 | * | |
4 | * Copyright (C) 2008 Texas Instruments | |
5 | * | |
6 | * Modified from mach-omap2/board-3430sdp.c | |
7 | * | |
8 | * Initial code: Syed Mohammed Khasim | |
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/delay.h> | |
19 | #include <linux/err.h> | |
20 | #include <linux/clk.h> | |
21 | #include <linux/io.h> | |
22 | #include <linux/leds.h> | |
b8e21308 PU |
23 | #include <linux/pwm.h> |
24 | #include <linux/leds_pwm.h> | |
2885f000 SMK |
25 | #include <linux/gpio.h> |
26 | #include <linux/input.h> | |
27 | #include <linux/gpio_keys.h> | |
e4db1c74 | 28 | #include <linux/pm_opp.h> |
65bf7ca0 | 29 | #include <linux/cpu.h> |
2885f000 SMK |
30 | |
31 | #include <linux/mtd/mtd.h> | |
32 | #include <linux/mtd/partitions.h> | |
33 | #include <linux/mtd/nand.h> | |
3a63833e | 34 | #include <linux/mmc/host.h> |
51482be9 | 35 | #include <linux/usb/phy.h> |
3fa4d734 | 36 | #include <linux/usb/usb_phy_gen_xceiv.h> |
2885f000 | 37 | |
bb3b9d8e | 38 | #include <linux/regulator/machine.h> |
b07682b6 | 39 | #include <linux/i2c/twl.h> |
145d9c94 | 40 | |
2885f000 SMK |
41 | #include <asm/mach-types.h> |
42 | #include <asm/mach/arch.h> | |
43 | #include <asm/mach/map.h> | |
44 | #include <asm/mach/flash.h> | |
45 | ||
a0b38cc4 | 46 | #include <video/omapdss.h> |
a0d8dde9 | 47 | #include <video/omap-panel-data.h> |
2203747c | 48 | #include <linux/platform_data/mtd-nand-omap2.h> |
2885f000 | 49 | |
6d02643d TL |
50 | #include "common.h" |
51 | #include "omap_device.h" | |
52 | #include "gpmc.h" | |
e4c060db | 53 | #include "soc.h" |
ca5742bd | 54 | #include "mux.h" |
d02a900b | 55 | #include "hsmmc.h" |
8743410d | 56 | #include "pm.h" |
2e618261 | 57 | #include "board-flash.h" |
fbd8071c | 58 | #include "common-board-devices.h" |
2885f000 | 59 | |
2e618261 AM |
60 | #define NAND_CS 0 |
61 | ||
b8e21308 PU |
62 | static struct pwm_lookup pwm_lookup[] = { |
63 | /* LEDB -> PMU_STAT */ | |
64 | PWM_LOOKUP("twl-pwmled", 1, "leds_pwm", "beagleboard::pmu_stat"), | |
65 | }; | |
66 | ||
67 | static struct led_pwm pwm_leds[] = { | |
68 | { | |
69 | .name = "beagleboard::pmu_stat", | |
70 | .max_brightness = 127, | |
71 | .pwm_period_ns = 7812500, | |
72 | }, | |
73 | }; | |
74 | ||
75 | static struct led_pwm_platform_data pwm_data = { | |
76 | .num_leds = ARRAY_SIZE(pwm_leds), | |
77 | .leds = pwm_leds, | |
78 | }; | |
79 | ||
80 | static struct platform_device leds_pwm = { | |
81 | .name = "leds_pwm", | |
82 | .id = -1, | |
83 | .dev = { | |
84 | .platform_data = &pwm_data, | |
85 | }, | |
86 | }; | |
87 | ||
954bed04 RN |
88 | /* |
89 | * OMAP3 Beagle revision | |
90 | * Run time detection of Beagle revision is done by reading GPIO. | |
91 | * GPIO ID - | |
92 | * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 | |
93 | * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 | |
94 | * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 | |
5fe8b4c1 JF |
95 | * XMA/XMB = GPIO173, GPIO172, GPIO171: 0 0 0 |
96 | * XMC = GPIO173, GPIO172, GPIO171: 0 1 0 | |
954bed04 RN |
97 | */ |
98 | enum { | |
99 | OMAP3BEAGLE_BOARD_UNKN = 0, | |
100 | OMAP3BEAGLE_BOARD_AXBX, | |
101 | OMAP3BEAGLE_BOARD_C1_3, | |
102 | OMAP3BEAGLE_BOARD_C4, | |
103 | OMAP3BEAGLE_BOARD_XM, | |
5fe8b4c1 | 104 | OMAP3BEAGLE_BOARD_XMC, |
954bed04 RN |
105 | }; |
106 | ||
107 | static u8 omap3_beagle_version; | |
108 | ||
5fe8b4c1 JF |
109 | /* |
110 | * Board-specific configuration | |
111 | * Defaults to BeagleBoard-xMC | |
112 | */ | |
113 | static struct { | |
114 | int mmc1_gpio_wp; | |
cf7dd658 | 115 | bool usb_pwr_level; /* 0 - Active Low, 1 - Active High */ |
aef2b896 | 116 | int dvi_pd_gpio; |
5fe8b4c1 | 117 | int usr_button_gpio; |
1afb82e4 | 118 | int mmc_caps; |
5fe8b4c1 JF |
119 | } beagle_config = { |
120 | .mmc1_gpio_wp = -EINVAL, | |
cf7dd658 | 121 | .usb_pwr_level = 0, |
aef2b896 | 122 | .dvi_pd_gpio = -EINVAL, |
5fe8b4c1 | 123 | .usr_button_gpio = 4, |
1afb82e4 | 124 | .mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
5fe8b4c1 | 125 | }; |
954bed04 | 126 | |
bc593f5d IG |
127 | static struct gpio omap3_beagle_rev_gpios[] __initdata = { |
128 | { 171, GPIOF_IN, "rev_id_0" }, | |
129 | { 172, GPIOF_IN, "rev_id_1" }, | |
130 | { 173, GPIOF_IN, "rev_id_2" }, | |
131 | }; | |
132 | ||
954bed04 RN |
133 | static void __init omap3_beagle_init_rev(void) |
134 | { | |
135 | int ret; | |
136 | u16 beagle_rev = 0; | |
137 | ||
138 | omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP); | |
139 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); | |
140 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); | |
141 | ||
bc593f5d IG |
142 | ret = gpio_request_array(omap3_beagle_rev_gpios, |
143 | ARRAY_SIZE(omap3_beagle_rev_gpios)); | |
144 | if (ret < 0) { | |
145 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | |
146 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | |
147 | return; | |
148 | } | |
954bed04 RN |
149 | |
150 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) | |
151 | | (gpio_get_value(173) << 2); | |
152 | ||
5e2ffc30 TK |
153 | gpio_free_array(omap3_beagle_rev_gpios, |
154 | ARRAY_SIZE(omap3_beagle_rev_gpios)); | |
155 | ||
954bed04 RN |
156 | switch (beagle_rev) { |
157 | case 7: | |
158 | printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); | |
159 | omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; | |
5fe8b4c1 | 160 | beagle_config.mmc1_gpio_wp = 29; |
aef2b896 | 161 | beagle_config.dvi_pd_gpio = 170; |
5fe8b4c1 | 162 | beagle_config.usr_button_gpio = 7; |
954bed04 RN |
163 | break; |
164 | case 6: | |
165 | printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); | |
166 | omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; | |
5fe8b4c1 | 167 | beagle_config.mmc1_gpio_wp = 23; |
aef2b896 | 168 | beagle_config.dvi_pd_gpio = 170; |
5fe8b4c1 | 169 | beagle_config.usr_button_gpio = 7; |
954bed04 RN |
170 | break; |
171 | case 5: | |
172 | printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); | |
173 | omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; | |
5fe8b4c1 | 174 | beagle_config.mmc1_gpio_wp = 23; |
aef2b896 | 175 | beagle_config.dvi_pd_gpio = 170; |
5fe8b4c1 | 176 | beagle_config.usr_button_gpio = 7; |
954bed04 RN |
177 | break; |
178 | case 0: | |
5fe8b4c1 | 179 | printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n"); |
954bed04 | 180 | omap3_beagle_version = OMAP3BEAGLE_BOARD_XM; |
cf7dd658 | 181 | beagle_config.usb_pwr_level = 1; |
1afb82e4 | 182 | beagle_config.mmc_caps &= ~MMC_CAP_8_BIT_DATA; |
5fe8b4c1 JF |
183 | break; |
184 | case 2: | |
185 | printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n"); | |
186 | omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC; | |
1afb82e4 | 187 | beagle_config.mmc_caps &= ~MMC_CAP_8_BIT_DATA; |
954bed04 RN |
188 | break; |
189 | default: | |
190 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); | |
191 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | |
192 | } | |
954bed04 RN |
193 | } |
194 | ||
2885f000 SMK |
195 | static struct mtd_partition omap3beagle_nand_partitions[] = { |
196 | /* All the partition sizes are listed in terms of NAND block size */ | |
197 | { | |
198 | .name = "X-Loader", | |
199 | .offset = 0, | |
200 | .size = 4 * NAND_BLOCK_SIZE, | |
201 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
202 | }, | |
203 | { | |
204 | .name = "U-Boot", | |
205 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ | |
206 | .size = 15 * NAND_BLOCK_SIZE, | |
207 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
208 | }, | |
209 | { | |
210 | .name = "U-Boot Env", | |
211 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */ | |
212 | .size = 1 * NAND_BLOCK_SIZE, | |
213 | }, | |
214 | { | |
215 | .name = "Kernel", | |
216 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ | |
217 | .size = 32 * NAND_BLOCK_SIZE, | |
218 | }, | |
219 | { | |
220 | .name = "File System", | |
221 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ | |
222 | .size = MTDPART_SIZ_FULL, | |
223 | }, | |
224 | }; | |
225 | ||
044d32ff KK |
226 | /* DSS */ |
227 | ||
5302556c TV |
228 | static struct connector_dvi_platform_data beagle_dvi_connector_pdata = { |
229 | .name = "dvi", | |
230 | .source = "tfp410.0", | |
231 | .i2c_bus_num = 3, | |
89747c91 BW |
232 | }; |
233 | ||
5302556c TV |
234 | static struct platform_device beagle_dvi_connector_device = { |
235 | .name = "connector-dvi", | |
236 | .id = 0, | |
237 | .dev.platform_data = &beagle_dvi_connector_pdata, | |
044d32ff KK |
238 | }; |
239 | ||
5302556c TV |
240 | static struct encoder_tfp410_platform_data beagle_tfp410_pdata = { |
241 | .name = "tfp410.0", | |
242 | .source = "dpi.0", | |
243 | .data_lines = 24, | |
244 | .power_down_gpio = -1, | |
245 | }; | |
246 | ||
247 | static struct platform_device beagle_tfp410_device = { | |
248 | .name = "tfp410", | |
249 | .id = 0, | |
250 | .dev.platform_data = &beagle_tfp410_pdata, | |
251 | }; | |
252 | ||
253 | static struct connector_atv_platform_data beagle_tv_pdata = { | |
044d32ff | 254 | .name = "tv", |
5302556c TV |
255 | .source = "venc.0", |
256 | .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO, | |
257 | .invert_polarity = false, | |
044d32ff KK |
258 | }; |
259 | ||
5302556c TV |
260 | static struct platform_device beagle_tv_connector_device = { |
261 | .name = "connector-analog-tv", | |
262 | .id = 0, | |
263 | .dev.platform_data = &beagle_tv_pdata, | |
044d32ff KK |
264 | }; |
265 | ||
266 | static struct omap_dss_board_info beagle_dss_data = { | |
5302556c | 267 | .default_display_name = "dvi", |
044d32ff KK |
268 | }; |
269 | ||
2e12bd7e PW |
270 | #include "sdram-micron-mt46h32m32lf-6.h" |
271 | ||
68ff0423 | 272 | static struct omap2_hsmmc_info mmc[] = { |
90c62bf0 TL |
273 | { |
274 | .mmc = 1, | |
1afb82e4 | 275 | .caps = MMC_CAP_4_BIT_DATA, |
5fe8b4c1 | 276 | .gpio_wp = -EINVAL, |
3b972bf0 | 277 | .deferred = true, |
90c62bf0 TL |
278 | }, |
279 | {} /* Terminator */ | |
280 | }; | |
281 | ||
786b01a8 OD |
282 | static struct regulator_consumer_supply beagle_vmmc1_supply[] = { |
283 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | |
bb3b9d8e DB |
284 | }; |
285 | ||
786b01a8 OD |
286 | static struct regulator_consumer_supply beagle_vsim_supply[] = { |
287 | REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"), | |
bb3b9d8e DB |
288 | }; |
289 | ||
90c62bf0 TL |
290 | static struct gpio_led gpio_leds[]; |
291 | ||
60226717 RQ |
292 | static struct usbhs_phy_data phy_data[] = { |
293 | { | |
294 | .port = 2, | |
295 | .reset_gpio = 147, | |
296 | .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */ | |
297 | .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */ | |
60226717 RQ |
298 | }, |
299 | }; | |
300 | ||
90c62bf0 TL |
301 | static int beagle_twl_gpio_setup(struct device *dev, |
302 | unsigned gpio, unsigned ngpio) | |
303 | { | |
5fe8b4c1 JF |
304 | int r; |
305 | ||
5fe8b4c1 | 306 | mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp; |
90c62bf0 | 307 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
145d9c94 | 308 | mmc[0].gpio_cd = gpio + 0; |
3b972bf0 | 309 | omap_hsmmc_late_init(mmc); |
90c62bf0 | 310 | |
68fc3e15 KK |
311 | /* |
312 | * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active | |
313 | * high / others active low) | |
bc593f5d | 314 | * DVI reset GPIO is different between beagle revisions |
1bd9ef19 | 315 | */ |
5fe8b4c1 JF |
316 | /* Valid for all -xM revisions */ |
317 | if (cpu_is_omap3630()) { | |
bc593f5d IG |
318 | /* |
319 | * gpio + 1 on Xm controls the TFP410's enable line (active low) | |
320 | * gpio + 2 control varies depending on the board rev as below: | |
321 | * P7/P8 revisions(prototype): Camera EN | |
322 | * A2+ revisions (production): LDO (DVI, serial, led blocks) | |
323 | */ | |
324 | r = gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW, | |
325 | "nDVI_PWR_EN"); | |
1bd9ef19 KK |
326 | if (r) |
327 | pr_err("%s: unable to configure nDVI_PWR_EN\n", | |
328 | __func__); | |
aef2b896 RD |
329 | |
330 | beagle_config.dvi_pd_gpio = gpio + 2; | |
331 | ||
bc593f5d | 332 | } else { |
bc593f5d IG |
333 | /* |
334 | * REVISIT: need ehci-omap hooks for external VBUS | |
335 | * power switch and overcurrent detect | |
336 | */ | |
337 | if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) | |
338 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | |
1bd9ef19 | 339 | } |
5302556c TV |
340 | beagle_tfp410_pdata.power_down_gpio = beagle_config.dvi_pd_gpio; |
341 | ||
342 | platform_device_register(&beagle_tfp410_device); | |
343 | platform_device_register(&beagle_dvi_connector_device); | |
344 | platform_device_register(&beagle_tv_connector_device); | |
1bd9ef19 | 345 | |
60226717 RQ |
346 | /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */ |
347 | phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX; | |
348 | phy_data[0].vcc_polarity = beagle_config.usb_pwr_level; | |
bc593f5d | 349 | |
60226717 | 350 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); |
90c62bf0 TL |
351 | return 0; |
352 | } | |
353 | ||
354 | static struct twl4030_gpio_platform_data beagle_gpio_data = { | |
90c62bf0 TL |
355 | .use_leds = true, |
356 | .pullups = BIT(1), | |
357 | .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) | |
358 | | BIT(15) | BIT(16) | BIT(17), | |
359 | .setup = beagle_twl_gpio_setup, | |
360 | }; | |
361 | ||
bb3b9d8e DB |
362 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
363 | static struct regulator_init_data beagle_vmmc1 = { | |
364 | .constraints = { | |
365 | .min_uV = 1850000, | |
366 | .max_uV = 3150000, | |
367 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
368 | | REGULATOR_MODE_STANDBY, | |
369 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
370 | | REGULATOR_CHANGE_MODE | |
371 | | REGULATOR_CHANGE_STATUS, | |
372 | }, | |
786b01a8 OD |
373 | .num_consumer_supplies = ARRAY_SIZE(beagle_vmmc1_supply), |
374 | .consumer_supplies = beagle_vmmc1_supply, | |
bb3b9d8e DB |
375 | }; |
376 | ||
377 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | |
378 | static struct regulator_init_data beagle_vsim = { | |
379 | .constraints = { | |
380 | .min_uV = 1800000, | |
381 | .max_uV = 3000000, | |
382 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
383 | | REGULATOR_MODE_STANDBY, | |
384 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
385 | | REGULATOR_CHANGE_MODE | |
386 | | REGULATOR_CHANGE_STATUS, | |
387 | }, | |
786b01a8 OD |
388 | .num_consumer_supplies = ARRAY_SIZE(beagle_vsim_supply), |
389 | .consumer_supplies = beagle_vsim_supply, | |
bb3b9d8e DB |
390 | }; |
391 | ||
90c62bf0 | 392 | static struct twl4030_platform_data beagle_twldata = { |
90c62bf0 TL |
393 | /* platform_data for children goes here */ |
394 | .gpio = &beagle_gpio_data, | |
bb3b9d8e DB |
395 | .vmmc1 = &beagle_vmmc1, |
396 | .vsim = &beagle_vsim, | |
90c62bf0 TL |
397 | }; |
398 | ||
e3333f48 MP |
399 | static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { |
400 | { | |
401 | I2C_BOARD_INFO("eeprom", 0x50), | |
402 | }, | |
403 | }; | |
404 | ||
90c62bf0 TL |
405 | static int __init omap3_beagle_i2c_init(void) |
406 | { | |
827ed9ae | 407 | omap3_pmic_get_config(&beagle_twldata, |
cdcc966d KM |
408 | TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC | |
409 | TWL_COMMON_PDATA_AUDIO, | |
b252b0ef PU |
410 | TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2); |
411 | ||
412 | beagle_twldata.vpll2->constraints.name = "VDVI"; | |
413 | ||
fbd8071c | 414 | omap3_pmic_init("twl4030", &beagle_twldata); |
8ca7fe26 KK |
415 | /* Bus 3 is attached to the DVI port where devices like the pico DLP |
416 | * projector don't work reliably with 400kHz */ | |
e3333f48 | 417 | omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); |
90c62bf0 TL |
418 | return 0; |
419 | } | |
420 | ||
2885f000 SMK |
421 | static struct gpio_led gpio_leds[] = { |
422 | { | |
423 | .name = "beagleboard::usr0", | |
424 | .default_trigger = "heartbeat", | |
425 | .gpio = 150, | |
426 | }, | |
427 | { | |
428 | .name = "beagleboard::usr1", | |
429 | .default_trigger = "mmc0", | |
430 | .gpio = 149, | |
431 | }, | |
432 | }; | |
433 | ||
434 | static struct gpio_led_platform_data gpio_led_info = { | |
435 | .leds = gpio_leds, | |
436 | .num_leds = ARRAY_SIZE(gpio_leds), | |
437 | }; | |
438 | ||
439 | static struct platform_device leds_gpio = { | |
440 | .name = "leds-gpio", | |
441 | .id = -1, | |
442 | .dev = { | |
443 | .platform_data = &gpio_led_info, | |
444 | }, | |
445 | }; | |
446 | ||
447 | static struct gpio_keys_button gpio_buttons[] = { | |
448 | { | |
449 | .code = BTN_EXTRA, | |
5fe8b4c1 JF |
450 | /* Dynamically assigned depending on board */ |
451 | .gpio = -EINVAL, | |
2885f000 SMK |
452 | .desc = "user", |
453 | .wakeup = 1, | |
454 | }, | |
455 | }; | |
456 | ||
457 | static struct gpio_keys_platform_data gpio_key_info = { | |
458 | .buttons = gpio_buttons, | |
459 | .nbuttons = ARRAY_SIZE(gpio_buttons), | |
460 | }; | |
461 | ||
462 | static struct platform_device keys_gpio = { | |
463 | .name = "gpio-keys", | |
464 | .id = -1, | |
465 | .dev = { | |
466 | .platform_data = &gpio_key_info, | |
467 | }, | |
468 | }; | |
469 | ||
cdcc966d KM |
470 | static struct platform_device madc_hwmon = { |
471 | .name = "twl4030_madc_hwmon", | |
472 | .id = -1, | |
473 | }; | |
474 | ||
2885f000 | 475 | static struct platform_device *omap3_beagle_devices[] __initdata = { |
2885f000 SMK |
476 | &leds_gpio, |
477 | &keys_gpio, | |
cdcc966d | 478 | &madc_hwmon, |
b8e21308 | 479 | &leds_pwm, |
2885f000 SMK |
480 | }; |
481 | ||
42973159 | 482 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
181b250c | 483 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
58a5491c FB |
484 | }; |
485 | ||
ca5742bd TL |
486 | #ifdef CONFIG_OMAP_MUX |
487 | static struct omap_board_mux board_mux[] __initdata = { | |
488 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
489 | }; | |
ca5742bd TL |
490 | #endif |
491 | ||
65bf7ca0 | 492 | static int __init beagle_opp_init(void) |
8743410d NM |
493 | { |
494 | int r = 0; | |
495 | ||
65bf7ca0 KH |
496 | if (!machine_is_omap3_beagle()) |
497 | return 0; | |
498 | ||
499 | /* Initialize the omap3 opp table if not already created. */ | |
500 | r = omap3_opp_init(); | |
c48cd659 | 501 | if (r < 0 && (r != -EEXIST)) { |
8743410d | 502 | pr_err("%s: opp default init failed\n", __func__); |
65bf7ca0 | 503 | return r; |
8743410d NM |
504 | } |
505 | ||
5fe8b4c1 JF |
506 | /* Custom OPP enabled for all xM versions */ |
507 | if (cpu_is_omap3630()) { | |
8c7f6594 | 508 | struct device *mpu_dev, *iva_dev; |
8743410d | 509 | |
65bf7ca0 | 510 | mpu_dev = get_cpu_device(0); |
b1621fc8 | 511 | iva_dev = omap_device_get_by_hwmod_name("iva"); |
8c7f6594 | 512 | |
c27f2de7 | 513 | if (!mpu_dev || IS_ERR(iva_dev)) { |
8743410d | 514 | pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", |
8c7f6594 | 515 | __func__, mpu_dev, iva_dev); |
65bf7ca0 | 516 | return -ENODEV; |
8743410d NM |
517 | } |
518 | /* Enable MPU 1GHz and lower opps */ | |
5d4879cd | 519 | r = dev_pm_opp_enable(mpu_dev, 800000000); |
8743410d NM |
520 | /* TODO: MPU 1GHz needs SR and ABB */ |
521 | ||
522 | /* Enable IVA 800MHz and lower opps */ | |
5d4879cd | 523 | r |= dev_pm_opp_enable(iva_dev, 660000000); |
8743410d NM |
524 | /* TODO: DSP 800MHz needs SR and ABB */ |
525 | if (r) { | |
526 | pr_err("%s: failed to enable higher opp %d\n", | |
527 | __func__, r); | |
528 | /* | |
529 | * Cleanup - disable the higher freqs - we dont care | |
530 | * about the results | |
531 | */ | |
5d4879cd NM |
532 | dev_pm_opp_disable(mpu_dev, 800000000); |
533 | dev_pm_opp_disable(iva_dev, 660000000); | |
8743410d NM |
534 | } |
535 | } | |
65bf7ca0 | 536 | return 0; |
8743410d | 537 | } |
b76c8b19 | 538 | omap_device_initcall(beagle_opp_init); |
8743410d | 539 | |
2885f000 SMK |
540 | static void __init omap3_beagle_init(void) |
541 | { | |
ca5742bd | 542 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
954bed04 | 543 | omap3_beagle_init_rev(); |
d1589f09 | 544 | |
aef2b896 | 545 | if (gpio_is_valid(beagle_config.mmc1_gpio_wp)) |
d1589f09 | 546 | omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT); |
1afb82e4 | 547 | mmc[0].caps = beagle_config.mmc_caps; |
3b972bf0 | 548 | omap_hsmmc_init(mmc); |
d1589f09 | 549 | |
90c62bf0 | 550 | omap3_beagle_i2c_init(); |
5fe8b4c1 JF |
551 | |
552 | gpio_buttons[0].gpio = beagle_config.usr_button_gpio; | |
553 | ||
2885f000 SMK |
554 | platform_add_devices(omap3_beagle_devices, |
555 | ARRAY_SIZE(omap3_beagle_devices)); | |
aef2b896 RD |
556 | if (gpio_is_valid(beagle_config.dvi_pd_gpio)) |
557 | omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT); | |
d5e13227 | 558 | omap_display_init(&beagle_dss_data); |
5302556c | 559 | |
2885f000 | 560 | omap_serial_init(); |
a4ca9dbe TL |
561 | omap_sdrc_init(mt46h32m32lf6_sdrc_params, |
562 | mt46h32m32lf6_sdrc_params); | |
90c62bf0 | 563 | |
51482be9 | 564 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
9e18630b | 565 | usb_musb_init(NULL); |
60226717 | 566 | |
9e64bb1e | 567 | usbhs_init(&usbhs_bdata); |
60226717 | 568 | |
2e618261 AM |
569 | board_nand_init(omap3beagle_nand_partitions, |
570 | ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, | |
571 | NAND_BUSWIDTH_16, NULL); | |
40234bf7 | 572 | omap_twl4030_audio_init("omap3beagle", NULL); |
9fb97412 | 573 | |
e2a346a2 AH |
574 | /* Ensure msecure is mux'd to be able to set the RTC. */ |
575 | omap_mux_init_signal("sys_drm_msecure", OMAP_PIN_OFF_OUTPUT_HIGH); | |
576 | ||
9fb97412 | 577 | /* Ensure SDRC pins are mux'd for self-refresh */ |
4896e394 TL |
578 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
579 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | |
b8e21308 PU |
580 | |
581 | pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup)); | |
2885f000 SMK |
582 | } |
583 | ||
2885f000 SMK |
584 | MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") |
585 | /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */ | |
5e52b435 | 586 | .atag_offset = 0x100, |
71ee7dad | 587 | .reserve = omap_reserve, |
3dc3bad6 | 588 | .map_io = omap3_map_io, |
7b250aff | 589 | .init_early = omap3_init_early, |
be732460 | 590 | .init_irq = omap3_init_irq, |
6b2f55d7 | 591 | .handle_irq = omap3_intc_handle_irq, |
2885f000 | 592 | .init_machine = omap3_beagle_init, |
bbd707ac | 593 | .init_late = omap3_init_late, |
6bb27d73 | 594 | .init_time = omap3_secure_sync32k_timer_init, |
187e3e06 | 595 | .restart = omap3xxx_restart, |
2885f000 | 596 | MACHINE_END |