mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Teresa Gámez" <t.gamez@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/5] devices-gpmc-nand: Add OMAP4 gpmc nand timings
Date: Thu, 15 Mar 2012 13:49:26 +0100	[thread overview]
Message-ID: <1331815767-16220-4-git-send-email-t.gamez@phytec.de> (raw)
In-Reply-To: <1331815767-16220-1-git-send-email-t.gamez@phytec.de>

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-03-15 12:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15 12:49 [PATCH 1/5] pcm049: Update RAM timings Teresa Gámez
2012-03-15 12:49 ` [PATCH 2/5] pcm049: Update muxing Teresa Gámez
2012-03-15 12:49 ` [PATCH 3/5] pcm049: Update GPMC net conf Teresa Gámez
2012-03-15 12:49 ` Teresa Gámez [this message]
2012-03-15 12:49 ` [PATCH 5/5] pcm049_xload_defconfig: activate Thumb-2 support Teresa Gámez
2012-03-15 19:55 ` [PATCH 1/5] pcm049: Update RAM timings Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331815767-16220-4-git-send-email-t.gamez@phytec.de \
    --to=t.gamez@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox