diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-ldp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 97 |
1 files changed, 96 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 1ea59986aa7a..aa6972781e4a 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/spi/ads7846.h> | 23 | #include <linux/spi/ads7846.h> |
24 | #include <linux/i2c/twl4030.h> | ||
24 | 25 | ||
25 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
@@ -38,11 +39,69 @@ | |||
38 | #include <asm/delay.h> | 39 | #include <asm/delay.h> |
39 | #include <mach/control.h> | 40 | #include <mach/control.h> |
40 | 41 | ||
42 | #include "mmc-twl4030.h" | ||
43 | |||
44 | #define SDP3430_SMC91X_CS 3 | ||
45 | |||
46 | static struct resource ldp_smc911x_resources[] = { | ||
47 | [0] = { | ||
48 | .start = OMAP34XX_ETHR_START, | ||
49 | .end = OMAP34XX_ETHR_START + SZ_4K, | ||
50 | .flags = IORESOURCE_MEM, | ||
51 | }, | ||
52 | [1] = { | ||
53 | .start = 0, | ||
54 | .end = 0, | ||
55 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static struct platform_device ldp_smc911x_device = { | ||
60 | .name = "smc911x", | ||
61 | .id = -1, | ||
62 | .num_resources = ARRAY_SIZE(ldp_smc911x_resources), | ||
63 | .resource = ldp_smc911x_resources, | ||
64 | }; | ||
65 | |||
66 | static struct platform_device *ldp_devices[] __initdata = { | ||
67 | &ldp_smc911x_device, | ||
68 | }; | ||
69 | |||
70 | static inline void __init ldp_init_smc911x(void) | ||
71 | { | ||
72 | int eth_cs; | ||
73 | unsigned long cs_mem_base; | ||
74 | int eth_gpio = 0; | ||
75 | |||
76 | eth_cs = LDP_SMC911X_CS; | ||
77 | |||
78 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
79 | printk(KERN_ERR "Failed to request GPMC mem for smc911x\n"); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | ldp_smc911x_resources[0].start = cs_mem_base + 0x0; | ||
84 | ldp_smc911x_resources[0].end = cs_mem_base + 0xf; | ||
85 | udelay(100); | ||
86 | |||
87 | eth_gpio = LDP_SMC911X_GPIO; | ||
88 | |||
89 | ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); | ||
90 | |||
91 | if (omap_request_gpio(eth_gpio) < 0) { | ||
92 | printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n", | ||
93 | eth_gpio); | ||
94 | return; | ||
95 | } | ||
96 | gpio_direction_input(eth_gpio); | ||
97 | } | ||
98 | |||
41 | static void __init omap_ldp_init_irq(void) | 99 | static void __init omap_ldp_init_irq(void) |
42 | { | 100 | { |
43 | omap2_init_common_hw(); | 101 | omap2_init_common_hw(); |
44 | omap_init_irq(); | 102 | omap_init_irq(); |
45 | omap_gpio_init(); | 103 | omap_gpio_init(); |
104 | ldp_init_smc911x(); | ||
46 | } | 105 | } |
47 | 106 | ||
48 | static struct omap_uart_config ldp_uart_config __initdata = { | 107 | static struct omap_uart_config ldp_uart_config __initdata = { |
@@ -53,20 +112,56 @@ static struct omap_board_config_kernel ldp_config[] __initdata = { | |||
53 | { OMAP_TAG_UART, &ldp_uart_config }, | 112 | { OMAP_TAG_UART, &ldp_uart_config }, |
54 | }; | 113 | }; |
55 | 114 | ||
115 | static struct twl4030_gpio_platform_data ldp_gpio_data = { | ||
116 | .gpio_base = OMAP_MAX_GPIO_LINES, | ||
117 | .irq_base = TWL4030_GPIO_IRQ_BASE, | ||
118 | .irq_end = TWL4030_GPIO_IRQ_END, | ||
119 | }; | ||
120 | |||
121 | static struct twl4030_platform_data ldp_twldata = { | ||
122 | .irq_base = TWL4030_IRQ_BASE, | ||
123 | .irq_end = TWL4030_IRQ_END, | ||
124 | |||
125 | /* platform_data for children goes here */ | ||
126 | .gpio = &ldp_gpio_data, | ||
127 | }; | ||
128 | |||
129 | static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { | ||
130 | { | ||
131 | I2C_BOARD_INFO("twl4030", 0x48), | ||
132 | .flags = I2C_CLIENT_WAKE, | ||
133 | .irq = INT_34XX_SYS_NIRQ, | ||
134 | .platform_data = &ldp_twldata, | ||
135 | }, | ||
136 | }; | ||
137 | |||
56 | static int __init omap_i2c_init(void) | 138 | static int __init omap_i2c_init(void) |
57 | { | 139 | { |
58 | omap_register_i2c_bus(1, 2600, NULL, 0); | 140 | omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo, |
141 | ARRAY_SIZE(ldp_i2c_boardinfo)); | ||
59 | omap_register_i2c_bus(2, 400, NULL, 0); | 142 | omap_register_i2c_bus(2, 400, NULL, 0); |
60 | omap_register_i2c_bus(3, 400, NULL, 0); | 143 | omap_register_i2c_bus(3, 400, NULL, 0); |
61 | return 0; | 144 | return 0; |
62 | } | 145 | } |
63 | 146 | ||
147 | static struct twl4030_hsmmc_info mmc[] __initdata = { | ||
148 | { | ||
149 | .mmc = 1, | ||
150 | .wires = 4, | ||
151 | .gpio_cd = -EINVAL, | ||
152 | .gpio_wp = -EINVAL, | ||
153 | }, | ||
154 | {} /* Terminator */ | ||
155 | }; | ||
156 | |||
64 | static void __init omap_ldp_init(void) | 157 | static void __init omap_ldp_init(void) |
65 | { | 158 | { |
66 | omap_i2c_init(); | 159 | omap_i2c_init(); |
160 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); | ||
67 | omap_board_config = ldp_config; | 161 | omap_board_config = ldp_config; |
68 | omap_board_config_size = ARRAY_SIZE(ldp_config); | 162 | omap_board_config_size = ARRAY_SIZE(ldp_config); |
69 | omap_serial_init(); | 163 | omap_serial_init(); |
164 | twl4030_mmc_init(mmc); | ||
70 | } | 165 | } |
71 | 166 | ||
72 | static void __init omap_ldp_map_io(void) | 167 | static void __init omap_ldp_map_io(void) |