[U-Boot] [PATCH 4/4] arm: bcm: configure NAND device and environment

Steve Rae srae at broadcom.com
Thu Mar 10 23:26:30 CET 2016


Configure the NAND device, define partition sizes, and create
the environment space for Cygnus and NSP boards.

Signed-off-by: Steve Rae <srae at broadcom.com>
---

 arch/arm/include/asm/arch-bcmcygnus/configs.h | 33 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-bcmnsp/configs.h    | 33 +++++++++++++++++++++++++++
 include/configs/bcm_ep_board.h                |  3 ---
 3 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-bcmcygnus/configs.h b/arch/arm/include/asm/arch-bcmcygnus/configs.h
index 40a9f0e..ad94e31 100644
--- a/arch/arm/include/asm/arch-bcmcygnus/configs.h
+++ b/arch/arm/include/asm/arch-bcmcygnus/configs.h
@@ -44,6 +44,39 @@
 #define CONFIG_SYS_NAND_SELF_INIT
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 
+/* Configuration for Micron MT29F8G08ABACA */
+#define CONFIG_NAND_CHIPSIZE		(1 << 30)	/* 1GB */
+#define CONFIG_NAND_BLOCKSIZE		(1 << 18)	/* 256KB */
+#define CONFIG_NAND_PAGE_SHIFT		12		/* 4KiB */
+#define CONFIG_NAND_BLOCK_SHIFT		18		/* 256 KiB */
+
+/* Configure the Environment and the u-boot-env partition */
+#define MTD_PART_BOOT1_SIZE	0x00200000
+#define MTD_PART_GPT_SIZE	0x00100000
+#define MTD_PART_SSB_SIZE	0x00200000
+#define MTD_PART_UBOOT_SIZE	0x00200000
+#define MTD_PART_UBOOT_ENV_SIZE	0x00200000
+#define MTD_PART_DTB_SIZE	0x00100000
+#define MTD_PART_KERNEL_SIZE	0x01000000
+#define MTD_PART_ROOT_SIZE	0x1c000000
+/*
+ * WARNING: When changing the order of the partitions, make sure you update
+ *	    CONFIG_ENV_OFFSET accordingly.
+ */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SIZE		0x2000
+#define CONFIG_ENV_RANGE	(2 * CONFIG_NAND_BLOCKSIZE)
+#define CONFIG_ENV_OFFSET	(MTD_PART_BOOT1_SIZE + MTD_PART_GPT_SIZE + \
+				 MTD_PART_SSB_SIZE + MTD_PART_UBOOT_SIZE)
+#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE)
+/*
+ * Check that the u-boot-env partition is big enough to accomodate the
+ * u-boot environment data and its redundant copy
+ */
+#if ((2 * CONFIG_ENV_RANGE) > MTD_PART_UBOOT_ENV_SIZE)
+#error u-boot-env partition size is to small
+#endif
+
 /* MTD configuration */
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_PARTITIONS
diff --git a/arch/arm/include/asm/arch-bcmnsp/configs.h b/arch/arm/include/asm/arch-bcmnsp/configs.h
index ac4f69e..debccc0 100644
--- a/arch/arm/include/asm/arch-bcmnsp/configs.h
+++ b/arch/arm/include/asm/arch-bcmnsp/configs.h
@@ -30,6 +30,39 @@
 #define CONFIG_SYS_NAND_SELF_INIT
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 
+/* Configuration for Micron MT29F8G08ABACA */
+#define CONFIG_NAND_CHIPSIZE		(1 << 30)	/* 1GB */
+#define CONFIG_NAND_BLOCKSIZE		(1 << 18)	/* 256KB */
+#define CONFIG_NAND_PAGE_SHIFT		12		/* 4KiB */
+#define CONFIG_NAND_BLOCK_SHIFT		18		/* 256 KiB */
+
+/* Configure the Environment and the u-boot-env partition */
+#define MTD_PART_BOOT1_SIZE	0x00200000
+#define MTD_PART_GPT_SIZE	0x00100000
+#define MTD_PART_SSB_SIZE	0x00200000
+#define MTD_PART_UBOOT_SIZE	0x00200000
+#define MTD_PART_UBOOT_ENV_SIZE	0x00200000
+#define MTD_PART_DTB_SIZE	0x00100000
+#define MTD_PART_KERNEL_SIZE	0x01000000
+#define MTD_PART_ROOT_SIZE	0x0c000000
+/*
+ * WARNING: When changing the order of the partitions, make sure you update
+ *	    CONFIG_ENV_OFFSET accordingly.
+ */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SIZE		0x2000
+#define CONFIG_ENV_RANGE	(2 * CONFIG_NAND_BLOCKSIZE)
+#define CONFIG_ENV_OFFSET	(MTD_PART_BOOT1_SIZE + MTD_PART_GPT_SIZE + \
+				 MTD_PART_SSB_SIZE + MTD_PART_UBOOT_SIZE)
+#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE)
+/*
+ * Check that the u-boot-env partition is big enough to accomodate the
+ * u-boot environment data and its redundant copy
+ */
+#if ((2 * CONFIG_ENV_RANGE) > MTD_PART_UBOOT_ENV_SIZE)
+#error u-boot-env partition size is to small
+#endif
+
 /* MTD configuration */
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_PARTITIONS
diff --git a/include/configs/bcm_ep_board.h b/include/configs/bcm_ep_board.h
index 1d4869b..fe97a40 100644
--- a/include/configs/bcm_ep_board.h
+++ b/include/configs/bcm_ep_board.h
@@ -50,9 +50,6 @@
 
 #define CONFIG_BAUDRATE			115200
 
-#define CONFIG_ENV_SIZE			0x2000
-#define CONFIG_ENV_IS_NOWHERE
-
 #define CONFIG_SYS_NO_FLASH	/* Not using NAND/NOR unmanaged flash */
 
 /* console configuration */
-- 
1.8.5



More information about the U-Boot mailing list