diff mbox

[U-Boot,RFC,09/11] sunxi/nand: Enable UBI and NAND commands

Message ID 1433505164-24112-10-git-send-email-r.spliet@ultimaker.com
State RFC
Delegated to: Scott Wood
Headers show

Commit Message

Roy Spliet June 5, 2015, 11:52 a.m. UTC
Signed-off-by: Roy Spliet <r.spliet@ultimaker.com>
---
 board/sunxi/Kconfig            |  8 +++-----
 drivers/mtd/Makefile           |  1 +
 include/configs/sunxi-common.h | 33 +++++++++++++++++++++++++--------
 3 files changed, 29 insertions(+), 13 deletions(-)

Comments

Hans de Goede June 6, 2015, 3:13 p.m. UTC | #1
Hi,

On 05-06-15 13:52, Roy Spliet wrote:
> Signed-off-by: Roy Spliet <r.spliet@ultimaker.com>
> ---
>   board/sunxi/Kconfig            |  8 +++-----
>   drivers/mtd/Makefile           |  1 +
>   include/configs/sunxi-common.h | 33 +++++++++++++++++++++++++--------
>   3 files changed, 29 insertions(+), 13 deletions(-)
>
> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> index cf58d73..37bbd0f 100644
> --- a/board/sunxi/Kconfig
> +++ b/board/sunxi/Kconfig
> @@ -269,17 +269,15 @@ config MMC_SUNXI_SLOT_EXTRA
>   	slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
>   	support for this.
>
> -config SPL_NAND_SUPPORT
> -	bool "SPL/NAND mode support"
> +config NAND_SUNXI
> +	bool "NAND support"
>   	depends on SPL
>   	default n
>   	---help---
>   	  This enables support for booting from NAND internal
>   	  memory. U-Boot SPL doesn't detect where is it load from,
>   	  therefore this option is needed to properly load image from
> -	  flash. Option also disables MMC functionality on U-Boot due to
> -	  initialization errors encountered, when both controllers are
> -	  enabled.
> +	  flash.
>
>   config USB0_VBUS_PIN
>   	string "Vbus enable pin for usb0 (otg)"
> diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
> index 5467a95..124b0f9 100644
> --- a/drivers/mtd/Makefile
> +++ b/drivers/mtd/Makefile
> @@ -18,3 +18,4 @@ obj-$(CONFIG_FTSMC020) += ftsmc020.o
>   obj-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
>   obj-$(CONFIG_MW_EEPROM) += mw_eeprom.o
>   obj-$(CONFIG_ST_SMI) += st_smi.o
> +obj-$(CONFIG_MTD_UBI) += ubi/
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index cce0441..ec28c40 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -113,7 +113,7 @@
>   #endif
>
>   /* 4MB of malloc() pool */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (4 << 20))
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (64 << 20))
>
>   /*
>    * Miscellaneous configurable options

Please update the comment about malloc_pool size to match :)

Regards,

Hans


> @@ -326,10 +326,31 @@ extern int soft_i2c_gpio_scl;
>   #define CONFIG_ENV_IS_NOWHERE
>   #endif
>
> -#ifdef CONFIG_SPL_NAND_SUPPORT
> +#ifdef CONFIG_NAND_SUNXI
> +#ifndef CONFIG_NAND_SUNXI_GPC_PORTS
> +#error "No NAND GPC ports defined, NAND unsupported"
> +#endif /* CONFIG_NAND_SUNXI_GPC_PORTS */
>   #define CONFIG_NAND
>   #define CONFIG_SYS_NAND_SELF_INIT
> -#define CONFIG_NAND_SUNXI
> +#define CONFIG_SYS_MAX_NAND_DEVICE 8
> +
> +#define CONFIG_SYS_NAND_ONFI_DETECTION
> +
> +/* Requirements for UBI */
> +#define CONFIG_RBTREE
> +#define CONFIG_LZO
> +#define CONFIG_CMD_MTDPARTS
> +#define CONFIG_CMD_UBI
> +#define CONFIG_CMD_UBIFS
> +#define CONFIG_MTD_DEVICE
> +
> +#define CONFIG_SPL_NAND_SUPPORT
> +
> +#define CONFIG_MTD_PARTITIONS
> +/*
> +#define CONFIG_MTD_DEBUG
> +#define CONFIG_MTD_DEBUG_VERBOSE		MTD_DEBUG_LEVEL3
> +*/
>   #define CONFIG_CMD_SPL_WRITE_SIZE		0x000400
>   #define CONFIG_SYS_NAND_U_BOOT_OFFS		0x008000
>
> @@ -338,11 +359,7 @@ extern int soft_i2c_gpio_scl;
>   #define CONFIG_NAND_SUNXI_ECC_STEP		1024
>   #define CONFIG_NAND_SUNXI_ECC_STRENGTH		40
>   #define CONFIG_NAND_SUNXI_ADDR_CYCLES		5
> -
> -#ifndef CONFIG_NAND_SUNXI_GPC_PORTS
> -#error "No NAND GPC ports defined, NAND unsupported"
> -#endif
> -#endif /* CONFIG_SPL_NAND_SUPPORT */
> +#endif /* CONFIG_NAND_SUNXI */
>
>   #define CONFIG_MISC_INIT_R
>   #define CONFIG_SYS_CONSOLE_IS_IN_ENV
>
Ian Campbell June 6, 2015, 3:36 p.m. UTC | #2
On Sat, 2015-06-06 at 17:13 +0200, Hans de Goede wrote:
> > @@ -113,7 +113,7 @@
> >   #endif
> >
> >   /* 4MB of malloc() pool */
> > -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (4 << 20))
> > +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (64 << 20))
> >
> >   /*
> >    * Miscellaneous configurable options
> 
> Please update the comment about malloc_pool size to match :)

...and explain in the commit log why this needs increasing as part of
this change.

Ian.
Roy Spliet June 8, 2015, 7:38 a.m. UTC | #3
Oh yes, thanks for pointing this one out. I increased the malloc pool 
during debugging as google hinted towards UBI being rather 
memory-hungry, but forgot to double-check whether it was required. I 
just did, and as it turns out it really only needs to be increased to 
8MiB for UBI to work in my set-up. As we have plenty of memory anyway, 
should I allocate some extra headroom for set-ups I haven't tested (e.g. 
many partitions, large bad-block tables etc.) and go for 16MiB instead?

Roy

Op 06-06-15 om 17:36 schreef Ian Campbell:
> On Sat, 2015-06-06 at 17:13 +0200, Hans de Goede wrote:
>>> @@ -113,7 +113,7 @@
>>>    #endif
>>>
>>>    /* 4MB of malloc() pool */
>>> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (4 << 20))
>>> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (64 << 20))
>>>
>>>    /*
>>>     * Miscellaneous configurable options
>> Please update the comment about malloc_pool size to match :)
> ...and explain in the commit log why this needs increasing as part of
> this change.
>
> Ian.
>
Ian Campbell June 8, 2015, 9:12 a.m. UTC | #4
On Mon, 2015-06-08 at 09:38 +0200, Roy Spliet wrote:

Please try and avoid sending HTML Mail as well as top posting.

> Oh yes, thanks for pointing this one out. I increased the malloc pool
> during debugging as google hinted towards UBI being rather
> memory-hungry, but forgot to double-check whether it was required. I
> just did, and as it turns out it really only needs to be increased to
> 8MiB for UBI to work in my set-up. As we have plenty of memory anyway,
> should I allocate some extra headroom for set-ups I haven't tested
> (e.g. many partitions, large bad-block tables etc.) and go for 16MiB
> instead?

Either value WFM if the rationale for it is in the commit message.

Ian.
diff mbox

Patch

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index cf58d73..37bbd0f 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -269,17 +269,15 @@  config MMC_SUNXI_SLOT_EXTRA
 	slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
 	support for this.
 
-config SPL_NAND_SUPPORT
-	bool "SPL/NAND mode support"
+config NAND_SUNXI
+	bool "NAND support"
 	depends on SPL
 	default n
 	---help---
 	  This enables support for booting from NAND internal
 	  memory. U-Boot SPL doesn't detect where is it load from,
 	  therefore this option is needed to properly load image from
-	  flash. Option also disables MMC functionality on U-Boot due to
-	  initialization errors encountered, when both controllers are
-	  enabled.
+	  flash.
 
 config USB0_VBUS_PIN
 	string "Vbus enable pin for usb0 (otg)"
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 5467a95..124b0f9 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -18,3 +18,4 @@  obj-$(CONFIG_FTSMC020) += ftsmc020.o
 obj-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 obj-$(CONFIG_MW_EEPROM) += mw_eeprom.o
 obj-$(CONFIG_ST_SMI) += st_smi.o
+obj-$(CONFIG_MTD_UBI) += ubi/
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index cce0441..ec28c40 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -113,7 +113,7 @@ 
 #endif
 
 /* 4MB of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (4 << 20))
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (64 << 20))
 
 /*
  * Miscellaneous configurable options
@@ -326,10 +326,31 @@  extern int soft_i2c_gpio_scl;
 #define CONFIG_ENV_IS_NOWHERE
 #endif
 
-#ifdef CONFIG_SPL_NAND_SUPPORT
+#ifdef CONFIG_NAND_SUNXI
+#ifndef CONFIG_NAND_SUNXI_GPC_PORTS
+#error "No NAND GPC ports defined, NAND unsupported"
+#endif /* CONFIG_NAND_SUNXI_GPC_PORTS */
 #define CONFIG_NAND
 #define CONFIG_SYS_NAND_SELF_INIT
-#define CONFIG_NAND_SUNXI
+#define CONFIG_SYS_MAX_NAND_DEVICE 8
+
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+
+/* Requirements for UBI */
+#define CONFIG_RBTREE
+#define CONFIG_LZO
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+#define CONFIG_MTD_DEVICE
+
+#define CONFIG_SPL_NAND_SUPPORT
+
+#define CONFIG_MTD_PARTITIONS
+/*
+#define CONFIG_MTD_DEBUG
+#define CONFIG_MTD_DEBUG_VERBOSE		MTD_DEBUG_LEVEL3
+*/
 #define CONFIG_CMD_SPL_WRITE_SIZE		0x000400
 #define CONFIG_SYS_NAND_U_BOOT_OFFS		0x008000
 
@@ -338,11 +359,7 @@  extern int soft_i2c_gpio_scl;
 #define CONFIG_NAND_SUNXI_ECC_STEP		1024
 #define CONFIG_NAND_SUNXI_ECC_STRENGTH		40
 #define CONFIG_NAND_SUNXI_ADDR_CYCLES		5
-
-#ifndef CONFIG_NAND_SUNXI_GPC_PORTS
-#error "No NAND GPC ports defined, NAND unsupported"
-#endif
-#endif /* CONFIG_SPL_NAND_SUPPORT */
+#endif /* CONFIG_NAND_SUNXI */
 
 #define CONFIG_MISC_INIT_R
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV