VAR-SOM-MX6 1GB NAND

From Variscite Wiki
Revision as of 16:43, 2 March 2017 by Eran (talk | contribs) (Created page with "{{PageHeader|VAR-SOM-MX6 1GB NAND flash support}} To use a 1GB NAND flash with erase block size of 512KiB, apply the following U-Boot, Linux and meta-variscite-imx patches:<br...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
VAR-SOM-MX6 1GB NAND flash support

To use a 1GB NAND flash with erase block size of 512KiB, apply the following U-Boot, Linux and meta-variscite-imx patches:

U-Boot:

From cff6d43d19d9a88e4c0b2e98c0bde7d697ef24b5 Mon Sep 17 00:00:00 2001
From: Eran Matityahu <eran.m@variscite.com>
Date: Thu, 2 Mar 2017 12:11:07 +0200
Subject: [PATCH] mx6var_som: nand: Increase mtd0 partition size to 4M

---
 include/configs/mx6var_som.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/configs/mx6var_som.h b/include/configs/mx6var_som.h
index 94d1e9c033..02834db673 100644
--- a/include/configs/mx6var_som.h
+++ b/include/configs/mx6var_som.h
@@ -208,8 +208,8 @@
                "else " \
                        "run bootargs_emmc; " \
                "fi; " \
-               "nand read ${loadaddr} 0x400000 0x800000; " \
-               "nand read ${fdt_addr} 0x3e0000 0x20000; " \
+               "nand read ${loadaddr} 0x600000 0x800000; " \
+               "nand read ${fdt_addr} 0x5e0000 0x20000; " \
                "bootm ${loadaddr} - ${fdt_addr}\0" \
        "mtdids=" MTDIDS_DEFAULT "\0" \
        "mtdparts=" MTDPARTS_DEFAULT "\0"
@@ -379,7 +379,7 @@
 #define CONFIG_ENV_IS_IN_NAND
 /* NAND boot config */
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x200000
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x400000
 #else
 #define CONFIG_ENV_IS_IN_MMC
 #endif
@@ -403,14 +403,14 @@

 /*
  * Partitions layout for NAND is:
- *     mtd0: 2M       (spl) First boot loader
+ *     mtd0: 4M       (spl) First boot loader
  *     mtd1: 2M       (u-boot, dtb)
  *     mtd2: 8M       (kernel)
  *     mtd3: left     (rootfs)
  */
 /* Default mtd partition table */
 #define MTDPARTS_DEFAULT       "mtdparts=nandflash-0:"\
-                                       "2m(spl),"\
+                                       "4m(spl),"\
                                        "2m(u-boot),"\
                                        "8m(kernel),"\
                                        "-(rootfs)"     /* ubifs */
@@ -432,7 +432,7 @@
 #define CONFIG_ENV_OFFSET              (0x3E0000)
 #elif defined(CONFIG_ENV_IS_IN_NAND)
 #undef CONFIG_ENV_SIZE
-#define CONFIG_ENV_OFFSET              (0x180000)
+#define CONFIG_ENV_OFFSET              (0x380000)
 #define CONFIG_ENV_SECT_SIZE           (128 << 10)
 #define CONFIG_ENV_SIZE                        CONFIG_ENV_SECT_SIZE
 #endif
-- 
2.11.0


Linux:

From 756829210fad2a0c45b088d028ebb3b98032023b Mon Sep 17 00:00:00 2001
From: Eran Matityahu <eran.m@variscite.com>
Date: Thu, 2 Mar 2017 12:17:23 +0200
Subject: [PATCH] imx6-var-som: nand: Increase mtd0 partition size to 4M

---
 arch/arm/boot/dts/imx6qdl-var-som.dtsi | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-var-som.dtsi b/arch/arm/boot/dts/imx6qdl-var-som.dtsi
index da34c19815ce..c6c203700534 100644
--- a/arch/arm/boot/dts/imx6qdl-var-som.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-var-som.dtsi
@@ -699,28 +699,28 @@
        pinctrl-0 = <&pinctrl_gpmi_nand_v1>;
        status = "okay";

-       /* a 2 MiB partition */
+       /* a 4 MiB partition */
        partition@0 {
                label = "spl";
-               reg = <0x00000000 0x00200000>;
+               reg = <0x00000000 0x00400000>;
        };

        /* a 2 MiB partition */
        partition@1 {
                label = "bootloader";
-               reg = <0x00200000 0x00200000>;
+               reg = <0x00400000 0x00200000>;
        };

        /* an 8 MiB partition */
        partition@2 {
                label = "kernel";
-               reg = <0x00400000 0x00800000>;
+               reg = <0x00600000 0x00800000>;
        };

-       /* a 1012 MiB partition */
+       /* a 1010 MiB partition */
        partition@3 {
                label = "rootfs";
-               reg = <0x00c00000 0x3f400000>;
+               reg = <0x00e00000 0x3f200000>;
        };
 };

-- 
2.11.0


meta-variscite-imx:

From ac7e8398ace5f34987e2e5f06bc04a60cf27ef0e Mon Sep 17 00:00:00 2001
From: Eran Matityahu <eran.m@variscite.com>
Date: Thu, 2 Mar 2017 17:24:02 +0200
Subject: [PATCH] var-som-mx6: Create UBI image for 1GB NAND flash with 512KiB
 erase blocks

---
 conf/machine/var-som-mx6.conf | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/conf/machine/var-som-mx6.conf b/conf/machine/var-som-mx6.conf
index 8bb4e8c..acb1c5a 100644
--- a/conf/machine/var-som-mx6.conf
+++ b/conf/machine/var-som-mx6.conf
@@ -16,16 +16,16 @@ SERIAL_CONSOLE = "115200 ttymxc0"
 MACHINE_FEATURES += " pci bluetooth touchscreen wifi"

 # UBIFS for Variscite NAND 0.5 GB
-MKUBIFS_ARGS = " -m 2048 -e 124KiB -c 3965 "
-UBINIZE_ARGS = " -m 2048 -p 128KiB -s 2048 -O 2048 "
+#MKUBIFS_ARGS = " -m 2048 -e 124KiB -c 3965 "
+#UBINIZE_ARGS = " -m 2048 -p 128KiB -s 2048 -O 2048 "

 # UBIFS for Variscite NAND 1.0 GB (models with erase block size of 128KiB)
 #MKUBIFS_ARGS = " -m 2048 -e 124KiB -c 7855 "
 #UBINIZE_ARGS = " -m 2048 -p 128KiB -s 2048 -O 2048 "

 # UBIFS for Variscite NAND 1.0 GB (models with erase block size of 512KiB)
-#MKUBIFS_ARGS = " -m 4096 -e 504KiB -c 2000 "
-#UBINIZE_ARGS = " -m 4096 -p 512KiB -s 4096 -O 4096 "
+MKUBIFS_ARGS = " -m 4096 -e 504KiB -c 2000 "
+UBINIZE_ARGS = " -m 4096 -p 512KiB -s 4096 -O 4096 "

 UBI_VOLNAME  = "rootfs"

-- 
2.11.0