From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] ARM OMAP gpmc nand: specify platform data in boards
Date: Thu, 2 Aug 2012 12:10:13 +0200 [thread overview]
Message-ID: <1343902216-13262-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1343902216-13262-1-git-send-email-s.hauer@pengutronix.de>
Instead of passing several options into the nand register function
it is much more straight forward to just pass the platformdata.
While at it, rename the function to omap_add_gpmc_nand_device to
better describe what it does.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/beagle/board.c | 9 +++++++--
arch/arm/boards/pcm049/board.c | 10 ++++++++--
arch/arm/boards/phycard-a-xl2/pca-a-xl2.c | 9 +++++++--
arch/arm/mach-omap/devices-gpmc-nand.c | 24 ++++++------------------
arch/arm/mach-omap/include/mach/gpmc_nand.h | 7 +++----
5 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index 9ddf317..5122817 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -283,6 +283,12 @@ static struct i2c_board_info i2c_devices[] = {
},
};
+static struct gpmc_nand_platform_data nand_plat = {
+ .device_width = 16,
+ .ecc_mode = OMAP_ECC_HAMMING_CODE_HW_ROMCODE,
+ .nand_cfg = &omap3_nand_cfg,
+};
+
static int beagle_mem_init(void)
{
arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
@@ -306,8 +312,7 @@ 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, &omap3_nand_cfg);
+ omap_add_gpmc_nand_device(&nand_plat);
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, 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 5b7854a..09f0d6d 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -94,6 +94,13 @@ static struct i2c_board_info i2c_devices[] = {
},
};
+static struct gpmc_nand_platform_data nand_plat = {
+ .wait_mon_pin = 1,
+ .device_width = 8,
+ .ecc_mode = OMAP_ECC_BCH8_CODE_HW,
+ .nand_cfg = &omap4_nand_cfg,
+};
+
static int pcm049_devices_init(void)
{
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
@@ -107,8 +114,7 @@ static int pcm049_devices_init(void)
pcm049_network_init();
- gpmc_generic_nand_devices_init(0, 8,
- OMAP_ECC_BCH8_CODE_HW, &omap4_nand_cfg);
+ omap_add_gpmc_nand_device(&nand_plat);
#ifdef CONFIG_PARTITION
devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "xload_raw");
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 128cb8f..220f7f4 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -104,6 +104,12 @@ static struct omap_hsmmc_platform_data mmc_device = {
#define OMAP4_MMC1_PBIASLITE_PWRDNZ (1<<22)
#define OMAP4_MMC1_PWRDNZ (1<<26)
+static struct gpmc_nand_platform_data nand_plat = {
+ .device_width = 16,
+ .ecc_mode = OMAP_ECC_BCH8_CODE_HW,
+ .nand_cfg = &omap4_nand_cfg,
+};
+
static int pcaaxl2_devices_init(void)
{
u32 value;
@@ -124,8 +130,7 @@ static int pcaaxl2_devices_init(void)
pcaaxl2_network_init();
- gpmc_generic_nand_devices_init(0, 16,
- OMAP_ECC_BCH8_CODE_HW, &omap4_nand_cfg);
+ omap_add_gpmc_nand_device(&nand_plat);
#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 9d0ab6e..64ca666 100644
--- a/arch/arm/mach-omap/devices-gpmc-nand.c
+++ b/arch/arm/mach-omap/devices-gpmc-nand.c
@@ -39,35 +39,23 @@
#define GPMC_CONF1_VALx8 0x00000800
#define GPMC_CONF1_VALx16 0x00001800
-/** NAND platform specific settings settings */
-static struct gpmc_nand_platform_data nand_plat = {
- .wait_mon_pin = 0,
-};
-
/**
* @brief gpmc_generic_nand_devices_init - init generic nand device
*
* @return success/fail based on device function
*/
-int gpmc_generic_nand_devices_init(int cs, int width,
- enum gpmc_ecc_mode eccmode, struct gpmc_config *nand_cfg)
+int omap_add_gpmc_nand_device(struct gpmc_nand_platform_data *pdata)
{
- nand_plat.cs = cs;
-
- if (width == 16)
- nand_cfg->cfg[0] = GPMC_CONF1_VALx16;
+ if (pdata->device_width == 16)
+ pdata->nand_cfg->cfg[0] = GPMC_CONF1_VALx16;
else
- nand_cfg->cfg[0] = GPMC_CONF1_VALx8;
-
- nand_plat.device_width = width;
- nand_plat.ecc_mode = eccmode;
- nand_plat.priv = nand_cfg;
+ pdata->nand_cfg->cfg[0] = GPMC_CONF1_VALx8;
/* Configure GPMC CS before register */
- gpmc_cs_config(nand_plat.cs, nand_cfg);
+ gpmc_cs_config(pdata->cs, pdata->nand_cfg);
add_generic_device("gpmc_nand", DEVICE_ID_DYNAMIC, NULL, OMAP_GPMC_BASE,
- 1024 * 4, IORESOURCE_MEM, &nand_plat);
+ 1024 * 4, IORESOURCE_MEM, pdata);
return 0;
}
diff --git a/arch/arm/mach-omap/include/mach/gpmc_nand.h b/arch/arm/mach-omap/include/mach/gpmc_nand.h
index 8a6927b..582fb36 100644
--- a/arch/arm/mach-omap/include/mach/gpmc_nand.h
+++ b/arch/arm/mach-omap/include/mach/gpmc_nand.h
@@ -61,12 +61,11 @@ struct gpmc_nand_platform_data {
/* if you like a custom oob use this. */
struct nand_ecclayout *oob;
- /** platform specific private data */
- void *priv;
+ /** gpmc config for nand */
+ struct gpmc_config *nand_cfg;
};
-int gpmc_generic_nand_devices_init(int cs, int width,
- enum gpmc_ecc_mode, struct gpmc_config *nand_cfg);
+int omap_add_gpmc_nand_device(struct gpmc_nand_platform_data *pdata);
extern struct gpmc_config omap3_nand_cfg;
extern struct gpmc_config omap4_nand_cfg;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-08-02 10:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 10:10 [PATCH] OMAP nand Sascha Hauer
2012-08-02 10:10 ` [PATCH 1/5] mtd OMAP NAND: Fix dev_ready handling Sascha Hauer
2012-08-02 10:10 ` Sascha Hauer [this message]
2012-08-02 10:10 ` [PATCH 3/5] mtd OMAP NAND: Use prefetch engine Sascha Hauer
2012-08-02 10:10 ` [PATCH 4/5] mtd nand: implement buswidth detection Sascha Hauer
2012-08-02 10:10 ` [PATCH 5/5] mtd OMAP NAND: implement buswidth autodetection support 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=1343902216-13262-3-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.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