All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7] igep003x: UBIize
Date: Sat, 1 Apr 2017 17:17:57 +0200	[thread overview]
Message-ID: <20170401151757.cjusllxak2h6zjfc@lenoch> (raw)
In-Reply-To: <20170401151326.4d3ijtffy744rwaz@lenoch>

Convert IGEP board to use UBI volumes for U-Boot, its environment and
kernel. With exception of first four sectors read by SoC BootROM whole
NAND is UBI managed.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 board/isee/igep003x/board.c       | 17 +++++++++++++++
 configs/am335x_igep0033_defconfig |  4 ++++
 include/configs/am335x_igep003x.h | 45 +++++++++++++++++++++++----------------
 3 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index 5fea7ffaef..9abb4824b5 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -23,6 +23,9 @@
 #include <i2c.h>
 #include <miiphy.h>
 #include <cpsw.h>
+#include <fdt_support.h>
+#include <mtd_node.h>
+#include <jffs2/load_kernel.h>
 #include "board.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -104,6 +107,20 @@ int board_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_OF_BOARD_SETUP
+int ft_board_setup(void *blob, bd_t *bd)
+{
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+	static struct node_info nodes[] = {
+		{ "ti,omap2-nand", MTD_DEV_TYPE_NAND, },
+	};
+
+	fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+#endif
+	return 0;
+}
+#endif
+
 #if defined(CONFIG_DRIVER_TI_CPSW)
 static void cpsw_control(int enabled)
 {
diff --git a/configs/am335x_igep0033_defconfig b/configs/am335x_igep0033_defconfig
index 12f04c68f9..71e11da17a 100644
--- a/configs/am335x_igep0033_defconfig
+++ b/configs/am335x_igep0033_defconfig
@@ -13,6 +13,7 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_SPL_FAT_SUPPORT=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
+CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="MACH_TYPE=MACH_TYPE_IGEP0033"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
@@ -41,9 +42,12 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_UBI=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_MMC_OMAP_HS=y
+CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_SYS_NS16550=y
 CONFIG_OF_LIBFDT=y
+CONFIG_FDT_FIXUP_PARTITIONS=y
 # CONFIG_GENERATE_SMBIOS_TABLE is not set
diff --git a/include/configs/am335x_igep003x.h b/include/configs/am335x_igep003x.h
index 348b16f3e8..f7209930d3 100644
--- a/include/configs/am335x_igep003x.h
+++ b/include/configs/am335x_igep003x.h
@@ -21,7 +21,7 @@
 #define V_OSCK				24000000  /* Clock output from T2 */
 #define V_SCLK				(V_OSCK)
 
-#define CONFIG_ENV_SIZE			(128 << 10)	/* 128 KiB */
+#define CONFIG_ENV_SIZE			(96 << 10)	/*  96 KiB */
 
 /* Make the verbose messages from UBI stop printing */
 #define CONFIG_UBI_SILENCE_MSG
@@ -67,11 +67,11 @@
 		"fi;\0" \
 	"mtdids=" MTDIDS_DEFAULT "\0" \
 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
-	"nandroot=ubi0:filesystem rw ubi.mtd=3,2048\0" \
+	"nandroot=ubi0:rootfs rw ubi.mtd=1\0" \
 	"nandrootfstype=ubifs rootwait\0" \
-	"nandload=ubi part filesystem 2048; ubifsmount ubi0; " \
-		"ubifsload ${loadaddr} ${bootdir}/${bootfile}; " \
-		"ubifsload ${fdtaddr} ${bootdir}/${dtbfile} \0" \
+	"nandload=ubi part UBI; " \
+		"ubi read ${loadaddr} kernel; " \
+		"ubi read ${fdtaddr} dtb \0" \
 	"nandargs=setenv bootargs console=${console} " \
 		"${optargs} " \
 		"root=${nandroot} " \
@@ -97,12 +97,6 @@
 /* NAND support */
 #define CONFIG_NAND_OMAP_ELM
 #define CONFIG_SYS_NAND_ONFI_DETECTION	1
-#define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */
-#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET		0x180000 /* environment starts here */
-#define CONFIG_ENV_ADDR_REDUND		(CONFIG_ENV_OFFSET + CONFIG_SYS_ENV_SECT_SIZE)
-#define CONFIG_ENV_SIZE_REDUND		(CONFIG_ENV_SIZE)
 
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_MTD_DEVICE
@@ -110,9 +104,7 @@
 #define CONFIG_LZO
 
 #define MTDIDS_DEFAULT			"nand0=omap2-nand.0"
-#define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:512k(spl),"\
-					"1m(uboot),256k(environment),"\
-					"-(filesystem)"
+#define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:512k(SPL),-(UBI)"
 
 /* Unsupported features */
 #undef CONFIG_USE_IRQ
@@ -120,6 +112,27 @@
 /* SPL */
 #define CONFIG_SPL_LDSCRIPT		"arch/arm/mach-omap2/am33xx/u-boot-spl.lds"
 
+/* UBI configuration */
+#define CONFIG_SPL_UBI			1
+#define CONFIG_SPL_UBI_MAX_VOL_LEBS	256
+#define CONFIG_SPL_UBI_MAX_PEB_SIZE	(256*1024)
+#define CONFIG_SPL_UBI_MAX_PEBS		4096
+#define CONFIG_SPL_UBI_VOL_IDS		8
+#define CONFIG_SPL_UBI_LOAD_MONITOR_ID	0
+#define CONFIG_SPL_UBI_LOAD_KERNEL_ID	3
+#define CONFIG_SPL_UBI_LOAD_ARGS_ID	4
+#define CONFIG_SPL_UBI_PEB_OFFSET	4
+#define CONFIG_SPL_UBI_VID_OFFSET	512
+#define CONFIG_SPL_UBI_LEB_START	2048
+#define CONFIG_SPL_UBI_INFO_ADDR	0x88080000
+
+/* environment organization */
+#define CONFIG_ENV_IS_IN_UBI		1
+#define CONFIG_ENV_UBI_PART		"UBI"
+#define CONFIG_ENV_UBI_VOLUME		"config"
+#define CONFIG_ENV_UBI_VOLUME_REDUND	"config_r"
+
+/* NAND config */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \
 					 CONFIG_SYS_NAND_PAGE_SIZE)
@@ -139,8 +152,4 @@
 #define CONFIG_SYS_NAND_ECCBYTES	14
 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW
 
-#define	CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
-
-#define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
-
 #endif	/* ! __CONFIG_IGEP003X_H */
-- 
2.11.0

  parent reply	other threads:[~2017-04-01 15:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01 15:13 [U-Boot] [PATCH 0/7] Add IGEP SMARC AM335x module support Ladislav Michl
2017-04-01 15:14 ` [U-Boot] [PATCH 1/7] ARM: am33xx: fix typo in spl.h Ladislav Michl
2017-04-06 17:18   ` Pau Pajuelo
2017-05-08 19:39   ` [U-Boot] [U-Boot,1/7] " Tom Rini
2017-04-01 15:15 ` [U-Boot] [PATCH 2/7] ARM: am33xx: define BOOT_DEVICE_ONENAND Ladislav Michl
2017-04-06 17:19   ` Pau Pajuelo
2017-05-08 19:39   ` [U-Boot] [U-Boot,2/7] " Tom Rini
2017-04-01 15:16 ` [U-Boot] [PATCH 3/7] mtd: nand: Consolidate nand spl loaders implementation Ladislav Michl
2017-04-06 17:20   ` Pau Pajuelo
2017-04-07 17:28   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-16 13:31     ` [U-Boot] [PATCH v2 " Ladislav Michl
2017-05-08 19:42       ` [U-Boot] [U-Boot, v2, " Tom Rini
2017-04-01 15:17 ` [U-Boot] [PATCH 4/7] igep0033: Rename to igep003x Ladislav Michl
2017-04-06 17:21   ` Pau Pajuelo
2017-05-08 19:40   ` [U-Boot] [U-Boot,4/7] " Tom Rini
2017-04-01 15:17 ` Ladislav Michl [this message]
2017-04-03  4:18   ` [U-Boot] [PATCH 5/7] igep003x: UBIize Heiko Schocher
2017-04-06 17:22     ` Pau Pajuelo
2017-05-08 19:40   ` [U-Boot] [U-Boot,5/7] " Tom Rini
2017-04-01 15:18 ` [U-Boot] [PATCH 6/7] igep003x: Add support for IGEP SMARC AM335x Ladislav Michl
2017-04-06 17:22   ` Pau Pajuelo
2017-05-08 19:40   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-01 15:19 ` [U-Boot] [PATCH 7/7] igep003x: Add netboot support Ladislav Michl
2017-04-06 17:23   ` Pau Pajuelo
2017-05-08 19:40   ` [U-Boot] [U-Boot,7/7] " Tom Rini

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=20170401151757.cjusllxak2h6zjfc@lenoch \
    --to=ladis@linux-mips.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.