Patchwork [U-Boot,1/3,v5] mtd: move & update nand_ecclayout structure

login
register
mail settings
Submitter Prabhakar Kushwaha
Date Oct. 4, 2013, 8:17 a.m.
Message ID <1380874678-8439-1-git-send-email-prabhakar@freescale.com>
Download mbox | patch
Permalink /patch/280488/
State Superseded
Delegated to: Scott Wood
Headers show

Comments

Prabhakar Kushwaha - Oct. 4, 2013, 8:17 a.m.
nand_ecclayout is present in mtd.h at Linux.
Move this structure to mtd.h to comply with Linux.

Also, increase the ecc placement locations to 640 to suport device having
writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
up to 640 bytes and consequently the maximum ecc placement locations have
also gone up to 640.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
CC: Vipin Kumar <vipin.kumar@st.com>
---
 Changes for v2: Incorporated Scott's comments
 	- move nand_ecclayout to mtd.h
	- updated OOBFREE, ECCPOS max entries

 Changes for v3: Sending as it is
 Changes for v4: Sending as it is
 Changes for v5: Sending as it is
 
 include/linux/mtd/mtd.h |   14 ++++++++++++++
 include/mtd/mtd-abi.h   |   12 ------------
 2 files changed, 14 insertions(+), 12 deletions(-)
Scott Wood - Nov. 15, 2013, 2:25 a.m.
On Fri, Oct 04, 2013 at 01:47:58PM +0530, Prabhakar Kushwaha wrote:
> nand_ecclayout is present in mtd.h at Linux.
> Move this structure to mtd.h to comply with Linux.
> 
> Also, increase the ecc placement locations to 640 to suport device having
> writesize/oobsize of 8KB/640B. This means that the maximum oobsize has gone
> up to 640 bytes and consequently the maximum ecc placement locations have
> also gone up to 640.
> 
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> CC: Vipin Kumar <vipin.kumar@st.com>
> 
> ---
> Changes for v2: Incorporated Scott's comments
>  	- move nand_ecclayout to mtd.h
> 	- updated OOBFREE, ECCPOS max entries
> 
>  Changes for v3: Sending as it is
>  Changes for v4: Sending as it is
>  Changes for v5: Sending as it is
>  
>  include/linux/mtd/mtd.h |   14 ++++++++++++++
>  include/mtd/mtd-abi.h   |   12 ------------
>  2 files changed, 14 insertions(+), 12 deletions(-)

This breaks the tricorder build due to the expanded eccpos violating SPL
size constraints:

Configuring for tricorder board...
make[1]: *** [/tmp/u-boot-arm/spl/u-boot-spl] Error 1
make: *** [/tmp/u-boot-arm/spl/u-boot-spl.bin] Error 2
   text	   data	    bss	    dec	    hex	filename
 352879	  27592	 217888	 598359	  92157	/tmp/u-boot-arm/u-boot
armv7a-ld.bfd: u-boot-spl section `.data' will not fit in region `.sram'
armv7a-ld.bfd: region `.sram' overflowed by 140 bytes
make[1]: *** [/tmp/u-boot-arm/spl/u-boot-spl] Error 1
make: *** [/tmp/u-boot-arm/spl/u-boot-spl.bin] Error 2
make: *** Waiting for unfinished jobs....

-Scott

Patch

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 6f44abd..3a18f8f 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -96,6 +96,20 @@  struct mtd_oob_ops {
 	uint8_t		*oobbuf;
 };
 
+#define MTD_MAX_OOBFREE_ENTRIES	32
+#define MTD_MAX_ECCPOS_ENTRIES	640
+
+/*
+ * ECC layout control structure. Exported to userspace for
+ * diagnosis and to allow creation of raw images
+ */
+struct nand_ecclayout {
+	uint32_t eccbytes;
+	uint32_t eccpos[MTD_MAX_ECCPOS_ENTRIES];
+	uint32_t oobavail;
+	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
+};
+
 struct mtd_info {
 	u_char type;
 	u_int32_t flags;
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index d51c1ab..ac3c298 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -155,18 +155,6 @@  struct nand_oobfree {
 	uint32_t length;
 };
 
-#define MTD_MAX_OOBFREE_ENTRIES	8
-/*
- * ECC layout control structure. Exported to userspace for
- * diagnosis and to allow creation of raw images
- */
-struct nand_ecclayout {
-	uint32_t eccbytes;
-	uint32_t eccpos[128];
-	uint32_t oobavail;
-	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
-};
-
 /**
  * struct mtd_ecc_stats - error correction stats
  *