diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-ldp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 191 |
1 files changed, 47 insertions, 144 deletions
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 00d9b13b01c5..f7d6038075f0 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -22,11 +22,11 @@ | |||
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/spi/ads7846.h> | ||
26 | #include <linux/regulator/machine.h> | 25 | #include <linux/regulator/machine.h> |
27 | #include <linux/i2c/twl.h> | 26 | #include <linux/i2c/twl.h> |
28 | #include <linux/io.h> | 27 | #include <linux/io.h> |
29 | #include <linux/smsc911x.h> | 28 | #include <linux/smsc911x.h> |
29 | #include <linux/mmc/host.h> | ||
30 | 30 | ||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
@@ -41,48 +41,21 @@ | |||
41 | #include <mach/board-zoom.h> | 41 | #include <mach/board-zoom.h> |
42 | 42 | ||
43 | #include <asm/delay.h> | 43 | #include <asm/delay.h> |
44 | #include <plat/control.h> | ||
45 | #include <plat/usb.h> | 44 | #include <plat/usb.h> |
45 | #include <plat/gpmc-smsc911x.h> | ||
46 | 46 | ||
47 | #include "board-flash.h" | ||
47 | #include "mux.h" | 48 | #include "mux.h" |
48 | #include "hsmmc.h" | 49 | #include "hsmmc.h" |
50 | #include "control.h" | ||
51 | #include "common-board-devices.h" | ||
49 | 52 | ||
50 | #define LDP_SMSC911X_CS 1 | 53 | #define LDP_SMSC911X_CS 1 |
51 | #define LDP_SMSC911X_GPIO 152 | 54 | #define LDP_SMSC911X_GPIO 152 |
52 | #define DEBUG_BASE 0x08000000 | 55 | #define DEBUG_BASE 0x08000000 |
53 | #define LDP_ETHR_START DEBUG_BASE | 56 | #define LDP_ETHR_START DEBUG_BASE |
54 | 57 | ||
55 | static struct resource ldp_smsc911x_resources[] = { | 58 | static uint32_t board_keymap[] = { |
56 | [0] = { | ||
57 | .start = LDP_ETHR_START, | ||
58 | .end = LDP_ETHR_START + SZ_4K, | ||
59 | .flags = IORESOURCE_MEM, | ||
60 | }, | ||
61 | [1] = { | ||
62 | .start = 0, | ||
63 | .end = 0, | ||
64 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
65 | }, | ||
66 | }; | ||
67 | |||
68 | static struct smsc911x_platform_config ldp_smsc911x_config = { | ||
69 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
70 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | ||
71 | .flags = SMSC911X_USE_32BIT, | ||
72 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
73 | }; | ||
74 | |||
75 | static struct platform_device ldp_smsc911x_device = { | ||
76 | .name = "smsc911x", | ||
77 | .id = -1, | ||
78 | .num_resources = ARRAY_SIZE(ldp_smsc911x_resources), | ||
79 | .resource = ldp_smsc911x_resources, | ||
80 | .dev = { | ||
81 | .platform_data = &ldp_smsc911x_config, | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | static int board_keymap[] = { | ||
86 | KEY(0, 0, KEY_1), | 59 | KEY(0, 0, KEY_1), |
87 | KEY(1, 0, KEY_2), | 60 | KEY(1, 0, KEY_2), |
88 | KEY(2, 0, KEY_3), | 61 | KEY(2, 0, KEY_3), |
@@ -195,82 +168,16 @@ static struct platform_device ldp_gpio_keys_device = { | |||
195 | }, | 168 | }, |
196 | }; | 169 | }; |
197 | 170 | ||
198 | static int ts_gpio; | 171 | static struct omap_smsc911x_platform_data smsc911x_cfg = { |
199 | 172 | .cs = LDP_SMSC911X_CS, | |
200 | /** | 173 | .gpio_irq = LDP_SMSC911X_GPIO, |
201 | * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq | 174 | .gpio_reset = -EINVAL, |
202 | * | 175 | .flags = SMSC911X_USE_32BIT, |
203 | * @return - void. If request gpio fails then Flag KERN_ERR. | ||
204 | */ | ||
205 | static void ads7846_dev_init(void) | ||
206 | { | ||
207 | if (gpio_request(ts_gpio, "ads7846 irq") < 0) { | ||
208 | printk(KERN_ERR "can't get ads746 pen down GPIO\n"); | ||
209 | return; | ||
210 | } | ||
211 | |||
212 | gpio_direction_input(ts_gpio); | ||
213 | gpio_set_debounce(ts_gpio, 310); | ||
214 | } | ||
215 | |||
216 | static int ads7846_get_pendown_state(void) | ||
217 | { | ||
218 | return !gpio_get_value(ts_gpio); | ||
219 | } | ||
220 | |||
221 | static struct ads7846_platform_data tsc2046_config __initdata = { | ||
222 | .get_pendown_state = ads7846_get_pendown_state, | ||
223 | .keep_vref_on = 1, | ||
224 | }; | ||
225 | |||
226 | static struct omap2_mcspi_device_config tsc2046_mcspi_config = { | ||
227 | .turbo_mode = 0, | ||
228 | .single_channel = 1, /* 0: slave, 1: master */ | ||
229 | }; | ||
230 | |||
231 | static struct spi_board_info ldp_spi_board_info[] __initdata = { | ||
232 | [0] = { | ||
233 | /* | ||
234 | * TSC2046 operates at a max freqency of 2MHz, so | ||
235 | * operate slightly below at 1.5MHz | ||
236 | */ | ||
237 | .modalias = "ads7846", | ||
238 | .bus_num = 1, | ||
239 | .chip_select = 0, | ||
240 | .max_speed_hz = 1500000, | ||
241 | .controller_data = &tsc2046_mcspi_config, | ||
242 | .irq = 0, | ||
243 | .platform_data = &tsc2046_config, | ||
244 | }, | ||
245 | }; | 176 | }; |
246 | 177 | ||
247 | static inline void __init ldp_init_smsc911x(void) | 178 | static inline void __init ldp_init_smsc911x(void) |
248 | { | 179 | { |
249 | int eth_cs; | 180 | gpmc_smsc911x_init(&smsc911x_cfg); |
250 | unsigned long cs_mem_base; | ||
251 | int eth_gpio = 0; | ||
252 | |||
253 | eth_cs = LDP_SMSC911X_CS; | ||
254 | |||
255 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
256 | printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); | ||
257 | return; | ||
258 | } | ||
259 | |||
260 | ldp_smsc911x_resources[0].start = cs_mem_base + 0x0; | ||
261 | ldp_smsc911x_resources[0].end = cs_mem_base + 0xff; | ||
262 | udelay(100); | ||
263 | |||
264 | eth_gpio = LDP_SMSC911X_GPIO; | ||
265 | |||
266 | ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); | ||
267 | |||
268 | if (gpio_request(eth_gpio, "smsc911x irq") < 0) { | ||
269 | printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", | ||
270 | eth_gpio); | ||
271 | return; | ||
272 | } | ||
273 | gpio_direction_input(eth_gpio); | ||
274 | } | 181 | } |
275 | 182 | ||
276 | static struct platform_device ldp_lcd_device = { | 183 | static struct platform_device ldp_lcd_device = { |
@@ -286,14 +193,10 @@ static struct omap_board_config_kernel ldp_config[] __initdata = { | |||
286 | { OMAP_TAG_LCD, &ldp_lcd_config }, | 193 | { OMAP_TAG_LCD, &ldp_lcd_config }, |
287 | }; | 194 | }; |
288 | 195 | ||
289 | static void __init omap_ldp_init_irq(void) | 196 | static void __init omap_ldp_init_early(void) |
290 | { | 197 | { |
291 | omap_board_config = ldp_config; | 198 | omap2_init_common_infrastructure(); |
292 | omap_board_config_size = ARRAY_SIZE(ldp_config); | 199 | omap2_init_common_devices(NULL, NULL); |
293 | omap2_init_common_hw(NULL, NULL); | ||
294 | omap_init_irq(); | ||
295 | omap_gpio_init(); | ||
296 | ldp_init_smsc911x(); | ||
297 | } | 200 | } |
298 | 201 | ||
299 | static struct twl4030_usb_data ldp_usb_data = { | 202 | static struct twl4030_usb_data ldp_usb_data = { |
@@ -329,6 +232,26 @@ static struct regulator_init_data ldp_vmmc1 = { | |||
329 | .consumer_supplies = &ldp_vmmc1_supply, | 232 | .consumer_supplies = &ldp_vmmc1_supply, |
330 | }; | 233 | }; |
331 | 234 | ||
235 | /* ads7846 on SPI */ | ||
236 | static struct regulator_consumer_supply ldp_vaux1_supplies[] = { | ||
237 | REGULATOR_SUPPLY("vcc", "spi1.0"), | ||
238 | }; | ||
239 | |||
240 | /* VAUX1 */ | ||
241 | static struct regulator_init_data ldp_vaux1 = { | ||
242 | .constraints = { | ||
243 | .min_uV = 3000000, | ||
244 | .max_uV = 3000000, | ||
245 | .apply_uV = true, | ||
246 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
247 | | REGULATOR_MODE_STANDBY, | ||
248 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
249 | | REGULATOR_CHANGE_STATUS, | ||
250 | }, | ||
251 | .num_consumer_supplies = ARRAY_SIZE(ldp_vaux1_supplies), | ||
252 | .consumer_supplies = ldp_vaux1_supplies, | ||
253 | }; | ||
254 | |||
332 | static struct twl4030_platform_data ldp_twldata = { | 255 | static struct twl4030_platform_data ldp_twldata = { |
333 | .irq_base = TWL4030_IRQ_BASE, | 256 | .irq_base = TWL4030_IRQ_BASE, |
334 | .irq_end = TWL4030_IRQ_END, | 257 | .irq_end = TWL4030_IRQ_END, |
@@ -337,23 +260,14 @@ static struct twl4030_platform_data ldp_twldata = { | |||
337 | .madc = &ldp_madc_data, | 260 | .madc = &ldp_madc_data, |
338 | .usb = &ldp_usb_data, | 261 | .usb = &ldp_usb_data, |
339 | .vmmc1 = &ldp_vmmc1, | 262 | .vmmc1 = &ldp_vmmc1, |
263 | .vaux1 = &ldp_vaux1, | ||
340 | .gpio = &ldp_gpio_data, | 264 | .gpio = &ldp_gpio_data, |
341 | .keypad = &ldp_kp_twl4030_data, | 265 | .keypad = &ldp_kp_twl4030_data, |
342 | }; | 266 | }; |
343 | 267 | ||
344 | static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { | ||
345 | { | ||
346 | I2C_BOARD_INFO("twl4030", 0x48), | ||
347 | .flags = I2C_CLIENT_WAKE, | ||
348 | .irq = INT_34XX_SYS_NIRQ, | ||
349 | .platform_data = &ldp_twldata, | ||
350 | }, | ||
351 | }; | ||
352 | |||
353 | static int __init omap_i2c_init(void) | 268 | static int __init omap_i2c_init(void) |
354 | { | 269 | { |
355 | omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo, | 270 | omap3_pmic_init("twl4030", &ldp_twldata); |
356 | ARRAY_SIZE(ldp_i2c_boardinfo)); | ||
357 | omap_register_i2c_bus(2, 400, NULL, 0); | 271 | omap_register_i2c_bus(2, 400, NULL, 0); |
358 | omap_register_i2c_bus(3, 400, NULL, 0); | 272 | omap_register_i2c_bus(3, 400, NULL, 0); |
359 | return 0; | 273 | return 0; |
@@ -362,7 +276,7 @@ static int __init omap_i2c_init(void) | |||
362 | static struct omap2_hsmmc_info mmc[] __initdata = { | 276 | static struct omap2_hsmmc_info mmc[] __initdata = { |
363 | { | 277 | { |
364 | .mmc = 1, | 278 | .mmc = 1, |
365 | .wires = 4, | 279 | .caps = MMC_CAP_4_BIT_DATA, |
366 | .gpio_cd = -EINVAL, | 280 | .gpio_cd = -EINVAL, |
367 | .gpio_wp = -EINVAL, | 281 | .gpio_wp = -EINVAL, |
368 | }, | 282 | }, |
@@ -370,7 +284,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
370 | }; | 284 | }; |
371 | 285 | ||
372 | static struct platform_device *ldp_devices[] __initdata = { | 286 | static struct platform_device *ldp_devices[] __initdata = { |
373 | &ldp_smsc911x_device, | ||
374 | &ldp_lcd_device, | 287 | &ldp_lcd_device, |
375 | &ldp_gpio_keys_device, | 288 | &ldp_gpio_keys_device, |
376 | }; | 289 | }; |
@@ -379,16 +292,8 @@ static struct platform_device *ldp_devices[] __initdata = { | |||
379 | static struct omap_board_mux board_mux[] __initdata = { | 292 | static struct omap_board_mux board_mux[] __initdata = { |
380 | { .reg_offset = OMAP_MUX_TERMINATOR }, | 293 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
381 | }; | 294 | }; |
382 | #else | ||
383 | #define board_mux NULL | ||
384 | #endif | 295 | #endif |
385 | 296 | ||
386 | static struct omap_musb_board_data musb_board_data = { | ||
387 | .interface_type = MUSB_INTERFACE_ULPI, | ||
388 | .mode = MUSB_OTG, | ||
389 | .power = 100, | ||
390 | }; | ||
391 | |||
392 | static struct mtd_partition ldp_nand_partitions[] = { | 297 | static struct mtd_partition ldp_nand_partitions[] = { |
393 | /* All the partition sizes are listed in terms of NAND block size */ | 298 | /* All the partition sizes are listed in terms of NAND block size */ |
394 | { | 299 | { |
@@ -424,17 +329,16 @@ static struct mtd_partition ldp_nand_partitions[] = { | |||
424 | static void __init omap_ldp_init(void) | 329 | static void __init omap_ldp_init(void) |
425 | { | 330 | { |
426 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 331 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
332 | omap_board_config = ldp_config; | ||
333 | omap_board_config_size = ARRAY_SIZE(ldp_config); | ||
334 | ldp_init_smsc911x(); | ||
427 | omap_i2c_init(); | 335 | omap_i2c_init(); |
428 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); | 336 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); |
429 | ts_gpio = 54; | 337 | omap_ads7846_init(1, 54, 310, NULL); |
430 | ldp_spi_board_info[0].irq = gpio_to_irq(ts_gpio); | ||
431 | spi_register_board_info(ldp_spi_board_info, | ||
432 | ARRAY_SIZE(ldp_spi_board_info)); | ||
433 | ads7846_dev_init(); | ||
434 | omap_serial_init(); | 338 | omap_serial_init(); |
435 | usb_musb_init(&musb_board_data); | 339 | usb_musb_init(NULL); |
436 | board_nand_init(ldp_nand_partitions, | 340 | board_nand_init(ldp_nand_partitions, |
437 | ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS); | 341 | ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); |
438 | 342 | ||
439 | omap2_hsmmc_init(mmc); | 343 | omap2_hsmmc_init(mmc); |
440 | /* link regulators to MMC adapters */ | 344 | /* link regulators to MMC adapters */ |
@@ -442,12 +346,11 @@ static void __init omap_ldp_init(void) | |||
442 | } | 346 | } |
443 | 347 | ||
444 | MACHINE_START(OMAP_LDP, "OMAP LDP board") | 348 | MACHINE_START(OMAP_LDP, "OMAP LDP board") |
445 | .phys_io = 0x48000000, | ||
446 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, | ||
447 | .boot_params = 0x80000100, | 349 | .boot_params = 0x80000100, |
448 | .map_io = omap3_map_io, | ||
449 | .reserve = omap_reserve, | 350 | .reserve = omap_reserve, |
450 | .init_irq = omap_ldp_init_irq, | 351 | .map_io = omap3_map_io, |
352 | .init_early = omap_ldp_init_early, | ||
353 | .init_irq = omap_init_irq, | ||
451 | .init_machine = omap_ldp_init, | 354 | .init_machine = omap_ldp_init, |
452 | .timer = &omap_timer, | 355 | .timer = &omap_timer, |
453 | MACHINE_END | 356 | MACHINE_END |