diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-h4.c')
-rw-r--r-- | arch/arm/mach-omap2/board-h4.c | 83 |
1 files changed, 20 insertions, 63 deletions
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 9a3878ec2256..3be1311f9e33 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -27,14 +27,12 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/input/matrix_keypad.h> | 28 | #include <linux/input/matrix_keypad.h> |
29 | #include <linux/mfd/menelaus.h> | 29 | #include <linux/mfd/menelaus.h> |
30 | #include <linux/omap-dma.h> | ||
30 | 31 | ||
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
32 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
33 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
34 | 35 | ||
35 | #include <linux/omap-dma.h> | ||
36 | #include <plat/debug-devices.h> | ||
37 | |||
38 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
39 | #include <video/omap-panel-generic-dpi.h> | 37 | #include <video/omap-panel-generic-dpi.h> |
40 | 38 | ||
@@ -42,11 +40,9 @@ | |||
42 | #include "mux.h" | 40 | #include "mux.h" |
43 | #include "control.h" | 41 | #include "control.h" |
44 | #include "gpmc.h" | 42 | #include "gpmc.h" |
43 | #include "gpmc-smc91x.h" | ||
45 | 44 | ||
46 | #define H4_FLASH_CS 0 | 45 | #define H4_FLASH_CS 0 |
47 | #define H4_SMC91X_CS 1 | ||
48 | |||
49 | #define H4_ETHR_GPIO_IRQ 92 | ||
50 | 46 | ||
51 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) | 47 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
52 | static const uint32_t board_matrix_keys[] = { | 48 | static const uint32_t board_matrix_keys[] = { |
@@ -250,71 +246,31 @@ static u32 is_gpmc_muxed(void) | |||
250 | return 0; | 246 | return 0; |
251 | } | 247 | } |
252 | 248 | ||
253 | static inline void __init h4_init_debug(void) | 249 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) |
254 | { | ||
255 | int eth_cs; | ||
256 | unsigned long cs_mem_base; | ||
257 | unsigned int muxed, rate; | ||
258 | struct clk *gpmc_fck; | ||
259 | |||
260 | eth_cs = H4_SMC91X_CS; | ||
261 | 250 | ||
262 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | 251 | static struct omap_smc91x_platform_data board_smc91x_data = { |
263 | if (IS_ERR(gpmc_fck)) { | 252 | .cs = 1, |
264 | WARN_ON(1); | 253 | .gpio_irq = 92, |
265 | return; | 254 | .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL, |
266 | } | 255 | }; |
267 | |||
268 | clk_prepare_enable(gpmc_fck); | ||
269 | rate = clk_get_rate(gpmc_fck); | ||
270 | clk_disable_unprepare(gpmc_fck); | ||
271 | clk_put(gpmc_fck); | ||
272 | 256 | ||
257 | static void __init board_smc91x_init(void) | ||
258 | { | ||
273 | if (is_gpmc_muxed()) | 259 | if (is_gpmc_muxed()) |
274 | muxed = 0x200; | 260 | board_smc91x_data.flags |= GPMC_MUX_ADD_DATA; |
275 | else | ||
276 | muxed = 0; | ||
277 | |||
278 | /* Make sure CS1 timings are correct */ | ||
279 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, | ||
280 | 0x00011000 | muxed); | ||
281 | |||
282 | if (rate >= 160000000) { | ||
283 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); | ||
284 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); | ||
285 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); | ||
286 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
287 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
288 | } else if (rate >= 130000000) { | ||
289 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
290 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
291 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
292 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
293 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
294 | } else {/* rate = 100000000 */ | ||
295 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
296 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
297 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
298 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
299 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
300 | } | ||
301 | |||
302 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
303 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
304 | goto out; | ||
305 | } | ||
306 | 261 | ||
307 | udelay(100); | 262 | omap_mux_init_gpio(board_smc91x_data.gpio_irq, OMAP_PIN_INPUT); |
263 | gpmc_smc91x_init(&board_smc91x_data); | ||
264 | } | ||
308 | 265 | ||
309 | omap_mux_init_gpio(92, 0); | 266 | #else |
310 | if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0) | ||
311 | gpmc_cs_free(eth_cs); | ||
312 | 267 | ||
313 | out: | 268 | static inline void board_smc91x_init(void) |
314 | clk_disable_unprepare(gpmc_fck); | 269 | { |
315 | clk_put(gpmc_fck); | ||
316 | } | 270 | } |
317 | 271 | ||
272 | #endif | ||
273 | |||
318 | static void __init h4_init_flash(void) | 274 | static void __init h4_init_flash(void) |
319 | { | 275 | { |
320 | unsigned long base; | 276 | unsigned long base; |
@@ -371,6 +327,7 @@ static void __init omap_h4_init(void) | |||
371 | omap_serial_init(); | 327 | omap_serial_init(); |
372 | omap_sdrc_init(NULL, NULL); | 328 | omap_sdrc_init(NULL, NULL); |
373 | h4_init_flash(); | 329 | h4_init_flash(); |
330 | board_smc91x_init(); | ||
374 | 331 | ||
375 | omap_display_init(&h4_dss_data); | 332 | omap_display_init(&h4_dss_data); |
376 | } | 333 | } |