From 09af5d9b77b5aa0ecd809d8a13a9b511306e6e1c Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Thu, 25 Jan 2007 16:25:48 -0800 Subject: [PATCH 4/7] ARM: OMAP: cleanup apollon board - Add etherent gpmc handling - Remove unused mux setting - Add MMC switch pin comments Signed-off-by: Kyungmin Park Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/board-apollon.c | 50 ++++++++++++++++++++++++++-------- 1 files changed, 38 insertions(+), 12 deletions(-) --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -187,16 +189,42 @@ static struct platform_device *apollon_devices[] __initdata = { static inline void __init apollon_init_smc91x(void) { unsigned long base; + unsigned int rate; + struct clk *l3ck; + int eth_cs; + + l3ck = clk_get(NULL, "core_l3_ck"); + if (IS_ERR(l3ck)) + rate = 100000000; + else + rate = clk_get_rate(l3ck); + + eth_cs = APOLLON_ETH_CS; /* Make sure CS1 timings are correct */ - GPMC_CONFIG1_1 = 0x00011203; - GPMC_CONFIG2_1 = 0x001f1f01; - GPMC_CONFIG3_1 = 0x00080803; - GPMC_CONFIG4_1 = 0x1c091c09; - GPMC_CONFIG5_1 = 0x041f1f1f; - GPMC_CONFIG6_1 = 0x000004c4; - - if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); + + if (rate >= 160000000) { + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); + } else if (rate >= 130000000) { + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); + } else {/* rate = 100000000 */ + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); + gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); + } + + if (gpmc_cs_request(eth_cs, SZ_16M, &base) < 0) { printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); return; } @@ -208,7 +236,7 @@ static inline void __init apollon_init_smc91x(void) if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", APOLLON_ETHR_GPIO_IRQ); - gpmc_cs_free(APOLLON_ETH_CS); + gpmc_cs_free(eth_cs); return; } omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); @@ -232,6 +260,7 @@ static struct omap_mmc_config apollon_mmc_config __initdata = { .wire4 = 1, .wp_pin = -1, .power_pin = -1, + /* Note: If you want to detect card feature, please assign 37 */ .switch_pin = -1, }, }; @@ -336,9 +365,6 @@ static void __init omap_apollon_init(void) apollon_flash_init(); apollon_usb_init(); - /* REVISIT: where's the correct place */ - omap_cfg_reg(W19_24XX_SYS_NIRQ); - /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */ CONTROL_DEVCONF |= (1 << 24); -- 1.4.4.2