From: Enric Balletbo i Serra <eballetbo@gmail.com>
To: linux-omap@vger.kernel.org
Cc: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Subject: [PATCHv2 5/8] omap3: Add support for flash on IGEP v2 board
Date: Wed, 18 Nov 2009 21:20:37 +0100 [thread overview]
Message-ID: <1258575640-8169-6-git-send-email-eballetbo@gmail.com> (raw)
In-Reply-To: <1258575640-8169-5-git-send-email-eballetbo@gmail.com>
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
This patch adds support for flashes on IGEP v2 boards. For now
only OneNAND is supported.
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
---
arch/arm/mach-omap2/board-igep0020.c | 101 ++++++++++++++++++++++++++++++++++
1 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index ea4e29f..054bc21 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -29,6 +29,7 @@
#include <plat/gpmc.h>
#include <plat/usb.h>
#include <plat/display.h>
+#include <plat/onenand.h>
#include "mux.h"
#include "mmc-twl4030.h"
@@ -41,6 +42,105 @@
#define IGEP2_GPIO_LED1_RED 28
#define IGEP2_GPIO_DVI_PUP 170
+#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
+ defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
+
+#define ONENAND_MAP 0x20000000
+
+/* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
+ * Since the device is equipped with two DataRAMs, and two-plane NAND
+ * Flash memory array, these two component enables simultaneous program
+ * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
+ * while Plane2 has only odd blocks such as block1, block3, block5.
+ * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
+ */
+
+static struct mtd_partition igep2_onenand_partitions[] = {
+ {
+ .name = "X-Loader",
+ .offset = 0,
+ .size = 2 * (64*(2*2048))
+ },
+ {
+ .name = "U-Boot",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 6 * (64*(2*2048)),
+ },
+ {
+ .name = "Environment",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 2 * (64*(2*2048)),
+ },
+ {
+ .name = "Kernel",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 12 * (64*(2*2048)),
+ },
+ {
+ .name = "File System",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+
+static int igep2_onenand_setup(void __iomem *onenand_base, int freq)
+{
+ /* nothing is required to be setup for onenand as of now */
+ return 0;
+}
+
+static struct omap_onenand_platform_data igep2_onenand_data = {
+ .parts = igep2_onenand_partitions,
+ .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
+ .onenand_setup = igep2_onenand_setup,
+ .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
+};
+
+static struct platform_device igep2_onenand_device = {
+ .name = "omap2-onenand",
+ .id = -1,
+ .dev = {
+ .platform_data = &igep2_onenand_data,
+ },
+};
+
+void __init igep2_flash_init(void)
+{
+ u8 cs = 0;
+ u8 onenandcs = GPMC_CS_NUM + 1;
+
+ while (cs < GPMC_CS_NUM) {
+ u32 ret = 0;
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+
+ /* Check if NAND/oneNAND is configured */
+ if ((ret & 0xC00) == 0x800)
+ /* NAND found */
+ pr_err("IGEP v2: Unsupported NAND found\n");
+ else {
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ if ((ret & 0x3F) == (ONENAND_MAP >> 24))
+ /* ONENAND found */
+ onenandcs = cs;
+ }
+ cs++;
+ }
+ if (onenandcs > GPMC_CS_NUM) {
+ pr_err("IGEP v2: Unable to find configuration in GPMC\n");
+ return;
+ }
+
+ if (onenandcs < GPMC_CS_NUM) {
+ igep2_onenand_data.cs = onenandcs;
+ if (platform_device_register(&igep2_onenand_device) < 0)
+ pr_err("IGEP v2: Unable to register OneNAND device\n");
+ }
+}
+
+#else
+void __init igep2_flash_init(void) {}
+#endif
+
#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
#include <linux/smsc911x.h>
@@ -314,6 +414,7 @@ static void __init igep2_init(void)
usb_musb_init();
usb_ehci_init(&ehci_pdata);
+ igep2_flash_init();
igep2_display_init();
igep2_init_smsc911x();
--
1.5.4.3
next prev parent reply other threads:[~2010-01-13 11:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 20:20 [PATCHv2 0/8] Introduce new features for IGEP v2 board Enric Balletbo i Serra
2009-11-18 20:20 ` [PATCHv2 1/8] omap3: Add platform data for the twl4030_codec MFD on IGEP v2 Enric Balletbo i Serra
2009-11-18 20:20 ` [PATCHv2 2/8] omap3: Fix typo on IGEP v2 board Enric Balletbo i Serra
2009-11-18 20:20 ` [PATCHv2 3/8] omap3: Add platform init code for EHCI driver on IGEP v2 Enric Balletbo i Serra
2009-11-18 20:20 ` [PATCHv2 4/8] omap3: Enable DSS2 for IGEP v2 board Enric Balletbo i Serra
2009-11-18 20:20 ` Enric Balletbo i Serra [this message]
2009-11-18 20:20 ` [PATCHv2 6/8] ARM: OMAP3: SDRC: add timing data for Numonyx M65KxxxxAM Enric Balletbo i Serra
2009-11-18 20:20 ` [PATCHv2 7/8] omap3: Use timing data for omap2_init_common_hw on IGEP v2 Enric Balletbo i Serra
2009-11-18 20:20 ` [PATCHv2 8/8] omap3: Update defconfig for IGEP v2 to allow new drivers and features Enric Balletbo i Serra
2010-02-05 0:22 ` [APPLIED] [PATCHv2 6/8] ARM: OMAP3: SDRC: add timing data for Numonyx Tony Lindgren
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=1258575640-8169-6-git-send-email-eballetbo@gmail.com \
--to=eballetbo@gmail.com \
--cc=eballetbo@iseebcn.com \
--cc=linux-omap@vger.kernel.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