diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-05-29 15:03:43 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-05-29 15:03:43 -0400 |
commit | 949abd84cd54ff864efca9df822d1e02a56694ec (patch) | |
tree | 0c0e7696a51e2989f11a37478ff26368cab0e227 /arch/arm/mach-omap2/board-2430sdp.c | |
parent | b0958aed1ea39825439a7848544bfb2e267273b4 (diff) | |
parent | cd07ecc828486e5887113c7dc4d9f9022145811b (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 into devel
Conflicts:
arch/arm/Makefile
Diffstat (limited to 'arch/arm/mach-omap2/board-2430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-2430sdp.c | 114 |
1 files changed, 37 insertions, 77 deletions
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 22143651037e..9c3fdcdf76c3 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
@@ -36,14 +36,12 @@ | |||
36 | #include <mach/common.h> | 36 | #include <mach/common.h> |
37 | #include <mach/gpmc.h> | 37 | #include <mach/gpmc.h> |
38 | #include <mach/usb.h> | 38 | #include <mach/usb.h> |
39 | #include <mach/gpmc-smc91x.h> | ||
39 | 40 | ||
40 | #include "mmc-twl4030.h" | 41 | #include "mmc-twl4030.h" |
41 | 42 | ||
42 | #define SDP2430_CS0_BASE 0x04000000 | 43 | #define SDP2430_CS0_BASE 0x04000000 |
43 | #define SDP2430_FLASH_CS 0 | 44 | #define SECONDARY_LCD_GPIO 147 |
44 | #define SDP2430_SMC91X_CS 5 | ||
45 | |||
46 | #define SDP2430_ETHR_GPIO_IRQ 149 | ||
47 | 45 | ||
48 | static struct mtd_partition sdp2430_partitions[] = { | 46 | static struct mtd_partition sdp2430_partitions[] = { |
49 | /* bootloader (U-Boot, etc) in first sector */ | 47 | /* bootloader (U-Boot, etc) in first sector */ |
@@ -99,100 +97,53 @@ static struct platform_device sdp2430_flash_device = { | |||
99 | .resource = &sdp2430_flash_resource, | 97 | .resource = &sdp2430_flash_resource, |
100 | }; | 98 | }; |
101 | 99 | ||
102 | static struct resource sdp2430_smc91x_resources[] = { | 100 | static struct platform_device sdp2430_lcd_device = { |
103 | [0] = { | 101 | .name = "sdp2430_lcd", |
104 | .start = SDP2430_CS0_BASE, | ||
105 | .end = SDP2430_CS0_BASE + SZ_64M - 1, | ||
106 | .flags = IORESOURCE_MEM, | ||
107 | }, | ||
108 | [1] = { | ||
109 | .start = OMAP_GPIO_IRQ(SDP2430_ETHR_GPIO_IRQ), | ||
110 | .end = OMAP_GPIO_IRQ(SDP2430_ETHR_GPIO_IRQ), | ||
111 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
112 | }, | ||
113 | }; | ||
114 | |||
115 | static struct platform_device sdp2430_smc91x_device = { | ||
116 | .name = "smc91x", | ||
117 | .id = -1, | 102 | .id = -1, |
118 | .num_resources = ARRAY_SIZE(sdp2430_smc91x_resources), | ||
119 | .resource = sdp2430_smc91x_resources, | ||
120 | }; | 103 | }; |
121 | 104 | ||
122 | static struct platform_device *sdp2430_devices[] __initdata = { | 105 | static struct platform_device *sdp2430_devices[] __initdata = { |
123 | &sdp2430_smc91x_device, | ||
124 | &sdp2430_flash_device, | 106 | &sdp2430_flash_device, |
107 | &sdp2430_lcd_device, | ||
125 | }; | 108 | }; |
126 | 109 | ||
127 | static inline void __init sdp2430_init_smc91x(void) | 110 | static struct omap_lcd_config sdp2430_lcd_config __initdata = { |
128 | { | 111 | .ctrl_name = "internal", |
129 | int eth_cs; | 112 | }; |
130 | unsigned long cs_mem_base; | ||
131 | unsigned int rate; | ||
132 | struct clk *gpmc_fck; | ||
133 | 113 | ||
134 | eth_cs = SDP2430_SMC91X_CS; | 114 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) |
135 | 115 | ||
136 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | 116 | static struct omap_smc91x_platform_data board_smc91x_data = { |
137 | if (IS_ERR(gpmc_fck)) { | 117 | .cs = 5, |
138 | WARN_ON(1); | 118 | .gpio_irq = 149, |
139 | return; | 119 | .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 | |
140 | } | 120 | IORESOURCE_IRQ_LOWLEVEL, |
141 | 121 | ||
142 | clk_enable(gpmc_fck); | 122 | }; |
143 | rate = clk_get_rate(gpmc_fck); | ||
144 | |||
145 | /* Make sure CS1 timings are correct, for 2430 always muxed */ | ||
146 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); | ||
147 | |||
148 | if (rate >= 160000000) { | ||
149 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); | ||
150 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); | ||
151 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); | ||
152 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
153 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
154 | } else if (rate >= 130000000) { | ||
155 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
156 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
157 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
158 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
159 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
160 | } else { /* rate = 100000000 */ | ||
161 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
162 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
163 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
164 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
165 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
166 | } | ||
167 | 123 | ||
168 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | 124 | static void __init board_smc91x_init(void) |
169 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | 125 | { |
170 | goto out; | 126 | if (omap_rev() > OMAP3430_REV_ES1_0) |
171 | } | 127 | board_smc91x_data.gpio_irq = 6; |
128 | else | ||
129 | board_smc91x_data.gpio_irq = 29; | ||
172 | 130 | ||
173 | sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300; | 131 | gpmc_smc91x_init(&board_smc91x_data); |
174 | sdp2430_smc91x_resources[0].end = cs_mem_base + 0x30f; | 132 | } |
175 | udelay(100); | ||
176 | 133 | ||
177 | if (gpio_request(SDP2430_ETHR_GPIO_IRQ, "SMC91x irq") < 0) { | 134 | #else |
178 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | ||
179 | SDP2430_ETHR_GPIO_IRQ); | ||
180 | gpmc_cs_free(eth_cs); | ||
181 | goto out; | ||
182 | } | ||
183 | gpio_direction_input(SDP2430_ETHR_GPIO_IRQ); | ||
184 | 135 | ||
185 | out: | 136 | static inline void board_smc91x_init(void) |
186 | clk_disable(gpmc_fck); | 137 | { |
187 | clk_put(gpmc_fck); | ||
188 | } | 138 | } |
189 | 139 | ||
140 | #endif | ||
141 | |||
190 | static void __init omap_2430sdp_init_irq(void) | 142 | static void __init omap_2430sdp_init_irq(void) |
191 | { | 143 | { |
192 | omap2_init_common_hw(NULL); | 144 | omap2_init_common_hw(NULL); |
193 | omap_init_irq(); | 145 | omap_init_irq(); |
194 | omap_gpio_init(); | 146 | omap_gpio_init(); |
195 | sdp2430_init_smc91x(); | ||
196 | } | 147 | } |
197 | 148 | ||
198 | static struct omap_uart_config sdp2430_uart_config __initdata = { | 149 | static struct omap_uart_config sdp2430_uart_config __initdata = { |
@@ -201,6 +152,7 @@ static struct omap_uart_config sdp2430_uart_config __initdata = { | |||
201 | 152 | ||
202 | static struct omap_board_config_kernel sdp2430_config[] = { | 153 | static struct omap_board_config_kernel sdp2430_config[] = { |
203 | {OMAP_TAG_UART, &sdp2430_uart_config}, | 154 | {OMAP_TAG_UART, &sdp2430_uart_config}, |
155 | {OMAP_TAG_LCD, &sdp2430_lcd_config}, | ||
204 | }; | 156 | }; |
205 | 157 | ||
206 | 158 | ||
@@ -248,6 +200,8 @@ static struct twl4030_hsmmc_info mmc[] __initdata = { | |||
248 | 200 | ||
249 | static void __init omap_2430sdp_init(void) | 201 | static void __init omap_2430sdp_init(void) |
250 | { | 202 | { |
203 | int ret; | ||
204 | |||
251 | omap2430_i2c_init(); | 205 | omap2430_i2c_init(); |
252 | 206 | ||
253 | platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); | 207 | platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); |
@@ -256,6 +210,12 @@ static void __init omap_2430sdp_init(void) | |||
256 | omap_serial_init(); | 210 | omap_serial_init(); |
257 | twl4030_mmc_init(mmc); | 211 | twl4030_mmc_init(mmc); |
258 | usb_musb_init(); | 212 | usb_musb_init(); |
213 | board_smc91x_init(); | ||
214 | |||
215 | /* Turn off secondary LCD backlight */ | ||
216 | ret = gpio_request(SECONDARY_LCD_GPIO, "Secondary LCD backlight"); | ||
217 | if (ret == 0) | ||
218 | gpio_direction_output(SECONDARY_LCD_GPIO, 0); | ||
259 | } | 219 | } |
260 | 220 | ||
261 | static void __init omap_2430sdp_map_io(void) | 221 | static void __init omap_2430sdp_map_io(void) |