diff mbox

[U-Boot,v5,11/16] sunxi: Enable UBI and NAND support

Message ID 26ffbdb85f0733dd3d2908aaa3a99e0067c0857d.1488215509.git-series.maxime.ripard@free-electrons.com
State Accepted
Commit d482a8dfba417c6554f054ca74281d8d32384ed7
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Maxime Ripard Feb. 27, 2017, 5:22 p.m. UTC
From: Hans de Goede <hdegoede@redhat.com>

Enable the NAND and UBI support in the configuration header so that we can
(finally) use it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 cmd/Kconfig                    | 4 ++++
 include/configs/sunxi-common.h | 3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

Comments

Chen-Yu Tsai March 2, 2017, 8:32 a.m. UTC | #1
Hi,

On Tue, Feb 28, 2017 at 1:22 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> From: Hans de Goede <hdegoede@redhat.com>
>
> Enable the NAND and UBI support in the configuration header so that we can
> (finally) use it.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  cmd/Kconfig                    | 4 ++++
>  include/configs/sunxi-common.h | 3 +++
>  2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 4e7c0fbcdee5..8e2a05de82ea 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -438,12 +438,14 @@ config CMD_MMC
>
>  config CMD_NAND
>         bool "nand"
> +       default y if ARCH_SUNXI

This breaks builds for Allwinner/sunxi SoCs that don't have NAND support:

  CC      cmd/nand.o
cmd/nand.c: In function 'set_dev':
cmd/nand.c:118:24: error: 'CONFIG_SYS_MAX_NAND_DEVICE' undeclared
(first use in this function)
  if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev]) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
cmd/nand.c:118:24: note: each undeclared identifier is reported only
once for each function it appears in
cmd/nand.c: In function 'do_nand':
cmd/nand.c:400:19: error: 'CONFIG_SYS_MAX_NAND_DEVICE' undeclared
(first use in this function)
   for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
cmd/nand.c: In function 'do_nandboot':
cmd/nand.c:994:24: error: 'CONFIG_SYS_MAX_NAND_DEVICE' undeclared
(first use in this function)
  if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx]) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.build:280: recipe for target 'cmd/nand.o' failed
make[1]: *** [cmd/nand.o] Error 1
Makefile:1229: recipe for target 'cmd' failed
make: *** [cmd] Error 2


And if CONFIG_SYS_MAX_NAND_DEVICE is fixed by moving it into a separate
#ifdef CONFIG_CMD_NAND, we then get:

  CC      drivers/mtd/nand/nand.o
drivers/mtd/nand/nand.c:15:37: error: 'CONFIG_SYS_NAND_BASE'
undeclared here (not in a function)
 #define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
                                     ^
drivers/mtd/nand/nand.c:27:57: note: in expansion of macro
'CONFIG_SYS_NAND_BASE_LIST'
 static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] =
CONFIG_SYS_NAND_BASE_LIST;

^~~~~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.build:280: recipe for target 'drivers/mtd/nand/nand.o' failed
make[1]: *** [drivers/mtd/nand/nand.o] Error 1
Makefile:1229: recipe for target 'drivers/mtd/nand' failed
make: *** [drivers/mtd/nand] Error 2

I don't think we define CONFIG_SYS_NAND_BASE or
CONFIG_SYS_NAND_BASE_LIST anywhere though.

Regards
ChenYu

>         help
>           NAND support.
>
>  if CMD_NAND
>  config CMD_NAND_TRIMFFS
>         bool "nand write.trimffs"
> +       default y if ARCH_SUNXI
>         help
>           Allows one to skip empty pages when flashing something on a NAND.
>
> @@ -845,6 +847,7 @@ config CMD_UBI
>         tristate "Enable UBI - Unsorted block images commands"
>         select CRC32
>         select MTD_UBI
> +       default y if ARCH_SUNXI
>         help
>           UBI is a software layer above MTD layer which admits use of LVM-like
>           logical volumes on top of MTD devices, hides some complexities of
> @@ -858,6 +861,7 @@ config CMD_UBIFS
>         select CRC32
>         select RBTREE if ARCH_SUNXI
>         select LZO if ARCH_SUNXI
> +       default y if ARCH_SUNXI
>         help
>           UBIFS is a file system for flash devices which works on top of UBI.
>
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index b9cf315af58d..b1af756a6ac9 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -132,6 +132,9 @@
>  #define CONFIG_SYS_NAND_MAX_ECCPOS 1664
>  #define CONFIG_SYS_NAND_ONFI_DETECTION
>  #define CONFIG_SYS_MAX_NAND_DEVICE 8
> +
> +#define CONFIG_MTD_DEVICE
> +#define CONFIG_MTD_PARTITIONS
>  #endif
>
>  #ifdef CONFIG_SPL_SPI_SUNXI
> --
> git-series 0.8.11
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/listinfo/u-boot
diff mbox

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 4e7c0fbcdee5..8e2a05de82ea 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -438,12 +438,14 @@  config CMD_MMC
 
 config CMD_NAND
 	bool "nand"
+	default y if ARCH_SUNXI
 	help
 	  NAND support.
 
 if CMD_NAND
 config CMD_NAND_TRIMFFS
 	bool "nand write.trimffs"
+	default y if ARCH_SUNXI
 	help
 	  Allows one to skip empty pages when flashing something on a NAND.
 
@@ -845,6 +847,7 @@  config CMD_UBI
 	tristate "Enable UBI - Unsorted block images commands"
 	select CRC32
 	select MTD_UBI
+	default y if ARCH_SUNXI
 	help
 	  UBI is a software layer above MTD layer which admits use of LVM-like
 	  logical volumes on top of MTD devices, hides some complexities of
@@ -858,6 +861,7 @@  config CMD_UBIFS
 	select CRC32
 	select RBTREE if ARCH_SUNXI
 	select LZO if ARCH_SUNXI
+	default y if ARCH_SUNXI
 	help
 	  UBIFS is a file system for flash devices which works on top of UBI.
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index b9cf315af58d..b1af756a6ac9 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -132,6 +132,9 @@ 
 #define CONFIG_SYS_NAND_MAX_ECCPOS 1664
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_MAX_NAND_DEVICE 8
+
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
 #endif
 
 #ifdef CONFIG_SPL_SPI_SUNXI