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

Hans de Goede
2015-06-06T15:13:45Z

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
>