Commit c3b19a6e authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: Use gpmc_cs_get_base_addr for H4 smc91x

Use gpmc_cs_get_base_addr for H4 smc91x
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 17cd565f
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -270,16 +272,78 @@ static struct platform_device *h4_devices[] __initdata = { ...@@ -270,16 +272,78 @@ static struct platform_device *h4_devices[] __initdata = {
&h4_lcd_device, &h4_lcd_device,
}; };
/* 2420 Sysboot setup (2430 is different) */
static u32 get_sysboot_value(void)
{
return (omap_readl(OMAP242X_CONTROL_STATUS) & 0xFFF);
}
/* FIXME: This function should be moved to some other file, gpmc.c? */
/* H4-2420's always used muxed mode, H4-2422's always use non-muxed
*
* Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423
* correctly. The macro needs to look at production_id not just hawkeye.
*/
static u32 is_gpmc_muxed(void)
{
u32 mux;
mux = get_sysboot_value();
if ((mux & 0xF) == 0xd)
return 1; /* NAND config (could be either) */
if (mux & 0x2) /* if mux'ed */
return 1;
else
return 0;
}
#define SMC91X_CS 1
static inline void __init h4_init_smc91x(void) static inline void __init h4_init_smc91x(void)
{ {
int eth_cs;
unsigned int muxed, rate;
struct clk *l3ck;
eth_cs = SMC91X_CS;
l3ck = clk_get(NULL, "core_l3_ck");
if (IS_ERR(l3ck))
rate = 100000000;
else
rate = clk_get_rate(l3ck);
if (is_gpmc_muxed())
muxed = 0x200;
else
muxed = 0;
/* Make sure CS1 timings are correct */ /* Make sure CS1 timings are correct */
GPMC_CONFIG1_1 = 0x00011200; gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1,
GPMC_CONFIG2_1 = 0x001f1f01; 0x00011000 | muxed);
GPMC_CONFIG3_1 = 0x00080803;
GPMC_CONFIG4_1 = 0x1c091c09; if (rate >= 160000000) {
GPMC_CONFIG5_1 = 0x041f1f1f; gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
GPMC_CONFIG6_1 = 0x000004c4; gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
GPMC_CONFIG7_1 = 0x00000f40 | (0x08000000 >> 24); 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);
}
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG7,
0x00000f40 | (0x08000000 >> 24));
udelay(100); udelay(100);
omap_cfg_reg(M15_24XX_GPIO92); omap_cfg_reg(M15_24XX_GPIO92);
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#define __ASM_ARCH_OMAP_H4_H #define __ASM_ARCH_OMAP_H4_H
/* Placeholder for H4 specific defines */ /* Placeholder for H4 specific defines */
/* GPMC CS1 */
#define OMAP24XX_ETHR_START 0x08000300
#define OMAP24XX_ETHR_GPIO_IRQ 92 #define OMAP24XX_ETHR_GPIO_IRQ 92
#define H4_CS0_BASE 0x04000000 #define H4_CS0_BASE 0x04000000
#endif /* __ASM_ARCH_OMAP_H4_H */ #endif /* __ASM_ARCH_OMAP_H4_H */
......
...@@ -20,5 +20,7 @@ ...@@ -20,5 +20,7 @@
#define OMAP24XX_PRCM_BASE (L4_24XX_BASE + 0x8000) #define OMAP24XX_PRCM_BASE (L4_24XX_BASE + 0x8000)
#define OMAP24XX_SDRC_BASE (L3_24XX_BASE + 0x9000) #define OMAP24XX_SDRC_BASE (L3_24XX_BASE + 0x9000)
#define OMAP242X_CONTROL_STATUS (L4_24XX_BASE + 0x2f8)
#endif /* __ASM_ARCH_OMAP24XX_H */ #endif /* __ASM_ARCH_OMAP24XX_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment