|
27 | 27 | #include <linux/io.h> |
28 | 28 | #include <linux/input/matrix_keypad.h> |
29 | 29 | #include <linux/mfd/menelaus.h> |
| 30 | +#include <linux/omap-dma.h> |
30 | 31 |
|
31 | 32 | #include <asm/mach-types.h> |
32 | 33 | #include <asm/mach/arch.h> |
33 | 34 | #include <asm/mach/map.h> |
34 | 35 |
|
35 | | -#include <linux/omap-dma.h> |
36 | | -#include <plat/debug-devices.h> |
37 | | - |
38 | 36 | #include <video/omapdss.h> |
39 | 37 | #include <video/omap-panel-generic-dpi.h> |
40 | 38 |
|
41 | 39 | #include "common.h" |
42 | 40 | #include "mux.h" |
43 | 41 | #include "control.h" |
44 | 42 | #include "gpmc.h" |
| 43 | +#include "gpmc-smc91x.h" |
45 | 44 |
|
46 | 45 | #define H4_FLASH_CS 0 |
47 | | -#define H4_SMC91X_CS 1 |
48 | | - |
49 | | -#define H4_ETHR_GPIO_IRQ 92 |
50 | 46 |
|
51 | 47 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
52 | 48 | static const uint32_t board_matrix_keys[] = { |
@@ -250,71 +246,31 @@ static u32 is_gpmc_muxed(void) |
250 | 246 | return 0; |
251 | 247 | } |
252 | 248 |
|
253 | | -static inline void __init h4_init_debug(void) |
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; |
| 249 | +#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) |
261 | 250 |
|
262 | | - gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ |
263 | | - if (IS_ERR(gpmc_fck)) { |
264 | | - WARN_ON(1); |
265 | | - return; |
266 | | - } |
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); |
| 251 | +static struct omap_smc91x_platform_data board_smc91x_data = { |
| 252 | + .cs = 1, |
| 253 | + .gpio_irq = 92, |
| 254 | + .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL, |
| 255 | +}; |
272 | 256 |
|
| 257 | +static void __init board_smc91x_init(void) |
| 258 | +{ |
273 | 259 | if (is_gpmc_muxed()) |
274 | | - muxed = 0x200; |
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 | | - } |
| 260 | + board_smc91x_data.flags |= GPMC_MUX_ADD_DATA; |
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); |
310 | | - if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0) |
311 | | - gpmc_cs_free(eth_cs); |
| 266 | +#else |
312 | 267 |
|
313 | | -out: |
314 | | - clk_disable_unprepare(gpmc_fck); |
315 | | - clk_put(gpmc_fck); |
| 268 | +static inline void board_smc91x_init(void) |
| 269 | +{ |
316 | 270 | } |
317 | 271 |
|
| 272 | +#endif |
| 273 | + |
318 | 274 | static void __init h4_init_flash(void) |
319 | 275 | { |
320 | 276 | unsigned long base; |
@@ -371,6 +327,7 @@ static void __init omap_h4_init(void) |
371 | 327 | omap_serial_init(); |
372 | 328 | omap_sdrc_init(NULL, NULL); |
373 | 329 | h4_init_flash(); |
| 330 | + board_smc91x_init(); |
374 | 331 |
|
375 | 332 | omap_display_init(&h4_dss_data); |
376 | 333 | } |
|
0 commit comments