>From b82b95ac25605e8dd89bab124fa2902960241759 Mon Sep 17 00:00:00 2001
From: Matthew Fatheree <matthew.fathe...@belkin.com>
Date: Sat, 15 Mar 2014 00:44:58 +0700
Subject: [PATCH 06/30] support NAND device for Mamba board

 - Use kernel command line to define the partition layout.
 - Add Mamba board config. Board specific support will be enabled by
   this flag. The Mamba board should receive the partition table from
kernel argument from U-boot, which is prefixed by "armada-nand". We
cannot change the U-boot environment, so we have to change the pxa3xx
driver to use the "armada-nand" when checking the partition table.
 - Add NAND Layout 2048B page size support for pxa3xx driver.

Signed-off-by: Matthew Fatheree <matthew.fathe...@belkin.com>
---
 target/linux/mvebu/config-3.10                     |    5 +++
 .../0303-ARM-mvebu-mamba-add-mach-def.patch        |   14 +++++++
 ...0304-ARM-mvebu-nand-2048-pagesize-support.patch |   39 ++++++++++++++++++++
 .../0305-ARM-mvebu-nand-mamba-nand-support.patch   |   16 ++++++++
 4 files changed, 74 insertions(+)
 create mode 100644 
target/linux/mvebu/patches-3.10/0303-ARM-mvebu-mamba-add-mach-def.patch
 create mode 100644 
target/linux/mvebu/patches-3.10/0304-ARM-mvebu-nand-2048-pagesize-support.patch
 create mode 100644 
target/linux/mvebu/patches-3.10/0305-ARM-mvebu-nand-mamba-nand-support.patch

diff --git a/target/linux/mvebu/config-3.10 b/target/linux/mvebu/config-3.10
index 1317e22..2d6ec37 100644
--- a/target/linux/mvebu/config-3.10
+++ b/target/linux/mvebu/config-3.10
@@ -161,6 +161,7 @@ CONFIG_LOG_BUF_SHIFT=14
 CONFIG_M25PXX_USE_FAST_READ=y
 CONFIG_MACH_ARMADA_370=y
 CONFIG_MACH_ARMADA_370_XP=y
+CONFIG_MACH_ARMADA_MAMBA=y
 CONFIG_MACH_ARMADA_XP=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_MARVELL_PHY=y
@@ -170,13 +171,17 @@ CONFIG_MIGHT_HAVE_PCI=y
 CONFIG_MODULES_USE_ELF_REL=y
 CONFIG_MSDOS_FS=y
 CONFIG_MTD_CFI_STAA=y
+CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_NAND_PXA3xx=y
 CONFIG_MTD_OF_PARTS=y
 CONFIG_MTD_PHYSMAP_OF=y
+# CONFIG_MTD_ROOTFS_ROOT_DEV is not set
+# CONFIG_MTD_ROOTFS_SPLIT is not set
 # CONFIG_MTD_SM_COMMON is not set
+# CONFIG_MTD_SPLIT is not set
 CONFIG_MULTI_IRQ_HANDLER=y
 CONFIG_MUTEX_SPIN_ON_OWNER=y
 CONFIG_MVEBU_CLK_CORE=y
diff --git 
a/target/linux/mvebu/patches-3.10/0303-ARM-mvebu-mamba-add-mach-def.patch 
b/target/linux/mvebu/patches-3.10/0303-ARM-mvebu-mamba-add-mach-def.patch
new file mode 100644
index 0000000..3ca2dd1
--- /dev/null
+++ b/target/linux/mvebu/patches-3.10/0303-ARM-mvebu-mamba-add-mach-def.patch
@@ -0,0 +1,14 @@
+--- a/arch/arm/mach-mvebu/Kconfig
++++ b/arch/arm/mach-mvebu/Kconfig
+@@ -49,4 +49,11 @@ config MACH_ARMADA_XP
+
+ endmenu
+
++config MACH_ARMADA_MAMBA
++      bool "Marvell Armada XP Mamba boards"
++      depends on MACH_ARMADA_XP
++      help
++        Support for ARMADA Mamba board. Say Y here if you have such
++        a board.
++
+ endif
diff --git 
a/target/linux/mvebu/patches-3.10/0304-ARM-mvebu-nand-2048-pagesize-support.patch
 
b/target/linux/mvebu/patches-3.10/0304-ARM-mvebu-nand-2048-pagesize-support.patch
new file mode 100644
index 0000000..e8ac41f
--- /dev/null
+++ 
b/target/linux/mvebu/patches-3.10/0304-ARM-mvebu-nand-2048-pagesize-support.patch
@@ -0,0 +1,39 @@
+diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
+index 31aae53..2a7a0b2 100644
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -286,6 +286,16 @@ static struct nand_bbt_descr bbt_mirror_descr = {
+       .pattern = bbt_mirror_pattern
+ };
+
++static struct nand_ecclayout ecc_layout_2KB_bch4bit = {
++      .eccbytes = 32,
++      .eccpos = {
++              32, 33, 34, 35, 36, 37, 38, 39,
++              40, 41, 42, 43, 44, 45, 46, 47,
++              48, 49, 50, 51, 52, 53, 54, 55,
++              56, 57, 58, 59, 60, 61, 62, 63},
++      .oobfree = { {2, 30} }
++};
++
+ static struct nand_ecclayout ecc_layout_4KB_bch4bit = {
+       .eccbytes = 64,
+       .eccpos = {
+@@ -1360,6 +1370,17 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info,
+        * Required ECC: 4-bit correction per 512 bytes
+        * Select: 16-bit correction per 2048 bytes
+        */
++      } else if (strength == 4 && ecc_stepsize == 512 && page_size == 2048) {
++              info->ecc_bch = 1;
++              info->chunk_size = 2048;
++              info->spare_size = 32;
++              info->ecc_size = 32;
++              ecc->mode = NAND_ECC_HW;
++              ecc->size = info->chunk_size;
++              ecc->layout = &ecc_layout_2KB_bch4bit;
++              ecc->strength = 16;
++              return 1;
++
+       } else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) {
+               info->ecc_bch = 1;
+               info->chunk_size = 2048;
diff --git 
a/target/linux/mvebu/patches-3.10/0305-ARM-mvebu-nand-mamba-nand-support.patch 
b/target/linux/mvebu/patches-3.10/0305-ARM-mvebu-nand-mamba-nand-support.patch
new file mode 100644
index 0000000..c144b92
--- /dev/null
+++ 
b/target/linux/mvebu/patches-3.10/0305-ARM-mvebu-nand-mamba-nand-support.patch
@@ -0,0 +1,16 @@
+diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
+index 2a7a0b2..dc9d713 100644
+--- a/drivers/mtd/nand/pxa3xx_nand.c
++++ b/drivers/mtd/nand/pxa3xx_nand.c
+@@ -1776,7 +1776,11 @@ static int pxa3xx_nand_probe(struct platform_device 
*pdev)
+                * parameter. This name cannot be changed or otherwise
+                * user's mtd partitions configuration would get broken.
+                */
++#ifdef CONFIG_MACH_ARMADA_MAMBA
++              mtd->name = "armada-nand";
++#else
+               mtd->name = "pxa3xx_nand-0";
++#endif
+               info->cs = cs;
+               ret = pxa3xx_nand_scan(mtd);
+               if (ret) {
--
1.7.9.5



__________________________________________________________________ Confidential 
This e-mail and any files transmitted with it are the property of Belkin 
International, Inc. and/or its affiliates, are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not one of the named recipients or otherwise have reason 
to believe that you have received this e-mail in error, please notify the 
sender and delete this message immediately from your computer. Any other use, 
retention, dissemination, forwarding, printing or copying of this e-mail is 
strictly prohibited. Pour la version française: 
http://www.belkin.com/email-notice/French.html Für die deutsche Übersetzung: 
http://www.belkin.com/email-notice/German.html 
__________________________________________________________________
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to