[PATCH] usb: mtu3: flush cache for the first GPD when allocate GPD ring

2021-09-22 Thread Chunfeng Yun
When allocate the GPD ring, and tell its address to the controller, then
the driver starts or resumes the QMU, the controller will try to access
the first GPD, so need flush the first one to avoid wrong GPD status.

Reported-by: Xin Lin 
Signed-off-by: Chunfeng Yun 
---
 drivers/usb/mtu3/mtu3_qmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/mtu3/mtu3_qmu.c b/drivers/usb/mtu3/mtu3_qmu.c
index 95eaf6d236..e8dc0095ab 100644
--- a/drivers/usb/mtu3/mtu3_qmu.c
+++ b/drivers/usb/mtu3/mtu3_qmu.c
@@ -112,6 +112,7 @@ int mtu3_gpd_ring_alloc(struct mtu3_ep *mep)
memset(gpd, 0, QMU_GPD_RING_SIZE);
ring->dma = (dma_addr_t)gpd;
gpd_ring_init(ring, gpd);
+   mtu3_flush_cache((uintptr_t)gpd, sizeof(*gpd));
 
return 0;
 }
-- 
2.25.1



RE: [PATCH 2/8] arm: socfpga: vining: Increase environment size

2021-09-22 Thread Chee, Tien Fong
> -Original Message-
> From: Marek Vasut 
> Sent: Tuesday, 14 September, 2021 11:26 AM
> To: u-boot@lists.denx.de
> Cc: Marek Vasut ; Lim, Elly Siew Chin
> ; Simon Goldschmidt
> ; Chee, Tien Fong
> 
> Subject: [PATCH 2/8] arm: socfpga: vining: Increase environment size
> 
> Increase the environment size from 4k to 16k to prevent environment from
> becoming full.
> 
> Signed-off-by: Marek Vasut 
> Cc: Siew Chin Lim 
> Cc: Simon Goldschmidt 
> Cc: Tien Fong Chee 
> ---
>  configs/socfpga_vining_fpga_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Tien Fong Chee 

Regards,
TF


[PATCH 1/1] riscv: ae350: enable Coherence Manager for ae350

2021-09-22 Thread Leo Yu-Chi Liang
If Coherence Manager were not set in the beginning,
u-boot-spl would sometimes fail to boot to u-boot proper.

Enable CM and I/D cache at the same time in harts_early_init

Signed-off-by: Leo Yu-Chi Liang 
---
 arch/riscv/cpu/ax25/cpu.c | 42 +++
 1 file changed, 42 insertions(+)

diff --git a/arch/riscv/cpu/ax25/cpu.c b/arch/riscv/cpu/ax25/cpu.c
index f092600e14..c4c2de2ef0 100644
--- a/arch/riscv/cpu/ax25/cpu.c
+++ b/arch/riscv/cpu/ax25/cpu.c
@@ -9,6 +9,22 @@
 #include 
 #include 
 #include 
+#include 
+
+#define CSR_MCACHE_CTL 0x7ca
+#define CSR_MMISC_CTL  0x7d0
+#define CSR_MARCHID0xf12
+
+#define V5_MCACHE_CTL_IC_EN_OFFSET  0
+#define V5_MCACHE_CTL_DC_EN_OFFSET  1
+#define V5_MCACHE_CTL_DC_COHEN_OFFSET  19
+#define V5_MCACHE_CTL_DC_COHSTA_OFFSET 20
+
+#define V5_MCACHE_CTL_IC_ENBIT(V5_MCACHE_CTL_IC_EN_OFFSET)
+#define V5_MCACHE_CTL_DC_EN
BIT(V5_MCACHE_CTL_DC_EN_OFFSET)
+#define V5_MCACHE_CTL_DC_COHEN_EN   BIT(V5_MCACHE_CTL_DC_COHEN_OFFSET)
+#define V5_MCACHE_CTL_DC_COHSTA_EN  BIT(V5_MCACHE_CTL_DC_COHSTA_OFFSET)
+
 
 /*
  * cleanup_before_linux() is called just before we call linux
@@ -27,3 +43,29 @@ int cleanup_before_linux(void)
 
return 0;
 }
+
+void harts_early_init(void)
+{
+   if (CONFIG_IS_ENABLED(RISCV_MMODE)) {
+   unsigned long long mcache_ctl_val = csr_read(CSR_MCACHE_CTL);
+
+   if (!(mcache_ctl_val & V5_MCACHE_CTL_DC_COHEN_EN))
+   mcache_ctl_val |= V5_MCACHE_CTL_DC_COHEN_EN;
+   if (!(mcache_ctl_val & V5_MCACHE_CTL_IC_EN))
+   mcache_ctl_val |= V5_MCACHE_CTL_IC_EN;
+   if (!(mcache_ctl_val & V5_MCACHE_CTL_DC_EN))
+   mcache_ctl_val |= V5_MCACHE_CTL_DC_EN;
+   csr_write(CSR_MCACHE_CTL, mcache_ctl_val);
+
+   /*
+* Check DC_COHEN_EN, if cannot write to mcache_ctl,
+* we assume this bitmap not support L2 CM
+*/
+   mcache_ctl_val = csr_read(CSR_MCACHE_CTL);
+   if ((mcache_ctl_val & V5_MCACHE_CTL_DC_COHEN_EN)) {
+   /* Wait for DC_COHSTA bit be set */
+   while (!(mcache_ctl_val & V5_MCACHE_CTL_DC_COHSTA_EN))
+   mcache_ctl_val = csr_read(CSR_MCACHE_CTL);
+   }
+   }
+}
-- 
2.17.0



RE: [PATCH 1/8] arm: socfpga: vining: Drop meaningless comment

2021-09-22 Thread Chee, Tien Fong
> -Original Message-
> From: Marek Vasut 
> Sent: Tuesday, 14 September, 2021 11:25 AM
> To: u-boot@lists.denx.de
> Cc: Marek Vasut ; Lim, Elly Siew Chin
> ; Simon Goldschmidt
> ; Chee, Tien Fong
> 
> Subject: [PATCH 1/8] arm: socfpga: vining: Drop meaningless comment
> 
> The comment is no longer meaningful due to DT conversion, drop it.
> 
> Signed-off-by: Marek Vasut 
> Cc: Siew Chin Lim 
> Cc: Simon Goldschmidt 
> Cc: Tien Fong Chee 
> ---
>  include/configs/socfpga_vining_fpga.h | 2 --
>  1 file changed, 2 deletions(-)
> 

Reviewed-by: Tien Fong Chee 

Regards,
TF


Re: [PATCH] m68k: Add missing ENTRY entry in linker script

2021-09-22 Thread Tom Rini
On Fri, Sep 17, 2021 at 12:10:19PM -0400, Tom Rini wrote:

> Currently, there is no ENTRY() entry in the m68k linker script.
> However, since they currently contain a version_string symbol, which
> then overrides the default weak version_string symbol, the linker
> decides we must keep start.o in the resulting link.  Add an ENTRY() line
> so that the linker will know to keep this, even when version_string is
> no longer provided in start.S
> 
> Cc: Huan Wang 
> Cc: Angelo Dureghello 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/1] powerpc: Drop version_string placement optimization

2021-09-22 Thread Tom Rini
On Thu, Sep 16, 2021 at 03:56:48PM -0400, Tom Rini wrote:

> As explained by Wolfgang, historically PowerPC would do a number of
> things to hand-optimize placement of the binary on NOR flash in order to
> maximize utilization of very scarce resources.  These days, we simply
> aren't optimizing our binary layout for NOR flash placement and it's
> quite likely this wasn't working as intended.  Furthermore, this level
> of optimization makes it difficult to have version_string be a global,
> instead of a weak and overridden value, and so make more progress on
> reproducible builds, which is a current concern.
> 
> Move to having PowerPC no longer store version_string in the early part
> of text so that it might be part of the first page of NOR and instead
> use the same declaration everyone else does.
> 
> Link: https://lore.kernel.org/r/96716.1629798...@gemini.denx.de/
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL next] u-boot-at91-2022.01-a

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 09:03:50AM +, eugen.hris...@microchip.com wrote:

> Hello Tom,
> 
> Please pull tag u-boot-at91-2022.01-a , the first set of features for 
> the next cycle 2022.01 . The PR is rebased on -next .
> 
> This feature set includes : the support for CPU driver for arm926 
> (sam9x60 device); changes required for OP-TEE boot for sama5d2_xplained 
> and sama5d27_som1_ek boards; QSPI boot configuration for sama5d2_icp; 
> starting to remove old Kconfig unused symbols from config_whitelist.txt 
> (work will take more time); also small fixes and updates in mach, DT, 
> configs, etc.
> 
> Thanks,
> Eugen
> 
> 
> The following changes since commit 44131caa4025455a659e958281f0e337bdf83f89:
> 
>scripts/config_whitelist.txt: Fix after merging (2021-09-16 13:18:21 
> -0400)
> 
> are available in the Git repository at:
> 
>https://source.denx.de/u-boot/custodians/u-boot-at91.git 
> tags/u-boot-at91-2022.01-a
> 
> for you to fetch changes up to d65b84a1d0dc116010a3842dc13661976ef92629:
> 
>ARM: dts: at91: update flexcom defines using include file (2021-09-21 
> 10:08:24 +0300)
> 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 11/11] test: Add a way to skip console checking until a string matches

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:33PM -0600, Simon Glass wrote:

> Some tests produce a lot of output that does not need to be individually
> checked by an assertion. Add a macro to handle this.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 09/11] sandbox: Add a way to map a file into memory

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:31PM -0600, Simon Glass wrote:

> It is useful to map a file into memory so that it can be accessed using
> simple pointers. Add a function to support this.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 08/11] sandbox: Add a way to find the size of a file

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:30PM -0600, Simon Glass wrote:

> Add a function to return the size of a file. This is useful in situations
> where we need to allocate memory for it before reading it.
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Marek Behún 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 06/11] test: Tidy a comment in the bloblist test

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:28PM -0600, Simon Glass wrote:

> Fix up a copy error.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 07/11] dm: core: Fix a few incorrect comments on first/next functions

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:29PM -0600, Simon Glass wrote:

> Tighten up these comments to make the behaviour clearer.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 04/11] btrfs: Suppress the message about missing filesystem

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:26PM -0600, Simon Glass wrote:

> This message comes up a lot when scanning filesystems. It suggests to the
> user that there is some sort of error, but in fact there is no reason to
> expect that a particular partition has a btrfs filesystem. Other
> filesystems don't print this error.
> 
> Turn it into a debug message.
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Marek Behún 
> Reviewed-by: Qu Wenruo 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 05/11] sqfs: Suppress the message about missing filesystem

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:27PM -0600, Simon Glass wrote:

> This message comes up a lot when scanning filesystems. It suggests to the
> user that there is some sort of error, but in fact there is no reason to
> expect that a particular partition has a sqfs filesystem. Other
> filesystems don't print this error.
> 
> Turn it into a debug message.
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Miquel Raynal 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 03/11] sandbox: Add license headers to the dts files

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:25PM -0600, Simon Glass wrote:

> Many of these files are missing a header. Fix this.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 02/11] sandbox: Correct handling of --rm_memory

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:24PM -0600, Simon Glass wrote:

> This option has no argument so we should not trip to skip one.
> 
> Fix it.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 11/11] Remove including timestamp.h in version.h

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:38PM +0200, Pali Rohár wrote:

> Header file version.h does not use anything from timestamp.h. Including of
> timestamp.h has side effect which cause recompiling object file at every
> make run because timestamp.h changes at every run.
> 
> So remove timestamp.h from version.h and include timestamp.h in files
> which needs it.
> 
> This change reduce recompilation time of final U-Boot binary when U-Boot
> source files were not changed as less source files needs to be recompiled.
> 
> Signed-off-by: Pali Rohár 
> Reviewed-by: Simon Glass 
> Reviewed-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 10/11] version: Remove global macro U_BOOT_VERSION_STRING from version.h

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:37PM +0200, Pali Rohár wrote:

> Version string is available in global variable char version_string[].
> Macro U_BOOT_VERSION_STRING is not used by any other file, so remove it
> completely from version.h. Other files were already converted to use
> variable version_string[].
> 
> Signed-off-by: Pali Rohár 
> Reviewed-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 09/11] x86: quark: MRC: Remove U_BOOT_DATE and U_BOOT_TIME from debug log

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:36PM +0200, Pali Rohár wrote:

> U_BOOT_DATE and U_BOOT_TIME are updated on every run of make command.
> Therefore mrc.c file is recompiled every time when running make which means
> that whole U-Boot binary is recompiled on every run of make command.
> 
> Simplify it and do not recompile U-Boot binary on every run of make command
> by not depending on macros U_BOOT_DATE and U_BOOT_TIME.
> 
> Signed-off-by: Pali Rohár 
> Reviewed-by: Simon Glass 
> Reviewed-by: Bin Meng 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 01/11] dtoc: Further improve documentation about warnings

2021-09-22 Thread Tom Rini
On Wed, Aug 18, 2021 at 09:40:23PM -0600, Simon Glass wrote:

> Split this information into subsections and expand it.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 08/11] version: Do not make version_string[] variable as a weak

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:35PM +0200, Pali Rohár wrote:

> There is no platform which needs to overload version_string[] variable, so
> remove weak symbol mark.
> 
> Signed-off-by: Pali Rohár 
> Reviewed-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 04/11] version: Move version_string[] from version.h to version_string.h

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:31PM +0200, Pali Rohár wrote:

> More C files do not use compile time timestamp macros and do not have to be
> recompiled every time when SOURCE_DATE_EPOCH changes.
> 
> This patch moves version_string[] from version.h to version_string.h and
> updates other C files which only needs version_string[] string to include
> version_string.h instead of version.h. After applying this patch these
> files are not recompiled every time when SOURCE_DATE_EPOCH changes.
> 
> Signed-off-by: Pali Rohár 
> Reviewed-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 05/11] m68k: mcf: Remove overloading version_string

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:32PM +0200, Pali Rohár wrote:

> There is no need to overload version_string at the end of start.S files.
> Common implementation of version_string should be fine.
> 
> Signed-off-by: Pali Rohár 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 03/11] efi_loader: Use directly version_string variable

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:30PM +0200, Pali Rohár wrote:

> Macro U_BOOT_VERSION_STRING is already stored in variable version_string.
> So use directly this variable instead of storing U_BOOT_VERSION_STRING into
> temporary variable.
> 
> Signed-off-by: Pali Rohár 
> Acked-by: Ilias Apalodimas 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 02/11] Remove #include from files which do not need it

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:29PM +0200, Pali Rohár wrote:

> Signed-off-by: Pali Rohár 
> Reviewed-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 01/11] Remove #include from files which do not need it

2021-09-22 Thread Tom Rini
On Mon, Aug 02, 2021 at 03:18:28PM +0200, Pali Rohár wrote:

> Signed-off-by: Pali Rohár 
> Reviewed-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


RE: [PATCH] ddr: altera: use KBUILD_BASENAME instead of __FILE__

2021-09-22 Thread Chee, Tien Fong
> -Original Message-
> From: Marek Vasut 
> Sent: Tuesday, 14 September, 2021 11:20 AM
> To: u-boot@lists.denx.de
> Cc: Marek Vasut ; Lim, Elly Siew Chin
> ; Simon Goldschmidt
> ; Chee, Tien Fong
> 
> Subject: [PATCH] ddr: altera: use KBUILD_BASENAME instead of __FILE__
> 
> The KBUILD_BASENAME contains just the name of the compiled module, in this
> case 'sequencer', rather than a full path to the compiled file. Use it to 
> prevent
> pulling the full path into the U-Boot binary, which is useless and annoying.
> 
> Signed-off-by: Marek Vasut 
> Cc: Siew Chin Lim 
> Cc: Simon Goldschmidt 
> Cc: Tien Fong Chee 
> ---
>  drivers/ddr/altera/sequencer.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Reviewed-by: Tien Fong Chee 

Regards,
TF


Re: USB 3.1 support

2021-09-22 Thread Bin Meng
HI Aaron,

On Thu, Sep 23, 2021 at 9:24 AM Aaron Williams  wrote:
>
> Hi all,
>
> You can ignore my previous email. It looks like it's being added as I type
> this.
>
> Best Regards,
>
> -Aaron Williams
>
> On Wednesday, September 22, 2021 6:22:00 PM PDT Aaron Williams wrote:
> > Hi Bin, Stefan,
> >
> > Is the U-Boot USB support compatible with USB 3.1 or does this need to be
> > added? The SoC I'm working on (CN106XX) includes USB 3.1 support. I have not
> > yet tried U-Boot on this chip but will shortly. If not, are there any
> > branches with USB 3.1 changes or are no changes required?

USB 3.1 / 3.2 is backward compatible with 3.0 if you are only looking
at the super speed. There is definitely work to do for 10G/20G support
but I doubt that brings too much value to U-Boot.

Regards,
Bin


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Vasut

On 9/22/21 10:00 PM, Tom Rini wrote:

On Wed, Sep 22, 2021 at 09:56:26PM +0200, Marek Vasut wrote:

On 9/22/21 9:46 PM, Tom Rini wrote:

On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:


I am talking about using nor%d in MTDIDS in U-Boot UBI code to look up from
which device to attach UBI in U-Boot.


OK, so are we not able to pass in the correct name now?  Or just worried
about old environment and new U-Boot?


Say you have the following in board config:

CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:-(fs);"

Then run "=> ubi part fs", which will fail to find nor0, because now that
nor0 is called something else. That is what this series tries to fix.


Yes, and what is nor0 now, and what happens if you use it?


Now it is "mt25ql02g", for all mt25ql02g on the board, so ... I cannot 
even select the one SPI NOR I want to use, since they are not even 
enumerated in any way, they are all the same. You might want to look at 
get_mtd_device_nm() in drivers/mtd/mtdcore.c .


Re: USB 3.1 support

2021-09-22 Thread Aaron Williams
Hi all,

You can ignore my previous email. It looks like it's being added as I type 
this.

Best Regards,

-Aaron Williams

On Wednesday, September 22, 2021 6:22:00 PM PDT Aaron Williams wrote:
> Hi Bin, Stefan,
> 
> Is the U-Boot USB support compatible with USB 3.1 or does this need to be
> added? The SoC I'm working on (CN106XX) includes USB 3.1 support. I have not
> yet tried U-Boot on this chip but will shortly. If not, are there any
> branches with USB 3.1 changes or are no changes required?
> 
> Best Regards,
> 
> -Aaron Williams





USB 3.1 support

2021-09-22 Thread Aaron Williams
Hi Bin, Stefan,

Is the U-Boot USB support compatible with USB 3.1 or does this need to be 
added? The SoC I'm working on (CN106XX) includes USB 3.1 support. I have not 
yet tried U-Boot on this chip but will shortly. If not, are there any branches 
with USB 3.1 changes or are no changes required?

Best Regards,

-Aaron Williams




[PATCH] board: gateworks: venice: add imx8mn-gw7902 support

2021-09-22 Thread Tim Harvey
The GW7902 is based on the i.MX 8M Mini / Nano SoC featuring:
 - LPDDR4 DRAM
 - eMMC FLASH
 - Gateworks System Controller
 - LTE CAT M1 modem
 - USB 2.0 HUB
 - M.2 Socket with USB2.0, PCIe, and dual-SIM
 - IMX8M FEC
 - PCIe based GbE
 - RS232/RS485/RS422 serial transceiver
 - GPS
 - CAN bus
 - WiFi / Bluetooth
 - MIPI header (DSI/CSI/GPIO/PWM/I2S)
 - PMIC

To add support for the i.MX8M Nano GW7902:
 - Add imx8mn-venice dts/defconfig/include
 - Add imx8mn-gw7902 dts
 - Add imx8mn-2gb lpddr4 dram configs
 - Add misc support for IMX8M Nano SoC
 - rename imx8mm-venice.c to venice.c as it is no longer imx8mm specific
 - update README with differences for IMX8MN vs IMX8MM

Signed-off-by: Tim Harvey 
---
 arch/arm/dts/Makefile |2 +
 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi |   29 +
 arch/arm/dts/imx8mn-venice-gw7902.dts |  888 ++
 arch/arm/dts/imx8mn-venice-u-boot.dtsi|  222 +++
 arch/arm/dts/imx8mn-venice.dts|  152 ++
 arch/arm/mach-imx/imx8m/Kconfig   |7 +
 board/gateworks/venice/Kconfig|   12 +
 board/gateworks/venice/MAINTAINERS|6 +-
 board/gateworks/venice/Makefile   |   10 +-
 board/gateworks/venice/README |5 +-
 board/gateworks/venice/gsc.c  |   13 +
 .../gateworks/venice/imximage-8mn-lpddr4.cfg  |   10 +
 board/gateworks/venice/lpddr4_timing.h|5 +
 ...lpddr4_timing.c => lpddr4_timing_imx8mm.c} |0
 .../lpddr4_timing_imx8mn_2gb_dual_die.c   | 1444 
 .../lpddr4_timing_imx8mn_2gb_single_die.c | 1445 +
 board/gateworks/venice/spl.c  |   52 +-
 .../venice/{imx8mm_venice.c => venice.c}  |0
 configs/imx8mn_venice_defconfig   |  117 ++
 include/configs/imx8mn_venice.h   |  127 ++
 20 files changed, 4538 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902.dts
 create mode 100644 arch/arm/dts/imx8mn-venice-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice.dts
 create mode 100644 board/gateworks/venice/imximage-8mn-lpddr4.cfg
 rename board/gateworks/venice/{lpddr4_timing.c => lpddr4_timing_imx8mm.c} 
(100%)
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_dual_die.c
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_single_die.c
 rename board/gateworks/venice/{imx8mm_venice.c => venice.c} (100%)
 create mode 100644 configs/imx8mn_venice_defconfig
 create mode 100644 include/configs/imx8mn_venice.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index fc16a57e60..9a39e11ddd 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -881,6 +881,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
imx8mn-ddr4-evk.dtb \
imx8mq-cm.dtb \
imx8mn-evk.dtb \
+   imx8mn-venice.dtb \
+   imx8mn-venice-gw7902.dtb \
imx8mq-evk.dtb \
imx8mm-beacon-kit.dtb \
imx8mn-beacon-kit.dtb \
diff --git a/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi 
b/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
new file mode 100644
index 00..f6f0aa7cb5
--- /dev/null
+++ b/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+#include "imx8mn-venice-u-boot.dtsi"
+
+&fec1 {
+   phy-reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <1>;
+   phy-reset-post-delay = <1>;
+};
+
+&pinctrl_fec1 {
+   u-boot,dm-spl;
+};
+
+&{/soc@0/bus@3080/i2c@30a2/pmic@4b} {
+   u-boot,dm-spl;
+};
+
+&{/soc@0/bus@3080/i2c@30a2/pmic@4b/regulators} {
+   u-boot,dm-spl;
+};
+
+&pinctrl_pmic {
+   u-boot,dm-spl;
+};
+
diff --git a/arch/arm/dts/imx8mn-venice-gw7902.dts 
b/arch/arm/dts/imx8mn-venice-gw7902.dts
new file mode 100644
index 00..06ee4cf794
--- /dev/null
+++ b/arch/arm/dts/imx8mn-venice-gw7902.dts
@@ -0,0 +1,888 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include 
+#include 
+
+#include "imx8mn.dtsi"
+
+/ {
+   model = "Gateworks Venice GW7902 i.MX8MN board";
+   compatible = "gw,imx8mn-gw7902", "fsl,imx8mn";
+
+   aliases {
+   usb0 = &usbotg1;
+   };
+
+   chosen {
+   stdout-path = &uart2;
+   };
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0x0 0x4000 0 0x8000>;
+   };
+
+   can20m: can20m {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2000>;
+   clock-output-names = "can20m";
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+
+   user-pb {
+   label = "user_pb";
+   gpios

RE: [PATCH 2/4] dm: hash: Add new UCLASS_HASH support

2021-09-22 Thread ChiaWei Wang
Hi Simon,

> From: Simon Glass 
> Sent: Thursday, September 23, 2021 12:19 AM
> 
> Hi,
> 
> On Thu, 2 Sept 2021 at 07:28, Tom Rini  wrote:
> >
> > On Fri, Jul 30, 2021 at 09:08:03AM +0800, Chia-Wei Wang wrote:
> >
> > > Add UCLASS_HASH for hash driver development. Thus the hash drivers
> > > (SW or HW-accelerated) can be developed in the DM-based fashion.
> > >
> > > Signed-off-by: Chia-Wei Wang 
> >
> > Applied to u-boot/next, thanks!
> 
> Oddly enough I didn't see this patch but did see Tom's reply.

Truly odd. You and Tom are on the '--to' list. 
I also checked the content sent on U-Boot Patchwork as shown below.

---
To: , , 
Subject: [PATCH 2/4] dm: hash: Add new UCLASS_HASH support
---

Regards,
Chiawei


[PULL] u-boot-socfpga/master

2021-09-22 Thread Marek Vasut

Bugfixes for this one socfpga platform, should go into 2021.10

The following changes since commit a49930f4c6ed5dcbf5127f7bf6d189afa92bffb3:

  Merge https://source.denx.de/u-boot/custodians/u-boot-x86 (2021-09-22 
11:43:12 -0400)


are available in the Git repository at:

  git://git.denx.de/u-boot-socfpga.git master

for you to fetch changes up to 532010da67329a1c3dbe92a167486df6e61d4f4a:

  ddr: altera: use KBUILD_BASENAME instead of __FILE__ (2021-09-22 
21:31:05 +0200)



Marek Vasut (9):
  arm: socfpga: vining: Drop meaningless comment
  arm: socfpga: vining: Increase environment size
  arm: socfpga: vining: Set USB gadget manufacturer to Softing with 
capital S

  arm: socfpga: vining: Set default SPI NOR mode and frequency
  arm: socfpga: vining: Un-disable WDT in DT
  arm: socfpga: vining: Fix UDC controller phandle in DT
  arm: socfpga: vining: Enable DW I2C driver
  arm: socfpga: vining: Let DWMAC configure PHY reset GPIO
  ddr: altera: use KBUILD_BASENAME instead of __FILE__

 arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi | 6 +-
 board/softing/vining_fpga/socfpga.c   | 7 ---
 configs/socfpga_vining_fpga_defconfig | 8 ++--
 drivers/ddr/altera/sequencer.c| 8 
 include/configs/socfpga_vining_fpga.h | 2 --
 5 files changed, 11 insertions(+), 20 deletions(-)



[PULL] u-boot-usb/master

2021-09-22 Thread Marek Vasut

Late bunch of USB fixes (incl. the xhci usb 3.1 support)

The following changes since commit a49930f4c6ed5dcbf5127f7bf6d189afa92bffb3:

  Merge https://source.denx.de/u-boot/custodians/u-boot-x86 (2021-09-22 
11:43:12 -0400)


are available in the Git repository at:

  git://source.denx.de/u-boot-usb.git master

for you to fetch changes up to 53eed9adfac17921511ebf9e00c429bcb385d231:

  usb: xhci-dwc3: Add support for USB 3.1 controllers (2021-09-22 
21:29:56 +0200)



Mark Kettenis (1):
  usb: xhci-dwc3: Add support for USB 3.1 controllers

Matthias Schiffer (4):
  usb: add support for ULPI/SERIAL/HSIC PHY modes
  include/configs: replace MXC_EHCI_MODE_SERIAL with PORT_PTS_SERIAL
  usb: ehci-ci: remove redundant PORTSC flag definitions
  usb: ehci-mx6: use phy_type from device tree

Samuel Holland (4):
  phy: sun50i-usb3: Add a driver for the H6 USB3 PHY
  usb: xhci-pci: Move reset logic out of XHCI core
  usb: xhci-dwc3: Add support for clocks/resets
  configs: Enable USB3 on Allwinner H6 boards

 configs/orangepi_3_defconfig|   5 +++
 configs/pine_h64_defconfig  |   5 +++
 drivers/phy/allwinner/Kconfig   |   8 +
 drivers/phy/allwinner/Makefile  |   1 +
 drivers/phy/allwinner/phy-sun50i-usb3.c | 171 
+

 drivers/usb/common/common.c |   3 ++
 drivers/usb/host/ehci-mx6.c |  25 --
 drivers/usb/host/xhci-dwc3.c|  59 
+++-

 drivers/usb/host/xhci-mem.c |   2 --
 drivers/usb/host/xhci-pci.c |  52 +---
 drivers/usb/host/xhci.c |  35 ---
 include/configs/zmx25.h |   2 +-
 include/linux/usb/phy.h |   3 ++
 include/usb/ehci-ci.h   |  12 +--
 include/usb/xhci.h  |   2 --
 15 files changed, 327 insertions(+), 58 deletions(-)
 create mode 100644 drivers/phy/allwinner/phy-sun50i-usb3.c


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 09:56:26PM +0200, Marek Vasut wrote:
> On 9/22/21 9:46 PM, Tom Rini wrote:
> > On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:
> > 
> > > I am talking about using nor%d in MTDIDS in U-Boot UBI code to look up 
> > > from
> > > which device to attach UBI in U-Boot.
> > 
> > OK, so are we not able to pass in the correct name now?  Or just worried
> > about old environment and new U-Boot?
> 
> Say you have the following in board config:
> 
> CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
> CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:-(fs);"
> 
> Then run "=> ubi part fs", which will fail to find nor0, because now that
> nor0 is called something else. That is what this series tries to fix.

Yes, and what is nor0 now, and what happens if you use it?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Vasut

On 9/22/21 9:46 PM, Tom Rini wrote:

On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:


I am talking about using nor%d in MTDIDS in U-Boot UBI code to look up from
which device to attach UBI in U-Boot.


OK, so are we not able to pass in the correct name now?  Or just worried
about old environment and new U-Boot?


Say you have the following in board config:

CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:-(fs);"

Then run "=> ubi part fs", which will fail to find nor0, because now 
that nor0 is called something else. That is what this series tries to fix.


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:

> I am talking about using nor%d in MTDIDS in U-Boot UBI code to look up from
> which device to attach UBI in U-Boot.

OK, so are we not able to pass in the correct name now?  Or just worried
about old environment and new U-Boot?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Makefile: Allow LTO to be disabled for a build

2021-09-22 Thread Marek Behún
On Wed, 22 Sep 2021 21:37:36 +0200
Heinrich Schuchardt  wrote:

> Am 22. September 2021 21:16:50 MESZ schrieb "Marek Behún" 
> :
> >nitpick?
> >  s/optimisation/optimization/  
> 
> British vs American English. I don't think we need to prescribe one or the 
> other.

OK :)


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:
[snip]
> Based on the comment from Tom, I think we are talking about two different
> things here. I am NOT talking about passing mtdparts to Linux at all, there
> using DT is clear.
> 
> I am talking about using nor%d in MTDIDS in U-Boot UBI code to look up from
> which device to attach UBI in U-Boot.

Thanks for clarifying what the use case here is, that does mean we can
stop making incorrect guesses about the problem.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:
> On 9/22/21 9:05 PM, Marek Behún wrote:
> 
> Hi,
> 
> [...]
> 
> > > > I find this either not complete or not needed:
> > > > 
> > > > - either you need mtd names to be of this format so that old MTDPARTS
> > > > config definitions do not need to be changed, i.e. something like
> > > >   CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
> > > > does not work currently, and you want to make it work.
> > > > 
> > > > I find your solution here incomplete because MTDPARTS can also be
> > > > used to be passed to Linux as mtdparts parameter, but there is no
> > > > guarantee that the "norN" numbering you are creating in U-Boot will
> > > > be the same as the one in kernel.
> > > > 
> > > > - or it is not needed, because you can remove MTDPARTS definition from
> > > > the board config entirely and move the information into device tree.
> > > > In fact this was the main idea behind making the series
> > > >   Support SPI NORs and OF partitions in `mtd list`
> > > > The SPI-NOR MTDs after this series can have conflicting names,
> > > > because you can still choose between them via OF path with the `mtd`
> > > > command.
> > > > 
> > > > Tom and I were of the opinion that MTDPARTS should be deprecated and
> > > > removed in favor of OF. Marek Vasut says that this is not possible
> > > > for every board, and so needs to stay.
> > > > 
> > > > BTW, I find it a little weird for Marek to defend old API which should
> > > > be converted to DT, when in discussion about DM USB / Nokia N900
> > > > USB TTY console [1] he was defending the opinion that we should be
> > > > heading to DT in U-Boot.
> > > > 
> > > > [1]
> > > > https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/
> > > 
> > > That USB discussion is completely unrelated to the problem here, the USB
> > > discussion is about internal (i.e. not user facing) conversion to DM/DT.
> > > The user-facing ABI does not change there. Also, that discussion was
> > > about patching USB stack to permit new non-DM/DT operation, not fixing
> > > existing one.
> > 
> > This is not only about the user ABI (altough now I agree that you are
> > correct there, see below). What I meant is this:
> >Should we push for converting to device-tree even if for some boards
> >it is not possible, and would mean removing them?
> 
> The N900 could however be converted to DT as far as I can tell, there was a
> solution which didn't end up patching the USB core with legacy stuff.

Just for the record and to hopefully end this specific tangent, the
"fix" at the time was to correct the "CONFIG_USB means host or gadget"
so that N900 has more time (and an active developer on) migrating gadget
as it does not use host.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Vasut

On 9/22/21 9:23 PM, Tom Rini wrote:

On Wed, Sep 22, 2021 at 09:05:36PM +0200, Marek Behún wrote:

On Wed, 22 Sep 2021 20:24:18 +0200
Marek Vasut  wrote:


On 9/22/21 7:29 PM, Marek Behún wrote:

(Adding also Tom.)

Hi Patrick, Marek,

I find this either not complete or not needed:

- either you need mtd names to be of this format so that old MTDPARTS
config definitions do not need to be changed, i.e. something like
  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
does not work currently, and you want to make it work.

I find your solution here incomplete because MTDPARTS can also be
used to be passed to Linux as mtdparts parameter, but there is no
guarantee that the "norN" numbering you are creating in U-Boot will
be the same as the one in kernel.

- or it is not needed, because you can remove MTDPARTS definition from
the board config entirely and move the information into device tree.
In fact this was the main idea behind making the series
  Support SPI NORs and OF partitions in `mtd list`
The SPI-NOR MTDs after this series can have conflicting names,
because you can still choose between them via OF path with the `mtd`
command.

Tom and I were of the opinion that MTDPARTS should be deprecated and
removed in favor of OF. Marek Vasut says that this is not possible
for every board, and so needs to stay.

BTW, I find it a little weird for Marek to defend old API which should
be converted to DT, when in discussion about DM USB / Nokia N900
USB TTY console [1] he was defending the opinion that we should be
heading to DT in U-Boot.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/


That USB discussion is completely unrelated to the problem here, the USB
discussion is about internal (i.e. not user facing) conversion to DM/DT.
The user-facing ABI does not change there. Also, that discussion was
about patching USB stack to permit new non-DM/DT operation, not fixing
existing one.


This is not only about the user ABI (altough now I agree that you are
correct there, see below). What I meant is this:
   Should we push for converting to device-tree even if for some boards
   it is not possible, and would mean removing them?

   Because you are saying that MTDPARTS cannot be converted to DT for
   some boards.

   But N900 also cannot be reasonably converted because of space
   issues, as far as I understood. Yes, it has gigabytes of eMMC storage,
   and it was proposed to put SPL in MTD and U-Boot proper into eMMC on
   VFAT/ext4, but this simply cannot be done reasonably, because:
   - it would break Linux userspace (existing OS upgrade system would
 have to be rewritten and backwords compatibility would be broken)
   - it would make bootstrapping (booting newer version of U-Boot) while
 developing U-Boot a pain in the ass or maybe even impossible
   - I beleive there was some other reason Pali mentioned, but I cannot
 remember anymore


This problem here is user facing ABI, the mtdparts/mtdids. That user
facing ABI got broken. Boards which do depend on it, even those
currently in tree, are broken. Not all boards can update their
environment, so some backward compatibility of the user facing ABI
should be in place, even though it might not be to the degree Linux
kernel does so. So far, it seems most of the U-Boot command line
interface has managed to retain backward compatibility, I don't see why
this here should be handled any differently.


OK, I get that the if `mtd nor0` was working before, it should work also
now. But the conversion from MTDPARTS to device tree could be probably
done for lots of these, see below.


Note that there are not just a few boards that are broken, but hundreds.
I believe that itself justifies a fix, instead of just throwing all
those hundreds of boards overboard.

u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
203


Only 96 of those also grep the substring "nor". But okay, that is still
a lot. The question is how many of them could be rewritten to DT:

   for cfg in $(git grep -l 'CONFIG_MTDIDS.*nor[0-9]' configs); do
 fgrep CONFIG_DEFAULT_DEVICE_TREE "$cfg"
   done | wc -l

92 of those 96 have CONFIG_DEFAULT_DEVICE_TREE defined.

Of these, 65 contain CONFIG_DM_SPI_FLASH=y, so at least these 65 could
be converted. Of the rest 27, how many could also be converted to DM?
How may use non-DM drivers?


I was thinking maybe we have problems with the platforms that "mtdparts
default", of which we have a handful and most of that handful also do it
to then make use of the partition table within U-Boot (dfu, or update
the on-flash U-Boot).  Of those, it might make most sense to poke the
maintainer directly on how to proceed.


I have a feeling you are talking about a different problem here.

What is broken is U-Boot only look up of MTD device from which to attach 
e.g. UBI or jffs2. That's MTDIDS. There you have that nor0 stuff, see:

cmd/jffs2.c: * mtdi

Re: [PATCH] Makefile: Allow LTO to be disabled for a build

2021-09-22 Thread Heinrich Schuchardt
Am 22. September 2021 21:16:50 MESZ schrieb "Marek Behún" :
>nitpick?
>  s/optimisation/optimization/

British vs American English. I don't think we need to prescribe one or the 
other.

Best regards

Heinrich

>
>Marek



Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Vasut

On 9/22/21 9:05 PM, Marek Behún wrote:

Hi,

[...]


I find this either not complete or not needed:

- either you need mtd names to be of this format so that old MTDPARTS
config definitions do not need to be changed, i.e. something like
  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
does not work currently, and you want to make it work.

I find your solution here incomplete because MTDPARTS can also be
used to be passed to Linux as mtdparts parameter, but there is no
guarantee that the "norN" numbering you are creating in U-Boot will
be the same as the one in kernel.

- or it is not needed, because you can remove MTDPARTS definition from
the board config entirely and move the information into device tree.
In fact this was the main idea behind making the series
  Support SPI NORs and OF partitions in `mtd list`
The SPI-NOR MTDs after this series can have conflicting names,
because you can still choose between them via OF path with the `mtd`
command.

Tom and I were of the opinion that MTDPARTS should be deprecated and
removed in favor of OF. Marek Vasut says that this is not possible
for every board, and so needs to stay.

BTW, I find it a little weird for Marek to defend old API which should
be converted to DT, when in discussion about DM USB / Nokia N900
USB TTY console [1] he was defending the opinion that we should be
heading to DT in U-Boot.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/


That USB discussion is completely unrelated to the problem here, the USB
discussion is about internal (i.e. not user facing) conversion to DM/DT.
The user-facing ABI does not change there. Also, that discussion was
about patching USB stack to permit new non-DM/DT operation, not fixing
existing one.


This is not only about the user ABI (altough now I agree that you are
correct there, see below). What I meant is this:
   Should we push for converting to device-tree even if for some boards
   it is not possible, and would mean removing them?


The N900 could however be converted to DT as far as I can tell, there 
was a solution which didn't end up patching the USB core with legacy stuff.



   Because you are saying that MTDPARTS cannot be converted to DT for
   some boards.

   But N900 also cannot be reasonably converted because of space
   issues, as far as I understood. Yes, it has gigabytes of eMMC storage,
   and it was proposed to put SPL in MTD and U-Boot proper into eMMC on
   VFAT/ext4, but this simply cannot be done reasonably, because:
   - it would break Linux userspace (existing OS upgrade system would
 have to be rewritten and backwords compatibility would be broken)


Not really, there was also the suggestion to use falcon boot and have 
SPL boot Linux directly (i.e. use SPL instead of U-Boot), while only put 
U-Boot into eMMC and boot it if needed and/or as a fallback.


That way you wouldn't break the existing updaters, because you install 
that SPL instead of current U-Boot, and new one could be added to 
install the extra u-boot binary. And that solves your space issue, 
forever no less.



   - it would make bootstrapping (booting newer version of U-Boot) while
 developing U-Boot a pain in the ass or maybe even impossible


Booting U-Boot from U-Boot is unsupported as far as I can tell. It may 
or may not work.



   - I beleive there was some other reason Pali mentioned, but I cannot
 remember anymore


This problem here is user facing ABI, the mtdparts/mtdids. That user
facing ABI got broken. Boards which do depend on it, even those
currently in tree, are broken. Not all boards can update their
environment, so some backward compatibility of the user facing ABI
should be in place, even though it might not be to the degree Linux
kernel does so. So far, it seems most of the U-Boot command line
interface has managed to retain backward compatibility, I don't see why
this here should be handled any differently.


OK, I get that the if `mtd nor0` was working before, it should work also
now. But the conversion from MTDPARTS to device tree could be probably
done for lots of these, see below.


Based on the comment from Tom, I think we are talking about two 
different things here. I am NOT talking about passing mtdparts to Linux 
at all, there using DT is clear.


I am talking about using nor%d in MTDIDS in U-Boot UBI code to look up 
from which device to attach UBI in U-Boot.



Note that there are not just a few boards that are broken, but hundreds.
I believe that itself justifies a fix, instead of just throwing all
those hundreds of boards overboard.

u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
203


Only 96 of those also grep the substring "nor". But okay, that is still
a lot. The question is how many of them could be rewritten to DT:

   for cfg in $(git grep -l 'CONFIG_MTDIDS.*nor[0-9]' configs); do
 fgrep CONFIG_DEFAULT_DEVICE_TREE "$cfg"
   done | wc

Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Vasut

On 9/22/21 8:42 PM, Tom Rini wrote:

On Wed, Sep 22, 2021 at 08:24:18PM +0200, Marek Vasut wrote:

On 9/22/21 7:29 PM, Marek Behún wrote:

(Adding also Tom.)

Hi Patrick, Marek,

I find this either not complete or not needed:

- either you need mtd names to be of this format so that old MTDPARTS
config definitions do not need to be changed, i.e. something like
  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
does not work currently, and you want to make it work.

I find your solution here incomplete because MTDPARTS can also be
used to be passed to Linux as mtdparts parameter, but there is no
guarantee that the "norN" numbering you are creating in U-Boot will
be the same as the one in kernel.

- or it is not needed, because you can remove MTDPARTS definition from
the board config entirely and move the information into device tree.
In fact this was the main idea behind making the series
  Support SPI NORs and OF partitions in `mtd list`
The SPI-NOR MTDs after this series can have conflicting names,
because you can still choose between them via OF path with the `mtd`
command.

Tom and I were of the opinion that MTDPARTS should be deprecated and
removed in favor of OF. Marek Vasut says that this is not possible
for every board, and so needs to stay.

BTW, I find it a little weird for Marek to defend old API which should
be converted to DT, when in discussion about DM USB / Nokia N900
USB TTY console [1] he was defending the opinion that we should be
heading to DT in U-Boot.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/


That USB discussion is completely unrelated to the problem here, the USB
discussion is about internal (i.e. not user facing) conversion to DM/DT. The
user-facing ABI does not change there. Also, that discussion was about
patching USB stack to permit new non-DM/DT operation, not fixing existing
one.

This problem here is user facing ABI, the mtdparts/mtdids. That user facing
ABI got broken. Boards which do depend on it, even those currently in tree,
are broken. Not all boards can update their environment, so some backward
compatibility of the user facing ABI should be in place, even though it
might not be to the degree Linux kernel does so. So far, it seems most of
the U-Boot command line interface has managed to retain backward
compatibility, I don't see why this here should be handled any differently.

Note that there are not just a few boards that are broken, but hundreds. I
believe that itself justifies a fix, instead of just throwing all those
hundreds of boards overboard.

u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
203

Hopefully that clarifies the difference.


It doesn't quite, sorry.  If you have "mtdparts=... mtdids=..." in your
cmdline that you pass to Linux, U-Boot doesn't care.


The MTDIDS is used by UBI code in U-Boot to locate from which MTD device 
to attach UBI. That is currently broken at least for UBI on SPI NOR or 
parallel NOR. This has nothing to do with passing mtdparts/mtdids to Linux.



That's one of the
main users of CONFIG_MTDIDS/MTDPARTS today, which could in some good
number of cases be removed (take am335x_evm_defconfig for example, the
table has been defined in the upstream DT for forever).  Taking a look
at:
commit 938db6fe5da3581ed2c17d64c7e016a7a8df5237
Author: Miquel Raynal 
Date:   Sat Sep 29 12:58:30 2018 +0200

 cmd: mtdparts: describe as legacy
 
 The 'mtdparts' command is not needed anymore. While the environment

 variable is still valid (and useful, along with the 'mtdids' one), the
 command has been replaced by 'mtd' which is much more close to the MTD
 stack and do not add its own specific glue.
 
 Signed-off-by: Miquel Raynal 

 Reviewed-by: Stefan Roese 
 Reviewed-by: Boris Brezillon 

Is when "mtdparts" in U-Boot was noted as legacy.  So what exactly are
we fixing with this series?  Nothing changed about hard-coded values
being passed along.  What may have broken was some progmatic way to set
those, but I think that's both fragile and deprecated in favor of the
table being in the DT.




Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 09:05:36PM +0200, Marek Behún wrote:
> On Wed, 22 Sep 2021 20:24:18 +0200
> Marek Vasut  wrote:
> 
> > On 9/22/21 7:29 PM, Marek Behún wrote:
> > > (Adding also Tom.)
> > > 
> > > Hi Patrick, Marek,
> > > 
> > > I find this either not complete or not needed:
> > > 
> > > - either you need mtd names to be of this format so that old MTDPARTS
> > >config definitions do not need to be changed, i.e. something like
> > >  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
> > >does not work currently, and you want to make it work.
> > > 
> > >I find your solution here incomplete because MTDPARTS can also be
> > >used to be passed to Linux as mtdparts parameter, but there is no
> > >guarantee that the "norN" numbering you are creating in U-Boot will
> > >be the same as the one in kernel.
> > > 
> > > - or it is not needed, because you can remove MTDPARTS definition from
> > >the board config entirely and move the information into device tree.
> > >In fact this was the main idea behind making the series
> > >  Support SPI NORs and OF partitions in `mtd list`
> > >The SPI-NOR MTDs after this series can have conflicting names,
> > >because you can still choose between them via OF path with the `mtd`
> > >command.
> > > 
> > >Tom and I were of the opinion that MTDPARTS should be deprecated and
> > >removed in favor of OF. Marek Vasut says that this is not possible
> > >for every board, and so needs to stay.
> > > 
> > > BTW, I find it a little weird for Marek to defend old API which should
> > > be converted to DT, when in discussion about DM USB / Nokia N900
> > > USB TTY console [1] he was defending the opinion that we should be
> > > heading to DT in U-Boot.
> > > 
> > > [1]
> > > https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/
> > >   
> > 
> > That USB discussion is completely unrelated to the problem here, the USB 
> > discussion is about internal (i.e. not user facing) conversion to DM/DT. 
> > The user-facing ABI does not change there. Also, that discussion was 
> > about patching USB stack to permit new non-DM/DT operation, not fixing 
> > existing one.
> 
> This is not only about the user ABI (altough now I agree that you are
> correct there, see below). What I meant is this:
>   Should we push for converting to device-tree even if for some boards
>   it is not possible, and would mean removing them?
> 
>   Because you are saying that MTDPARTS cannot be converted to DT for
>   some boards.
> 
>   But N900 also cannot be reasonably converted because of space
>   issues, as far as I understood. Yes, it has gigabytes of eMMC storage,
>   and it was proposed to put SPL in MTD and U-Boot proper into eMMC on
>   VFAT/ext4, but this simply cannot be done reasonably, because:
>   - it would break Linux userspace (existing OS upgrade system would
> have to be rewritten and backwords compatibility would be broken)
>   - it would make bootstrapping (booting newer version of U-Boot) while
> developing U-Boot a pain in the ass or maybe even impossible
>   - I beleive there was some other reason Pali mentioned, but I cannot
> remember anymore
> 
> > This problem here is user facing ABI, the mtdparts/mtdids. That user 
> > facing ABI got broken. Boards which do depend on it, even those 
> > currently in tree, are broken. Not all boards can update their 
> > environment, so some backward compatibility of the user facing ABI 
> > should be in place, even though it might not be to the degree Linux 
> > kernel does so. So far, it seems most of the U-Boot command line 
> > interface has managed to retain backward compatibility, I don't see why 
> > this here should be handled any differently.
> 
> OK, I get that the if `mtd nor0` was working before, it should work also
> now. But the conversion from MTDPARTS to device tree could be probably
> done for lots of these, see below.
> 
> > Note that there are not just a few boards that are broken, but hundreds. 
> > I believe that itself justifies a fix, instead of just throwing all 
> > those hundreds of boards overboard.
> > 
> > u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
> > 203
> 
> Only 96 of those also grep the substring "nor". But okay, that is still
> a lot. The question is how many of them could be rewritten to DT:
> 
>   for cfg in $(git grep -l 'CONFIG_MTDIDS.*nor[0-9]' configs); do
> fgrep CONFIG_DEFAULT_DEVICE_TREE "$cfg"
>   done | wc -l
> 
> 92 of those 96 have CONFIG_DEFAULT_DEVICE_TREE defined.
> 
> Of these, 65 contain CONFIG_DM_SPI_FLASH=y, so at least these 65 could
> be converted. Of the rest 27, how many could also be converted to DM?
> How may use non-DM drivers?

I was thinking maybe we have problems with the platforms that "mtdparts
default", of which we have a handful and most of that handful also do it
to then make use of the partition table within U-Boot (dfu, or update
the on-flash U-Boot).  Of

Re: [PATCH] Makefile: Allow LTO to be disabled for a build

2021-09-22 Thread Marek Behún
nitpick?
  s/optimisation/optimization/

Marek


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Behún
On Wed, 22 Sep 2021 14:42:30 -0400
Tom Rini  wrote:

> On Wed, Sep 22, 2021 at 08:24:18PM +0200, Marek Vasut wrote:
> > On 9/22/21 7:29 PM, Marek Behún wrote:  
> > > (Adding also Tom.)
> > > 
> > > Hi Patrick, Marek,
> > > 
> > > I find this either not complete or not needed:
> > > 
> > > - either you need mtd names to be of this format so that old MTDPARTS
> > >config definitions do not need to be changed, i.e. something like
> > >  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
> > >does not work currently, and you want to make it work.
> > > 
> > >I find your solution here incomplete because MTDPARTS can also be
> > >used to be passed to Linux as mtdparts parameter, but there is no
> > >guarantee that the "norN" numbering you are creating in U-Boot will
> > >be the same as the one in kernel.
> > > 
> > > - or it is not needed, because you can remove MTDPARTS definition from
> > >the board config entirely and move the information into device tree.
> > >In fact this was the main idea behind making the series
> > >  Support SPI NORs and OF partitions in `mtd list`
> > >The SPI-NOR MTDs after this series can have conflicting names,
> > >because you can still choose between them via OF path with the `mtd`
> > >command.
> > > 
> > >Tom and I were of the opinion that MTDPARTS should be deprecated and
> > >removed in favor of OF. Marek Vasut says that this is not possible
> > >for every board, and so needs to stay.
> > > 
> > > BTW, I find it a little weird for Marek to defend old API which should
> > > be converted to DT, when in discussion about DM USB / Nokia N900
> > > USB TTY console [1] he was defending the opinion that we should be
> > > heading to DT in U-Boot.
> > > 
> > > [1]
> > > https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/
> > >   
> > 
> > That USB discussion is completely unrelated to the problem here, the USB
> > discussion is about internal (i.e. not user facing) conversion to DM/DT. The
> > user-facing ABI does not change there. Also, that discussion was about
> > patching USB stack to permit new non-DM/DT operation, not fixing existing
> > one.
> > 
> > This problem here is user facing ABI, the mtdparts/mtdids. That user facing
> > ABI got broken. Boards which do depend on it, even those currently in tree,
> > are broken. Not all boards can update their environment, so some backward
> > compatibility of the user facing ABI should be in place, even though it
> > might not be to the degree Linux kernel does so. So far, it seems most of
> > the U-Boot command line interface has managed to retain backward
> > compatibility, I don't see why this here should be handled any differently.
> > 
> > Note that there are not just a few boards that are broken, but hundreds. I
> > believe that itself justifies a fix, instead of just throwing all those
> > hundreds of boards overboard.
> > 
> > u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
> > 203
> > 
> > Hopefully that clarifies the difference.  
> 
> It doesn't quite, sorry.  If you have "mtdparts=... mtdids=..." in your
> cmdline that you pass to Linux, U-Boot doesn't care.  That's one of the
> main users of CONFIG_MTDIDS/MTDPARTS today, which could in some good
> number of cases be removed (take am335x_evm_defconfig for example, the
> table has been defined in the upstream DT for forever).  Taking a look
> at:
> commit 938db6fe5da3581ed2c17d64c7e016a7a8df5237
> Author: Miquel Raynal 
> Date:   Sat Sep 29 12:58:30 2018 +0200
> 
> cmd: mtdparts: describe as legacy
> 
> The 'mtdparts' command is not needed anymore. While the environment
> variable is still valid (and useful, along with the 'mtdids' one), the
> command has been replaced by 'mtd' which is much more close to the MTD
> stack and do not add its own specific glue.
> 
> Signed-off-by: Miquel Raynal 
> Reviewed-by: Stefan Roese 
> Reviewed-by: Boris Brezillon 
> 
> Is when "mtdparts" in U-Boot was noted as legacy.  So what exactly are
> we fixing with this series?  Nothing changed about hard-coded values
> being passed along.  What may have broken was some progmatic way to set
> those, but I think that's both fragile and deprecated in favor of the
> table being in the DT.
> 

We may be fixing user scripts hardcoded with something like
  mtd read nor0

The question is how many users use something like this, and how many
just need the norN names for mtdparts.

Marek


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Behún
On Wed, 22 Sep 2021 20:24:18 +0200
Marek Vasut  wrote:

> On 9/22/21 7:29 PM, Marek Behún wrote:
> > (Adding also Tom.)
> > 
> > Hi Patrick, Marek,
> > 
> > I find this either not complete or not needed:
> > 
> > - either you need mtd names to be of this format so that old MTDPARTS
> >config definitions do not need to be changed, i.e. something like
> >  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
> >does not work currently, and you want to make it work.
> > 
> >I find your solution here incomplete because MTDPARTS can also be
> >used to be passed to Linux as mtdparts parameter, but there is no
> >guarantee that the "norN" numbering you are creating in U-Boot will
> >be the same as the one in kernel.
> > 
> > - or it is not needed, because you can remove MTDPARTS definition from
> >the board config entirely and move the information into device tree.
> >In fact this was the main idea behind making the series
> >  Support SPI NORs and OF partitions in `mtd list`
> >The SPI-NOR MTDs after this series can have conflicting names,
> >because you can still choose between them via OF path with the `mtd`
> >command.
> > 
> >Tom and I were of the opinion that MTDPARTS should be deprecated and
> >removed in favor of OF. Marek Vasut says that this is not possible
> >for every board, and so needs to stay.
> > 
> > BTW, I find it a little weird for Marek to defend old API which should
> > be converted to DT, when in discussion about DM USB / Nokia N900
> > USB TTY console [1] he was defending the opinion that we should be
> > heading to DT in U-Boot.
> > 
> > [1]
> > https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/
> >   
> 
> That USB discussion is completely unrelated to the problem here, the USB 
> discussion is about internal (i.e. not user facing) conversion to DM/DT. 
> The user-facing ABI does not change there. Also, that discussion was 
> about patching USB stack to permit new non-DM/DT operation, not fixing 
> existing one.

This is not only about the user ABI (altough now I agree that you are
correct there, see below). What I meant is this:
  Should we push for converting to device-tree even if for some boards
  it is not possible, and would mean removing them?

  Because you are saying that MTDPARTS cannot be converted to DT for
  some boards.

  But N900 also cannot be reasonably converted because of space
  issues, as far as I understood. Yes, it has gigabytes of eMMC storage,
  and it was proposed to put SPL in MTD and U-Boot proper into eMMC on
  VFAT/ext4, but this simply cannot be done reasonably, because:
  - it would break Linux userspace (existing OS upgrade system would
have to be rewritten and backwords compatibility would be broken)
  - it would make bootstrapping (booting newer version of U-Boot) while
developing U-Boot a pain in the ass or maybe even impossible
  - I beleive there was some other reason Pali mentioned, but I cannot
remember anymore

> This problem here is user facing ABI, the mtdparts/mtdids. That user 
> facing ABI got broken. Boards which do depend on it, even those 
> currently in tree, are broken. Not all boards can update their 
> environment, so some backward compatibility of the user facing ABI 
> should be in place, even though it might not be to the degree Linux 
> kernel does so. So far, it seems most of the U-Boot command line 
> interface has managed to retain backward compatibility, I don't see why 
> this here should be handled any differently.

OK, I get that the if `mtd nor0` was working before, it should work also
now. But the conversion from MTDPARTS to device tree could be probably
done for lots of these, see below.

> Note that there are not just a few boards that are broken, but hundreds. 
> I believe that itself justifies a fix, instead of just throwing all 
> those hundreds of boards overboard.
> 
> u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
> 203

Only 96 of those also grep the substring "nor". But okay, that is still
a lot. The question is how many of them could be rewritten to DT:

  for cfg in $(git grep -l 'CONFIG_MTDIDS.*nor[0-9]' configs); do
fgrep CONFIG_DEFAULT_DEVICE_TREE "$cfg"
  done | wc -l

92 of those 96 have CONFIG_DEFAULT_DEVICE_TREE defined.

Of these, 65 contain CONFIG_DM_SPI_FLASH=y, so at least these 65 could
be converted. Of the rest 27, how many could also be converted to DM?
How may use non-DM drivers?

Marek


[PATCH 09/14] Convert CONFIG_SYS_NAND_ONFI_DETECTION to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_NAND_ONFI_DETECTION

Signed-off-by: Tom Rini 
---
 configs/CHIP_pro_defconfig   | 1 +
 configs/Nintendo_NES_Classic_Edition_defconfig   | 1 +
 configs/P1010RDB-PB_36BIT_NAND_defconfig | 1 +
 configs/P1010RDB-PB_NAND_defconfig   | 1 +
 configs/T1024RDB_NAND_defconfig  | 1 +
 configs/T1042D4RDB_NAND_defconfig| 1 +
 configs/T2080QDS_NAND_defconfig  | 1 +
 configs/T2080RDB_NAND_defconfig  | 1 +
 configs/T2080RDB_revD_NAND_defconfig | 1 +
 configs/am335x_baltos_defconfig  | 1 +
 configs/am335x_evm_defconfig | 1 +
 configs/am335x_evm_spiboot_defconfig | 1 +
 configs/am335x_guardian_defconfig| 1 +
 configs/am335x_hs_evm_defconfig  | 1 +
 configs/am335x_hs_evm_uart_defconfig | 1 +
 configs/am335x_igep003x_defconfig| 1 +
 configs/am43xx_evm_defconfig | 1 +
 configs/am43xx_evm_rtconly_defconfig | 1 +
 configs/am43xx_evm_usbhost_boot_defconfig| 1 +
 configs/am43xx_hs_evm_defconfig  | 1 +
 configs/bcm963158_ram_defconfig  | 1 +
 configs/bcm968360bg_ram_defconfig| 1 +
 configs/bcm968380gerg_ram_defconfig  | 1 +
 configs/bcm968580xref_ram_defconfig  | 1 +
 configs/bitmain_antminer_s9_defconfig| 1 +
 configs/bk4r1_defconfig  | 1 +
 configs/chiliboard_defconfig | 1 +
 configs/cm_fx6_defconfig | 1 +
 configs/cm_t335_defconfig| 1 +
 configs/cm_t43_defconfig | 1 +
 configs/colibri-imx6ull_defconfig| 1 +
 configs/colibri_imx7_defconfig   | 1 +
 configs/colibri_t20_defconfig| 1 +
 configs/colibri_vf_defconfig | 1 +
 configs/comtrend_vr3032u_ram_defconfig   | 1 +
 configs/cortina_presidio-asic-pnand_defconfig| 1 +
 configs/db-88f6820-amc_defconfig | 1 +
 configs/db-mv784mp-gp_defconfig  | 1 +
 configs/db-xc3-24g4xg_defconfig  | 1 +
 configs/dra7xx_evm_defconfig | 1 +
 configs/dra7xx_hs_evm_defconfig  | 1 +
 configs/draco_defconfig  | 1 +
 configs/etamin_defconfig | 1 +
 configs/harmony_defconfig| 1 +
 configs/imx6dl_icore_nand_defconfig  | 1 +
 configs/imx6q_icore_nand_defconfig   | 1 +
 configs/imx6q_logic_defconfig| 1 +
 configs/imx6qdl_icore_mmc_defconfig  | 1 +
 configs/imx6qdl_icore_nand_defconfig | 1 +
 configs/imx6ul_geam_nand_defconfig   | 1 +
 configs/imx6ul_isiot_nand_defconfig  | 1 +
 configs/kmcent2_defconfig| 1 +
 configs/ls1021aqds_ddr4_nor_defconfig| 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 +
 configs/ls1021aqds_nand_defconfig| 1 +
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig | 1 +
 configs/ls1021aqds_nor_defconfig | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig  | 1 +
 configs/ls1021aqds_sdcard_ifc_defconfig  | 1 +
 configs/ls1043aqds_defconfig | 1 +
 configs/ls1043aqds_lpuart_defconfig  | 1 +
 configs/ls1043aqds_nand_defconfig| 1 +
 configs/ls1043aqds_nor_ddr3_defconfig| 1 +
 configs/ls1043aqds_sdcard_ifc_defconfig  | 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1043aqds_tfa_defconfig | 1 +
 configs/ls1043ardb_SECURE_BOOT_defconfig | 1 +
 configs/ls1043ardb_defconfig | 1 +
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig| 1 +
 configs/ls1043ardb_nand_defconfig| 1 +
 configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig  | 1 +
 configs/ls1043ardb_sdcard_defconfig  | 1 +
 configs/ls1043ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1043ardb_tfa_defconfig | 1 +
 configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig| 1 +
 configs/ls1046afrwy_tfa_defconfig| 1 +
 configs/ls1046aqds_SECURE_BOOT_defconfig | 1 +
 configs/ls1046aqds_defconfig | 1 +
 configs/ls1046aqds_lpuart_defconfig  | 1 +
 configs/ls1046aqds_nand_defconfig| 1 +
 configs/ls1046aqds_sdcard_ifc_defconfig  | 1 +
 configs/ls1046aqds_tfa_SECURE_BOOT

[PATCH 13/14] Convert CONFIG_SYS_NAND_U_BOOT_LOCATIONS et al to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_NAND_U_BOOT_LOCATIONS
   CONFIG_SYS_NAND_U_BOOT_OFFS

Signed-off-by: Tom Rini 
---
 README  | 3 ---
 configs/am335x_baltos_defconfig | 2 +-
 configs/am335x_evm_defconfig| 2 ++
 configs/am335x_evm_spiboot_defconfig| 2 ++
 configs/am335x_hs_evm_defconfig | 2 ++
 configs/am335x_hs_evm_uart_defconfig| 2 ++
 configs/am43xx_evm_defconfig| 2 ++
 configs/am43xx_evm_rtconly_defconfig| 2 ++
 configs/am43xx_evm_usbhost_boot_defconfig   | 2 ++
 configs/am43xx_hs_evm_defconfig | 2 ++
 configs/axm_defconfig   | 2 ++
 configs/chiliboard_defconfig| 2 ++
 configs/cm_t335_defconfig   | 2 ++
 configs/corvus_defconfig| 2 ++
 configs/devkit3250_defconfig| 2 ++
 configs/devkit8000_defconfig| 2 ++
 configs/dra7xx_evm_defconfig| 2 ++
 configs/dra7xx_hs_evm_defconfig | 2 ++
 configs/draco_defconfig | 2 ++
 configs/etamin_defconfig| 2 ++
 configs/gardena-smart-gateway-at91sam_defconfig | 2 ++
 configs/gwventana_nand_defconfig| 2 ++
 configs/imx6dl_icore_nand_defconfig | 2 ++
 configs/imx6q_icore_nand_defconfig  | 2 ++
 configs/imx6q_logic_defconfig   | 2 ++
 configs/imx6qdl_icore_mmc_defconfig | 2 ++
 configs/imx6qdl_icore_nand_defconfig| 2 ++
 configs/imx6ul_geam_nand_defconfig  | 2 ++
 configs/imx6ul_isiot_nand_defconfig | 2 ++
 configs/ls1021aqds_nand_defconfig   | 2 ++
 configs/ls1043aqds_nand_defconfig   | 2 ++
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig   | 2 ++
 configs/ls1043ardb_nand_defconfig   | 2 ++
 configs/ls1046aqds_nand_defconfig   | 2 ++
 configs/ls2080aqds_nand_defconfig   | 2 ++
 configs/ls2080ardb_nand_defconfig   | 2 ++
 configs/m53menlo_defconfig  | 2 ++
 configs/pxm2_defconfig  | 2 ++
 configs/rastaban_defconfig  | 2 ++
 configs/rut_defconfig   | 2 ++
 configs/sama5d3_xplained_mmc_defconfig  | 2 ++
 configs/sama5d3_xplained_nandflash_defconfig| 2 ++
 configs/sama5d3xek_mmc_defconfig| 2 ++
 configs/sama5d3xek_nandflash_defconfig  | 2 ++
 configs/sama5d3xek_spiflash_defconfig   | 2 ++
 configs/sama5d4_xplained_mmc_defconfig  | 2 ++
 configs/sama5d4_xplained_nandflash_defconfig| 2 ++
 configs/sama5d4_xplained_spiflash_defconfig | 2 ++
 configs/sama5d4ek_mmc_defconfig | 2 ++
 configs/sama5d4ek_nandflash_defconfig   | 2 ++
 configs/sama5d4ek_spiflash_defconfig| 2 ++
 configs/smartweb_defconfig  | 2 ++
 configs/socfpga_secu1_defconfig | 2 ++
 configs/taurus_defconfig| 2 ++
 configs/thuban_defconfig| 2 ++
 configs/ti816x_evm_defconfig| 2 ++
 configs/uniphier_ld4_sld8_defconfig | 2 ++
 configs/uniphier_v7_defconfig   | 2 ++
 configs/work_92105_defconfig| 2 ++
 include/configs/am335x_evm.h| 1 -
 include/configs/am3517_evm.h| 1 -
 include/configs/am43xx_evm.h| 1 -
 include/configs/at91sam9m10g45ek.h  | 1 -
 include/configs/at91sam9n12ek.h | 1 -
 include/configs/at91sam9x5ek.h  | 1 -
 include/configs/brppt1.h| 1 -
 include/configs/chiliboard.h| 1 -
 include/configs/cm_t335.h   | 3 ---
 include/configs/corvus.h| 1 -
 include/configs/devkit3250.h| 1 -
 include/configs/devkit8000.h| 1 -
 include/configs/dra7xx_evm.h| 1 -
 include/configs/etamin.h| 3 ---
 include/configs/gardena-smart-gateway-at91sam.h | 1 -
 include/configs/gw_ventana.h| 1 -
 include/configs/imx6-engicam.h  | 1 -
 include/configs/imx6_logic.h| 1 -
 include/configs/ls1021aqds.h| 1 -
 include/configs/ls1043aqds.h| 1 -
 include/configs/ls1043ardb.h| 1 -
 include/configs/ls1046aqds.h| 1 -
 include/configs/ls2080aqds.h| 1 -
 include/configs/ls2080ardb.h| 1 -
 include/configs/m53menlo.h  | 1 -
 include/configs/omap3_beagle.h  | 1 -
 include/configs/pm9g45.h| 1 -
 include/configs/sama5d3_xplained.h  | 1 -
 include/conf

[PATCH 14/14] Convert CONFIG_NAND_OMAP_ECCSCHEME to Kconfig

2021-09-22 Thread Tom Rini
The values of CONFIG_NAND_OMAP_ECCSCHEME map to the enum in
include/linux/mtd/omap_gpmc.h for valid ECC schemes.  Make which one we
will use be a choice statement, enumerating the ones which we have
implemented.

Signed-off-by: Tom Rini 
---
 configs/am335x_guardian_defconfig |   1 +
 configs/am3517_evm_defconfig  |   1 +
 configs/am43xx_evm_defconfig  |   1 +
 configs/am43xx_evm_rtconly_defconfig  |   1 +
 configs/am43xx_evm_usbhost_boot_defconfig |   1 +
 configs/am43xx_hs_evm_defconfig   |   1 +
 configs/devkit8000_defconfig  |   1 +
 configs/etamin_defconfig  |   1 +
 configs/igep00x0_defconfig|   1 +
 configs/omap35_logic_defconfig|   1 +
 configs/omap35_logic_somlv_defconfig  |   1 +
 configs/omap3_beagle_defconfig|   1 +
 configs/omap3_evm_defconfig   |   1 +
 configs/omap3_logic_defconfig |   1 +
 configs/omap3_logic_somlv_defconfig   |   1 +
 doc/README.nand   |  66 --
 drivers/mtd/nand/raw/Kconfig  | 103 +-
 include/configs/am335x_evm.h  |   1 -
 include/configs/am335x_guardian.h |   1 -
 include/configs/am335x_igep003x.h |   1 -
 include/configs/am3517_evm.h  |   1 -
 include/configs/am43xx_evm.h  |   1 -
 include/configs/baltos.h  |   1 -
 include/configs/brppt1.h  |   1 -
 include/configs/chiliboard.h  |   1 -
 include/configs/cm_t43.h  |   1 -
 include/configs/devkit8000.h  |   1 -
 include/configs/dra7xx_evm.h  |   1 -
 include/configs/etamin.h  |   2 -
 include/configs/omap3_beagle.h|   1 -
 include/configs/omap3_evm.h   |   1 -
 include/configs/omap3_igep00x0.h  |   1 -
 include/configs/omap3_logic.h |   1 -
 include/configs/phycore_am335x_r2.h   |   1 -
 include/configs/siemens-am33x-common.h|   1 -
 include/configs/tam3517-common.h  |   1 -
 include/configs/ti816x_evm.h  |   1 -
 37 files changed, 116 insertions(+), 89 deletions(-)

diff --git a/configs/am335x_guardian_defconfig 
b/configs/am335x_guardian_defconfig
index 272d5b877514..ea4032fe1ff0 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -88,6 +88,7 @@ CONFIG_MISC=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH16_CODE_HW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index 665c54a88189..17b301756d9c 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -57,6 +57,7 @@ CONFIG_DM_PCA953X=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x2
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
 CONFIG_SYS_NAND_PAGE_SIZE=0x800
diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig
index 59256c1894d8..443bdca096bb 100644
--- a/configs/am43xx_evm_defconfig
+++ b/configs/am43xx_evm_defconfig
@@ -60,6 +60,7 @@ CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH16_CODE_HW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
diff --git a/configs/am43xx_evm_rtconly_defconfig 
b/configs/am43xx_evm_rtconly_defconfig
index 8b35144164b2..183801120296 100644
--- a/configs/am43xx_evm_rtconly_defconfig
+++ b/configs/am43xx_evm_rtconly_defconfig
@@ -47,6 +47,7 @@ CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH16_CODE_HW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
diff --git a/configs/am43xx_evm_usbhost_boot_defconfig 
b/configs/am43xx_evm_usbhost_boot_defconfig
index 119392d84826..c5a6a07b3240 100644
--- a/configs/am43xx_evm_usbhost_boot_defconfig
+++ b/configs/am43xx_evm_usbhost_boot_defconfig
@@ -63,6 +63,7 @@ CONFIG_MISC=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH16_CODE_HW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
diff --git a/configs/am43xx_hs_evm_defconfig b/configs/am43xx_hs_evm_defconfig
index 2ab15c975b99..1eb394cbd8df 100644
--- a/configs/am43xx_hs_evm_defconfig
+++ b/configs/am43xx_hs_evm_defconfig
@@ -65,6 +65,7 @@ CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH16_CODE_HW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
diff --git a/configs/devkit8000_defconfig b/configs/devkit8000_defconf

[PATCH 10/14] nand.h: Cleanup linux/mtd/rawnand.h usage

2021-09-22 Thread Tom Rini
We only include  in  for the forward
declaration of struct nand_chip, so do that directly.  Then, include
 where required directly.

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/ti-common/davinci_nand.h | 1 -
 arch/arm/mach-imx/cmd_nandbcb.c   | 1 +
 board/cssi/MCR3000/nand.c | 1 +
 board/freescale/m5329evb/nand.c   | 1 +
 board/freescale/m5373evb/nand.c   | 1 +
 board/socrates/nand.c | 1 +
 board/xes/common/actl_nand.c  | 1 +
 cmd/nand.c| 1 +
 drivers/mtd/nand/raw/am335x_spl_bch.c | 1 +
 drivers/mtd/nand/raw/atmel_nand.c | 1 +
 drivers/mtd/nand/raw/brcmnand/brcmnand.c  | 1 +
 drivers/mtd/nand/raw/cortina_nand.c   | 1 +
 drivers/mtd/nand/raw/davinci_nand.c   | 1 +
 drivers/mtd/nand/raw/fsl_elbc_spl.c   | 1 +
 drivers/mtd/nand/raw/fsl_upm.c| 1 +
 drivers/mtd/nand/raw/fsmc_nand.c  | 1 +
 drivers/mtd/nand/raw/kb9202_nand.c| 1 +
 drivers/mtd/nand/raw/kirkwood_nand.c  | 1 +
 drivers/mtd/nand/raw/kmeter1_nand.c   | 1 +
 drivers/mtd/nand/raw/lpc32xx_nand_mlc.c   | 1 +
 drivers/mtd/nand/raw/lpc32xx_nand_slc.c   | 1 +
 drivers/mtd/nand/raw/mxc_nand.c   | 1 +
 drivers/mtd/nand/raw/mxc_nand_spl.c   | 1 +
 drivers/mtd/nand/raw/mxs_nand_spl.c   | 1 +
 drivers/mtd/nand/raw/nand.c   | 1 +
 drivers/mtd/nand/raw/nand_plat.c  | 1 +
 drivers/mtd/nand/raw/nand_spl_simple.c| 1 +
 drivers/mtd/nand/raw/nand_util.c  | 1 +
 drivers/mtd/nand/raw/octeontx_nand.c  | 1 +
 drivers/mtd/nand/raw/omap_gpmc.c  | 1 +
 drivers/mtd/nand/raw/rockchip_nfc.c   | 1 +
 drivers/mtd/nand/raw/stm32_fmc2_nand.c| 1 +
 drivers/mtd/nand/raw/sunxi_nand_spl.c | 1 +
 drivers/mtd/nand/raw/tegra_nand.c | 1 +
 fs/yaffs2/yaffs_uboot_glue.c  | 1 +
 include/mxs_nand.h| 1 +
 include/nand.h| 3 ++-
 37 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/ti-common/davinci_nand.h 
b/arch/arm/include/asm/ti-common/davinci_nand.h
index 28842c3b1552..222dd705cd10 100644
--- a/arch/arm/include/asm/ti-common/davinci_nand.h
+++ b/arch/arm/include/asm/ti-common/davinci_nand.h
@@ -9,7 +9,6 @@
 #ifndef _DAVINCI_NAND_H_
 #define _DAVINCI_NAND_H_
 
-#include 
 #include 
 
 #define NAND_READ_START0x00
diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c
index cd5134459787..09622c13c980 100644
--- a/arch/arm/mach-imx/cmd_nandbcb.c
+++ b/arch/arm/mach-imx/cmd_nandbcb.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/board/cssi/MCR3000/nand.c b/board/cssi/MCR3000/nand.c
index 15a10bffadc1..11aca4ff7363 100644
--- a/board/cssi/MCR3000/nand.c
+++ b/board/cssi/MCR3000/nand.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define BIT_CLE((unsigned short)0x0800)
diff --git a/board/freescale/m5329evb/nand.c b/board/freescale/m5329evb/nand.c
index 58b8ee51d378..a10c365ec378 100644
--- a/board/freescale/m5329evb/nand.c
+++ b/board/freescale/m5329evb/nand.c
@@ -15,6 +15,7 @@
 #if defined(CONFIG_CMD_NAND)
 #include 
 #include 
+#include 
 
 #define SET_CLE0x10
 #define SET_ALE0x08
diff --git a/board/freescale/m5373evb/nand.c b/board/freescale/m5373evb/nand.c
index 4c30d5100181..fdf3e0ac1b1b 100644
--- a/board/freescale/m5373evb/nand.c
+++ b/board/freescale/m5373evb/nand.c
@@ -15,6 +15,7 @@
 #if defined(CONFIG_CMD_NAND)
 #include 
 #include 
+#include 
 
 #define SET_CLE0x10
 #define SET_ALE0x08
diff --git a/board/socrates/nand.c b/board/socrates/nand.c
index 07c493679bf0..9b7ffee83a41 100644
--- a/board/socrates/nand.c
+++ b/board/socrates/nand.c
@@ -9,6 +9,7 @@
 #if defined(CONFIG_SYS_NAND_BASE)
 #include 
 #include 
+#include 
 #include 
 
 static int state;
diff --git a/board/xes/common/actl_nand.c b/board/xes/common/actl_nand.c
index 4e52838c9095..2d8a57576a6c 100644
--- a/board/xes/common/actl_nand.c
+++ b/board/xes/common/actl_nand.c
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/cmd/nand.c b/cmd/nand.c
index d381053c6ac6..df5a4b1db1a0 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/mtd/nand/raw/am335x_spl_bch.c 
b/drivers/mtd/nand/raw/am335x_spl_bch.c
index b6fc5f29c7a8..83590a63ccaf 100644
--- a/drivers/mtd/nand/raw/am335x_spl_bch.c
+++ b/drivers/mtd/nand/raw/am335x_spl_bch.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
 static struct mtd_info *mtd;
diff --git a/drivers/mtd/nand/raw/atmel_nand.c 
b

[PATCH 12/14] Convert CONFIG_NAND_FSL_ELBC et al to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_NAND_FSL_ELBC
   CONFIG_NAND_FSL_IFC

Note that a number of PowerPC platforms had previously enabled
CONFIG_NAND_FSL_ELBC without CONFIG_MTD_RAW_NAND, and now they no longer
enable the option, reducing the size of a few functions.

Signed-off-by: Tom Rini 
---
 arch/powerpc/include/asm/config_mpc85xx.h|  2 --
 configs/P1010RDB-PA_36BIT_NAND_defconfig |  1 +
 configs/P1010RDB-PA_NAND_defconfig   |  1 +
 configs/P1010RDB-PB_36BIT_NAND_defconfig |  1 +
 configs/P1010RDB-PB_NAND_defconfig   |  1 +
 configs/P1020RDB-PC_36BIT_NAND_defconfig |  1 +
 configs/P1020RDB-PC_NAND_defconfig   |  1 +
 configs/P1020RDB-PD_NAND_defconfig   |  1 +
 configs/P2020RDB-PC_36BIT_NAND_defconfig |  1 +
 configs/P2020RDB-PC_NAND_defconfig   |  1 +
 configs/P2041RDB_NAND_defconfig  |  1 +
 configs/P3041DS_NAND_defconfig   |  1 +
 configs/P5040DS_NAND_defconfig   |  1 +
 configs/T1024RDB_NAND_defconfig  |  1 +
 configs/T1042D4RDB_NAND_defconfig|  1 +
 configs/T2080QDS_NAND_defconfig  |  1 +
 configs/T2080RDB_NAND_defconfig  |  1 +
 configs/T2080RDB_revD_NAND_defconfig |  1 +
 configs/ids8313_defconfig|  1 +
 configs/kmcent2_defconfig|  1 +
 configs/ls1021aqds_ddr4_nor_defconfig|  1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig |  1 +
 configs/ls1021aqds_nand_defconfig|  1 +
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig |  1 +
 configs/ls1021aqds_nor_defconfig |  1 +
 configs/ls1021aqds_nor_lpuart_defconfig  |  1 +
 configs/ls1021aqds_sdcard_ifc_defconfig  |  1 +
 configs/ls1043aqds_defconfig |  1 +
 configs/ls1043aqds_lpuart_defconfig  |  1 +
 configs/ls1043aqds_nand_defconfig|  1 +
 configs/ls1043aqds_nor_ddr3_defconfig|  1 +
 configs/ls1043aqds_sdcard_ifc_defconfig  |  1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig |  1 +
 configs/ls1043aqds_tfa_defconfig |  1 +
 configs/ls1043ardb_SECURE_BOOT_defconfig |  1 +
 configs/ls1043ardb_defconfig |  1 +
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig|  1 +
 configs/ls1043ardb_nand_defconfig|  1 +
 configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig  |  1 +
 configs/ls1043ardb_sdcard_defconfig  |  1 +
 configs/ls1043ardb_tfa_SECURE_BOOT_defconfig |  1 +
 configs/ls1043ardb_tfa_defconfig |  1 +
 configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig|  1 +
 configs/ls1046afrwy_tfa_defconfig|  1 +
 configs/ls1046aqds_SECURE_BOOT_defconfig |  1 +
 configs/ls1046aqds_defconfig |  1 +
 configs/ls1046aqds_lpuart_defconfig  |  1 +
 configs/ls1046aqds_nand_defconfig|  1 +
 configs/ls1046aqds_sdcard_ifc_defconfig  |  1 +
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig |  1 +
 configs/ls1046aqds_tfa_defconfig |  1 +
 configs/ls1046ardb_emmc_defconfig|  1 +
 configs/ls1046ardb_qspi_SECURE_BOOT_defconfig|  1 +
 configs/ls1046ardb_qspi_defconfig|  1 +
 configs/ls1046ardb_qspi_spl_defconfig|  1 +
 configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig  |  1 +
 configs/ls1046ardb_sdcard_defconfig  |  1 +
 configs/ls1046ardb_tfa_SECURE_BOOT_defconfig |  1 +
 configs/ls1046ardb_tfa_defconfig |  1 +
 configs/ls1088aqds_defconfig |  1 +
 configs/ls1088aqds_qspi_SECURE_BOOT_defconfig|  1 +
 configs/ls1088aqds_qspi_defconfig|  1 +
 configs/ls1088aqds_sdcard_ifc_defconfig  |  1 +
 configs/ls1088aqds_sdcard_qspi_defconfig |  1 +
 configs/ls1088aqds_tfa_defconfig |  1 +
 configs/ls1088ardb_qspi_SECURE_BOOT_defconfig|  1 +
 configs/ls1088ardb_qspi_defconfig|  1 +
 configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig |  1 +
 configs/ls1088ardb_sdcard_qspi_defconfig |  1 +
 configs/ls1088ardb_tfa_SECURE_BOOT_defconfig |  1 +
 configs/ls1088ardb_tfa_defconfig |  1 +
 configs/ls2080aqds_SECURE_BOOT_defconfig |  1 +
 configs/ls2080aqds_defconfig |  1 +
 configs/ls2080aqds_nand_defconfig|  1 +
 configs/ls2080aqds_qspi_defconfig|  1 +
 configs/ls2080aqds_sdcard_defconfig  |  1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig  

[PATCH 04/14] Convert CONFIG_SPL_NAND_LOAD et al to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SPL_NAND_LOAD
   CONFIG_SYS_NAND_BLOCK_SIZE
   CONFIG_SYS_NAND_PAGE_SIZE
   CONFIG_SYS_NAND_OOBSIZE

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-lpc32xx/config.h  |  6 --
 configs/P1010RDB-PA_36BIT_NAND_defconfig|  1 +
 configs/P1010RDB-PA_NAND_defconfig  |  1 +
 configs/P1010RDB-PB_36BIT_NAND_defconfig|  1 +
 configs/P1010RDB-PB_NAND_defconfig  |  1 +
 configs/P1020RDB-PC_36BIT_NAND_defconfig|  1 +
 configs/P1020RDB-PC_NAND_defconfig  |  1 +
 configs/P1020RDB-PD_NAND_defconfig  |  1 +
 configs/P2020RDB-PC_36BIT_NAND_defconfig|  1 +
 configs/P2020RDB-PC_NAND_defconfig  |  1 +
 configs/T1024RDB_NAND_defconfig |  1 +
 configs/T1042D4RDB_NAND_defconfig   |  1 +
 configs/T2080QDS_NAND_defconfig |  1 +
 configs/T2080RDB_NAND_defconfig |  1 +
 configs/T2080RDB_revD_NAND_defconfig|  1 +
 configs/am335x_baltos_defconfig |  3 +++
 configs/am335x_evm_defconfig|  3 +++
 configs/am335x_evm_spiboot_defconfig|  2 ++
 configs/am335x_guardian_defconfig   |  3 +++
 configs/am335x_hs_evm_defconfig |  2 ++
 configs/am335x_hs_evm_uart_defconfig|  2 ++
 configs/am335x_igep003x_defconfig   |  3 +++
 configs/am3517_evm_defconfig|  3 +++
 configs/am43xx_evm_defconfig|  3 +++
 configs/am43xx_evm_rtconly_defconfig|  3 +++
 configs/am43xx_evm_usbhost_boot_defconfig   |  3 +++
 configs/am43xx_hs_evm_defconfig |  3 +++
 configs/at91sam9n12ek_nandflash_defconfig   |  2 ++
 configs/at91sam9x5ek_dataflash_defconfig|  2 ++
 configs/at91sam9x5ek_nandflash_defconfig|  2 ++
 configs/axm_defconfig   |  3 +++
 configs/brppt1_nand_defconfig   |  3 +++
 configs/chiliboard_defconfig|  3 +++
 configs/cm_t335_defconfig   |  3 +++
 configs/cm_t43_defconfig|  2 ++
 configs/corvus_defconfig|  3 +++
 configs/da850evm_nand_defconfig |  3 +++
 configs/devkit3250_defconfig|  3 +++
 configs/devkit8000_defconfig|  3 +++
 configs/dra7xx_evm_defconfig|  3 +++
 configs/dra7xx_hs_evm_defconfig |  2 ++
 configs/draco_defconfig |  3 +++
 configs/etamin_defconfig|  3 +++
 configs/gardena-smart-gateway-at91sam_defconfig |  3 +++
 configs/igep00x0_defconfig  |  3 +++
 configs/ls1021aqds_nand_defconfig   |  1 +
 configs/ls1043aqds_nand_defconfig   |  1 +
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig   |  1 +
 configs/ls1043ardb_nand_defconfig   |  1 +
 configs/ls2080aqds_nand_defconfig   |  1 +
 configs/ls2080ardb_nand_defconfig   |  1 +
 configs/m53menlo_defconfig  |  3 +++
 configs/omap35_logic_defconfig  |  3 +++
 configs/omap35_logic_somlv_defconfig|  3 +++
 configs/omap3_beagle_defconfig  |  3 +++
 configs/omap3_evm_defconfig |  3 +++
 configs/omap3_logic_defconfig   |  3 +++
 configs/omap3_logic_somlv_defconfig |  3 +++
 configs/omapl138_lcdk_defconfig |  3 +++
 configs/phycore-am335x-r2-regor_defconfig   |  3 +++
 configs/phycore-am335x-r2-wega_defconfig|  3 +++
 configs/pxm2_defconfig  |  3 +++
 configs/rastaban_defconfig  |  3 +++
 configs/rut_defconfig   |  3 +++
 configs/sama5d36ek_cmp_nandflash_defconfig  |  2 ++
 configs/sama5d3_xplained_nandflash_defconfig|  3 +++
 configs/sama5d3xek_nandflash_defconfig  |  3 +++
 configs/sama5d4_xplained_nandflash_defconfig|  3 +++
 configs/sama5d4ek_nandflash_defconfig   |  3 +++
 configs/smartweb_defconfig  |  3 +++
 configs/taurus_defconfig|  3 +++
 configs/thuban_defconfig|  3 +++
 configs/ti816x_evm_defconfig|  3 +++
 drivers/mtd/nand/raw/Kconfig| 17 ++---
 include/configs/P1010RDB.h  |  2 --
 include/configs/P2041RDB.h  |  3 +--
 include/configs/T102xRDB.h  | 10 --
 include/configs/T104xRDB.h  |  6 --
 include/configs/T208xQDS.h  |  3 ---
 include/configs/T208xRDB.h  |  3 ---
 include/configs/T4240RDB.h  |  4 
 include/configs/am335x_evm.h|  5 -
 include/configs/am335x_guardian.h   |  3 ---
 include/configs/am335x_i

[PATCH 05/14] Convert CONFIG_SYS_NAND_PAGE_COUNT to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_NAND_PAGE_COUNT

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-lpc32xx/config.h  | 2 --
 configs/am335x_baltos_defconfig | 1 +
 configs/am335x_evm_defconfig| 1 +
 configs/am335x_guardian_defconfig   | 1 +
 configs/am335x_igep003x_defconfig   | 1 +
 configs/am3517_evm_defconfig| 1 +
 configs/am43xx_evm_defconfig| 1 +
 configs/am43xx_evm_rtconly_defconfig| 1 +
 configs/am43xx_evm_usbhost_boot_defconfig   | 1 +
 configs/am43xx_hs_evm_defconfig | 1 +
 configs/axm_defconfig   | 1 +
 configs/brppt1_nand_defconfig   | 1 +
 configs/chiliboard_defconfig| 1 +
 configs/cm_t335_defconfig   | 1 +
 configs/corvus_defconfig| 1 +
 configs/da850evm_nand_defconfig | 1 +
 configs/devkit3250_defconfig| 1 +
 configs/devkit8000_defconfig| 1 +
 configs/dra7xx_evm_defconfig| 1 +
 configs/draco_defconfig | 1 +
 configs/etamin_defconfig| 1 +
 configs/gardena-smart-gateway-at91sam_defconfig | 1 +
 configs/igep00x0_defconfig  | 1 +
 configs/m53menlo_defconfig  | 1 +
 configs/omap35_logic_defconfig  | 1 +
 configs/omap35_logic_somlv_defconfig| 1 +
 configs/omap3_beagle_defconfig  | 1 +
 configs/omap3_evm_defconfig | 1 +
 configs/omap3_logic_defconfig   | 1 +
 configs/omap3_logic_somlv_defconfig | 1 +
 configs/omapl138_lcdk_defconfig | 1 +
 configs/phycore-am335x-r2-regor_defconfig   | 1 +
 configs/phycore-am335x-r2-wega_defconfig| 1 +
 configs/pxm2_defconfig  | 1 +
 configs/rastaban_defconfig  | 1 +
 configs/rut_defconfig   | 1 +
 configs/sama5d3_xplained_nandflash_defconfig| 1 +
 configs/sama5d3xek_nandflash_defconfig  | 1 +
 configs/sama5d4_xplained_nandflash_defconfig| 1 +
 configs/sama5d4ek_nandflash_defconfig   | 1 +
 configs/smartweb_defconfig  | 1 +
 configs/taurus_defconfig| 1 +
 configs/thuban_defconfig| 1 +
 configs/ti816x_evm_defconfig| 1 +
 drivers/mtd/nand/raw/Kconfig| 7 +++
 include/configs/am335x_evm.h| 2 --
 include/configs/am335x_guardian.h   | 2 --
 include/configs/am335x_igep003x.h   | 2 --
 include/configs/am3517_evm.h| 1 -
 include/configs/am43xx_evm.h| 2 --
 include/configs/at91sam9m10g45ek.h  | 1 -
 include/configs/at91sam9n12ek.h | 1 -
 include/configs/at91sam9x5ek.h  | 1 -
 include/configs/baltos.h| 2 --
 include/configs/brppt1.h| 2 --
 include/configs/chiliboard.h| 2 --
 include/configs/cm_t335.h   | 2 --
 include/configs/cm_t43.h| 2 --
 include/configs/corvus.h| 2 --
 include/configs/da850evm.h  | 1 -
 include/configs/devkit8000.h| 1 -
 include/configs/dra7xx_evm.h| 2 --
 include/configs/gardena-smart-gateway-at91sam.h | 1 -
 include/configs/m53menlo.h  | 2 --
 include/configs/omap3_beagle.h  | 1 -
 include/configs/omap3_evm.h | 1 -
 include/configs/omap3_igep00x0.h| 1 -
 include/configs/omap3_logic.h   | 1 -
 include/configs/omapl138_lcdk.h | 1 -
 include/configs/phycore_am335x_r2.h | 2 --
 include/configs/pm9g45.h| 1 -
 include/configs/sama5d3_xplained.h  | 1 -
 include/configs/sama5d3xek.h| 1 -
 include/configs/sama5d4_xplained.h  | 1 -
 include/configs/sama5d4ek.h | 1 -
 include/configs/siemens-am33x-common.h  | 2 --
 include/configs/smartweb.h  | 2 --
 include/configs/tam3517-common.h| 1 -
 include/configs/taurus.h| 2 --
 include/configs/ti816x_evm.h| 2 --
 scripts/config_whitelist.txt| 1 -
 81 files changed, 50 insertions(+), 55 deletions(-)

diff --git a/arch/arm/include/asm/arch-lpc32xx/config.h 
b/arch/arm/include/asm/arch-lpc32xx/config.h
index 00987b5bf5db..22f39cad5916 100644
--- a/arch/arm/include/asm/arch-lpc32xx/config.h
+++ b/arch/arm/include/asm/arch-lpc32xx/config.h
@@ -48,8 +48,6 @@
 
 #define CONFIG_SYS_NAND_ECCSIZE0x100
 #define CONFIG_SYS_NAND_ECCBYTES   3
-#define C

[PATCH 11/14] Convert CONFIG_SYS_NAND_MAX_CHIPS to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_NAND_MAX_CHIPS

Signed-off-by: Tom Rini 
---
 drivers/mtd/Kconfig  | 8 
 drivers/mtd/nand/raw/Kconfig | 7 ---
 include/configs/MCR3000.h| 1 -
 include/configs/cm_fx6.h | 1 -
 include/configs/etamin.h | 2 --
 include/configs/ids8313.h| 1 -
 include/configs/mvebu_armada-8k.h| 1 -
 include/configs/presidio_asic.h  | 1 -
 include/configs/ti_armv7_keystone2.h | 1 -
 include/linux/mtd/bbm.h  | 5 -
 10 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index b303fabe0f05..83c055a26ef5 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -111,6 +111,14 @@ config HBMC_AM654
 
 source "drivers/mtd/nand/Kconfig"
 
+config SYS_NAND_MAX_CHIPS
+   int "NAND max chips"
+   depends on MTD_RAW_NAND || CMD_ONENAND || TARGET_S5PC210_UNIVERSAL || \
+   SPL_OMAP3_ID_NAND
+   default 1
+   help
+ The maximum number of NAND chips per device to be supported.
+
 source "drivers/mtd/spi/Kconfig"
 
 source "drivers/mtd/ubi/Kconfig"
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 68f909db4c0e..2d67b1b1284e 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -419,13 +419,6 @@ config SYS_NAND_BUSWIDTH_16BIT
not available while configuring controller. So a static 
CONFIG_NAND_xx
is needed to know the device's bus-width in advance.
 
-config SYS_NAND_MAX_CHIPS
-   int "NAND max chips"
-   default 1
-   depends on NAND_ARASAN
-   help
- The maximum number of NAND chips per device to be supported.
-
 if SPL
 
 config SYS_NAND_5_ADDR_CYCLE
diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
index 65c16380ee52..73858c56e515 100644
--- a/include/configs/MCR3000.h
+++ b/include/configs/MCR3000.h
@@ -95,7 +95,6 @@
 
 /* NAND configuration part */
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define CONFIG_SYS_NAND_MAX_CHIPS  1
 #define CONFIG_SYS_NAND_BASE   0x0C00
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
index 1d6c77ee8094..c1b6847ef844 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -143,7 +143,6 @@
 /* NAND */
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_SYS_NAND_BASE   0x4000
-#define CONFIG_SYS_NAND_MAX_CHIPS  1
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 /* APBH DMA is required for NAND support */
 #endif
diff --git a/include/configs/etamin.h b/include/configs/etamin.h
index e1d27ac0c844..229a695c12eb 100644
--- a/include/configs/etamin.h
+++ b/include/configs/etamin.h
@@ -51,8 +51,6 @@
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20
 
-#define CONFIG_SYS_NAND_MAX_CHIPS   1
-
 #undef CONFIG_SYS_MAX_NAND_DEVICE
 #define CONFIG_SYS_MAX_NAND_DEVICE  3
 #define CONFIG_SYS_NAND_BASE2   (0x1800)/* physical address */
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 5bd4f3bc8ca4..5e2f377749f0 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -129,7 +129,6 @@
  */
 #define CONFIG_SYS_NAND_BASE   0xE100
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define CONFIG_SYS_NAND_MAX_CHIPS  1
 #define CONFIG_NAND_FSL_ELBC
 #define NAND_CACHE_PAGES   64
 
diff --git a/include/configs/mvebu_armada-8k.h 
b/include/configs/mvebu_armada-8k.h
index cb8ccb32f593..2f8be2ee4948 100644
--- a/include/configs/mvebu_armada-8k.h
+++ b/include/configs/mvebu_armada-8k.h
@@ -33,7 +33,6 @@
 /* When runtime detection fails this is the default */
 
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define CONFIG_SYS_NAND_MAX_CHIPS  1
 
 /*
  * Ethernet Driver configuration
diff --git a/include/configs/presidio_asic.h b/include/configs/presidio_asic.h
index b22e676ee00e..8d689d9e4be1 100644
--- a/include/configs/presidio_asic.h
+++ b/include/configs/presidio_asic.h
@@ -78,7 +78,6 @@
 /* nand driver parameters */
 #ifdef CONFIG_TARGET_PRESIDIO_ASIC
#define CONFIG_SYS_MAX_NAND_DEVICE  1
-   #define CONFIG_SYS_NAND_MAX_CHIPS   1
#define CONFIG_SYS_NAND_BASECONFIG_SYS_FLASH_BASE
#define CONFIG_SYS_NAND_BASE_LIST   { CONFIG_SYS_NAND_BASE }
 #endif
diff --git a/include/configs/ti_armv7_keystone2.h 
b/include/configs/ti_armv7_keystone2.h
index 690ef0e14471..50d6cef84c25 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -131,7 +131,6 @@
 #define CONFIG_SYS_NAND_LARGEPAGE
 #define CONFIG_SYS_NAND_BASE_LIST  { 0x3000, }
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define CONFIG_SYS_NAND_MAX_CHIPS  1
 #define CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
 
 #define DFU_ALT_INFO_MMC \
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 7239eb1125c7..fb86f1ddef9c 100644
--- a/include/

[PATCH 07/14] Convert CONFIG_SYS_NAND_BAD_BLOCK_POS to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_NAND_BAD_BLOCK_POS

In order to do this, introduce a choice for HAS_LARGE/SMALL_BADBLOCK_POS
as those are the only valid values.  Use LARGE as the default as no
in-tree boards use SMALL, but it is possible.

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-lpc32xx/config.h|  2 --
 drivers/mtd/nand/raw/Kconfig  | 21 +++
 include/configs/am335x_evm.h  |  1 -
 include/configs/am335x_guardian.h |  2 --
 include/configs/am335x_igep003x.h |  1 -
 include/configs/am3517_evm.h  |  1 -
 include/configs/am43xx_evm.h  |  1 -
 include/configs/at91sam9m10g45ek.h|  1 -
 include/configs/at91sam9n12ek.h   |  1 -
 include/configs/at91sam9x5ek.h|  1 -
 include/configs/baltos.h  |  1 -
 include/configs/brppt1.h  |  1 -
 include/configs/chiliboard.h  |  1 -
 include/configs/cm_t335.h |  1 -
 include/configs/cm_t43.h  |  1 -
 include/configs/corvus.h  |  1 -
 include/configs/da850evm.h|  1 -
 include/configs/devkit8000.h  |  1 -
 include/configs/dra7xx_evm.h  |  1 -
 .../configs/gardena-smart-gateway-at91sam.h   |  1 -
 include/configs/m53menlo.h|  1 -
 include/configs/omap3_beagle.h|  1 -
 include/configs/omap3_evm.h   |  1 -
 include/configs/omap3_igep00x0.h  |  1 -
 include/configs/omap3_logic.h |  1 -
 include/configs/omapl138_lcdk.h   |  1 -
 include/configs/phycore_am335x_r2.h   |  1 -
 include/configs/pm9g45.h  |  1 -
 include/configs/sama5d3_xplained.h|  1 -
 include/configs/sama5d3xek.h  |  1 -
 include/configs/sama5d4_xplained.h|  1 -
 include/configs/sama5d4ek.h   |  1 -
 include/configs/siemens-am33x-common.h|  1 -
 include/configs/smartweb.h|  1 -
 include/configs/socfpga_common.h  |  1 -
 include/configs/tam3517-common.h  |  1 -
 include/configs/taurus.h  |  1 -
 include/configs/ti816x_evm.h  |  1 -
 include/configs/uniphier.h|  1 -
 39 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/arch/arm/include/asm/arch-lpc32xx/config.h 
b/arch/arm/include/asm/arch-lpc32xx/config.h
index 22f39cad5916..653792c610cb 100644
--- a/arch/arm/include/asm/arch-lpc32xx/config.h
+++ b/arch/arm/include/asm/arch-lpc32xx/config.h
@@ -38,10 +38,8 @@
 #define CONFIG_SYS_NAND_ECCPOS { 40, 41, 42, 43, 44, 45, 46, 47, \
  48, 49, 50, 51, 52, 53, 54, 55, \
  56, 57, 58, 59, 60, 61, 62, 63, }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #elif (CONFIG_SYS_NAND_PAGE_SIZE == NAND_SMALL_BLOCK_PAGE_SIZE)
 #define CONFIG_SYS_NAND_ECCPOS { 10, 11, 12, 13, 14, 15, }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #else
 #error "CONFIG_SYS_NAND_PAGE_SIZE set to an invalid value"
 #endif
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 1e94cccbdecc..006ed80a1112 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -421,6 +421,27 @@ config SYS_NAND_MAX_CHIPS
 
 if SPL
 
+choice
+   prompt "NAND bad block marker/indicator positon in the OOB"
+   depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || 
\
+   SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
+   default HAS_NAND_LARGE_BADBLOCK_POS
+   help
+ In the OOB, which position contains the badblock information.
+
+config HAS_NAND_LARGE_BADBLOCK_POS
+   bool "Set the bad block marker/indicator to the 'large' position"
+
+config HAS_NAND_SMALL_BADBLOCK_POS
+   bool "Set the bad block marker/indicator to the 'small' position"
+
+endchoice
+
+config SYS_NAND_BAD_BLOCK_POS
+   int
+   default 0 if HAS_NAND_LARGE_BADBLOCK_POS
+   default 5 if HAS_NAND_SMALL_BADBLOCK_POS
+
 config SYS_NAND_U_BOOT_LOCATIONS
bool "Define U-boot binaries locations in NAND"
help
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index c6ef96ec1c8e..a8ee559825cf 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -182,7 +182,6 @@
 /* NAND: device related configs */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 /* NAND: driver related configs */
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
 10, 11, 12, 13, 14, 15, 16, 17, \
 18, 19, 20, 21, 22, 23, 24, 25, \
diff --git a/include/configs/am335x_guardian.h 
b/includ

[PATCH 08/14] Convert CONFIG_SYS_NAND_5_ADDR_CYCLE to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_NAND_5_ADDR_CYCLE

Signed-off-by: Tom Rini 
---
 configs/devkit3250_defconfig| 1 +
 drivers/mtd/nand/raw/Kconfig| 9 +
 include/configs/am335x_evm.h| 1 -
 include/configs/am335x_guardian.h   | 3 ---
 include/configs/am335x_igep003x.h   | 1 -
 include/configs/am3517_evm.h| 1 -
 include/configs/am43xx_evm.h| 1 -
 include/configs/at91sam9m10g45ek.h  | 1 -
 include/configs/at91sam9n12ek.h | 1 -
 include/configs/at91sam9x5ek.h  | 1 -
 include/configs/baltos.h| 1 -
 include/configs/brppt1.h| 1 -
 include/configs/chiliboard.h| 1 -
 include/configs/cm_t335.h   | 1 -
 include/configs/cm_t43.h| 1 -
 include/configs/colibri_imx7.h  | 1 -
 include/configs/corvus.h| 1 -
 include/configs/da850evm.h  | 1 -
 include/configs/devkit8000.h| 1 -
 include/configs/dra7xx_evm.h| 1 -
 include/configs/gardena-smart-gateway-at91sam.h | 2 --
 include/configs/imx6-engicam.h  | 1 -
 include/configs/imx6_logic.h| 1 -
 include/configs/mx6sabreauto.h  | 1 -
 include/configs/mx6sxsabreauto.h| 1 -
 include/configs/mx7dsabresd.h   | 1 -
 include/configs/mxs.h   | 1 -
 include/configs/omap3_beagle.h  | 1 -
 include/configs/omap3_evm.h | 1 -
 include/configs/omap3_igep00x0.h| 1 -
 include/configs/omap3_logic.h   | 1 -
 include/configs/omapl138_lcdk.h | 1 -
 include/configs/phycore_am335x_r2.h | 1 -
 include/configs/pm9g45.h| 1 -
 include/configs/sama5d3_xplained.h  | 1 -
 include/configs/sama5d3xek.h| 1 -
 include/configs/sama5d4_xplained.h  | 1 -
 include/configs/sama5d4ek.h | 1 -
 include/configs/siemens-am33x-common.h  | 1 -
 include/configs/smartweb.h  | 1 -
 include/configs/tam3517-common.h| 1 -
 include/configs/taurus.h| 1 -
 include/configs/ti816x_evm.h| 1 -
 scripts/config_whitelist.txt| 1 -
 44 files changed, 10 insertions(+), 45 deletions(-)

diff --git a/configs/devkit3250_defconfig b/configs/devkit3250_defconfig
index 4e90af6fdadd..dc85a8419831 100644
--- a/configs/devkit3250_defconfig
+++ b/configs/devkit3250_defconfig
@@ -57,6 +57,7 @@ CONFIG_SYS_NAND_BLOCK_SIZE=0x2
 CONFIG_SYS_NAND_PAGE_COUNT=0x40
 CONFIG_SYS_NAND_PAGE_SIZE=0x800
 CONFIG_SYS_NAND_OOBSIZE=0x40
+# CONFIG_SYS_NAND_5_ADDR_CYCLE is not set
 CONFIG_PHYLIB=y
 CONFIG_PHY_ADDR_ENABLE=y
 CONFIG_PHY_ADDR=31
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 006ed80a1112..98d09f1e64e5 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -421,6 +421,15 @@ config SYS_NAND_MAX_CHIPS
 
 if SPL
 
+config SYS_NAND_5_ADDR_CYCLE
+   bool "Wait 5 address cycles during NAND commands"
+   depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
+   (SPL_NAND_SUPPORT && NAND_ATMEL)
+   default y
+   help
+ Some controllers require waiting for 5 address cycles when issuing
+ some commands, on NAND chips larger than 128MiB.
+
 choice
prompt "NAND bad block marker/indicator positon in the OOB"
depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || 
\
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index a8ee559825cf..ec34992b2dfe 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -180,7 +180,6 @@
 
 #ifdef CONFIG_MTD_RAW_NAND
 /* NAND: device related configs */
-#define CONFIG_SYS_NAND_5_ADDR_CYCLE
 /* NAND: driver related configs */
 #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
 10, 11, 12, 13, 14, 15, 16, 17, \
diff --git a/include/configs/am335x_guardian.h 
b/include/configs/am335x_guardian.h
index 087b2d0e6dc6..43b83630004c 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -106,9 +106,6 @@
 #define CONFIG_SYS_BOOTCOUNT_LE
 
 #ifdef CONFIG_MTD_RAW_NAND
-
-#define CONFIG_SYS_NAND_5_ADDR_CYCLE
-
 #define CONFIG_SYS_NAND_ECCPOS  {   2,   3,   4,   5,   6,   7,   8,   9, \
 10,  11,  12,  13,  14,  15,  16,  17,  18,  19, \
 20,  21,  22,  23,  24,  25,  26,  27,  28,  29, \
diff --git a/include/configs/am335x_igep003x.h 
b/include/configs/am335x_igep003x.h
index 71ecd554b015..ed2685d19e3c 100644
--- a/include/configs/am335x_igep003

[PATCH 06/14] nand_spl_simple: Drop CONFIG_SYS_NAND_4_ADDR_CYCLE support

2021-09-22 Thread Tom Rini
This code is unused, drop it.

Signed-off-by: Tom Rini 
---
 drivers/mtd/nand/raw/nand_spl_simple.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_spl_simple.c 
b/drivers/mtd/nand/raw/nand_spl_simple.c
index 09e053541a9d..ede7dbf15b90 100644
--- a/drivers/mtd/nand/raw/nand_spl_simple.c
+++ b/drivers/mtd/nand/raw/nand_spl_simple.c
@@ -39,11 +39,6 @@ static int nand_command(int block, int page, uint32_t offs,
this->cmd_ctrl(mtd, page_addr & 0xff, NAND_CTRL_ALE); /* A[16:9] */
this->cmd_ctrl(mtd, (page_addr >> 8) & 0xff,
   NAND_CTRL_ALE); /* A[24:17] */
-#ifdef CONFIG_SYS_NAND_4_ADDR_CYCLE
-   /* One more address cycle for devices > 32MiB */
-   this->cmd_ctrl(mtd, (page_addr >> 16) & 0x0f,
-  NAND_CTRL_ALE); /* A[28:25] */
-#endif
/* Latch in address */
this->cmd_ctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
 
-- 
2.17.1



[PATCH 03/14] Convert CONFIG_NAND_LPC32XX_MLC to Kconfig

2021-09-22 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_NAND_LPC32XX_MLC

Signed-off-by: Tom Rini 
---
 configs/work_92105_defconfig | 1 +
 drivers/mtd/nand/raw/Kconfig | 5 +
 include/configs/work_92105.h | 1 -
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configs/work_92105_defconfig b/configs/work_92105_defconfig
index b09c855ed4b9..d67ec056fa50 100644
--- a/configs/work_92105_defconfig
+++ b/configs/work_92105_defconfig
@@ -54,6 +54,7 @@ CONFIG_SYS_I2C_EEPROM_ADDR=0x56
 # CONFIG_MMC is not set
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_LPC32XX_MLC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_ADDR_ENABLE=y
 CONFIG_PHY_SMSC=y
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index f7b1334ddb47..a0602e391607 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -118,6 +118,11 @@ config NAND_DENALI_DT
  Enable the driver for NAND flash on platforms using a Denali NAND
  controller as a DT device.
 
+config NAND_LPC32XX_MLC
+   bool "Support LPC32XX_MLC controller"
+   help
+ Enable the LPC32XX MLC NAND controller.
+
 config NAND_LPC32XX_SLC
bool "Support LPC32XX_SLC controller"
help
diff --git a/include/configs/work_92105.h b/include/configs/work_92105.h
index 83b24a7dcc8f..d6addf957b10 100644
--- a/include/configs/work_92105.h
+++ b/include/configs/work_92105.h
@@ -59,7 +59,6 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 #define CONFIG_SYS_MAX_NAND_CHIPS 1
 #define CONFIG_SYS_NAND_BASE MLC_NAND_BASE
-#define CONFIG_NAND_LPC32XX_MLC
 
 /*
  * GPIO
-- 
2.17.1



[PATCH 02/14] m53menlo: Switch to deriving CONFIG_SYS_NAND_PAGE_COUNT

2021-09-22 Thread Tom Rini
Typically platforms will define CONFIG_SYS_NAND_PAGE_COUNT based on
CONFIG_SYS_NAND_BLOCK_SIZE / CONFIG_SYS_NAND_PAGE_SIZE.  Switch to this
in preparation for migrating CONFIG_SYS_NAND namespace to Kconfig.

Cc: Marek Vasut 
Cc: Olaf Mandel 
Signed-off-by: Tom Rini 
---
 include/configs/m53menlo.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h
index 813d326cdaf5..11c8a87c95ad 100644
--- a/include/configs/m53menlo.h
+++ b/include/configs/m53menlo.h
@@ -140,9 +140,11 @@
 #define CONFIG_SPL_STACK   0x70004000
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFSCONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
 #define CONFIG_SYS_NAND_PAGE_SIZE  2048
 #define CONFIG_SYS_NAND_OOBSIZE64
-#define CONFIG_SYS_NAND_PAGE_COUNT 64
+#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
+CONFIG_SYS_NAND_PAGE_SIZE)
 #define CONFIG_SYS_NAND_SIZE   (256 * 1024 * 1024)
 #define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 
-- 
2.17.1



[PATCH 01/14] rk3308: Remove unused NAND defines

2021-09-22 Thread Tom Rini
These platforms do not currently enable NAND, remove these references.

Cc: Kever Yang 
Signed-off-by: Tom Rini 
---
Please note that this file isn't listed in any MAINTAINERS file, but
should be, thanks!
---
 include/configs/rk3308_common.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/include/configs/rk3308_common.h b/include/configs/rk3308_common.h
index edaf78a6e81a..496f4628d34f 100644
--- a/include/configs/rk3308_common.h
+++ b/include/configs/rk3308_common.h
@@ -9,11 +9,6 @@
 #include "rockchip-common.h"
 
 #define CONFIG_SYS_CBSIZE  1024
-#define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define CONFIG_SYS_NAND_ONFI_DETECTION
-#define CONFIG_SYS_NAND_PAGE_SIZE  2048
-#define CONFIG_SYS_NAND_PAGE_COUNT 64
-#define CONFIG_SYS_NAND_SIZE   (256 * 1024 * 1024)
 #define CONFIG_SPL_MAX_SIZE0x2
 #define CONFIG_SPL_BSS_START_ADDR  0x0040
 #define CONFIG_SPL_BSS_MAX_SIZE0x2000
-- 
2.17.1



Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 08:24:18PM +0200, Marek Vasut wrote:
> On 9/22/21 7:29 PM, Marek Behún wrote:
> > (Adding also Tom.)
> > 
> > Hi Patrick, Marek,
> > 
> > I find this either not complete or not needed:
> > 
> > - either you need mtd names to be of this format so that old MTDPARTS
> >config definitions do not need to be changed, i.e. something like
> >  CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
> >does not work currently, and you want to make it work.
> > 
> >I find your solution here incomplete because MTDPARTS can also be
> >used to be passed to Linux as mtdparts parameter, but there is no
> >guarantee that the "norN" numbering you are creating in U-Boot will
> >be the same as the one in kernel.
> > 
> > - or it is not needed, because you can remove MTDPARTS definition from
> >the board config entirely and move the information into device tree.
> >In fact this was the main idea behind making the series
> >  Support SPI NORs and OF partitions in `mtd list`
> >The SPI-NOR MTDs after this series can have conflicting names,
> >because you can still choose between them via OF path with the `mtd`
> >command.
> > 
> >Tom and I were of the opinion that MTDPARTS should be deprecated and
> >removed in favor of OF. Marek Vasut says that this is not possible
> >for every board, and so needs to stay.
> > 
> > BTW, I find it a little weird for Marek to defend old API which should
> > be converted to DT, when in discussion about DM USB / Nokia N900
> > USB TTY console [1] he was defending the opinion that we should be
> > heading to DT in U-Boot.
> > 
> > [1]
> > https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/
> 
> That USB discussion is completely unrelated to the problem here, the USB
> discussion is about internal (i.e. not user facing) conversion to DM/DT. The
> user-facing ABI does not change there. Also, that discussion was about
> patching USB stack to permit new non-DM/DT operation, not fixing existing
> one.
> 
> This problem here is user facing ABI, the mtdparts/mtdids. That user facing
> ABI got broken. Boards which do depend on it, even those currently in tree,
> are broken. Not all boards can update their environment, so some backward
> compatibility of the user facing ABI should be in place, even though it
> might not be to the degree Linux kernel does so. So far, it seems most of
> the U-Boot command line interface has managed to retain backward
> compatibility, I don't see why this here should be handled any differently.
> 
> Note that there are not just a few boards that are broken, but hundreds. I
> believe that itself justifies a fix, instead of just throwing all those
> hundreds of boards overboard.
> 
> u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
> 203
> 
> Hopefully that clarifies the difference.

It doesn't quite, sorry.  If you have "mtdparts=... mtdids=..." in your
cmdline that you pass to Linux, U-Boot doesn't care.  That's one of the
main users of CONFIG_MTDIDS/MTDPARTS today, which could in some good
number of cases be removed (take am335x_evm_defconfig for example, the
table has been defined in the upstream DT for forever).  Taking a look
at:
commit 938db6fe5da3581ed2c17d64c7e016a7a8df5237
Author: Miquel Raynal 
Date:   Sat Sep 29 12:58:30 2018 +0200

cmd: mtdparts: describe as legacy

The 'mtdparts' command is not needed anymore. While the environment
variable is still valid (and useful, along with the 'mtdids' one), the
command has been replaced by 'mtd' which is much more close to the MTD
stack and do not add its own specific glue.

Signed-off-by: Miquel Raynal 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 

Is when "mtdparts" in U-Boot was noted as legacy.  So what exactly are
we fixing with this series?  Nothing changed about hard-coded values
being passed along.  What may have broken was some progmatic way to set
those, but I think that's both fragile and deprecated in favor of the
table being in the DT.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Vasut

On 9/22/21 7:29 PM, Marek Behún wrote:

(Adding also Tom.)

Hi Patrick, Marek,

I find this either not complete or not needed:

- either you need mtd names to be of this format so that old MTDPARTS
   config definitions do not need to be changed, i.e. something like
 CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
   does not work currently, and you want to make it work.

   I find your solution here incomplete because MTDPARTS can also be
   used to be passed to Linux as mtdparts parameter, but there is no
   guarantee that the "norN" numbering you are creating in U-Boot will
   be the same as the one in kernel.

- or it is not needed, because you can remove MTDPARTS definition from
   the board config entirely and move the information into device tree.
   In fact this was the main idea behind making the series
 Support SPI NORs and OF partitions in `mtd list`
   The SPI-NOR MTDs after this series can have conflicting names,
   because you can still choose between them via OF path with the `mtd`
   command.

   Tom and I were of the opinion that MTDPARTS should be deprecated and
   removed in favor of OF. Marek Vasut says that this is not possible
   for every board, and so needs to stay.

BTW, I find it a little weird for Marek to defend old API which should
be converted to DT, when in discussion about DM USB / Nokia N900
USB TTY console [1] he was defending the opinion that we should be
heading to DT in U-Boot.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/


That USB discussion is completely unrelated to the problem here, the USB 
discussion is about internal (i.e. not user facing) conversion to DM/DT. 
The user-facing ABI does not change there. Also, that discussion was 
about patching USB stack to permit new non-DM/DT operation, not fixing 
existing one.


This problem here is user facing ABI, the mtdparts/mtdids. That user 
facing ABI got broken. Boards which do depend on it, even those 
currently in tree, are broken. Not all boards can update their 
environment, so some backward compatibility of the user facing ABI 
should be in place, even though it might not be to the degree Linux 
kernel does so. So far, it seems most of the U-Boot command line 
interface has managed to retain backward compatibility, I don't see why 
this here should be handled any differently.


Note that there are not just a few boards that are broken, but hundreds. 
I believe that itself justifies a fix, instead of just throwing all 
those hundreds of boards overboard.


u-boot$ git grep -l CONFIG_MTDIDS configs | wc -l
203

Hopefully that clarifies the difference.


[PATCH] Makefile: Allow LTO to be disabled for a build

2021-09-22 Thread Simon Glass
LTO (Link-Time Optimisation) is an very useful feature which can
significantly reduce the size of U-Boot binaries. So far it has been
made available for selected ARM boards and sandbox.

However, incremental builds are much slower when LTO is used. For example,
an incremental build of sandbox takes 2.1 seconds on my machine, but 6.7
seconds with LTO enabled.

Add a LTO_BUILD=n parameter to the build, so it can be disabled during
development if needed, for faster builds.

Add some documentation about LTO while we are here.

Signed-off-by: Simon Glass 
---

 Makefile   | 18 +-
 arch/arm/config.mk |  4 ++--
 arch/arm/include/asm/global_data.h |  2 +-
 doc/build/gcc.rst  | 18 ++
 4 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 3014788e14e..f3f9092de06 100644
--- a/Makefile
+++ b/Makefile
@@ -430,6 +430,9 @@ KBUILD_CFLAGS   += -fshort-wchar -fno-strict-aliasing
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 KBUILD_LDFLAGS  :=
 
+# Set this to "n" use of LTO for this build, e.g. LTO_BUILD=n
+LTO_BUILD  ?= y
+
 ifeq ($(cc-name),clang)
 ifneq ($(CROSS_COMPILE),)
 CLANG_TARGET   := --target=$(notdir $(CROSS_COMPILE:%-=%))
@@ -637,6 +640,11 @@ export CFLAGS_EFI  # Compiler flags to add when building 
EFI app
 export CFLAGS_NON_EFI  # Compiler flags to remove when building EFI app
 export EFI_TARGET  # binutils target if EFI is natively supported
 
+export LTO_ENABLE
+
+# This is y if LTO is enabled for this build
+LTO_ENABLE=$(if $(CONFIG_LTO),$(LTO_BUILD),)
+
 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
 # that (or fail if absent).  Otherwise, search for a linker script in a
 # standard location.
@@ -684,16 +692,16 @@ endif
 LTO_CFLAGS :=
 LTO_FINAL_LDFLAGS :=
 export LTO_CFLAGS LTO_FINAL_LDFLAGS
-ifdef CONFIG_LTO
+ifeq ($(LTO_ENABLE),y)
ifeq ($(cc-name),clang)
-   LTO_CFLAGS  += -flto
+   LTO_CFLAGS  += -DLTO_ENABLE -flto
LTO_FINAL_LDFLAGS   += -flto
 
AR  = $(shell $(CC) 
-print-prog-name=llvm-ar)
NM  = $(shell $(CC) 
-print-prog-name=llvm-nm)
else
NPROC   := $(shell nproc 2>/dev/null || echo 1)
-   LTO_CFLAGS  += -flto=$(NPROC)
+   LTO_CFLAGS  += -DLTO_ENABLE -flto=$(NPROC)
LTO_FINAL_LDFLAGS   += -fuse-linker-plugin -flto=$(NPROC)
 
# use plugin aware tools
@@ -1732,7 +1740,7 @@ ARCH_POSTLINK := $(wildcard 
$(srctree)/arch/$(ARCH)/Makefile.postlink)
 
 # Generate linker list symbols references to force compiler to not optimize
 # them away when compiling with LTO
-ifdef CONFIG_LTO
+ifeq ($(LTO_ENABLE),y)
 u-boot-keep-syms-lto := keep-syms-lto.o
 u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto))
 
@@ -1754,7 +1762,7 @@ endif
 
 # Rule to link u-boot
 # May be overridden by arch/$(ARCH)/config.mk
-ifdef CONFIG_LTO
+ifeq ($(LTO_ENABLE),y)
 quiet_cmd_u-boot__ ?= LTO $@
   cmd_u-boot__ ?=  
\
$(CC) -nostdlib -nostartfiles   
\
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 16c63e12667..956fa5ad5aa 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -15,11 +15,11 @@ CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections 
-fdata-sections \
  -fstack-protector-strong
 CFLAGS_EFI := -fpic -fshort-wchar
 
-ifneq ($(CONFIG_LTO)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
+ifneq ($(LTO_ENABLE)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
 LDFLAGS_FINAL += --gc-sections
 endif
 
-ifndef CONFIG_LTO
+ifneq ($(LTO_ENABLE),y)
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 endif
 
diff --git a/arch/arm/include/asm/global_data.h 
b/arch/arm/include/asm/global_data.h
index 085e12b5d4d..b255b195aa0 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -98,7 +98,7 @@ struct arch_global_data {
 
 #include 
 
-#if defined(__clang__) || defined(CONFIG_LTO)
+#if defined(__clang__) || defined(LTO_ENABLE)
 
 #define DECLARE_GLOBAL_DATA_PTR
 #define gd get_gd()
diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst
index 0cdc307d57b..7fc5952b661 100644
--- a/doc/build/gcc.rst
+++ b/doc/build/gcc.rst
@@ -120,6 +120,24 @@ Further important build parameters are
 * O= - generate all output files in directory , including .config
 * V=1 - verbose build
 
+Link-time optimisation (LTO)
+
+
+U-Boot supports link-time optimisation which can reduce the size of the final
+U-Boot binaries, particularly with SPL.
+
+At present this can be enabled by ARM boards by adding `CONFIG_LTO=y` into the
+defconfig file. Other architectures are not supported. LTO is enabled by 
default
+for sandbox.
+
+This does incur a 

[PATCH v3 2/2] Makefile: Only build dtc if needed

2021-09-22 Thread Simon Glass
At present U-Boot always builds dtc if CONFIG_OF_CONTROL is defined, even
when DTC is provided. The built dtc is not actually used, so this is a
waste of time.

Update the Makefile logic to build dtc only if one is not provided to the
build with the DTC variable. Add documentation to explain this.

This saves about 3.5 seconds of elapsed time on a clean build of
sandbox_spl for me.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Use DTC_MIN_VERSION instead of hard-coding in the dtc-version call
- Make the logic deterministic, failing if DTC is too old
- Move version checks into Makefile to avoid the complicated version script
- Add documentation
- Update the commit message

Changes in v2:
- Add a patch to bring back the dtc-version.sh script
- Update the check to make sure libfdt is available if needed

 Makefile   | 30 --
 doc/build/gcc.rst  | 21 +
 dts/Kconfig|  4 
 scripts/Makefile   |  1 -
 scripts/dtc-version.sh |  7 ++-
 5 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 3014788e14e..74ca48c50c3 100644
--- a/Makefile
+++ b/Makefile
@@ -415,7 +415,13 @@ PERL   = perl
 PYTHON ?= python
 PYTHON2= python2
 PYTHON3?= python3
-DTC?= $(objtree)/scripts/dtc/dtc
+
+# The devicetree compiler and pylibfdt are automatically built unless DTC is
+# provided. If DTC is provided, it is assumed the pylibfdt is available too.
+DTC_INTREE := $(objtree)/scripts/dtc/dtc
+DTC?= $(DTC_INTREE)
+DTC_MIN_VERSION:= 010406
+
 CHECK  = sparse
 
 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
@@ -1973,9 +1979,29 @@ endif
 
 endif
 
+# Check dtc and pylibfdt, if DTC is provided, else build them
 PHONY += scripts_dtc
 scripts_dtc: scripts_basic
-   $(Q)$(MAKE) $(build)=scripts/dtc
+   $(Q)if test "$(DTC)" = "$(DTC_INTREE)"; then \
+   $(MAKE) $(build)=scripts/dtc; \
+   else \
+   if ! $(DTC) -v >/dev/null; then \
+   echo '*** Failed to check dtc version: $(DTC)'; \
+   false; \
+   else \
+   if test "$(call dtc-version)" -lt $(DTC_MIN_VERSION); 
then \
+   echo '*** Your dtc is too old, please upgrade 
to dtc $(DTC_MIN_VERSION) or newer'; \
+   false; \
+   else \
+   if [ -n "$(CONFIG_PYLIBFDT)" ]; then \
+   if ! echo "import libfdt" | $(PYTHON3) 
2>/dev/null; then \
+   echo '*** pylibfdt does not 
seem to be available with $(PYTHON3)'; \
+   false; \
+   fi; \
+   fi; \
+   fi; \
+   fi; \
+   fi
 
 # ---
 quiet_cmd_cpp_lds = LDS $@
diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst
index 0cdc307d57b..6c4b4ad7a05 100644
--- a/doc/build/gcc.rst
+++ b/doc/build/gcc.rst
@@ -120,6 +120,27 @@ Further important build parameters are
 * O= - generate all output files in directory , including .config
 * V=1 - verbose build
 
+Devicetree compiler
+~~~
+
+Boards that use `CONFIG_OF_CONTROL` (i.e. almost all of them) need the
+devicetree compiler (dtc). Those with `CONFIG_PYLIBFDT` need pylibfdt, a Python
+library for accessing devicetree data. Suitable versions of these are included
+in the U-Boot tree in `scripts/dtc` and built automatically as needed.
+
+To use the system versions of these, use the DTC parameter, for example
+
+.. code-block:: bash
+
+DTC=/usr/bin/dtc make
+
+In this case, dtc and pylibfdt are not built. The build checks that the version
+of dtc is new enough. It also makes sure that pylibfdt is present, if needed
+(see `scripts_dtc` in the Makefile).
+
+Note that the :doc:`tools` are always built with the included version of libfdt
+so it is not possible to build U-Boot tools with a system libfdt, at present.
+
 Other build targets
 ~~~
 
diff --git a/dts/Kconfig b/dts/Kconfig
index dabe0080c1e..85d9d397e58 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -5,9 +5,6 @@
 config SUPPORT_OF_CONTROL
bool
 
-config DTC
-   bool
-
 config PYLIBFDT
bool
 
@@ -42,7 +39,6 @@ menu "Device Tree Control"
 
 config OF_CONTROL
bool "Run-time configuration via Device Tree"
-   select DTC
select OF_LIBFDT if !OF_PLATDATA
help
  This feature provides for run-time configuration of U-Boot
diff --git a/scripts/Makefile b/scripts/Makefile
index e7b353f77f4..cfe9fef8044 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -10,4 +10,3 @@ always:= $(hostprogs-y)
 
 # Let clean descend into

[PATCH v3 1/2] Revert "kbuild: remove unused dtc-version.sh script"

2021-09-22 Thread Simon Glass
We need this to make building dtc optional. It makes no sense to build our
own dtc if the system one works correctly.

This reverts commit ddb87a0b40262ff99d675e946f57427642303938.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add an SPDX header and MAINTAINERS entry

 MAINTAINERS|  1 +
 scripts/Kbuild.include |  1 +
 scripts/dtc-version.sh | 22 ++
 3 files changed, 24 insertions(+)
 create mode 100755 scripts/dtc-version.sh

diff --git a/MAINTAINERS b/MAINTAINERS
index 67c96a60454..294d78b52e2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -757,6 +757,7 @@ F:  include/fdt*
 F: include/linux/libfdt*
 F: cmd/fdt.c
 F: common/fdt_support.c
+F: scripts/dtc-version.sh
 
 FREEBSD
 M: Rafal Jaworowski 
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index a745cc4fccd..09506cb9a7e 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -148,6 +148,7 @@ cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo 
$(3) || echo $(4))
 
 # added for U-Boot
 binutils-version = $(shell $(CONFIG_SHELL) 
$(srctree)/scripts/binutils-version.sh $(AS))
+dtc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/dtc-version.sh $(DTC))
 
 # cc-ldoption
 # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh
new file mode 100755
index 000..bd4e818e92d
--- /dev/null
+++ b/scripts/dtc-version.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# dtc-version dtc-command
+#
+# Prints the dtc version of `dtc-command' in a canonical 6-digit form
+# such as `010404'  for dtc 1.4.4
+#
+
+dtc="$*"
+
+if [ ${#dtc} -eq 0 ]; then
+   echo "Error: No dtc command specified."
+   printf "Usage:\n\t$0 \n"
+   exit 1
+fi
+
+MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1)
+MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2)
+PATCH=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 3 | cut -d - -f 1)
+
+printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCH
-- 
2.33.0.685.g46640cef36-goog



Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Marek Behún
(Adding also Tom.)

Hi Patrick, Marek,

I find this either not complete or not needed:

- either you need mtd names to be of this format so that old MTDPARTS
  config definitions do not need to be changed, i.e. something like
CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
  does not work currently, and you want to make it work.

  I find your solution here incomplete because MTDPARTS can also be
  used to be passed to Linux as mtdparts parameter, but there is no
  guarantee that the "norN" numbering you are creating in U-Boot will
  be the same as the one in kernel.

- or it is not needed, because you can remove MTDPARTS definition from
  the board config entirely and move the information into device tree. 
  In fact this was the main idea behind making the series
Support SPI NORs and OF partitions in `mtd list`
  The SPI-NOR MTDs after this series can have conflicting names,
  because you can still choose between them via OF path with the `mtd`
  command.

  Tom and I were of the opinion that MTDPARTS should be deprecated and
  removed in favor of OF. Marek Vasut says that this is not possible
  for every board, and so needs to stay.

BTW, I find it a little weird for Marek to defend old API which should
be converted to DT, when in discussion about DM USB / Nokia N900
USB TTY console [1] he was defending the opinion that we should be
heading to DT in U-Boot.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-p...@kernel.org/

On Wed, 22 Sep 2021 18:29:06 +0200
Patrick Delaunay  wrote:

> This serie is a V4 for [1].
> 
> Now the SPI nor are named "norN" with N after the CFI nor device:
> "nor0" to "norM" => N= M+1.
> 
> See also an other proposal from Marek (not working after test)
> "mtd: spi-nor: Fix SF MTDIDS when registering multiple MTDs with
> DM enabled"
> 
> http://patchwork.ozlabs.org/project/uboot/list/?series=262362
> 
> The first patch of the serie fixed the compilation issues around
> 'cfi_flash_num_flash_banks' found in CI:
> 
> https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9138
> 
> [1] Series: mtd: spi: nor: force mtd name to "nor%d"
> http://patchwork.ozlabs.org/project/uboot/list/?series=262632&state=*
> http://patchwork.ozlabs.org/project/uboot/list/?series=262017&state=*
> http://patchwork.ozlabs.org/project/uboot/list/?series=262013&state=*
> 
> Patrick
> 
> 
> Changes in v4:
> - introduce macro MTD_NAME_SIZE for mtd_name size and use MTD_DEV_TYPE
>   to retrieved the "nor" string.
> 
> Changes in v3:
> - NEW: solve compilation issue when CONFIG_SYS_MAX_FLASH_BANKS is used
> - start index after the last CFI device, use CONFIG_SYS_MAX_FLASH_BANKS
> 
> Changes in v2:
> - correct commit message
> 
> Patrick Delaunay (2):
>   mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported
>   mtd: spi: nor: force mtd name to "nor%d"
> 
>  drivers/mtd/spi/spi-nor-core.c | 17 ++---
>  include/dm/device.h|  3 ++-
>  include/linux/mtd/spi-nor.h|  2 ++
>  include/mtd.h  |  4 
>  include/mtd/cfi_flash.h|  8 +++-
>  5 files changed, 29 insertions(+), 5 deletions(-)
> 



[PATCH v4 2/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Patrick Delaunay
Force the mtd name of spi-nor to "nor" + the driver sequence number:
"nor0", "nor1"... beginning after the existing nor devices.

This patch is coherent with existing "nand" and "spi-nand"
mtd device names.

When CFI MTD NOR device are supported, the spi-nor index is chosen after
the last CFI device defined by CONFIG_SYS_MAX_FLASH_BANKS.

When CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated, this config
is replaced by to cfi_flash_num_flash_banks in the include file
mtd/cfi_flash.h.

This generic name "nor%d" can be use to identify the mtd spi-nor device
without knowing the real device name or the DT path of the device,
used with API get_mtd_device_nm() and is used in mtdparts command.

This patch also avoids issue when the same NOR device is present 2 times,
for example on STM32MP15F-EV1:

STM32MP> mtd list
SF: Detected mx66l51235l with page size 256 Bytes, erase size 64 KiB, \
total 64 MiB

List of MTD devices:
* nand0
  - type: NAND flash
  - block size: 0x4 bytes
  - min I/O: 0x1000 bytes
  - OOB size: 224 bytes
  - OOB available: 118 bytes
  - ECC strength: 8 bits
  - ECC step size: 512 bytes
  - bitflip threshold: 6 bits
  - 0x-0x4000 : "nand0"
* mx66l51235l
  - device: mx66l51235l@0
  - parent: spi@58003000
  - driver: jedec_spi_nor
  - path: /soc/spi@58003000/mx66l51235l@0
  - type: NOR flash
  - block size: 0x1 bytes
  - min I/O: 0x1 bytes
  - 0x-0x0400 : "mx66l51235l"
* mx66l51235l
  - device: mx66l51235l@1
  - parent: spi@58003000
  - driver: jedec_spi_nor
  - path: /soc/spi@58003000/mx66l51235l@1
  - type: NOR flash
  - block size: 0x1 bytes
  - min I/O: 0x1 bytes
  - 0x-0x0400 : "mx66l51235l"

The same mtd name "mx66l51235l" identify the 2 instances
mx66l51235l@0 and mx66l51235l@1.

This patch fixes a ST32CubeProgrammer / stm32prog command issue
with nor0 target on STM32MP157C-EV1 board introduced by
commit b7f060565e31 ("mtd: spi-nor: allow registering multiple MTDs when
DM is enabled").

Fixes: b7f060565e31 ("mtd: spi-nor: allow registering multiple MTDs when DM is 
enabled")
Signed-off-by: Patrick Delaunay 
---
For other device, the mtd name are hardcoded in each MTD driver:

drivers/mtd/nand/spi/core.c:1169:
sprintf(mtd->name, "spi-nand%d", spi_nand_idx++);
drivers/mtd/nand/raw/nand.c:59:
sprintf(dev_name[devnum], "nand%d", devnum);

And the nor device name "nor%d" is also used for CFI in
./drivers/mtd/cfi_mtd.c with i=0 to CONFIG_SYS_MAX_FLASH_BANKS - 1

sprintf(cfi_mtd_names[i], "nor%d", i);
mtd->name   = cfi_mtd_names[i];

Today the number of CFI device is hardcoded by this config.


Changes in v4:
- introduce macro MTD_NAME_SIZE for mtd_name size and use MTD_DEV_TYPE
  to retrieved the "nor" string.

Changes in v3:
- start index after the last CFI device, use CONFIG_SYS_MAX_FLASH_BANKS

Changes in v2:
- correct commit message

 drivers/mtd/spi/spi-nor-core.c | 17 ++---
 include/dm/device.h|  3 ++-
 include/linux/mtd/spi-nor.h|  2 ++
 include/mtd.h  |  4 
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index d5d905fa5a..f1b4e5ea8e 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -10,6 +10,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -26,6 +27,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -3664,6 +3666,11 @@ int spi_nor_scan(struct spi_nor *nor)
struct mtd_info *mtd = &nor->mtd;
struct spi_slave *spi = nor->spi;
int ret;
+   int cfi_mtd_nb = 0;
+
+#ifdef CONFIG_SYS_MAX_FLASH_BANKS
+   cfi_mtd_nb = CONFIG_SYS_MAX_FLASH_BANKS;
+#endif
 
/* Reset SPI protocol for all commands. */
nor->reg_proto = SNOR_PROTO_1_1_1;
@@ -3715,8 +3722,12 @@ int spi_nor_scan(struct spi_nor *nor)
if (ret)
return ret;
 
-   if (!mtd->name)
-   mtd->name = info->name;
+   if (!mtd->name) {
+   sprintf(nor->mtd_name, "%s%d",
+   MTD_DEV_TYPE(MTD_DEV_TYPE_NOR),
+   cfi_mtd_nb + dev_seq(nor->dev));
+   mtd->name = nor->mtd_name;
+   }
mtd->dev = nor->dev;
mtd->priv = nor;
mtd->type = MTD_NORFLASH;
@@ -3821,7 +3832,7 @@ int spi_nor_scan(struct spi_nor *nor)
 
nor->rdsr_dummy = params.rdsr_dummy;
nor->rdsr_addr_nbytes = params.rdsr_addr_nbytes;
-   nor->name = mtd->name;
+   nor->name = info->name;
nor->size = mtd->size;
nor->erase_size = mtd->erasesize;
nor->sector_size = mtd->erasesize;
diff --git a/include/dm/device.h b/include/dm/device.h
index 0a9718a5b8..b1d8da747a 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -207,8 +207,9 @@ struct udevice_rt {
u32 flags_;
 };
 
-/* Maximum sequence number supported */
+/* Maximum sequence number supported an

[PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-22 Thread Patrick Delaunay


This serie is a V4 for [1].

Now the SPI nor are named "norN" with N after the CFI nor device:
"nor0" to "norM" => N= M+1.

See also an other proposal from Marek (not working after test)
"mtd: spi-nor: Fix SF MTDIDS when registering multiple MTDs with
DM enabled"

http://patchwork.ozlabs.org/project/uboot/list/?series=262362

The first patch of the serie fixed the compilation issues around
'cfi_flash_num_flash_banks' found in CI:

https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9138

[1] Series: mtd: spi: nor: force mtd name to "nor%d"
http://patchwork.ozlabs.org/project/uboot/list/?series=262632&state=*
http://patchwork.ozlabs.org/project/uboot/list/?series=262017&state=*
http://patchwork.ozlabs.org/project/uboot/list/?series=262013&state=*

Patrick


Changes in v4:
- introduce macro MTD_NAME_SIZE for mtd_name size and use MTD_DEV_TYPE
  to retrieved the "nor" string.

Changes in v3:
- NEW: solve compilation issue when CONFIG_SYS_MAX_FLASH_BANKS is used
- start index after the last CFI device, use CONFIG_SYS_MAX_FLASH_BANKS

Changes in v2:
- correct commit message

Patrick Delaunay (2):
  mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported
  mtd: spi: nor: force mtd name to "nor%d"

 drivers/mtd/spi/spi-nor-core.c | 17 ++---
 include/dm/device.h|  3 ++-
 include/linux/mtd/spi-nor.h|  2 ++
 include/mtd.h  |  4 
 include/mtd/cfi_flash.h|  8 +++-
 5 files changed, 29 insertions(+), 5 deletions(-)

-- 
2.25.1



[PATCH v4 1/2] mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported

2021-09-22 Thread Patrick Delaunay
When CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated,
CONFIG_SYS_MAX_FLASH_BANKS is replaced by cfi_flash_num_flash_banks,
but this variable is defined in drivers/mtd/cfi_flash.c, which is
compiled only when CONFIG_FLASH_CFI_DRIVER is activated, in U-Boot
or in SPL when CONFIG_SPL_MTD_SUPPORT is activated.

This patch deactivates this feature CONFIG_SYS_MAX_FLASH_BANKS_DETECT
when flash cfi driver is not activated to avoid compilation issue in
the next patch, when CONFIG_SYS_MAX_FLASH_BANKS is used in spi_nor_scan().

Signed-off-by: Patrick Delaunay 
---
see error in
https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9138

drivers/mtd/spi/spi-nor-core.o: in function `spi_nor_scan':
drivers/mtd/spi/spi-nor-core.c:3672:
undefined reference to `cfi_flash_num_flash_banks'

compilation issue for the boards:
- j721e_hs_evm_r5
- j721e_evm_r5j
- j721e_hs_evm_a72
- j721e_evm_a72
- sagem_f@st1704_ram

(no changes since v3)

Changes in v3:
- NEW: solve compilation issue when CONFIG_SYS_MAX_FLASH_BANKS is used

 include/mtd/cfi_flash.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h
index 4963c89642..a1af6fc200 100644
--- a/include/mtd/cfi_flash.h
+++ b/include/mtd/cfi_flash.h
@@ -157,11 +157,17 @@ struct cfi_pri_hdr {
  * Use CONFIG_SYS_MAX_FLASH_BANKS_DETECT if defined
  */
 #if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT)
-#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks)
 #define CFI_MAX_FLASH_BANKSCONFIG_SYS_MAX_FLASH_BANKS_DETECT
+/* map to cfi_flash_num_flash_banks only when supported */
+#if IS_ENABLED(CONFIG_FLASH_CFI_DRIVER) && \
+(!IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_SPL_MTD_SUPPORT))
+#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks)
 /* board code can update this variable before CFI detection */
 extern int cfi_flash_num_flash_banks;
 #else
+#define CONFIG_SYS_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+#endif
+#else
 #define CFI_MAX_FLASH_BANKSCONFIG_SYS_MAX_FLASH_BANKS
 #endif
 
-- 
2.25.1



Re: [PATCH 2/4] dm: hash: Add new UCLASS_HASH support

2021-09-22 Thread Simon Glass
Hi,

On Thu, 2 Sept 2021 at 07:28, Tom Rini  wrote:
>
> On Fri, Jul 30, 2021 at 09:08:03AM +0800, Chia-Wei Wang wrote:
>
> > Add UCLASS_HASH for hash driver development. Thus the
> > hash drivers (SW or HW-accelerated) can be developed
> > in the DM-based fashion.
> >
> > Signed-off-by: Chia-Wei Wang 
>
> Applied to u-boot/next, thanks!

Oddly enough I didn't see this patch but did see Tom's reply.

Regards,
SImon


Re: [PATCH v2 1/3] efi_loader: add SMBIOS table measurement

2021-09-22 Thread Simon Glass
Hi Masahisa,

On Tue, 21 Sept 2021 at 01:17, Masahisa Kojima
 wrote:
>
> TCG PC Client spec requires to measure the SMBIOS
> table that contain static configuration information
> (e.g. Platform Manufacturer Enterprise Number assigned by IANA,
> platform model number, Vendor and Device IDs for each SMBIOS table).
>
> The device and environment dependent information such as

device- and environment-dependent

> serial number is cleared to zero or space character for
> the measurement.
>
> Existing smbios_string() function returns pointer to the string
> with const qualifier, but exisintg use case is updating version
> string and const qualifier must be removed.
> This commit removes const qualifier from smbios_string()
> return value and reuses to clear the strings for the measurement.
>
> This commit also fixes the following compiler warning:
>
> lib/smbios-parser.c:59:39: warning: cast to pointer from integer of
> different size [-Wint-to-pointer-cast]
>   const struct smbios_header *header = (struct smbios_header 
> *)entry->struct_table_address;
>
> Signed-off-by: Masahisa Kojima 
> ---
>
> Changes in v2:
> - use flexible array for table_entry field
> - modify funtion name to find_smbios_table()
> - remove unnecessary const qualifier from smbios_string()
> - create non-const version of next_header()
>
>  include/efi_loader.h  |   2 +
>  include/efi_tcg2.h|  15 
>  include/smbios.h  |  17 +++-
>  lib/efi_loader/Kconfig|   1 +
>  lib/efi_loader/efi_boottime.c |   2 +
>  lib/efi_loader/efi_smbios.c   |   2 -
>  lib/efi_loader/efi_tcg2.c |  84 +++
>  lib/smbios-parser.c   | 152 +++---
>  8 files changed, 261 insertions(+), 14 deletions(-)

Where are the tests for this new code, please?

Would it make sense to have a function that iterates through the data
that does need to be hashed, instead?

Regards,
Simon


Re: [PATCH] rtc: ds1307: Handle oscillator-stop bit correctly

2021-09-22 Thread Simon Glass
Hi Mark,

On Mon, 20 Sept 2021 at 19:17, Mark Tomlinson
 wrote:
>
> The DS1307 driver was originally based on the DS1337 driver. However,
> the functionality of the clock set/get functions has diverged. In the
> original DS1337 driver, the set/get functions did the following:
>   1) Setting the clock ensured the oscillator was enabled.
>   2) Getting the clock checked and reset the oscillator-stop flag.
> The DS1307 does not have and oscillator-stop flag, but the driver tried

an

> (incorrectly) to emulate this by ensuring the oscillator was running. It
> really makes no sense to start a stopped clock without setting it.
>
> This patch makes the DS1307 driver behave like the original DS1337
> driver again. For the DS1307 itself, this is just a removal of code,
> since there is no oscillator-fail bit to check or reset, and the clock
> is started when it is set. Since the DS1307 driver can now also be used
> for the DS1337 and DS1340 which do have this bit, add code to handle the
> oscillator-stop bit in the same was the original DS1337 driver did --
> i.e. report that the oscillator had stopped and clear the flag.
>
> This means that setting the date using the date command (which does both
> a get and a set) will now clear the oscillator-stop flag in addition to
> setting and starting the clock.
>
> The old-style (non-DM) code has also been updated. Note that this does
> not support the DS1337, as there is a separate driver for this. Also
> note that the original (DM) code used the wrong control-register address
> for the DS1337.

Please don't update the old-style code. Delete it (in a separate
patch) if it won't cause build errors.

>
> Signed-off-by: Mark Tomlinson 
> ---
> Note that this patch is based on 'next' rather than 'master' as it is
> dependent on a patch which has not yet made it to master.
>
>  drivers/rtc/ds1307.c | 106 ---
>  1 file changed, 29 insertions(+), 77 deletions(-)
>

Regards,
Simon


Re: Please pull u-boot-x86

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 11:42:07PM +0800, Bin Meng wrote:

> Hi Tom,
> 
> This PR includes the following x86 changes for v2021.10 release:
> 
> - Small fixes to eMMC and SDHCI for Intel Edison
> 
> Azure results: PASS
> https://dev.azure.com/bmeng/GitHub/_build/results?buildId=457&view=results
> 
> The following changes since commit cfb573d22dac1089b5c792bc8529dd76acfa68fc:
> 
>   Merge tag 'u-boot-stm32-20210921' of
> https://source.denx.de/u-boot/custodians/u-boot-stm (2021-09-22
> 09:38:48 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-x86
> 
> for you to fetch changes up to 57e2c0a86fe48194c9407d36d60f9ab033b4460e:
> 
>   x86: tangier: acpi: Add GPIO card detection to SDHCI #2 (2021-09-22
> 21:50:35 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] MAINTAINERS: remove SPEAR entry

2021-09-22 Thread Bin Meng
On Wed, Sep 22, 2021 at 12:19 AM Patrick Delaunay
 wrote:
>
> As the lastest spear directories are removed, delete the associated entry
> in the MAINTAINERS file:
> - arch/arm/cpu/arm926ejs/spear/
> - arch/arm/include/asm/arch-spear/
>
> Fixes: 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr 
> support")
> Signed-off-by: Patrick Delaunay 
> ---
>
>  MAINTAINERS | 7 ---
>  1 file changed, 7 deletions(-)
>

Reviewed-by: Bin Meng 


Please pull u-boot-x86

2021-09-22 Thread Bin Meng
Hi Tom,

This PR includes the following x86 changes for v2021.10 release:

- Small fixes to eMMC and SDHCI for Intel Edison

Azure results: PASS
https://dev.azure.com/bmeng/GitHub/_build/results?buildId=457&view=results

The following changes since commit cfb573d22dac1089b5c792bc8529dd76acfa68fc:

  Merge tag 'u-boot-stm32-20210921' of
https://source.denx.de/u-boot/custodians/u-boot-stm (2021-09-22
09:38:48 -0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-x86

for you to fetch changes up to 57e2c0a86fe48194c9407d36d60f9ab033b4460e:

  x86: tangier: acpi: Add GPIO card detection to SDHCI #2 (2021-09-22
21:50:35 +0800)


Andy Shevchenko (2):
  x86: edison: Mark eMMC non-removable
  x86: tangier: acpi: Add GPIO card detection to SDHCI #2

 arch/x86/dts/edison.dts |  1 +
 arch/x86/include/asm/arch-tangier/acpi/southcluster.asl | 32

 2 files changed, 33 insertions(+)

Regards,
Bin


Re: [PULL] Pull request for u-boot master / v2021.10 = u-boot-stm32-20210921

2021-09-22 Thread Tom Rini
On Tue, Sep 21, 2021 at 09:48:57AM +0200, Patrick DELAUNAY wrote:

> Hi Tom,
> 
> Please pull the STM32 related fixes for u-boot/master, v2021.10:
> u-boot-stm32-20210921
> 
> - stm32mp15: fix the used partition name for U-Boot environement with SPL
> 
> CI status:
> https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9197
> 
> Thanks,
> Patrick
> 
> git request-pull origin/master
> https://source.denx.de/u-boot/custodians/u-boot-stm.git/
> u-boot-stm32-20210921
> 
> 
> 
> The following changes since commit e3f5edf65916a881b71eea54f475c7a4bae8565c:
> 
>   Merge https://source.denx.de/u-boot/custodians/u-boot-marvell (2021-09-20
> 08:45:26 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-stm.git/
> tags/u-boot-stm32-20210921
> 
> for you to fetch changes up to cf39d0c29dcf332d7055d0545fc95e3379d91a62:
> 
>   arm: dts: stm32mp1: use ssbl partition name for U-Boot (2021-09-21
> 09:22:01 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] mtd: remove SPEAr flash driver st_smi

2021-09-22 Thread Tom Rini
On Wed, Sep 22, 2021 at 11:02:26AM +0200, Patrick Delaunay wrote:

> Remove the driver st_smic.c used in SPEAr products and the associated
> config CONFIG_ST_SMI; this driver is no more used in U-Boot after the
> commit 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr
> support").
> 
> Fixes: 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr 
> support")
> Signed-off-by: Patrick Delaunay 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature


[PULL next] u-boot-at91-2022.01-a

2021-09-22 Thread Eugen.Hristev
Hello Tom,

Please pull tag u-boot-at91-2022.01-a , the first set of features for 
the next cycle 2022.01 . The PR is rebased on -next .

This feature set includes : the support for CPU driver for arm926 
(sam9x60 device); changes required for OP-TEE boot for sama5d2_xplained 
and sama5d27_som1_ek boards; QSPI boot configuration for sama5d2_icp; 
starting to remove old Kconfig unused symbols from config_whitelist.txt 
(work will take more time); also small fixes and updates in mach, DT, 
configs, etc.

Thanks,
Eugen


The following changes since commit 44131caa4025455a659e958281f0e337bdf83f89:

   scripts/config_whitelist.txt: Fix after merging (2021-09-16 13:18:21 
-0400)

are available in the Git repository at:

   https://source.denx.de/u-boot/custodians/u-boot-at91.git 
tags/u-boot-at91-2022.01-a

for you to fetch changes up to d65b84a1d0dc116010a3842dc13661976ef92629:

   ARM: dts: at91: update flexcom defines using include file (2021-09-21 
10:08:24 +0300)


First set of u-boot-at91 features for the 2022.01 cycle


Claudiu Beznea (4):
   clk: at91: clk-master: split master clock in pres and divider
   cpu: at91: add compatible for ARM9260EJ-S
   ARM: dts: at91: sam9x60: add bindings for CPU
   configs: sam9x60ek: enable CONFIG_CPU

Clément Léger (6):
   ARM: mach-at91: armv7: fix multiple cpu_reset definition when 
enabling SYSRESET
   board: sama5d27_som1_ek: Get dram size and base from device tree
   board: sama5d27_som1_ek: Modify load addresses
   ARM: dts: at91: sama5d2_xplained: Add memory node in devicetree
   board: sama5d2_xplained: Get dram size and base from device tree
   board: sama5d2_xplained: Modify load addresses

Eugen Hristev (8):
   ARM: dts: at91: sama5d2_icp: cosmetic arrangement of the nodes
   ARM: dts: at91: sama5d2: fix dtc warning for ohci and ehci
   board: atmel: sama7g5ek: avoid rewriting of configured 
CONFIG_BOOTCOMMAND
   board: pm926x: remove unused CONFIG_SYS_AT91_CPU_NAME
   ARM: at91: remove references to RM9200DK
   net: remove unused CONFIG_DRIVER_AT91EMAC_*
   include: dt-bindings: mfd: add atmel flexcom include file
   ARM: dts: at91: update flexcom defines using include file

Hari Prasath (1):
   ARM: at91: Add chip ID of SAMA5D29

Mihai Sain (2):
   ARM: dts: at91: sama5d2_icp: add QSPI1 device
   configs: sama5d2: add qspi config for QSPI1

Reto Schneider (1):
   configs: gardena-smart-gateway-at91sam: Adjust to production values

  MAINTAINERS |   1 +
  README  |  11 -
  arch/arm/cpu/arm920t/start.S|  14 -
  arch/arm/dts/at91-sama5d27_som1_ek.dts  |   4 +-
  arch/arm/dts/at91-sama5d2_icp-u-boot.dtsi   |  23 +-
  arch/arm/dts/at91-sama5d2_icp.dts   |  48 ++-
  arch/arm/dts/at91-sama5d2_ptc_ek.dts|   4 +-
  arch/arm/dts/at91-sama5d2_xplained.dts  |   8 +-
  arch/arm/dts/sam9x60.dtsi   |  12 +
  arch/arm/dts/sam9x60ek.dts  |   3 +-
  arch/arm/dts/sama5d2.dtsi   |   4 +-
  arch/arm/dts/sama7g5ek.dts  |   3 +-
  arch/arm/include/asm/mach-types.h   |   1 -
  arch/arm/mach-at91/armv7/Makefile   |   4 +-
  arch/arm/mach-at91/armv7/sama5d2_devices.c  |   2 +
  arch/arm/mach-at91/include/mach/sama5d2.h   |   1 +
  board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c |  12 +-
  board/atmel/sama5d2_icp/MAINTAINERS |   1 +
  board/atmel/sama5d2_xplained/sama5d2_xplained.c |  11 +-
  configs/gardena-smart-gateway-at91sam_defconfig |  15 +-
  configs/sam9x60ek_mmc_defconfig |   1 +
  configs/sam9x60ek_nandflash_defconfig   |   1 +
  configs/sam9x60ek_qspiflash_defconfig   |   1 +
  configs/sama5d2_icp_qspiflash_defconfig | 103 +
  configs/sama7g5ek_mmc1_defconfig|   2 +
  configs/sama7g5ek_mmc_defconfig |   2 +
  drivers/clk/at91/clk-master.c   | 107 -
  drivers/clk/at91/pmc.h  |   7 +-
  drivers/clk/at91/sam9x60.c  |  44 +-
  drivers/clk/at91/sama7g5.c  |  36 +-
  drivers/cpu/at91_cpu.c  |   1 +
  drivers/net/Makefile|   1 -
  drivers/net/at91_emac.c | 519 

  include/configs/pm9261.h|   2 -
  include/configs/pm9263.h|   2 -
  include/configs/sama5d27_som1_ek.h  |  12 +-
  include/configs/sama5d2_xplained.h  |  24 +-
  include/configs/sama7g5ek.h |   6 +-
  include/dt-bindings/mfd/atmel-flexcom.h |  15 +
  include/netdev.h 

[PATCH 2/2] cmd/mmc: add subcommand to query max enhanced partition size

2021-09-22 Thread Matthias Schiffer
From: Markus Niebel 

The new command prints the sector count and size in a human-readable
format and sets an environment variable for scripted handling. The
variable value is set in decimal to match what the 'mmc hwpartition'
command expects.

The environment variable can be used for automated partitioning scripts,
for example the following would convert a whole eMMC to pSLC mode:

mmc maxhwpartsectors
mmc hwpartition user enh 0 ${maxhwpartsectors} wrrel on complete

Signed-off-by: Markus Niebel 
Signed-off-by: Matthias Schiffer 
---

The human-readable output of the command could also be added to `mmc info`,
but it would still be great to have a separate command that sets an
environment variable for scripting, like this patch adds.


 cmd/mmc.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index f1e30d0cf64..d0b33cc0494 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -593,6 +593,33 @@ static int do_mmc_list(struct cmd_tbl *cmdtp, int flag,
 }
 
 #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
+static int do_mmc_maxhwpartsectors(struct cmd_tbl *cmdtp, int flag, int argc, 
char * const argv[])
+{
+   struct mmc *mmc;
+   u64 sectors;
+
+   mmc = init_mmc_device(curr_device, false);
+   if (!mmc)
+   return CMD_RET_FAILURE;
+
+   if (mmc_max_enhanced_size_sectors(mmc, §ors))
+   return CMD_RET_FAILURE;
+
+   /* Ensure that the value fits in mmc_hwpart_conf::user.enh_size */
+   if (sectors > UINT_MAX) {
+   puts("ERROR: sector count larger than UINT_MAX\n");
+   return CMD_RET_FAILURE;
+   }
+
+   env_set_ulong("maxhwpartsectors", sectors);
+
+   printf("Maximum size of hardware partition: %u sectors (",
+  (uint)sectors);
+   print_size(sectors * 512, ")\n");
+
+   return 0;
+}
+
 static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
 int argc, char *const argv[])
 {
@@ -1021,6 +1048,7 @@ static struct cmd_tbl cmd_mmc[] = {
U_BOOT_CMD_MKENT(dev, 4, 0, do_mmc_dev, "", ""),
U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
 #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
+   U_BOOT_CMD_MKENT(maxhwpartsectors, 1, 0, do_mmc_maxhwpartsectors, "", 
""),
U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),
 #endif
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
@@ -1084,6 +1112,8 @@ U_BOOT_CMD(
"mmc list - lists available devices\n"
"mmc wp - power on write protect boot partitions\n"
 #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
+   "mmc maxhwpartsectors - shows the maximum number of 512-byte blocks 
usable for hardware partitioning\n"
+   "  Sets env var maxhwpartsectors on success.\n"
"mmc hwpartition- does hardware partitioning\n"
"  arguments (sizes in 512-byte blocks):\n"
"   USER -  <{on|off}>\n"
-- 
2.17.1



[PATCH 1/2] mmc: add helper to query max enhanced part size

2021-09-22 Thread Matthias Schiffer
From: Markus Niebel 

This helper will be used later on in an extension of the mmc
command.

Signed-off-by: Markus Niebel 
Signed-off-by: Matthias Schiffer 
---
 drivers/mmc/mmc.c | 38 ++
 include/mmc.h |  1 +
 2 files changed, 39 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d3babbfeb1c..c1b1ef7eb0b 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1039,6 +1039,44 @@ int mmc_switch_part(struct mmc *mmc, unsigned int 
part_num)
 }
 
 #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
+int mmc_max_enhanced_size_sectors(struct mmc *mmc, u64 *size)
+{
+   u64 sz;
+   int err;
+
+   ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
+
+   if (IS_SD(mmc) || mmc->version < MMC_VERSION_4_41) {
+   pr_err("eMMC >= 4.4 required for enhanced user data area\n");
+   return -EMEDIUMTYPE;
+   }
+
+   if (!(mmc->part_support & PART_SUPPORT)) {
+   pr_err("Card does not support partitioning\n");
+   return -EMEDIUMTYPE;
+   }
+
+   if (!mmc->hc_wp_grp_size) {
+   pr_err("Card does not define HC WP group size\n");
+   return -EMEDIUMTYPE;
+   }
+
+   err = mmc_send_ext_csd(mmc, ext_csd);
+   if (err)
+   return err;
+
+   sz =
+   (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 2] << 16) +
+   (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 1] << 8) +
+   ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT];
+   sz *= ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
+   sz *= ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
+   sz *= SZ_1K;
+   *size = sz;
+
+   return 0;
+}
+
 int mmc_hwpart_config(struct mmc *mmc,
  const struct mmc_hwpart_conf *conf,
  enum mmc_hwpart_conf_mode mode)
diff --git a/include/mmc.h b/include/mmc.h
index b92e2553402..3e1fc82d9b4 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -846,6 +846,7 @@ void print_mmc_devices(char separator);
  */
 int get_mmc_num(void);
 int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
+int mmc_max_enhanced_size_sectors(struct mmc *mmc, u64 *size);
 int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
  enum mmc_hwpart_conf_mode mode);
 
-- 
2.17.1



Re: [PATCH] mtd: remove SPEAr flash driver st_smi

2021-09-22 Thread Stefan Roese

On 22.09.21 11:02, Patrick Delaunay wrote:

Remove the driver st_smic.c used in SPEAr products and the associated
config CONFIG_ST_SMI; this driver is no more used in U-Boot after the
commit 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr
support").

Fixes: 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr 
support")
Signed-off-by: Patrick Delaunay 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
Even if CONFIG_ST_SMI was activated in 2 board, the compiled driver was
empty because CONFIG_MTD_NOR_FLASH wasn't activated in:
- bcm7260_defconfig
- bcm7445_defconfig

The U-Boot size don't change for these 2 defconfig (tested with buildman).

This patch replace the previous "configs: Migrate CONFIG_ST_SMI to Kconfig".
http://patchwork.ozlabs.org/project/uboot/list/?series=263365&state=*


  drivers/mtd/Makefile |   1 -
  drivers/mtd/st_smi.c | 565 ---
  include/configs/bcmstb.h |   1 -
  include/linux/mtd/st_smi.h   | 100 ---
  scripts/config_whitelist.txt |   1 -
  5 files changed, 668 deletions(-)
  delete mode 100644 drivers/mtd/st_smi.c
  delete mode 100644 include/linux/mtd/st_smi.h

diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 6d77ebfaa5..ce0451108e 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -12,7 +12,6 @@ mtd-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
  mtd-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
  mtd-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
  mtd-$(CONFIG_FLASH_PIC32) += pic32_flash.o
-mtd-$(CONFIG_ST_SMI) += st_smi.o
  mtd-$(CONFIG_STM32_FLASH) += stm32_flash.o
  mtd-$(CONFIG_RENESAS_RPC_HF) += renesas_rpc_hf.o
  mtd-$(CONFIG_HBMC_AM654) += hbmc-am654.o
diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
deleted file mode 100644
index 7c652e6c53..00
--- a/drivers/mtd/st_smi.c
+++ /dev/null
@@ -1,565 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Microelectronics, vipin.ku...@st.com.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#if defined(CONFIG_MTD_NOR_FLASH)
-
-static struct smi_regs *const smicntl =
-(struct smi_regs * const)CONFIG_SYS_SMI_BASE;
-static ulong bank_base[CONFIG_SYS_MAX_FLASH_BANKS] =
-CONFIG_SYS_FLASH_ADDR_BASE;
-flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
-
-/* data structure to maintain flash ids from different vendors */
-struct flash_device {
-   char *name;
-   u8 erase_cmd;
-   u32 device_id;
-   u32 pagesize;
-   unsigned long sectorsize;
-   unsigned long size_in_bytes;
-};
-
-#define FLASH_ID(n, es, id, psize, ssize, size)\
-{  \
-   .name = n,  \
-   .erase_cmd = es,\
-   .device_id = id,\
-   .pagesize = psize,  \
-   .sectorsize = ssize,\
-   .size_in_bytes = size   \
-}
-
-/*
- * List of supported flash devices.
- * Currently the erase_cmd field is not used in this driver.
- */
-static struct flash_device flash_devices[] = {
-   FLASH_ID("st m25p16" , 0xd8, 0x00152020, 0x100, 0x1, 0x20),
-   FLASH_ID("st m25p32" , 0xd8, 0x00162020, 0x100, 0x1, 0x40),
-   FLASH_ID("st m25p64" , 0xd8, 0x00172020, 0x100, 0x1, 0x80),
-   FLASH_ID("st m25p128", 0xd8, 0x00182020, 0x100, 0x4, 0x100),
-   FLASH_ID("st m25p05" , 0xd8, 0x00102020, 0x80 , 0x8000 , 0x1),
-   FLASH_ID("st m25p10" , 0xd8, 0x00112020, 0x80 , 0x8000 , 0x2),
-   FLASH_ID("st m25p20" , 0xd8, 0x00122020, 0x100, 0x1, 0x4),
-   FLASH_ID("st m25p40" , 0xd8, 0x00132020, 0x100, 0x1, 0x8),
-   FLASH_ID("st m25p80" , 0xd8, 0x00142020, 0x100, 0x1, 0x10),
-   FLASH_ID("st m45pe10", 0xd8, 0x00114020, 0x100, 0x1, 0x2),
-   FLASH_ID("st m45pe20", 0xd8, 0x00124020, 0x100, 0x1, 0x4),
-   FLASH_ID("st m45pe40", 0xd8, 0x00134020, 0x100, 0x1, 0x8),
-   FLASH_ID("st m45pe80", 0xd8, 0x00144020, 0x100, 0x1, 0x10),
-   FLASH_ID("sp s25fl004"   , 0xd8, 0x00120201, 0x100, 0x1, 0x8),
-   FLASH_ID("sp s25fl008"   , 0xd8, 0x00130201, 0x100, 0x1, 0x10),
-   FLASH_ID("sp s25fl016"   , 0xd8, 0x00140201, 0x100, 0x1, 0x20),
-   FLASH_ID("sp s25fl032"   , 0xd8, 0x00150201, 0x100, 0x1, 0x40),
-   FLASH_ID("sp s25fl064"   , 0xd8, 0x00160201, 0x100, 0x1, 0x80),
-   FLASH_ID("mac 25l512", 0xd8, 0x001020C2, 0x010, 0x1, 0x1),
-   FLASH_ID("mac 25l1005"   , 0xd8, 0x001120C2, 0x010, 0x1, 0x2),
-   FLASH_ID("mac 25l2005"   , 0xd8, 0x001220C2, 0x010, 0x1, 0x4),
-   FLASH_ID("mac 25l4005"   , 0xd8, 0x001320C2, 0x010, 0x1, 0x8),
-   FLASH_ID("mac 25l4005a"  , 0xd8, 0x001320C2, 0x010, 0x1, 0x8),
-   FLASH_ID("mac 25l8005"   , 0xd8, 0x001420C2, 0x010, 0x1, 0x10),
-   FLASH

[PATCH] mtd: remove SPEAr flash driver st_smi

2021-09-22 Thread Patrick Delaunay
Remove the driver st_smic.c used in SPEAr products and the associated
config CONFIG_ST_SMI; this driver is no more used in U-Boot after the
commit 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr
support").

Fixes: 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr 
support")
Signed-off-by: Patrick Delaunay 
---
Even if CONFIG_ST_SMI was activated in 2 board, the compiled driver was
empty because CONFIG_MTD_NOR_FLASH wasn't activated in:
- bcm7260_defconfig
- bcm7445_defconfig

The U-Boot size don't change for these 2 defconfig (tested with buildman).

This patch replace the previous "configs: Migrate CONFIG_ST_SMI to Kconfig".
http://patchwork.ozlabs.org/project/uboot/list/?series=263365&state=*


 drivers/mtd/Makefile |   1 -
 drivers/mtd/st_smi.c | 565 ---
 include/configs/bcmstb.h |   1 -
 include/linux/mtd/st_smi.h   | 100 ---
 scripts/config_whitelist.txt |   1 -
 5 files changed, 668 deletions(-)
 delete mode 100644 drivers/mtd/st_smi.c
 delete mode 100644 include/linux/mtd/st_smi.h

diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 6d77ebfaa5..ce0451108e 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -12,7 +12,6 @@ mtd-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
 mtd-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
 mtd-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 mtd-$(CONFIG_FLASH_PIC32) += pic32_flash.o
-mtd-$(CONFIG_ST_SMI) += st_smi.o
 mtd-$(CONFIG_STM32_FLASH) += stm32_flash.o
 mtd-$(CONFIG_RENESAS_RPC_HF) += renesas_rpc_hf.o
 mtd-$(CONFIG_HBMC_AM654) += hbmc-am654.o
diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
deleted file mode 100644
index 7c652e6c53..00
--- a/drivers/mtd/st_smi.c
+++ /dev/null
@@ -1,565 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Microelectronics, vipin.ku...@st.com.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#if defined(CONFIG_MTD_NOR_FLASH)
-
-static struct smi_regs *const smicntl =
-(struct smi_regs * const)CONFIG_SYS_SMI_BASE;
-static ulong bank_base[CONFIG_SYS_MAX_FLASH_BANKS] =
-CONFIG_SYS_FLASH_ADDR_BASE;
-flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
-
-/* data structure to maintain flash ids from different vendors */
-struct flash_device {
-   char *name;
-   u8 erase_cmd;
-   u32 device_id;
-   u32 pagesize;
-   unsigned long sectorsize;
-   unsigned long size_in_bytes;
-};
-
-#define FLASH_ID(n, es, id, psize, ssize, size)\
-{  \
-   .name = n,  \
-   .erase_cmd = es,\
-   .device_id = id,\
-   .pagesize = psize,  \
-   .sectorsize = ssize,\
-   .size_in_bytes = size   \
-}
-
-/*
- * List of supported flash devices.
- * Currently the erase_cmd field is not used in this driver.
- */
-static struct flash_device flash_devices[] = {
-   FLASH_ID("st m25p16" , 0xd8, 0x00152020, 0x100, 0x1, 0x20),
-   FLASH_ID("st m25p32" , 0xd8, 0x00162020, 0x100, 0x1, 0x40),
-   FLASH_ID("st m25p64" , 0xd8, 0x00172020, 0x100, 0x1, 0x80),
-   FLASH_ID("st m25p128", 0xd8, 0x00182020, 0x100, 0x4, 0x100),
-   FLASH_ID("st m25p05" , 0xd8, 0x00102020, 0x80 , 0x8000 , 0x1),
-   FLASH_ID("st m25p10" , 0xd8, 0x00112020, 0x80 , 0x8000 , 0x2),
-   FLASH_ID("st m25p20" , 0xd8, 0x00122020, 0x100, 0x1, 0x4),
-   FLASH_ID("st m25p40" , 0xd8, 0x00132020, 0x100, 0x1, 0x8),
-   FLASH_ID("st m25p80" , 0xd8, 0x00142020, 0x100, 0x1, 0x10),
-   FLASH_ID("st m45pe10", 0xd8, 0x00114020, 0x100, 0x1, 0x2),
-   FLASH_ID("st m45pe20", 0xd8, 0x00124020, 0x100, 0x1, 0x4),
-   FLASH_ID("st m45pe40", 0xd8, 0x00134020, 0x100, 0x1, 0x8),
-   FLASH_ID("st m45pe80", 0xd8, 0x00144020, 0x100, 0x1, 0x10),
-   FLASH_ID("sp s25fl004"   , 0xd8, 0x00120201, 0x100, 0x1, 0x8),
-   FLASH_ID("sp s25fl008"   , 0xd8, 0x00130201, 0x100, 0x1, 0x10),
-   FLASH_ID("sp s25fl016"   , 0xd8, 0x00140201, 0x100, 0x1, 0x20),
-   FLASH_ID("sp s25fl032"   , 0xd8, 0x00150201, 0x100, 0x1, 0x40),
-   FLASH_ID("sp s25fl064"   , 0xd8, 0x00160201, 0x100, 0x1, 0x80),
-   FLASH_ID("mac 25l512", 0xd8, 0x001020C2, 0x010, 0x1, 0x1),
-   FLASH_ID("mac 25l1005"   , 0xd8, 0x001120C2, 0x010, 0x1, 0x2),
-   FLASH_ID("mac 25l2005"   , 0xd8, 0x001220C2, 0x010, 0x1, 0x4),
-   FLASH_ID("mac 25l4005"   , 0xd8, 0x001320C2, 0x010, 0x1, 0x8),
-   FLASH_ID("mac 25l4005a"  , 0xd8, 0x001320C2, 0x010, 0x1, 0x8),
-   FLASH_ID("mac 25l8005"   , 0xd8, 0x001420C2, 0x010, 0x1, 0x10),
-   FLASH_ID("mac 25l1605"   , 0xd8, 0x001520C2, 0x100, 0x1, 0x20),
-   FLASH_ID("mac 25l1605a"  , 0xd8

Re: [PATCH] configs: Migrate CONFIG_ST_SMI to Kconfig

2021-09-22 Thread Patrick DELAUNAY

Hi,

On 9/21/21 8:39 PM, Tom Rini wrote:

On Tue, Sep 21, 2021 at 06:36:03PM +0200, Patrick Delaunay wrote:


Use moveconfig.py script to convert the define CONFIG_ST_SMI to Kconfig
and move this entries to defconfigs.

Before migration, the st_smi.c driver was empty when CONFIG_MTD_NOR_FLASH
wasn't activated; it is now managed in Kconfig by the "depends on" and
this driver is not compiled.

After this patch, the driver st_smic.c is no more used in U-Boot;
it was only used in SPEAr products before commit 570c3dcfc153 ("arm:
Remove spear600 boards and the rest of SPEAr support").

Signed-off-by: Patrick Delaunay 
---
In the first migration process (without depends on) the config
CONFIG_ST_SMI was added in bcm7445_defconfig and bcm7260_defconfig.

But after adding the "depends on MTD_NOR_FLASH" and a Rsync all defconfig
files using moveconfig.py the CONFIG_ST_SMI is also deactivated in these
2 last users:
- bcm7260_defconfig
- bcm7445_defconfig

The U-Boot size don't change for these 2 defconfig (tested with buildman).

Thanks for doing a migration.  But, since you've found this is dead
code now, it would make more sense to just delete the driver.



Sure, I expected this answer when I see that the driver wasn't no more used.

Regards

Patrick



Re: [PATCH] drivers: pmic: Add sysreset driver to da9063 pmic device

2021-09-22 Thread Alexandre Ghiti
On Tue, Sep 21, 2021 at 9:23 AM Heinrich Schuchardt
 wrote:
>
>
>
> On 9/20/21 5:48 PM, Alexandre Ghiti wrote:
> > This pmic device is present on the SiFive Unmatched board and this
> > new driver adds the possibility to reset it.
> >
> > Signed-off-by: Alexandre Ghiti 
> > ---
> >   configs/sifive_unmatched_defconfig |  2 ++
> >   drivers/power/pmic/da9063.c| 49 ++
> >   2 files changed, 51 insertions(+)
> >
> > diff --git a/configs/sifive_unmatched_defconfig 
> > b/configs/sifive_unmatched_defconfig
> > index 978818b688..9ab058be39 100644
> > --- a/configs/sifive_unmatched_defconfig
> > +++ b/configs/sifive_unmatched_defconfig
> > @@ -43,3 +43,5 @@ CONFIG_DM_USB=y
> >   CONFIG_USB_XHCI_HCD=y
> >   CONFIG_USB_XHCI_PCI=y
> >   CONFIG_BOARD_EARLY_INIT_F=y
> > +CONFIG_DM_PMIC=y
> > +CONFIG_DM_PMIC_DA9063=y
> > diff --git a/drivers/power/pmic/da9063.c b/drivers/power/pmic/da9063.c
> > index 25101d18f7..b04879d9c5 100644
> > --- a/drivers/power/pmic/da9063.c
> > +++ b/drivers/power/pmic/da9063.c
> > @@ -10,6 +10,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   #include 
> >   #include 
> >   #include 
> > @@ -87,6 +88,7 @@ static int da9063_bind(struct udevice *dev)
> >   {
> >   ofnode regulators_node;
> >   int children;
> > + int ret;
> >
> >   regulators_node = dev_read_subnode(dev, "regulators");
> >   if (!ofnode_valid(regulators_node)) {
> > @@ -101,6 +103,14 @@ static int da9063_bind(struct udevice *dev)
> >   if (!children)
> >   debug("%s: %s - no child found\n", __func__, dev->name);
> >
> > + if (CONFIG_IS_ENABLED(SYSRESET)) {
>
> Thank you for addressing the missing reset driver for the SiFive
> Unmatched board.
>
> I imagine some existing or future boards using the DA9063 will have a
> GPIO for system reset. Should all boards having a DA9063 PMIC implement
> system reset via the power management IC?
>
> We could instead use the devicetree to identify if a board shall use the
> DA9063 for system reset.

Indeed, with this patch, any board with this chip may use this reset
handler, I'm not sure in which order the sysreset drivers are called
though.
We could add a new device like the rtc/watchdog ones, I'll give it a
try, that sounds way cleaner.

>
> > + ret = device_bind_driver(dev, "da9063-sysreset",
> > +  "da9063-sysreset", NULL);
> > + if (ret)
> > + debug("%s: %s - failed to bind sysreset driver\n",
> > +   __func__, dev->name);
> > + }
> > +
> >   /* Always return success for this device */
> >   return 0;
> >   }
> > @@ -129,3 +139,42 @@ U_BOOT_DRIVER(pmic_da9063) = {
> >   .probe = da9063_probe,
> >   .ops = &da9063_ops,
> >   };
> > +
> > +#ifdef CONFIG_SYSRESET
>
> The linker will remove functions that are not used automatically. We
> have tended to not enclose functions in #ifdef but instead allow the
> compiler to check the code.
>

Ok thanks!


> > +#include 
>
> Please, keep includes at the top of the code.
>
> > +
>
> Even though this is a static function I would add a Sphinx style comment
> here. Cf.
> https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#function-documentation
>
> Best regards
>
> Heinrich
>
> > +static int da9063_sysreset_request(struct udevice *dev, enum sysreset_t 
> > type)
> > +{
> > + struct udevice *pmic_dev = dev->parent;
> > + uint ret;
> > +
> > + if (type != SYSRESET_WARM && type != SYSRESET_COLD)
> > + return -EPROTONOSUPPORT;
> > +
> > + ret = pmic_reg_write(pmic_dev, DA9063_REG_PAGE_CON, 0x00);
> > + if (ret < 0)
> > + return ret;
> > +
> > + /* Sets the WAKE_UP bit */
> > + ret = pmic_reg_write(pmic_dev, DA9063_REG_CONTROL_F, 0x04);
> > + if (ret < 0)
> > + return ret;
> > +
> > + /* Powerdown! */
> > + ret = pmic_reg_write(pmic_dev, DA9063_REG_CONTROL_A, 0x68);
> > + if (ret < 0)
> > + return ret;
> > +
> > + return -EINPROGRESS;
> > +}
> > +
> > +static struct sysreset_ops da9063_sysreset_ops = {
> > + .request = da9063_sysreset_request,
> > +};
> > +
> > +U_BOOT_DRIVER(da9063_sysreset) = {
> > + .name = "da9063-sysreset",
> > + .id = UCLASS_SYSRESET,
> > + .ops = &da9063_sysreset_ops,
> > +};
> > +#endif
> >

Alex