diff mbox

[U-Boot,v2,9/14] sunxi: Enable UBI and NAND support

Message ID 55a34bf3e571b4af63c9b7ca913b51402ab486b2.1479817585.git-series.maxime.ripard@free-electrons.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Maxime Ripard Nov. 22, 2016, 12:38 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>
---
 board/sunxi/Kconfig            |  8 ++++++++
 include/configs/sunxi-common.h | 14 ++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

Comments

Boris Brezillon Nov. 22, 2016, 12:58 p.m. UTC | #1
On Tue, 22 Nov 2016 13:38:39 +0100
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>
> ---
>  board/sunxi/Kconfig            |  8 ++++++++
>  include/configs/sunxi-common.h | 14 ++++++++++++++
>  2 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> index e1d4ab148f08..c6a620a20167 100644
> --- a/board/sunxi/Kconfig
> +++ b/board/sunxi/Kconfig
> @@ -460,6 +460,14 @@ config AXP_GPIO
>  	---help---
>  	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
>  
> +if NAND_SUNXI
> +config CMD_NAND
> +	default y
> +
> +config CMD_UBI
> +	default y
> +endif
> +
>  config VIDEO
>  	bool "Enable graphical uboot console on HDMI, LCD or VGA"
>  	depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && !MACH_SUN50I
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index fd2677ba14a4..feedd9f8811b 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -132,6 +132,20 @@
>  #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_CMD_NAND
> +#define CONFIG_CMD_NAND_TRIMFFS
> +#endif
> +
> +#ifdef CONFIG_CMD_UBI
> +#define CONFIG_CMD_UBIFS
> +
> +#define CONFIG_RBTREE
> +#define CONFIG_LZO
>  #endif
>  
>  #ifdef CONFIG_SPL_SPI_SUNXI

Shouldn't we add all these MTD/NAND/UBI/UBIFS related options in
Kconfig too?
Tom Rini Nov. 22, 2016, 3:24 p.m. UTC | #2
On Tue, Nov 22, 2016 at 01:38:39PM +0100, Maxime Ripard 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>
> ---
>  board/sunxi/Kconfig            |  8 ++++++++
>  include/configs/sunxi-common.h | 14 ++++++++++++++
>  2 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> index e1d4ab148f08..c6a620a20167 100644
> --- a/board/sunxi/Kconfig
> +++ b/board/sunxi/Kconfig
> @@ -460,6 +460,14 @@ config AXP_GPIO
>  	---help---
>  	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
>  
> +if NAND_SUNXI
> +config CMD_NAND
> +	default y
> +
> +config CMD_UBI
> +	default y
> +endif

We want to move away from adding 'default y' to board/*/Kconfig and
instead have 'default y if ...' where the option is declared.  In this
particular case we have a TODO of adding a NAND option that would be
used to hide things like CMD_NAND and other sub-sections rather than
using CMD_NAND for everything.

That said, we've just got 2 sunxi boards with NAND today right?  Maybe
we shouldn't make this default for all sunxi boards yet, yes?  Thanks!
Peter Robinson Nov. 22, 2016, 3:47 p.m. UTC | #3
On Tue, Nov 22, 2016 at 3:24 PM, Tom Rini <trini@konsulko.com> wrote:
> On Tue, Nov 22, 2016 at 01:38:39PM +0100, Maxime Ripard 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>
>> ---
>>  board/sunxi/Kconfig            |  8 ++++++++
>>  include/configs/sunxi-common.h | 14 ++++++++++++++
>>  2 files changed, 22 insertions(+), 0 deletions(-)
>>
>> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
>> index e1d4ab148f08..c6a620a20167 100644
>> --- a/board/sunxi/Kconfig
>> +++ b/board/sunxi/Kconfig
>> @@ -460,6 +460,14 @@ config AXP_GPIO
>>       ---help---
>>       Say Y here to enable support for the gpio pins of the axp PMIC ICs.
>>
>> +if NAND_SUNXI
>> +config CMD_NAND
>> +     default y
>> +
>> +config CMD_UBI
>> +     default y
>> +endif
>
> We want to move away from adding 'default y' to board/*/Kconfig and
> instead have 'default y if ...' where the option is declared.  In this
> particular case we have a TODO of adding a NAND option that would be
> used to hide things like CMD_NAND and other sub-sections rather than
> using CMD_NAND for everything.
>
> That said, we've just got 2 sunxi boards with NAND today right?  Maybe
> we shouldn't make this default for all sunxi boards yet, yes?  Thanks!

There might be a few more (I think CubieTruck has onboard nand for
example) but at least in Fedora we don't support any of the devices
running nand because of the support in generally isn't great yet.

Peter
Maxime Ripard Nov. 22, 2016, 3:54 p.m. UTC | #4
Hi Tom,

On Tue, Nov 22, 2016 at 10:24:27AM -0500, Tom Rini wrote:
> On Tue, Nov 22, 2016 at 01:38:39PM +0100, Maxime Ripard 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>
> > ---
> >  board/sunxi/Kconfig            |  8 ++++++++
> >  include/configs/sunxi-common.h | 14 ++++++++++++++
> >  2 files changed, 22 insertions(+), 0 deletions(-)
> > 
> > diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> > index e1d4ab148f08..c6a620a20167 100644
> > --- a/board/sunxi/Kconfig
> > +++ b/board/sunxi/Kconfig
> > @@ -460,6 +460,14 @@ config AXP_GPIO
> >  	---help---
> >  	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
> >  
> > +if NAND_SUNXI
> > +config CMD_NAND
> > +	default y
> > +
> > +config CMD_UBI
> > +	default y
> > +endif
> 
> We want to move away from adding 'default y' to board/*/Kconfig and
> instead have 'default y if ...' where the option is declared.

Yeah, I wasn't really sure about this. You can find the two
constructs in there. But ok, that's noted :)

> In this particular case we have a TODO of adding a NAND option that
> would be used to hide things like CMD_NAND and other sub-sections
> rather than using CMD_NAND for everything.

Ok.

> That said, we've just got 2 sunxi boards with NAND today right?  Maybe
> we shouldn't make this default for all sunxi boards yet, yes?  Thanks!

Not really. The huge majority of the rather old boards (basically
everything older than a year or so) is using NAND. However, they're
all using MLC NANDs, which are not supported into UBI right now.

The CHIP Pro is the only board with an Allwinner SoC and an SLC NAND,
hence why we can enable the NAND support.

However, in both cases (MLC and SLC), we'll need UBI. In the former
because other filesystems will not be reliable, in the latter because
the NAND is quite huge and the other filesystems would take an insane
amount of time to be accessed.

Maxime
Tom Rini Nov. 22, 2016, 4:40 p.m. UTC | #5
On Tue, Nov 22, 2016 at 04:54:53PM +0100, Maxime Ripard wrote:
> Hi Tom,
> 
> On Tue, Nov 22, 2016 at 10:24:27AM -0500, Tom Rini wrote:
> > On Tue, Nov 22, 2016 at 01:38:39PM +0100, Maxime Ripard 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>
> > > ---
> > >  board/sunxi/Kconfig            |  8 ++++++++
> > >  include/configs/sunxi-common.h | 14 ++++++++++++++
> > >  2 files changed, 22 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> > > index e1d4ab148f08..c6a620a20167 100644
> > > --- a/board/sunxi/Kconfig
> > > +++ b/board/sunxi/Kconfig
> > > @@ -460,6 +460,14 @@ config AXP_GPIO
> > >  	---help---
> > >  	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
> > >  
> > > +if NAND_SUNXI
> > > +config CMD_NAND
> > > +	default y
> > > +
> > > +config CMD_UBI
> > > +	default y
> > > +endif
> > 
> > We want to move away from adding 'default y' to board/*/Kconfig and
> > instead have 'default y if ...' where the option is declared.
> 
> Yeah, I wasn't really sure about this. You can find the two
> constructs in there. But ok, that's noted :)
> 
> > In this particular case we have a TODO of adding a NAND option that
> > would be used to hide things like CMD_NAND and other sub-sections
> > rather than using CMD_NAND for everything.
> 
> Ok.
> 
> > That said, we've just got 2 sunxi boards with NAND today right?  Maybe
> > we shouldn't make this default for all sunxi boards yet, yes?  Thanks!
> 
> Not really. The huge majority of the rather old boards (basically
> everything older than a year or so) is using NAND. However, they're
> all using MLC NANDs, which are not supported into UBI right now.

Ah, good to know, OK.  So v2, default y if ARCH_SUNXI on cmd/Kconfig :)
diff mbox

Patch

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index e1d4ab148f08..c6a620a20167 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -460,6 +460,14 @@  config AXP_GPIO
 	---help---
 	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
 
+if NAND_SUNXI
+config CMD_NAND
+	default y
+
+config CMD_UBI
+	default y
+endif
+
 config VIDEO
 	bool "Enable graphical uboot console on HDMI, LCD or VGA"
 	depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && !MACH_SUN50I
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index fd2677ba14a4..feedd9f8811b 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -132,6 +132,20 @@ 
 #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_CMD_NAND
+#define CONFIG_CMD_NAND_TRIMFFS
+#endif
+
+#ifdef CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+
+#define CONFIG_RBTREE
+#define CONFIG_LZO
 #endif
 
 #ifdef CONFIG_SPL_SPI_SUNXI