Re: [PATCH 16/25] microblaze: Migrate DCACHE/ICACHE to Kconfig

2022-03-30 Thread Michal Simek




On 3/31/22 00:07, Tom Rini wrote:

Move these two options to the arch Kconfig file.

Cc: Michal Simek 
Signed-off-by: Tom Rini 
---
  arch/microblaze/Kconfig  | 8 
  include/configs/microblaze-generic.h | 3 ---
  2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index a25a95a0131c..d7d1b219704e 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -25,6 +25,14 @@ config TARGET_MICROBLAZE_GENERIC
  
  endchoice
  
+config DCACHE

+   bool "Enable dcache support"
+   default y
+
+config ICACHE
+   bool "Enable icache support"
+   default y
+
  source "board/xilinx/Kconfig"
  source "board/xilinx/microblaze-generic/Kconfig"
  
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h

index 744e20e58e71..663837f33dc4 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -30,9 +30,6 @@
  # define CONFIG_SYS_MAX_FLASH_SECT2048
  #endif
  
-#define CONFIG_ICACHE

-#define CONFIG_DCACHE
-
  #ifndef XILINX_DCACHE_BYTE_SIZE
  #define XILINX_DCACHE_BYTE_SIZE   32768
  #endif


Acked-by: Michal Simek 

Thanks,
Michal


Re: TFTP hangs with fragmented IP packets

2022-03-30 Thread Ramon Fried
On Tue, Mar 29, 2022 at 11:28 PM Laurent Pinchart
 wrote:
>
> Hello,
>
> I've banged my head a few days ago trying to debug an issue with a TFTP
> transfer hanging in the middle.
>
> I'm testing U-Boot 2022-rc5 on a Toradex Verdin i.MX8MP module (using
> the verdin-imx8mp defconfig). My local network MTU is 1500 bytes, and
> the board uses the EQoS ethernet controller.
>
> The problem started occurring after rebuilding a kernel image. U-Boot
> started transferring the image, and stopped in the middle, eventually
> timing out. Capture network traffic showed that U-Boot was continuously
> asking for retransmit of the same block, and eventually timed out.
>
> U-Boot is configured with a default TFTP block size of 4096 bytes, which
> results in the TFTP blocks being sent in one UDP packet split in three
> IP packets. U-Boot is configured with IP fragmentation supprot enabled.
> This works fine for all TFTP blocks until a paticular one in the middle
> of the kernel image.
>
> I've narrowed it down to a file of 1472 that can't be transferred at
> all (I have attached the binary to this e-mail). Changing the value of
> any of the last two bytes of the file allows transferring it correctly,
> so I suspect a CRC issue, likely related to IP fragmentation. Lowering
> the TFTP block size to avoid fragmentation works around the problem.
>
> Arguably a TFTP block size of 4096 bytes should probably not be used
> with a 1500 bytes MTU network, but I thought it would be useful to fix
> the issue nonetheless.
>
> I can test patches.
>
> --
> Regards,
>
> Laurent Pinchart
Interesting.
I will try to reproduce.
Thanks for reporting.


[PATCH v2] mtd: rawnand: mxs_nand: Fix use_minimum_ecc for spl driver

2022-03-30 Thread Ye Li
Because mxs_nand_spl driver does not support DM, to use the minimum ECC
layout, it needs to handle the CONFIG_NAND_MXS_USE_MINIMUM_ECC.

Signed-off-by: Ye Li 
Reviewed-by: Han Xu 
---
Changes in v2:
 - Use IS_ENABLED to replace #ifdef
 
 drivers/mtd/nand/raw/mxs_nand.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
index ee5d7fd..0c4e559 100644
--- a/drivers/mtd/nand/raw/mxs_nand.c
+++ b/drivers/mtd/nand/raw/mxs_nand.c
@@ -1380,6 +1380,9 @@ int mxs_nand_init_spl(struct nand_chip *nand)
else
nand_info->max_ecc_strength_supported = 40;
 
+   if (IS_ENABLED(CONFIG_NAND_MXS_USE_MINIMUM_ECC))
+   nand_info->use_minimum_ecc = true;
+
err = mxs_nand_alloc_buffers(nand_info);
if (err)
return err;
-- 
2.7.4



Re: [PATCH 00/52] mips: octeon: Add ethernet support

2022-03-30 Thread Stefan Roese

Hi Daniel,

On 3/31/22 01:56, Daniel Schwierzeck wrote:

Am Mittwoch, dem 30.03.2022 um 12:06 +0200 schrieb Stefan Roese:

This patchset adds the networking files and drivers including device
helper headers and C files. Please excuse the massive amount of files
in this patch series. Also the sometimes huge files (mostly headers
with register definitions) that I needed to include.

The infrastructure code with all the headers is ported mistly without
any intended functional changes from the 2013 Cavium / Marvell U-Boot
version. It has undergone many hours of extensive code cleanup and
reformatting. Some of it done by using tools (checkpatch, Lindent,
clang
format etc) and also some of it done manually, as I couldn't find
some
tools that could do the needed work in a reliable and functional way.
The result is that checkpatch now only throws a "few" warnings that
are
left. Some of those can't be removed without an even more extensive
cleanup / rewrite of the code, like the addition of typedefs.

The added header, helper and infrastructure files in the first part
of
the patch-series (patches 1-43) are the foundation, that is used by
the
main Octeon U-Boot ethernet driver (patch 50/52). Patches 47-49 add
the
DT nodes and properties to the corresponding dtsi / dts files.
Patches
51 & 52 finally enable the ethernet support both MIPS Octeon boards,
EBB7304 & NIC23.

All this is tested on the 2 Cavium / Marvell MIPS Octeon boards:
EBB7304 & NIC23

This patchset including the small Marvell PHY patches is available in
this gitlab branch:

https://source.denx.de/u-boot/custodians/u-boot-marvell/-/tree/mips-octeon-ethernet-v1-2022-03-30

Thanks,
Stefan

Aaron Williams (40):
   mips: octeon: Add misc cvmx-* header files
   mips: octeon: Add cvmx-ilk-defs.h header file
   mips: octeon: Add cvmx-iob-defs.h header file
   mips: octeon: Add cvmx-lbk-defs.h header file
   mips: octeon: Add cvmx-npei-defs.h header file
   mips: octeon: Add cvmx-pcsxx-defs.h header file
   mips: octeon: Add cvmx-xcv-defs.h header file
   mips: octeon: Add cvmx-helper-agl.c
   mips: octeon: Add cvmx-helper-bgx.c
   mips: octeon: Add cvmx-helper-board.c
   mips: octeon: Add cvmx-helper-fpa.c
   mips: octeon: Add cvmx-helper-igl.c
   mips: octeon: Add cvmx-helper-ipd.c
   mips: octeon: Add cvmx-helper-loop.c
   mips: octeon: Add cvmx-helper-npi.c
   mips: octeon: Add cvmx-helper-pki.c
   mips: octeon: Add cvmx-helper-pko.c
   mips: octeon: Add cvmx-helper-pko3.c
   mips: octeon: Add cvmx-helper-rgmii.c
   mips: octeon: Add cvmx-helper-sgmii.c
   mips: octeon: Add cvmx-helper-sfp.c
   mips: octeon: Add cvmx-helper-xaui.c
   mips: octeon: Add cvmx-agl.c
   mips: octeon: Add cvmx-cmd-queue.c
   mips: octeon: Add cvmx-fau-compat.c
   mips: octeon: Add cvmx-fpa.c
   mips: octeon: Add cvmx-fpa-resource.c
   mips: octeon: Add cvmx-global-resource.c
   mips: octeon: Add cvmx-ilk.c
   mips: octeon: Add cvmx-ipd.c
   mips: octeon: Add cvmx-pki.c
   mips: octeon: Add cvmx-pki-resources.c
   mips: octeon: Add cvmx-pko.c
   mips: octeon: Add cvmx-pko3.c
   mips: octeon: Add cvmx-pko3-queue.c
   mips: octeon: Add cvmx-pko3-compat.c
   mips: octeon: Add cvmx-pko3-resources.c
   mips: octeon: Add cvmx-pko-internal-ports-range.c
   mips: octeon: Add cvmx-qlm-tables.c
   mips: octeon: Add cvmx-range.c


are those 10 millions helper functions really used by the ethernet
driver? Do you really need features like SFP modules in U-Boot?


It's very hard to add the network support for those SoCs with their
quite complex devices and interfaces without using this proven code.
I agree, that this is not really appealing. And at least the NIC23
only supports network via SFP modules, so there is not alterative
interface here.


Maybe it helps to have a look at u-boot.map to see which functions are
unused and are discarded by the linker. Those functions could be
actually removed to reduce the LoC count ;)


Good idea, thanks. I was looking for something like this, but never got
the idea to actually look at the u-boot.map file to detect the unused
functions, so that I can remove them. I'll work on this to get the LoC
down a bit. ;)

Thanks,
Stefan



Stefan Roese (12):
   mips: octeon: Misc changes to existing headers for upcoming eth
 support
   mips: octeon: Misc changes to existing C files for upcoming eth
 support
   mips: octeon: Makefile: Enable building of the newly added C files
   mips: octeon: cpu.c: Move bootmem init to arch_early_init_r()
   mips: octeon: cpu.c: Implement configure_lmtdma_window()
   mips: octeon: octeon_common.h: Move init SP because of increased
image
 size
   mips: octeon: mrvl,cn73xx.dtsi: Add ethernet (BGX) and SMI DT nodes
   mips: octeon: mrvl,octeon-ebb7304.dts: Add ethernet DT support
   mips: octeon: mrvl,octeon-nic23.dts: Add ethernet DT support
   net: Add ethernet support for MIPS Octeon
   mips: octeon: ebb7304: Enable ethernet support
   mips: octeon: nic23: Enable ethernet support

  arch/mips/Kconfig

Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset

2022-03-30 Thread Ye Li
On Thu, 2022-03-31 at 00:27 +0200, Marek Vasut wrote:
> Caution: EXT Email
> 
> On 3/29/22 11:56, Ye Li wrote:
> 
> Hi,
> 
> > 
> > > 
> > > > 
> > > > But once you want to upgrade the
> > > > flash.bin, flexspi configurations will also be erased due to
> > > > the
> > > > block
> > > > size. Then you have to reprogram the configurations with
> > > > flash.bin.
> > > > So most of our customers add the flexspi configurations to
> > > > flash.bin
> > > > head. They don't use so called one image for both SD and
> > > > flexspi.
> > > There are no upstream users of flexspi right now, see above.
> > > 
> > > > 
> > > > 
> > > > As the spl_romapi_get_uboot_base is defined to weak. It is
> > > > better
> > > > to
> > > > overwrite this function for your particular usage.
> > > I would much rather prefer to have one flash.bin which works on
> > > both
> > > SD
> > > card and FlexSPI, on all iMX8M, that is far less confusing. And
> > > since
> > > there are no upstream users of flexspi boot so far, this is how
> > > it
> > > can
> > > still be implemented, consistently.
> > I can think out 3 drawbacks using this one flash.bin for flexspi:
> > 
> > 1. The flexspi configuration header will be erased when you update
> > the
> > flash.bin to flexspi device. In a common usage, this header will
> > combine with flash.bin to a final boot image which is not same with
> > SD.
> This is not correct.
> 
> If you need to update only the flash.bin in SPI NOR without rewriting
> the FCFB header, use 'sf update' with 0x1000 start address:
> dhcp ${loadaddr} 192.168.1.1:flash.bin && \
>    sf update ${loadaddr} 0x1000 ${filesize}
> 
> If you need to update both the flash.bin and generate the FCFB, use
> the
> aforementioned script with sf update using 0x0 start address, i.e.:
> dhcp ${loadaddr} 192.168.1.1:flash.bin ; \
> \
> setexpr sfaddr ${loadaddr} - 0x1000 ; \
> \
> base ${sfaddr} ; \
> mw 0 0 0x400 ; \
> mw 0x400 0x42464346 ; \
> mw 0x404 0x5601 ; \
> mw 0x40c 00030300 ; \
> mw 0x444 0x00020101 ; \
> mw 0x450 0x1000 ; \
> mw 0x480 0x0818040b ; \
> mw 0x484 0x24043008 ; \
> mw 0x5c0 0x100 ; \
> mw 0x5c4 0x1 ; \
> base 0 ; \
> \
> setexpr filesize ${filesize} + 0x1000 ; \
> \
> sf probe && sf update ${sfaddr} 0 ${filesize}
> 
> > 
> > 2. How can users update u-boot.itb only if using this one
> > flash.bin?
> Write u-boot.itb to offset 0x59000 in SPI NOR:
> => sf update ${loadaddr} 0x59000 ${filesize}
> 
> That 0x59000 is ( imx8mp-u-boot.dtsi /imx-boot/blob-ext@2/offset =
> <0x58000>) + (the SPI NOR flash.bin offset = 0x1000) = 0x59000
> 
> > 
> > With the same offset of SD, it causes the u-boot.itb locates at a
> > offset not block aligned.
> 0x59000 is both 4 kiB and 512 Byte aligned .

4KB is not a erase block size supported by all NOR flash. You should
use 64KB which is default to all.

Same for #1 drawback, 0x1000 offset can't satify the erase block size.
so every time your update flash.bin will need to update flash
configuration header as well, why not combine them together.


> 
> > 
> > 3. Not all iMX8M can support this one flash.bin.  8MM and 8MQ have
> > different IVT. Their flexspi IVT can't work for SD/eMMC.
> What's the difference ? Looking at the MX8MM RM rev.3, FlexSPI boot
> looks very much the same.
> 
No. The IVT structures are same but the base used by the fields in IVT
is changed. So you can't use one image for flexspi and SD, it will fail
to boot.

Another thing is the from imx8mm-u-boot.dtsi. the offset is 0x57c00. it
even does not align with 4KB. 

         binman_uboot: uboot {
             filename = "u-boot.itb";
             offset = <0x57c00>;
             type = "blob-ext";
         };


Best regards,
Ye Li


> (we have no MX8MQ/MX8MM boards which boot from FlexSPI either).
> 
> ...
> 
> I still believe it is better (=less confusing for users) to have one
> unified flash.bin for all boot media.

Re: [PATCH 08/25] corvus: Migrate CONFIG_*_LED out of CONFIG namespace

2022-03-30 Thread Heiko Schocher
Hello Tom,

On 31.03.22 00:07, Tom Rini wrote:
> This code is only used on the corvus platform, so migrate the LED on/off
> code to this platform and remove it from the CONFIG namespace.  In
> theory, this should likely be moved to the modern GPIO LED driver as a
> further cleanup.
> 
> Cc: Heiko Schocher 
> Signed-off-by: Tom Rini 
> ---
>  board/siemens/corvus/board.c | 24 ++--
>  include/configs/corvus.h |  4 
>  2 files changed, 22 insertions(+), 6 deletions(-)

Reviewed-by: Heiko Schocher 

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


[PATCH 2/3] imx: power-domain: Inline arch-imx8m/power-domain.h

2022-03-30 Thread Marek Vasut
The arch/arm/include/asm/arch-imx8m/power-domain.h is not included
anywhere except in drivers/power/domain/imx8m-power-domain.c, just
inline the content and drop the header. No functional change.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
 arch/arm/include/asm/arch-imx8m/power-domain.h | 15 ---
 drivers/power/domain/imx8m-power-domain.c  |  7 ++-
 2 files changed, 6 insertions(+), 16 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-imx8m/power-domain.h

diff --git a/arch/arm/include/asm/arch-imx8m/power-domain.h 
b/arch/arm/include/asm/arch-imx8m/power-domain.h
deleted file mode 100644
index 7a833e564b5..000
--- a/arch/arm/include/asm/arch-imx8m/power-domain.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2017 NXP
- */
-
-#ifndef _ASM_ARCH_IMX8M_POWER_DOMAIN_H
-#define _ASM_ARCH_IMX8M_POWER_DOMAIN_H
-
-struct imx8m_power_domain_plat {
-   int resource_id;
-   int has_pd;
-   struct power_domain pd;
-};
-
-#endif
diff --git a/drivers/power/domain/imx8m-power-domain.c 
b/drivers/power/domain/imx8m-power-domain.c
index ac7411f8327..c32dbcc31ae 100644
--- a/drivers/power/domain/imx8m-power-domain.c
+++ b/drivers/power/domain/imx8m-power-domain.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -18,6 +17,12 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct imx8m_power_domain_plat {
+   int resource_id;
+   int has_pd;
+   struct power_domain pd;
+};
+
 static int imx8m_power_domain_on(struct power_domain *power_domain)
 {
struct udevice *dev = power_domain->dev;
-- 
2.35.1



[PATCH 3/3] imx: power-domain: Get rid of SMCCC dependency

2022-03-30 Thread Marek Vasut
This driver is the only SMCCC dependency in iMX8M U-Boot port. Rework
the driver based on Linux GPCv2 driver to directly control the GPCv2
block instead of using SMCCC calls. This way, U-Boot can operate the
i.MX8M power domains without depending on anything else.

This is losely based on Linux GPCv2 driver. The GPU, VPU, MIPI power
domains are not supported to save space, since they are not useful in
the bootloader. The only domains kept are ones for HSIO, PCIe, USB.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
NOTE: So far this is tested on MX8MM and MX8MN. MX8MQ is not tested.
---
 drivers/power/domain/Kconfig  |   1 +
 drivers/power/domain/imx8m-power-domain.c | 379 --
 2 files changed, 361 insertions(+), 19 deletions(-)

diff --git a/drivers/power/domain/Kconfig b/drivers/power/domain/Kconfig
index 93d2599d83c..04fc0054323 100644
--- a/drivers/power/domain/Kconfig
+++ b/drivers/power/domain/Kconfig
@@ -35,6 +35,7 @@ config IMX8_POWER_DOMAIN
 config IMX8M_POWER_DOMAIN
bool "Enable i.MX8M power domain driver"
depends on POWER_DOMAIN && ARCH_IMX8M
+   select CLK
help
  Enable support for manipulating NXP i.MX8M on-SoC power domains via
  requests to the ATF.
diff --git a/drivers/power/domain/imx8m-power-domain.c 
b/drivers/power/domain/imx8m-power-domain.c
index c32dbcc31ae..e2e41cf5fee 100644
--- a/drivers/power/domain/imx8m-power-domain.c
+++ b/drivers/power/domain/imx8m-power-domain.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -12,52 +13,361 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define GPC_PGC_CPU_MAPPING0x0ec
+
+#define IMX8M_PCIE2_A53_DOMAIN BIT(15)
+#define IMX8M_OTG2_A53_DOMAIN  BIT(5)
+#define IMX8M_OTG1_A53_DOMAIN  BIT(4)
+#define IMX8M_PCIE1_A53_DOMAIN BIT(3)
+
+#define IMX8MM_OTG2_A53_DOMAIN BIT(5)
+#define IMX8MM_OTG1_A53_DOMAIN BIT(4)
+#define IMX8MM_PCIE_A53_DOMAIN BIT(3)
+
+#define IMX8MN_OTG1_A53_DOMAIN BIT(4)
+#define IMX8MN_MIPI_A53_DOMAIN BIT(2)
+
+#define GPC_PU_PGC_SW_PUP_REQ  0x0f8
+#define GPC_PU_PGC_SW_PDN_REQ  0x104
+
+#define IMX8M_PCIE2_SW_Pxx_REQ BIT(13)
+#define IMX8M_OTG2_SW_Pxx_REQ  BIT(3)
+#define IMX8M_OTG1_SW_Pxx_REQ  BIT(2)
+#define IMX8M_PCIE1_SW_Pxx_REQ BIT(1)
+
+#define IMX8MM_OTG2_SW_Pxx_REQ BIT(3)
+#define IMX8MM_OTG1_SW_Pxx_REQ BIT(2)
+#define IMX8MM_PCIE_SW_Pxx_REQ BIT(1)
+
+#define IMX8MN_OTG1_SW_Pxx_REQ BIT(2)
+#define IMX8MN_MIPI_SW_Pxx_REQ BIT(0)
+
+#define GPC_M4_PU_PDN_FLG  0x1bc
+
+#define GPC_PU_PWRHSK  0x1fc
+
+#define IMX8MM_HSIO_HSK_PWRDNACKN  (BIT(23) | BIT(24))
+#define IMX8MM_HSIO_HSK_PWRDNREQN  (BIT(5) | BIT(6))
+
+#define IMX8MN_HSIO_HSK_PWRDNACKN  BIT(23)
+#define IMX8MN_HSIO_HSK_PWRDNREQN  BIT(5)
+
+/*
+ * The PGC offset values in Reference Manual
+ * (Rev. 1, 01/2018 and the older ones) GPC chapter's
+ * GPC_PGC memory map are incorrect, below offset
+ * values are from design RTL.
+ */
+#define IMX8M_PGC_PCIE117
+#define IMX8M_PGC_OTG1 18
+#define IMX8M_PGC_OTG2 19
+#define IMX8M_PGC_PCIE229
+
+#define IMX8MM_PGC_PCIE17
+#define IMX8MM_PGC_OTG118
+#define IMX8MM_PGC_OTG219
+
+#define IMX8MN_PGC_OTG118
+
+#define GPC_PGC_CTRL(n)(0x800 + (n) * 0x40)
+#define GPC_PGC_SR(n)  (GPC_PGC_CTRL(n) + 0xc)
+
+#define GPC_PGC_CTRL_PCR   BIT(0)
+
+struct imx_pgc_regs {
+   u16 map;
+   u16 pup;
+   u16 pdn;
+   u16 hsk;
+};
+
+struct imx_pgc_domain {
+   unsigned long pgc;
+
+   const struct {
+   u32 pxx;
+   u32 map;
+   u32 hskreq;
+   u32 hskack;
+   } bits;
+
+   const bool keep_clocks;
+};
+
+struct imx_pgc_domain_data {
+   const struct imx_pgc_domain *domains;
+   size_t domains_num;
+   const struct imx_pgc_regs *pgc_regs;
+};
+
 struct imx8m_power_domain_plat {
+   struct power_domain pd;
+   const struct imx_pgc_domain *domain;
+   const struct imx_pgc_regs *regs;
+   struct clk_bulk clk;
+   void __iomem *base;
int resource_id;
int has_pd;
-   struct power_domain pd;
 };
 
+#if defined(CONFIG_IMX8MM) || defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MQ)
+static const struct imx_pgc_regs imx7_pgc_regs 

[PATCH 1/3] imx: power-domain: Descend into pgc subnode if present

2022-03-30 Thread Marek Vasut
In case the power domain node structure is gpc@303a/pgc/power-domain@N,
do not bind power domain driver to the 'pgc' node, but rather descend into
it and only bind power domain drivers to power-domain@N subnodes. This way
we do not waste one useless driver instance associated with 'pgc' node.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
 drivers/power/domain/imx8m-power-domain.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/power/domain/imx8m-power-domain.c 
b/drivers/power/domain/imx8m-power-domain.c
index 6082ee6ff8c..ac7411f8327 100644
--- a/drivers/power/domain/imx8m-power-domain.c
+++ b/drivers/power/domain/imx8m-power-domain.c
@@ -73,6 +73,12 @@ static int imx8m_power_domain_bind(struct udevice *dev)
/* Bind the subnode to this driver */
name = fdt_get_name(gd->fdt_blob, offset, NULL);
 
+   /* Descend into 'pgc' subnode */
+   if (!strstr(name, "power-domain")) {
+   offset = fdt_first_subnode(gd->fdt_blob, offset);
+   name = fdt_get_name(gd->fdt_blob, offset, NULL);
+   }
+
ret = device_bind_with_driver_data(dev, dev->driver, name,
   dev->driver_data,
   offset_to_ofnode(offset),
-- 
2.35.1



[PATCH] ARM: imx: Get rid of only i.MX8M SMCCC arch call

2022-03-30 Thread Marek Vasut
This is the only place where i.MX8M code does SMCCC call, remove it.
The output has little value as it prints some part of commit ID, and
worse, if there is no SMC handler installed, the code outright hangs
or crashes the system.

By removing this one instance of SMCCC call, U-Boot no longer depends
on SMC handlers and can boot without hanging in any case. If there is
a need to dump this commit ID, use CMD_SMC instead and do 'smc' call
from U-Boot shell or scripts instead of hard-coding SMCCC dependency
into architecture code. This particular code can be replaced by:
 => smc 0xc203 0 0 0 0 0 0

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
NOTE: This could also be hidden behind ARM_PSCI_FW , but I would rather
  just remove this hard dependency, it makes U-Boot porting easier.
---
 arch/arm/mach-imx/imx8m/soc.c | 20 
 1 file changed, 20 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 1a5a391443d..45c5476bbc7 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -1191,27 +1190,8 @@ void reset_cpu(void)
 #endif
 
 #if defined(CONFIG_ARCH_MISC_INIT)
-static void acquire_buildinfo(void)
-{
-   u64 atf_commit = 0;
-   struct arm_smccc_res res;
-
-   /* Get ARM Trusted Firmware commit id */
-   arm_smccc_smc(IMX_SIP_BUILDINFO, IMX_SIP_BUILDINFO_GET_COMMITHASH,
- 0, 0, 0, 0, 0, 0, );
-   atf_commit = res.a0;
-   if (atf_commit == 0x) {
-   debug("ATF does not support build info\n");
-   atf_commit = 0x30; /* Display 0, 0 ascii is 0x30 */
-   }
-
-   printf("\n BuildInfo:\n  - ATF %s\n\n", (char *)_commit);
-}
-
 int arch_misc_init(void)
 {
-   acquire_buildinfo();
-
return 0;
 }
 #endif
-- 
2.35.1



[PATCH] power-domain: Return 0 if ops unimplemented and remove empty functions

2022-03-30 Thread Marek Vasut
In case the ops is not implemented, return 0 in the core right away.
This is better than having multiple copies of functions which just
return 0 in each power domain driver. Drop all those empty functions.

Signed-off-by: Marek Vasut 
Cc: Patrick Delaunay 
Cc: Simon Glass 
---
 drivers/power/domain/apple-pmgr.c | 30 ---
 drivers/power/domain/bcm6328-power-domain.c   |  6 
 .../power/domain/imx8-power-domain-legacy.c   | 16 --
 drivers/power/domain/imx8-power-domain.c  | 24 ---
 drivers/power/domain/imx8m-power-domain.c | 18 ---
 drivers/power/domain/meson-ee-pwrc.c  | 12 
 drivers/power/domain/meson-gx-pwrc-vpu.c  | 12 
 drivers/power/domain/mtk-power-domain.c   |  6 
 drivers/power/domain/power-domain-uclass.c|  8 ++---
 drivers/power/domain/tegra186-power-domain.c  | 26 
 drivers/power/domain/ti-power-domain.c| 13 
 drivers/power/domain/ti-sci-power-domain.c| 14 -
 12 files changed, 4 insertions(+), 181 deletions(-)

diff --git a/drivers/power/domain/apple-pmgr.c 
b/drivers/power/domain/apple-pmgr.c
index 4d06e76ff5e..402c5b1fd18 100644
--- a/drivers/power/domain/apple-pmgr.c
+++ b/drivers/power/domain/apple-pmgr.c
@@ -42,16 +42,6 @@ static int apple_reset_of_xlate(struct reset_ctl *reset_ctl,
return 0;
 }
 
-static int apple_reset_request(struct reset_ctl *reset_ctl)
-{
-   return 0;
-}
-
-static int apple_reset_free(struct reset_ctl *reset_ctl)
-{
-   return 0;
-}
-
 static int apple_reset_assert(struct reset_ctl *reset_ctl)
 {
struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
@@ -80,8 +70,6 @@ static int apple_reset_deassert(struct reset_ctl *reset_ctl)
 
 struct reset_ops apple_reset_ops = {
.of_xlate = apple_reset_of_xlate,
-   .request = apple_reset_request,
-   .rfree = apple_reset_free,
.rst_assert = apple_reset_assert,
.rst_deassert = apple_reset_deassert,
 };
@@ -92,16 +80,6 @@ static struct driver apple_reset_driver = {
.ops = _reset_ops,
 };
 
-static int apple_pmgr_request(struct power_domain *power_domain)
-{
-   return 0;
-}
-
-static int apple_pmgr_rfree(struct power_domain *power_domain)
-{
-   return 0;
-}
-
 static int apple_pmgr_ps_set(struct power_domain *power_domain, u32 pstate)
 {
struct apple_pmgr_priv *priv = dev_get_priv(power_domain->dev);
@@ -121,11 +99,6 @@ static int apple_pmgr_on(struct power_domain *power_domain)
return apple_pmgr_ps_set(power_domain, APPLE_PMGR_PS_ACTIVE);
 }
 
-static int apple_pmgr_off(struct power_domain *power_domain)
-{
-   return 0;
-}
-
 static int apple_pmgr_of_xlate(struct power_domain *power_domain,
   struct ofnode_phandle_args *args)
 {
@@ -167,10 +140,7 @@ static int apple_pmgr_probe(struct udevice *dev)
 }
 
 struct power_domain_ops apple_pmgr_ops = {
-   .request = apple_pmgr_request,
-   .rfree = apple_pmgr_rfree,
.on = apple_pmgr_on,
-   .off = apple_pmgr_off,
.of_xlate = apple_pmgr_of_xlate,
 };
 
diff --git a/drivers/power/domain/bcm6328-power-domain.c 
b/drivers/power/domain/bcm6328-power-domain.c
index 6e720e0798c..80144dd9772 100644
--- a/drivers/power/domain/bcm6328-power-domain.c
+++ b/drivers/power/domain/bcm6328-power-domain.c
@@ -24,11 +24,6 @@ static int bcm6328_power_domain_request(struct power_domain 
*power_domain)
return 0;
 }
 
-static int bcm6328_power_domain_free(struct power_domain *power_domain)
-{
-   return 0;
-}
-
 static int bcm6328_power_domain_on(struct power_domain *power_domain)
 {
struct bcm6328_power_domain *priv = dev_get_priv(power_domain->dev);
@@ -64,7 +59,6 @@ static const struct udevice_id bcm6328_power_domain_ids[] = {
 };
 
 struct power_domain_ops bcm6328_power_domain_ops = {
-   .rfree = bcm6328_power_domain_free,
.off = bcm6328_power_domain_off,
.on = bcm6328_power_domain_on,
.request = bcm6328_power_domain_request,
diff --git a/drivers/power/domain/imx8-power-domain-legacy.c 
b/drivers/power/domain/imx8-power-domain-legacy.c
index e2fae2dbc86..bf45891bccd 100644
--- a/drivers/power/domain/imx8-power-domain-legacy.c
+++ b/drivers/power/domain/imx8-power-domain-legacy.c
@@ -84,20 +84,6 @@ int imx8_power_domain_lookup_name(const char *name,
return 0;
 }
 
-static int imx8_power_domain_request(struct power_domain *power_domain)
-{
-   debug("%s(power_domain=%p)\n", __func__, power_domain);
-
-   return 0;
-}
-
-static int imx8_power_domain_free(struct power_domain *power_domain)
-{
-   debug("%s(power_domain=%p)\n", __func__, power_domain);
-
-   return 0;
-}
-
 static int imx8_power_domain_on(struct power_domain *power_domain)
 {
struct udevice *dev = power_domain->dev;
@@ -364,8 +350,6 @@ static const struct udevice_id imx8_power_domain_ids[] = {
 };
 
 struct power_domain_ops imx8_power_domain_ops = {
-   

Re: [PATCH v3 9/9] doc: uefi: Update the capsule update related documentation

2022-03-30 Thread Masami Hiramatsu
Hi Sughosh,

2022年3月30日(水) 23:52 Sughosh Ganu :
>
> Update the capsule update functionality related documentation to
> refect the fact that a unique image GUID is to be used per image
> that forms part of the capsule file.

Thank you for updating! Now the relationship of dfu_alt_info and GUIDs is clear.

Reviewed-by: Masami Hiramatsu 

Thanks,
>
> Signed-off-by: Sughosh Ganu 
> ---
>
> Changes since V2:
> * Add a description for adding image index value and definition of
>   set_dfu_alt_info function for the capsule updates.
>
>  doc/develop/uefi/uefi.rst | 22 --
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> index fe337c88bd..403885d0f2 100644
> --- a/doc/develop/uefi/uefi.rst
> +++ b/doc/develop/uefi/uefi.rst
> @@ -312,8 +312,8 @@ Run the following command
>  .. code-block:: console
>
>  $ mkeficapsule \
> -  --index 1 --instance 0 \
> -  [--fit  | --raw ] \
> +  --index  --instance 0 \
> +  --guid  \
>
>
>  Performing the update
> @@ -333,6 +333,24 @@ won't be taken over across the reboot. If this is the 
> case, you can skip
>  this feature check with the Kconfig option (CONFIG_EFI_IGNORE_OSINDICATIONS)
>  set.
>
> +A few things need to be defined in the board file for performing the
> +capsule upadte. The first is defining the function set_dfu_alt_info in
> +the board file. This function sets the environment variable
> +dfu_alt_info. Instead of taking the variable from the environment, the
> +capsule update feature requires that the variable be set through the
> +board function, since that is more robust. Secondly, define GUID
> +values and image index of the images that are to be updated through
> +the capsule update feature in the board file. Both the values are to
> +be defined as part of the fw_images array. These GUID values would be
> +used by the Firmware Management Protocol(FMP) to populate the image
> +descriptor array and also displayed as part of the ESRT table. The
> +image index values defined in the array should match the dfu alt
> +number that corresponds to the firmware image. The dfu alt number can
> +be obtained by running the following command::
> +
> +dfu list
> +
> +
>  Finally, the capsule update can be initiated by rebooting the board.
>
>  Enabling Capsule Authentication
> --
> 2.25.1
>


-- 
Masami Hiramatsu


Re: [PATCH v3 1/9] capsule: Add Image GUIDs and image index for platforms using capsule updates

2022-03-30 Thread Masami Hiramatsu
Hi Sughosh,

The DeveloperBox part looks good to me.
Reviewed-by: Masami Hiramatsu 

Thank you,

2022年3月30日(水) 23:51 Sughosh Ganu :
>
> Currently, all platforms that enable capsule updates do so using
> either EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID or
> EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID. This is based on the Firmware
> Management Protocol(FMP) instance used on the platform. However, this
> means that all platforms that enable a particular FMP instance have
> the same GUID value for all the updatable images, either the FIT image
> GUID or the raw image GUID, and that an image for some platform can be
> updated on any other platform which uses the same FMP instance. Another
> issue with this implementation is that the ESRT table shows the same
> GUID value for all images on the platform and also across platforms,
> which is not in compliance with the UEFI specification.
>
> Fix this by defining image GUID values and firmware names for
> individual images per platform. The GetImageInfo FMP hook would then
> populate these values in the image descriptor array.
>
> Also add the image index value associated with a particular
> image. This is the value that should match with the image_index value
> that is part of the capsule header. The capsule update code will check
> if the two values match, and the update will only proceed on a match.
>
> Signed-off-by: Sughosh Ganu 
> ---
>
> Changes since V2:
> * Add a new member image_index to the struct efi_fw_images to allow
>   the platforms to define the values for images.
> * Address review comments from Michal Simek for the xilinx boards.
> * Fix double inclusion of efi_loader.h as was pointed out by Heiko
>   Thiery.
>
>
>  .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c   | 20 +
>  .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 19 +
>  board/emulation/qemu-arm/qemu-arm.c   | 20 +
>  board/kontron/pitx_imx8m/pitx_imx8m.c | 16 ++-
>  board/kontron/sl-mx8mm/sl-mx8mm.c | 15 ++
>  board/kontron/sl28/sl28.c | 15 ++
>  board/sandbox/sandbox.c   | 28 +++
>  board/socionext/developerbox/developerbox.c   | 26 +
>  board/xilinx/common/board.c   | 24 
>  include/configs/imx8mm-cl-iot-gate.h  | 10 +++
>  include/configs/imx8mp_rsb3720.h  | 10 +++
>  include/configs/kontron-sl-mx8mm.h|  6 
>  include/configs/kontron_pitx_imx8m.h  |  6 
>  include/configs/kontron_sl28.h|  6 
>  include/configs/qemu-arm.h| 10 +++
>  include/configs/sandbox.h | 14 ++
>  include/configs/synquacer.h   | 14 ++
>  include/configs/xilinx_versal.h   |  6 
>  include/configs/xilinx_zynqmp.h   | 10 +++
>  include/configs/zynq-common.h | 10 +++
>  include/efi_loader.h  | 18 
>  21 files changed, 302 insertions(+), 1 deletion(-)
>
> diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c 
> b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> index 16566092bd..1c953ba195 100644
> --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> @@ -6,6 +6,8 @@
>
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -21,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -44,6 +47,23 @@ static void setup_gpmi_nand(void)
>  }
>  #endif
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +   {
> +#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
> +   .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
> +#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
> +   .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,
> +#endif
> +   .fw_name = u"IMX8MP-RSB3720-FIT",
> +   .image_index = 1
> +   },
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
> +
>  int board_early_init_f(void)
>  {
> struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
> diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c 
> b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> index 7e2d88f449..f5b89a5ddc 100644
> --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> @@ -5,6 +5,8 @@
>   */
>
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -21,11 +23,28 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "ddr/ddr.h"
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +  

Re: [PATCH v3 2/9] capsule: FMP: Populate the image descriptor array from platform data

2022-03-30 Thread Masami Hiramatsu
Hi Sughosh,

This looks good to me.
Reviewed-by: Masami Hiramatsu 

Thank you,

2022年3月30日(水) 23:51 Sughosh Ganu :
>
> Currently, the image descriptor array that has been passed to the
> GetImageInfo function of the Firmware Management Protocol(FMP) gets
> populated through the data stored with the dfu framework. The
> dfu data is not restricted to contain information only of the images
> updatable through the capsule update mechanism, but it also contains
> information on other images.
>
> The image descriptor array is also parsed by the ESRT generation code,
> and thus the ESRT table contains entries for other images that are not
> being handled by the FMP for the capsule updates.
>
> The other issue fixed is assignment of a separate GUID for all images
> in the image descriptor array. The UEFI specification mandates that
> all entries in the ESRT table should have a unique GUID value as part
> of the FwClass member of the EFI_SYSTEM_RESOURCE_ENTRY. Currently, all
> images are assigned a single GUID value, either an FIT GUID or a raw
> image GUID. This is fixed by obtaining the GUID values from the
> efi_fw_images array defined per platform.
>
> Signed-off-by: Sughosh Ganu 
> ---
>
> Changes since V2:
> * Use the image index values defined in the platform's fw_images array
>   for the image descriptors
>
>  include/efi_loader.h  |  3 ++
>  lib/efi_loader/efi_firmware.c | 91 +++
>  2 files changed, 30 insertions(+), 64 deletions(-)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 284d64547b..9704397bd7 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -997,6 +997,9 @@ struct efi_fw_images {
> u8 image_index;
>  };
>
> +extern struct efi_fw_images fw_images[];
> +extern u8 num_image_type_guids;
> +
>  /**
>   * Install the ESRT system table.
>   *
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index a5ff32f121..169f3a29bb 100644
> --- a/lib/efi_loader/efi_firmware.c
> +++ b/lib/efi_loader/efi_firmware.c
> @@ -97,91 +97,60 @@ efi_status_t EFIAPI 
> efi_firmware_set_package_info_unsupported(
>  }
>
>  /**
> - * efi_get_dfu_info - return information about the current firmware image
> + * efi_fill_image_desc_array - populate image descriptor array
>   * @this:  Protocol instance
>   * @image_info_size:   Size of @image_info
>   * @image_info:Image information
>   * @descriptor_version:Pointer to version number
> - * @descriptor_count:  Pointer to number of descriptors
> + * @descriptor_count:  Image count
>   * @descriptor_size:   Pointer to descriptor size
> - * package_version:Package version
> - * package_version_name:   Package version's name
> - * image_type: Image type GUID
> + * @package_version:   Package version
> + * @package_version_name:  Package version's name
>   *
>   * Return information bout the current firmware image in @image_info.
>   * @image_info will consist of a number of descriptors.
> - * Each descriptor will be created based on "dfu_alt_info" variable.
> + * Each descriptor will be created based on "efi_fw_images" variable.
>   *
>   * Return  status code
>   */
> -static efi_status_t efi_get_dfu_info(
> +static efi_status_t efi_fill_image_desc_array(
> efi_uintn_t *image_info_size,
> struct efi_firmware_image_descriptor *image_info,
> u32 *descriptor_version,
> u8 *descriptor_count,
> efi_uintn_t *descriptor_size,
> u32 *package_version,
> -   u16 **package_version_name,
> -   const efi_guid_t *image_type)
> +   u16 **package_version_name)
>  {
> -   struct dfu_entity *dfu;
> size_t names_len, total_size;
> -   int dfu_num, i;
> -   u16 *name, *next;
> -   int ret;
> -
> -   ret = dfu_init_env_entities(NULL, NULL);
> -   if (ret)
> -   return EFI_SUCCESS;
> +   struct efi_fw_images *fw_array;
> +   u8 image_count;
> +   int i;
>
> +   fw_array = _images[0];
> +   *descriptor_count = image_count = num_image_type_guids;
> names_len = 0;
> -   dfu_num = 0;
> -   list_for_each_entry(dfu, _list, list) {
> -   names_len += (utf8_utf16_strlen(dfu->name) + 1) * 2;
> -   dfu_num++;
> -   }
> -   if (!dfu_num) {
> -   log_warning("No entities in dfu_alt_info\n");
> -   *image_info_size = 0;
> -   dfu_free_entities();
>
> -   return EFI_SUCCESS;
> -   }
> +   total_size = sizeof(*image_info) * image_count;
>
> -   total_size = sizeof(*image_info) * dfu_num + names_len;
> -   /*
> -* we will assume that sizeof(*image_info) * dfu_name
> -* is, at least, a multiple of 2. So the start address for
> -* image_id_name would be aligned with 2 bytes.
> -*/
> if 

Re: [PATCH v3 3/9] capsule: Put a check for image index before the update

2022-03-30 Thread Masami Hiramatsu
Hi Sughosh,

This looks good to me.
Reviewed-by: Masami Hiramatsu 

Thank you!

2022年3月30日(水) 23:51 Sughosh Ganu :
>
> The current capsule update code compares the image GUID value in the
> capsule header with the image GUID value obtained from the
> GetImageInfo function of the Firmware Management Protocol(FMP). This
> comparison is done to ascertain if the FMP's SetImage function can be
> called for the update. Make this checking more robust by comparing the
> image_index value passed through the capsule with that returned by the
> FMP's GetImageInfo function. This protects against the scenario of the
> firmware being updated in a wrong partition/location on the storage
> device if an incorrect value has been passed through the capsule,
> since the image_index is used to determine the location of the update
> on the storage device.
>
> Signed-off-by: Sughosh Ganu 
> ---
>
> Changes since V2: New patch
>
>  lib/efi_loader/efi_capsule.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index f00440163d..f03f4c9044 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -128,6 +128,7 @@ void set_capsule_result(int index, struct 
> efi_capsule_header *capsule,
>  /**
>   * efi_fmp_find - search for Firmware Management Protocol drivers
>   * @image_type:Image type guid
> + * @image_index:   Image Index
>   * @instance:  Instance number
>   * @handles:   Handles of FMP drivers
>   * @no_handles:Number of handles
> @@ -141,8 +142,8 @@ void set_capsule_result(int index, struct 
> efi_capsule_header *capsule,
>   * * NULL  - on failure
>   */
>  static struct efi_firmware_management_protocol *
> -efi_fmp_find(efi_guid_t *image_type, u64 instance, efi_handle_t *handles,
> -efi_uintn_t no_handles)
> +efi_fmp_find(efi_guid_t *image_type, u8 image_index, u64 instance,
> +efi_handle_t *handles, efi_uintn_t no_handles)
>  {
> efi_handle_t *handle;
> struct efi_firmware_management_protocol *fmp;
> @@ -203,6 +204,7 @@ efi_fmp_find(efi_guid_t *image_type, u64 instance, 
> efi_handle_t *handles,
> log_debug("+++ desc[%d] index: %d, name: %ls\n",
>   j, desc->image_index, desc->image_id_name);
> if (!guidcmp(>image_type_id, image_type) &&
> +   (desc->image_index == image_index) &&
> (!instance ||
>  !desc->hardware_instance ||
>   desc->hardware_instance == instance))
> @@ -449,8 +451,8 @@ static efi_status_t efi_capsule_update_firmware(
> }
>
> /* find a device for update firmware */
> -   /* TODO: should we pass index as well, or nothing but type? */
> fmp = efi_fmp_find(>update_image_type_id,
> +  image->update_image_index,
>image->update_hardware_instance,
>handles, no_handles);
> if (!fmp) {
> --
> 2.25.1
>


-- 
Masami Hiramatsu


Re: [PATCH v3 5/9] capsule: kconfig: Select SET_DFU_ALT_INFO config symbol for capsule update

2022-03-30 Thread Masami Hiramatsu
Hi,

Even with this patch, if the platform configuration doesn't select
EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the
platform will lose raw DFU availability.

Thank you,

2022年3月30日(水) 23:51 Sughosh Ganu :
>
> The capsule update code uses the dfu_alt_info variable for the actual
> update of the firmware component. The dfu_alt_info variable gives
> information needed to perform the update, like the device on which the
> update is to be made, the partition, type of partition etc. Since the
> dfu_alt_info is a environmental variable, it can be modified from the
> u-boot command line. An incorrect update of the variable will result
> in the update being done incorrectly.
>
> Prevent this scenario by forcing an update of the dfu_alt_info
> variable from the information obtained through the board file when
> UEFI capsule update functionality is enabled.
>
> Signed-off-by: Sughosh Ganu 
> ---
>
> Changes since V2: New Patch
>
>  lib/efi_loader/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index e5e35fe51f..09fb8cbe75 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
> depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> select UPDATE_FIT
> select DFU
> +   select SET_DFU_ALT_INFO
> select EFI_CAPSULE_FIRMWARE
> help
>   Select this option if you want to enable firmware management 
> protocol
> @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
> depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
> select DFU_WRITE_ALT
> select DFU
> +   select SET_DFU_ALT_INFO
> select EFI_CAPSULE_FIRMWARE
> help
>   Select this option if you want to enable firmware management 
> protocol
> --
> 2.25.1
>


-- 
Masami Hiramatsu


Re: [PATCH v3 4/9] board: Define set_dfu_alt_info() for boards with UEFI capsule update enabled

2022-03-30 Thread Masami Hiramatsu
Hi Sughosh,

If you remove the DEFAULT_DFU_ALT_INFO definition but introduce
set_dfu_alt_info(), this also must the CONFIG_SET_DFU_ALT_INFO for
each platform configuration too.
Unless that, some platform will not lose the dfu_alt_info until next
patch ([5/9]) is applied.

Thank you,

2022年3月30日(水) 23:51 Sughosh Ganu :
>
> Currently, there are a bunch of boards which enable the UEFI capsule
> update feature. The actual update of the firmware images is done
> through the dfu framework which uses the dfu_alt_info environment
> variable for getting information on the update, like device, partition
> number/address etc. Currently, these boards define the dfu_alt_info
> variable in the board config header, as an environment variable. With
> this, the variable can be modified from the u-boot command line and
> this can cause an incorrect update.
>
> To prevent this from happening, define the set_dfu_alt_info function
> in the board file, and use the function for populating the
> variable. With the function defined, the dfu framework populates the
> dfu_alt_info variable through the board file, instead of fetching the
> variable from the environment, thus making the update more robust.
>
> Signed-off-by: Sughosh Ganu 
> ---
>
> Changes since V2: New Patch
>
>
>  .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c   | 24 +
>  .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 24 +
>  board/emulation/common/qemu_dfu.c |  6 ++---
>  board/kontron/pitx_imx8m/pitx_imx8m.c | 24 +
>  board/kontron/sl-mx8mm/sl-mx8mm.c | 24 +
>  board/kontron/sl28/sl28.c | 25 ++
>  board/sandbox/sandbox.c   | 26 +++
>  board/socionext/developerbox/developerbox.c   | 26 +++
>  board/xilinx/zynq/board.c |  5 ++--
>  board/xilinx/zynqmp/zynqmp.c  |  5 ++--
>  include/configs/imx8mm-cl-iot-gate.h  |  1 -
>  include/configs/imx8mp_rsb3720.h  |  1 -
>  include/configs/kontron-sl-mx8mm.h|  1 -
>  include/configs/kontron_pitx_imx8m.h  |  1 -
>  include/configs/kontron_sl28.h|  2 --
>  include/configs/synquacer.h   |  6 -
>  16 files changed, 182 insertions(+), 19 deletions(-)
>
> diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c 
> b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> index 1c953ba195..41154ca9f3 100644
> --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> @@ -5,10 +5,12 @@
>   */
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -24,6 +26,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -231,3 +234,24 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc 
> *mmc)
> }
>  }
>  #endif /* CONFIG_SPL_MMC_SUPPORT */
> +
> +#if defined(CONFIG_SET_DFU_ALT_INFO)
> +
> +#define DFU_ALT_BUF_LENSZ_1K
> +
> +void set_dfu_alt_info(char *interface, char *devstr)
> +{
> +   ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
> +
> +   if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
> +   env_get("dfu_alt_info"))
> +   return;
> +
> +   memset(buf, 0, DFU_ALT_BUF_LEN);
> +
> +   snprintf(buf, DFU_ALT_BUF_LEN,
> +"mmc 2=flash-bin raw 0 0x1B00 mmcpart 1");
> +
> +   env_set("dfu_alt_info", buf);
> +}
> +#endif /* CONFIG_SET_DFU_ALT_INFO */
> diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c 
> b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> index f5b89a5ddc..1880dd9c55 100644
> --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> @@ -5,6 +5,7 @@
>   */
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -12,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -24,6 +26,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "ddr/ddr.h"
>
> @@ -446,3 +449,24 @@ int board_late_init(void)
>
> return 0;
>  }
> +
> +#if defined(CONFIG_SET_DFU_ALT_INFO)
> +
> +#define DFU_ALT_BUF_LENSZ_1K
> +
> +void set_dfu_alt_info(char *interface, char *devstr)
> +{
> +   ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
> +
> +   if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
> +   env_get("dfu_alt_info"))
> +   return;
> +
> +   memset(buf, 0, DFU_ALT_BUF_LEN);
> +
> +   snprintf(buf, DFU_ALT_BUF_LEN,
> +"mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1");
> +
> +   env_set("dfu_alt_info", buf);
> +}
> +#endif /* CONFIG_SET_DFU_ALT_INFO */
> diff --git a/board/emulation/common/qemu_dfu.c 
> 

[PATCH v2] ARM: dts: imx: Add support for Data Modul i.MX8M Mini eDM SBC

2022-03-30 Thread Marek Vasut
Add support for Data Modul i.MX8M Mini eDM SBC board. This is an
evaluation board for various custom display units. Currently
supported are serial console, ethernet, eMMC, SD, SPI NOR,
USB host and USB OTG.

Reviewed-by: Fabio Estevam 
Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
V2: - Disable UHS mode support in SPL, the overhead incured by bringing up UHS
  mode in SPL does not make sense for loading less than 1 MiB u-boot.itb.
- Select primary boot device based on boot device indicated by BootROM,
  either eMMC or SD boot device is supported. Always select the other
  boot device, SD or eMMC, as fallback boot device.
- Set 'devnum' environment variable based on boot device indicated by 
BootROM
  unless the 'devnum' variable is already set. This way it is possible to 
boot
  from the same boot media from which BootROM started U-Boot SPL and U-Boot 
SPL
  started U-Boot itself.
- Add RB from Fabio
---
 arch/arm/dts/Makefile |1 +
 .../dts/imx8mm-data-modul-edm-sbc-u-boot.dtsi |  116 ++
 arch/arm/dts/imx8mm-data-modul-edm-sbc.dts|  996 +
 arch/arm/mach-imx/imx8m/Kconfig   |8 +
 board/data_modul/imx8mm_edm_sbc/Kconfig   |   12 +
 board/data_modul/imx8mm_edm_sbc/MAINTAINERS   |8 +
 board/data_modul/imx8mm_edm_sbc/Makefile  |   13 +
 board/data_modul/imx8mm_edm_sbc/common.c  |   37 +
 .../imx8mm_data_modul_edm_sbc.c   |  110 +
 board/data_modul/imx8mm_edm_sbc/imximage.cfg  |8 +
 .../data_modul/imx8mm_edm_sbc/lpddr4_timing.h |   14 +
 .../imx8mm_edm_sbc/lpddr4_timing_2G_32.c  | 1845 +
 .../imx8mm_edm_sbc/lpddr4_timing_4G_32.c  | 1842 
 board/data_modul/imx8mm_edm_sbc/spl.c |  179 ++
 configs/imx8mm_data_modul_edm_sbc_defconfig   |  229 ++
 include/configs/imx8mm_data_modul_edm_sbc.h   |  133 ++
 16 files changed, 5551 insertions(+)
 create mode 100644 arch/arm/dts/imx8mm-data-modul-edm-sbc-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-data-modul-edm-sbc.dts
 create mode 100644 board/data_modul/imx8mm_edm_sbc/Kconfig
 create mode 100644 board/data_modul/imx8mm_edm_sbc/MAINTAINERS
 create mode 100644 board/data_modul/imx8mm_edm_sbc/Makefile
 create mode 100644 board/data_modul/imx8mm_edm_sbc/common.c
 create mode 100644 board/data_modul/imx8mm_edm_sbc/imx8mm_data_modul_edm_sbc.c
 create mode 100644 board/data_modul/imx8mm_edm_sbc/imximage.cfg
 create mode 100644 board/data_modul/imx8mm_edm_sbc/lpddr4_timing.h
 create mode 100644 board/data_modul/imx8mm_edm_sbc/lpddr4_timing_2G_32.c
 create mode 100644 board/data_modul/imx8mm_edm_sbc/lpddr4_timing_4G_32.c
 create mode 100644 board/data_modul/imx8mm_edm_sbc/spl.c
 create mode 100644 configs/imx8mm_data_modul_edm_sbc_defconfig
 create mode 100644 include/configs/imx8mm_data_modul_edm_sbc.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 644ba961a22..244386a9d14 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -899,6 +899,7 @@ dtb-$(CONFIG_ARCH_IMX8ULP) += \
imx8ulp-evk.dtb
 
 dtb-$(CONFIG_ARCH_IMX8M) += \
+   imx8mm-data-modul-edm-sbc.dtb \
imx8mm-evk.dtb \
imx8mm-icore-mx8mm-ctouch2.dtb \
imx8mm-icore-mx8mm-edimm2.2.dtb \
diff --git a/arch/arm/dts/imx8mm-data-modul-edm-sbc-u-boot.dtsi 
b/arch/arm/dts/imx8mm-data-modul-edm-sbc-u-boot.dtsi
new file mode 100644
index 000..184c30ab4a7
--- /dev/null
+++ b/arch/arm/dts/imx8mm-data-modul-edm-sbc-u-boot.dtsi
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2022 Marek Vasut 
+ */
+
+#include "imx8mm-u-boot.dtsi"
+
+/ {
+   aliases {
+   eeprom0 = 
+   mmc0 =  /* eMMC */
+   mmc1 =  /* MicroSD */
+   };
+
+   config {
+   dmo,ram-coding-gpios = < 8 0>, < 1 0>, < 0 0>;
+   };
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   u-boot,dm-spl;
+   };
+};
+
+_reg {
+   u-boot,dm-spl;
+};
+
+_reg {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+_hog_sbc {
+   u-boot,dm-spl;
+};
+
+_i2c1 {
+   u-boot,dm-spl;
+};
+
+_i2c1_gpio {
+   u-boot,dm-spl;
+};
+
+_pmic {
+   u-boot,dm-spl;
+};
+
+_uart3 {
+   u-boot,dm-spl;
+};
+
+_usdhc2 {
+   u-boot,dm-spl;
+};
+
+_usdhc3 {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+
+   regulators {
+   u-boot,dm-spl;
+   };
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+ {
+   u-boot,dm-spl;
+};
+
+ {
+   dr_mode = "peripheral";
+};
+
+ {
+   u-boot,dm-spl;
+   sd-uhs-sdr104;
+   sd-uhs-ddr50;
+};
+
+ {
+   u-boot,dm-spl;
+   mmc-hs400-1_8v;
+   mmc-hs400-enhanced-strobe;
+};
+
+ {
+   u-boot,dm-spl;
+};
diff --git 

Re: [PATCH v4 06/11] efi_loader: bootmgr: add booting from removable media

2022-03-30 Thread Masahisa Kojima
Hi Ilias,

On Thu, 31 Mar 2022 at 04:13, Ilias Apalodimas
 wrote:
>
> Hello Akashi-san,
>
> On Thu, Mar 24, 2022 at 10:54:38PM +0900, Masahisa Kojima wrote:
> > From: AKASHI Takahiro 
> >
> > Under the current implementation, booting from removable media using
> > a architecture-specific default image name, say BOOTAA64.EFI, is
> > supported only in distro_bootcmd script. See the commit 74522c898b35
> > ("efi_loader: Add distro boot script for removable media").
> >
> > This is, however, half-baked implementation because
> > 1) UEFI specification requires this feature to be implemented as part
> >of Boot Manager's responsibility:
> >
> >   3 - Boot Manager
> >   3.5.1 Boot via the Simple File Protocol
> >   When booting via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, the FilePath will
> >   start with a device path that points to the device that implements the
> >   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the EFI_BLOCK_IO_PROTOCOL. The next
> >   part of the FilePath may point to the file name, including
> >   subdirectories, which contain the bootable image. If the file name is
> >   a null device path, the file name must be generated from the rules
> >   defined below.
> >   ...
> >   3.5.1.1 Removable Media Boot Behavior
> >   To generate a file name when none is present in the FilePath, the
> >   firmware must append a default file name in the form
> >   \EFI\BOOT\BOOT{machine type short-name}.EFI ...
> >
> > 2) So (1) entails the hehavior that the user's preference of boot media
> >order should be determined by Boot and BootOrder variables.
> >
> > With this patch, the semantics mentioned above is fully implemented.
> > For example, if you want to boot the system from USB and SCSI in this
> > order,
> > * define Boot0001 which contains only a device path to the USB device
> >   (without any file path/name)
> > * define Boot0002 which contains only a device path to the SCSI device,
> > and
> > * set BootOrder to Boot0001:Boot0002
>
> Mark had some concerns wrt to this approach and from what I can tell this
> hasn't changed in this revision [1]. Can we use boot_targets and generate
> Boot with an empty FilePath as Mark suggested?  Or is the user expected to
> select that somehow from the menu?
>
> [1] https://lore.kernel.org/u-boot/d3cac2e5b37f9...@bloch.sibelius.xs4all.nl/

My patch series tries to resolve the above issue to some extent
by a different approach.

The patch "[PATCH v4 10/11] bootmenu: add removable media entries" [*1]
enumerates the all (removable) medias supporting
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.

Example bootmenu is as below.

*** U-Boot Boot Menu ***

   UEFI BOOT : mmc0:1
   UEFI BOOT0001 : mmc0:2
   UEFI BOOT0002 : debian
   UEFI BOOT0003 : nvme0:1
   UEFI BOOT0004 : ubuntu
   UEFI BOOT0005 : nvme0:2
   UEFI BOOT0006 : usb0:2

mmcX:X, usbX:X and nvmeX:X are the entries of the removable media
having device path without FilePath. They are automatically created
by the bootmenu and BOOT and BootOrder variables are updated.
They are also managed by the bootmenu, if the usb device is removed from
the system at the next boot, the BOOT variable is removed by bootmenu
and BootOrder is also updated.

[*1] 
https://lore.kernel.org/u-boot/20220324135443.1571-11-masahisa.koj...@linaro.org/

Thanks,
Masahisa Kojima

>
> Thanks
> /Ilias
> >
> > Signed-off-by: AKASHI Takahiro 
> > Signed-off-by: Masahisa Kojima 
> > ---
> > Changes from original version:
> > - create new include file "efi_default_filename.h" to
> >   avoid conflict with config_distro_bootcmd.h
> > - modify the target pointer of efi_free_pool(), expand_media_path() should
> >   only free the pointer allocated by efi_dp_from_file() function.
> >
> >  include/config_distro_bootcmd.h | 14 +
> >  include/efi_default_filename.h  | 26 +
> >  lib/efi_loader/efi_bootmgr.c| 50 -
> >  3 files changed, 76 insertions(+), 14 deletions(-)
> >  create mode 100644 include/efi_default_filename.h
> >
> > diff --git a/include/config_distro_bootcmd.h 
> > b/include/config_distro_bootcmd.h
> > index 2f90929178..ef2c9f330e 100644
> > --- a/include/config_distro_bootcmd.h
> > +++ b/include/config_distro_bootcmd.h
> > @@ -91,19 +91,7 @@
> >  #endif
> >
> >  #ifdef CONFIG_EFI_LOADER
> > -#if defined(CONFIG_ARM64)
> > -#define BOOTEFI_NAME "bootaa64.efi"
> > -#elif defined(CONFIG_ARM)
> > -#define BOOTEFI_NAME "bootarm.efi"
> > -#elif defined(CONFIG_X86_RUN_32BIT)
> > -#define BOOTEFI_NAME "bootia32.efi"
> > -#elif defined(CONFIG_X86_RUN_64BIT)
> > -#define BOOTEFI_NAME "bootx64.efi"
> > -#elif defined(CONFIG_ARCH_RV32I)
> > -#define BOOTEFI_NAME "bootriscv32.efi"
> > -#elif defined(CONFIG_ARCH_RV64I)
> > -#define BOOTEFI_NAME "bootriscv64.efi"
> > -#endif
> > +#include 
> >  #endif
> >
> >  #ifdef BOOTEFI_NAME
> > diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h
> > new file mode 100644
> > index 00..de030d2692
> 

Re: Please pull clk-2022.04-next

2022-03-30 Thread Tom Rini
On Wed, Mar 30, 2022 at 03:27:47PM -0400, Sean Anderson wrote:

> The following changes since commit d2e5250be49fce4653689c41a5dc7e2d7e7ecf33:
> 
>   Merge tag 'next-20220328' of 
> https://source.denx.de/u-boot/custodians/u-boot-video into next (2022-03-28 
> 17:04:45 -0400)
> 
> are available in the Git repository at:
> 
>   g...@source.denx.de:u-boot/custodians/u-boot-clk.git tags/clk-2022.04-next
> 
> for you to fetch changes up to 682e73d23555afdd733c20810d282d9cc2bc0e0f:
> 
>   clk: Use generic CCF ops where possible (2022-03-30 14:18:56 -0400)
> 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 00/52] mips: octeon: Add ethernet support

2022-03-30 Thread Daniel Schwierzeck
Am Mittwoch, dem 30.03.2022 um 12:06 +0200 schrieb Stefan Roese:
> This patchset adds the networking files and drivers including device
> helper headers and C files. Please excuse the massive amount of files
> in this patch series. Also the sometimes huge files (mostly headers
> with register definitions) that I needed to include.
> 
> The infrastructure code with all the headers is ported mistly without
> any intended functional changes from the 2013 Cavium / Marvell U-Boot
> version. It has undergone many hours of extensive code cleanup and
> reformatting. Some of it done by using tools (checkpatch, Lindent,
> clang
> format etc) and also some of it done manually, as I couldn't find
> some
> tools that could do the needed work in a reliable and functional way.
> The result is that checkpatch now only throws a "few" warnings that
> are
> left. Some of those can't be removed without an even more extensive
> cleanup / rewrite of the code, like the addition of typedefs.
> 
> The added header, helper and infrastructure files in the first part
> of
> the patch-series (patches 1-43) are the foundation, that is used by
> the
> main Octeon U-Boot ethernet driver (patch 50/52). Patches 47-49 add
> the
> DT nodes and properties to the corresponding dtsi / dts files.
> Patches
> 51 & 52 finally enable the ethernet support both MIPS Octeon boards,
> EBB7304 & NIC23.
> 
> All this is tested on the 2 Cavium / Marvell MIPS Octeon boards:
> EBB7304 & NIC23
> 
> This patchset including the small Marvell PHY patches is available in
> this gitlab branch:
> 
> https://source.denx.de/u-boot/custodians/u-boot-marvell/-/tree/mips-octeon-ethernet-v1-2022-03-30
> 
> Thanks,
> Stefan
> 
> Aaron Williams (40):
>   mips: octeon: Add misc cvmx-* header files
>   mips: octeon: Add cvmx-ilk-defs.h header file
>   mips: octeon: Add cvmx-iob-defs.h header file
>   mips: octeon: Add cvmx-lbk-defs.h header file
>   mips: octeon: Add cvmx-npei-defs.h header file
>   mips: octeon: Add cvmx-pcsxx-defs.h header file
>   mips: octeon: Add cvmx-xcv-defs.h header file
>   mips: octeon: Add cvmx-helper-agl.c
>   mips: octeon: Add cvmx-helper-bgx.c
>   mips: octeon: Add cvmx-helper-board.c
>   mips: octeon: Add cvmx-helper-fpa.c
>   mips: octeon: Add cvmx-helper-igl.c
>   mips: octeon: Add cvmx-helper-ipd.c
>   mips: octeon: Add cvmx-helper-loop.c
>   mips: octeon: Add cvmx-helper-npi.c
>   mips: octeon: Add cvmx-helper-pki.c
>   mips: octeon: Add cvmx-helper-pko.c
>   mips: octeon: Add cvmx-helper-pko3.c
>   mips: octeon: Add cvmx-helper-rgmii.c
>   mips: octeon: Add cvmx-helper-sgmii.c
>   mips: octeon: Add cvmx-helper-sfp.c
>   mips: octeon: Add cvmx-helper-xaui.c
>   mips: octeon: Add cvmx-agl.c
>   mips: octeon: Add cvmx-cmd-queue.c
>   mips: octeon: Add cvmx-fau-compat.c
>   mips: octeon: Add cvmx-fpa.c
>   mips: octeon: Add cvmx-fpa-resource.c
>   mips: octeon: Add cvmx-global-resource.c
>   mips: octeon: Add cvmx-ilk.c
>   mips: octeon: Add cvmx-ipd.c
>   mips: octeon: Add cvmx-pki.c
>   mips: octeon: Add cvmx-pki-resources.c
>   mips: octeon: Add cvmx-pko.c
>   mips: octeon: Add cvmx-pko3.c
>   mips: octeon: Add cvmx-pko3-queue.c
>   mips: octeon: Add cvmx-pko3-compat.c
>   mips: octeon: Add cvmx-pko3-resources.c
>   mips: octeon: Add cvmx-pko-internal-ports-range.c
>   mips: octeon: Add cvmx-qlm-tables.c
>   mips: octeon: Add cvmx-range.c

are those 10 millions helper functions really used by the ethernet
driver? Do you really need features like SFP modules in U-Boot? 

Maybe it helps to have a look at u-boot.map to see which functions are
unused and are discarded by the linker. Those functions could be
actually removed to reduce the LoC count ;)

> 
> Stefan Roese (12):
>   mips: octeon: Misc changes to existing headers for upcoming eth
> support
>   mips: octeon: Misc changes to existing C files for upcoming eth
> support
>   mips: octeon: Makefile: Enable building of the newly added C files
>   mips: octeon: cpu.c: Move bootmem init to arch_early_init_r()
>   mips: octeon: cpu.c: Implement configure_lmtdma_window()
>   mips: octeon: octeon_common.h: Move init SP because of increased
> image
> size
>   mips: octeon: mrvl,cn73xx.dtsi: Add ethernet (BGX) and SMI DT nodes
>   mips: octeon: mrvl,octeon-ebb7304.dts: Add ethernet DT support
>   mips: octeon: mrvl,octeon-nic23.dts: Add ethernet DT support
>   net: Add ethernet support for MIPS Octeon
>   mips: octeon: ebb7304: Enable ethernet support
>   mips: octeon: nic23: Enable ethernet support
> 
>  arch/mips/Kconfig |1 +
>  arch/mips/dts/mrvl,cn73xx.dtsi|   35 +
>  arch/mips/dts/mrvl,octeon-ebb7304.dts |   45 +
>  arch/mips/dts/mrvl,octeon-nic23.dts   |  238 ++
>  arch/mips/mach-octeon/Makefile|   35 +-
>  arch/mips/mach-octeon/cpu.c   |   47 +-
>  arch/mips/mach-octeon/cvmx-agl.c  |  216 +
>  arch/mips/mach-octeon/cvmx-bootmem.c  |3 +-
>  

Re: [RFC PATCH] mips: dts: add initial support for ls1c300 SoC

2022-03-30 Thread Daniel Schwierzeck
Am Mittwoch, dem 30.03.2022 um 03:30 +0800 schrieb Du Huanpeng:
> Loongson 1C is a cost-effective SOC chip for industrial control and
> the Internet of Things. The Loongson 1C includes a floating-point
> processing unit, supports multiple types of memory, and supports
> high-capacity MLC NAND Flash. Loongson 1C provides developers with a
> wealth of peripheral interfaces and on-chip modules, including Camera
> controller, USB OTG and USB HOST interfaces, AC97/I2S controller, LCD
> controller, SPI interface, UART interface, etc., providing sufficient
> computing power and multi-application connectivity.
> 
> Some highlights of this SoC are:
> - Single core LS232, MIPS32 instruction set compatible, main
> frequency
> 300MHZ
> - 16KB data cache and 16KB instruction cache
> - 64 bit float unit, hardware division
> - 8/16 bit SDRAM controller, 45 ~ 133MHz
> - 8/16 bit SRAM, NAND
> - I2S/AC97, LCD, MAC, USB, OTG, SPI, I2C, PWM, CAN, SDIO, ADC
> - 12 UARTs
> 
> See Techinical Reference Manual for details: https://www.loongson.cn/
> 
> introduce base support for the ls1c300 SoC.
> - debug UART2
> - serial console
> - clock
> - watchdog
> - sysreset
> - many uarts
> 
> Signed-off-by: Du Huanpeng 

Sean already addressed most points, so only just some additional
comments below.

> ---
>  arch/mips/Kconfig |  25 +++
>  arch/mips/Makefile|   1 +
>  arch/mips/dts/Makefile|   1 +
>  arch/mips/dts/loongson32-ls1c300b.dtsi| 138
> +
>  arch/mips/dts/ls1c300-eval.dts|  27 
>  arch/mips/mach-lsmips/Kconfig |  77 ++
>  arch/mips/mach-lsmips/Makefile|   6 +
>  arch/mips/mach-lsmips/cpu.c   |  24 +++
>  arch/mips/mach-lsmips/include/mach/serial.h   |  16 ++
>  arch/mips/mach-lsmips/ls1c300/Makefile|   6 +
>  arch/mips/mach-lsmips/ls1c300/gpio.c  |  60 
>  arch/mips/mach-lsmips/ls1c300/init.c  |  60 
>  arch/mips/mach-lsmips/ls1c300/lowlevel_init.S | 123 +++
>  arch/mips/mach-lsmips/ls1c300/ls1c300.h   |  52 +++
>  arch/mips/mach-lsmips/ls1c300/serial.c| 112 ++
>  arch/mips/mach-lsmips/spl.c   |  47 ++

you should use mach-loongson. If you copied the naming from mtmips,
then don't ;) mtmips only exists because mediatek was already used for
the ARM specific SoC's and we needed some different Kconfig symbols for
the MIPS SoC's.

>  board/loongson/ls1c300-eval/Kconfig   |  12 ++
>  board/loongson/ls1c300-eval/MAINTAINERS   |   7 +
>  board/loongson/ls1c300-eval/Makefile  |   3 +
>  board/loongson/ls1c300-eval/board.c   |  20 +++
>  configs/ls1c300_defconfig |  65 
>  drivers/clk/Makefile  |   1 +
>  drivers/clk/lsmips/Makefile   |   3 +
>  drivers/clk/lsmips/clk-ls1c300.c  | 145
> ++
>  drivers/watchdog/Kconfig  |   8 +
>  drivers/watchdog/Makefile |   1 +
>  drivers/watchdog/lsmips_wdt.c | 126 +++
>  include/configs/ls1c300.h |  61 
>  include/dt-bindings/clock/ls1c300-clk.h   |  48 ++
>  29 files changed, 1275 insertions(+)
>  create mode 100644 arch/mips/dts/loongson32-ls1c300b.dtsi
>  create mode 100644 arch/mips/dts/ls1c300-eval.dts
>  create mode 100644 arch/mips/mach-lsmips/Kconfig
>  create mode 100644 arch/mips/mach-lsmips/Makefile
>  create mode 100644 arch/mips/mach-lsmips/cpu.c
>  create mode 100644 arch/mips/mach-lsmips/include/mach/serial.h
>  create mode 100644 arch/mips/mach-lsmips/ls1c300/Makefile
>  create mode 100644 arch/mips/mach-lsmips/ls1c300/gpio.c
>  create mode 100644 arch/mips/mach-lsmips/ls1c300/init.c
>  create mode 100644 arch/mips/mach-lsmips/ls1c300/lowlevel_init.S
>  create mode 100644 arch/mips/mach-lsmips/ls1c300/ls1c300.h
>  create mode 100644 arch/mips/mach-lsmips/ls1c300/serial.c
>  create mode 100644 arch/mips/mach-lsmips/spl.c
>  create mode 100644 board/loongson/ls1c300-eval/Kconfig
>  create mode 100644 board/loongson/ls1c300-eval/MAINTAINERS
>  create mode 100644 board/loongson/ls1c300-eval/Makefile
>  create mode 100644 board/loongson/ls1c300-eval/board.c
>  create mode 100644 configs/ls1c300_defconfig
>  create mode 100644 drivers/clk/lsmips/Makefile
>  create mode 100644 drivers/clk/lsmips/clk-ls1c300.c
>  create mode 100644 drivers/watchdog/lsmips_wdt.c
>  create mode 100644 include/configs/ls1c300.h
>  create mode 100644 include/dt-bindings/clock/ls1c300-clk.h
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 28234aa0bb..d95868ef4b 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -93,6 +93,30 @@ config ARCH_MTMIPS
>   select SUPPORTS_LITTLE_ENDIAN
>   select SUPPORT_SPL
>  
> +config ARCH_LSMIPS
> + bool "Support Loongson MIPS platforms"
> + 

Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset

2022-03-30 Thread Fabio Estevam
Hi Marek,

On Wed, Mar 30, 2022 at 7:27 PM Marek Vasut  wrote:

> I still believe it is better (=less confusing for users) to have one
> unified flash.bin for all boot media.

I agree with your approach.

Thanks


Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset

2022-03-30 Thread Marek Vasut

On 3/29/22 11:56, Ye Li wrote:

Hi,


But once you want to upgrade the
flash.bin, flexspi configurations will also be erased due to the
block
size. Then you have to reprogram the configurations with flash.bin.
So most of our customers add the flexspi configurations to
flash.bin
head. They don't use so called one image for both SD and flexspi.

There are no upstream users of flexspi right now, see above.



As the spl_romapi_get_uboot_base is defined to weak. It is better
to
overwrite this function for your particular usage.

I would much rather prefer to have one flash.bin which works on both
SD
card and FlexSPI, on all iMX8M, that is far less confusing. And since
there are no upstream users of flexspi boot so far, this is how it
can
still be implemented, consistently.


I can think out 3 drawbacks using this one flash.bin for flexspi:

1. The flexspi configuration header will be erased when you update the
flash.bin to flexspi device. In a common usage, this header will
combine with flash.bin to a final boot image which is not same with SD.


This is not correct.

If you need to update only the flash.bin in SPI NOR without rewriting 
the FCFB header, use 'sf update' with 0x1000 start address:

dhcp ${loadaddr} 192.168.1.1:flash.bin && \
  sf update ${loadaddr} 0x1000 ${filesize}

If you need to update both the flash.bin and generate the FCFB, use the 
aforementioned script with sf update using 0x0 start address, i.e.:

dhcp ${loadaddr} 192.168.1.1:flash.bin ; \
\
setexpr sfaddr ${loadaddr} - 0x1000 ; \
\
base ${sfaddr} ; \
mw 0 0 0x400 ; \
mw 0x400 0x42464346 ; \
mw 0x404 0x5601 ; \
mw 0x40c 00030300 ; \
mw 0x444 0x00020101 ; \
mw 0x450 0x1000 ; \
mw 0x480 0x0818040b ; \
mw 0x484 0x24043008 ; \
mw 0x5c0 0x100 ; \
mw 0x5c4 0x1 ; \
base 0 ; \
\
setexpr filesize ${filesize} + 0x1000 ; \
\
sf probe && sf update ${sfaddr} 0 ${filesize}


2. How can users update u-boot.itb only if using this one flash.bin?


Write u-boot.itb to offset 0x59000 in SPI NOR:
=> sf update ${loadaddr} 0x59000 ${filesize}

That 0x59000 is ( imx8mp-u-boot.dtsi /imx-boot/blob-ext@2/offset = 
<0x58000>) + (the SPI NOR flash.bin offset = 0x1000) = 0x59000



With the same offset of SD, it causes the u-boot.itb locates at a
offset not block aligned.


0x59000 is both 4 kiB and 512 Byte aligned .


3. Not all iMX8M can support this one flash.bin.  8MM and 8MQ have
different IVT. Their flexspi IVT can't work for SD/eMMC.


What's the difference ? Looking at the MX8MM RM rev.3, FlexSPI boot 
looks very much the same.


(we have no MX8MQ/MX8MM boards which boot from FlexSPI either).

...

I still believe it is better (=less confusing for users) to have one 
unified flash.bin for all boot media.


[PATCH 20/25] galileo: Remove CONFIG_DESIGNWARE_ETH reference

2022-03-30 Thread Tom Rini
This platform has CONFIG_ETH_DESIGNWARE set already, which is the
correct value for the driver in question.  Remove this incorrect line.

Signed-off-by: Tom Rini 
---
 include/configs/galileo.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/galileo.h b/include/configs/galileo.h
index 57483a2af960..c50ecf27e44c 100644
--- a/include/configs/galileo.h
+++ b/include/configs/galileo.h
@@ -22,7 +22,6 @@
"stderr=serial\0"
 
 /* 10/100M Ethernet support */
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_DW_ALTDESCRIPTOR
 
 /* Environment configuration */
-- 
2.25.1



[PATCH 19/25] powerpc: mpc83xx: Migrate DEFAULT_IMMR to Kconfig

2022-03-30 Thread Tom Rini
As no platforms override this value, set it for all mpc83xx platforms.

Cc: Mario Six 
Cc: Wolfgang Denk 
Signed-off-by: Tom Rini 
---
 arch/powerpc/cpu/mpc83xx/Kconfig | 4 
 include/mpc83xx.h| 4 
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig
index 2ebf8fc221d6..d1b9ae4c3c92 100644
--- a/arch/powerpc/cpu/mpc83xx/Kconfig
+++ b/arch/powerpc/cpu/mpc83xx/Kconfig
@@ -1,6 +1,10 @@
 menu "mpc83xx CPU"
depends on MPC83xx
 
+config DEFAULT_IMMR
+   hex
+   default 0xFF40
+
 config E300
def_bool y
 
diff --git a/include/mpc83xx.h b/include/mpc83xx.h
index 0275b3184ea3..2181a90b59cf 100644
--- a/include/mpc83xx.h
+++ b/include/mpc83xx.h
@@ -21,10 +21,6 @@
 /*
  * IMMRBAR - Internal Memory Register Base Address
  */
-#ifndef CONFIG_DEFAULT_IMMR
-/* Default IMMR base address */
-#define CONFIG_DEFAULT_IMMR0xFF40
-#endif
 /* Register offset to immr */
 #define IMMRBAR0x
 #define IMMRBAR_BASE_ADDR  0xFFF0  /* Base addr. mask */
-- 
2.25.1



[PATCH 04/25] Convert CONFIG_CMDLINE_PS_SUPPORT to Kconfig

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CMDLINE_PS_SUPPORT

Signed-off-by: Tom Rini 
---
 README| 8 
 cmd/Kconfig   | 7 +++
 configs/socfpga_vining_fpga_defconfig | 1 +
 include/configs/socfpga_vining_fpga.h | 3 ---
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/README b/README
index 04e3fad0b8b6..6273a7f3673e 100644
--- a/README
+++ b/README
@@ -1532,14 +1532,6 @@ The following options need to be configured:
of the backslashes before semicolons and special
symbols.
 
-- Command Line Editing and History:
-   CONFIG_CMDLINE_PS_SUPPORT
-
-   Enable support for changing the command prompt string
-   at run-time. Only static string is supported so far.
-   The string is obtained from environment variables PS1
-   and PS2.
-
 - Default Environment:
CONFIG_EXTRA_ENV_SETTINGS
 
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 1d8401236fb3..0065d670dc45 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -31,6 +31,13 @@ config CMDLINE_EDITING
  Enable editing and History functions for interactive command line
  input operations
 
+config CMDLINE_PS_SUPPORT
+   bool "Enable support for changing the command prompt string at run-time"
+   depends on HUSH_PARSER
+   help
+ Only static string in the prompt is supported so far.  The string is
+ obtained from environment variables PS1 and PS2.
+
 config AUTO_COMPLETE
bool "Enable auto complete using TAB"
depends on CMDLINE
diff --git a/configs/socfpga_vining_fpga_defconfig 
b/configs/socfpga_vining_fpga_defconfig
index 52084b8f2a5d..331975ad3097 100644
--- a/configs/socfpga_vining_fpga_defconfig
+++ b/configs/socfpga_vining_fpga_defconfig
@@ -27,6 +27,7 @@ CONFIG_CLOCKS=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x4
+CONFIG_CMDLINE_PS_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
diff --git a/include/configs/socfpga_vining_fpga.h 
b/include/configs/socfpga_vining_fpga.h
index 2d4ce3ce44b5..500657d0a577 100644
--- a/include/configs/socfpga_vining_fpga.h
+++ b/include/configs/socfpga_vining_fpga.h
@@ -186,9 +186,6 @@
"fi\0"  \
"socfpga_legacy_reset_compat=1\0"
 
-/* Support changing the prompt string */
-#define CONFIG_CMDLINE_PS_SUPPORT
-
 /* The rest of the configuration is shared */
 #include 
 
-- 
2.25.1



[PATCH 22/25] Convert CONFIG_FSL_QIXIS et al to Kconfig

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_FSL_QIXIS
   CONFIG_QIXIS_I2C_ACCESS

Signed-off-by: Tom Rini 
---
 board/freescale/common/Kconfig   | 8 
 configs/T2080QDS_NAND_defconfig  | 2 ++
 configs/T2080QDS_SDCARD_defconfig| 2 ++
 configs/T2080QDS_SECURE_BOOT_defconfig   | 2 ++
 configs/T2080QDS_SPIFLASH_defconfig  | 2 ++
 configs/T2080QDS_SRIO_PCIE_BOOT_defconfig| 2 ++
 configs/T2080QDS_defconfig   | 2 ++
 configs/ls1012aqds_qspi_defconfig| 1 +
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1012aqds_tfa_defconfig | 1 +
 configs/ls1021aqds_ddr4_nor_defconfig| 2 ++
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 2 ++
 configs/ls1021aqds_nand_defconfig| 2 ++
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig | 2 ++
 configs/ls1021aqds_nor_defconfig | 2 ++
 configs/ls1021aqds_nor_lpuart_defconfig  | 2 ++
 configs/ls1021aqds_qspi_defconfig| 1 +
 configs/ls1021aqds_sdcard_ifc_defconfig  | 2 ++
 configs/ls1021aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1028aqds_tfa_defconfig | 1 +
 configs/ls1028aqds_tfa_lpuart_defconfig  | 1 +
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1028ardb_tfa_defconfig | 1 +
 configs/ls1043aqds_defconfig | 2 ++
 configs/ls1043aqds_lpuart_defconfig  | 2 ++
 configs/ls1043aqds_nand_defconfig| 2 ++
 configs/ls1043aqds_nor_ddr3_defconfig| 2 ++
 configs/ls1043aqds_qspi_defconfig| 1 +
 configs/ls1043aqds_sdcard_ifc_defconfig  | 2 ++
 configs/ls1043aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1043aqds_tfa_defconfig | 1 +
 configs/ls1046aqds_SECURE_BOOT_defconfig | 2 ++
 configs/ls1046aqds_defconfig | 2 ++
 configs/ls1046aqds_lpuart_defconfig  | 2 ++
 configs/ls1046aqds_nand_defconfig| 2 ++
 configs/ls1046aqds_qspi_defconfig| 1 +
 configs/ls1046aqds_sdcard_ifc_defconfig  | 2 ++
 configs/ls1046aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1046aqds_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 | 2 ++
 configs/ls2080aqds_defconfig | 2 ++
 configs/ls2080aqds_nand_defconfig| 1 +
 configs/ls2080aqds_qspi_defconfig| 1 +
 configs/ls2080aqds_sdcard_defconfig  | 1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig | 2 ++
 configs/ls2080ardb_defconfig | 2 ++
 configs/ls2080ardb_nand_defconfig| 2 ++
 configs/ls2081ardb_defconfig | 1 +
 configs/ls2088aqds_tfa_defconfig | 2 ++
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig | 2 ++
 configs/ls2088ardb_tfa_defconfig | 2 ++
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160aqds_tfa_defconfig | 1 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160ardb_tfa_defconfig | 1 +
 configs/lx2160ardb_tfa_stmm_defconfig| 1 +
 configs/lx2162aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2162aqds_tfa_defconfig | 1 +
 configs/lx2162aqds_tfa_verified_boot_defconfig   | 1 +
 include/configs/T208xQDS.h   | 1 -
 include/configs/ls1012aqds.h | 2 --
 include/configs/ls1021aqds.h | 5 -
 include/configs/ls1028aqds.h | 3 ---
 include/configs/ls1028ardb.h | 3 ---
 include/configs/ls1043aqds.h | 2 --
 include/configs/ls1046aqds.h 

[PATCH 25/25] arm: fsl-layerscape: Migrate more DP-DDR options to Kconfig

2022-03-30 Thread Tom Rini
Based on current usage, migrate a number of DP-DDR related options to
Kconfig.

Cc: Priyanka Jain 
Cc: Rajesh Bhagat 
Signed-off-by: Tom Rini 
---
 README|  3 ---
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 25 +++
 include/configs/ls2080a_common.h  | 10 -
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/README b/README
index 6273a7f3673e..d503357f3be2 100644
--- a/README
+++ b/README
@@ -487,9 +487,6 @@ The following options need to be configured:
CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS
Number of controllers used for other than main memory.
 
-   CONFIG_SYS_FSL_HAS_DP_DDR
-   Defines the SoC has DP-DDR used for DPAA.
-
CONFIG_SYS_FSL_SEC_BE
Defines the SEC controller register space as Big Endian
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index 9bb870dcd8c2..5ea99c459ce7 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -502,6 +502,31 @@ config SYS_FSL_HAS_CCN508
 
 config SYS_FSL_HAS_DP_DDR
bool
+   help
+ Defines the SoC has DP-DDR used for DPAA.
+
+config DP_DDR_CTRL
+   int
+   depends on SYS_FSL_HAS_DP_DDR
+   default 2 if ARCH_LS2080A
+
+config DP_DDR_NUM_CTRLS
+   int
+   depends on SYS_FSL_HAS_DP_DDR
+   default 1 if ARCH_LS2080A
+
+config SYS_DP_DDR_BASE
+   hex
+   depends on SYS_FSL_HAS_DP_DDR
+   default 0x60 if ARCH_LS2080A
+
+config SYS_DP_DDR_BASE_PHY
+   int
+   depends on SYS_FSL_HAS_DP_DDR
+   default 0 if ARCH_LS2080A
+   help
+ DDR controller uses this value as the base address for binding.
+ It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
 
 config SYS_FSL_SRDS_1
bool
diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h
index 9027bd06b02d..82585f5dbfaf 100644
--- a/include/configs/ls2080a_common.h
+++ b/include/configs/ls2080a_common.h
@@ -40,16 +40,6 @@
 #define CPU_RELEASE_ADDR   secondary_boot_addr
 
 #define CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS
-#ifdef CONFIG_SYS_FSL_HAS_DP_DDR
-#define CONFIG_SYS_DP_DDR_BASE 0x60ULL
-/*
- * DDR controller use 0 as the base address for binding.
- * It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
- */
-#define CONFIG_SYS_DP_DDR_BASE_PHY 0
-#define CONFIG_DP_DDR_CTRL 2
-#define CONFIG_DP_DDR_NUM_CTRLS1
-#endif
 
 /* Generic Timer Definitions */
 /*
-- 
2.25.1



[PATCH 24/25] siemens-am33x-common: Drop CONFIG_DMA_COHERENT*

2022-03-30 Thread Tom Rini
These values are not used in the code, remove them.

Signed-off-by: Tom Rini 
---
 include/configs/siemens-am33x-common.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/configs/siemens-am33x-common.h 
b/include/configs/siemens-am33x-common.h
index bfadf4a6b861..08c4d52d658f 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -15,9 +15,6 @@
 
 #include 
 
-#define CONFIG_DMA_COHERENT
-#define CONFIG_DMA_COHERENT_SIZE   (1 << 20)
-
 /* commands to include */
 
 #ifndef CONFIG_SPL_BUILD
-- 
2.25.1



[PATCH 23/25] m53menlo: Drop CONFIG_DISCOVER_PHY

2022-03-30 Thread Tom Rini
This is not used in code, drop.

Signed-off-by: Tom Rini 
---
 include/configs/m53menlo.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h
index dd803e7053cb..5bd6cbefc67d 100644
--- a/include/configs/m53menlo.h
+++ b/include/configs/m53menlo.h
@@ -71,7 +71,6 @@
 #ifdef CONFIG_CMD_NET
 #define IMX_FEC_BASE   FEC_BASE_ADDR
 #define CONFIG_FEC_MXC_PHYADDR 0x0
-#define CONFIG_DISCOVER_PHY
 #endif
 
 #define CONFIG_SYS_RTC_BUS_NUM 1 /* I2C2 */
-- 
2.25.1



[PATCH 21/25] Convert CONFIG_DIMM_SLOTS_PER_CTLR to Kconfig

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_DIMM_SLOTS_PER_CTLR

Signed-off-by: Tom Rini 
---
 configs/T2080QDS_NAND_defconfig| 1 +
 configs/T2080QDS_SDCARD_defconfig  | 1 +
 configs/T2080QDS_SECURE_BOOT_defconfig | 1 +
 configs/T2080QDS_SPIFLASH_defconfig| 1 +
 configs/T2080QDS_SRIO_PCIE_BOOT_defconfig  | 1 +
 configs/T2080QDS_defconfig | 1 +
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/ls1028aqds_tfa_defconfig   | 1 +
 configs/ls1028aqds_tfa_lpuart_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   | 1 +
 configs/ls2080ardb_defconfig   | 1 +
 configs/ls2080ardb_nand_defconfig  | 1 +
 configs/ls2081ardb_defconfig   | 1 +
 configs/ls2088aqds_tfa_defconfig   | 1 +
 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig  | 1 +
 configs/ls2088ardb_qspi_defconfig  | 1 +
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/ls2088ardb_tfa_defconfig   | 1 +
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/lx2160aqds_tfa_defconfig   | 1 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/lx2160ardb_tfa_defconfig   | 1 +
 configs/lx2160ardb_tfa_stmm_defconfig  | 1 +
 configs/lx2162aqds_tfa_SECURE_BOOT_defconfig   | 1 +
 configs/lx2162aqds_tfa_defconfig   | 1 +
 configs/lx2162aqds_tfa_verified_boot_defconfig | 1 +
 drivers/ddr/fsl/Kconfig| 4 
 include/configs/MPC8548CDS.h   | 2 --
 include/configs/P1010RDB.h | 2 --
 include/configs/P2041RDB.h | 2 --
 include/configs/T102xRDB.h | 1 -
 include/configs/T104xRDB.h | 2 --
 include/configs/T208xQDS.h | 1 -
 include/configs/T208xRDB.h | 1 -
 include/configs/T4240RDB.h | 2 --
 include/configs/corenet_ds.h   | 2 --
 include/configs/km/pg-wcom-ls102xa.h   | 2 --
 include/configs/kmcent2.h  | 2 --
 include/configs/kontron_sl28.h | 1 -
 include/configs/ls1012a2g5rdb.h| 1 -
 include/configs/ls1012afrdm.h  | 1 -
 include/configs/ls1012afrwy.h  | 1 -
 include/configs/ls1012aqds.h   | 1 -
 include/configs/ls1012ardb.h   | 1 -
 include/configs/ls1021aqds.h   | 1 -
 include/configs/ls1028aqds.h   | 3 ---
 include/configs/ls1028ardb.h   | 2 --
 include/configs/ls1043aqds.h   | 1 -
 include/configs/ls1043ardb.h   | 1 -
 include/configs/ls1046afrwy.h  | 2 --
 include/configs/ls1046aqds.h   | 1 -
 include/configs/ls1046ardb.h   | 1 -
 include/configs/ls1088aqds.h   | 2 --
 include/configs/ls1088ardb.h   | 1 -
 include/configs/ls2080aqds.h   | 1 -
 include/configs/ls2080ardb.h   | 1 -
 include/configs/lx2160a_common.h   | 1 -
 include/configs/p1_p2_rdb_pc.h | 2 --
 include/configs/socrates.h | 2 --
 include/configs/ten64.h| 2 --
 scripts/config_whitelist.txt   | 1 -
 66 files changed, 35 insertions(+), 50 deletions(-)

diff --git a/configs/T2080QDS_NAND_defconfig b/configs/T2080QDS_NAND_defconfig
index 66883c78b82c..a69ab1eaaad6 100644
--- a/configs/T2080QDS_NAND_defconfig
+++ b/configs/T2080QDS_NAND_defconfig
@@ -63,6 +63,7 @@ CONFIG_DM=y
 CONFIG_SYS_SATA_MAX_DEVICE=2
 CONFIG_FSL_CAAM=y
 CONFIG_DYNAMIC_DDR_CLK_FREQ=y
+CONFIG_DIMM_SLOTS_PER_CTLR=2
 CONFIG_DDR_ECC=y
 CONFIG_ECC_INIT_VIA_DDRCONTROLLER=y
 CONFIG_DM_I2C=y
diff --git a/configs/T2080QDS_SDCARD_defconfig 
b/configs/T2080QDS_SDCARD_defconfig
index 3a01904a486a..565476f7665e 100644
--- a/configs/T2080QDS_SDCARD_defconfig
+++ b/configs/T2080QDS_SDCARD_defconfig
@@ -61,6 +61,7 @@ CONFIG_DM=y
 CONFIG_SYS_SATA_MAX_DEVICE=2
 CONFIG_FSL_CAAM=y
 CONFIG_DYNAMIC_DDR_CLK_FREQ=y
+CONFIG_DIMM_SLOTS_PER_CTLR=2
 CONFIG_DDR_ECC=y
 CONFIG_ECC_INIT_VIA_DDRCONTROLLER=y
 CONFIG_DM_I2C=y
diff --git a/configs/T2080QDS_SECURE_BOOT_defconfig 
b/configs/T2080QDS_SECURE_BOOT_defconfig
index a7e62174de67..d5ed28336763 100644
--- a/configs/T2080QDS_SECURE_BOOT_defconfig
+++ b/configs/T2080QDS_SECURE_BOOT_defconfig
@@ -46,6 +46,7 @@ CONFIG_ETHPRIME="FM1@DTSEC3"
 CONFIG_DM=y
 CONFIG_SYS_SATA_MAX_DEVICE=2
 CONFIG_DYNAMIC_DDR_CLK_FREQ=y
+CONFIG_DIMM_SLOTS_PER_CTLR=2
 CONFIG_DDR_ECC=y
 CONFIG_ECC_INIT_VIA_DDRCONTROLLER=y
 

[PATCH 18/25] nds32: Migrate CONFIG_DEBUG_LED to Kconfig

2022-03-30 Thread Tom Rini
Move this value to the board Kconfig file.

Signed-off-by: Tom Rini 
---
 arch/nds32/include/asm/arch-ag101/ag101.h | 3 ---
 arch/nds32/include/asm/arch-ag102/ag102.h | 2 --
 board/AndesTech/adp-ag101p/Kconfig| 4 
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/nds32/include/asm/arch-ag101/ag101.h 
b/arch/nds32/include/asm/arch-ag101/ag101.h
index 23908f82a4e0..6900868a66ca 100644
--- a/arch/nds32/include/asm/arch-ag101/ag101.h
+++ b/arch/nds32/include/asm/arch-ag101/ag101.h
@@ -43,9 +43,6 @@
 /* External AHB slave2 (FUSBH200) */
 #define CONFIG_EXT_AHBSLAVE02_BASE 0x9200
 
-/* DEBUG LED */
-#define CONFIG_DEBUG_LED   0x902C
-
 /* APB Device definitions */
 
 /* Power Management Unit */
diff --git a/arch/nds32/include/asm/arch-ag102/ag102.h 
b/arch/nds32/include/asm/arch-ag102/ag102.h
index 3255db6592e6..53d38b357345 100644
--- a/arch/nds32/include/asm/arch-ag102/ag102.h
+++ b/arch/nds32/include/asm/arch-ag102/ag102.h
@@ -72,8 +72,6 @@
 /* PWM - Pulse Width Modulator Controller */
 #define CONFIG_FTPWM010_BASE   0x94F0
 
-/* Debug LED */
-#define CONFIG_DEBUG_LED   0x902C
 /* Power Management Unit */
 #define CONFIG_FTPMU010_BASE   0x9810
 
diff --git a/board/AndesTech/adp-ag101p/Kconfig 
b/board/AndesTech/adp-ag101p/Kconfig
index 5e8aa22c448a..0fb7a10409b6 100644
--- a/board/AndesTech/adp-ag101p/Kconfig
+++ b/board/AndesTech/adp-ag101p/Kconfig
@@ -1,5 +1,9 @@
 if TARGET_ADP_AG101P
 
+config DEBUG_LED
+   hex
+   default 0x902C
+
 config SYS_CPU
default "n1213"
 
-- 
2.25.1



[PATCH 17/25] ls1021atwr: Use DEBUG and not CONFIG_DEBUG

2022-03-30 Thread Tom Rini
We use 'DEBUG' and not 'CONFIG_DEBUG' tree-wide for debug code that is
left in, and not wrapped by some other regular debugging type print
macro.

Cc: Alison Wang 
Signed-off-by: Tom Rini 
---
 board/freescale/ls1021atwr/ls1021atwr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/freescale/ls1021atwr/ls1021atwr.c 
b/board/freescale/ls1021atwr/ls1021atwr.c
index f0b441db6381..4a2449567393 100644
--- a/board/freescale/ls1021atwr/ls1021atwr.c
+++ b/board/freescale/ls1021atwr/ls1021atwr.c
@@ -107,7 +107,7 @@ static void cpld_show(void)
   in_8(_data->pcba_ver) & VERSION_MASK,
   in_8(_data->vbank) & BANK_MASK);
 
-#ifdef CONFIG_DEBUG
+#ifdef DEBUG
printf("soft_mux_on =%x\n",
   in_8(_data->soft_mux_on));
printf("cfg_rcw_src1 =%x\n",
-- 
2.25.1



[PATCH 16/25] microblaze: Migrate DCACHE/ICACHE to Kconfig

2022-03-30 Thread Tom Rini
Move these two options to the arch Kconfig file.

Cc: Michal Simek 
Signed-off-by: Tom Rini 
---
 arch/microblaze/Kconfig  | 8 
 include/configs/microblaze-generic.h | 3 ---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index a25a95a0131c..d7d1b219704e 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -25,6 +25,14 @@ config TARGET_MICROBLAZE_GENERIC
 
 endchoice
 
+config DCACHE
+   bool "Enable dcache support"
+   default y
+
+config ICACHE
+   bool "Enable icache support"
+   default y
+
 source "board/xilinx/Kconfig"
 source "board/xilinx/microblaze-generic/Kconfig"
 
diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 744e20e58e71..663837f33dc4 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -30,9 +30,6 @@
 # define CONFIG_SYS_MAX_FLASH_SECT 2048
 #endif
 
-#define CONFIG_ICACHE
-#define CONFIG_DCACHE
-
 #ifndef XILINX_DCACHE_BYTE_SIZE
 #define XILINX_DCACHE_BYTE_SIZE32768
 #endif
-- 
2.25.1



[PATCH 13/25] spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig

2022-03-30 Thread Tom Rini
This is a little tricky since SoCFPGA has code to determine this as
runtime.  Introduce a guard variable for platforms to select if they
have a static value to use.  Then for ARCH_SOCFPGA, call
cm_get_qspi_controller_clk_hz() and otherwise continue the previous
behavior.

Cc: Jagan Teki 
Signed-off-by: Tom Rini 
---
 arch/arm/mach-socfpga/misc_soc64.c | 1 +
 configs/j7200_evm_a72_defconfig| 2 ++
 configs/j7200_evm_r5_defconfig | 2 ++
 configs/j721e_evm_a72_defconfig| 2 ++
 configs/j721e_evm_r5_defconfig | 2 ++
 configs/j721e_hs_evm_a72_defconfig | 2 ++
 configs/j721e_hs_evm_r5_defconfig  | 2 ++
 configs/j721s2_evm_a72_defconfig   | 2 ++
 configs/j721s2_evm_r5_defconfig| 2 ++
 configs/k2g_evm_defconfig  | 2 ++
 configs/k2g_hs_evm_defconfig   | 2 ++
 configs/stv0991_defconfig  | 2 ++
 drivers/spi/Kconfig| 8 
 drivers/spi/cadence_qspi.c | 4 +++-
 drivers/spi/cadence_qspi.h | 1 +
 include/configs/j721e_evm.h| 1 -
 include/configs/j721s2_evm.h   | 1 -
 include/configs/k2g_evm.h  | 4 
 include/configs/socfpga_common.h   | 9 -
 include/configs/socfpga_soc64_common.h | 5 -
 include/configs/stv0991.h  | 8 
 21 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-socfpga/misc_soc64.c 
b/arch/arm/mach-socfpga/misc_soc64.c
index 7b973a79e807..2acdfad07b35 100644
--- a/arch/arm/mach-socfpga/misc_soc64.c
+++ b/arch/arm/mach-socfpga/misc_soc64.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig
index eb1d7d46b82a..3d0d1977ff99 100644
--- a/configs/j7200_evm_a72_defconfig
+++ b/configs/j7200_evm_a72_defconfig
@@ -173,6 +173,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig
index e500a27bb692..0f4b006b80b5 100644
--- a/configs/j7200_evm_r5_defconfig
+++ b/configs/j7200_evm_r5_defconfig
@@ -134,6 +134,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 447967add2f2..792a9021d773 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -173,6 +173,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig
index e6a5f9950561..6553212de85b 100644
--- a/configs/j721e_evm_r5_defconfig
+++ b/configs/j721e_evm_r5_defconfig
@@ -127,6 +127,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j721e_hs_evm_a72_defconfig 
b/configs/j721e_hs_evm_a72_defconfig
index b468a4438eb5..8146af9732d4 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -145,6 +145,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j721e_hs_evm_r5_defconfig 
b/configs/j721e_hs_evm_r5_defconfig
index 1e4a93ff53fe..aaf3c2b5b0b4 100644
--- a/configs/j721e_hs_evm_r5_defconfig
+++ b/configs/j721e_hs_evm_r5_defconfig
@@ -114,6 +114,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 7e2bbc482d1d..e0d124575c4b 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -181,6 +181,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index 996efd4db269..4147b4e26c7b 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -138,6 +138,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=1
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 

[PATCH 15/25] tegra: Drop CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS

2022-03-30 Thread Tom Rini
This is not currently set by any boards, so drop.

Signed-off-by: Tom Rini 
---
 include/configs/tegra-common-post.h | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index d9d89b6d7581..755a41fef7e2 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -70,10 +70,6 @@
 #define BOARD_EXTRA_ENV_SETTINGS
 #endif
 
-#ifndef CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
-#define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
-#endif
-
 #ifdef CONFIG_ARM64
 #define FDT_HIGH ""
 #define INITRD_HIGH ""
@@ -88,8 +84,7 @@
"fdt_high=" FDT_HIGH "\0" \
"initrd_high=" INITRD_HIGH "\0" \
BOOTENV \
-   BOARD_EXTRA_ENV_SETTINGS \
-   CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
+   BOARD_EXTRA_ENV_SETTINGS
 
 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || 
defined(CONFIG_TEGRA114_SPI)
 #define CONFIG_TEGRA_SPI
-- 
2.25.1



[PATCH 07/25] MPC837XERDB: Stop using CONFIG_RAMDISKFILE

2022-03-30 Thread Tom Rini
We don't really configure this, just set it directly in the environment
section.

Signed-off-by: Tom Rini 
---
 include/configs/MPC837XERDB.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 4c4d2c0e1056..eb4ccb17eaaf 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -315,7 +315,6 @@
 
 #define CONFIG_HOSTNAME"mpc837x_rdb"
 #define CONFIG_ROOTPATH"/nfsroot"
-#define CONFIG_RAMDISKFILE "rootfs.ext2.gz.uboot"
/* U-Boot image on TFTP server */
 #define CONFIG_UBOOTPATH   "u-boot.bin"
 #define CONFIG_FDTFILE "mpc8379_rdb.dtb"
@@ -337,7 +336,7 @@
"fdtaddr=78\0"  \
"fdtfile=" CONFIG_FDTFILE "\0"  \
"ramdiskaddr=100\0" \
-   "ramdiskfile=" CONFIG_RAMDISKFILE "\0"  \
+   "ramdiskfile=rootfs.ext2.gz.uboot\0"\
"console=ttyS0\0"   \
"setbootargs=setenv bootargs "  \
"root=$rootdev rw console=$console,$baudrate $othbootargs\0" \
-- 
2.25.1



[PATCH 12/25] Convert CONFIG_SH_SCIF_CLK_FREQ to Kconfig

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SH_SCIF_CLK_FREQ

Signed-off-by: Tom Rini 
---
 configs/stout_defconfig| 1 +
 drivers/serial/Kconfig | 5 +
 include/configs/alt.h  | 3 ---
 include/configs/armadillo-800eva.h | 3 ---
 include/configs/gose.h | 3 ---
 include/configs/koelsch.h  | 3 ---
 include/configs/kzm9g.h| 1 -
 include/configs/lager.h| 3 ---
 include/configs/porter.h   | 3 ---
 include/configs/rcar-gen3-common.h | 3 ---
 include/configs/silk.h | 3 ---
 include/configs/stout.h| 3 ---
 12 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/configs/stout_defconfig b/configs/stout_defconfig
index 0502ae5d3067..ea07ceb8f373 100644
--- a/configs/stout_defconfig
+++ b/configs/stout_defconfig
@@ -88,6 +88,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_SCIF_CONSOLE=y
+CONFIG_SH_SCIF_CLK_FREQ=5200
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_SH_QSPI=y
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index f52422504b03..b8d1fb849376 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -803,6 +803,11 @@ config CONS_SCIFA0
 
 endchoice
 
+config SH_SCIF_CLK_FREQ
+   int "SCIF console clock frequency"
+   depends on SCIF_CONSOLE && (!DM_SERIAL || (SPL && !SPL_DM_SERIAL))
+   default 6500
+
 config UNIPHIER_SERIAL
bool "Support for UniPhier on-chip UART"
depends on ARCH_UNIPHIER
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 1656072ebb4d..090bee7d2d66 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -41,8 +41,5 @@
 /* SPL support */
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SH_SCIF_CLK_FREQ6500
-#endif
 
 #endif /* __ALT_H */
diff --git a/include/configs/armadillo-800eva.h 
b/include/configs/armadillo-800eva.h
index f144302a71d2..acd140ee35ee 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -67,7 +67,4 @@
 #define CONFIG_SH_ETHER_SH7734_MII (0x01)
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
 
-/* Board Clock */
-#define CONFIG_SH_SCIF_CLK_FREQ get_board_sys_clk()
-
 #endif /* __ARMADILLO_800EVA_H */
diff --git a/include/configs/gose.h b/include/configs/gose.h
index 9015cabc2d17..4ffa5bea8f83 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -36,8 +36,5 @@
 /* SPL support */
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SH_SCIF_CLK_FREQ6500
-#endif
 
 #endif /* __GOSE_H */
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 3fef4150b25c..c0997aa3ddd5 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -36,8 +36,5 @@
 /* SPL support */
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SH_SCIF_CLK_FREQ6500
-#endif
 
 #endif /* __KOELSCH_H */
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index f35549d95acb..7e99490e5271 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -66,7 +66,6 @@
 /* Clock */
 #define CONFIG_GLOBAL_TIMER
 #define CONFIG_SYS_CPU_CLK (119600)
-#define CONFIG_SH_SCIF_CLK_FREQ get_board_sys_clk()
 #define TMU_CLK_DIVIDER(4) /* 4 (default), 16, 64, 256 or 
1024 */
 
 #endif /* __KZM9G_H */
diff --git a/include/configs/lager.h b/include/configs/lager.h
index df3b4bbce072..a5abbaaeab1f 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -37,8 +37,5 @@
 /* SPL support */
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SH_SCIF_CLK_FREQ6500
-#endif
 
 #endif /* __LAGER_H */
diff --git a/include/configs/porter.h b/include/configs/porter.h
index 964ce7def64b..bf380ddf05b0 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -41,8 +41,5 @@
 /* SPL support */
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SH_SCIF_CLK_FREQ6500
-#endif
 
 #endif /* __PORTER_H */
diff --git a/include/configs/rcar-gen3-common.h 
b/include/configs/rcar-gen3-common.h
index 5bb6bf3d7822..64743382eda1 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -59,8 +59,5 @@
 #endif
 #define CONFIG_SPL_STACK   0xe6304000
 #define CONFIG_SPL_MAX_SIZE0x7000
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SH_SCIF_CLK_FREQ6500
-#endif
 
 #endif /* __RCAR_GEN3_COMMON_H */
diff --git a/include/configs/silk.h b/include/configs/silk.h

[PATCH 09/25] stm32f429-discovery: Migrate CONFIG_*_LED out of CONFIG namespace

2022-03-30 Thread Tom Rini
These values are only used in one file, reference them more directly.

Cc: Kamil Lulko 
Cc: Patrick Delaunay 
Cc: Patrice Chotard 
Cc: uboot-st...@st-md-mailman.stormreply.com
Signed-off-by: Tom Rini 
---
 board/st/stm32f429-discovery/led.c| 19 +++
 include/configs/stm32f429-discovery.h |  3 ---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/board/st/stm32f429-discovery/led.c 
b/board/st/stm32f429-discovery/led.c
index 539c139bb5dd..8dda6a97bd1c 100644
--- a/board/st/stm32f429-discovery/led.c
+++ b/board/st/stm32f429-discovery/led.c
@@ -8,30 +8,33 @@
 #include 
 #include 
 
+#define RED_LED110
+#define GREEN_LED  109
+
 void coloured_LED_init(void)
 {
-   gpio_request(CONFIG_RED_LED, "red led");
-   gpio_direction_output(CONFIG_RED_LED, 0);
-   gpio_request(CONFIG_GREEN_LED, "green led");
-   gpio_direction_output(CONFIG_GREEN_LED, 0);
+   gpio_request(RED_LED, "red led");
+   gpio_direction_output(RED_LED, 0);
+   gpio_request(GREEN_LED, "green led");
+   gpio_direction_output(GREEN_LED, 0);
 }
 
 void red_led_off(void)
 {
-   gpio_set_value(CONFIG_RED_LED, 0);
+   gpio_set_value(RED_LED, 0);
 }
 
 void green_led_off(void)
 {
-   gpio_set_value(CONFIG_GREEN_LED, 0);
+   gpio_set_value(GREEN_LED, 0);
 }
 
 void red_led_on(void)
 {
-   gpio_set_value(CONFIG_RED_LED, 1);
+   gpio_set_value(RED_LED, 1);
 }
 
 void green_led_on(void)
 {
-   gpio_set_value(CONFIG_GREEN_LED, 1);
+   gpio_set_value(GREEN_LED, 1);
 }
diff --git a/include/configs/stm32f429-discovery.h 
b/include/configs/stm32f429-discovery.h
index c9649a085ef1..21bab5aafd54 100644
--- a/include/configs/stm32f429-discovery.h
+++ b/include/configs/stm32f429-discovery.h
@@ -17,9 +17,6 @@
 
 #define CONFIG_SYS_MAX_FLASH_SECT  12
 
-#define CONFIG_RED_LED 110
-#define CONFIG_GREEN_LED   109
-
 #define CONFIG_SYS_HZ_CLOCK100 /* Timer is clocked at 1MHz */
 
 #define CONFIG_SYS_CBSIZE  1024
-- 
2.25.1



[PATCH 14/25] controlcenterdc: Migrate CUSTOMER_BOARD_SUPPORT to Kconfig

2022-03-30 Thread Tom Rini
This symbol is only possibly useful on some mvebu platforms, so move the
symbol there and select it for the only current user.

Cc: Mario Six 
Cc: Stefan Roese 
Signed-off-by: Tom Rini 
---
 arch/arm/mach-mvebu/Kconfig   | 4 
 include/configs/controlcenterdc.h | 5 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index e17a55a44261..21d9db2638d6 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -90,6 +90,9 @@ config 88F6820
bool
select ARMADA_38X
 
+config CUSTOMER_BOARD_SUPPORT
+   bool
+
 choice
prompt "Armada XP/375/38x/3700/7K/8K board select"
optional
@@ -173,6 +176,7 @@ config TARGET_THEADORABLE
 config TARGET_CONTROLCENTERDC
bool "Support CONTROLCENTERDC"
select 88F6820
+   select CUSTOMER_BOARD_SUPPORT
 
 config TARGET_X530
bool "Support Allied Telesis x530"
diff --git a/include/configs/controlcenterdc.h 
b/include/configs/controlcenterdc.h
index a7d922c3a237..b499d7085fd4 100644
--- a/include/configs/controlcenterdc.h
+++ b/include/configs/controlcenterdc.h
@@ -7,11 +7,6 @@
 #ifndef _CONFIG_CONTROLCENTERDC_H
 #define _CONFIG_CONTROLCENTERDC_H
 
-/*
- * High Level Configuration Options (easy to change)
- */
-#define CONFIG_CUSTOMER_BOARD_SUPPORT
-
 /*
  * TEXT_BASE needs to be below 16MiB, since this area is scrubbed
  * for DDR ECC byte filling in the SPL before loading the main
-- 
2.25.1



[PATCH 01/25] Convert CONFIG_BOARD_SIZE_LIMIT to Kconfig

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_BOARD_SIZE_LIMIT

To do this, introduce CONFIG_HAS_BOARD_SIZE_LIMIT.

Signed-off-by: Tom Rini 
---
 Kconfig| 17 +
 README |  5 -
 configs/bk4r1_defconfig|  2 ++
 configs/colibri_pxa270_defconfig   |  2 ++
 configs/colibri_vf_defconfig   |  2 ++
 configs/ea-lpc3250devkitv2_defconfig   |  2 ++
 configs/gardena-smart-gateway-mt7688_defconfig |  2 ++
 configs/guruplug_defconfig |  2 ++
 configs/linkit-smart-7688_defconfig|  2 ++
 configs/mx51evk_defconfig  |  2 ++
 configs/mx53loco_defconfig |  2 ++
 configs/mx7ulp_com_defconfig   |  2 ++
 configs/openrd_base_defconfig  |  2 ++
 configs/openrd_client_defconfig|  2 ++
 configs/openrd_ultimate_defconfig  |  2 ++
 configs/pcm052_defconfig   |  2 ++
 configs/pico-dwarf-imx6ul_defconfig|  2 ++
 configs/pico-dwarf-imx7d_defconfig |  2 ++
 configs/pico-hobbit-imx6ul_defconfig   |  2 ++
 configs/pico-hobbit-imx7d_defconfig|  2 ++
 configs/pico-imx6_defconfig|  2 ++
 configs/pico-imx6ul_defconfig  |  2 ++
 configs/pico-imx7d_bl33_defconfig  |  2 ++
 configs/pico-imx7d_defconfig   |  2 ++
 configs/pico-nymph-imx7d_defconfig |  2 ++
 configs/pico-pi-imx6ul_defconfig   |  2 ++
 configs/pico-pi-imx7d_defconfig|  2 ++
 configs/sheevaplug_defconfig   |  2 ++
 configs/tbs2910_defconfig  |  2 ++
 configs/vf610twr_defconfig |  2 ++
 configs/vf610twr_nand_defconfig|  2 ++
 configs/warp7_bl33_defconfig   |  2 ++
 configs/warp7_defconfig|  2 ++
 include/configs/bk4r1.h|  3 ---
 include/configs/colibri_pxa270.h   |  2 --
 include/configs/colibri_vf.h   |  3 ---
 include/configs/ea-lpc3250devkitv2.h   |  5 -
 include/configs/gardena-smart-gateway-mt7688.h |  6 --
 include/configs/guruplug.h |  5 -
 include/configs/linkit-smart-7688.h|  6 --
 include/configs/mx51evk.h  | 13 -
 include/configs/mx53loco.h | 12 
 include/configs/mx7ulp_com.h   | 10 --
 include/configs/openrd.h   |  5 -
 include/configs/pcm052.h   |  3 ---
 include/configs/pico-imx6.h| 12 
 include/configs/pico-imx6ul.h  | 11 ---
 include/configs/pico-imx7d.h   | 10 --
 include/configs/rcar-gen3-common.h |  3 ---
 include/configs/sheevaplug.h   |  5 -
 include/configs/sunxi-common.h |  9 -
 include/configs/tbs2910.h  |  2 --
 include/configs/vf610twr.h |  3 ---
 include/configs/warp7.h| 13 -
 54 files changed, 79 insertions(+), 146 deletions(-)

diff --git a/Kconfig b/Kconfig
index 112745440b5a..5a19fc99deb6 100644
--- a/Kconfig
+++ b/Kconfig
@@ -395,6 +395,23 @@ config BUILD_TARGET
  special image will be automatically built upon calling
  make / buildman.
 
+config HAS_BOARD_SIZE_LIMIT
+   bool "Define a maximum size for the U-Boot image"
+   default y if RCAR_GEN3
+   help
+ In some cases, we need to enforce a hard limit on how big the U-Boot
+ image itself can be.
+
+config BOARD_SIZE_LIMIT
+   int "Maximum size of the U-Boot image in bytes"
+   default 1048576 if RCAR_GEN3
+   depends on HAS_BOARD_SIZE_LIMIT
+   help
+ Maximum size of the U-Boot image. When defined, the build system
+ checks that the actual size does not exceed it.  This does not
+ include SPL nor TPL, on platforms that use that functionality, they
+ have a separate option to restict size.
+
 config SYS_CUSTOM_LDSCRIPT
bool "Use a custom location for the U-Boot linker script"
help
diff --git a/README b/README
index f31fcd73f196..04e3fad0b8b6 100644
--- a/README
+++ b/README
@@ -2183,11 +2183,6 @@ use the "saveenv" command to store a valid environment.
later, once stdio is running and output goes to the LCD, if
present.
 
-- CONFIG_BOARD_SIZE_LIMIT:
-   Maximum size of the U-Boot image. When defined, the
-   build system checks that the actual size does not
-   exceed it.
-
 Low Level (hardware related) configuration options:
 ---
 
diff --git a/configs/bk4r1_defconfig 

[PATCH 11/25] Convert CONFIG_CONS_SCIF0 et al to Kconfig

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CONS_SCIF0
   CONFIG_CONS_SCIF1
   CONFIG_CONS_SCIF2
   CONFIG_CONS_SCIF4
   CONFIG_CONS_SCIFA0

Signed-off-by: Tom Rini 
---
 drivers/serial/Kconfig | 21 +
 include/configs/alt.h  |  1 -
 include/configs/armadillo-800eva.h |  1 -
 include/configs/gose.h |  1 -
 include/configs/koelsch.h  |  1 -
 include/configs/kzm9g.h|  1 -
 include/configs/lager.h|  1 -
 include/configs/porter.h   |  1 -
 include/configs/r2dplus.h  |  1 -
 include/configs/rcar-gen3-common.h |  1 -
 include/configs/silk.h |  1 -
 include/configs/stout.h|  1 -
 12 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 610f8062c76b..f52422504b03 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -782,6 +782,27 @@ config SCIF_CONSOLE
  on systems with RCar or SH SoCs, say Y to this option. If unsure,
  say N.
 
+choice
+   prompt "SCIF console port"
+   depends on SCIF_CONSOLE && (!DM_SERIAL || (SPL && !SPL_DM_SERIAL))
+
+config CONS_SCIF0
+   bool "SCIF0"
+
+config CONS_SCIF1
+   bool "SCIF1"
+
+config CONS_SCIF2
+   bool "SCIF2"
+
+config CONS_SCIF4
+   bool "SCIF4"
+
+config CONS_SCIFA0
+   bool "SCIFA0"
+
+endchoice
+
 config UNIPHIER_SERIAL
bool "Support for UniPhier on-chip UART"
depends on ARCH_UNIPHIER
diff --git a/include/configs/alt.h b/include/configs/alt.h
index acc416de06bd..1656072ebb4d 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -42,7 +42,6 @@
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF2
 #define CONFIG_SH_SCIF_CLK_FREQ6500
 #endif
 
diff --git a/include/configs/armadillo-800eva.h 
b/include/configs/armadillo-800eva.h
index 18e1e401ae68..f144302a71d2 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -33,7 +33,6 @@
 #define CONFIG_SYS_BAUDRATE_TABLE  { 115200 }
 
 /* SCIF */
-#define CONFIG_CONS_SCIF1
 #define SCIF0_BASE 0xe6c4
 #define SCIF1_BASE 0xe6c5
 #define SCIF2_BASE 0xe6c6
diff --git a/include/configs/gose.h b/include/configs/gose.h
index dfa139dc7dc1..9015cabc2d17 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -37,7 +37,6 @@
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ6500
 #endif
 
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 84603e354020..3fef4150b25c 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -37,7 +37,6 @@
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ6500
 #endif
 
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index c20ef5f69685..f35549d95acb 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -27,7 +27,6 @@
 #define CONFIG_SYS_BAUDRATE_TABLE  { 115200 }
 
 /* SCIF */
-#define CONFIG_CONS_SCIF4
 
 #undef  CONFIG_SYS_LOADS_BAUD_CHANGE
 
diff --git a/include/configs/lager.h b/include/configs/lager.h
index 8cabad2853c9..df3b4bbce072 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -38,7 +38,6 @@
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ6500
 #endif
 
diff --git a/include/configs/porter.h b/include/configs/porter.h
index 661b7ea0cd2a..964ce7def64b 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -42,7 +42,6 @@
 #define CONFIG_SPL_STACK   0xe634
 #define CONFIG_SPL_MAX_SIZE0x4000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF0
 #define CONFIG_SH_SCIF_CLK_FREQ6500
 #endif
 
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
index 869f9f52ae11..54674094e83b 100644
--- a/include/configs/r2dplus.h
+++ b/include/configs/r2dplus.h
@@ -4,7 +4,6 @@
 #define __LITTLE_ENDIAN__  1
 
 /* SCIF */
-#define CONFIG_CONS_SCIF1  1
 
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE  0x8C00
diff --git a/include/configs/rcar-gen3-common.h 
b/include/configs/rcar-gen3-common.h
index c3759ed19bf0..5bb6bf3d7822 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -60,7 +60,6 @@
 #define CONFIG_SPL_STACK   0xe6304000
 #define CONFIG_SPL_MAX_SIZE0x7000
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_CONS_SCIF2
 #define 

[PATCH 10/25] at91: Remove unused LED code

2022-03-30 Thread Tom Rini
These LED files (and CONFIG values) are unused today, remove the code in
question.

Signed-off-by: Tom Rini 
---
 arch/arm/mach-at91/arm926ejs/Makefile |  1 -
 arch/arm/mach-at91/arm926ejs/led.c| 47 ---
 board/atmel/at91sam9260ek/Makefile|  1 -
 board/atmel/at91sam9260ek/led.c   | 22 -
 board/atmel/at91sam9261ek/Makefile|  1 -
 board/atmel/at91sam9261ek/led.c   | 28 
 board/atmel/at91sam9263ek/Makefile|  1 -
 board/atmel/at91sam9263ek/led.c   | 27 ---
 board/atmel/at91sam9m10g45ek/Makefile |  1 -
 board/atmel/at91sam9m10g45ek/led.c| 24 --
 board/atmel/at91sam9rlek/Makefile |  1 -
 board/atmel/at91sam9rlek/led.c| 26 ---
 board/ronetix/pm9261/Makefile |  1 -
 board/ronetix/pm9261/led.c| 26 ---
 board/ronetix/pm9263/Makefile |  1 -
 board/ronetix/pm9263/led.c| 24 --
 include/configs/smartweb.h|  4 ---
 17 files changed, 236 deletions(-)
 delete mode 100644 arch/arm/mach-at91/arm926ejs/led.c
 delete mode 100644 board/atmel/at91sam9260ek/led.c
 delete mode 100644 board/atmel/at91sam9261ek/led.c
 delete mode 100644 board/atmel/at91sam9263ek/led.c
 delete mode 100644 board/atmel/at91sam9m10g45ek/led.c
 delete mode 100644 board/atmel/at91sam9rlek/led.c
 delete mode 100644 board/ronetix/pm9261/led.c
 delete mode 100644 board/ronetix/pm9263/led.c

diff --git a/arch/arm/mach-at91/arm926ejs/Makefile 
b/arch/arm/mach-at91/arm926ejs/Makefile
index c1904d535be2..f306b172f09e 100644
--- a/arch/arm/mach-at91/arm926ejs/Makefile
+++ b/arch/arm/mach-at91/arm926ejs/Makefile
@@ -16,7 +16,6 @@ obj-$(CONFIG_AT91SAM9N12) += at91sam9n12_devices.o
 obj-$(CONFIG_AT91SAM9X5)   += at91sam9x5_devices.o
 obj-$(CONFIG_SAM9X60)  += sam9x60_devices.o
 obj-$(CONFIG_AT91_EFLASH)  += eflash.o
-obj-$(CONFIG_AT91_LED) += led.o
 obj-y += clock.o
 obj-y += cpu.o
 obj-y  += reset.o
diff --git a/arch/arm/mach-at91/arm926ejs/led.c 
b/arch/arm/mach-at91/arm926ejs/led.c
deleted file mode 100644
index de24db183665..
--- a/arch/arm/mach-at91/arm926ejs/led.c
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2007-2008
- * Stelian Pop 
- * Lead Tech Design 
- */
-
-#include 
-#include 
-#include 
-#include 
-
-#ifdef CONFIG_RED_LED
-void red_led_on(void)
-{
-   gpio_set_value(CONFIG_RED_LED, 1);
-}
-
-void red_led_off(void)
-{
-   gpio_set_value(CONFIG_RED_LED, 0);
-}
-#endif
-
-#ifdef CONFIG_GREEN_LED
-void green_led_on(void)
-{
-   gpio_set_value(CONFIG_GREEN_LED, 0);
-}
-
-void green_led_off(void)
-{
-   gpio_set_value(CONFIG_GREEN_LED, 1);
-}
-#endif
-
-#ifdef CONFIG_YELLOW_LED
-void yellow_led_on(void)
-{
-   gpio_set_value(CONFIG_YELLOW_LED, 0);
-}
-
-void yellow_led_off(void)
-{
-   gpio_set_value(CONFIG_YELLOW_LED, 1);
-}
-#endif
diff --git a/board/atmel/at91sam9260ek/Makefile 
b/board/atmel/at91sam9260ek/Makefile
index 56cac9750858..0f1729644cd3 100644
--- a/board/atmel/at91sam9260ek/Makefile
+++ b/board/atmel/at91sam9260ek/Makefile
@@ -8,4 +8,3 @@
 # Lead Tech Design 
 
 obj-y  += at91sam9260ek.o
-obj-$(CONFIG_AT91_LED) += led.o
diff --git a/board/atmel/at91sam9260ek/led.c b/board/atmel/at91sam9260ek/led.c
deleted file mode 100644
index cc6d5d7a05eb..
--- a/board/atmel/at91sam9260ek/led.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2007-2008
- * Stelian Pop 
- * Lead Tech Design 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-void coloured_LED_init(void)
-{
-   /* Clock is enabled in board_early_init_f() */
-   at91_set_gpio_output(CONFIG_RED_LED, 1);
-   at91_set_gpio_output(CONFIG_GREEN_LED, 1);
-
-   at91_set_gpio_value(CONFIG_RED_LED, 0);
-   at91_set_gpio_value(CONFIG_GREEN_LED, 1);
-}
diff --git a/board/atmel/at91sam9261ek/Makefile 
b/board/atmel/at91sam9261ek/Makefile
index 7f5369f4319b..de3466627b1e 100644
--- a/board/atmel/at91sam9261ek/Makefile
+++ b/board/atmel/at91sam9261ek/Makefile
@@ -8,4 +8,3 @@
 # Lead Tech Design 
 
 obj-y += at91sam9261ek.o
-obj-$(CONFIG_AT91_LED) += led.o
diff --git a/board/atmel/at91sam9261ek/led.c b/board/atmel/at91sam9261ek/led.c
deleted file mode 100644
index a1aab98d5870..
--- a/board/atmel/at91sam9261ek/led.c
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2007-2008
- * Stelian Pop 
- * Lead Tech Design 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-void coloured_LED_init(void)
-{
-   /* Enable clock */
-   at91_periph_clk_enable(ATMEL_ID_PIOA);
-
-   at91_set_gpio_output(CONFIG_RED_LED, 1);
-   at91_set_gpio_output(CONFIG_GREEN_LED, 1);
-   at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
-
-   at91_set_gpio_value(CONFIG_RED_LED, 0);
-   at91_set_gpio_value(CONFIG_GREEN_LED, 1);
-   

[PATCH 08/25] corvus: Migrate CONFIG_*_LED out of CONFIG namespace

2022-03-30 Thread Tom Rini
This code is only used on the corvus platform, so migrate the LED on/off
code to this platform and remove it from the CONFIG namespace.  In
theory, this should likely be moved to the modern GPIO LED driver as a
further cleanup.

Cc: Heiko Schocher 
Signed-off-by: Tom Rini 
---
 board/siemens/corvus/board.c | 24 ++--
 include/configs/corvus.h |  4 
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c
index a6e1737be022..90fece7f958d 100644
--- a/board/siemens/corvus/board.c
+++ b/board/siemens/corvus/board.c
@@ -52,8 +52,28 @@ static void corvus_request_gpio(void)
gpio_request(AT91_PIN_PD3, "USB1");
gpio_request(AT91_PIN_PB18, "SPICS1");
gpio_request(AT91_PIN_PB3, "SPICS0");
-   gpio_request(CONFIG_RED_LED, "red led");
-   gpio_request(CONFIG_GREEN_LED, "green led");
+   gpio_request(AT91_PIN_PD31, "red led"); /* this is the user1 led */
+   gpio_request(AT91_PIN_PD0, "green led"); /* this is the user2 led */
+}
+
+void red_led_on(void)
+{
+   gpio_set_value(AT91_PIN_PD31, 1);
+}
+
+void red_led_off(void)
+{
+   gpio_set_value(AT91_PIN_PD31, 0);
+}
+
+void green_led_on(void)
+{
+   gpio_set_value(AT91_PIN_PD0, 0);
+}
+
+void green_led_off(void)
+{
+   gpio_set_value(AT91_PIN_PD0, 1);
 }
 
 static void corvus_nand_hw_init(void)
diff --git a/include/configs/corvus.h b/include/configs/corvus.h
index bb73201b54fe..4809b59ecc39 100644
--- a/include/configs/corvus.h
+++ b/include/configs/corvus.h
@@ -31,10 +31,6 @@
 #define CONFIG_USART_BASE  ATMEL_BASE_DBGU
 #define CONFIG_USART_IDATMEL_ID_SYS
 
-/* LED */
-#define CONFIG_RED_LED AT91_PIN_PD31   /* this is the user1 led */
-#define CONFIG_GREEN_LED   AT91_PIN_PD0/* this is the user2 led */
-
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE   ATMEL_BASE_CS6
 #define CONFIG_SYS_SDRAM_SIZE  0x0800
-- 
2.25.1



[PATCH 06/25] s5p_goni, smdkc100: Move some environment settings out of CONFIG

2022-03-30 Thread Tom Rini
A number of CONFIG options are used on these platforms as part of the
default environment.  Set some of these more directly and in other
cases, just reference them directly.

Cc: Jaehoon Chung 
Cc: Minkyu Kang 
Signed-off-by: Tom Rini 
---
 include/configs/s5p_goni.h | 23 ++-
 include/configs/smdkc100.h | 24 ++--
 2 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0ec60cadb49e..3b4347dd00bd 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -67,18 +67,14 @@
"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
-#define CONFIG_RAMDISK_BOOT"root=/dev/ram0 rw rootfstype=ext4" \
-   " ${console} ${meminfo}"
-
-#define CONFIG_COMMON_BOOT "${console} ${meminfo} ${mtdparts}"
-
-#define CONFIG_UPDATEB "updateb=onenand erase 0x0 0x10;" \
-   " onenand write 0x32008000 0x0 0x10\0"
+#define COMMON_BOOT"${console} ${meminfo} ${mtdparts}"
 
 #define CONFIG_MISC_COMMON
 
 #define CONFIG_EXTRA_ENV_SETTINGS  \
-   CONFIG_UPDATEB \
+   "updateb=" \
+   "onenand erase 0x0 0x10;" \
+   "onenand write 0x32008000 0x0 0x10\0" \
"updatek=" \
"onenand erase 0xc0 0x60;" \
"onenand write 0x31008000 0xc0 0x60\0" \
@@ -91,22 +87,23 @@
"flashboot=" \
"set bootargs root=/dev/mtdblock${bootblock} " \
"rootfstype=${rootfstype} ${opts} " \
-   "${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
+   "${lcdinfo} " COMMON_BOOT "; run bootk\0" \
"ubifsboot=" \
"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
"${opts} ${lcdinfo} " \
-   CONFIG_COMMON_BOOT "; run bootk\0" \
+   COMMON_BOOT "; run bootk\0" \
"tftpboot=" \
"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-   "${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
+   "${opts} ${lcdinfo} " COMMON_BOOT \
"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
"ramboot=" \
-   "set bootargs " CONFIG_RAMDISK_BOOT \
+   "set bootargs root=/dev/ram0 rw rootfstype=ext4" \
+   " ${console} ${meminfo} " \
"initrd=0x3300,8M ramdisk=8192\0" \
"mmcboot=" \
"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
-   CONFIG_COMMON_BOOT "; run bootk\0" \
+   COMMON_BOOT "; run bootk\0" \
"boottrace=setenv opts initcall_debug; run bootcmd\0" \
"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
"verify=n\0" \
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
index 4401094ee39c..8eea45450b5c 100644
--- a/include/configs/smdkc100.h
+++ b/include/configs/smdkc100.h
@@ -35,19 +35,14 @@
 /* PWM */
 #define CONFIG_PWM 1
 
-#define CONFIG_RAMDISK_BOOT"root=/dev/ram0 rw rootfstype=ext2" \
-   " console=ttySAC0,115200n8" \
-   " mem=128M"
-
-#define CONFIG_COMMON_BOOT "console=ttySAC0,115200n8" \
+#define COMMON_BOOT"console=ttySAC0,115200n8" \
" mem=128M " \
" " CONFIG_MTDPARTS_DEFAULT
 
-#define CONFIG_UPDATEB "updateb=onenand erase 0x0 0x4;" \
-   " onenand write 0x32008000 0x0 0x4\0"
-
 #define CONFIG_EXTRA_ENV_SETTINGS  \
-   CONFIG_UPDATEB \
+   "updateb=" \
+   "onenand erase 0x0 0x4;" \
+   "onenand write 0x32008000 0x0 0x4\0" \
"updatek=" \
"onenand erase 0x6 0x30;" \
"onenand write 0x31008000 0x6 0x30\0" \
@@ -60,25 +55,26 @@
"flashboot=" \
"set bootargs root=/dev/mtdblock${bootblock} " \
"rootfstype=${rootfstype} " \
-   "ubi.mtd=${ubiblock} ${opts} " CONFIG_COMMON_BOOT ";" \
+   "ubi.mtd=${ubiblock} ${opts} " COMMON_BOOT ";" \
"run bootk\0" \
"ubifsboot=" \
"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-   " ubi.mtd=${ubiblock} ${opts} " CONFIG_COMMON_BOOT "; " \
+   " ubi.mtd=${ubiblock} ${opts} " COMMON_BOOT "; " \
"run bootk\0" \
"boottrace=setenv opts initcall_debug; run bootcmd\0" \
"android=" \
"set bootargs root=ubi0!ramdisk ubi.mtd=${ubiblock} " \
-   "rootfstype=ubifs init=/init.sh " CONFIG_COMMON_BOOT "; " \
+   "rootfstype=ubifs init=/init.sh " COMMON_BOOT "; " \
   

[PATCH 02/25] mvebu: Move BOOTROM_ERR_REG out of CONFIG namespace

2022-03-30 Thread Tom Rini
This register is referenced in one location and does not seem
configurable, so remove it from CONFIG namespace.

Cc: Stefan Roese 
Signed-off-by: Tom Rini 
---
 arch/arm/mach-mvebu/cpu.c  | 2 +-
 arch/arm/mach-mvebu/include/mach/soc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index 0272dd7352d8..1e893777b292 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -91,7 +91,7 @@ u32 get_boot_device(void)
 * be done, via the bootrom error register. Here the
 * MSB marks if the UART mode is active.
 */
-   val = readl(CONFIG_BOOTROM_ERR_REG);
+   val = readl(BOOTROM_ERR_REG);
boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device);
if (boot_device == BOOTROM_ERR_MODE_UART)
diff --git a/arch/arm/mach-mvebu/include/mach/soc.h 
b/arch/arm/mach-mvebu/include/mach/soc.h
index aab61f7c15cf..3b9618852c6d 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -125,7 +125,7 @@
 #define COMPHY_REFCLK_ALIGNMENT(MVEBU_REGISTER(0x182f8))
 
 /* BootROM error register (also includes some status infos) */
-#define CONFIG_BOOTROM_ERR_REG (MVEBU_REGISTER(0x182d0))
+#define BOOTROM_ERR_REG(MVEBU_REGISTER(0x182d0))
 #define BOOTROM_ERR_MODE_OFFS  28
 #define BOOTROM_ERR_MODE_MASK  (0xf << BOOTROM_ERR_MODE_OFFS)
 #define BOOTROM_ERR_MODE_UART  0x6
-- 
2.25.1



[PATCH 03/25] tegra: Migrate CI_UDC_HAS_HOSTPC to Kconfig

2022-03-30 Thread Tom Rini
This option is only enabled for CI_UDC and !TEGRA20, so implement it as
such in Kconfig directly.

Signed-off-by: Tom Rini 
---
 arch/arm/mach-tegra/Kconfig   |  4 
 include/configs/apalis-tk1.h  |  1 -
 include/configs/apalis_t30.h  |  1 -
 include/configs/beaver.h  |  1 -
 include/configs/cei-tk1-som.h |  1 -
 include/configs/colibri_t20.h |  1 -
 include/configs/colibri_t30.h |  1 -
 include/configs/dalmore.h |  1 -
 include/configs/jetson-tk1.h  |  1 -
 include/configs/nyan-big.h|  1 -
 include/configs/p2371-.h  |  1 -
 include/configs/p2371-2180.h  |  1 -
 include/configs/p2571.h   |  1 -
 include/configs/p3450-.h  |  1 -
 include/configs/tegra-common-usb-gadget.h | 18 --
 include/configs/venice2.h |  1 -
 16 files changed, 4 insertions(+), 32 deletions(-)
 delete mode 100644 include/configs/tegra-common-usb-gadget.h

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 957e3ce64a5e..5309be9cc210 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -164,6 +164,10 @@ config TEGRA_DISCONNECT_UDC_ON_BOOT
  USB controller when U-Boot boots to avoid leaving a stale USB device
  present.
 
+config CI_UDC_HAS_HOSTPC
+   def_bool y
+   depends on CI_UDC && !TEGRA20
+
 config SYS_MALLOC_F_LEN
default 0x1800
 
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index da935f77b9a6..59c901994fd3 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -111,7 +111,6 @@
 #undef CONFIG_SYS_MAXARGS
 #define CONFIG_SYS_MAXARGS 32
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index eab4f22be34e..b7a2fb695e2f 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -49,7 +49,6 @@
 #define BOARD_EXTRA_ENV_SETTINGS \
UBOOT_UPDATE
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/beaver.h b/include/configs/beaver.h
index 8be491e60103..1d51bb4e4c48 100644
--- a/include/configs/beaver.h
+++ b/include/configs/beaver.h
@@ -24,7 +24,6 @@
 #define CONFIG_TEGRA_SLINK_CTRLS   6
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index 1cc86091022b..0672b7dbbe93 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -25,7 +25,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index c45016a83583..fdf6bb284191 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -39,7 +39,6 @@
 #undef CONFIG_SYS_MAXARGS
 #define CONFIG_SYS_MAXARGS 32
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index 324e607839a9..cbe73bf86bad 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -47,7 +47,6 @@
 #define BOARD_EXTRA_ENV_SETTINGS \
UBOOT_UPDATE
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
index 2a020e96c405..e03a24adca4a 100644
--- a/include/configs/dalmore.h
+++ b/include/configs/dalmore.h
@@ -22,7 +22,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h
index b4c42fd37229..69aa55f86c5f 100644
--- a/include/configs/jetson-tk1.h
+++ b/include/configs/jetson-tk1.h
@@ -23,7 +23,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index 3584d9ad90e1..bc5754566bdd 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -26,7 +26,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/p2371-.h b/include/configs/p2371-.h
index 5cebafc7c7c6..ecd0405d297b 100644
--- a/include/configs/p2371-.h
+++ b/include/configs/p2371-.h
@@ -22,7 

[PATCH 05/25] arm: integrator: Migrate platform-specific options and cleanup armcoremodule.h

2022-03-30 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_CM_INIT
   CONFIG_CM_REMAP
   CONFIG_CM_SPD_DETECT
   CONFIG_CM_MULTIPLE_SSRAM
   CONFIG_CM_TCRAM

We make the first three of these options be always enabled, as that
matches usage.  We select the last two based on how they were defined in
armcoremodule.h.  This also allows us to remove some unused code in
board/armltd/integrator/lowlevel_init.S

Cc: Linus Walleij 
Cc: Andre Przywara 
Signed-off-by: Tom Rini 
---
 arch/arm/mach-integrator/Kconfig| 19 +
 board/armltd/integrator/integrator.c|  1 +
 board/armltd/integrator/lowlevel_init.S |  7 +
 include/armcoremodule.h | 36 -
 include/configs/integrator-common.h | 27 ---
 include/configs/integratorap.h  |  9 ---
 6 files changed, 21 insertions(+), 78 deletions(-)

diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index d506ee5b39cd..4b5a50717a55 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -32,14 +32,18 @@ config CM920T
 config CM926EJ_S
bool "Core Module for ARM926EJ-STM"
select CPU_ARM926EJS
+   select CM_TCRAM
 
 config CM946ES
bool "Core Module for ARM946E-STM"
select CPU_ARM946ES
+   select CM_MULTIPLE_SSRAM
+   select CM_TCRAM
 
 config CM1136
bool "Core Module for ARM1136JF-STM"
select CPU_ARM1136
+   select CM_TCRAM
 
 endchoice
 
@@ -56,4 +60,19 @@ config SYS_CONFIG_NAME
 config SYS_MALLOC_F_LEN
default 0x2000
 
+config CM_INIT
+   def_bool y
+
+config CM_REMAP
+   def_bool y
+
+config CM_SPD_DETECT
+   def_bool y
+
+config CM_MULTIPLE_SSRAM
+   bool
+
+config CM_TCRAM
+   bool
+
 endmenu
diff --git a/board/armltd/integrator/integrator.c 
b/board/armltd/integrator/integrator.c
index 388795809dfd..e734ceae8890 100644
--- a/board/armltd/integrator/integrator.c
+++ b/board/armltd/integrator/integrator.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/armltd/integrator/lowlevel_init.S 
b/board/armltd/integrator/lowlevel_init.S
index 1a1cb580be63..ea5b654ed527 100644
--- a/board/armltd/integrator/lowlevel_init.S
+++ b/board/armltd/integrator/lowlevel_init.S
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 
/* Reset using CM control register */
 .global reset_cpu
@@ -41,10 +42,6 @@ lowlevel_init:
/* set the desired CM specific value */
mov r2,#CMMASK_LOWVEC   /* Vectors at 0x for all */
 
-#if defined (CONFIG_CM10200E) || defined (CONFIG_CM10220E)
-   orr r2,r2,#CMMASK_INIT_102
-#else
-
 #if !defined (CONFIG_CM920T) && !defined (CONFIG_CM920T_ETM) && \
  !defined (CONFIG_CM940T)
 
@@ -69,8 +66,6 @@ lowlevel_init:
 
 #endif /* CMxx6 code */
 
-#endif /* ARM102xxE value */
-
/* read CM_INIT  */
mov r0, #CM_BASE
ldr r1, [r0, #OS_INIT]
diff --git a/include/armcoremodule.h b/include/armcoremodule.h
index 613b88427026..ee839c886da1 100644
--- a/include/armcoremodule.h
+++ b/include/armcoremodule.h
@@ -34,42 +34,6 @@
/*   CM926EJ-S */
/*   CM1136-EJ-S */
 
-#if defined (CONFIG_CM10200E) || defined (CONFIG_CM10220E)
-#define CMMASK_INIT_1020x0300  /* see CM102xx ref 
manual */
-   /* - PLL test clock bypassed */
-   /* - bus clock ratio 2 */
-   /* - little endian */
-   /* - vectors at zero */
-#endif /* CM1022xx */
-
-/* Determine CM characteristics */
-
-#undef CONFIG_CM_MULTIPLE_SSRAM
-#undef CONFIG_CM_SPD_DETECT
-#undef CONFIG_CM_REMAP
-#undef CONFIG_CM_INIT
-#undef CONFIG_CM_TCRAM
-
-#if defined (CONFIG_CM946E_S) || defined (CONFIG_CM966E_S)
-#defineCONFIG_CM_MULTIPLE_SSRAM/* CM has multiple SSRAM 
mapping */
-#endif
-
-/* Excalibur core module has reduced functionality */
-#ifndefCONFIG_CM922T_XA10
-#define CONFIG_CM_SPD_DETECT   /* CM supports SPD query  */
-#define OS_SPD 0x0100  /* Address of SPD data*/
-#define CONFIG_CM_REMAP/* CM supports 
remapping  */
-#define CONFIG_CM_INIT /* CM has initialization reg  */
-#endif /* NOT EXCALIBUR */
-
-#if defined(CONFIG_CM926EJ_S)   || defined (CONFIG_CM946E_S)   || \
-defined(CONFIG_CM966E_S)|| defined (CONFIG_CM1026EJ_S) || \
-defined(CONFIG_CM1136JF_S)
-#define CONFIG_CM_TCRAM/* CM has TCRAM  */
-#endif
-
-#ifdef CONFIG_CM_SPD_DETECT
 #define OS_SPD 0x0100  /* The SDRAM SPD data is copied here */
-#endif
 
 #endif /* __ARMCOREMODULE_H */
diff --git 

Re: [PATCH v2] board: gateworks: venice: determine dram size at runtime

2022-03-30 Thread Tim Harvey
On Wed, Mar 30, 2022 at 1:58 PM Fabio Estevam  wrote:
>
> Hi Tim,
>
> On Wed, Mar 30, 2022 at 5:39 PM Tim Harvey  wrote:
> >
> > The SPL does not update the memory node with the dram size from EEPROM
> > but instead we can use get_ram_size which does a simple memory test
> > to determine the available RAM. Update PHYS_SDRAM_SIZE to 4GiB as that
> > is the max used on the Venice boards.
> >
> > Signed-off-by: Tim Harvey 
> > Reviewed-by: Fabio Estevam 
>
> Is this 2022.04 material?

Fabio,

Probably a good idea - without it the DRAM size is set to something
that may not be appropriate and if larger than what's actually on the
board could cause a crash if someone tried to allocate that memory.

Fixes: 692c25ee30efd "(board: gateworks: venice: get mem size from dt)"

Thanks,

Tim


Re: [PATCH v2] board: gateworks: venice: determine dram size at runtime

2022-03-30 Thread Fabio Estevam
Hi Tim,

On Wed, Mar 30, 2022 at 5:39 PM Tim Harvey  wrote:
>
> The SPL does not update the memory node with the dram size from EEPROM
> but instead we can use get_ram_size which does a simple memory test
> to determine the available RAM. Update PHYS_SDRAM_SIZE to 4GiB as that
> is the max used on the Venice boards.
>
> Signed-off-by: Tim Harvey 
> Reviewed-by: Fabio Estevam 

Is this 2022.04 material?


Re: [RFC PATCH] mips: dts: add initial support for ls1c300 SoC

2022-03-30 Thread Sean Anderson

On 3/29/22 3:30 PM, Du Huanpeng wrote:

Loongson 1C is a cost-effective SOC chip for industrial control and
the Internet of Things. The Loongson 1C includes a floating-point
processing unit, supports multiple types of memory, and supports
high-capacity MLC NAND Flash. Loongson 1C provides developers with a
wealth of peripheral interfaces and on-chip modules, including Camera
controller, USB OTG and USB HOST interfaces, AC97/I2S controller, LCD
controller, SPI interface, UART interface, etc., providing sufficient
computing power and multi-application connectivity.

Some highlights of this SoC are:
- Single core LS232, MIPS32 instruction set compatible, main frequency
300MHZ
- 16KB data cache and 16KB instruction cache
- 64 bit float unit, hardware division
- 8/16 bit SDRAM controller, 45 ~ 133MHz
- 8/16 bit SRAM, NAND
- I2S/AC97, LCD, MAC, USB, OTG, SPI, I2C, PWM, CAN, SDIO, ADC
- 12 UARTs

See Techinical Reference Manual for details: https://www.loongson.cn/


Can you provide a direct link please? I looked around a bit but I don't
read Chinese and I was unable to figure out where to find more
documentation on this CPU.



introduce base support for the ls1c300 SoC.
- debug UART2
- serial console
- clock
- watchdog
- sysreset
- many uarts

Signed-off-by: Du Huanpeng 
---
  arch/mips/Kconfig |  25 +++
  arch/mips/Makefile|   1 +
  arch/mips/dts/Makefile|   1 +
  arch/mips/dts/loongson32-ls1c300b.dtsi| 138 +
  arch/mips/dts/ls1c300-eval.dts|  27 
  arch/mips/mach-lsmips/Kconfig |  77 ++
  arch/mips/mach-lsmips/Makefile|   6 +
  arch/mips/mach-lsmips/cpu.c   |  24 +++
  arch/mips/mach-lsmips/include/mach/serial.h   |  16 ++
  arch/mips/mach-lsmips/ls1c300/Makefile|   6 +
  arch/mips/mach-lsmips/ls1c300/gpio.c  |  60 
  arch/mips/mach-lsmips/ls1c300/init.c  |  60 
  arch/mips/mach-lsmips/ls1c300/lowlevel_init.S | 123 +++
  arch/mips/mach-lsmips/ls1c300/ls1c300.h   |  52 +++
  arch/mips/mach-lsmips/ls1c300/serial.c| 112 ++
  arch/mips/mach-lsmips/spl.c   |  47 ++
  board/loongson/ls1c300-eval/Kconfig   |  12 ++
  board/loongson/ls1c300-eval/MAINTAINERS   |   7 +
  board/loongson/ls1c300-eval/Makefile  |   3 +
  board/loongson/ls1c300-eval/board.c   |  20 +++
  configs/ls1c300_defconfig |  65 
  drivers/clk/Makefile  |   1 +
  drivers/clk/lsmips/Makefile   |   3 +
  drivers/clk/lsmips/clk-ls1c300.c  | 145 ++
  drivers/watchdog/Kconfig  |   8 +
  drivers/watchdog/Makefile |   1 +
  drivers/watchdog/lsmips_wdt.c | 126 +++
  include/configs/ls1c300.h |  61 
  include/dt-bindings/clock/ls1c300-clk.h   |  48 ++
  29 files changed, 1275 insertions(+)
  create mode 100644 arch/mips/dts/loongson32-ls1c300b.dtsi
  create mode 100644 arch/mips/dts/ls1c300-eval.dts
  create mode 100644 arch/mips/mach-lsmips/Kconfig
  create mode 100644 arch/mips/mach-lsmips/Makefile
  create mode 100644 arch/mips/mach-lsmips/cpu.c
  create mode 100644 arch/mips/mach-lsmips/include/mach/serial.h
  create mode 100644 arch/mips/mach-lsmips/ls1c300/Makefile
  create mode 100644 arch/mips/mach-lsmips/ls1c300/gpio.c
  create mode 100644 arch/mips/mach-lsmips/ls1c300/init.c
  create mode 100644 arch/mips/mach-lsmips/ls1c300/lowlevel_init.S
  create mode 100644 arch/mips/mach-lsmips/ls1c300/ls1c300.h
  create mode 100644 arch/mips/mach-lsmips/ls1c300/serial.c
  create mode 100644 arch/mips/mach-lsmips/spl.c
  create mode 100644 board/loongson/ls1c300-eval/Kconfig
  create mode 100644 board/loongson/ls1c300-eval/MAINTAINERS
  create mode 100644 board/loongson/ls1c300-eval/Makefile
  create mode 100644 board/loongson/ls1c300-eval/board.c
  create mode 100644 configs/ls1c300_defconfig
  create mode 100644 drivers/clk/lsmips/Makefile
  create mode 100644 drivers/clk/lsmips/clk-ls1c300.c
  create mode 100644 drivers/watchdog/lsmips_wdt.c
  create mode 100644 include/configs/ls1c300.h
  create mode 100644 include/dt-bindings/clock/ls1c300-clk.h


I'm mainly going to comment on clocks becuase you asked me about that,
but note that this should all be split up into several commits, one
per driver/subsystem.

You will also need some kind of entry in doc/boards.


diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 28234aa0bb..d95868ef4b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -93,6 +93,30 @@ config ARCH_MTMIPS
select SUPPORTS_LITTLE_ENDIAN
select SUPPORT_SPL
  
+config ARCH_LSMIPS

+   bool "Support Loongson MIPS platforms"
+   select CLK
+   imply CMD_DM
+   select DISPLAY_CPUINFO
+   select DM
+

[PATCH] [PATCH] sunxi-nand: Undo removal of DMA that breaks NAND SPL

2022-03-30 Thread Chris Morgan
From: Chris Morgan 

For the sun5i based NAND, removal of the DMA specific code from the SPL
driver caused it to no longer function.

These patches revert the changes made here, specifically patches 13/20
and 14/20:
https://lore.kernel.org/u-boot/20210624120540.7oyhdmerjndsylbq@gilmour/

These patches only apply for sun5i based boards. Tested on my NTC CHIP
(an R8/A13 based device) and it is able to boot U-Boot properly with
these patches.

Signed-off-by: Chris Morgan 
---
 board/sunxi/board.c   |   3 +
 drivers/mtd/nand/raw/sunxi_nand_spl.c | 105 ++
 2 files changed, 108 insertions(+)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 28f702bc29..289f568415 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -393,6 +393,9 @@ static void nand_clock_setup(void)
 #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I || \
 defined CONFIG_MACH_SUN9I || defined CONFIG_MACH_SUN50I
setbits_le32(>ahb_reset0_cfg, (1 << AHB_GATE_OFFSET_NAND0));
+#endif
+#if defined(CONFIG_MACH_SUN5I) && defined(CONFIG_NAND_SUNXI)
+   setbits_le32(>ahb_gate0, (1 << AHB_GATE_OFFSET_DMA));
 #endif
setbits_le32(>nand0_clk_cfg, CCM_NAND_CTRL_ENABLE | AHB_DIV_1);
 }
diff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c 
b/drivers/mtd/nand/raw/sunxi_nand_spl.c
index a29a76c58d..1b2c995803 100644
--- a/drivers/mtd/nand/raw/sunxi_nand_spl.c
+++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* registers */
@@ -85,6 +86,22 @@
 #define NFC_CMD_RNDOUT 0x05
 #define NFC_CMD_READSTART  0x30
 
+#define SUNXI_DMA_CFG_REG0  0x300
+#define SUNXI_DMA_SRC_START_ADDR_REG0   0x304
+#define SUNXI_DMA_DEST_START_ADDRR_REG0 0x308
+#define SUNXI_DMA_DDMA_BC_REG0  0x30C
+#define SUNXI_DMA_DDMA_PARA_REG00x318
+
+#define SUNXI_DMA_DDMA_CFG_REG_LOADING  (1 << 31)
+#define SUNXI_DMA_DDMA_CFG_REG_DMA_DEST_DATA_WIDTH_32 (2 << 25)
+#define SUNXI_DMA_DDMA_CFG_REG_DDMA_DST_DRQ_TYPE_DRAM (1 << 16)
+#define SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_DATA_WIDTH_32 (2 << 9)
+#define SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_ADDR_MODE_IO (1 << 5)
+#define SUNXI_DMA_DDMA_CFG_REG_DDMA_SRC_DRQ_TYPE_NFC (3 << 0)
+
+#define SUNXI_DMA_DDMA_PARA_REG_SRC_WAIT_CYC (0x0F << 0)
+#define SUNXI_DMA_DDMA_PARA_REG_SRC_BLK_SIZE (0x7F << 8)
+
 struct nfc_config {
int page_size;
int ecc_strength;
@@ -254,6 +271,93 @@ static int nand_change_column(u16 column)
 
 static const int ecc_bytes[] = {32, 46, 54, 60, 74, 88, 102, 110, 116};
 
+#if defined(CONFIG_MACH_SUN5I)
+static int nand_read_page(const struct nfc_config *conf, u32 offs,
+ void *dest, int len)
+{
+   dma_addr_t dst = (dma_addr_t)dest;
+   int nsectors = len / conf->ecc_size;
+   u16 rand_seed = 0;
+   u32 val;
+   int page;
+
+   page = offs / conf->page_size;
+
+   if (offs % conf->page_size || len % conf->ecc_size ||
+   len > conf->page_size || len < 0)
+   return -EINVAL;
+
+   /* clear ecc status */
+   writel(0, SUNXI_NFC_BASE + NFC_ECC_ST);
+
+   /* Choose correct seed if randomized */
+   if (conf->randomize)
+   rand_seed = random_seed[page % conf->nseeds];
+
+   writel((rand_seed << 16) | (conf->ecc_strength << 12) |
+   (conf->randomize ? NFC_ECC_RANDOM_EN : 0) |
+   (conf->ecc_size == 512 ? NFC_ECC_BLOCK_SIZE : 0) |
+   NFC_ECC_EN | NFC_ECC_PIPELINE | NFC_ECC_EXCEPTION,
+   SUNXI_NFC_BASE + NFC_ECC_CTL);
+
+   flush_dcache_range(dst, ALIGN(dst + conf->ecc_size, ARCH_DMA_MINALIGN));
+
+   /* SUNXI_DMA */
+   writel(0x0, SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0); /* clr dma cmd */
+   /* read from REG_IO_DATA */
+   writel(SUNXI_NFC_BASE + NFC_IO_DATA,
+  SUNXI_DMA_BASE + SUNXI_DMA_SRC_START_ADDR_REG0);
+   /* read to RAM */
+   writel(dst, SUNXI_DMA_BASE + SUNXI_DMA_DEST_START_ADDRR_REG0);
+   writel(SUNXI_DMA_DDMA_PARA_REG_SRC_WAIT_CYC |
+  SUNXI_DMA_DDMA_PARA_REG_SRC_BLK_SIZE,
+  SUNXI_DMA_BASE + SUNXI_DMA_DDMA_PARA_REG0);
+   writel(len, SUNXI_DMA_BASE + SUNXI_DMA_DDMA_BC_REG0);
+   writel(SUNXI_DMA_DDMA_CFG_REG_LOADING |
+  SUNXI_DMA_DDMA_CFG_REG_DMA_DEST_DATA_WIDTH_32 |
+  SUNXI_DMA_DDMA_CFG_REG_DDMA_DST_DRQ_TYPE_DRAM |
+  SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_DATA_WIDTH_32 |
+  SUNXI_DMA_DDMA_CFG_REG_DMA_SRC_ADDR_MODE_IO |
+  SUNXI_DMA_DDMA_CFG_REG_DDMA_SRC_DRQ_TYPE_NFC,
+  SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0);
+
+   writel(nsectors, SUNXI_NFC_BASE + NFC_SECTOR_NUM);
+   writel(NFC_ST_DMA_INT_FLAG, SUNXI_NFC_BASE + NFC_ST);
+   writel(NFC_DATA_TRANS | NFC_PAGE_CMD | NFC_DATA_SWAP_METHOD,
+  SUNXI_NFC_BASE + NFC_CMD);
+
+   if (!check_value(SUNXI_NFC_BASE + NFC_ST, NFC_ST_DMA_INT_FLAG,
+

[PATCH] imx8m{m,n}-venice-gw7902: add support for GPY111 phy

2022-03-30 Thread Tim Harvey
The TI DP83867 phy has been replaced with the MaxLinear GPY111 phy
due to part availability. Add support for it:
 - increase post-reset time to 300ms per datasheet
 - add tx-delay/rx-delay config

Signed-off-by: Tim Harvey 
---
 arch/arm/dts/imx8mm-venice-gw7902-u-boot.dtsi | 2 +-
 arch/arm/dts/imx8mm-venice-gw7902.dts | 4 
 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi | 2 +-
 arch/arm/dts/imx8mn-venice-gw7902.dts | 4 
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/imx8mm-venice-gw7902-u-boot.dtsi 
b/arch/arm/dts/imx8mm-venice-gw7902-u-boot.dtsi
index 1e1769f55127..f21e46b12dd7 100644
--- a/arch/arm/dts/imx8mm-venice-gw7902-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-venice-gw7902-u-boot.dtsi
@@ -158,7 +158,7 @@
  {
phy-reset-gpios = < 10 GPIO_ACTIVE_LOW>;
phy-reset-duration = <1>;
-   phy-reset-post-delay = <1>;
+   phy-reset-post-delay = <300>;
 };
 
 _fec1 {
diff --git a/arch/arm/dts/imx8mm-venice-gw7902.dts 
b/arch/arm/dts/imx8mm-venice-gw7902.dts
index adf521632d63..b0404ec4c8af 100644
--- a/arch/arm/dts/imx8mm-venice-gw7902.dts
+++ b/arch/arm/dts/imx8mm-venice-gw7902.dts
@@ -243,10 +243,14 @@
ethphy0: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
+   /* TI DP83867 props */
ti,rx-internal-delay = ;
ti,tx-internal-delay = ;
tx-fifo-depth = ;
rx-fifo-depth = ;
+   /* GPY111 props */
+   rx-internal-delay-ps = <2000>;
+   tx-internal-delay-ps = <2500>;
};
};
 };
diff --git a/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi 
b/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
index 9431e2a6cde7..17e6828c79f8 100644
--- a/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
+++ b/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
@@ -116,7 +116,7 @@
  {
phy-reset-gpios = < 10 GPIO_ACTIVE_LOW>;
phy-reset-duration = <1>;
-   phy-reset-post-delay = <1>;
+   phy-reset-post-delay = <300>;
 };
 
 _fec1 {
diff --git a/arch/arm/dts/imx8mn-venice-gw7902.dts 
b/arch/arm/dts/imx8mn-venice-gw7902.dts
index 29897c161b96..d026d965580e 100644
--- a/arch/arm/dts/imx8mn-venice-gw7902.dts
+++ b/arch/arm/dts/imx8mn-venice-gw7902.dts
@@ -242,10 +242,14 @@
ethphy0: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
+   /* TI DP83867 props */
ti,rx-internal-delay = ;
ti,tx-internal-delay = ;
tx-fifo-depth = ;
rx-fifo-depth = ;
+   /* GPY111 props */
+   rx-internal-delay-ps = <2000>;
+   tx-internal-delay-ps = <2500>;
};
};
 };
-- 
2.17.1



[PATCH v2] board: gateworks: venice: determine dram size at runtime

2022-03-30 Thread Tim Harvey
The SPL does not update the memory node with the dram size from EEPROM
but instead we can use get_ram_size which does a simple memory test
to determine the available RAM. Update PHYS_SDRAM_SIZE to 4GiB as that
is the max used on the Venice boards.

Signed-off-by: Tim Harvey 
Reviewed-by: Fabio Estevam 
---
v2:
 - bump PHYS_SDRAM_SIZE for imx8mn_venice to account for boards that
   have more than 1GiB of DRAM
 - added Fabio's rb tag
---
 board/gateworks/venice/venice.c | 13 ++---
 include/configs/imx8mm_venice.h |  2 +-
 include/configs/imx8mn_venice.h |  2 +-
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c
index 4e05802b6ff1..5334500ef6a7 100644
--- a/board/gateworks/venice/venice.c
+++ b/board/gateworks/venice/venice.c
@@ -21,19 +21,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_phys_sdram_size(phys_size_t *size)
 {
-   const fdt64_t *val;
-   int offset;
-   int len;
-
-   /* get size from dt which SPL updated per EEPROM config */
-   offset = fdt_path_offset(gd->fdt_blob, "/memory");
-   if (offset < 0)
+   if (!size)
return -EINVAL;
 
-   val = fdt_getprop(gd->fdt_blob, offset, "reg", );
-   if (len < sizeof(*val) * 2)
-   return -EINVAL;
-   *size = get_unaligned_be64([1]);
+   *size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
 
return 0;
 }
diff --git a/include/configs/imx8mm_venice.h b/include/configs/imx8mm_venice.h
index 1ec27f40f2b5..a3649702e955 100644
--- a/include/configs/imx8mm_venice.h
+++ b/include/configs/imx8mm_venice.h
@@ -83,7 +83,7 @@
 
 /* SDRAM configuration */
 #define PHYS_SDRAM  0x4000
-#define PHYS_SDRAM_SIZESZ_1G /* 1GB DDR */
+#define PHYS_SDRAM_SIZESZ_4G
 #define CONFIG_SYS_BOOTM_LEN   SZ_256M
 
 /* UART */
diff --git a/include/configs/imx8mn_venice.h b/include/configs/imx8mn_venice.h
index c01a590c8af6..c68cc96a7300 100644
--- a/include/configs/imx8mn_venice.h
+++ b/include/configs/imx8mn_venice.h
@@ -80,7 +80,7 @@
 
 /* SDRAM configuration */
 #define PHYS_SDRAM  0x4000
-#define PHYS_SDRAM_SIZESZ_1G
+#define PHYS_SDRAM_SIZESZ_4G
 #define CONFIG_SYS_BOOTM_LEN   SZ_256M
 
 /* UART */
-- 
2.17.1



Re: [PATCH] efi_loader (v2): Expose relocated address for gdb debugging purposes

2022-03-30 Thread Heinrich Schuchardt




On 3/24/22 20:00, Alexander von Gluck IV wrote:

* If users want to debug EFI applications via qemu + GDB, they
   need to know the relocated address of the application to
   align their symbols to in GDB via add-symbol-file.
* This exposes where EFI applications are relocated to enable
   debugging EFI applications via qemu + gdb
* Usage is generally determining the address, then
   add-symbol-file (efi loader) (address)
* The address can change, but is generally consistent with
   the same qemu version and u-boot binary. (allowing you to
   boot once, find the address, then reboot with qemu -s -S
---
  include/efi_loader.h  | 3 +++
  lib/efi_loader/efi_boottime.c | 1 +
  lib/efi_loader/efi_image_loader.c | 3 +++
  3 files changed, 7 insertions(+)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index f4860e87fc..2ca2bf3adb 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -403,6 +403,7 @@ enum efi_image_auth_status {
   * @exit_data_size:   exit data size passed to Exit()
   * @exit_data:exit data passed to Exit()
   * @exit_jmp: long jump buffer for returning from started image
+ * @reloc_addr:relocated address of the image
   * @entry:entry address of the relocated image
   * @image_type:   indicates if the image is an applicition or a 
driver
   * @auth_status:  indicates if the image is authenticated
@@ -413,6 +414,8 @@ struct efi_loaded_image_obj {
efi_uintn_t *exit_data_size;
u16 **exit_data;
struct jmp_buf_data *exit_jmp;
+
+   u64 reloc_addr;
EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
 struct efi_system_table *st);
u16 image_type;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 20b69699fe..6fac8c576e 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -3057,6 +3057,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t 
image_handle,
  
  	current_image = image_handle;

image_obj->header.type = EFI_OBJECT_TYPE_STARTED_IMAGE;
+   log_info("EFI image relocated to 0x%llx\n", image_obj->reloc_addr);


This will mess up the output in menu driven EFI applications like SCT.

Best regards

Heinrich


EFI_PRINT("Jumping into 0x%p\n", image_obj->entry);
ret = EFI_CALL(image_obj->entry(image_handle, ));
  
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c

index 773bd0677c..65e5b7e40b 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -906,6 +906,7 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj 
*handle,
ret = EFI_OUT_OF_RESOURCES;
goto err;
}
+   handle->reloc_addr = (u64)efi_reloc;
handle->entry = efi_reloc + opt->AddressOfEntryPoint;
rel_size = opt->DataDirectory[rel_idx].Size;
rel = efi_reloc + opt->DataDirectory[rel_idx].VirtualAddress;
@@ -922,6 +923,8 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj 
*handle,
ret = EFI_OUT_OF_RESOURCES;
goto err;
}
+
+   handle->reloc_addr = (u64)efi_reloc;
handle->entry = efi_reloc + opt->AddressOfEntryPoint;
rel_size = opt->DataDirectory[rel_idx].Size;
rel = efi_reloc + opt->DataDirectory[rel_idx].VirtualAddress;


[PATCH] Makefile: add endian link flag to u-boot-elf.o

2022-03-30 Thread Du Huanpeng
From: Du Huanpeng 

fix compile error when using a little-endian to build with configs:
sfr_nb4-ser_ram_defconfig
comtrend_wap5813n_ram_defconfig
comtrend_ar5387un_ram_defconfig
comtrend_ct5361_ram_defconfig
comtrend_vr3032u_ram_defconfig
comtrend_ar5315u_ram_defconfig
huawei_hg556a_ram_defconfig
netgear_dgnd3700v2_ram_defconfig

Signed-off-by: Du Huanpeng 
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 699834..5007307f23 100644
--- a/Makefile
+++ b/Makefile
@@ -1700,6 +1700,7 @@ u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin 
FORCE
 
 quiet_cmd_u-boot-elf ?= LD  $@
cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
+   $(if $(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) \
-T u-boot-elf.lds 
--defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
 u-boot.elf: u-boot.bin u-boot-elf.lds
-- 
2.32.0



Re: [PATCH 3/3] doc: usage: Convert README.plan9 to reST

2022-03-30 Thread Heinrich Schuchardt




On 3/29/22 19:11, Heinrich Schuchardt wrote:

On 3/28/22 04:43, Bin Meng wrote:

This converts the existing README.plan9 to reST, and puts it under
the doc/usage/os directory.

Signed-off-by: Bin Meng 
---

  doc/usage/index.rst  |  1 +
  doc/{README.plan9 => usage/os/plan9.rst} | 12 
  2 files changed, 9 insertions(+), 4 deletions(-)
  rename doc/{README.plan9 => usage/os/plan9.rst} (89%)

diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index b8916971bc..ecb4908fd1 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -59,4 +59,5 @@ Booting OS
  .. toctree::
 :maxdepth: 1
+   os/plan9
 os/vxworks
diff --git a/doc/README.plan9 b/doc/usage/os/plan9.rst
similarity index 89%
rename from doc/README.plan9
rename to doc/usage/os/plan9.rst
index 2d3d0e0cf6..f91712c009 100644
--- a/doc/README.plan9
+++ b/doc/usage/os/plan9.rst
@@ -1,3 +1,10 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Steven Stallion
+.. June 2013
+
+Plan 9
+==
+
  Plan 9 from Bell Labs kernel images require additional setup to pass


Does U-Boot support any hardware that Plan 9 supports?


https://p9f.org/magic/man2html/8/booting describes the Raspberry Pi and
OMAP3 as supported by Plan 9.

http://9p.io/sources/contrib/miller/9pi.img.gz
is meant to be an image for the Raspberry Pi. See description at
https://bendyworks.com/blog/getting-plan-9-running-on-the-raspberry-pi

So let's keep this document.

Reviewed-by: Heinrich Schuchardt 



Or can we simply drop this document?


  configuration information to the kernel.  An environment variable named
  confaddr must be defined with the same value as CONFADDR (see mem.h).
@@ -10,9 +17,6 @@ bootargs environment variable will be copied.
  If no command line arguments or bootargs are defined, CONFADDR is left
  uninitialized to permit manual configuration.  For example, PC-style
-configuration could be simulated by issuing a fatload in bootcmd:
+configuration could be simulated by issuing a fatload in bootcmd::
    # setenv bootcmd fatload mmc 0 $confaddr plan9.ini; ...; bootm


Is this prompt correct?
I cannot find any defconfig where CONFIG_SYS_PROMPT="# ".

Best regards

Heinrich


-
-Steven Stallion
-June 2013




Please pull clk-2022.04-next

2022-03-30 Thread Sean Anderson

The following changes since commit d2e5250be49fce4653689c41a5dc7e2d7e7ecf33:

  Merge tag 'next-20220328' of 
https://source.denx.de/u-boot/custodians/u-boot-video into next (2022-03-28 
17:04:45 -0400)

are available in the Git repository at:

  g...@source.denx.de:u-boot/custodians/u-boot-clk.git tags/clk-2022.04-next

for you to fetch changes up to 682e73d23555afdd733c20810d282d9cc2bc0e0f:

  clk: Use generic CCF ops where possible (2022-03-30 14:18:56 -0400)


Clock patches for u-boot/next

This is mostly cleanups/consolidations. clk_free is made to return void, and the
CCF wrappers present in almost every CCF clock are consolidated. I would
particularly like to have the latter upstream, since there are at least two
series adding support for new CCF drivers (imx8mq and imxrt1170) which can
benefit from these commits.

I had to fix up the last commit since I missed an include for at91.

CI: https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/11521


Sean Anderson (10):
  clk: Make rfree return void
  dma: bcm6348: Don't check clk_free
  net: bcm63xx: Don't check clk_free
  phy: bcm63xx: Don't check clk_free
  spi: bcm63xx: Don't check clk_free
  spi: dw: Don't check clk_free
  clk: Make clk_free return void
  clk: Consolidate some clock functions
  clk: ccf: Add some helper functions for clock ops
  clk: Use generic CCF ops where possible

 drivers/clk/at91/pmc.c   | 57 +++--
 drivers/clk/clk-uclass.c | 37 -
 drivers/clk/clk.c| 65 +
 drivers/clk/clk_sandbox.c|  6 +--
 drivers/clk/clk_sandbox_test.c   |  9 ++--
 drivers/clk/imx/clk-imx6q.c  | 73 
 drivers/clk/imx/clk-imx8mm.c | 88 +--
 drivers/clk/imx/clk-imx8mn.c | 88 +--
 drivers/clk/imx/clk-imx8mp.c | 90 +---
 drivers/clk/imx/clk-imxrt1020.c  | 65 ++---
 drivers/clk/imx/clk-imxrt1050.c  | 85 +
 drivers/clk/microchip/mpfs_clk.c | 67 +-
 drivers/dma/bcm6348-iudma.c  |  6 +--
 drivers/net/bcm6348-eth.c|  6 +--
 drivers/net/bcm6368-eth.c|  6 +--
 drivers/phy/bcm6318-usbh-phy.c   |  4 +-
 drivers/phy/bcm6348-usbh-phy.c   |  4 +-
 drivers/phy/bcm6368-usbh-phy.c   |  8 +---
 drivers/spi/bcm63xx_hsspi.c  |  8 +---
 drivers/spi/bcm63xx_spi.c|  4 +-
 drivers/spi/designware_spi.c |  2 +-
 include/clk-uclass.h |  8 ++--
 include/clk.h|  8 ++--
 include/linux/clk-provider.h |  8 
 24 files changed, 127 insertions(+), 675 deletions(-)


Re: [PATCH 0/7] clk: Make clk_free return void

2022-03-30 Thread Sean Anderson
On Sat, 15 Jan 2022 17:24:57 -0500, Sean Anderson wrote:
> clk_free cleans up resources allocated by clk_request et. al. It returns an
> error code, but it really shouldn't. Much like regular free(), there is
> typically no way to handle an error, and errors from clk_free shouldn't 
> prevent
> progress in the rest of the program. Make clk_free (and rfree) return void.
> 
> 
> Sean Anderson (7):
>   clk: Make rfree return void
>   dma: bcm6348: Don't check clk_free
>   net: bcm63xx: Don't check clk_free
>   phy: bcm63xx: Don't check clk_free
>   spi: bcm63xx: Don't check clk_free
>   spi: dw: Don't check clk_free
>   clk: Make clk_free return void
> 
> [...]

Applied, thanks!

[1/7] clk: Make rfree return void
  commit: 276d446757e462c210768eb0bbd48450ae254f51
[2/7] dma: bcm6348: Don't check clk_free
  commit: 454af567edc0b02842c83aaf1a60bbcb766af0cd
[3/7] net: bcm63xx: Don't check clk_free
  commit: b2e0889abacfd453131359156fe279996727d95b
[4/7] phy: bcm63xx: Don't check clk_free
  commit: ad20358c7462159d5f9012facba9dec1e197aaca
[5/7] spi: bcm63xx: Don't check clk_free
  commit: dfdb227c3d018983f37cc97fe003e231a81a46ea
[6/7] spi: dw: Don't check clk_free
  commit: 3cbdd4cab951b8bd3f2e76066e6911f9780c4eb1
[7/7] clk: Make clk_free return void
  commit: ac15e789caecec19d29ee9c5869305d3c3ddfb42

Best regards,
-- 
Sean Anderson 


Re: [PATCH] clk: Consolidate some clock functions

2022-03-30 Thread Sean Anderson
On Sun, 27 Feb 2022 14:01:13 -0500, Sean Anderson wrote:
> These functions are exactly the same as their "nodev" varients, except they
> accept a device and not an ofnode. Rewrite them to just call the other
> function.
> 
> 

Applied, thanks!

[1/1] clk: Consolidate some clock functions
  commit: e7075ff7b3dce82e4fd6246b87f3c44fabf6323b

Best regards,
-- 
Sean Anderson 


Re: [PATCH 1/2] clk: ccf: Add some helper functions for clock ops

2022-03-30 Thread Sean Anderson
On Sun, 20 Mar 2022 16:34:45 -0400, Sean Anderson wrote:
> Most CCF drivers follow a common pattern where their clock ops defer the
> actual operation to the backing CCF clock. Add some generic implementations
> of these functions to reduce duplication of code.
> 
> 

Applied, thanks!

[1/2] clk: ccf: Add some helper functions for clock ops
  commit: 3a11b5ae65c269ef9f7bb1e18826e85fc164f161
[2/2] clk: Use generic CCF ops where possible
  commit: 47ac74e4eb7bc920573a7cf59275b48fe8500482

Best regards,
-- 
Sean Anderson 


Re: [PATCH 2/2] clk: Use generic CCF ops where possible

2022-03-30 Thread Sean Anderson

On 3/20/22 4:34 PM, Sean Anderson wrote:

This converts most CCF drivers to use generic ops. imx6q is the only
outlier, where we retain the existing functionality by moving the check to
request().

Signed-off-by: Sean Anderson 
---

  drivers/clk/at91/pmc.c   | 56 ++--
  drivers/clk/imx/clk-imx6q.c  | 73 +++---
  drivers/clk/imx/clk-imx8mm.c | 88 +--
  drivers/clk/imx/clk-imx8mn.c | 88 +--
  drivers/clk/imx/clk-imx8mp.c | 90 +---
  drivers/clk/imx/clk-imxrt1020.c  | 65 ++-
  drivers/clk/imx/clk-imxrt1050.c  | 85 +-
  drivers/clk/microchip/mpfs_clk.c | 67 +---
  8 files changed, 21 insertions(+), 591 deletions(-)

diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 1fa42d728b..58bf1047b5 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c


This driver needs to #include 

I've added this while applying.

--Sean


Re: [PATCH v1 1/1] efi_loader: initrddump: Actually use the custom CFLAGS

2022-03-30 Thread Heinrich Schuchardt

On 3/30/22 11:14, Andy Shevchenko wrote:

It seems a copy'n'paste typo when tool had been introduced.
It has never had the 'exit' suffix in the file name. Hence,
the custom CFLAGS never been applied and, for example, BFD
linker complains:

   LD  lib/efi_loader/initrddump_efi.so
   ld.bfd: lib/efi_loader/initrddump.o: warning: relocation in read-only 
section `.text.efi_main'
   ld.bfd: warning: creating DT_TEXTREL in a shared object

Remove wrong 'exit' suffix from the custom CFLAGS variable.

Fixes: 65ab48d69ddb ("efi_selftest: provide initrddump test tool")
Signed-off-by: Andy Shevchenko 


Reviewed-by: Heinrich Schuchardt 


---
  lib/efi_loader/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index befed7144e78..034d26cf0109 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -16,7 +16,7 @@ CFLAGS_helloworld.o := $(CFLAGS_EFI) -Os -ffreestanding
  CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
  CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding
  CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI)
-CFLAGS_initrddump_exit.o := $(CFLAGS_EFI) -Os -ffreestanding
+CFLAGS_initrddump.o := $(CFLAGS_EFI) -Os -ffreestanding
  CFLAGS_REMOVE_initrddump.o := $(CFLAGS_NON_EFI)

  ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)




Re: [PATCH v4 06/11] efi_loader: bootmgr: add booting from removable media

2022-03-30 Thread Ilias Apalodimas
Hello Akashi-san,

On Thu, Mar 24, 2022 at 10:54:38PM +0900, Masahisa Kojima wrote:
> From: AKASHI Takahiro 
> 
> Under the current implementation, booting from removable media using
> a architecture-specific default image name, say BOOTAA64.EFI, is
> supported only in distro_bootcmd script. See the commit 74522c898b35
> ("efi_loader: Add distro boot script for removable media").
> 
> This is, however, half-baked implementation because
> 1) UEFI specification requires this feature to be implemented as part
>of Boot Manager's responsibility:
> 
>   3 - Boot Manager
>   3.5.1 Boot via the Simple File Protocol
>   When booting via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, the FilePath will
>   start with a device path that points to the device that implements the
>   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the EFI_BLOCK_IO_PROTOCOL. The next
>   part of the FilePath may point to the file name, including
>   subdirectories, which contain the bootable image. If the file name is
>   a null device path, the file name must be generated from the rules
>   defined below.
>   ...
>   3.5.1.1 Removable Media Boot Behavior
>   To generate a file name when none is present in the FilePath, the
>   firmware must append a default file name in the form
>   \EFI\BOOT\BOOT{machine type short-name}.EFI ...
> 
> 2) So (1) entails the hehavior that the user's preference of boot media
>order should be determined by Boot and BootOrder variables.
> 
> With this patch, the semantics mentioned above is fully implemented.
> For example, if you want to boot the system from USB and SCSI in this
> order,
> * define Boot0001 which contains only a device path to the USB device
>   (without any file path/name)
> * define Boot0002 which contains only a device path to the SCSI device,
> and
> * set BootOrder to Boot0001:Boot0002

Mark had some concerns wrt to this approach and from what I can tell this
hasn't changed in this revision [1]. Can we use boot_targets and generate
Boot with an empty FilePath as Mark suggested?  Or is the user expected to
select that somehow from the menu?

[1] https://lore.kernel.org/u-boot/d3cac2e5b37f9...@bloch.sibelius.xs4all.nl/

Thanks
/Ilias
> 
> Signed-off-by: AKASHI Takahiro 
> Signed-off-by: Masahisa Kojima 
> ---
> Changes from original version:
> - create new include file "efi_default_filename.h" to
>   avoid conflict with config_distro_bootcmd.h
> - modify the target pointer of efi_free_pool(), expand_media_path() should
>   only free the pointer allocated by efi_dp_from_file() function.
> 
>  include/config_distro_bootcmd.h | 14 +
>  include/efi_default_filename.h  | 26 +
>  lib/efi_loader/efi_bootmgr.c| 50 -
>  3 files changed, 76 insertions(+), 14 deletions(-)
>  create mode 100644 include/efi_default_filename.h
> 
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index 2f90929178..ef2c9f330e 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -91,19 +91,7 @@
>  #endif
>  
>  #ifdef CONFIG_EFI_LOADER
> -#if defined(CONFIG_ARM64)
> -#define BOOTEFI_NAME "bootaa64.efi"
> -#elif defined(CONFIG_ARM)
> -#define BOOTEFI_NAME "bootarm.efi"
> -#elif defined(CONFIG_X86_RUN_32BIT)
> -#define BOOTEFI_NAME "bootia32.efi"
> -#elif defined(CONFIG_X86_RUN_64BIT)
> -#define BOOTEFI_NAME "bootx64.efi"
> -#elif defined(CONFIG_ARCH_RV32I)
> -#define BOOTEFI_NAME "bootriscv32.efi"
> -#elif defined(CONFIG_ARCH_RV64I)
> -#define BOOTEFI_NAME "bootriscv64.efi"
> -#endif
> +#include 
>  #endif
>  
>  #ifdef BOOTEFI_NAME
> diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h
> new file mode 100644
> index 00..de030d2692
> --- /dev/null
> +++ b/include/efi_default_filename.h
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Default boot file name when none is present in the FilePath.
> + *
> + * Copyright (c) 2022, Linaro Limited
> + */
> +#ifndef _EFI_DEFAULT_FILENAME_H
> +#define _EFI_DEFAULT_FILENAME_H
> +
> +#if defined(CONFIG_ARM64)
> +#define BOOTEFI_NAME "BOOTAA64.EFI"
> +#elif defined(CONFIG_ARM)
> +#define BOOTEFI_NAME "BOOTARM.EFI"
> +#elif defined(CONFIG_X86_64)
> +#define BOOTEFI_NAME "BOOTX64.EFI"
> +#elif defined(CONFIG_X86)
> +#define BOOTEFI_NAME "BOOTIA32.EFI"
> +#elif defined(CONFIG_ARCH_RV32I)
> +#define BOOTEFI_NAME "BOOTRISCV32.EFI"
> +#elif defined(CONFIG_ARCH_RV64I)
> +#define BOOTEFI_NAME "BOOTRISCV64.EFI"
> +#else
> +#error Unsupported UEFI architecture
> +#endif
> +
> +#endif
> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> index 8c04ecbdc8..22a4302aac 100644
> --- a/lib/efi_loader/efi_bootmgr.c
> +++ b/lib/efi_loader/efi_bootmgr.c
> @@ -11,6 +11,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -30,6 +31,50 @@ static const struct efi_runtime_services *rs;
>   * should do normal or recovery boot.
>   */
>  
> +/**
> + * 

Re: [PATCH v3 0/3] malloc: Enable profiling dlmalloc with valgrind

2022-03-30 Thread Sean Anderson

Hi all,

On 3/23/22 2:04 PM, Sean Anderson wrote:

This series adds support for running valgrind against U-Boot's internal
malloc. This allows for much more useful reports to be generated.

Some example output of valgrind run against u-boot/master with this branch
applied may be found at [1]. Note that valgrind gives up around acpi. This
feature still needs a lot of work on suppressions/hints to filter out the noise
properly.

[1] 
https://gist.githubusercontent.com/Forty-Bot/199bf06f9cdd6871e54f8f484c16e111/raw/2a2f99108eef84b48e27a54332f3f71f4e2e5342/gistfile1.txt


This is a bit of a follow up to the above. Over the past week I've sent

a few patches [1-4] with various bugs found with valgrind. Hopefully

this gives a good idea of the kind of problems valgrind is equipped to

find. In particular, it is good at determining where we go past the end

of buffers or otherwise read uninitialized memory.



I've also discovered why I originally stopped working on this series:

supressions don't "un-taint" uninitialized memory accesses. Currently, I

have dlmalloc's reads its bookkeeping information marked as a "red

zone." This means that all reads to it are marked as illegal by

valgrind. This is fine for regular code, but dlmalloc really does need

to access this area, so we suppress its violations. However, if dlmalloc

then passes a result calculated from a "tainted" access, that result is

still tainted. So the first accessor will raise a warning. This means

that every construct like



foo = malloc(sizeof(*foo));

if (!foo)

return -ENOMEM;



will raise a warning when we check the result of malloc. Whoops.



There are three ways (as I see it) to address this:



- Don't mark dlmalloc bookkeeping information as a red zone. This is the

  simplest solution, but reduces the power of valgrind immensely, since

  we can no longer determine that (e.g.) access past the end of an array

  is undefined.

- Implement red zones properly. This would involve growing every

  allocation by a fixed amount (16 bytes or so) and then using that

  extra space for a real red zone that neither regular code nor dlmalloc

  needs to access. Unfortunately, this would probably some fairly

  intensive surgery to dlmalloc to add/remove the offset appropriately.

- Mark bookkeeping information as valid before we use it in dlmalloc,

  and then mark it invalid before returning. This would be the most

  correct, but it would be very tricky to implement since there are so

  many code paths to mark. I think it would be the most effort out of

  the three options here.



Until one of the above options are implemented, it will remain difficult

to sift through the massive amount of spurious warnings.



That said, if anyone wants to play around with this a bit, I have some

additional invocation suggestions which I have been using, but which are

not documented



- "--error-limit=no" will enable printing more than 1000 errors in a

  single session.

- "--vgdb=yes --vgdb-error=0" will let you use gdb to attach like



gdb -ex "target remote | vgdb" u-boot



   This is very helpful for inspecting the program state when there is

   an error.

- "t cooked" to U-Boot will keep the console in a sane state if you

  terminate it early (instead of having to run tset).



The above should probably be documented in patch 3. I will add it if I

do a v4 (or I will send a follow-up).



--Sean



[1] https://patchwork.ozlabs.org/project/uboot/list/?series=291719

[2] https://patchwork.ozlabs.org/project/uboot/list/?series=291739

[3] https://patchwork.ozlabs.org/project/uboot/list/?series=292710

[4] https://patchwork.ozlabs.org/project/uboot/list/?series=292712


Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson

On 3/30/22 1:13 PM, Andy Shevchenko wrote:

On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:

Also I don't like to have workarounds for the broken tools.
But if you still want to have something, what about rather this


  #define for_each_console_dev(i, file, dev) \
-   for (i = 0, dev = console_devices[file][i]; \
-i < cd_count[file];\
-i++, dev = console_devices[file][i])
+   for (i = 0; i < cd_count[file] &&   \
+   (dev = console_devices[file][i]); i++)


for (i = 0, dev = console_devices[file][0]; \
 i < cd_count[file];\
 i++, dev = console_devices[file][i])

?

Or if it's still complains

for (i = 0, dev = cd_count[file] ? console_devices[file][0] : NULL; 
\
 i < cd_count[file];\
 i++, dev = console_devices[file][i])

?



The problem is not the first assignment but the last. Consider the case when 
cd_count[file] = 1

i = 0, dev = console_devices[file][0]; // OK
i < cd_count[file] // 0 < 1
// loop body
i++, dev = console_devices[file][1] // Oops, past the end
i < cd_count[file] // 1 < 1, loop exit

--Sean


Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:

Also I don't like to have workarounds for the broken tools.
But if you still want to have something, what about rather this

>  #define for_each_console_dev(i, file, dev) \
> -   for (i = 0, dev = console_devices[file][i]; \
> -i < cd_count[file];\
> -i++, dev = console_devices[file][i])
> +   for (i = 0; i < cd_count[file] &&   \
> +   (dev = console_devices[file][i]); i++)

   for (i = 0, dev = console_devices[file][0]; \
i < cd_count[file];\
i++, dev = console_devices[file][i])

?

Or if it's still complains

   for (i = 0, dev = cd_count[file] ? console_devices[file][0] : NULL; \
i < cd_count[file];\
i++, dev = console_devices[file][i])

?

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson

On 3/30/22 1:07 PM, Andy Shevchenko wrote:

On Wed, Mar 30, 2022 at 8:01 PM Andy Shevchenko
 wrote:

On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:


...


  #define for_each_console_dev(i, file, dev) \
-   for (i = 0, dev = console_devices[file][i]; \


When we enter the loop, the dev is assigned and perhaps valid


-i < cd_count[file];\
-i++, dev = console_devices[file][i])
+   for (i = 0; i < cd_count[file] &&   \


Not the case anymore.


+   (dev = console_devices[file][i]); i++)


On the second look, it seems a bit unusual, but for loop checks the
condition before entering and in such case the dev will be assigned if
the count is greater than 0.
So, basically the difference is that dev is left completely
uninitialized in case of count==0. However, it may not be a problem.


Well, in such a case, the value of console_devices[file][i] is bogus
anyway, so stack garbage is just as good.

If it turns out to be a problem, this can always be rewritten to

for (i = 0 dev = NULL; i < cd_count[file] && \
(dev = console_devices[file][i]); i++)


Anyways, I would rather see better written for-loop that we see the iterations


Sorry, I'm not sure what you mean by this...

Ideally this loop would be written like

for (i = 0 dev = NULL; i < cd_count[file]; i++) {
dev = console_devices[file][i]);
/* loop body */
}

which is much more obviously correct. But since this macro must use the 
following
block as the loop body, it's trickier to do.

--Sean


Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 8:05 PM Sean Anderson  wrote:
> On 3/30/22 1:01 PM, Andy Shevchenko wrote:
> > On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:

...

> >>   #define for_each_console_dev(i, file, dev) \
> >> -   for (i = 0, dev = console_devices[file][i]; \
> >
> > When we enter the loop, the dev is assigned and perhaps valid
> >
> >> -i < cd_count[file];\
> >> -i++, dev = console_devices[file][i])
> >> +   for (i = 0; i < cd_count[file] &&   \
> >
> > Not the case anymore.
>
> The loop condition is evaluated before we enter the loop,
> which includes the first assignment to dev.

Yeah, I just sent a reply to my reply :-)

> >> +   (dev = console_devices[file][i]); i++)

So, what I don't like is exactly this hidenness, which I have stumbled upon.

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 8:01 PM Andy Shevchenko
 wrote:
> On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:

...

> >  #define for_each_console_dev(i, file, dev) \
> > -   for (i = 0, dev = console_devices[file][i]; \
>
> When we enter the loop, the dev is assigned and perhaps valid
>
> > -i < cd_count[file];\
> > -i++, dev = console_devices[file][i])
> > +   for (i = 0; i < cd_count[file] &&   \
>
> Not the case anymore.
>
> > +   (dev = console_devices[file][i]); i++)

On the second look, it seems a bit unusual, but for loop checks the
condition before entering and in such case the dev will be assigned if
the count is greater than 0.
So, basically the difference is that dev is left completely
uninitialized in case of count==0. However, it may not be a problem.

Anyways, I would rather see better written for-loop that we see the iterations


-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson

On 3/30/22 1:01 PM, Andy Shevchenko wrote:

On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:


We should only access console_devices[file][i] once we have checked that
i < cd_count[file]. Otherwise, we will access uninitialized memory at the end of
the loop. console_devices[file][i] should not be NULL, but putting the
assignment in the loop condition allows us to ensure that i is checked
beforehand. This isn't a bug, but it does make valgrind stop complaining.



Fixes: 400797cad3 ("IOMUX: Split out for_each_console_dev() helper macro")


Has this been tested? See below.


Yes.


...


  #define for_each_console_dev(i, file, dev) \
-   for (i = 0, dev = console_devices[file][i]; \


When we enter the loop, the dev is assigned and perhaps valid


-i < cd_count[file];\
-i++, dev = console_devices[file][i])
+   for (i = 0; i < cd_count[file] &&   \


Not the case anymore.


The loop condition is evaluated before we enter the loop,
which includes the first assignment to dev.

--Sean


+   (dev = console_devices[file][i]); i++)








Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson  wrote:
>
> We should only access console_devices[file][i] once we have checked that
> i < cd_count[file]. Otherwise, we will access uninitialized memory at the end 
> of
> the loop. console_devices[file][i] should not be NULL, but putting the
> assignment in the loop condition allows us to ensure that i is checked
> beforehand. This isn't a bug, but it does make valgrind stop complaining.

> Fixes: 400797cad3 ("IOMUX: Split out for_each_console_dev() helper macro")

Has this been tested? See below.

...

>  #define for_each_console_dev(i, file, dev) \
> -   for (i = 0, dev = console_devices[file][i]; \

When we enter the loop, the dev is assigned and perhaps valid

> -i < cd_count[file];\
> -i++, dev = console_devices[file][i])
> +   for (i = 0; i < cd_count[file] &&   \

Not the case anymore.

> +   (dev = console_devices[file][i]); i++)



-- 
With Best Regards,
Andy Shevchenko


[PATCH 0/4] mmc: sandbox: Some small fixes

2022-03-30 Thread Sean Anderson
Various small fixes which were found with valgrind.


Sean Anderson (4):
  mmc: sandbox: Initialize the status register
  mmc: sandbox: Initialize backing buffer
  mmc: Import some defines for R1 responses
  mmc: sandbox: Set the response

 drivers/mmc/sandbox_mmc.c | 13 +++---
 include/mmc.h | 52 +--
 2 files changed, 60 insertions(+), 5 deletions(-)

-- 
2.35.1



[PATCH 3/4] mmc: Import some defines for R1 responses

2022-03-30 Thread Sean Anderson
This imports defines for R1 responses from include/linux/mmc/mmc.h from
Linux 5.10.

Signed-off-by: Sean Anderson 
---
Yes, this is an old version, but it's what I had checked out, and I don't think
there are any new fields we need to handle :)

 include/mmc.h | 52 +--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/include/mmc.h b/include/mmc.h
index 6bdcce881d..7304eee0d4 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -311,8 +311,56 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_WR_DATA_REL_USR(1 << 0)/* user data 
area WR_REL */
 #define EXT_CSD_WR_DATA_REL_GP(x)  (1 << ((x)+1))  /* GP part (x+1) WR_REL 
*/
 
-#define R1_ILLEGAL_COMMAND (1 << 22)
-#define R1_APP_CMD (1 << 5)
+/*
+  MMC status in R1, for native mode (SPI bits are different)
+  Type
+   e : error bit
+   s : status bit
+   r : detected and set for the actual command response
+   x : detected and set during command execution. the host must poll
+the card by sending status command in order to read these bits.
+  Clear condition
+   a : according to the card state
+   b : always related to the previous command. Reception of
+a valid command will clear it (with a delay of one command)
+   c : clear by read
+ */
+
+#define R1_OUT_OF_RANGE(1 << 31)   /* er, c */
+#define R1_ADDRESS_ERROR   (1 << 30)   /* erx, c */
+#define R1_BLOCK_LEN_ERROR (1 << 29)   /* er, c */
+#define R1_ERASE_SEQ_ERROR  (1 << 28)  /* er, c */
+#define R1_ERASE_PARAM (1 << 27)   /* ex, c */
+#define R1_WP_VIOLATION(1 << 26)   /* erx, c */
+#define R1_CARD_IS_LOCKED  (1 << 25)   /* sx, a */
+#define R1_LOCK_UNLOCK_FAILED  (1 << 24)   /* erx, c */
+#define R1_COM_CRC_ERROR   (1 << 23)   /* er, b */
+#define R1_ILLEGAL_COMMAND (1 << 22)   /* er, b */
+#define R1_CARD_ECC_FAILED (1 << 21)   /* ex, c */
+#define R1_CC_ERROR(1 << 20)   /* erx, c */
+#define R1_ERROR   (1 << 19)   /* erx, c */
+#define R1_UNDERRUN(1 << 18)   /* ex, c */
+#define R1_OVERRUN (1 << 17)   /* ex, c */
+#define R1_CID_CSD_OVERWRITE   (1 << 16)   /* erx, c, CID/CSD overwrite */
+#define R1_WP_ERASE_SKIP   (1 << 15)   /* sx, c */
+#define R1_CARD_ECC_DISABLED   (1 << 14)   /* sx, a */
+#define R1_ERASE_RESET (1 << 13)   /* sr, c */
+#define R1_STATUS(x)(x & 0xFFF9A000)
+#define R1_CURRENT_STATE(x)((x & 0x1E00) >> 9) /* sx, b (4 bits) */
+#define R1_READY_FOR_DATA  (1 << 8)/* sx, a */
+#define R1_SWITCH_ERROR(1 << 7)/* sx, c */
+#define R1_EXCEPTION_EVENT (1 << 6)/* sr, a */
+#define R1_APP_CMD (1 << 5)/* sr, c */
+
+#define R1_STATE_IDLE  0
+#define R1_STATE_READY 1
+#define R1_STATE_IDENT 2
+#define R1_STATE_STBY  3
+#define R1_STATE_TRAN  4
+#define R1_STATE_DATA  5
+#define R1_STATE_RCV   6
+#define R1_STATE_PRG   7
+#define R1_STATE_DIS   8
 
 #define MMC_RSP_PRESENT (1 << 0)
 #define MMC_RSP_136(1 << 1)/* 136 bit response */
-- 
2.35.1



[PATCH 1/4] mmc: sandbox: Initialize the status register

2022-03-30 Thread Sean Anderson
The send status command expects the status register to be returned as a
response. Without writing data back, whatever is on the stack will be
interpreted as the status register. There are a lot of fields in this
register, but fortunately all zeros is interpreted as "we don't support
anything."

Signed-off-by: Sean Anderson 
---

 drivers/mmc/sandbox_mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index 451fe4a4e5..35159451e1 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -57,6 +57,7 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct 
mmc_cmd *cmd,
break;
case MMC_CMD_SEND_STATUS:
cmd->response[0] = MMC_STATUS_RDY_FOR_DATA;
+   memset(data->dest, '\0', data->blocks * data->blocksize);
break;
case MMC_CMD_SELECT_CARD:
break;
-- 
2.35.1



[PATCH 4/4] mmc: sandbox: Set the response

2022-03-30 Thread Sean Anderson
The mmc subsystem checks the response, but we (almost) never set it. Add a
bare-bones implementation. Technically, we are supposed to return our
current state in our responses, but I don't think the subsystem checks it.

Signed-off-by: Sean Anderson 
---

 drivers/mmc/sandbox_mmc.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index 60a6be0add..8922eeba2a 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -44,6 +44,9 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct 
mmc_cmd *cmd,
struct mmc *mmc = mmc_get_mmc_dev(dev);
static ulong erase_start, erase_end;
 
+   /* Default R1 response */
+   cmd->response[0] = R1_READY_FOR_DATA;
+
switch (cmd->cmdidx) {
case MMC_CMD_ALL_SEND_CID:
memset(cmd->response, '\0', sizeof(cmd->response));
@@ -55,8 +58,8 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct 
mmc_cmd *cmd,
case SD_CMD_SEND_IF_COND:
cmd->response[0] = 0xaa;
break;
-   case MMC_CMD_SEND_STATUS:
-   cmd->response[0] = MMC_STATUS_RDY_FOR_DATA;
+   case SD_CMD_APP_SD_STATUS:
+   cmd->response[0] |= R1_APP_CMD;
memset(data->dest, '\0', data->blocks * data->blocksize);
break;
case MMC_CMD_SELECT_CARD:
@@ -106,6 +109,7 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct 
mmc_cmd *cmd,
cmd->response[2] = 0;
break;
case MMC_CMD_APP_CMD:
+   cmd->response[0] |= R1_APP_CMD;
break;
case MMC_CMD_SET_BLOCKLEN:
debug("block len %d\n", cmd->cmdarg);
@@ -113,11 +117,13 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, 
struct mmc_cmd *cmd,
case SD_CMD_APP_SEND_SCR: {
u32 *scr = (u32 *)data->dest;
 
+   cmd->response[0] |= R1_APP_CMD;
scr[0] = cpu_to_be32(2 << 24 | 1 << 15);  /* SD version 3 */
break;
}
default:
debug("%s: Unknown command %d\n", __func__, cmd->cmdidx);
+   cmd->response[0] |= R1_ILLEGAL_COMMAND;
break;
}
 
-- 
2.35.1



[PATCH 2/4] mmc: sandbox: Initialize backing buffer

2022-03-30 Thread Sean Anderson
Private data is initialized to all zeros by DM. Malloc does not do this.
Initialize it. This fixes partition detection logic from trying to detect
partitions in uninitialized memory.

Fixes: 0bf61aced2 ("sandbox: mmc: Support a backing file")
Signed-off-by: Sean Anderson 
---

 drivers/mmc/sandbox_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index 35159451e1..60a6be0add 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -178,7 +178,7 @@ static int sandbox_mmc_probe(struct udevice *dev)
priv->csize = 0;
priv->size = (priv->csize + 1) * SIZE_MULTIPLE; /* 1 MiB */
 
-   priv->buf = malloc(priv->size);
+   priv->buf = calloc(1, priv->size);
if (!priv->buf) {
log_err("%s: Not enough memory (%x bytes)\n",
dev->name, priv->size);
-- 
2.35.1



[PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson
We should only access console_devices[file][i] once we have checked that
i < cd_count[file]. Otherwise, we will access uninitialized memory at the end of
the loop. console_devices[file][i] should not be NULL, but putting the
assignment in the loop condition allows us to ensure that i is checked
beforehand. This isn't a bug, but it does make valgrind stop complaining.

Fixes: 400797cad3 ("IOMUX: Split out for_each_console_dev() helper macro")
Signed-off-by: Sean Anderson 
---

 include/iomux.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/iomux.h b/include/iomux.h
index 37f5f6dee6..1046df133b 100644
--- a/include/iomux.h
+++ b/include/iomux.h
@@ -25,9 +25,8 @@ extern struct stdio_dev **console_devices[MAX_FILES];
 extern int cd_count[MAX_FILES];
 
 #define for_each_console_dev(i, file, dev) \
-   for (i = 0, dev = console_devices[file][i]; \
-i < cd_count[file];\
-i++, dev = console_devices[file][i])
+   for (i = 0; i < cd_count[file] &&   \
+   (dev = console_devices[file][i]); i++)
 
 int iomux_match_device(struct stdio_dev **, const int, struct stdio_dev *);
 int iomux_doenv(const int, const char *);
-- 
2.35.1



[PATCH] dm: core: Use device_foreach_child where possible

2022-03-30 Thread Sean Anderson
We have some nice macros for iterating over devices in device.h, but they
are not used by the driver core. Convert all the users I could find.

Signed-off-by: Sean Anderson 
---

 drivers/core/device-remove.c |  4 ++--
 drivers/core/device.c| 21 ++---
 drivers/core/devres.c|  2 +-
 drivers/core/dump.c  |  2 +-
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 73d2e9e420..a86b9325dd 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -29,7 +29,7 @@ int device_chld_unbind(struct udevice *dev, struct driver 
*drv)
 
assert(dev);
 
-   list_for_each_entry_safe(pos, n, >child_head, sibling_node) {
+   device_foreach_child_safe(pos, n, dev) {
if (drv && (pos->driver != drv))
continue;
 
@@ -52,7 +52,7 @@ int device_chld_remove(struct udevice *dev, struct driver 
*drv,
 
assert(dev);
 
-   list_for_each_entry_safe(pos, n, >child_head, sibling_node) {
+   device_foreach_child_safe(pos, n, dev) {
int ret;
 
if (drv && (pos->driver != drv))
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 1b356f12dd..a7bfc47191 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -284,8 +284,7 @@ int device_reparent(struct udevice *dev, struct udevice 
*new_parent)
assert(dev);
assert(new_parent);
 
-   list_for_each_entry_safe(pos, n, >parent->child_head,
-sibling_node) {
+   device_foreach_child_safe(pos, n, dev->parent) {
if (pos->driver != dev->driver)
continue;
 
@@ -729,7 +728,7 @@ int device_get_child(const struct udevice *parent, int 
index,
 {
struct udevice *dev;
 
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
if (!index--)
return device_get_device_tail(dev, 0, devp);
}
@@ -742,7 +741,7 @@ int device_get_child_count(const struct udevice *parent)
struct udevice *dev;
int count = 0;
 
-   list_for_each_entry(dev, >child_head, sibling_node)
+   device_foreach_child(dev, parent)
count++;
 
return count;
@@ -753,7 +752,7 @@ int device_get_decendent_count(const struct udevice *parent)
const struct udevice *dev;
int count = 1;
 
-   list_for_each_entry(dev, >child_head, sibling_node)
+   device_foreach_child(dev, parent)
count += device_get_decendent_count(dev);
 
return count;
@@ -766,7 +765,7 @@ int device_find_child_by_seq(const struct udevice *parent, 
int seq,
 
*devp = NULL;
 
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
if (dev->seq_ == seq) {
*devp = dev;
return 0;
@@ -795,7 +794,7 @@ int device_find_child_by_of_offset(const struct udevice 
*parent, int of_offset,
 
*devp = NULL;
 
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
if (dev_of_offset(dev) == of_offset) {
*devp = dev;
return 0;
@@ -824,7 +823,7 @@ static struct udevice *_device_find_global_by_ofnode(struct 
udevice *parent,
if (ofnode_equal(dev_ofnode(parent), ofnode))
return parent;
 
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
found = _device_find_global_by_ofnode(dev, ofnode);
if (found)
return found;
@@ -902,7 +901,7 @@ int device_find_first_inactive_child(const struct udevice 
*parent,
struct udevice *dev;
 
*devp = NULL;
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
if (!device_active(dev) &&
device_get_uclass_id(dev) == uclass_id) {
*devp = dev;
@@ -920,7 +919,7 @@ int device_find_first_child_by_uclass(const struct udevice 
*parent,
struct udevice *dev;
 
*devp = NULL;
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
if (device_get_uclass_id(dev) == uclass_id) {
*devp = dev;
return 0;
@@ -937,7 +936,7 @@ int device_find_child_by_namelen(const struct udevice 
*parent, const char *name,
 
*devp = NULL;
 
-   list_for_each_entry(dev, >child_head, sibling_node) {
+   device_foreach_child(dev, parent) {
if (!strncmp(dev->name, name, len) &&
strlen(dev->name) == len) {
*devp = dev;
diff --git a/drivers/core/devres.c b/drivers/core/devres.c

Re: [PATCH 0/6] Add MV88E61xx DSA driver and use on gwventana

2022-03-30 Thread Tim Harvey
On Tue, Mar 29, 2022 at 3:52 PM Tim Harvey  wrote:
>
> This series adds a DSA driver for the MV88E61xx based on
> drivers/net/phy/mv88e61xx and uses in on the gwventana_gw5904_defconfig.
>
> The hope is that the other three boards that use the MV88E61xx driver
> can move to this as well eventually so that we can remove the non-dm
> driver and the 4 Kconfig options it requires.
>
> The MV88E61xx has an MDIO interface this DM_MDIO must be used so support
> for a UCLASS_MDIO driver is added to the fec_mxc ethernet driver in a
> way that allows a fallback to the previous non DM_MDIO case as there are
> many boards out there using this driver that define DM_MDIO but do not
> have the required dt props for a DM_MDIO driver which would cause a
> regression.
>
> Additionally a patch to ensure MDIO children are scanned on post-bind is
> needed.
>
> I'm making use of the dm_mdio_read/dm_mdio_write wrapper from Merak that
> is pending so it is in this series as well.
>
> Best Regards,
>
> Tim
>
> Tim Harvey (6):
>   net: mdio-uclass: scan for dm mdio children on post-bind
>   net: dsa: move cpu port probe to dsa_post_probe
>   net: mdio-uclass: add wrappers for read/write/reset operations
>   net: fec: add support for DM_MDIO
>   net: add MV88E61xx DSA driver
>   board: gw_ventana: enable MV88E61XX DSA support
>
>  arch/arm/dts/imx6qdl-gw5904.dtsi|  35 +
>  board/gateworks/gw_ventana/gw_ventana.c |  50 +-
>  configs/gwventana_gw5904_defconfig  |   7 +-
>  drivers/net/Kconfig |   7 +
>  drivers/net/Makefile|   1 +
>  drivers/net/fec_mxc.c   | 113 ++-
>  drivers/net/fec_mxc.h   |   1 +
>  drivers/net/mv88e61xx.c | 982 
>  include/miiphy.h|  31 +
>  net/dsa-uclass.c|  14 +-
>  net/mdio-uclass.c   |  35 +
>  11 files changed, 1227 insertions(+), 49 deletions(-)
>  create mode 100644 drivers/net/mv88e61xx.c
>
> --
> 2.17.1
>

Adding Chris and Anotolij to the thread as the maintainers of the only
other boards using drivers/net/phy/mv88e61xx.c. If they can switch to
the DSA driver it would allow us to remove the static Kconfig options
to configure the switch which should be present in the device-tree.

Best Regards,

Tim


Re: [PATCH v1 1/2] hexdump: Introduce debug APIs

2022-03-30 Thread Heinrich Schuchardt

On 3/30/22 11:30, Andy Shevchenko wrote:

On Sat, Nov 13, 2021 at 11:14:28AM -0700, Simon Glass wrote:

On Tue, 9 Nov 2021 at 05:03, Andy Shevchenko
 wrote:


debug_hex_dump() and debug_hex_dump_bytes() conditionally print
the dump based on DEBUG definition.

Signed-off-by: Andy Shevchenko 
---
  include/hexdump.h |  4 
  lib/hexdump.c | 60 ---
  2 files changed, 56 insertions(+), 8 deletions(-)


+Heinrich Schuchardt


Heinrich, it's several months passed. What should we do?


The logging system was designed by Simon.




Is it possible to resolve this in the header file? It is a bit odd to
have to add DEBUG to hexdump.c in order to get debug output.

Note also the logging system so you can do

log(LOG_CATEGORY, dbg ? LOGL_DEBUG : LOGL_INFO, "fmt ...", ...)





I would do something like below.

Then you can use the log command to switch debug output on and off.

Best regards

Heinrich


--- a/include/hexdump.h
+++ b/include/hexdump.h
@@ -148,6 +148,19 @@ int hex_dump_to_buffer(const void *buf, size_t len,
int rowsize, int groupsize,
 int print_hex_dump(const char *prefix_str, int prefix_type, int rowsize,
   int groupsize, const void *buf, size_t len, bool ascii);

+
+int log_hex_dump(enum log_category_t cat, enum log_level_t level,
+const char *prefix_str, int prefix_type, int rowsize,
+int groupsize, const void *buf, size_t len, bool ascii);
+
+#define print_hex_dump(args...) ({ \
+   log_hex_dump(LOG_CATEGORY, LOGL_INFO, args); \
+   })
+
+#define debug_hex_dump(args...) ({ \
+   log_hex_dump(LOG_CATEGORY, LOGL_DEBUG, args); \
+   })
+
 /**
  * print_hex_dump_bytes - shorthand form of print_hex_dump() with
default params
  * @prefix_str: string to prefix each line with;
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 149c93ead8..eb77a9cf94 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -10,6 +10,7 @@

 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -125,8 +126,9 @@ overflow1:
return ascii ? ascii_column + len : (groupsize * 2 + 1) * ngroups - 1;
 }

-int print_hex_dump(const char *prefix_str, int prefix_type, int rowsize,
-  int groupsize, const void *buf, size_t len, bool ascii)
+int log_hex_dump(enum log_category_t cat, enum log_level_t level,
+const char *prefix_str, int prefix_type, int rowsize,
+int groupsize, const void *buf, size_t len, bool ascii)
 {
const u8 *ptr = buf;
int i, linelen, remaining = len;
@@ -146,15 +148,17 @@ int print_hex_dump(const char *prefix_str, int
prefix_type, int rowsize,

switch (prefix_type) {
case DUMP_PREFIX_ADDRESS:
-   printf("%s%0*lx: %s\n", prefix_str,
-  IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
-  (ulong)map_to_sysmem(ptr) + i, linebuf);
+   log(cat, level,
+   "%s%0*lx: %s\n", prefix_str,
+   IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+   (ulong)map_to_sysmem(ptr) + i, linebuf);
break;
case DUMP_PREFIX_OFFSET:
-   printf("%s%.8x: %s\n", prefix_str, i, linebuf);
+   log(cat, level,
+   "%s%.8x: %s\n", prefix_str, i, linebuf);
break;
default:
-   printf("%s%s\n", prefix_str, linebuf);
+   log(cat, level, "%s%s\n", prefix_str, linebuf);
break;
}
if (!IS_ENABLED(CONFIG_SPL_BUILD) && ctrlc())


Re: [PATCH v7 4/4] configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER

2022-03-30 Thread Clément Léger
Le Tue, 22 Mar 2022 13:35:08 +0100,
Clément Léger  a écrit :

> Le Tue, 22 Mar 2022 11:18:39 +,
>  a écrit :
> 

[...]

> > 
> > Could not initialize timer (err -22)
> > 
> > ...
> > 
> > 
> > 
> > Could you investigate this please ?  
> 
> Hi Eugen,
> 
> Ok, I'll try to debug that !

Hi Eugen, while debugging it, I found that there was actually one major
flaw. The clock that I used was the GLCK. If only this clock is
enabled, the TCB can not work, the tcb0_clk must also be enabled for the
TCB to start counting. It worked on my side because I forgot that I had
a quirk in OP-TEE that was enabling the clocks before starting U-Boot.
Without that, it actually could not work.

Since the tcb0_clk is needed, I switched the driver to use this one
only and it works well on a "bare" setup (ie without OP-TEE). I even
think it could not work with the tcb0_gclk since this one does not
correctly handles the case when the parent clock is the slow_clk (which
might be the case after booting) and in this case, will return 0 as
rate (this is by the way supported in your CCF branch).

Anyway, I fixed the driver to use the tcb0_clk and thus it should work
much better. I will send a V8 and it should work with U-Boot and the
SPL.

By the way, do you have any documentation which explains how to use
U-Boot SPL on sama5d2_xplained (or other) board ?

Regards,

Clément.

-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com


[PATCH v1 1/1] Revert "x86: Move FACP table into separate functions"

2022-03-30 Thread Andy Shevchenko
Before the culprit patch (see BugLink for the details):

  => acpi list
  Name  Base   Size  Detail
      -  --
  RSDP  000e4500 24  v02 U-BOOT
  RSDT  000e4530 38  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  XSDT  000e45e0 4c  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  CSRT  000e5490 58  v00 U-BOOT U-BOOTBL 20220401 INTL 0
  FACP  000e54f0114  v06 U-BOOT U-BOOTBL 20220401 INTL 0
  DSDT  000e4780c06  v02 U-BOOT U-BOOTBL 1 INTL 20200925
  FACS  000e4740 40
  MCFG  000e5610 3c  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  SPCR  000e5650 50  v02 U-BOOT U-BOOTBL 20220401 INTL 0
  APIC  000e56a0 48  v02 U-BOOT U-BOOTBL 20220401 INTL 0

After the culprit patch:

  => acpi list
  Name  Base   Size  Detail
      -  --
  RSDP  000e4500 24  v02 U-BOOT
  RSDT  000e4530 34  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  XSDT  000e45e0 44  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  CSRT  000e53a0 58  v00 U-BOOT U-BOOTBL 20220401 INTL 0
  MCFG  000e5520 3c  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  SPCR  000e5560 50  v02 U-BOOT U-BOOTBL 20220401 INTL 0
  APIC  000e55b0 48  v02 U-BOOT U-BOOTBL 20220401 INTL 0

As a result Linux kernel can't find mandatory tables and fails
to boot.

Hence, revert it for good.

This reverts commit 379d3c1fd6aa490b1ad5697525cfc89b615cf25a.

BugLink: https://lore.kernel.org/all/20220131225930.GJ7515@bill-the-cat/
Signed-off-by: Andy Shevchenko 
---
 arch/x86/cpu/apollolake/acpi.c| 17 -
 arch/x86/cpu/baytrail/acpi.c  | 27 ---
 arch/x86/cpu/quark/acpi.c | 27 ---
 arch/x86/cpu/tangier/acpi.c   | 25 -
 arch/x86/include/asm/acpi_table.h |  2 ++
 arch/x86/lib/acpi_table.c | 15 +++
 6 files changed, 45 insertions(+), 68 deletions(-)

diff --git a/arch/x86/cpu/apollolake/acpi.c b/arch/x86/cpu/apollolake/acpi.c
index a3dd7373af0d..fd21c0b49684 100644
--- a/arch/x86/cpu/apollolake/acpi.c
+++ b/arch/x86/cpu/apollolake/acpi.c
@@ -146,25 +146,16 @@ void fill_fadt(struct acpi_fadt *fadt)
fadt->x_pm_tmr_blk.addrl = IOMAP_ACPI_BASE + PM1_TMR;
 }
 
-static int apl_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer 
*entry)
+void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
+ void *dsdt)
 {
-   struct acpi_table_header *header;
-   struct acpi_fadt *fadt;
+   struct acpi_table_header *header = >header;
 
-   fadt = ctx->current;
-   acpi_fadt_common(fadt, ctx->facs, ctx->dsdt);
+   acpi_fadt_common(fadt, facs, dsdt);
intel_acpi_fill_fadt(fadt);
fill_fadt(fadt);
-   header = >header;
header->checksum = table_compute_checksum(fadt, header->length);
-
-   acpi_add_table(ctx, fadt);
-
-   acpi_inc(ctx, sizeof(struct acpi_fadt));
-
-   return 0;
 }
-ACPI_WRITER(5fadt, "FACS", apl_write_fadt, 0);
 
 int apl_acpi_fill_dmar(struct acpi_ctx *ctx)
 {
diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c
index 59db2e2c5d84..07757b88a305 100644
--- a/arch/x86/cpu/baytrail/acpi.c
+++ b/arch/x86/cpu/baytrail/acpi.c
@@ -15,24 +15,20 @@
 #include 
 #include 
 
-static int baytrail_write_fadt(struct acpi_ctx *ctx,
-  const struct acpi_writer *entry)
+void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
+ void *dsdt)
 {
-   struct acpi_table_header *header;
-   struct acpi_fadt *fadt;
-
-   fadt = ctx->current;
-   header = >header;
+   struct acpi_table_header *header = &(fadt->header);
u16 pmbase = ACPI_BASE_ADDRESS;
 
-   memset(fadt, '\0', sizeof(struct acpi_fadt));
+   memset((void *)fadt, 0, sizeof(struct acpi_fadt));
 
acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 4;
 
-   fadt->firmware_ctrl = (u32)ctx->facs;
-   fadt->dsdt = (u32)ctx->dsdt;
+   fadt->firmware_ctrl = (u32)facs;
+   fadt->dsdt = (u32)dsdt;
fadt->preferred_pm_profile = ACPI_PM_MOBILE;
fadt->sci_int = 9;
fadt->smi_cmd = 0;
@@ -79,9 +75,9 @@ static int baytrail_write_fadt(struct acpi_ctx *ctx,
fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;
 
-   fadt->x_firmware_ctl_l = (u32)ctx->facs;
+   fadt->x_firmware_ctl_l = (u32)facs;
fadt->x_firmware_ctl_h = 0;
-   fadt->x_dsdt_l = (u32)ctx->dsdt;
+   fadt->x_dsdt_l = (u32)dsdt;
fadt->x_dsdt_h = 0;
 
fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
@@ -141,14 +137,7 @@ static int baytrail_write_fadt(struct acpi_ctx *ctx,
fadt->x_gpe1_blk.addrh = 0x0;
 
header->checksum = table_compute_checksum(fadt, header->length);
-
-   acpi_add_table(ctx, fadt);
-
-   acpi_inc(ctx, sizeof(struct acpi_fadt));
-
-   return 0;
 }
-ACPI_WRITER(5fadt, "FACP", 

Re: [ANN] U-Boot v2022.04-rc1 released

2022-03-30 Thread Andy Shevchenko
On Sat, Feb 12, 2022 at 05:02:00PM +0200, Andy Shevchenko wrote:
> On Fri, Feb 11, 2022 at 9:15 PM Andy Shevchenko
>  wrote:
> > On Fri, Feb 11, 2022 at 8:46 PM Andy Shevchenko
> >  wrote:
> > > On Fri, Feb 11, 2022 at 8:31 PM Andy Shevchenko
> > >  wrote:
> > > > On Mon, Jan 31, 2022 at 05:59:30PM -0500, Tom Rini wrote:
> 
> ...
> 
> > > git bisect bad 379d3c1fd6aa490b1ad5697525cfc89b615cf25a
> > > # first bad commit: [379d3c1fd6aa490b1ad5697525cfc89b615cf25a] x86:
> > > Move FACP table into separate functions
> > > u-boot((379d3c1fd6aa...)|BISECTING)$
> >
> > For the record, these two
> >  acpi: Move MCFG implementation to common lib
> >  arch: x86: lib: acpi_table: Fix MCFG entries
> >
> > do not help.
> >
> > > Irony is that I have reviewed it, but that time I was busy and couldn't 
> > > test.
> > >
> > > > Simon, can you prioritize setting up Edison to make it available for 
> > > > tests?
> >
> > So, I'm open to testing any other suggestions.
> 
> Meanwhile I will try to revert and if it works and no other solution
> comes, I will send it out.

Revert has been sent.

-- 
With Best Regards,
Andy Shevchenko




Re: [PATCH 5/6] net: add MV88E61xx DSA driver

2022-03-30 Thread Tim Harvey
On Tue, Mar 29, 2022 at 4:22 PM Marek Behún  wrote:
>
> On Tue, 29 Mar 2022 15:52:39 -0700
> Tim Harvey  wrote:
>
> > Add a DSA driver for the MV88E61xx compatible GbE Ethernet switches.
> >
> > Signed-off-by: Tim Harvey 
>

Marek,

Thanks for looking at this.

> Is this final version that should be accepted?

This is the first submission of the new driver.

>
> The drivers seems to support not only 61xx, but 6xxx (6096, 6250, 6352,
> ...).

It should also support all the same devices that the non dsa driver it
was derived from (drivers/net/phy/mv88e61xx.c) but I only have a board
with 88E6176 to test with.

It is not completely clear to me what devices are supported in the
original driver per Kconfig but from looking over the code I would say
the following appear to be supported:
mv88e6096
mv88e6097
mv88e6020
mv88e6070
mv88e6071
mv88e6172
mv88e6176
mv88e6220
mv88e6240
mv88e6250
mv88e6352

>
> Also there are some commented lines, for example
>
> > +//   u16 port_stat_link_mask;/* Bitmask for port link status bits */
> > +//   u16 port_stat_dup_mask; /* Bitmask for port duplex status bits */
> > +//   u8 port_stat_speed_width;/* Width of speed status bitfield */
>
> What is their purpose?
>

oops... that was a mistake. I'm surprised checkpatch didn't catch
those. Those were in the non-dsa driver and not used here so will be
removed.

> Why is mv88e61xx_dsa_xmit() no-op?

For DSA dsa-uclass calls the switch master eth device send function
after calling the dsa_ops->xmit function so that a dsa driver can add
any header/footer if needed. The function is required but in my case I
don't care about header/footer tagging or vlan as only 1 port is
active at a time in U-Boot so I just return success.

Best Regards,

Tim


[PATCH v3 9/9] doc: uefi: Update the capsule update related documentation

2022-03-30 Thread Sughosh Ganu
Update the capsule update functionality related documentation to
refect the fact that a unique image GUID is to be used per image
that forms part of the capsule file.

Signed-off-by: Sughosh Ganu 
---

Changes since V2:
* Add a description for adding image index value and definition of
  set_dfu_alt_info function for the capsule updates.

 doc/develop/uefi/uefi.rst | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
index fe337c88bd..403885d0f2 100644
--- a/doc/develop/uefi/uefi.rst
+++ b/doc/develop/uefi/uefi.rst
@@ -312,8 +312,8 @@ Run the following command
 .. code-block:: console
 
 $ mkeficapsule \
-  --index 1 --instance 0 \
-  [--fit  | --raw ] \
+  --index  --instance 0 \
+  --guid  \
   
 
 Performing the update
@@ -333,6 +333,24 @@ won't be taken over across the reboot. If this is the 
case, you can skip
 this feature check with the Kconfig option (CONFIG_EFI_IGNORE_OSINDICATIONS)
 set.
 
+A few things need to be defined in the board file for performing the
+capsule upadte. The first is defining the function set_dfu_alt_info in
+the board file. This function sets the environment variable
+dfu_alt_info. Instead of taking the variable from the environment, the
+capsule update feature requires that the variable be set through the
+board function, since that is more robust. Secondly, define GUID
+values and image index of the images that are to be updated through
+the capsule update feature in the board file. Both the values are to
+be defined as part of the fw_images array. These GUID values would be
+used by the Firmware Management Protocol(FMP) to populate the image
+descriptor array and also displayed as part of the ESRT table. The
+image index values defined in the array should match the dfu alt
+number that corresponds to the firmware image. The dfu alt number can
+be obtained by running the following command::
+
+dfu list
+
+
 Finally, the capsule update can be initiated by rebooting the board.
 
 Enabling Capsule Authentication
-- 
2.25.1



[PATCH v3 8/9] mkeficapsule: Remove raw and FIT GUID types

2022-03-30 Thread Sughosh Ganu
While building a capsule, the GUID value of that specific image is to
be passed through the --guid command option to the mkeficapsule
tool. This renders the EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID and
EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID values superfluous. Remove the
--raw and --fit command line options as well.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: None

 tools/eficapsule.h   |  8 
 tools/mkeficapsule.c | 26 +-
 2 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/tools/eficapsule.h b/tools/eficapsule.h
index 69c9c58c2f..d63b831443 100644
--- a/tools/eficapsule.h
+++ b/tools/eficapsule.h
@@ -37,14 +37,6 @@ typedef struct {
EFI_GUID(0x6dcbd5ed, 0xe82d, 0x4c44, 0xbd, 0xa1, \
 0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a)
 
-#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \
-   EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \
-0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47)
-
-#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \
-   EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \
-0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f)
-
 #define EFI_CERT_TYPE_PKCS7_GUID \
EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \
 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7)
diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
index c118335b93..5f74d23b9e 100644
--- a/tools/mkeficapsule.c
+++ b/tools/mkeficapsule.c
@@ -27,17 +27,11 @@
 static const char *tool_name = "mkeficapsule";
 
 efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID;
-efi_guid_t efi_guid_image_type_uboot_fit =
-   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID;
-efi_guid_t efi_guid_image_type_uboot_raw =
-   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID;
 efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID;
 
-static const char *opts_short = "frg:i:I:v:p:c:m:dh";
+static const char *opts_short = "g:i:I:v:p:c:m:dh";
 
 static struct option options[] = {
-   {"fit", no_argument, NULL, 'f'},
-   {"raw", no_argument, NULL, 'r'},
{"guid", required_argument, NULL, 'g'},
{"index", required_argument, NULL, 'i'},
{"instance", required_argument, NULL, 'I'},
@@ -54,8 +48,6 @@ static void print_usage(void)
fprintf(stderr, "Usage: %s [options]  \n"
"Options:\n"
 
-   "\t-f, --fit   FIT image type\n"
-   "\t-r, --raw   raw image type\n"
"\t-g, --guid guid for image blob type\n"
"\t-i, --index  update image index\n"
"\t-I, --instanceupdate hardware instance\n"
@@ -606,22 +598,6 @@ int main(int argc, char **argv)
break;
 
switch (c) {
-   case 'f':
-   if (guid) {
-   fprintf(stderr,
-   "Image type already specified\n");
-   exit(EXIT_FAILURE);
-   }
-   guid = _guid_image_type_uboot_fit;
-   break;
-   case 'r':
-   if (guid) {
-   fprintf(stderr,
-   "Image type already specified\n");
-   exit(EXIT_FAILURE);
-   }
-   guid = _guid_image_type_uboot_raw;
-   break;
case 'g':
if (guid) {
fprintf(stderr,
-- 
2.25.1



[PATCH v3 6/9] test: capsule: Modify the capsule tests to use GUID values for sandbox

2022-03-30 Thread Sughosh Ganu
The current UEFI capsule updation code uses two GUID values, one for
FIT images, and one for raw images across platforms. This logic is
being changed to have GUID values per image, per platform. Change the
tests for the capsule update code to reflect this change. The GUID
values now used are the ones specific to the sandbox platform -- one
for the u-boot image, and another for the u-boot environment image.

The UEFI specification does not allow installation of multiple
Firmware Management Protocols(FMP) at the same time. Install the
FMP instance for raw images on the sandbox variant for testing the
capsule update code. Install the FMP instance for the FIT images on
the sandbox64 and sandbox_flattree variant for testing capsule update
for FIT images. This is being done by splitting the capsule update
script for FIT and raw images.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: None

 configs/sandbox64_defconfig   |   1 -
 configs/sandbox_defconfig |   1 -
 configs/sandbox_flattree_defconfig|   5 +
 test/py/tests/test_efi_capsule/conftest.py|  21 +-
 .../test_capsule_firmware_fit.py  | 186 ++
 ...rmware.py => test_capsule_firmware_raw.py} | 159 +--
 6 files changed, 258 insertions(+), 115 deletions(-)
 create mode 100644 test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py
 rename test/py/tests/test_efi_capsule/{test_capsule_firmware.py => 
test_capsule_firmware_raw.py} (75%)

diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 7c157a23d0..1a0142795a 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -247,7 +247,6 @@ CONFIG_ERRNO_STR=y
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
-CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_EFI_SECURE_BOOT=y
 CONFIG_TEST_FDTDEC=y
 CONFIG_UNIT_TEST=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index ab0e2defee..de2526df09 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -318,7 +318,6 @@ CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
-CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_EFI_SECURE_BOOT=y
 CONFIG_TEST_FDTDEC=y
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index 217b0647bb..bbcf435ac6 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_CMD_NVEDIT_INFO=y
 CONFIG_CMD_NVEDIT_LOAD=y
 CONFIG_CMD_NVEDIT_SELECT=y
@@ -210,3 +211,7 @@ CONFIG_HEXDUMP=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
+CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
+CONFIG_DFU_SF=y
diff --git a/test/py/tests/test_efi_capsule/conftest.py 
b/test/py/tests/test_efi_capsule/conftest.py
index 9076087a12..d757415c88 100644
--- a/test/py/tests/test_efi_capsule/conftest.py
+++ b/test/py/tests/test_efi_capsule/conftest.py
@@ -72,7 +72,7 @@ def efi_capsule_data(request, u_boot_config):
 
 # Create capsule files
 # two regions: one for u-boot.bin and the other for u-boot.env
-check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n 
u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old -> u-boot.env.old; echo -n 
u-boot-env:New > u-boot.env.new' % data_dir,
+check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n 
u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old > u-boot.env.old; echo -n 
u-boot-env:New > u-boot.env.new' % data_dir,
shell=True)
 check_call('sed -e \"s?BINFILE1?u-boot.bin.new?\" -e 
\"s?BINFILE2?u-boot.env.new?\" 
%s/test/py/tests/test_efi_capsule/uboot_bin_env.its > %s/uboot_bin_env.its' %
(u_boot_config.source_dir, data_dir),
@@ -80,21 +80,29 @@ def efi_capsule_data(request, u_boot_config):
 check_call('cd %s; %s/tools/mkimage -f uboot_bin_env.its 
uboot_bin_env.itb' %
(data_dir, u_boot_config.build_dir),
shell=True)
-check_call('cd %s; %s/tools/mkeficapsule --index 1 --fit 
uboot_bin_env.itb Test01' %
+check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 
09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test01' %
(data_dir, u_boot_config.build_dir),
shell=True)
-check_call('cd %s; %s/tools/mkeficapsule --index 1 --raw 
u-boot.bin.new Test02' %
+check_call('cd %s; %s/tools/mkeficapsule --index 2 --guid 
5A7021F5-FEF2-48B4-AABA-832E777418C0 u-boot.env.new Test02' %
(data_dir, u_boot_config.build_dir),
shell=True)
-check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 
E2BB9C06-70E9-4B14-97A3-5A7913176E3F 

[PATCH v3 7/9] FMP: Remove GUIDs for FIT and raw images

2022-03-30 Thread Sughosh Ganu
The capsule update code has been modified for getting the image GUID
values from the platform code. With this, each image now has a unique
GUID value. With this change, there is no longer a need for defining
GUIDs for FIT and raw images. Remove these GUID values.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: None

 include/efi_api.h | 8 
 lib/efi_loader/efi_firmware.c | 4 
 2 files changed, 12 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 982c200172..c7f7873b5d 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -1967,14 +1967,6 @@ struct efi_signature_list {
EFI_GUID(0x86c77a67, 0x0b97, 0x4633, 0xa1, 0x87, \
 0x49, 0x10, 0x4d, 0x06, 0x85, 0xc7)
 
-#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \
-   EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \
-0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47)
-
-#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \
-   EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \
-0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f)
-
 #define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE0x0001
 #define IMAGE_ATTRIBUTE_RESET_REQUIRED 0x0002
 #define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED0x0004
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index 169f3a29bb..7734d9f353 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -185,8 +185,6 @@ static efi_status_t efi_fill_image_desc_array(
  *   - versioning of firmware image
  *   - package information
  */
-const efi_guid_t efi_firmware_image_type_uboot_fit =
-   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID;
 
 /**
  * efi_firmware_fit_get_image_info - return information about the current
@@ -293,8 +291,6 @@ const struct efi_firmware_management_protocol efi_fmp_fit = 
{
  * This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update
  * method with raw data.
  */
-const efi_guid_t efi_firmware_image_type_uboot_raw =
-   EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID;
 
 /**
  * efi_firmware_raw_get_image_info - return information about the current
-- 
2.25.1



[PATCH v3 4/9] board: Define set_dfu_alt_info() for boards with UEFI capsule update enabled

2022-03-30 Thread Sughosh Ganu
Currently, there are a bunch of boards which enable the UEFI capsule
update feature. The actual update of the firmware images is done
through the dfu framework which uses the dfu_alt_info environment
variable for getting information on the update, like device, partition
number/address etc. Currently, these boards define the dfu_alt_info
variable in the board config header, as an environment variable. With
this, the variable can be modified from the u-boot command line and
this can cause an incorrect update.

To prevent this from happening, define the set_dfu_alt_info function
in the board file, and use the function for populating the
variable. With the function defined, the dfu framework populates the
dfu_alt_info variable through the board file, instead of fetching the
variable from the environment, thus making the update more robust.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: New Patch


 .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c   | 24 +
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 24 +
 board/emulation/common/qemu_dfu.c |  6 ++---
 board/kontron/pitx_imx8m/pitx_imx8m.c | 24 +
 board/kontron/sl-mx8mm/sl-mx8mm.c | 24 +
 board/kontron/sl28/sl28.c | 25 ++
 board/sandbox/sandbox.c   | 26 +++
 board/socionext/developerbox/developerbox.c   | 26 +++
 board/xilinx/zynq/board.c |  5 ++--
 board/xilinx/zynqmp/zynqmp.c  |  5 ++--
 include/configs/imx8mm-cl-iot-gate.h  |  1 -
 include/configs/imx8mp_rsb3720.h  |  1 -
 include/configs/kontron-sl-mx8mm.h|  1 -
 include/configs/kontron_pitx_imx8m.h  |  1 -
 include/configs/kontron_sl28.h|  2 --
 include/configs/synquacer.h   |  6 -
 16 files changed, 182 insertions(+), 19 deletions(-)

diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c 
b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
index 1c953ba195..41154ca9f3 100644
--- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
+++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
@@ -5,10 +5,12 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -24,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -231,3 +234,24 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
}
 }
 #endif /* CONFIG_SPL_MMC_SUPPORT */
+
+#if defined(CONFIG_SET_DFU_ALT_INFO)
+
+#define DFU_ALT_BUF_LENSZ_1K
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
+
+   if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
+   env_get("dfu_alt_info"))
+   return;
+
+   memset(buf, 0, DFU_ALT_BUF_LEN);
+
+   snprintf(buf, DFU_ALT_BUF_LEN,
+"mmc 2=flash-bin raw 0 0x1B00 mmcpart 1");
+
+   env_set("dfu_alt_info", buf);
+}
+#endif /* CONFIG_SET_DFU_ALT_INFO */
diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c 
b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
index f5b89a5ddc..1880dd9c55 100644
--- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
+++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -12,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -24,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ddr/ddr.h"
 
@@ -446,3 +449,24 @@ int board_late_init(void)
 
return 0;
 }
+
+#if defined(CONFIG_SET_DFU_ALT_INFO)
+
+#define DFU_ALT_BUF_LENSZ_1K
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
+
+   if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
+   env_get("dfu_alt_info"))
+   return;
+
+   memset(buf, 0, DFU_ALT_BUF_LEN);
+
+   snprintf(buf, DFU_ALT_BUF_LEN,
+"mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1");
+
+   env_set("dfu_alt_info", buf);
+}
+#endif /* CONFIG_SET_DFU_ALT_INFO */
diff --git a/board/emulation/common/qemu_dfu.c 
b/board/emulation/common/qemu_dfu.c
index 62234a7647..85dff4373b 100644
--- a/board/emulation/common/qemu_dfu.c
+++ b/board/emulation/common/qemu_dfu.c
@@ -44,10 +44,11 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
 
-   if (env_get("dfu_alt_info"))
+   if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
+   env_get("dfu_alt_info"))
return;
 
-   memset(buf, 0, sizeof(buf));
+   memset(buf, 0, DFU_ALT_BUF_LEN);
 
/*
 * Currently dfu_alt_info is needed on Qemu ARM64 for
@@ -64,5 +65,4 @@ 

[PATCH v3 5/9] capsule: kconfig: Select SET_DFU_ALT_INFO config symbol for capsule update

2022-03-30 Thread Sughosh Ganu
The capsule update code uses the dfu_alt_info variable for the actual
update of the firmware component. The dfu_alt_info variable gives
information needed to perform the update, like the device on which the
update is to be made, the partition, type of partition etc. Since the
dfu_alt_info is a environmental variable, it can be modified from the
u-boot command line. An incorrect update of the variable will result
in the update being done incorrectly.

Prevent this scenario by forcing an update of the dfu_alt_info
variable from the information obtained through the board file when
UEFI capsule update functionality is enabled.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: New Patch

 lib/efi_loader/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index e5e35fe51f..09fb8cbe75 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
select UPDATE_FIT
select DFU
+   select SET_DFU_ALT_INFO
select EFI_CAPSULE_FIRMWARE
help
  Select this option if you want to enable firmware management protocol
@@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
select DFU_WRITE_ALT
select DFU
+   select SET_DFU_ALT_INFO
select EFI_CAPSULE_FIRMWARE
help
  Select this option if you want to enable firmware management protocol
-- 
2.25.1



[PATCH v3 3/9] capsule: Put a check for image index before the update

2022-03-30 Thread Sughosh Ganu
The current capsule update code compares the image GUID value in the
capsule header with the image GUID value obtained from the
GetImageInfo function of the Firmware Management Protocol(FMP). This
comparison is done to ascertain if the FMP's SetImage function can be
called for the update. Make this checking more robust by comparing the
image_index value passed through the capsule with that returned by the
FMP's GetImageInfo function. This protects against the scenario of the
firmware being updated in a wrong partition/location on the storage
device if an incorrect value has been passed through the capsule,
since the image_index is used to determine the location of the update
on the storage device.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: New patch

 lib/efi_loader/efi_capsule.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index f00440163d..f03f4c9044 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -128,6 +128,7 @@ void set_capsule_result(int index, struct 
efi_capsule_header *capsule,
 /**
  * efi_fmp_find - search for Firmware Management Protocol drivers
  * @image_type:Image type guid
+ * @image_index:   Image Index
  * @instance:  Instance number
  * @handles:   Handles of FMP drivers
  * @no_handles:Number of handles
@@ -141,8 +142,8 @@ void set_capsule_result(int index, struct 
efi_capsule_header *capsule,
  * * NULL  - on failure
  */
 static struct efi_firmware_management_protocol *
-efi_fmp_find(efi_guid_t *image_type, u64 instance, efi_handle_t *handles,
-efi_uintn_t no_handles)
+efi_fmp_find(efi_guid_t *image_type, u8 image_index, u64 instance,
+efi_handle_t *handles, efi_uintn_t no_handles)
 {
efi_handle_t *handle;
struct efi_firmware_management_protocol *fmp;
@@ -203,6 +204,7 @@ efi_fmp_find(efi_guid_t *image_type, u64 instance, 
efi_handle_t *handles,
log_debug("+++ desc[%d] index: %d, name: %ls\n",
  j, desc->image_index, desc->image_id_name);
if (!guidcmp(>image_type_id, image_type) &&
+   (desc->image_index == image_index) &&
(!instance ||
 !desc->hardware_instance ||
  desc->hardware_instance == instance))
@@ -449,8 +451,8 @@ static efi_status_t efi_capsule_update_firmware(
}
 
/* find a device for update firmware */
-   /* TODO: should we pass index as well, or nothing but type? */
fmp = efi_fmp_find(>update_image_type_id,
+  image->update_image_index,
   image->update_hardware_instance,
   handles, no_handles);
if (!fmp) {
-- 
2.25.1



[PATCH v3 1/9] capsule: Add Image GUIDs and image index for platforms using capsule updates

2022-03-30 Thread Sughosh Ganu
Currently, all platforms that enable capsule updates do so using
either EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID or
EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID. This is based on the Firmware
Management Protocol(FMP) instance used on the platform. However, this
means that all platforms that enable a particular FMP instance have
the same GUID value for all the updatable images, either the FIT image
GUID or the raw image GUID, and that an image for some platform can be
updated on any other platform which uses the same FMP instance. Another
issue with this implementation is that the ESRT table shows the same
GUID value for all images on the platform and also across platforms,
which is not in compliance with the UEFI specification.

Fix this by defining image GUID values and firmware names for
individual images per platform. The GetImageInfo FMP hook would then
populate these values in the image descriptor array.

Also add the image index value associated with a particular
image. This is the value that should match with the image_index value
that is part of the capsule header. The capsule update code will check
if the two values match, and the update will only proceed on a match.

Signed-off-by: Sughosh Ganu 
---

Changes since V2:
* Add a new member image_index to the struct efi_fw_images to allow
  the platforms to define the values for images.
* Address review comments from Michal Simek for the xilinx boards.
* Fix double inclusion of efi_loader.h as was pointed out by Heiko
  Thiery.


 .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c   | 20 +
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 19 +
 board/emulation/qemu-arm/qemu-arm.c   | 20 +
 board/kontron/pitx_imx8m/pitx_imx8m.c | 16 ++-
 board/kontron/sl-mx8mm/sl-mx8mm.c | 15 ++
 board/kontron/sl28/sl28.c | 15 ++
 board/sandbox/sandbox.c   | 28 +++
 board/socionext/developerbox/developerbox.c   | 26 +
 board/xilinx/common/board.c   | 24 
 include/configs/imx8mm-cl-iot-gate.h  | 10 +++
 include/configs/imx8mp_rsb3720.h  | 10 +++
 include/configs/kontron-sl-mx8mm.h|  6 
 include/configs/kontron_pitx_imx8m.h  |  6 
 include/configs/kontron_sl28.h|  6 
 include/configs/qemu-arm.h| 10 +++
 include/configs/sandbox.h | 14 ++
 include/configs/synquacer.h   | 14 ++
 include/configs/xilinx_versal.h   |  6 
 include/configs/xilinx_zynqmp.h   | 10 +++
 include/configs/zynq-common.h | 10 +++
 include/efi_loader.h  | 18 
 21 files changed, 302 insertions(+), 1 deletion(-)

diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c 
b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
index 16566092bd..1c953ba195 100644
--- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
+++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
@@ -6,6 +6,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -21,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -44,6 +47,23 @@ static void setup_gpmi_nand(void)
 }
 #endif
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+   {
+#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
+   .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
+#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
+   .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,
+#endif
+   .fw_name = u"IMX8MP-RSB3720-FIT",
+   .image_index = 1
+   },
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
+
 int board_early_init_f(void)
 {
struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c 
b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
index 7e2d88f449..f5b89a5ddc 100644
--- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
+++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
@@ -5,6 +5,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -21,11 +23,28 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ddr/ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+   {
+#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE)
+   .image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID,
+#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE)
+   .image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID,
+#endif
+   .fw_name = u"IMX8MM-CL-IOT-GATE-FIT",
+   .image_index = 1
+   },
+};
+
+u8 

[PATCH v3 2/9] capsule: FMP: Populate the image descriptor array from platform data

2022-03-30 Thread Sughosh Ganu
Currently, the image descriptor array that has been passed to the
GetImageInfo function of the Firmware Management Protocol(FMP) gets
populated through the data stored with the dfu framework. The
dfu data is not restricted to contain information only of the images
updatable through the capsule update mechanism, but it also contains
information on other images.

The image descriptor array is also parsed by the ESRT generation code,
and thus the ESRT table contains entries for other images that are not
being handled by the FMP for the capsule updates.

The other issue fixed is assignment of a separate GUID for all images
in the image descriptor array. The UEFI specification mandates that
all entries in the ESRT table should have a unique GUID value as part
of the FwClass member of the EFI_SYSTEM_RESOURCE_ENTRY. Currently, all
images are assigned a single GUID value, either an FIT GUID or a raw
image GUID. This is fixed by obtaining the GUID values from the
efi_fw_images array defined per platform.

Signed-off-by: Sughosh Ganu 
---

Changes since V2: 
* Use the image index values defined in the platform's fw_images array
  for the image descriptors

 include/efi_loader.h  |  3 ++
 lib/efi_loader/efi_firmware.c | 91 +++
 2 files changed, 30 insertions(+), 64 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 284d64547b..9704397bd7 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -997,6 +997,9 @@ struct efi_fw_images {
u8 image_index;
 };
 
+extern struct efi_fw_images fw_images[];
+extern u8 num_image_type_guids;
+
 /**
  * Install the ESRT system table.
  *
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index a5ff32f121..169f3a29bb 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -97,91 +97,60 @@ efi_status_t EFIAPI 
efi_firmware_set_package_info_unsupported(
 }
 
 /**
- * efi_get_dfu_info - return information about the current firmware image
+ * efi_fill_image_desc_array - populate image descriptor array
  * @this:  Protocol instance
  * @image_info_size:   Size of @image_info
  * @image_info:Image information
  * @descriptor_version:Pointer to version number
- * @descriptor_count:  Pointer to number of descriptors
+ * @descriptor_count:  Image count
  * @descriptor_size:   Pointer to descriptor size
- * package_version:Package version
- * package_version_name:   Package version's name
- * image_type: Image type GUID
+ * @package_version:   Package version
+ * @package_version_name:  Package version's name
  *
  * Return information bout the current firmware image in @image_info.
  * @image_info will consist of a number of descriptors.
- * Each descriptor will be created based on "dfu_alt_info" variable.
+ * Each descriptor will be created based on "efi_fw_images" variable.
  *
  * Return  status code
  */
-static efi_status_t efi_get_dfu_info(
+static efi_status_t efi_fill_image_desc_array(
efi_uintn_t *image_info_size,
struct efi_firmware_image_descriptor *image_info,
u32 *descriptor_version,
u8 *descriptor_count,
efi_uintn_t *descriptor_size,
u32 *package_version,
-   u16 **package_version_name,
-   const efi_guid_t *image_type)
+   u16 **package_version_name)
 {
-   struct dfu_entity *dfu;
size_t names_len, total_size;
-   int dfu_num, i;
-   u16 *name, *next;
-   int ret;
-
-   ret = dfu_init_env_entities(NULL, NULL);
-   if (ret)
-   return EFI_SUCCESS;
+   struct efi_fw_images *fw_array;
+   u8 image_count;
+   int i;
 
+   fw_array = _images[0];
+   *descriptor_count = image_count = num_image_type_guids;
names_len = 0;
-   dfu_num = 0;
-   list_for_each_entry(dfu, _list, list) {
-   names_len += (utf8_utf16_strlen(dfu->name) + 1) * 2;
-   dfu_num++;
-   }
-   if (!dfu_num) {
-   log_warning("No entities in dfu_alt_info\n");
-   *image_info_size = 0;
-   dfu_free_entities();
 
-   return EFI_SUCCESS;
-   }
+   total_size = sizeof(*image_info) * image_count;
 
-   total_size = sizeof(*image_info) * dfu_num + names_len;
-   /*
-* we will assume that sizeof(*image_info) * dfu_name
-* is, at least, a multiple of 2. So the start address for
-* image_id_name would be aligned with 2 bytes.
-*/
if (*image_info_size < total_size) {
*image_info_size = total_size;
-   dfu_free_entities();
 
return EFI_BUFFER_TOO_SMALL;
}
*image_info_size = total_size;
 
*descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
-   *descriptor_count = dfu_num;
*descriptor_size = 

[PATCH v3 0/9] efi: capsule: Capsule Update fixes and enhancements

2022-03-30 Thread Sughosh Ganu


This series is cleaning up the usage of the image GUIDs that are used
in capsule update and the EFI System Resource Table(ESRT). There are
some other enhancements being made to the capsule update code to make
it more robust.

Firstly, an overview of the fixes being made.

Currently, there are two instances of the Firmware Management
Protocol(FMP), one defined for updating the FIT images, and the other
for updating raw images. The FMP code defines two GUID values, one for
all FIT images, and one for raw images. Depending on the FMP instance
used on a platform, the platform needs to use the corresponding image
GUID value for all images on the platform, and also across platforms.

A few issues are being fixed through the patch series. One, that an
image for a different platform can be flashed on another platform if
both the platforms are using the same FMP instance. So, for e.g. a
capsule generated for the Socionext DeveloperBox platform can be
flashed on the ZynqMP platform, since both the platforms use the
CONFIG_EFI_CAPSULE_FIRMWARE_RAW instance of the FMP. This can be
corrected if each firmware image that can be updated through the
capsule update mechanism has it's own unique image GUID.

The second issue that this patch series fixes is the value of FwClass
in the ESRT. With the current logic, all firmware image entries in the
ESRT display the same GUID value -- either the FIT GUID or the raw
GUID. This is not in compliance with the UEFI specification, as the
specification requires all entries to have unique GUID values.

The third issue being fixed is the population of the
EFI_FIRMWARE_IMAGE_DESCRIPTOR array. The current code uses the dfu
framework for populating the image descriptor array. However, there
might be other images that are not to be updated through the capsule
update mechanism also registered with the dfu framework. As a result
of this, the ESRT will show up entries of images that are not to be
targeted by the capsule update mechanism.

These issues are being fixed by defining a structure, efi_fw_images. A
platform can then define image related information like the image GUID
and image name. Every platform that uses capsule update mechanism
needs to define fw_images array. This array will then be used to
populate the image descriptor array, and also in determining if a
particular capsule's payload can be used for updating an image on the
platform.


The other part of the patches are some enhancements being made to the
capsule update code to make it more robust.

The first enhancement being made is to have a check for the image
index being passed through the capsule header. The capsule update code
uses the image index value as the dfu alt number, which points to the
partition to which the update must be made. The platform is supposed
to define the image index value for the updatable firmare images as
part of the fw_images array. This value must correspond to the dfu alt
num for the corresponding image, and can be obtained by checking the
output of the 'dfu list' u-boot command. At the time of update, the
image index being passed through the capsule is checked against the
image index value obtained from the platform.

The second enhancement made is the retrieval of the dfu_alt_info
variable from the set_dfu_alt_info function defined in the board
file. The dfu framework checks for the existence of this function, and
if the function is not defined, gets the value from the
environment. This can cause in an incorrect update if the environment
variable value is incorrect. By mandating all the platforms which
enable the capsule update feature to define set_dfu_alt_info function,
the variable is then obtained from the board file rather than the
environment.

Changes since V2:

* Add a new member image_index to the struct efi_fw_images to allow
  the platforms to define the values for images.
* Address review comments from Michal Simek for the xilinx boards.
* Fix double inclusion of efi_loader.h as was pointed out by Heiko
  Thiery.
* Use the image index values defined in the platform's fw_images array
  for the image descriptors
* Add a description for adding image index value and definition of
  set_dfu_alt_info function for the capsule updates.


The first patch adds the structure efi_fw_images and defines an array
fw_images on all platforms which enable capsule update feature

The second patch populates the image descriptor array in the
GetImageInfo function with the values from the fw_images array

The third patch adds a check for the image index value from the
capsule header against the value obtained from the fw_images array for
the corresponding image

The fourth patch defines the function set_dfu_alt_info for all the
platforms which enable capsule update feature.

The fifth patch selects SET_DFU_ALT_INFO config symbol for all
platforms that enable capsule update feature.

The sixth patch splits the capsule update test script into two, one
for FMP for raw images, and one for FMP for FIT 

Re: [PATCH 1/2] net: phy: marvell: Support reg config via "marvell, reg-init" DT property

2022-03-30 Thread Marek Behún
On Wed, 30 Mar 2022 15:33:34 +0200
Stefan Roese  wrote:

> So how to continue? Add this "reg-init" "feature" for now? And perhaps
> drop it once this LED configuration is possible via the way you describe
> above? Or drop it once it's also dropped in the Kernel? My personal
> feeling is, that supporting "reg-init" does not "hurt" and might even be
> handy for some testing / debugging of network PHY setups.

Add it now, maybe we will drop it sometime in future if no dts uses it
anymore.

Kernel will need to support it forever because of backwards
compatibility with older DTBs.

Marek


Re: [PATCH] powerpc: Fix incorrect SYS_IMMR migration values

2022-03-30 Thread Pali Rohár
On Wednesday 30 March 2022 09:30:15 Tom Rini wrote:
> When migrating SYS_IMMR, I didn't allow for boards to provide
> non-default values here.  This lead to an incorrect migration on the
> platforms where CONFIG_SYS_IMMR is set to CONFIG_SYS_CCSRBAR and
> CONFIG_SYS_CSSRBAR is NOT the same as CONFIG_SYS_CCSRBAR_DEFAULT.  Add
> text to the prompt so that non-default values can be used and re-migrate
> the platforms that have CONFIG_SYS_IMMR=CONFIG_SYS_CSSRBAR where
> CONFIG_SYS_CSSRBAR != CONFIG_SYS_CCSRBAR_DEFAULT.
> 
> Fixes: be7dbb60c5bf ("Convert CONFIG_SYS_IMMR to Kconfig")
> Reported-by: Pali Rohár 
> Signed-off-by: Tom Rini 

For P2020RDB-PC_SDCARD_defconfig:
Tested-by: Pali Rohár 

> ---
>  arch/Kconfig | 2 +-
>  configs/MPC8548CDS_36BIT_defconfig   | 1 +
>  configs/MPC8548CDS_defconfig | 1 +
>  configs/MPC8548CDS_legacy_defconfig  | 1 +
>  configs/P1010RDB-PA_36BIT_NAND_defconfig | 1 +
>  configs/P1010RDB-PA_36BIT_NOR_defconfig  | 1 +
>  configs/P1010RDB-PA_36BIT_SDCARD_defconfig   | 1 +
>  configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig | 1 +
>  configs/P1010RDB-PA_NAND_defconfig   | 1 +
>  configs/P1010RDB-PA_NOR_defconfig| 1 +
>  configs/P1010RDB-PA_SDCARD_defconfig | 1 +
>  configs/P1010RDB-PA_SPIFLASH_defconfig   | 1 +
>  configs/P1010RDB-PB_36BIT_NAND_defconfig | 1 +
>  configs/P1010RDB-PB_36BIT_NOR_defconfig  | 1 +
>  configs/P1010RDB-PB_36BIT_SDCARD_defconfig   | 1 +
>  configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig | 1 +
>  configs/P1010RDB-PB_NAND_defconfig   | 1 +
>  configs/P1010RDB-PB_NOR_defconfig| 1 +
>  configs/P1010RDB-PB_SDCARD_defconfig | 1 +
>  configs/P1010RDB-PB_SPIFLASH_defconfig   | 1 +
>  configs/P1020RDB-PC_36BIT_NAND_defconfig | 1 +
>  configs/P1020RDB-PC_36BIT_SDCARD_defconfig   | 1 +
>  configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig | 1 +
>  configs/P1020RDB-PC_36BIT_defconfig  | 1 +
>  configs/P1020RDB-PC_NAND_defconfig   | 1 +
>  configs/P1020RDB-PC_SDCARD_defconfig | 1 +
>  configs/P1020RDB-PC_SPIFLASH_defconfig   | 1 +
>  configs/P1020RDB-PC_defconfig| 1 +
>  configs/P1020RDB-PD_NAND_defconfig   | 1 +
>  configs/P1020RDB-PD_SDCARD_defconfig | 1 +
>  configs/P1020RDB-PD_SPIFLASH_defconfig   | 1 +
>  configs/P1020RDB-PD_defconfig| 1 +
>  configs/P2020RDB-PC_36BIT_NAND_defconfig | 1 +
>  configs/P2020RDB-PC_36BIT_SDCARD_defconfig   | 1 +
>  configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig | 1 +
>  configs/P2020RDB-PC_36BIT_defconfig  | 1 +
>  configs/P2020RDB-PC_NAND_defconfig   | 1 +
>  configs/P2020RDB-PC_SDCARD_defconfig | 1 +
>  configs/P2020RDB-PC_SPIFLASH_defconfig   | 1 +
>  configs/P2020RDB-PC_defconfig| 1 +
>  configs/socrates_defconfig   | 1 +
>  41 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index e6191446a357..7ecb375b6b5a 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -363,7 +363,7 @@ config SYS_DISABLE_DCACHE_OPS
>this functionality.
>  
>  config SYS_IMMR
> - hex
> + hex "Address for the Internal Memory-Mapped Registers (IMMR) window"
>   depends on PPC || FSL_LSCH2 || FSL_LSCH3 || ARCH_LS1021A
>   default 0xFF00 if MPC8xx
>   default 0xF000 if ARCH_MPC8313
> diff --git a/configs/MPC8548CDS_36BIT_defconfig 
> b/configs/MPC8548CDS_36BIT_defconfig
> index d6351d5b11b9..240c6bec3758 100644
> --- a/configs/MPC8548CDS_36BIT_defconfig
> +++ b/configs/MPC8548CDS_36BIT_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_PPC=y
> +CONFIG_SYS_IMMR=0xE000
>  CONFIG_SYS_TEXT_BASE=0xFFF8
>  CONFIG_SYS_MALLOC_LEN=0x10
>  CONFIG_ENV_SIZE=0x2000
> diff --git a/configs/MPC8548CDS_defconfig b/configs/MPC8548CDS_defconfig
> index da0b80b09d7b..434ab0939b0b 100644
> --- a/configs/MPC8548CDS_defconfig
> +++ b/configs/MPC8548CDS_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_PPC=y
> +CONFIG_SYS_IMMR=0xE000
>  CONFIG_SYS_TEXT_BASE=0xFFF8
>  CONFIG_SYS_MALLOC_LEN=0x10
>  CONFIG_ENV_SIZE=0x2000
> diff --git a/configs/MPC8548CDS_legacy_defconfig 
> b/configs/MPC8548CDS_legacy_defconfig
> index 87d1fd716c95..eb8233dfd67e 100644
> --- a/configs/MPC8548CDS_legacy_defconfig
> +++ b/configs/MPC8548CDS_legacy_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_PPC=y
> +CONFIG_SYS_IMMR=0xE000
>  CONFIG_SYS_TEXT_BASE=0xFFF8
>  CONFIG_SYS_MALLOC_LEN=0x10
>  CONFIG_ENV_SIZE=0x2000
> diff --git a/configs/P1010RDB-PA_36BIT_NAND_defconfig 
> b/configs/P1010RDB-PA_36BIT_NAND_defconfig
> index 61fd2a78a4e3..314d73a8ae1e 100644
> --- a/configs/P1010RDB-PA_36BIT_NAND_defconfig
> +++ b/configs/P1010RDB-PA_36BIT_NAND_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_PPC=y
> +CONFIG_SYS_IMMR=0xFFE0
>  CONFIG_SYS_TEXT_BASE=0x11001000
>  CONFIG_SYS_MALLOC_LEN=0x10
>  CONFIG_ENV_SIZE=0x4000
> diff --git 

Re: [PATCH 1/2] net: phy: marvell: Support reg config via "marvell, reg-init" DT property

2022-03-30 Thread Stefan Roese

On 3/30/22 14:16, Marek Behún wrote:

On Wed, 30 Mar 2022 10:38:25 +0200
Stefan Roese  wrote:


This patch adds support for the "marvell,reg-init" DT property, which
is used to describe board specific Marvell PHY register configurations
in the board dts file. This DT property is supported in the Linux Kernel
since a longer time. Adding it to U-Boot now, enables the boards which
describe the register settings in their DT files here as well.

I've included calling this marvell_of_reg_init() to all foo_config()
functions in this patch as well. If CONFIG_DM_ETH is not set, there is
no ofnode, or no "marvell,reg-init" property, the PHY initialization is
unchanged.

The function marvell_of_reg_init() is a port of the Linux version.
Please note that I explicitly did not add error checking and handling
to the U-Boot version, as this is basically not done for phy_read/write
in this Marvell PHY code.

This will be used by the upcoming ethernet support on the MIPS
Octeon EBB 7304 board.

Signed-off-by: Stefan Roese 
Cc: Ramon Fried 
Cc: Joe Hershberger 
Cc: Aaron Williams 
Cc: Chandrakala Chavva 


Hi Stefan, I know this property is used also in kernel, but what do you
want to use it for?


Frankly, I do not know exactly. It's part of the MIPS Octeon ethernet
support in mainline U-Boot, which also uses this DT property on the
EBB7304 board. I've not analyzed the register settings in detail to
check which register is being configured to which value to see, why this
might be the case. Dropping these register settings might have resulted
in problems not directly spotted on the board. So my plan was to
integrate these as well.

For reference, I've added the current DT reg-init setting below [1].
This is for the 88e1240 PHY, and taking a quick look in the manual,
this seems to be LED related (see below).



Because in kernel the idea is to deprecate it.


This is new to me.


It is used for example to confiure INT pin, but that should have it's
own property once someone implements it. It is also used to configure
LEDs, and that is hopefully gonna be obsoleted by supporting the LEDs
via the LED subsystem, so afterwards we will write
ethernet-phy@1 {
   leds {
   led@0 {
   color = ...;
   };
   };
};


That would be very cool indeed. Even though it's not possible "right
now".

So how to continue? Add this "reg-init" "feature" for now? And perhaps
drop it once this LED configuration is possible via the way you describe
above? Or drop it once it's also dropped in the Kernel? My personal
feeling is, that supporting "reg-init" does not "hurt" and might even be
handy for some testing / debugging of network PHY setups.

Perhaps Ramon and/or Joe also have some comments on this.

Thanks,
Stefan

[1] marvell,reg-init = <3 0x10 0 0x8665>,
   <3 0x11 0 0x00aa>,
   <3 0x12 0 0x4105>,
   <3 0x13 0 0x8a08>;


[PATCH] powerpc: Fix incorrect SYS_IMMR migration values

2022-03-30 Thread Tom Rini
When migrating SYS_IMMR, I didn't allow for boards to provide
non-default values here.  This lead to an incorrect migration on the
platforms where CONFIG_SYS_IMMR is set to CONFIG_SYS_CCSRBAR and
CONFIG_SYS_CSSRBAR is NOT the same as CONFIG_SYS_CCSRBAR_DEFAULT.  Add
text to the prompt so that non-default values can be used and re-migrate
the platforms that have CONFIG_SYS_IMMR=CONFIG_SYS_CSSRBAR where
CONFIG_SYS_CSSRBAR != CONFIG_SYS_CCSRBAR_DEFAULT.

Fixes: be7dbb60c5bf ("Convert CONFIG_SYS_IMMR to Kconfig")
Reported-by: Pali Rohár 
Signed-off-by: Tom Rini 
---
 arch/Kconfig | 2 +-
 configs/MPC8548CDS_36BIT_defconfig   | 1 +
 configs/MPC8548CDS_defconfig | 1 +
 configs/MPC8548CDS_legacy_defconfig  | 1 +
 configs/P1010RDB-PA_36BIT_NAND_defconfig | 1 +
 configs/P1010RDB-PA_36BIT_NOR_defconfig  | 1 +
 configs/P1010RDB-PA_36BIT_SDCARD_defconfig   | 1 +
 configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig | 1 +
 configs/P1010RDB-PA_NAND_defconfig   | 1 +
 configs/P1010RDB-PA_NOR_defconfig| 1 +
 configs/P1010RDB-PA_SDCARD_defconfig | 1 +
 configs/P1010RDB-PA_SPIFLASH_defconfig   | 1 +
 configs/P1010RDB-PB_36BIT_NAND_defconfig | 1 +
 configs/P1010RDB-PB_36BIT_NOR_defconfig  | 1 +
 configs/P1010RDB-PB_36BIT_SDCARD_defconfig   | 1 +
 configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig | 1 +
 configs/P1010RDB-PB_NAND_defconfig   | 1 +
 configs/P1010RDB-PB_NOR_defconfig| 1 +
 configs/P1010RDB-PB_SDCARD_defconfig | 1 +
 configs/P1010RDB-PB_SPIFLASH_defconfig   | 1 +
 configs/P1020RDB-PC_36BIT_NAND_defconfig | 1 +
 configs/P1020RDB-PC_36BIT_SDCARD_defconfig   | 1 +
 configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig | 1 +
 configs/P1020RDB-PC_36BIT_defconfig  | 1 +
 configs/P1020RDB-PC_NAND_defconfig   | 1 +
 configs/P1020RDB-PC_SDCARD_defconfig | 1 +
 configs/P1020RDB-PC_SPIFLASH_defconfig   | 1 +
 configs/P1020RDB-PC_defconfig| 1 +
 configs/P1020RDB-PD_NAND_defconfig   | 1 +
 configs/P1020RDB-PD_SDCARD_defconfig | 1 +
 configs/P1020RDB-PD_SPIFLASH_defconfig   | 1 +
 configs/P1020RDB-PD_defconfig| 1 +
 configs/P2020RDB-PC_36BIT_NAND_defconfig | 1 +
 configs/P2020RDB-PC_36BIT_SDCARD_defconfig   | 1 +
 configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig | 1 +
 configs/P2020RDB-PC_36BIT_defconfig  | 1 +
 configs/P2020RDB-PC_NAND_defconfig   | 1 +
 configs/P2020RDB-PC_SDCARD_defconfig | 1 +
 configs/P2020RDB-PC_SPIFLASH_defconfig   | 1 +
 configs/P2020RDB-PC_defconfig| 1 +
 configs/socrates_defconfig   | 1 +
 41 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index e6191446a357..7ecb375b6b5a 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -363,7 +363,7 @@ config SYS_DISABLE_DCACHE_OPS
 this functionality.
 
 config SYS_IMMR
-   hex
+   hex "Address for the Internal Memory-Mapped Registers (IMMR) window"
depends on PPC || FSL_LSCH2 || FSL_LSCH3 || ARCH_LS1021A
default 0xFF00 if MPC8xx
default 0xF000 if ARCH_MPC8313
diff --git a/configs/MPC8548CDS_36BIT_defconfig 
b/configs/MPC8548CDS_36BIT_defconfig
index d6351d5b11b9..240c6bec3758 100644
--- a/configs/MPC8548CDS_36BIT_defconfig
+++ b/configs/MPC8548CDS_36BIT_defconfig
@@ -1,4 +1,5 @@
 CONFIG_PPC=y
+CONFIG_SYS_IMMR=0xE000
 CONFIG_SYS_TEXT_BASE=0xFFF8
 CONFIG_SYS_MALLOC_LEN=0x10
 CONFIG_ENV_SIZE=0x2000
diff --git a/configs/MPC8548CDS_defconfig b/configs/MPC8548CDS_defconfig
index da0b80b09d7b..434ab0939b0b 100644
--- a/configs/MPC8548CDS_defconfig
+++ b/configs/MPC8548CDS_defconfig
@@ -1,4 +1,5 @@
 CONFIG_PPC=y
+CONFIG_SYS_IMMR=0xE000
 CONFIG_SYS_TEXT_BASE=0xFFF8
 CONFIG_SYS_MALLOC_LEN=0x10
 CONFIG_ENV_SIZE=0x2000
diff --git a/configs/MPC8548CDS_legacy_defconfig 
b/configs/MPC8548CDS_legacy_defconfig
index 87d1fd716c95..eb8233dfd67e 100644
--- a/configs/MPC8548CDS_legacy_defconfig
+++ b/configs/MPC8548CDS_legacy_defconfig
@@ -1,4 +1,5 @@
 CONFIG_PPC=y
+CONFIG_SYS_IMMR=0xE000
 CONFIG_SYS_TEXT_BASE=0xFFF8
 CONFIG_SYS_MALLOC_LEN=0x10
 CONFIG_ENV_SIZE=0x2000
diff --git a/configs/P1010RDB-PA_36BIT_NAND_defconfig 
b/configs/P1010RDB-PA_36BIT_NAND_defconfig
index 61fd2a78a4e3..314d73a8ae1e 100644
--- a/configs/P1010RDB-PA_36BIT_NAND_defconfig
+++ b/configs/P1010RDB-PA_36BIT_NAND_defconfig
@@ -1,4 +1,5 @@
 CONFIG_PPC=y
+CONFIG_SYS_IMMR=0xFFE0
 CONFIG_SYS_TEXT_BASE=0x11001000
 CONFIG_SYS_MALLOC_LEN=0x10
 CONFIG_ENV_SIZE=0x4000
diff --git a/configs/P1010RDB-PA_36BIT_NOR_defconfig 
b/configs/P1010RDB-PA_36BIT_NOR_defconfig
index 0e537ebb5213..ebfb9c43f7ae 100644
--- a/configs/P1010RDB-PA_36BIT_NOR_defconfig
+++ b/configs/P1010RDB-PA_36BIT_NOR_defconfig
@@ -1,4 +1,5 @@
 CONFIG_PPC=y
+CONFIG_SYS_IMMR=0xFFE0
 CONFIG_SYS_TEXT_BASE=0xEFF4
 CONFIG_SYS_MALLOC_LEN=0x10
 

  1   2   >