[PATCH 4/5] devices-gpmc-nand: Add OMAP4 gpmc nand timings
Teresa Gámez
t.gamez at phytec.de
Thu Mar 15 08:49:26 EDT 2012
Add a OMAP4 specific GMPC nand config for pcm049 and phyCARD-A-XL2 to increase
performance. Also add the possiblility to pass a board GPMC nand config.
Signed-off-by: Teresa Gámez <t.gamez at phytec.de>
---
arch/arm/boards/beagle/board.c | 3 +-
arch/arm/boards/pcm049/board.c | 3 +-
arch/arm/boards/phycard-a-l1/pca-a-l1.c | 2 +-
arch/arm/boards/phycard-a-xl2/pca-a-xl2.c | 4 +-
arch/arm/mach-omap/devices-gpmc-nand.c | 33 ++++----------------------
arch/arm/mach-omap/include/mach/gpmc_nand.h | 6 ++++-
arch/arm/mach-omap/omap3_generic.c | 16 +++++++++++++
arch/arm/mach-omap/omap4_generic.c | 16 +++++++++++++
8 files changed, 49 insertions(+), 34 deletions(-)
diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index faeaf8e..90525d8 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -306,7 +306,8 @@ static int beagle_devices_init(void)
/* WP is made high and WAIT1 active Low */
gpmc_generic_init(0x10);
#endif
- gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE);
+ gpmc_generic_nand_devices_init(0, 16,
+ OMAP_ECC_HAMMING_CODE_HW_ROMCODE, &omap3_nand_cfg);
add_generic_device("omap-hsmmc", -1, NULL, OMAP_MMC1_BASE, SZ_4K,
IORESOURCE_MEM, NULL);
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 4d52155..0c82261 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -106,7 +106,8 @@ static int pcm049_devices_init(void)
pcm049_network_init();
- gpmc_generic_nand_devices_init(0, 8, OMAP_ECC_BCH8_CODE_HW);
+ gpmc_generic_nand_devices_init(0, 8,
+ OMAP_ECC_BCH8_CODE_HW, &omap4_nand_cfg);
#ifdef CONFIG_PARTITION
devfs_add_partition("nand0", 0x00000, SZ_128K, PARTITION_FIXED, "xload_raw");
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index e4f2483..3fc3542 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -332,7 +332,7 @@ static int pcaal1_late_init(void)
{
struct device_d *nand;
- gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_SOFT);
+ gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_SOFT, &omap3_nand_cfg);
nand = get_device_by_name("nand0");
diff --git a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
index 5513661..72fc18f 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -95,7 +95,6 @@ static struct i2c_board_info i2c_devices[] = {
},
};
-
static struct omap_hsmmc_platform_data mmc_device = {
.f_max = 26000000,
};
@@ -125,7 +124,8 @@ static int pcaaxl2_devices_init(void)
pcaaxl2_network_init();
- gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_BCH8_CODE_HW);
+ gpmc_generic_nand_devices_init(0, 16,
+ OMAP_ECC_BCH8_CODE_HW, &omap4_nand_cfg);
#ifdef CONFIG_PARTITION
devfs_add_partition("nand0", 0x00000, SZ_128K,
diff --git a/arch/arm/mach-omap/devices-gpmc-nand.c b/arch/arm/mach-omap/devices-gpmc-nand.c
index 197d4be..54625ca 100644
--- a/arch/arm/mach-omap/devices-gpmc-nand.c
+++ b/arch/arm/mach-omap/devices-gpmc-nand.c
@@ -4,7 +4,6 @@
*
* FileName: arch/arm/boards/omap/devices-gpmc-nand.c
*
- * GPMC NAND Devices such as those from Micron, Samsung are listed here
*/
/*
* (C) Copyright 2006-2008
@@ -39,35 +38,12 @@
#define GPMC_CONF1_VALx8 0x00000800
#define GPMC_CONF1_VALx16 0x00001800
-/* Set up the generic params */
-
-/** GPMC timing for our nand device */
-static struct gpmc_config nand_cfg = {
- .cfg = {
- 0, /*CONF1 */
- 0x00141400, /*CONF2 */
- 0x00141400, /*CONF3 */
- 0x0F010F01, /*CONF4 */
- 0x010C1414, /*CONF5 */
-#ifdef CONFIG_ARCH_OMAP3
- /* Additional bits in OMAP3 */
- 0x1F040000 |
-#endif
- 0x00000A80, /*CONF6 */
- },
-
- /* Nand: dont care about base address */
- .base = 0x28000000,
- /* GPMC address map as small as possible */
- .size = GPMC_SIZE_16M,
-};
/** NAND platform specific settings settings */
static struct gpmc_nand_platform_data nand_plat = {
.cs = 0,
.max_timeout = MSECOND,
.wait_mon_pin = 0,
- .priv = (void *)&nand_cfg,
};
/**
@@ -76,20 +52,21 @@ static struct gpmc_nand_platform_data nand_plat = {
* @return success/fail based on device funtion
*/
int gpmc_generic_nand_devices_init(int cs, int width,
- enum gpmc_ecc_mode eccmode)
+ enum gpmc_ecc_mode eccmode, struct gpmc_config *nand_cfg)
{
nand_plat.cs = cs;
if (width == 16)
- nand_cfg.cfg[0] = GPMC_CONF1_VALx16;
+ nand_cfg->cfg[0] = GPMC_CONF1_VALx16;
else
- nand_cfg.cfg[0] = GPMC_CONF1_VALx8;
+ nand_cfg->cfg[0] = GPMC_CONF1_VALx8;
nand_plat.device_width = width;
nand_plat.ecc_mode = eccmode;
+ nand_plat.priv = nand_cfg;
/* Configure GPMC CS before register */
- gpmc_cs_config(nand_plat.cs, &nand_cfg);
+ gpmc_cs_config(nand_plat.cs, nand_cfg);
add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
IORESOURCE_MEM, &nand_plat);
diff --git a/arch/arm/mach-omap/include/mach/gpmc_nand.h b/arch/arm/mach-omap/include/mach/gpmc_nand.h
index 1bc52ff..b9c659d 100644
--- a/arch/arm/mach-omap/include/mach/gpmc_nand.h
+++ b/arch/arm/mach-omap/include/mach/gpmc_nand.h
@@ -78,6 +78,10 @@ struct gpmc_nand_platform_data {
#define NAND_WAITPOL_HIGH (1 << 0)
#define NAND_WAITPOL_MASK (1 << 0)
-int gpmc_generic_nand_devices_init(int cs, int width, enum gpmc_ecc_mode);
+int gpmc_generic_nand_devices_init(int cs, int width,
+ enum gpmc_ecc_mode, struct gpmc_config *nand_cfg);
+
+extern struct gpmc_config omap3_nand_cfg;
+extern struct gpmc_config omap4_nand_cfg;
#endif /* __ASM_OMAP_NAND_GPMC_H */
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index fe7363a..4ab265a 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -499,3 +499,19 @@ enum omap_boot_src omap3_bootsrc(void)
return OMAP_BOOTSRC_MMC1;
return OMAP_BOOTSRC_UNKNOWN;
}
+
+/* GPMC timing for OMAP3 nand device */
+const struct gpmc_config omap3_nand_cfg = {
+ .cfg = {
+ 0x00000000, /* CONF1 */
+ 0x00141400, /* CONF2 */
+ 0x00141400, /* CONF3 */
+ 0x0F010F01, /* CONF4 */
+ 0x010C1414, /* CONF5 */
+ 0x1F040000 |
+ 0x00000A80, /* CONF6 */
+ },
+ /* GPMC address map as small as possible */
+ .base = 0x28000000,
+ .size = GPMC_SIZE_16M,
+};
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index baa138d..db26a59 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -7,6 +7,7 @@
#include <mach/omap4-clock.h>
#include <mach/syslib.h>
#include <mach/xload.h>
+#include <mach/gpmc.h>
void __noreturn reset_cpu(unsigned long addr)
{
@@ -460,3 +461,18 @@ void omap4_do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
for (i = 0; i < size; i++, pad++)
writew(pad->val, base + pad->offset);
}
+
+/* GPMC timing for OMAP4 nand device */
+const struct gpmc_config omap4_nand_cfg = {
+ .cfg = {
+ 0x00000800, /* CONF1 */
+ 0x00050500, /* CONF2 */
+ 0x00040400, /* CONF3 */
+ 0x03000300, /* CONF4 */
+ 0x00050808, /* CONF5 */
+ 0x00000000, /* CONF6 */
+ },
+ /* GPMC address map as small as possible */
+ .base = 0x28000000,
+ .size = GPMC_SIZE_16M,
+};
--
1.7.0.4
More information about the barebox
mailing list