Re: [PATCH 5/5] pci: Fix showing registers

2021-10-07 Thread Stefan Roese

On 07.10.21 14:51, Pali Rohár wrote:

Header type is 7-bit number so use all 7 bits when detecting header type
and not only 2 bits.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  cmd/pci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/pci.c b/cmd/pci.c
index 4a82854db7fa..3b1863f139c9 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -239,7 +239,7 @@ static void pci_header_show(struct udevice *dev)
   pci_class_str(class));
pci_show_regs(dev, regs_rest);
  
-	switch (header_type & 0x03) {

+   switch (header_type & 0x7f) {
case PCI_HEADER_TYPE_NORMAL:/* "normal" PCI device */
pci_show_regs(dev, regs_normal);
break;




Viele Grüße,
Stefan

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


Re: [PATCH 4/5] pci: Fix showing bars

2021-10-07 Thread Stefan Roese

On 07.10.21 14:51, Pali Rohár wrote:

Header type is 7-bit number so properly clear upper 8th bit which
indicates multifunction device.

And do not try to show bars for unsupported header types.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  cmd/pci.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/cmd/pci.c b/cmd/pci.c
index cfabdc0f3012..4a82854db7fa 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -71,10 +71,15 @@ static int pci_bar_show(struct udevice *dev)
int prefetchable;
  
  	dm_pci_read_config8(dev, PCI_HEADER_TYPE, _type);

+   header_type &= 0x7f;
  
  	if (header_type == PCI_HEADER_TYPE_CARDBUS) {

printf("CardBus doesn't support BARs\n");
return -ENOSYS;
+   } else if (header_type != PCI_HEADER_TYPE_NORMAL &&
+  header_type != PCI_HEADER_TYPE_BRIDGE) {
+   printf("unknown header type\n");
+   return -ENOSYS;
}
  
  	bar_cnt = (header_type == PCI_HEADER_TYPE_NORMAL) ? 6 : 2;





Viele Grüße,
Stefan

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


Re: [PATCH 3/5] pci: Fix configuring BARs

2021-10-07 Thread Stefan Roese

On 07.10.21 14:50, Pali Rohár wrote:

Number of BARs is defined by header type, not by class code.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  drivers/pci/pci_auto.c | 31 +--
  1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index 288f7996c7c0..5af4ee6e56df 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -19,7 +19,7 @@
  #define CONFIG_SYS_PCI_CACHE_LINE_SIZE8
  #endif
  
-static void dm_pciauto_setup_device(struct udevice *dev, int bars_num,

+static void dm_pciauto_setup_device(struct udevice *dev,
struct pci_region *mem,
struct pci_region *prefetch,
struct pci_region *io)
@@ -28,6 +28,7 @@ static void dm_pciauto_setup_device(struct udevice *dev, int 
bars_num,
pci_size_t bar_size;
u16 cmdstat = 0;
int bar, bar_nr = 0;
+   int bars_num;
u8 header_type;
int rom_addr;
pci_addr_t bar_value;
@@ -39,6 +40,26 @@ static void dm_pciauto_setup_device(struct udevice *dev, int 
bars_num,
cmdstat = (cmdstat & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) |
PCI_COMMAND_MASTER;
  
+	dm_pci_read_config8(dev, PCI_HEADER_TYPE, _type);

+   header_type &= 0x7f;
+
+   switch (header_type) {
+   case PCI_HEADER_TYPE_NORMAL:
+   bars_num = 6;
+   break;
+   case PCI_HEADER_TYPE_BRIDGE:
+   bars_num = 2;
+   break;
+   case PCI_HEADER_TYPE_CARDBUS:
+   /* CardBus header does not have any BAR */
+   bars_num = 0;
+   break;
+   default:
+   /* Skip configuring BARs for unknown header types */
+   bars_num = 0;
+   break;
+   }
+
for (bar = PCI_BASE_ADDRESS_0;
 bar < PCI_BASE_ADDRESS_0 + (bars_num * 4); bar += 4) {
int ret = 0;
@@ -129,8 +150,6 @@ static void dm_pciauto_setup_device(struct udevice *dev, 
int bars_num,
}
  
  	/* Configure the expansion ROM address */

-   dm_pci_read_config8(dev, PCI_HEADER_TYPE, _type);
-   header_type &= 0x7f;
if (header_type == PCI_HEADER_TYPE_NORMAL ||
header_type == PCI_HEADER_TYPE_BRIDGE) {
rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ?
@@ -343,7 +362,7 @@ int dm_pciauto_config_device(struct udevice *dev)
debug("PCI Autoconfig: Found P2P bridge, device %d\n",
  PCI_DEV(dm_pci_get_bdf(dev)));
  
-		dm_pciauto_setup_device(dev, 2, pci_mem, pci_prefetch, pci_io);

+   dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io);
  
  		ret = dm_pci_hose_probe_bus(dev);

if (ret < 0)
@@ -356,7 +375,7 @@ int dm_pciauto_config_device(struct udevice *dev)
 * just do a minimal setup of the bridge,
 * let the OS take care of the rest
 */
-   dm_pciauto_setup_device(dev, 0, pci_mem, pci_prefetch, pci_io);
+   dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io);
  
  		debug("PCI Autoconfig: Found P2CardBus bridge, device %d\n",

  PCI_DEV(dm_pci_get_bdf(dev)));
@@ -388,7 +407,7 @@ int dm_pciauto_config_device(struct udevice *dev)
/* fall through */
  
  	default:

-   dm_pciauto_setup_device(dev, 6, pci_mem, pci_prefetch, pci_io);
+   dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io);
break;
}
  




Viele Grüße,
Stefan

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


Re: [PATCH 2/5] pci: Skip configuring invalid P2P bridge devices

2021-10-07 Thread Stefan Roese

On 07.10.21 14:50, Pali Rohár wrote:

Function dm_pci_hose_probe_bus() expects that bus is valid PCI device with
Bridge header type (0x01). So add check before touching PCI config space to
prevent misconfiguring some non-standard device.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  drivers/pci/pci-uclass.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 044babee164f..5da3515f5f25 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -627,6 +627,7 @@ int pci_generic_mmap_read_config(
  
  int dm_pci_hose_probe_bus(struct udevice *bus)

  {
+   u8 header_type;
int sub_bus;
int ret;
int ea_pos;
@@ -634,6 +635,14 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
  
  	debug("%s\n", __func__);
  
+	dm_pci_read_config8(bus, PCI_HEADER_TYPE, _type);

+   header_type &= 0x7f;
+   if (header_type != PCI_HEADER_TYPE_BRIDGE) {
+   debug("%s: Skipping PCI device %d with Non-Bridge Header Type 
0x%x\n",
+ __func__, PCI_DEV(dm_pci_get_bdf(bus)), header_type);
+   return log_msg_ret("probe", -EINVAL);
+   }
+
ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
if (ea_pos) {
dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),




Viele Grüße,
Stefan

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


Re: [PATCH 1/5] pci: Skip configuring PCI Rom Address for unsupported header types

2021-10-07 Thread Stefan Roese

On 07.10.21 14:50, Pali Rohár wrote:

PCI Rom Address is currently supported only for Normal (0x00) and
Bridge (0x01) header types. Fix code accordingly.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  drivers/pci/pci_auto.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index 08082460eb86..288f7996c7c0 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -131,7 +131,8 @@ static void dm_pciauto_setup_device(struct udevice *dev, 
int bars_num,
/* Configure the expansion ROM address */
dm_pci_read_config8(dev, PCI_HEADER_TYPE, _type);
header_type &= 0x7f;
-   if (header_type != PCI_HEADER_TYPE_CARDBUS) {
+   if (header_type == PCI_HEADER_TYPE_NORMAL ||
+   header_type == PCI_HEADER_TYPE_BRIDGE) {
rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ?
PCI_ROM_ADDRESS : PCI_ROM_ADDRESS1;
dm_pci_write_config32(dev, rom_addr, 0xfffe);




Viele Grüße,
Stefan

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


Re: [PATCH] ARM: mvebu: x530: Remove custom kwbimage.cfg

2021-10-07 Thread Stefan Roese

On 07.10.21 10:39, Chris Packham wrote:

Commit ca1a4c863232 ("mvebu: select boot device at SoC level") made it
unnecessary for the A385 boards to have their own kwbimage.cfg but as
the x530 was in flight at the time it was added with it's own
kwbimage.cfg. Remove the custom kwbimage.cfg as the SoC level file is
suitable.

Signed-off-by: Chris Packham 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  board/alliedtelesis/x530/kwbimage.cfg | 12 
  1 file changed, 12 deletions(-)
  delete mode 100644 board/alliedtelesis/x530/kwbimage.cfg

diff --git a/board/alliedtelesis/x530/kwbimage.cfg 
b/board/alliedtelesis/x530/kwbimage.cfg
deleted file mode 100644
index f58d388825e7..
--- a/board/alliedtelesis/x530/kwbimage.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Copyright (C) 2017 Allied Telesis Labs
-#
-
-# Armada XP uses version 1 image format
-VERSION1
-
-# Boot Media configurations
-BOOT_FROM  spi
-
-# Binary Header (bin_hdr) with DDR3 training code
-BINARY spl/u-boot-spl-dtb.bin 005b 0068




Viele Grüße,
Stefan

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


Re: [resent RFC 06/22] sata: call device_probe() after scanning

2021-10-07 Thread Ilias Apalodimas
[...]
> > > +   ret = device_probe(bdev);
> > > +   if (ret < 0) {
> > > +   debug("Can't probe\n");
> > > +   /* TODO: undo create */
> > > +
> > > +   device_unbind(bdev);
> > > +
> > > +   return ret;
> > > +   }
> > > +
> >
> > Patches 2-6 seem to do the same thing for different subsystems.  I think
> > creating a function for that would make it easier.
>
> Well, the reason why I put those changes in separate commits is
> - first, different subsystems are owned by different maintainers, and
> - more importantly, different subsystems may have different cleanup
>   processing required.

That also stands if you create a common function doesn't it?
Create a function that fits most, add the calls in separate patches so
subsystems maintainers can have a look.  If one of the implementation
special, it can ignore the wrapper and go do it's own thing.

>   There are always extra setups after blk_create_device(), which should
>   be reverted if device_probe() fails. For instance, sil_unbind_device()
>   and fsl_unbind_device().
>   So I would like to leave subsystem owners responsible for that.

Regards
/Ilias

>
> -Takahiro Akashi
>
>
> > > return 0;
> > >  }
> > >
> > > diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c
> > > index e44db0a37458..346e9298b4c5 100644
> > > --- a/drivers/ata/fsl_sata.c
> > > +++ b/drivers/ata/fsl_sata.c
> > > @@ -982,6 +982,17 @@ static int fsl_ata_probe(struct udevice *dev)
> > > failed_number++;
> > > continue;
> > > }
> > > +
> > > +   ret = device_probe(bdev);
> > > +   if (ret < 0) {
> > > +   debug("Can't probe\n");
> > > +   ret = fsl_unbind_device(blk);
> >
> > Apart from this exception I guess
> >
> > > +   if (ret)
> > > +   return ret;
> > > +
> > > +   failed_number++;
> > > +   continue;
> > > +   }
> > > }
> > >
> > > if (failed_number == nr_ports)
> > > diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> > > index 003222d47be6..09b735779ebf 100644
> > > --- a/drivers/ata/sata_mv.c
> > > +++ b/drivers/ata/sata_mv.c
> > > @@ -1099,6 +1099,15 @@ static int sata_mv_probe(struct udevice *dev)
> > > continue;
> > > }
> > >
> > > +   ret = device_probe(bdev);
> > > +   if (ret < 0) {
> > > +   debug("Can't probe\n");
> > > +   /* TODO: undo create */
> > > +
> > > +   device_unbind(bdev);
> > > +   continue;
> > > +   }
> > > +
> > > /* If we got here, the current SATA port was probed
> > >  * successfully, so set the probe status to successful.
> > >  */
> > > diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
> > > index dda712f42cb2..295f7ca72303 100644
> > > --- a/drivers/ata/sata_sil.c
> > > +++ b/drivers/ata/sata_sil.c
> > > @@ -864,6 +864,18 @@ static int sil_pci_probe(struct udevice *dev)
> > > failed_number++;
> > > continue;
> > > }
> > > +
> > > +   ret = device_probe(bdev);
> > > +   if (ret < 0) {
> > > +   debug("Can't probe\n");
> > > +   ret = sil_unbind_device(blk);
> > > +   device_unbind(bdev);
> > > +   if (ret)
> > > +   return ret;
> > > +
> > > +   failed_number++;
> > > +   continue;
> > > +   }
> > > }
> > >
> > > if (failed_number == sata_info.maxport)
> > > --
> > > 2.33.0
> > >


[PATCH v2 08/12] i2c: Add a DM_I2C driver for the sun8i RSB controller

2021-10-07 Thread Samuel Holland
This bus controller is used to communicate with an X-Powers AXP PMIC.
Currently, various drivers access PMIC registers through a platform-
specific non-DM "pmic_bus" interface, which depends on the legacy I2C
framework. In order to convert those drivers to use DM_PMIC, this bus
needs a DM_I2C driver.

Refactor the rsb functions to take the base address as a parameter,
and implement both the existing interface (which is still needed in
SPL) and the DM_I2C interface on top of them.

The register for switching between I2C/P2WI/RSB mode is the same across
all PMIC variants, so move that to the common header.

There are only a couple of pairs of hardware/runtime addresses used
across all PMIC variants. So far the code expected only the "primary"
pair, but some PMICs like the AXP305 and AXP805 use the secondary pair,
so add support for that to the DM driver as well.

Signed-off-by: Samuel Holland 
---

Changes in v2:
- Renamed Kconfig symbol to SYS_I2C_SUN8I_RSB
- Moved entire RSB driver source to drivers/i2c

 arch/arm/mach-sunxi/Kconfig|  20 +--
 arch/arm/mach-sunxi/Makefile   |   1 -
 arch/arm/mach-sunxi/pmic_bus.c |  11 +-
 arch/arm/mach-sunxi/rsb.c  | 175 
 drivers/i2c/Kconfig|   8 +
 drivers/i2c/Makefile   |   1 +
 drivers/i2c/sun8i_rsb.c| 281 +
 include/axp_pmic.h |   6 +
 8 files changed, 308 insertions(+), 195 deletions(-)
 delete mode 100644 arch/arm/mach-sunxi/rsb.c
 create mode 100644 drivers/i2c/sun8i_rsb.c

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index ae3b7974f09..df160c9a775 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -100,14 +100,6 @@ config AXP_PMIC_BUS
  Select this PMIC bus access helpers for Sunxi platform PRCM or other
  AXP family PMIC devices.
 
-config SUN8I_RSB
-   bool "Allwinner sunXi Reduced Serial Bus Driver"
-   help
- Say y here to enable support for Allwinner's Reduced Serial Bus
- (RSB) support. This controller is responsible for communicating
- with various RSB based devices, such as AXP223, AXP8XX PMICs,
- and AC100/AC200 ICs.
-
 config SUNXI_SRAM_ADDRESS
hex
default 0x1 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5
@@ -250,9 +242,10 @@ config MACH_SUN8I_A23
select ARCH_SUPPORT_PSCI
select DRAM_SUN8I_A23
select PHY_SUN4I_USB
-   select SUN8I_RSB
+   select SPL_I2C
select SUNXI_GEN_SUN6I
select SUPPORT_SPL
+   select SYS_I2C_SUN8I_RSB
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
imply CONS_INDEX_5 if !DM_SERIAL
 
@@ -264,9 +257,10 @@ config MACH_SUN8I_A33
select ARCH_SUPPORT_PSCI
select DRAM_SUN8I_A33
select PHY_SUN4I_USB
-   select SUN8I_RSB
+   select SPL_I2C
select SUNXI_GEN_SUN6I
select SUPPORT_SPL
+   select SYS_I2C_SUN8I_RSB
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
imply CONS_INDEX_5 if !DM_SERIAL
 
@@ -275,11 +269,12 @@ config MACH_SUN8I_A83T
select CPU_V7A
select DRAM_SUN8I_A83T
select PHY_SUN4I_USB
-   select SUN8I_RSB
+   select SPL_I2C
select SUNXI_GEN_SUN6I
select MMC_SUNXI_HAS_NEW_MODE
select MMC_SUNXI_HAS_MODE_SWITCH
select SUPPORT_SPL
+   select SYS_I2C_SUN8I_RSB
 
 config MACH_SUN8I_H3
bool "sun8i (Allwinner H3)"
@@ -320,10 +315,11 @@ config MACH_SUN9I
bool "sun9i (Allwinner A80)"
select CPU_V7A
select DRAM_SUN9I
+   select SPL_I2C
select SUN6I_PRCM
select SUNXI_GEN_SUN6I
-   select SUN8I_RSB
select SUPPORT_SPL
+   select SYS_I2C_SUN8I_RSB
 
 config MACH_SUN50I
bool "sun50i (Allwinner A64)"
diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index c9312bb3934..5d3fd70f749 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -13,7 +13,6 @@ obj-y += dram_helpers.o
 obj-y  += pinmux.o
 obj-$(CONFIG_SUN6I_PRCM)   += prcm.o
 obj-$(CONFIG_AXP_PMIC_BUS) += pmic_bus.o
-obj-$(CONFIG_SUN8I_RSB)+= rsb.o
 obj-$(CONFIG_MACH_SUN4I)   += clock_sun4i.o
 obj-$(CONFIG_MACH_SUN5I)   += clock_sun4i.o
 obj-$(CONFIG_MACH_SUN6I)   += clock_sun6i.o
diff --git a/arch/arm/mach-sunxi/pmic_bus.c b/arch/arm/mach-sunxi/pmic_bus.c
index 673a05fdd16..827797249ea 100644
--- a/arch/arm/mach-sunxi/pmic_bus.c
+++ b/arch/arm/mach-sunxi/pmic_bus.c
@@ -23,10 +23,6 @@
 
 #define AXP221_CHIP_ADDR   0x68
 
-/* AXP818 device and runtime addresses are same as AXP223 */
-#define AXP223_DEVICE_ADDR 0x3a3
-#define AXP223_RUNTIME_ADDR0x2d
-
 int pmic_bus_init(void)
 {
/* This cannot be 0 because it is used in SPL before BSS is ready */
@@ -49,7 +45,8 @@ int pmic_bus_init(void)
if (ret)
return ret;
 
-   ret = 

[PATCH v2 06/12] sunxi: pmic_bus: Fix Kconfig dependencies

2021-10-07 Thread Samuel Holland
AXP_PMIC_BUS enables communication with a specific AXP PMIC at a
PMIC-dependent I2C/P2WI/RSB bus address. It is automatically selected
as a dependency of the PMIC driver. It should not be selectable by the
user when no PMIC is chosen.

AXP_GPIO uses the pmic_bus functions, and also depends on a specific
PMIC header to pick up register definitions.

Both of these changes have no impact on any existing configs, since
the code does not compile if the dependencies are not met.

Reviewed-by: Jaehoon Chung 
Signed-off-by: Samuel Holland 
---

Changes in v2:
- No changes

 arch/arm/mach-sunxi/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 677d4554173..4d8f0e17d40 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -106,7 +106,7 @@ config SUN6I_PRCM
  in A31 SoC.
 
 config AXP_PMIC_BUS
-   bool "Sunxi AXP PMIC bus access helpers"
+   bool
help
  Select this PMIC bus access helpers for Sunxi platform PRCM or other
  AXP family PMIC devices.
@@ -809,6 +809,7 @@ endif
 
 config AXP_GPIO
bool "Enable support for gpio-s on axp PMICs"
+   depends on AXP_PMIC_BUS
---help---
Say Y here to enable support for the gpio pins of the axp PMIC ICs.
 
-- 
2.32.0



[PATCH v2 09/12] sunxi: pmic_bus: Clean up preprocessor conditions

2021-10-07 Thread Samuel Holland
Instead of using the SoC symbols to decide the bus type, use whichever
bus driver is actually enabled. This allows collapsing all of the AXP2xx
and AXP8xx variants into one "else" case. It also has the advantage of
falling back to I2C when the other bus drivers are disabled; this works
because all of the PMICs support I2C in addition to other interfaces.

Signed-off-by: Samuel Holland 
---

Changes in v2:
- Update IS_ENABLEDs in pmic_bus.c to match chages to previous patches

 arch/arm/mach-sunxi/pmic_bus.c | 90 +++---
 1 file changed, 39 insertions(+), 51 deletions(-)

diff --git a/arch/arm/mach-sunxi/pmic_bus.c b/arch/arm/mach-sunxi/pmic_bus.c
index 827797249ea..20ded436cd2 100644
--- a/arch/arm/mach-sunxi/pmic_bus.c
+++ b/arch/arm/mach-sunxi/pmic_bus.c
@@ -23,75 +23,63 @@
 
 #define AXP221_CHIP_ADDR   0x68
 
+static int pmic_i2c_address(void)
+{
+   if (IS_ENABLED(CONFIG_AXP152_POWER))
+   return AXP152_I2C_ADDR;
+   if (IS_ENABLED(CONFIG_AXP305_POWER))
+   return AXP305_I2C_ADDR;
+
+   /* Other AXP2xx and AXP8xx variants */
+   return AXP209_I2C_ADDR;
+}
+
 int pmic_bus_init(void)
 {
/* This cannot be 0 because it is used in SPL before BSS is ready */
static int needs_init = 1;
-   __maybe_unused int ret;
+   int ret = 0;
 
if (!needs_init)
return 0;
 
-#if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined 
CONFIG_AXP818_POWER
-# ifdef CONFIG_MACH_SUN6I
-   p2wi_init();
-   ret = p2wi_change_to_p2wi_mode(AXP221_CHIP_ADDR, AXP_PMIC_MODE_REG,
-  AXP_PMIC_MODE_P2WI);
-# elif defined CONFIG_MACH_SUN8I_R40
-   /* Nothing. R40 uses the AXP221s in I2C mode */
-   ret = 0;
-# else
-   ret = rsb_init();
-   if (ret)
-   return ret;
+   if (IS_ENABLED(CONFIG_SYS_I2C_SUN6I_P2WI)) {
+   p2wi_init();
+   ret = p2wi_change_to_p2wi_mode(AXP221_CHIP_ADDR,
+  AXP_PMIC_MODE_REG,
+  AXP_PMIC_MODE_P2WI);
+   } else if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB)) {
+   ret = rsb_init();
+   if (ret)
+   return ret;
 
-   ret = rsb_set_device_address(AXP_PMIC_PRI_DEVICE_ADDR,
-AXP_PMIC_PRI_RUNTIME_ADDR);
-# endif
-   if (ret)
-   return ret;
-#endif
+   ret = rsb_set_device_address(AXP_PMIC_PRI_DEVICE_ADDR,
+AXP_PMIC_PRI_RUNTIME_ADDR);
+   }
+
+   needs_init = ret;
 
-   needs_init = 0;
-   return 0;
+   return ret;
 }
 
 int pmic_bus_read(u8 reg, u8 *data)
 {
-#ifdef CONFIG_AXP152_POWER
-   return i2c_read(AXP152_I2C_ADDR, reg, 1, data, 1);
-#elif defined CONFIG_AXP209_POWER
-   return i2c_read(AXP209_I2C_ADDR, reg, 1, data, 1);
-#elif defined CONFIG_AXP305_POWER
-   return i2c_read(AXP305_I2C_ADDR, reg, 1, data, 1);
-#elif defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined 
CONFIG_AXP818_POWER
-# ifdef CONFIG_MACH_SUN6I
-   return p2wi_read(reg, data);
-# elif defined CONFIG_MACH_SUN8I_R40
-   return i2c_read(AXP209_I2C_ADDR, reg, 1, data, 1);
-# else
-   return rsb_read(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data);
-# endif
-#endif
+   if (IS_ENABLED(CONFIG_SYS_I2C_SUN6I_P2WI))
+   return p2wi_read(reg, data);
+   if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB))
+   return rsb_read(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data);
+
+   return i2c_read(pmic_i2c_address(), reg, 1, data, 1);
 }
 
 int pmic_bus_write(u8 reg, u8 data)
 {
-#ifdef CONFIG_AXP152_POWER
-   return i2c_write(AXP152_I2C_ADDR, reg, 1, , 1);
-#elif defined CONFIG_AXP209_POWER
-   return i2c_write(AXP209_I2C_ADDR, reg, 1, , 1);
-#elif defined CONFIG_AXP305_POWER
-   return i2c_write(AXP305_I2C_ADDR, reg, 1, , 1);
-#elif defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined 
CONFIG_AXP818_POWER
-# ifdef CONFIG_MACH_SUN6I
-   return p2wi_write(reg, data);
-# elif defined CONFIG_MACH_SUN8I_R40
-   return i2c_write(AXP209_I2C_ADDR, reg, 1, , 1);
-# else
-   return rsb_write(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data);
-# endif
-#endif
+   if (IS_ENABLED(CONFIG_SYS_I2C_SUN6I_P2WI))
+   return p2wi_write(reg, data);
+   if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB))
+   return rsb_write(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data);
+
+   return i2c_write(pmic_i2c_address(), reg, 1, , 1);
 }
 
 int pmic_bus_setbits(u8 reg, u8 bits)
-- 
2.32.0



[PATCH v2 11/12] sunxi: video: Convert panel I2C to use DM_I2C

2021-10-07 Thread Samuel Holland
Two displays supported by the sunxi display driver (each one used by a
single board) require initialization over I2C. Both previously used
i2c_soft; replace this with the i2c-gpio instance that already exists in
those boards' device trees (sun5i-a13-utoo-p66 and sun6i-a31-colombus).

Since the i2c-gpio nodes are not referenced by any other node in the
device trees (the device trees have no panel node), the I2C bus is
selected by its node name.

This panel initialization code was the only i2c_soft user, so the
i2c_soft GPIO setup code can be removed now as well.

Reviewed-by: Heiko Schocher 
Signed-off-by: Samuel Holland 
---

Changes in v2:
- No changes

 arch/arm/mach-sunxi/Kconfig |  21 ++
 board/sunxi/board.c |  44 +---
 configs/Colombus_defconfig  |   6 --
 configs/UTOO_P66_defconfig  |   3 -
 drivers/video/anx9804.c | 103 ++--
 drivers/video/anx9804.h |   5 +-
 drivers/video/sunxi/sunxi_display.c |  55 ++-
 include/configs/sunxi-common.h  |  17 -
 8 files changed, 100 insertions(+), 154 deletions(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index cfd95b09498..99928821673 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -923,27 +923,18 @@ config VIDEO_LCD_BL_PWM_ACTIVE_LOW
 config VIDEO_LCD_PANEL_I2C
bool "LCD panel needs to be configured via i2c"
depends on VIDEO_SUNXI
-   select CMD_I2C
+   select DM_I2C
+   select DM_I2C_GPIO
---help---
Say y here if the LCD panel needs to be configured via i2c. This
will add a bitbang i2c controller using gpios to talk to the LCD.
 
-config VIDEO_LCD_PANEL_I2C_SDA
-   string "LCD panel i2c interface SDA pin"
-   depends on VIDEO_LCD_PANEL_I2C
-   default "PG12"
-   ---help---
-   Set the SDA pin for the LCD i2c interface. This takes a string in the
-   format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
-
-config VIDEO_LCD_PANEL_I2C_SCL
-   string "LCD panel i2c interface SCL pin"
+config VIDEO_LCD_PANEL_I2C_NAME
+   string "LCD panel i2c interface node name"
depends on VIDEO_LCD_PANEL_I2C
-   default "PG10"
+   default "i2c@0"
---help---
-   Set the SCL pin for the LCD i2c interface. This takes a string in the
-   format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
-
+   Set the device tree node name for the LCD i2c interface.
 
 # Note only one of these may be selected at a time! But hidden choices are
 # not supported by Kconfig
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 2b7d655678d..dabe6734b81 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -47,47 +47,6 @@
 #include 
 #include 
 
-#if defined(CONFIG_VIDEO_LCD_PANEL_I2C)
-/* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
-int soft_i2c_gpio_sda;
-int soft_i2c_gpio_scl;
-
-static int soft_i2c_board_init(void)
-{
-   int ret;
-
-   soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
-   if (soft_i2c_gpio_sda < 0) {
-   printf("Error invalid soft i2c sda pin: '%s', err %d\n",
-  CONFIG_VIDEO_LCD_PANEL_I2C_SDA, soft_i2c_gpio_sda);
-   return soft_i2c_gpio_sda;
-   }
-   ret = gpio_request(soft_i2c_gpio_sda, "soft-i2c-sda");
-   if (ret) {
-   printf("Error requesting soft i2c sda pin: '%s', err %d\n",
-  CONFIG_VIDEO_LCD_PANEL_I2C_SDA, ret);
-   return ret;
-   }
-
-   soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
-   if (soft_i2c_gpio_scl < 0) {
-   printf("Error invalid soft i2c scl pin: '%s', err %d\n",
-  CONFIG_VIDEO_LCD_PANEL_I2C_SCL, soft_i2c_gpio_scl);
-   return soft_i2c_gpio_scl;
-   }
-   ret = gpio_request(soft_i2c_gpio_scl, "soft-i2c-scl");
-   if (ret) {
-   printf("Error requesting soft i2c scl pin: '%s', err %d\n",
-  CONFIG_VIDEO_LCD_PANEL_I2C_SCL, ret);
-   return ret;
-   }
-
-   return 0;
-}
-#else
-static int soft_i2c_board_init(void) { return 0; }
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 void i2c_init_board(void)
@@ -312,8 +271,7 @@ int board_init(void)
 #endif
 #endif /* CONFIG_DM_MMC */
 
-   /* Uses dm gpio code so do this here and not in i2c_init_board() */
-   return soft_i2c_board_init();
+   return 0;
 }
 
 /*
diff --git a/configs/Colombus_defconfig b/configs/Colombus_defconfig
index 31541f898d4..270bd7d351a 100644
--- a/configs/Colombus_defconfig
+++ b/configs/Colombus_defconfig
@@ -13,15 +13,9 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0
 CONFIG_VIDEO_LCD_POWER="PH27"
 CONFIG_VIDEO_LCD_BL_EN="PM1"
 CONFIG_VIDEO_LCD_BL_PWM="PH13"
-CONFIG_VIDEO_LCD_PANEL_I2C_SDA="PA23"
-CONFIG_VIDEO_LCD_PANEL_I2C_SCL="PA24"
 

[PATCH v2 10/12] sunxi: pmic_bus: Use the DM PMIC interface when possible

2021-10-07 Thread Samuel Holland
The pmic_bus functions are used in both SPL (for regulator setup) and
U-Boot proper (for regulator setup, SID access, GPIO, and poweroff).

Currently, pmic_bus conflicts with DM_I2C because it uses the legacy I2C
interface. This commit makes pmic_bus dual-compatible with either the
legacy I2C functions or the newly-added PMIC_AXP driver (which uses
DM_I2C). In turn, this allows platforms to start transitioning to DM_I2C
in U-Boot proper, without breaking boards that still depend on the
legacy I2C interface for other reasons.

Signed-off-by: Samuel Holland 
---

Changes in v2:
- No changes

 arch/arm/mach-sunxi/Kconfig|  2 ++
 arch/arm/mach-sunxi/pmic_bus.c | 19 +++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index df160c9a775..cfd95b09498 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -96,6 +96,8 @@ config SUN6I_PRCM
 
 config AXP_PMIC_BUS
bool
+   select DM_PMIC if DM_I2C
+   select PMIC_AXP if DM_I2C
help
  Select this PMIC bus access helpers for Sunxi platform PRCM or other
  AXP family PMIC devices.
diff --git a/arch/arm/mach-sunxi/pmic_bus.c b/arch/arm/mach-sunxi/pmic_bus.c
index 20ded436cd2..c0908406370 100644
--- a/arch/arm/mach-sunxi/pmic_bus.c
+++ b/arch/arm/mach-sunxi/pmic_bus.c
@@ -10,9 +10,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define AXP152_I2C_ADDR0x30
@@ -23,6 +25,9 @@
 
 #define AXP221_CHIP_ADDR   0x68
 
+#if CONFIG_IS_ENABLED(PMIC_AXP)
+static struct udevice *pmic;
+#else
 static int pmic_i2c_address(void)
 {
if (IS_ENABLED(CONFIG_AXP152_POWER))
@@ -33,6 +38,7 @@ static int pmic_i2c_address(void)
/* Other AXP2xx and AXP8xx variants */
return AXP209_I2C_ADDR;
 }
+#endif
 
 int pmic_bus_init(void)
 {
@@ -43,6 +49,10 @@ int pmic_bus_init(void)
if (!needs_init)
return 0;
 
+#if CONFIG_IS_ENABLED(PMIC_AXP)
+   ret = uclass_get_device_by_driver(UCLASS_PMIC, DM_DRIVER_GET(axp_pmic),
+ );
+#else
if (IS_ENABLED(CONFIG_SYS_I2C_SUN6I_P2WI)) {
p2wi_init();
ret = p2wi_change_to_p2wi_mode(AXP221_CHIP_ADDR,
@@ -56,6 +66,7 @@ int pmic_bus_init(void)
ret = rsb_set_device_address(AXP_PMIC_PRI_DEVICE_ADDR,
 AXP_PMIC_PRI_RUNTIME_ADDR);
}
+#endif
 
needs_init = ret;
 
@@ -64,22 +75,30 @@ int pmic_bus_init(void)
 
 int pmic_bus_read(u8 reg, u8 *data)
 {
+#if CONFIG_IS_ENABLED(PMIC_AXP)
+   return pmic_read(pmic, reg, data, 1);
+#else
if (IS_ENABLED(CONFIG_SYS_I2C_SUN6I_P2WI))
return p2wi_read(reg, data);
if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB))
return rsb_read(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data);
 
return i2c_read(pmic_i2c_address(), reg, 1, data, 1);
+#endif
 }
 
 int pmic_bus_write(u8 reg, u8 data)
 {
+#if CONFIG_IS_ENABLED(PMIC_AXP)
+   return pmic_write(pmic, reg, , 1);
+#else
if (IS_ENABLED(CONFIG_SYS_I2C_SUN6I_P2WI))
return p2wi_write(reg, data);
if (IS_ENABLED(CONFIG_SYS_I2C_SUN8I_RSB))
return rsb_write(AXP_PMIC_PRI_RUNTIME_ADDR, reg, data);
 
return i2c_write(pmic_i2c_address(), reg, 1, , 1);
+#endif
 }
 
 int pmic_bus_setbits(u8 reg, u8 bits)
-- 
2.32.0



[PATCH v2 07/12] i2c: Add a DM_I2C driver for the sun6i P2WI controller

2021-10-07 Thread Samuel Holland
This bus controller is used to communicate with an X-Powers AXP PMIC.
Currently, various drivers access PMIC registers through a platform-
specific non-DM "pmic_bus" interface, which depends on the legacy I2C
framework. In order to convert those drivers to use DM_PMIC, this bus
needs a DM_I2C driver.

Refactor the p2wi functions to take the base address as a parameter,
and implement both the existing interface (which is still needed in
SPL) and the DM_I2C interface on top of them.

The register for switching between I2C/P2WI/RSB mode is the same across
all PMIC variants. Move that to the common header, so it can be used by
both interface implementations.

Signed-off-by: Samuel Holland 
---

Changes in v2:
- Renamed Kconfig symbol to SYS_I2C_SUN6I_P2WI
- Moved entire P2WI driver source to drivers/i2c

 arch/arm/mach-sunxi/Kconfig|  14 +--
 arch/arm/mach-sunxi/Makefile   |   1 -
 arch/arm/mach-sunxi/p2wi.c | 117 --
 arch/arm/mach-sunxi/pmic_bus.c |   7 +-
 drivers/i2c/Kconfig|   8 ++
 drivers/i2c/Makefile   |   1 +
 drivers/i2c/sun6i_p2wi.c   | 220 +
 include/axp_pmic.h |   6 +
 8 files changed, 240 insertions(+), 134 deletions(-)
 delete mode 100644 arch/arm/mach-sunxi/p2wi.c
 create mode 100644 drivers/i2c/sun6i_p2wi.c

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 4d8f0e17d40..ae3b7974f09 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -88,17 +88,6 @@ config DRAM_SUN50I_H616_UNKNOWN_FEATURE
  feature.
 endif
 
-config SUN6I_P2WI
-   bool "Allwinner sun6i internal P2WI controller"
-   help
- If you say yes to this option, support will be included for the
- P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi
- SOCs.
- The P2WI looks like an SMBus controller (which supports only byte
- accesses), except that it only supports one slave device.
- This interface is used to connect to specific PMIC devices (like the
- AXP221).
-
 config SUN6I_PRCM
bool
help
@@ -232,10 +221,11 @@ config MACH_SUN6I
select ARCH_SUPPORT_PSCI
select DRAM_SUN6I
select PHY_SUN4I_USB
-   select SUN6I_P2WI
+   select SPL_I2C
select SUN6I_PRCM
select SUNXI_GEN_SUN6I
select SUPPORT_SPL
+   select SYS_I2C_SUN6I_P2WI
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN7I
diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index 3f081d92f37..c9312bb3934 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -11,7 +11,6 @@ obj-y += clock.o
 obj-y  += cpu_info.o
 obj-y  += dram_helpers.o
 obj-y  += pinmux.o
-obj-$(CONFIG_SUN6I_P2WI)   += p2wi.o
 obj-$(CONFIG_SUN6I_PRCM)   += prcm.o
 obj-$(CONFIG_AXP_PMIC_BUS) += pmic_bus.o
 obj-$(CONFIG_SUN8I_RSB)+= rsb.o
diff --git a/arch/arm/mach-sunxi/p2wi.c b/arch/arm/mach-sunxi/p2wi.c
deleted file mode 100644
index 7c5c12254ea..000
--- a/arch/arm/mach-sunxi/p2wi.c
+++ /dev/null
@@ -1,117 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Sunxi A31 Power Management Unit
- *
- * (C) Copyright 2013 Oliver Schinagl 
- * http://linux-sunxi.org
- *
- * Based on sun6i sources and earlier U-Boot Allwinner A10 SPL work
- *
- * (C) Copyright 2006-2013
- * Allwinner Technology Co., Ltd. 
- * Berg Xing 
- * Tom Cubie 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-void p2wi_init(void)
-{
-   struct sunxi_p2wi_reg *p2wi = (struct sunxi_p2wi_reg *)SUN6I_P2WI_BASE;
-
-   /* Enable p2wi and PIO clk, and de-assert their resets */
-   prcm_apb0_enable(PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_P2WI);
-
-   sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN6I_GPL0_R_P2WI_SCK);
-   sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN6I_GPL1_R_P2WI_SDA);
-
-   /* Reset p2wi controller and set clock to CLKIN(12)/8 = 1.5 MHz */
-   writel(P2WI_CTRL_RESET, >ctrl);
-   sdelay(0x100);
-   writel(P2WI_CC_SDA_OUT_DELAY(1) | P2WI_CC_CLK_DIV(8),
-  >cc);
-}
-
-int p2wi_change_to_p2wi_mode(u8 slave_addr, u8 ctrl_reg, u8 init_data)
-{
-   struct sunxi_p2wi_reg *p2wi = (struct sunxi_p2wi_reg *)SUN6I_P2WI_BASE;
-   unsigned long tmo = timer_get_us() + 100;
-
-   writel(P2WI_PM_DEV_ADDR(slave_addr) |
-  P2WI_PM_CTRL_ADDR(ctrl_reg) |
-  P2WI_PM_INIT_DATA(init_data) |
-  P2WI_PM_INIT_SEND,
-  >pm);
-
-   while ((readl(>pm) & P2WI_PM_INIT_SEND)) {
-   if (timer_get_us() > tmo)
-   return -ETIME;
-   }
-
-   return 0;
-}
-
-static int p2wi_await_trans(void)
-{
-   struct sunxi_p2wi_reg *p2wi = (struct sunxi_p2wi_reg *)SUN6I_P2WI_BASE;
-   unsigned long tmo = timer_get_us() + 100;
-   int ret;
-   u8 reg;

[PATCH v2 12/12] sunxi: Enable DM_I2C for all sunxi boards

2021-10-07 Thread Samuel Holland
Now that the last users of legacy I2C (outside of SPL) have been
resolved, we can enable DM_I2C at the sunxi architecture level.

Reviewed-by: Heiko Schocher 
Signed-off-by: Samuel Holland 
---

Changes in v2:
- No changes

 arch/arm/Kconfig| 1 +
 arch/arm/mach-sunxi/Kconfig | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ebb19272708..d8c041a8773 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1028,6 +1028,7 @@ config ARCH_SUNXI
select DM
select DM_ETH
select DM_GPIO
+   select DM_I2C if I2C
select DM_KEYBOARD
select DM_MMC if MMC
select DM_SCSI if SCSI
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 99928821673..9047a88c9da 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -165,7 +165,6 @@ endif
 
 config MACH_SUNXI_H3_H5
bool
-   select DM_I2C
select PHY_SUN4I_USB
select SUNXI_DE2
select SUNXI_DRAM_DW
@@ -327,7 +326,6 @@ config MACH_SUN50I
bool "sun50i (Allwinner A64)"
select ARM64
select SPI
-   select DM_I2C
select DM_SPI if SPI
select DM_SPI_FLASH
select PHY_SUN4I_USB
@@ -923,7 +921,6 @@ config VIDEO_LCD_BL_PWM_ACTIVE_LOW
 config VIDEO_LCD_PANEL_I2C
bool "LCD panel needs to be configured via i2c"
depends on VIDEO_SUNXI
-   select DM_I2C
select DM_I2C_GPIO
---help---
Say y here if the LCD panel needs to be configured via i2c. This
-- 
2.32.0



[PATCH v2 03/12] power: pmic: Add a driver for X-Powers AXP PMICs

2021-10-07 Thread Samuel Holland
These PMICs provide some combination of battery charger, fuel gauge,
GPIOs, regulators, and VBUS routing. These functions are represented
as child nodes in the device tree. Add the minimal driver needed to
probe these child devices and provide the DM_PMIC ops.

Enable the driver by default for SoCs that normally pair with a PMIC.

Signed-off-by: Samuel Holland 
---

Changes in v2:
- Replace axp_pmic_bind() with `.bind = dm_scan_fdt_dev`

 drivers/power/pmic/Kconfig  | 14 ++
 drivers/power/pmic/Makefile |  1 +
 drivers/power/pmic/axp.c| 38 +
 3 files changed, 53 insertions(+)
 create mode 100644 drivers/power/pmic/axp.c

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index e8a04325f85..fcb517f1044 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -63,6 +63,20 @@ config PMIC_ACT8846
functions. It uses an I2C interface and is designed for use with
tablets and smartphones.
 
+config PMIC_AXP
+   bool "Enable Driver Model for X-Powers AXP PMICs"
+   depends on DM_I2C
+   help
+ This config enables driver-model PMIC uclass features for
+ X-Powers AXP152, AXP2xx, and AXP8xx PMICs.
+
+config SPL_PMIC_AXP
+   bool "Enable Driver Model for X-Powers AXP PMICs in SPL"
+   depends on SPL_DM_I2C && SPL_DM_PMIC
+   help
+ This config enables driver-model PMIC uclass features in the SPL for
+ X-Powers AXP152, AXP2xx, and AXP8xx PMICs.
+
 config DM_PMIC_DA9063
bool "Enable Driver Model for the Dialog DA9063 PMIC"
help
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 5250eac12f2..e1922df00f8 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o
 obj-$(CONFIG_PMIC_AB8500) += ab8500.o
 obj-$(CONFIG_PMIC_ACT8846) += act8846.o
 obj-$(CONFIG_PMIC_AS3722) += as3722.o as3722_gpio.o
+obj-$(CONFIG_$(SPL_)PMIC_AXP) += axp.o
 obj-$(CONFIG_PMIC_MAX8997) += max8997.o
 obj-$(CONFIG_PMIC_PM8916) += pm8916.o
 obj-$(CONFIG_$(SPL_TPL_)PMIC_RK8XX) += rk8xx.o
diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c
new file mode 100644
index 000..74c94bdb47b
--- /dev/null
+++ b/drivers/power/pmic/axp.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+#include 
+#include 
+
+static int axp_pmic_reg_count(struct udevice *dev)
+{
+   /* TODO: Get the specific value from driver data. */
+   return 0x100;
+}
+
+static struct dm_pmic_ops axp_pmic_ops = {
+   .reg_count  = axp_pmic_reg_count,
+   .read   = dm_i2c_read,
+   .write  = dm_i2c_write,
+};
+
+static const struct udevice_id axp_pmic_ids[] = {
+   { .compatible = "x-powers,axp152" },
+   { .compatible = "x-powers,axp202" },
+   { .compatible = "x-powers,axp209" },
+   { .compatible = "x-powers,axp221" },
+   { .compatible = "x-powers,axp223" },
+   { .compatible = "x-powers,axp803" },
+   { .compatible = "x-powers,axp806" },
+   { .compatible = "x-powers,axp809" },
+   { .compatible = "x-powers,axp813" },
+   { }
+};
+
+U_BOOT_DRIVER(axp_pmic) = {
+   .name   = "axp_pmic",
+   .id = UCLASS_PMIC,
+   .of_match   = axp_pmic_ids,
+   .bind   = dm_scan_fdt_dev,
+   .ops= _pmic_ops,
+};
-- 
2.32.0



[PATCH v2 05/12] sunxi: Select SUN8I_RSB more carefully

2021-10-07 Thread Samuel Holland
SUN8I_RSB should not be selected by MACH_SUN8I, because the hardware
is not present in half of those SoCs (H3/H5, R40, and V3s). Move the
selection to the SoCs where the hardware actually exists.

Reviewed-by: Andre Przywara 
Signed-off-by: Samuel Holland 
---

Changes in v2:
- No changes

 arch/arm/mach-sunxi/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 1d4a4fdd0c5..677d4554173 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -260,6 +260,7 @@ config MACH_SUN8I_A23
select ARCH_SUPPORT_PSCI
select DRAM_SUN8I_A23
select PHY_SUN4I_USB
+   select SUN8I_RSB
select SUNXI_GEN_SUN6I
select SUPPORT_SPL
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -273,6 +274,7 @@ config MACH_SUN8I_A33
select ARCH_SUPPORT_PSCI
select DRAM_SUN8I_A33
select PHY_SUN4I_USB
+   select SUN8I_RSB
select SUNXI_GEN_SUN6I
select SUPPORT_SPL
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -283,6 +285,7 @@ config MACH_SUN8I_A83T
select CPU_V7A
select DRAM_SUN8I_A83T
select PHY_SUN4I_USB
+   select SUN8I_RSB
select SUNXI_GEN_SUN6I
select MMC_SUNXI_HAS_NEW_MODE
select MMC_SUNXI_HAS_MODE_SWITCH
@@ -377,7 +380,6 @@ endchoice
 # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
 config MACH_SUN8I
bool
-   select SUN8I_RSB
select SUN6I_PRCM
default y if MACH_SUN8I_A23
default y if MACH_SUN8I_A33
-- 
2.32.0



[PATCH v2 04/12] sunxi: Only initialize legacy I2C when enabled

2021-10-07 Thread Samuel Holland
CONFIG_SPL_I2C is the wrong symbol to use here. It is the top-level
Kconfig symbol (not specific to either legacy or DM I2C), whereas the
i2c_init() function is specific to legacy I2C. This change fixes a
build failure when enabling SPL_I2C but not SPL_SYS_I2C_LEGACY.

Signed-off-by: Samuel Holland 
---
Actually, I think this commit raises a larger issue:

For some reason, SPL_SYS_I2C_LEGACY does not depend on SPL_I2C. When
SPL_SYS_I2C_LEGACY was added in commit 55dabcc8f245 ("Convert
CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY"),
SPL_I2C wasn't added to the board configs.

But since commit 537892065ac1 ("Makefile: Move drivers/i2c/ into
drivers/Makefile"), drivers/i2c is only compiled if SPL_I2C is enabled.

So the combination of these two commits appears to have accidentally
removed I2C support from SPL for many boards.

The impact here is that checking CONFIG_IS_ENABLED(SYS_I2C_LEGACY) is
not always enough, even though it should be. Because if CONFIG_SPL_I2C=n
then i2c_init is undefined because drivers/i2c/i2c_core.c is not built.

Changes in v2:
- New patch to account for I2C Kconfig changes

 arch/arm/mach-sunxi/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index d9b04f75fc4..b74ad4074df 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -339,7 +339,7 @@ void board_init_f(ulong dummy)
spl_init();
preloader_console_init();
 
-#ifdef CONFIG_SPL_I2C
+#if CONFIG_IS_ENABLED(I2C) && CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
/* Needed early by sunxi_board_init if PMU is enabled */
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
-- 
2.32.0



[PATCH v2 02/12] power: pmic: Consistently depend on SPL_DM_PMIC

2021-10-07 Thread Samuel Holland
Now that there is a separate symbol to enable DM_PMIC in SPL, update the
the SPL-specific driver symbols to depend on this new option.

Signed-off-by: Samuel Holland 
---

Changes in v2:
- Rebase to pick up 7abf178b ("power: Tidy up #undef of CONFIG_DM_PMIC")

 drivers/power/pmic/Kconfig | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 2472555a3ff..e8a04325f85 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -36,6 +36,7 @@ config PMIC_CHILDREN
 
 config SPL_PMIC_CHILDREN
bool "Allow child devices for PMICs in SPL"
+   depends on SPL_DM_PMIC
default y
---help---
This allows PMICs to support child devices (such as regulators) in
@@ -70,7 +71,7 @@ config DM_PMIC_DA9063
 
 config SPL_DM_PMIC_DA9063
bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL"
-   depends on SPL
+   depends on SPL_DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC DA9063. The driver implements read/write operations.
@@ -91,6 +92,7 @@ config DM_PMIC_BD71837
 
 config SPL_DM_PMIC_BD71837
bool "Enable Driver Model for PMIC BD71837 in SPL stage"
+   depends on SPL_DM_PMIC
help
  This config enables implementation of driver-model pmic uclass
  features for PMIC BD71837. The driver implements read/write
@@ -118,6 +120,7 @@ config DM_PMIC_MP5416
 
 config SPL_DM_PMIC_MP5416
bool "Enable Driver Model for PMIC MP5416 in SPL stage"
+   depends on SPL_DM_PMIC
help
  This config enables implementation of driver-model pmic uclass
  features for PMIC MP5416. The driver implements read/write
@@ -131,6 +134,7 @@ config DM_PMIC_PCA9450
 
 config SPL_DM_PMIC_PCA9450
bool "Enable Driver Model for PMIC PCA9450"
+   depends on SPL_DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC PCA9450 in SPL. The driver implements read/write operations.
@@ -143,6 +147,7 @@ config DM_PMIC_PFUZE100
 
 config SPL_DM_PMIC_PFUZE100
bool "Enable Driver Model for PMIC PFUZE100 in SPL"
+   depends on SPL_DM_PMIC
---help---
This config enables implementation of driver-model pmic uclass features
for PMIC PFUZE100 in SPL. The driver implements read/write operations.
@@ -204,6 +209,7 @@ config PMIC_RK8XX
 
 config SPL_PMIC_RK8XX
bool "Enable support for Rockchip PMIC RK8XX"
+   depends on SPL_DM_PMIC
---help---
The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs,
an RTC and two low Rds (resistance (drain to source)) switches. It is
@@ -313,18 +319,21 @@ config PMIC_STPMIC1
 
 config SPL_PMIC_PALMAS
bool "Enable driver for Texas Instruments PALMAS PMIC"
+   depends on SPL_DM_PMIC
help
The PALMAS is a PMIC containing several LDOs, SMPS.
This driver binds the pmic children in SPL.
 
 config SPL_PMIC_LP873X
bool "Enable driver for Texas Instruments LP873X PMIC"
+   depends on SPL_DM_PMIC
help
The LP873X is a PMIC containing couple of LDOs and couple of SMPS.
This driver binds the pmic children in SPL.
 
 config SPL_PMIC_LP87565
bool "Enable driver for Texas Instruments LP87565 PMIC"
+   depends on SPL_DM_PMIC
help
The LP87565 is a PMIC containing a bunch of SMPS.
This driver binds the pmic children in SPL.
-- 
2.32.0



[PATCH v2 00/12] sunxi: Migrate to DM_I2C

2021-10-07 Thread Samuel Holland
This series does the initial work to migrate sunxi boards to DM_I2C.
Version 1 of this series bitrotted quite a bit, so there is some
reorganization in version 2.

First it takes care of the PMIC:
 - Patches 1-2 clean up the PMIC Kconfig, though they are not strictly
   necessary after 7abf178b, and are independent from the other patches.
 - Patch 3 then adds a DM_PMIC driver.
 - Patches 4-6 prepare to move the P2WI/RSB bus drivers to drivers/i2c.
 - Patches 7-8 move and add DM_I2C versions of those two drivers.
 - Patches 9-10 migrate the "pmic_bus" functions to use the DM_I2C bus
   and DM_PMIC driver when possible.
Then it takes care of the LCD panels:
 - Patch 11 converts those drivers to use DM_I2C.
Finally, patch 12 switches all sunxi boards over to DM_I2C.

I have build-tested each commit on all sunxi boards.

There is some remaining work to clean up uses of pmic_bus in U-Boot
proper and replace them with DM_PMIC functions:
 - drivers/gpio/axp_gpio.c - I have a series for this.
 - do_poweroff() in drivers/gpio/axp???.c - I have a series for this.
 - axp_get_sid() in drivers/power/axp221.c - Not sure what to do here.
 - axp_set_eldo() in drivers/video/sunxi/sunxi_display.c - This will
   need a DM_REGULATOR driver.

Changes in v2:
- Rebase to pick up 7abf178b ("power: Tidy up #undef of CONFIG_DM_PMIC")
- Rebase to pick up 7abf178b ("power: Tidy up #undef of CONFIG_DM_PMIC")
- Replace axp_pmic_bind() with `.bind = dm_scan_fdt_dev`
- New patch to account for I2C Kconfig changes
- Renamed Kconfig symbol to SYS_I2C_SUN6I_P2WI
- Moved entire P2WI driver source to drivers/i2c
- Renamed Kconfig symbol to SYS_I2C_SUN8I_RSB
- Moved entire RSB driver source to drivers/i2c
- Update IS_ENABLEDs in pmic_bus.c to match chages to previous patches

Samuel Holland (12):
  power: pmic: Consistently depend on DM_PMIC
  power: pmic: Consistently depend on SPL_DM_PMIC
  power: pmic: Add a driver for X-Powers AXP PMICs
  sunxi: Only initialize legacy I2C when enabled
  sunxi: Select SUN8I_RSB more carefully
  sunxi: pmic_bus: Fix Kconfig dependencies
  i2c: Add a DM_I2C driver for the sun6i P2WI controller
  i2c: Add a DM_I2C driver for the sun8i RSB controller
  sunxi: pmic_bus: Clean up preprocessor conditions
  sunxi: pmic_bus: Use the DM PMIC interface when possible
  sunxi: video: Convert panel I2C to use DM_I2C
  sunxi: Enable DM_I2C for all sunxi boards

 arch/arm/Kconfig|   1 +
 arch/arm/mach-sunxi/Kconfig |  59 ++
 arch/arm/mach-sunxi/Makefile|   2 -
 arch/arm/mach-sunxi/board.c |   2 +-
 arch/arm/mach-sunxi/p2wi.c  | 117 
 arch/arm/mach-sunxi/pmic_bus.c  | 109 +--
 arch/arm/mach-sunxi/rsb.c   | 175 -
 board/sunxi/board.c |  44 +
 configs/Colombus_defconfig  |   6 -
 configs/UTOO_P66_defconfig  |   3 -
 drivers/i2c/Kconfig |  16 ++
 drivers/i2c/Makefile|   2 +
 drivers/i2c/sun6i_p2wi.c| 220 ++
 drivers/i2c/sun8i_rsb.c | 281 
 drivers/power/pmic/Kconfig  |  69 ---
 drivers/power/pmic/Makefile |   1 +
 drivers/power/pmic/axp.c|  38 
 drivers/video/anx9804.c | 103 +-
 drivers/video/anx9804.h |   5 +-
 drivers/video/sunxi/sunxi_display.c |  55 --
 include/axp_pmic.h  |  12 ++
 include/configs/sunxi-common.h  |  17 --
 22 files changed, 773 insertions(+), 564 deletions(-)
 delete mode 100644 arch/arm/mach-sunxi/p2wi.c
 delete mode 100644 arch/arm/mach-sunxi/rsb.c
 create mode 100644 drivers/i2c/sun6i_p2wi.c
 create mode 100644 drivers/i2c/sun8i_rsb.c
 create mode 100644 drivers/power/pmic/axp.c

-- 
2.32.0



[PATCH v2 01/12] power: pmic: Consistently depend on DM_PMIC

2021-10-07 Thread Samuel Holland
Kconfig symbols for two PMIC drivers (PMIC_AS3722 and DM_PMIC_MC34708)
were missing a dependency on DM_PMIC. To fix this inconsistency, and to
keep it from happening again, wrap the driver section with "if DM_PMIC"
instead of using a "depends on DM_PMIC" clause for each driver.

Reviewed-by: Igor Opaniuk 
Reviewed-by: Jaehoon Chung 
Signed-off-by: Samuel Holland 
---

Changes in v2:
- Rebase to pick up 7abf178b ("power: Tidy up #undef of CONFIG_DM_PMIC")

 drivers/power/pmic/Kconfig | 46 --
 1 file changed, 9 insertions(+), 37 deletions(-)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index cf2a9b2c17e..2472555a3ff 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -10,10 +10,12 @@ config DM_PMIC
- 'drivers/power/pmic/pmic-uclass.c'
- 'include/power/pmic.h'
 
+if DM_PMIC
+
 config SPL_DM_PMIC
bool "Enable Driver Model for PMIC drivers (UCLASS_PMIC) in SPL"
depends on SPL_DM
-   default y if DM_PMIC
+   default y
---help---
This config enables the driver-model PMIC support in SPL.
UCLASS_PMIC - designed to provide an I/O interface for PMIC devices.
@@ -25,7 +27,6 @@ config SPL_DM_PMIC
 
 config PMIC_CHILDREN
bool "Allow child devices for PMICs"
-   depends on DM_PMIC
default y
---help---
This allows PMICs to support child devices (such as regulators) in
@@ -35,7 +36,6 @@ config PMIC_CHILDREN
 
 config SPL_PMIC_CHILDREN
bool "Allow child devices for PMICs in SPL"
-   depends on DM_PMIC
default y
---help---
This allows PMICs to support child devices (such as regulators) in
@@ -46,7 +46,6 @@ config SPL_PMIC_CHILDREN
 
 config PMIC_AB8500
bool "Enable driver for ST-Ericsson AB8500 PMIC via PRCMU"
-   depends on DM_PMIC
select REGMAP
select SYSCON
help
@@ -56,7 +55,7 @@ config PMIC_AB8500
 
 config PMIC_ACT8846
bool "Enable support for the active-semi 8846 PMIC"
-   depends on DM_PMIC && DM_I2C
+   depends on DM_I2C
---help---
This PMIC includes 4 DC/DC step-down buck regulators and 8 low-dropout
regulators (LDOs). It also provides some GPIO, reset and battery
@@ -65,14 +64,13 @@ config PMIC_ACT8846
 
 config DM_PMIC_DA9063
bool "Enable Driver Model for the Dialog DA9063 PMIC"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC DA9063. The driver implements read/write operations.
 
 config SPL_DM_PMIC_DA9063
bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL"
-   depends on DM_PMIC && SPL
+   depends on SPL
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC DA9063. The driver implements read/write operations.
@@ -87,14 +85,12 @@ config PMIC_AS3722
 
 config DM_PMIC_BD71837
bool "Enable Driver Model for PMIC BD71837"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC BD71837. The driver implements read/write operations.
 
 config SPL_DM_PMIC_BD71837
bool "Enable Driver Model for PMIC BD71837 in SPL stage"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass
  features for PMIC BD71837. The driver implements read/write
@@ -102,7 +98,7 @@ config SPL_DM_PMIC_BD71837
 
 config DM_PMIC_FAN53555
bool "Enable support for OnSemi FAN53555"
-   depends on DM_PMIC && DM_REGULATOR && DM_I2C
+   depends on DM_REGULATOR && DM_I2C
select DM_REGULATOR_FAN53555
help
  This config enables implementation of driver-model PMIC
@@ -116,14 +112,12 @@ config DM_PMIC_FAN53555
 
 config DM_PMIC_MP5416
bool "Enable Driver Model for PMIC MP5416"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC MP5416. The driver implements read/write operations.
 
 config SPL_DM_PMIC_MP5416
bool "Enable Driver Model for PMIC MP5416 in SPL stage"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass
  features for PMIC MP5416. The driver implements read/write
@@ -131,56 +125,48 @@ config SPL_DM_PMIC_MP5416
 
 config DM_PMIC_PCA9450
bool "Enable Driver Model for PMIC PCA9450"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC PCA9450. The driver implements read/write operations.
 
 config SPL_DM_PMIC_PCA9450
bool "Enable Driver Model for PMIC PCA9450"
-   depends on DM_PMIC
help
  This config enables implementation of driver-model pmic uclass 
features
  for PMIC 

[PATCH V2 7/7] doc: imx8mq_evk: update doc after using binman

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

Update doc after using binman to pack images

Signed-off-by: Peng Fan 
---
 doc/board/nxp/imx8mq_evk.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/board/nxp/imx8mq_evk.rst b/doc/board/nxp/imx8mq_evk.rst
index c269fdebe3..92eeda79aa 100644
--- a/doc/board/nxp/imx8mq_evk.rst
+++ b/doc/board/nxp/imx8mq_evk.rst
@@ -43,13 +43,14 @@ Build U-Boot
 
$ export CROSS_COMPILE=aarch64-poky-linux-
$ make imx8mq_evk_defconfig
-   $ make flash.bin
+   $ make
 
 Burn the flash.bin to MicroSD card offset 33KB:
 
 .. code-block:: bash
 
$sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc
+   $sudo dd if=u-boot.itb of=/dev/sd[x] bs=1024 seek=384 conv=notrunc
 
 Boot
 
-- 
2.30.0



[PATCH V2 6/7] imx: imx8mq use common imximage.cfg

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

After all these board switch to binman, we could use common imximage.cfg

Signed-off-by: Peng Fan 
---
 arch/arm/mach-imx/imx8m/imximage.cfg  | 12 +++-
 board/freescale/imx8mq_evk/imximage.cfg   | 11 ---
 board/google/imx8mq_phanbell/imximage.cfg | 11 ---
 board/technexion/pico-imx8mq/imximage.cfg | 11 ---
 configs/imx8mq_evk_defconfig  |  2 +-
 configs/imx8mq_phanbell_defconfig |  2 +-
 configs/pico-imx8mq_defconfig |  2 +-
 7 files changed, 6 insertions(+), 45 deletions(-)
 delete mode 100644 board/freescale/imx8mq_evk/imximage.cfg
 delete mode 100644 board/google/imx8mq_phanbell/imximage.cfg
 delete mode 100644 board/technexion/pico-imx8mq/imximage.cfg

diff --git a/arch/arm/mach-imx/imx8m/imximage.cfg 
b/arch/arm/mach-imx/imx8m/imximage.cfg
index 714b24273b..9c6eaf0a6d 100644
--- a/arch/arm/mach-imx/imx8m/imximage.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage.cfg
@@ -1,17 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2018 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #define __ASSEMBLY__
 
 FIT
 BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi_imx8m.bin
-LOADER spl/u-boot-spl-ddr.bin  0x7E1000
-SECOND_LOADER  u-boot.itb  0x4020 0x6
-
-DDR_FW lpddr4_pmu_train_1d_imem.bin
-DDR_FW lpddr4_pmu_train_1d_dmem.bin
-DDR_FW lpddr4_pmu_train_2d_imem.bin
-DDR_FW lpddr4_pmu_train_2d_dmem.bin
+SIGNED_HDMIsigned_hdmi.bin
+LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/board/freescale/imx8mq_evk/imximage.cfg 
b/board/freescale/imx8mq_evk/imximage.cfg
deleted file mode 100644
index 74f12b30d2..00
--- a/board/freescale/imx8mq_evk/imximage.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2021 NXP
- */
-
-#define __ASSEMBLY__
-
-FIT
-BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/board/google/imx8mq_phanbell/imximage.cfg 
b/board/google/imx8mq_phanbell/imximage.cfg
deleted file mode 100644
index 74f12b30d2..00
--- a/board/google/imx8mq_phanbell/imximage.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2021 NXP
- */
-
-#define __ASSEMBLY__
-
-FIT
-BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/board/technexion/pico-imx8mq/imximage.cfg 
b/board/technexion/pico-imx8mq/imximage.cfg
deleted file mode 100644
index 74f12b30d2..00
--- a/board/technexion/pico-imx8mq/imximage.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2021 NXP
- */
-
-#define __ASSEMBLY__
-
-FIT
-BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index 4e74c6f235..412d05e41a 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -19,7 +19,7 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8mq_evk/imximage.cfg"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
diff --git a/configs/imx8mq_phanbell_defconfig 
b/configs/imx8mq_phanbell_defconfig
index 24922ce2e0..3a6e428617 100644
--- a/configs/imx8mq_phanbell_defconfig
+++ b/configs/imx8mq_phanbell_defconfig
@@ -19,7 +19,7 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/google/imx8mq_phanbell/imximage.cfg"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg"
 CONFIG_SD_BOOT=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
diff --git a/configs/pico-imx8mq_defconfig b/configs/pico-imx8mq_defconfig
index c510b0b7cb..3db75826c1 100644
--- a/configs/pico-imx8mq_defconfig
+++ b/configs/pico-imx8mq_defconfig
@@ -18,7 +18,7 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/technexion/pico-imx8mq/imximage.cfg"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
-- 
2.30.0



[PATCH V2 5/7] imx: makefile: drop the use of imx8mimage.sh

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

After switch to use binman, no need to use the bash script
to check file exsiting or not. And there is bug that
the script will be executed everytime Makefile is used which is
confusing people.

Signed-off-by: Peng Fan 
---
 arch/arm/mach-imx/Makefile | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 63e28c635e..bfff79f88c 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -114,8 +114,7 @@ endif
 DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout 
$(srctree)/$(IMX_CONFIG); if [ -f u-boot-dtb.cfgout ]; then $(CNTR_DEPFILES) 
u-boot-dtb.cfgout; echo $$?; fi)
 else ifeq ($(CONFIG_ARCH_IMX8M), y)
 IMAGE_TYPE := imx8mimage
-IMX8M_DEPFILES := $(srctree)/tools/imx8m_image.sh
-DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout 
$(srctree)/$(IMX_CONFIG);if [ -f spl/u-boot-spl.cfgout ]; then 
$(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 0; echo $$?; fi)
+DEPFILE_EXISTS := 0
 else
 IMAGE_TYPE := imximage
 DEPFILE_EXISTS := 0
@@ -150,16 +149,18 @@ endif
 
 ifdef CONFIG_ARM64
 ifeq ($(CONFIG_ARCH_IMX8M), y)
-SPL:
+
+SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
 
 MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout \
   -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
 flash.bin: MKIMAGEOUTPUT = flash.log
 
+spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cpp_cfg)
+
 spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
-ifeq ($(DEPFILE_EXISTS),0)
-   $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 1
-endif
 
 flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE
$(call if_changed,mkimage)
-- 
2.30.0



[PATCH V2 3/7] imx: imx8mq_phanbell: switch to binman

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

Switch to binman to pack images

Signed-off-by: Peng Fan 
---
 arch/arm/dts/imx8mq-phanbell-u-boot.dtsi  |  2 ++
 arch/arm/mach-imx/imx8m/Kconfig   |  7 ---
 board/google/imx8mq_phanbell/imximage.cfg | 11 +++
 configs/imx8mq_phanbell_defconfig |  3 ++-
 4 files changed, 19 insertions(+), 4 deletions(-)
 create mode 100644 board/google/imx8mq_phanbell/imximage.cfg

diff --git a/arch/arm/dts/imx8mq-phanbell-u-boot.dtsi 
b/arch/arm/dts/imx8mq-phanbell-u-boot.dtsi
index 4712cf6a44..a65a942ee7 100644
--- a/arch/arm/dts/imx8mq-phanbell-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-phanbell-u-boot.dtsi
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
 
+#include "imx8mq-u-boot.dtsi"
+
 _usdhc2_vmmc {
u-boot,off-on-delay-us = <2>;
 };
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index ef3e4b209f..16c950fcfe 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -41,9 +41,10 @@ config TARGET_IMX8MQ_EVK
select IMX8M_LPDDR4
 
 config TARGET_IMX8MQ_PHANBELL
-bool "imx8mq_phanbell"
-select IMX8MQ
-select IMX8M_LPDDR4
+   bool "imx8mq_phanbell"
+   select BINMAN
+   select IMX8MQ
+   select IMX8M_LPDDR4
 
 config TARGET_IMX8MM_EVK
bool "imx8mm LPDDR4 EVK board"
diff --git a/board/google/imx8mq_phanbell/imximage.cfg 
b/board/google/imx8mq_phanbell/imximage.cfg
new file mode 100644
index 00..74f12b30d2
--- /dev/null
+++ b/board/google/imx8mq_phanbell/imximage.cfg
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+#define __ASSEMBLY__
+
+FIT
+BOOT_FROM  sd
+SIGNED_HDMIsigned_hdmi.bin
+LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/configs/imx8mq_phanbell_defconfig 
b/configs/imx8mq_phanbell_defconfig
index 911c3391db..24922ce2e0 100644
--- a/configs/imx8mq_phanbell_defconfig
+++ b/configs/imx8mq_phanbell_defconfig
@@ -18,7 +18,8 @@ CONFIG_SYS_LOAD_ADDR=0x4048
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/google/imx8mq_phanbell/imximage.cfg"
 CONFIG_SD_BOOT=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
-- 
2.30.0



[PATCH V2 4/7] imx: pico-imx8mq: switch to use binman

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

Switch to use binman to pack images

Signed-off-by: Peng Fan 
---
 arch/arm/dts/imx8mq-pico-pi.dts   |  1 +
 arch/arm/mach-imx/imx8m/Kconfig   |  1 +
 board/technexion/pico-imx8mq/imximage.cfg | 11 +++
 configs/pico-imx8mq_defconfig |  3 ++-
 4 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 board/technexion/pico-imx8mq/imximage.cfg

diff --git a/arch/arm/dts/imx8mq-pico-pi.dts b/arch/arm/dts/imx8mq-pico-pi.dts
index d2af18ad0e..8ed6e9166b 100644
--- a/arch/arm/dts/imx8mq-pico-pi.dts
+++ b/arch/arm/dts/imx8mq-pico-pi.dts
@@ -9,6 +9,7 @@
 /dts-v1/;
 
 #include "imx8mq.dtsi"
+#include "imx8mq-u-boot.dtsi"
 
 / {
model = "TechNexion PICO-PI-8M";
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index 16c950fcfe..1d08a2977f 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -100,6 +100,7 @@ config TARGET_IMX8MP_EVK
 
 config TARGET_PICO_IMX8MQ
bool "Support Technexion Pico iMX8MQ"
+   select BINMAN
select IMX8MQ
select IMX8M_LPDDR4
 
diff --git a/board/technexion/pico-imx8mq/imximage.cfg 
b/board/technexion/pico-imx8mq/imximage.cfg
new file mode 100644
index 00..74f12b30d2
--- /dev/null
+++ b/board/technexion/pico-imx8mq/imximage.cfg
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+#define __ASSEMBLY__
+
+FIT
+BOOT_FROM  sd
+SIGNED_HDMIsigned_hdmi.bin
+LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/configs/pico-imx8mq_defconfig b/configs/pico-imx8mq_defconfig
index b90a492424..c510b0b7cb 100644
--- a/configs/pico-imx8mq_defconfig
+++ b/configs/pico-imx8mq_defconfig
@@ -17,7 +17,8 @@ CONFIG_SYS_LOAD_ADDR=0x4048
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/technexion/pico-imx8mq/imximage.cfg"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
-- 
2.30.0



[PATCH V2 1/7] tools: imx8mimage: not abort when mmap fail

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan 
---
 tools/imx8mimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/imx8mimage.c b/tools/imx8mimage.c
index 11e40ccd94..4eed683396 100644
--- a/tools/imx8mimage.c
+++ b/tools/imx8mimage.c
@@ -271,7 +271,7 @@ static void copy_file(int ifd, const char *datafile, int 
pad, int offset,
if (ptr == MAP_FAILED) {
fprintf(stderr, "Can't read %s: %s\n",
datafile, strerror(errno));
-   exit(EXIT_FAILURE);
+   goto err_mmap;
}
 
size = sbuf.st_size - datafile_offset;
@@ -311,6 +311,7 @@ static void copy_file(int ifd, const char *datafile, int 
pad, int offset,
}
 
munmap((void *)ptr, sbuf.st_size);
+err_mmap:
close(dfd);
 }
 
-- 
2.30.0



[PATCH V2 2/7] imx: imx8mq_evk: switch to binman

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

Switch to use binman to pack images

Signed-off-by: Peng Fan 
---
 arch/arm/dts/imx8mq-evk-u-boot.dtsi |   2 +
 arch/arm/dts/imx8mq-u-boot.dtsi | 122 
 arch/arm/mach-imx/imx8m/Kconfig |   1 +
 board/freescale/imx8mq_evk/imximage.cfg |  11 +++
 configs/imx8mq_evk_defconfig|   3 +-
 5 files changed, 138 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx8mq-u-boot.dtsi
 create mode 100644 board/freescale/imx8mq_evk/imximage.cfg

diff --git a/arch/arm/dts/imx8mq-evk-u-boot.dtsi 
b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
index 2cfc12b7e0..6f9c81462e 100644
--- a/arch/arm/dts/imx8mq-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
 
+#include "imx8mq-u-boot.dtsi"
+
  {
mmc-hs400-1_8v;
 };
diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi
new file mode 100644
index 00..2c10e9b645
--- /dev/null
+++ b/arch/arm/dts/imx8mq-u-boot.dtsi
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 NXP
+ */
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+
+};
+
+ {
+   u-boot-spl-ddr {
+   filename = "u-boot-spl-ddr.bin";
+   pad-byte = <0xff>;
+   align-size = <4>;
+   align = <4>;
+
+   u-boot-spl {
+   align-end = <4>;
+   };
+
+   blob_1: blob-ext@1 {
+   filename = "lpddr4_pmu_train_1d_imem.bin";
+   size = <0x8000>;
+   };
+
+   blob_2: blob-ext@2 {
+   filename = "lpddr4_pmu_train_1d_dmem.bin";
+   size = <0x4000>;
+   };
+
+   blob_3: blob-ext@3 {
+   filename = "lpddr4_pmu_train_2d_imem.bin";
+   size = <0x8000>;
+   };
+
+   blob_4: blob-ext@4 {
+   filename = "lpddr4_pmu_train_2d_dmem.bin";
+   size = <0x4000>;
+   };
+   };
+
+   signed_hdmi {
+   filename = "signed_hdmi.bin";
+
+   blob_5: blob-ext@5 {
+   filename = "signed_hdmi_imx8m.bin";
+   };
+   };
+
+   flash {
+   mkimage {
+   args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
+
+   blob {
+   filename = "u-boot-spl-ddr.bin";
+   };
+
+   };
+
+   };
+
+   itb {
+   filename = "u-boot.itb";
+
+   fit {
+   description = "Configuration to load ATF before U-Boot";
+   #address-cells = <1>;
+   fit,external-offset = ;
+
+   images {
+   uboot {
+   description = "U-Boot (64-bit)";
+   type = "standalone";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+
+   uboot_blob: blob-ext {
+   filename = "u-boot-nodtb.bin";
+   };
+   };
+
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   load = <0x91>;
+   entry = <0x91>;
+
+   atf_blob: blob-ext {
+   filename = "bl31.bin";
+   };
+   };
+
+   fdt {
+   description = "NAME";
+   type = "flat_dt";
+   compression = "none";
+
+   uboot_fdt_blob: blob-ext {
+   filename = "u-boot.dtb";
+   };
+   };
+   };
+
+   configurations {
+   default = "conf";
+
+   conf {
+   description = "NAME";
+   firmware = "uboot";
+   loadables = "atf";
+   fdt = "fdt";
+   };
+

[PATCH V2 0/7] imx8mq: switch to binman

2021-10-07 Thread Peng Fan (OSS)
From: Peng Fan 

V2:
 Add cover-letter
 Rebased to latest master to avoid apply failure.

Peng Fan (7):
  tools: imx8mimage: not abort when mmap fail
  imx: imx8mq_evk: switch to binman
  imx: imx8mq_phanbell: switch to binman
  imx: pico-imx8mq: switch to use binman
  imx: makefile: drop the use of imx8mimage.sh
  imx: imx8mq use common imximage.cfg
  doc: imx8mq_evk: update doc after using binman

 arch/arm/dts/imx8mq-evk-u-boot.dtsi  |   2 +
 arch/arm/dts/imx8mq-phanbell-u-boot.dtsi |   2 +
 arch/arm/dts/imx8mq-pico-pi.dts  |   1 +
 arch/arm/dts/imx8mq-u-boot.dtsi  | 122 +++
 arch/arm/mach-imx/Makefile   |  13 +--
 arch/arm/mach-imx/imx8m/Kconfig  |   9 +-
 arch/arm/mach-imx/imx8m/imximage.cfg |  12 +--
 configs/imx8mq_evk_defconfig |   3 +-
 configs/imx8mq_phanbell_defconfig|   3 +-
 configs/pico-imx8mq_defconfig|   3 +-
 doc/board/nxp/imx8mq_evk.rst |   3 +-
 tools/imx8mimage.c   |   3 +-
 12 files changed, 153 insertions(+), 23 deletions(-)
 create mode 100644 arch/arm/dts/imx8mq-u-boot.dtsi

-- 
2.30.0



[PATCH v1 3/3] rockchip: rk3568: add arch_cpu_init()

2021-10-07 Thread Nico Cheng
We configured the drive strength and security of EMMC in
arch_cpu_init().

Signed-off-by: Nico Cheng 
---

 arch/arm/mach-rockchip/rk3568/rk3568.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3568/rk3568.c 
b/arch/arm/mach-rockchip/rk3568/rk3568.c
index 973b4f9dcb..3f9a435c3c 100644
--- a/arch/arm/mach-rockchip/rk3568/rk3568.c
+++ b/arch/arm/mach-rockchip/rk3568/rk3568.c
@@ -13,6 +13,14 @@
 
 #define PMUGRF_BASE0xfdc2
 #define GRF_BASE   0xfdc6
+#define GRF_GPIO1B_DS_20x218
+#define GRF_GPIO1B_DS_30x21c
+#define GRF_GPIO1C_DS_00x220
+#define GRF_GPIO1C_DS_10x224
+#define GRF_GPIO1C_DS_20x228
+#define GRF_GPIO1C_DS_30x22c
+#define SGRF_BASE  0xFDD18000
+#define SGRF_SOC_CON4  0x10
 
 /* PMU_GRF_GPIO0D_IOMUX_L */
 enum {
@@ -81,5 +89,16 @@ void board_debug_uart_init(void)
 
 int arch_cpu_init(void)
 {
+#ifdef CONFIG_SPL_BUILD
+   /* Set the emmc sdmmc0 to secure */
+   writel(((0x3 << 11 | 0x1 << 4) << 16), SGRF_BASE + SGRF_SOC_CON4);
+   /* set the emmc ds to level 2 */
+   writel(0x3f3f0707, GRF_BASE + GRF_GPIO1B_DS_2);
+   writel(0x3f3f0707, GRF_BASE + GRF_GPIO1B_DS_3);
+   writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_0);
+   writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_1);
+   writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_2);
+   writel(0x3f3f0707, GRF_BASE + GRF_GPIO1C_DS_3);
+#endif
return 0;
 }
-- 
2.17.1





[PATCH v1 2/3] arm: dts: rockchip: rk3568: Enable sdhci and sdmmc0 node

2021-10-07 Thread Nico Cheng
Enable sdhci and sdmmc0 node in rk3568-u-boot.dtsi

Signed-off-by: Nico Cheng 
---

 arch/arm/dts/rk3568-u-boot.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/dts/rk3568-u-boot.dtsi b/arch/arm/dts/rk3568-u-boot.dtsi
index 1570f13fc7..5a80dda275 100644
--- a/arch/arm/dts/rk3568-u-boot.dtsi
+++ b/arch/arm/dts/rk3568-u-boot.dtsi
@@ -9,6 +9,10 @@
mmc1 = 
};
 
+   chosen {
+   u-boot,spl-boot-order = , 
+   };
+
dmc: dmc {
compatible = "rockchip,rk3568-dmc";
u-boot,dm-pre-reloc;
@@ -35,3 +39,16 @@
u-boot,dm-pre-reloc;
status = "okay";
 };
+
+ {
+   u-boot,dm-spl;
+   status = "okay";
+};
+
+ {
+   bus-width = <8>;
+   u-boot,dm-spl;
+   mmc-hs200-1_8v;
+   status = "okay";
+};
+
-- 
2.17.1





[PATCH v1 1/3] rockchip: Kconfig: Enable SPL support for rk3568

2021-10-07 Thread Nico Cheng
Enable SPL support in Kconfig and add some related option in
rk3568_common.h

Signed-off-by: Nico Cheng 
Signed-off-by: Jason Zhu 
---

 arch/arm/mach-rockchip/Kconfig  |  2 ++
 configs/evb-rk3568_defconfig| 25 -
 include/configs/rk3568_common.h |  4 
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b164afb529..21b9c381cf 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -260,6 +260,8 @@ config ROCKCHIP_RK3399
 config ROCKCHIP_RK3568
bool "Support Rockchip RK3568"
select ARM64
+   select SUPPORT_SPL
+   select SPL
select CLK
select PINCTRL
select RAM
diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index a102a5a999..a145b71ac2 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -1,20 +1,42 @@
 CONFIG_ARM=y
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_SYS_TEXT_BASE=0x00a0
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=2
-CONFIG_DEFAULT_DEVICE_TREE="rk3568-evb"
 CONFIG_ROCKCHIP_RK3568=y
+CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
+CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL_STACK_R_ADDR=0x60
 CONFIG_TARGET_EVB_RK3568=y
 CONFIG_DEBUG_UART_BASE=0xFE66
 CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_DEFAULT_DEVICE_TREE="rk3568-evb"
 CONFIG_DEBUG_UART=y
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_SEPARATE_BSS=y
+CONFIG_SPL_CRC32_SUPPORT=y
+CONFIG_SPL_ATF=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_SETEXPR is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_LIVE=y
 CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_CLK=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
@@ -28,6 +50,7 @@ CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
 CONFIG_REGULATOR_PWM=y
 CONFIG_PWM_ROCKCHIP=y
+CONFIG_SPL_RAM=y
 CONFIG_DM_RESET=y
 CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_SHIFT=2
diff --git a/include/configs/rk3568_common.h b/include/configs/rk3568_common.h
index b6568917ea..47fc91779e 100644
--- a/include/configs/rk3568_common.h
+++ b/include/configs/rk3568_common.h
@@ -18,6 +18,10 @@
 
 #define CONFIG_SYS_INIT_SP_ADDR0x00c0
 #define CONFIG_SYS_LOAD_ADDR   0x00c00800
+#define CONFIG_SPL_STACK   0x0040
+#define CONFIG_SPL_MAX_SIZE0x2
+#define CONFIG_SPL_BSS_START_ADDR  0x400
+#define CONFIG_SPL_BSS_MAX_SIZE0x4000
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)  /* 64M */
 
 #define CONFIG_SYS_SDRAM_BASE  0
-- 
2.17.1





[PATCH v1 0/3] Add SPL build support for RK3568

2021-10-07 Thread Nico Cheng


This series adds support for the rk3568 SOC, SPL load next-stage image from
eMMC will be supported after this series of patches.


Nico Cheng (3):
  rockchip: Kconfig: Enable SPL support for rk3568
  arm: dts: rockchip: rk3568: Enable sdhci and sdmmc0 node
  rockchip: rk3568: add arch_cpu_init()

 arch/arm/dts/rk3568-u-boot.dtsi| 17 +
 arch/arm/mach-rockchip/Kconfig |  2 ++
 arch/arm/mach-rockchip/rk3568/rk3568.c | 19 +++
 configs/evb-rk3568_defconfig   | 25 -
 include/configs/rk3568_common.h|  4 
 5 files changed, 66 insertions(+), 1 deletion(-)

-- 
2.17.1





Re: [RFC 07/22] dm: blk: add UCLASS_PARTITION

2021-10-07 Thread AKASHI Takahiro
On Mon, Oct 04, 2021 at 12:27:59PM +0900, AKASHI Takahiro wrote:
> On Fri, Oct 01, 2021 at 11:30:37AM +0200, Heinrich Schuchardt wrote:
> > 
> > 
> > On 10/1/21 07:01, AKASHI Takahiro wrote:
> > > UCLASS_PARTITION device will be created as a child node of
> > > UCLASS_BLK device.
> > > 
> > > Signed-off-by: AKASHI Takahiro 
> > > ---
> > >   drivers/block/blk-uclass.c | 111 +
> > >   include/blk.h  |   9 +++
> > >   include/dm/uclass-id.h |   1 +
> > >   3 files changed, 121 insertions(+)
> > > 
> > > diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> > > index 83682dcc181a..dd7f3c0fe31e 100644
> > > --- a/drivers/block/blk-uclass.c
> > > +++ b/drivers/block/blk-uclass.c
> > > @@ -12,6 +12,7 @@
> > >   #include 
> > >   #include 
> > >   #include 
> > > +#include 
> > >   #include 
> > >   #include 
> > >   #include 
> > > @@ -695,6 +696,44 @@ int blk_unbind_all(int if_type)
> > >   return 0;
> > >   }
> > > 
> > > +int blk_create_partitions(struct udevice *parent)
> > > +{
> > > + int part, count;
> > > + struct blk_desc *desc = dev_get_uclass_plat(parent);
> > > + struct disk_partition info;
> > > + struct disk_part *part_data;
> > > + char devname[32];
> > > + struct udevice *dev;
> > > + int ret;
> > > +
> > > + if (!CONFIG_IS_ENABLED(PARTITIONS) ||
> > > + !CONFIG_IS_ENABLED(HAVE_BLOCK_DEVICE))
> > > + return 0;
> > > +
> > > + /* Add devices for each partition */
> > > + for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
> > > + if (part_get_info(desc, part, ))
> > > + continue;
> > > + snprintf(devname, sizeof(devname), "%s:%d", parent->name,
> > > +  part);
> > > +
> > > + ret = device_bind_driver(parent, "blk_partition",
> > > +  strdup(devname), );
> > > + if (ret)
> > > + return ret;
> > > +
> > > + part_data = dev_get_uclass_plat(dev);
> > > + part_data->partnum = part;
> > > + part_data->gpt_part_info = info;
> > > + count++;
> > > +
> > > + device_probe(dev);
> > > + }
> > > + debug("%s: %d partitions found in %s\n", __func__, count, parent->name);
> > > +
> > > + return 0;
> > > +}
> > > +
> > >   static int blk_post_probe(struct udevice *dev)
> > >   {
> > >   if (IS_ENABLED(CONFIG_PARTITIONS) &&
> > > @@ -713,3 +752,75 @@ UCLASS_DRIVER(blk) = {
> > >   .post_probe = blk_post_probe,
> > >   .per_device_plat_auto   = sizeof(struct blk_desc),
> > >   };
> > > +
> > > +static ulong blk_part_read(struct udevice *dev, lbaint_t start,
> > > +lbaint_t blkcnt, void *buffer)
> > > +{
> > > + struct udevice *parent;
> > > + struct disk_part *part;
> > > + const struct blk_ops *ops;
> > > +
> > > + parent = dev_get_parent(dev);
> > 
> > What device type will the parent have if it is a eMMC hardware partition?
> > 
> > > + ops = blk_get_ops(parent);
> > > + if (!ops->read)
> > > + return -ENOSYS;
> > > +
> > > + part = dev_get_uclass_plat(dev);
> > 
> > You should check that we do not access the block device past the
> > partition end:
> 
> Yes, I will fix all of checks.
> 
> > struct blk_desc *desc = dev_get_uclass_plat(parent);
> > if ((start + blkcnt) * desc->blksz < part->gpt_part_info.blksz)
> > return -EFAULT.
> > 
> > > + start += part->gpt_part_info.start;

A better solution is:
if (start >= part->gpt_part_info.size)
return 0;

if ((start + blkcnt) > part->gpt_part_info.size)
blkcnt = part->gpt_part_info.size - start;
start += part->gpt_part_info.start;
instead of returning -EFAULT.
(note that start and blkcnt are in "block".)

-Takahiro Akashi

> > > +
> > > + return ops->read(parent, start, blkcnt, buffer);
> > > +}
> > > +
> > > +static ulong blk_part_write(struct udevice *dev, lbaint_t start,
> > > + lbaint_t blkcnt, const void *buffer)
> > > +{
> > > + struct udevice *parent;
> > > + struct disk_part *part;
> > > + const struct blk_ops *ops;
> > > +
> > > + parent = dev_get_parent(dev);
> > > + ops = blk_get_ops(parent);
> > > + if (!ops->write)
> > > + return -ENOSYS;
> > > +
> > > + part = dev_get_uclass_plat(dev);
> > > + start += part->gpt_part_info.start;
> > 
> > here too
> > 
> > > +
> > > + return ops->write(parent, start, blkcnt, buffer);
> > > +}
> > > +
> > > +static ulong blk_part_erase(struct udevice *dev, lbaint_t start,
> > > + lbaint_t blkcnt)
> > > +{
> > > + struct udevice *parent;
> > > + struct disk_part *part;
> > > + const struct blk_ops *ops;
> > > +
> > > + parent = dev_get_parent(dev);
> > > + ops = blk_get_ops(parent);
> > > + if (!ops->erase)
> > > + return -ENOSYS;
> > > +
> > > + part = dev_get_uclass_plat(dev);
> > > + start += part->gpt_part_info.start;
> > 
> > here too
> > 
> > Best regards
> > 
> > Heinrich
> > 
> > > +
> > > + 

[PATCH v5 08/10] include/configs: apalis-imx8/verdin-imx8mm: rename kernel image variable

2021-10-07 Thread Marcel Ziswiler
From: Oleksandr Suvorov 

Variable "kernel_image" is used in boot.scr script only, that sets its
own default value to the constant string @@KERNEL_IMAGETYPE@@ in case
"kernel_image" is not set.
The default name of the kernel image shipped with BSP 5.x is "Image.gz".
Setting kernel_image="Image" as a pre-defined u-boot variable
breaks booting systems with modern versions of boot.scr, whereas
renaming it fixes booting with modern scripts and does not break working
of earlier versions of boot.scr.

Signed-off-by: Oleksandr Suvorov 
Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 

---

(no changes since v3)

Changes in v3:
- Fix patch.
- Add missing apalis-imx8 part.
- While at it update copyright year resp. period.
- Fix closing endif comment.

Changes in v2:
- New patch allows booting recent embedded Linux BSPs.

 include/configs/apalis-imx8.h   |  6 +++---
 include/configs/verdin-imx8mm.h | 10 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 80594548877..ce5681499c9 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2019 Toradex
+ * Copyright 2019-2021 Toradex
  */
 
 #ifndef __APALIS_IMX8_H
@@ -42,12 +42,12 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS \
+   "boot_file=Image\0" \
"console=ttyLP1 earlycon\0" \
"fdt_addr=0x8300\0" \
"fdt_file=fsl-imx8qm-apalis-eval.dtb\0" \
"fdtfile=fsl-imx8qm-apalis-eval.dtb\0" \
"finduuid=part uuid mmc ${mmcdev}:2 uuid\0" \
-   "image=Image\0" \
"initrd_addr=0x8380\0" \
"initrd_high=0x\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
@@ -57,7 +57,7 @@
"netargs=setenv bootargs console=${console},${baudrate} " \
"root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp" \
"\0" \
-   "nfsboot=run netargs; dhcp ${loadaddr} ${image}; tftp ${fdt_addr} " \
+   "nfsboot=run netargs; dhcp ${loadaddr} ${boot_file}; tftp ${fdt_addr} " 
\
"apalis-imx8/${fdt_file}; booti ${loadaddr} - ${fdt_addr}\0" \
"panel=NULL\0" \
"script=boot.scr\0" \
diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h
index 50c808383db..693fd6907eb 100644
--- a/include/configs/verdin-imx8mm.h
+++ b/include/configs/verdin-imx8mm.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2020 Toradex
+ * Copyright 2020-2021 Toradex
  */
 
 #ifndef __VERDIN_IMX8MM_H
@@ -54,16 +54,16 @@
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS \
"bootcmd_mfg=fastboot 0\0" \
+   "boot_file=Image\0" \
"console=ttymxc0\0" \
"fdt_addr=0x4300\0" \
-   "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+   "fdt_board=dev\0" \
"initrd_addr=0x4380\0" \
"initrd_high=0x\0" \
-   "kernel_image=Image\0" \
"netargs=setenv bootargs console=${console},${baudrate} " \
"root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp" \
"\0" \
-   "nfsboot=run netargs; dhcp ${loadaddr} ${kernel_image}; " \
+   "nfsboot=run netargs; dhcp ${loadaddr} ${boot_file}; " \
"tftp ${fdt_addr} verdin/${fdtfile}; " \
"booti ${loadaddr} - ${fdt_addr}\0" \
"setup=setenv setupargs console=${console},${baudrate} " \
@@ -118,4 +118,4 @@
 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 
-#endif /*_VERDIN_IMX8MM_H */
+#endif /* __VERDIN_IMX8MM_H */
-- 
2.26.2



[PATCH v5 00/10] board: toradex: verdin-imx8mm: target refresh

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 


An assortment of fixes and improvements like an Ethernet PHY
configuration fix, DEK blob encapsulation preparation, migration to
using binman to pack images, SLEEP_MOCI# enablement, dropping of V1.0
hardware support [1], renaming kernel image variable, using preboot
for fdtfile evaluation and watchdog pinctrl fix.

Note that this series is applied on top of Peng's Makefile fix [2] as
otherwise, it may not quite generate all binman artefacts in the right
order as discussed here [3].

[1] https://developer.toradex.com/verdin-sample-phase-over
[2] https://marc.info/?l=u-boot=162908373904742
[3] https://marc.info/?l=u-boot=162945614207220

Changes in v5:
- Drop device tree part already done by Marek's patch.
- Add another fixes tag as his patch forgot the board code part.
- Re-based on top of u-boot-imx, master yet again.

Changes in v4:
- Add Heiko Schocher's reviewed-by tag.
- Fix copyright periods.
- Re-based.

Changes in v3:
- Case fold hex string.
- Revert binman part of imx8mm-verdin-u-boot.dtsi to a plain copy from
  imx8mm-evk and postpone further improvements to after migrating to a
  common binman config as agreed with Frieder and Simon.
- New patch cleaning up include order.
- Add Fabio's reviewed-by tag.
- Fix patch.
- Add missing apalis-imx8 part.
- While at it update copyright year resp. period.
- Fix closing endif comment.

Changes in v2:
- Explicitly pass filename to binman when generating binaries as
  suggested by Heiko.
- Use proper intermediate binary u-boot-spl-ddr.bin for imximage as
  pointed out by Heiko.
- Drop first patch ("imx: mkimage_fit_atf: fix legacy image generation")
  as a similar fix was already refused earlier.
- New patch allows booting recent embedded Linux BSPs.
- New patch addressing dynamic fdtfile definition.
- New patch fixing watchdog pinctrl issue.

Igor Opaniuk (1):
  verdin-imx8mm: use preboot for fdtfile evaluation

Marcel Ziswiler (6):
  imx8m: clean-up kconfig indentation
  verdin-imx8mm: fix ethernet
  ARM: dts: imx8mm-verdin: prepare for dek blob encapsulation
  verdin-imx8mm: switch to use binman to pack images
  verdin-imx8mm: clean-up include order
  verdin-imx8mm: fix watchdog pinctrl issue

Max Krummenacher (2):
  verdin-imx8mm: enable sleep_moci output
  verdin-imx8mm: drop support for v1.0 hardware

Oleksandr Suvorov (1):
  include/configs: apalis-imx8/verdin-imx8mm: rename kernel image
variable

 arch/arm/dts/imx8mm-verdin-u-boot.dtsi  | 135 +++-
 arch/arm/dts/imx8mm-verdin.dts  |  18 +++
 arch/arm/mach-imx/imx8m/Kconfig |  21 +--
 board/toradex/verdin-imx8mm/imximage.cfg|  11 +-
 board/toradex/verdin-imx8mm/verdin-imx8mm.c |  81 +---
 configs/verdin-imx8mm_defconfig |   6 +-
 doc/board/toradex/verdin-imx8mm.rst |  53 
 include/configs/apalis-imx8.h   |   6 +-
 include/configs/verdin-imx8mm.h |  10 +-
 9 files changed, 214 insertions(+), 127 deletions(-)

-- 
2.26.2



[PATCH v5 10/10] verdin-imx8mm: fix watchdog pinctrl issue

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Finally, found the root cause of the issue already once mentioned back
here [2] which caused the following error message during boot:

imx_wdt watchdog@3028:
 pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

Turns out while the watchdog node itself was already u-boot,dm-spl its
pinctrl node was not which caused it to be unavailable at that early
stage. Note that any and all other boards I checked also seem to be
missing this. However, I can't judge whether or not they might indeed
need a similar fix or not.

[2] https://marc.info/?l=u-boot=161786572422973

Fixes: commit d304e7ace3a6
 ("ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin")
Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 

---

(no changes since v2)

Changes in v2:
- New patch fixing watchdog pinctrl issue.

 arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
index 0c65070cd5f..bf47930c36f 100644
--- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
@@ -68,6 +68,10 @@
u-boot,dm-spl;
 };
 
+_wdog {
+   u-boot,dm-spl;
+};
+
 &{/soc@0/bus@3080/i2c@30a2/pmic} {
u-boot,dm-spl;
 };
-- 
2.26.2



[PATCH v5 04/10] verdin-imx8mm: switch to use binman to pack images

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Use binman to pack images.

Signed-off-by: Marcel Ziswiler 
Reviewed-by: Heiko Thiery 
Reviewed-by: Fabio Estevam 
Reviewed-by: Heiko Schocher 

---

(no changes since v4)

Changes in v4:
- Add Heiko Schocher's reviewed-by tag.
- Fix copyright periods.

Changes in v3:
- Case fold hex string.
- Revert binman part of imx8mm-verdin-u-boot.dtsi to a plain copy from
  imx8mm-evk and postpone further improvements to after migrating to a
  common binman config as agreed with Frieder and Simon.

Changes in v2:
- Explicitly pass filename to binman when generating binaries as
  suggested by Heiko.
- Use proper intermediate binary u-boot-spl-ddr.bin for imximage as
  pointed out by Heiko.

 arch/arm/dts/imx8mm-verdin-u-boot.dtsi   | 124 ++-
 arch/arm/mach-imx/imx8m/Kconfig  |   1 +
 board/toradex/verdin-imx8mm/imximage.cfg |  11 +-
 configs/verdin-imx8mm_defconfig  |   2 +-
 doc/board/toradex/verdin-imx8mm.rst  |  53 +-
 5 files changed, 157 insertions(+), 34 deletions(-)

diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
index a97626fa0c1..0c65070cd5f 100644
--- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
@@ -1,11 +1,15 @@
 // SPDX-License-Identifier: GPL-2.0+ OR MIT
 /*
- * Copyright 2020 Toradex
+ * Copyright 2020-2021 Toradex
  */
 
 #include "imx8mm-u-boot.dtsi"
 
 / {
+   binman: binman {
+   multiple-images;
+   };
+
firmware {
optee {
compatible = "linaro,optee-tz";
@@ -91,3 +95,121 @@
  {
u-boot,dm-spl;
 };
+
+ {
+u-boot-spl-ddr {
+   filename = "u-boot-spl-ddr.bin";
+   pad-byte = <0xff>;
+   align-size = <4>;
+   align = <4>;
+
+   u-boot-spl {
+   align-end = <4>;
+   };
+
+   blob_1: blob-ext@1 {
+   filename = "lpddr4_pmu_train_1d_imem.bin";
+   size = <0x8000>;
+   };
+
+   blob_2: blob-ext@2 {
+   filename = "lpddr4_pmu_train_1d_dmem.bin";
+   size = <0x4000>;
+   };
+
+   blob_3: blob-ext@3 {
+   filename = "lpddr4_pmu_train_2d_imem.bin";
+   size = <0x8000>;
+   };
+
+   blob_4: blob-ext@4 {
+   filename = "lpddr4_pmu_train_2d_dmem.bin";
+   size = <0x4000>;
+   };
+   };
+
+   spl {
+   filename = "spl.bin";
+
+   mkimage {
+   args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
+
+   blob {
+   filename = "u-boot-spl-ddr.bin";
+   };
+   };
+   };
+
+   itb {
+   filename = "u-boot.itb";
+
+   fit {
+   description = "Configuration to load ATF before U-Boot";
+   #address-cells = <1>;
+   fit,external-offset = ;
+
+   images {
+   uboot {
+   description = "U-Boot (64-bit)";
+   type = "standalone";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+
+   uboot_blob: blob-ext {
+   filename = "u-boot-nodtb.bin";
+   };
+   };
+
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   load = <0x92>;
+   entry = <0x92>;
+
+   atf_blob: blob-ext {
+   filename = "bl31.bin";
+   };
+   };
+
+   fdt {
+   description = "NAME";
+   type = "flat_dt";
+   compression = "none";
+
+   uboot_fdt_blob: blob-ext {
+   filename = "u-boot.dtb";
+   };
+   };
+   };
+
+   configurations {
+   default = "conf";
+
+   

[PATCH v5 09/10] verdin-imx8mm: use preboot for fdtfile evaluation

2021-10-07 Thread Marcel Ziswiler
From: Igor Opaniuk 

Enable and set preboot var with fdtfile evaluation.
It will be checked and run immediately before starting the
CONFIG_BOOTDELAY countdown and/or running the auto-boot command resp.
entering interactive mode.

This provides possibility to use different boot cmds in interactive mode
without manual setting fdtfile value, as it it's already evaluated
before entering interactive mode.

Signed-off-by: Igor Opaniuk 
Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 

---

(no changes since v2)

Changes in v2:
- New patch addressing dynamic fdtfile definition.

 configs/verdin-imx8mm_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index ced0d0acc37..ed14ff3b114 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -26,7 +26,8 @@ CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 # CONFIG_USE_BOOTCOMMAND is not set
-CONFIG_DEFAULT_FDT_FILE="fsl-imx8mm-verdin-dev.dtb"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdtfile imx8mm-verdin-${variant}-${fdt_board}.dtb"
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-- 
2.26.2



[PATCH v5 05/10] verdin-imx8mm: enable sleep_moci output

2021-10-07 Thread Marcel Ziswiler
From: Max Krummenacher 

This powers some peripherals on the carrier board e.g. the USB hub.

Related-to: ELB-3206
Signed-off-by: Max Krummenacher 
Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 
---

(no changes since v1)

 arch/arm/dts/imx8mm-verdin.dts  | 18 ++
 configs/verdin-imx8mm_defconfig |  1 +
 2 files changed, 19 insertions(+)

diff --git a/arch/arm/dts/imx8mm-verdin.dts b/arch/arm/dts/imx8mm-verdin.dts
index ac2a4b69d3c..a2331627d72 100644
--- a/arch/arm/dts/imx8mm-verdin.dts
+++ b/arch/arm/dts/imx8mm-verdin.dts
@@ -196,6 +196,18 @@
};
 };
 
+ {
+   ctrl_sleep_moci {
+   gpio-hog;
+   /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
+   gpios = <1 GPIO_ACTIVE_HIGH>;
+   line-name = "CTRL_SLEEP_MOCI#";
+   output-high;
+   pinctrl-names = "default";
+   pinctrl-0 = <_ctrl_sleep_moci>;
+   };
+};
+
 /* On-module I2C */
  {
clock-frequency = <40>;
@@ -548,6 +560,12 @@
>;
};
 
+   pinctrl_ctrl_sleep_moci: ctrlsleepmocigrp {
+   fsl,pins = <
+   MX8MM_IOMUXC_SAI3_TXD_GPIO5_IO1 0x1c4   
/* SODIMM 256 */
+   >;
+   };
+
pinctrl_dsi_bkl_en: dsi_bkl_en {
fsl,pins = <
MX8MM_IOMUXC_NAND_CE2_B_GPIO3_IO3   0x1c4   
/* SODIMM 21 */
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index 1c8b505656a..ced0d0acc37 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -69,6 +69,7 @@ CONFIG_SPL_CLK_COMPOSITE_CCF=y
 CONFIG_CLK_COMPOSITE_CCF=y
 CONFIG_SPL_CLK_IMX8MM=y
 CONFIG_CLK_IMX8MM=y
+CONFIG_GPIO_HOG=y
 CONFIG_MXC_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_MISC=y
-- 
2.26.2



[PATCH v5 07/10] verdin-imx8mm: drop support for v1.0 hardware

2021-10-07 Thread Marcel Ziswiler
From: Max Krummenacher 

We drop support for Verdin iMX8M Mini V1.0B.

Related-to: ELB-3551
Signed-off-by: Max Krummenacher 
Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 

---

Changes in v5:
- Re-based on top of u-boot-imx, master yet again.

Changes in v4:
- Re-based.

Changes in v3:
- Add Fabio's reviewed-by tag.

Changes in v2:
- Drop first patch ("imx: mkimage_fit_atf: fix legacy image generation")
  as a similar fix was already refused earlier.

 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 71ceb26e811..c51c99b5156 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,17 +88,13 @@ static void select_dt_from_module_version(void)
 
switch (get_pcb_revision()) {
case PCB_VERSION_1_0:
-   printf("Detected a V1.0 module\n");
-   if (is_wifi)
-   strncpy([0], "wifi", sizeof(variant));
-   else
-   strncpy([0], "nonwifi", sizeof(variant));
-   break;
+   printf("Detected a V1.0 module which is no longer supported in 
this BSP version\n");
+   hang();
default:
if (is_wifi)
-   strncpy([0], "wifi-v1.1", sizeof(variant));
+   strlcpy([0], "wifi", sizeof(variant));
else
-   strncpy([0], "nonwifi-v1.1", sizeof(variant));
+   strlcpy([0], "nonwifi", sizeof(variant));
break;
}
 
-- 
2.26.2



[PATCH v5 01/10] imx8m: clean-up kconfig indentation

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Replace spurious spaces with proper tabs.

Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 
---

(no changes since v1)

 arch/arm/mach-imx/imx8m/Kconfig | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index d6b9571b373..60a29cddda1 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -25,14 +25,14 @@ config SYS_SOC
default "imx8m"
 
 choice
-   prompt  "NXP i.MX8M board select"
+   prompt "NXP i.MX8M board select"
optional
 
 config TARGET_IMX8MQ_CM
-bool "Ronetix iMX8MQ-CM SoM"
+   bool "Ronetix iMX8MQ-CM SoM"
select BINMAN
-select IMX8MQ
-select IMX8M_LPDDR4
+   select IMX8MQ
+   select IMX8M_LPDDR4
 
 config TARGET_IMX8MQ_EVK
bool "imx8mq_evk"
@@ -105,10 +105,10 @@ config TARGET_PICO_IMX8MQ
select IMX8M_LPDDR4
 
 config TARGET_VERDIN_IMX8MM
-   bool "Support Toradex Verdin iMX8M Mini module"
-   select IMX8MM
-   select SUPPORT_SPL
-   select IMX8M_LPDDR4
+   bool "Support Toradex Verdin iMX8M Mini module"
+   select IMX8MM
+   select SUPPORT_SPL
+   select IMX8M_LPDDR4
 
 config TARGET_IMX8MM_BEACON
bool "imx8mm Beacon Embedded devkit"
@@ -125,14 +125,14 @@ config TARGET_IMX8MN_BEACON
 config TARGET_PHYCORE_IMX8MM
bool "PHYTEC PHYCORE i.MX8MM"
select IMX8MM
-select SUPPORT_SPL
+   select SUPPORT_SPL
select IMX8M_LPDDR4
 
 config TARGET_PHYCORE_IMX8MP
bool "PHYTEC PHYCORE i.MX8MP"
select BINMAN
select IMX8MP
-select SUPPORT_SPL
+   select SUPPORT_SPL
select IMX8M_LPDDR4
 
 config TARGET_IMX8MM_CL_IOT_GATE
-- 
2.26.2



[PATCH v5 06/10] verdin-imx8mm: clean-up include order

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Alphabetically order includes.
While at it also update copyright year resp. period.

Signed-off-by: Marcel Ziswiler 
---

(no changes since v3)

Changes in v3:
- New patch cleaning up include order.

 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 1644f4b3081..71ceb26e811 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2020 Toradex
+ * Copyright 2020-2021 Toradex
  */
 
 #include 
@@ -10,9 +10,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 #include "../common/tdx-cfg-block.h"
 
-- 
2.26.2



[PATCH v5 03/10] ARM: dts: imx8mm-verdin: prepare for dek blob encapsulation

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Prepare for DEK blob encapsulation support through "dek_blob" command.
On ARMv8, u-boot runs in non-secure, thus cannot encapsulate a DEK blob
for encrypted boot.
The DEK blob is encapsulated by OP-TEE through a trusted application
call. U-boot sends and receives the DEK and the DEK blob binaries
through OP-TEE dynamic shared memory.

To enable the DEK blob encapsulation, add to the defconfig:
CONFIG_SECURE_BOOT=y
CONFIG_FAT_WRITE=y
CONFIG_CMD_DEKBLOB=y

Taken from NXP's commit 56d2050f4028 ("imx8m: Add DEK blob encapsulation
for imx8m").

Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 
---

(no changes since v1)

 arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
index 67c31c49b6c..a97626fa0c1 100644
--- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
@@ -6,6 +6,13 @@
 #include "imx8mm-u-boot.dtsi"
 
 / {
+   firmware {
+   optee {
+   compatible = "linaro,optee-tz";
+   method = "smc";
+   };
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
wdt = <>;
-- 
2.26.2



[PATCH v5 02/10] verdin-imx8mm: fix ethernet

2021-10-07 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Turns out Microship (formerly Micrel) meanwhile integrated proper
support for the DLL setup on their KSZ9131. Unfortunately, this
conflicts with our previous board code doing that.
Fix this by getting rid of our board code and just relying on the
generic implementation relying on rgmii-id being used as phy-mode.

Fixes: commit c6df0e2ffdc4
   ("net: phy: micrel: add support for DLL setup on ksz9131")
Fixes: commit af2d3c91d877
   ("ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID")
Signed-off-by: Marcel Ziswiler 
Reviewed-by: Fabio Estevam 

---

Changes in v5:
- Drop device tree part already done by Marek's patch.
- Add another fixes tag as his patch forgot the board code part.

 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 64 -
 1 file changed, 64 deletions(-)

diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 76f4a1e209a..1644f4b3081 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -36,70 +36,6 @@ static int setup_fec(void)
 
return 0;
 }
-
-int board_phy_config(struct phy_device *phydev)
-{
-   int tmp;
-
-   switch (ksz9xx1_phy_get_id(phydev) & MII_KSZ9x31_SILICON_REV_MASK) {
-   case PHY_ID_KSZ9031:
-   /*
-* The PHY adds 1.2ns for the RXC and 0ns for TXC clock by
-* default. The MAC and the layout don't add a skew between
-* clock and data.
-* Add 0.3ns for the RXC path and 0.96 + 0.42 ns (1.38 ns) for
-* the TXC path to get the required clock skews.
-*/
-   /* control data pad skew - devaddr = 0x02, register = 0x04 */
-   ksz9031_phy_extended_write(phydev, 0x02,
-  MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
-  MII_KSZ9031_MOD_DATA_NO_POST_INC,
-  0x0070);
-   /* rx data pad skew - devaddr = 0x02, register = 0x05 */
-   ksz9031_phy_extended_write(phydev, 0x02,
-  MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
-  MII_KSZ9031_MOD_DATA_NO_POST_INC,
-  0x);
-   /* tx data pad skew - devaddr = 0x02, register = 0x06 */
-   ksz9031_phy_extended_write(phydev, 0x02,
-  MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
-  MII_KSZ9031_MOD_DATA_NO_POST_INC,
-  0x);
-   /* gtx and rx clock pad skew - devaddr = 0x02,register = 0x08 */
-   ksz9031_phy_extended_write(phydev, 0x02,
-  MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
-  MII_KSZ9031_MOD_DATA_NO_POST_INC,
-  0x03f4);
-   break;
-   case PHY_ID_KSZ9131:
-   default:
-   /* read rxc dll control - devaddr = 0x2, register = 0x4c */
-   tmp = ksz9031_phy_extended_read(phydev, 0x02,
-   MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
-   MII_KSZ9031_MOD_DATA_NO_POST_INC);
-   /* disable rxdll bypass (enable 2ns skew delay on RXC) */
-   tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
-   /* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4c */
-   tmp = ksz9031_phy_extended_write(phydev, 0x02,
-   MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
-   MII_KSZ9031_MOD_DATA_NO_POST_INC, tmp);
-   /* read txc dll control - devaddr = 0x02, register = 0x4d */
-   tmp = ksz9031_phy_extended_read(phydev, 0x02,
-   MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
-   MII_KSZ9031_MOD_DATA_NO_POST_INC);
-   /* disable txdll bypass (enable 2ns skew delay on TXC) */
-   tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
-   /* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4d */
-   tmp = ksz9031_phy_extended_write(phydev, 0x02,
-   MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
-   MII_KSZ9031_MOD_DATA_NO_POST_INC, tmp);
-   break;
-   }
-
-   if (phydev->drv->config)
-   phydev->drv->config(phydev);
-   return 0;
-}
 #endif
 
 int board_init(void)
-- 
2.26.2



Re: [PATCH] ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID

2021-10-07 Thread Marek Vasut

On 10/8/21 2:13 AM, Marcel Ziswiler wrote:

On Thu, 2021-10-07 at 23:56 +, Marcel Ziswiler wrote:

On Thu, 2021-10-07 at 16:12 +0200, sba...@denx.de wrote:

Since c6df0e2ffdc ("net: phy: micrel: add support for DLL setup on ksz9131")
the Micrel PHY driver correctly configures the delay register. The Verdin PHY
is RGMII-ID, so reflect that in DT, otherwise the ethernet no longer works.
Signed-off-by: Marek Vasut 
Cc: Marcel Ziswiler 
Cc: Max Krummenacher 
Cc: Oleksandr Suvorov 

Applied to u-boot-imx, master, thanks !


No, remember, you should not have picked that one but rather my patch series 
instead!


Okay, let me send a v5 of my patch series re-based on top of this now with 
another fixes tag (;-p).


Ah sigh, thanks.


Re: [PATCH] ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID

2021-10-07 Thread Marcel Ziswiler
On Thu, 2021-10-07 at 23:56 +, Marcel Ziswiler wrote:
> On Thu, 2021-10-07 at 16:12 +0200, sba...@denx.de wrote:
> > > Since c6df0e2ffdc ("net: phy: micrel: add support for DLL setup on 
> > > ksz9131")
> > > the Micrel PHY driver correctly configures the delay register. The Verdin 
> > > PHY
> > > is RGMII-ID, so reflect that in DT, otherwise the ethernet no longer 
> > > works.
> > > Signed-off-by: Marek Vasut 
> > > Cc: Marcel Ziswiler 
> > > Cc: Max Krummenacher 
> > > Cc: Oleksandr Suvorov 
> > Applied to u-boot-imx, master, thanks !
> 
> No, remember, you should not have picked that one but rather my patch series 
> instead!

Okay, let me send a v5 of my patch series re-based on top of this now with 
another fixes tag (;-p).

> > Best regards,
> > Stefano Babic


Re: [PATCH] ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID

2021-10-07 Thread Marcel Ziswiler
On Thu, 2021-10-07 at 16:12 +0200, sba...@denx.de wrote:
> > Since c6df0e2ffdc ("net: phy: micrel: add support for DLL setup on ksz9131")
> > the Micrel PHY driver correctly configures the delay register. The Verdin 
> > PHY
> > is RGMII-ID, so reflect that in DT, otherwise the ethernet no longer works.
> > Signed-off-by: Marek Vasut 
> > Cc: Marcel Ziswiler 
> > Cc: Max Krummenacher 
> > Cc: Oleksandr Suvorov 
> Applied to u-boot-imx, master, thanks !

No, remember, you should not have picked that one but rather my patch series 
instead!

> Best regards,
> Stefano Babic


Re: [PATCH v4 04/10] verdin-imx8mm: switch to use binman to pack images

2021-10-07 Thread Marcel Ziswiler
Hi Simon

On Wed, 2021-10-06 at 20:18 -0600, Simon Glass wrote:
> ...
> Nice clean-up!

Thanks!

> Reviewed-by: Simon Glass 
> 
> Option below.
> 
> > 
> > diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi 
> > b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
> > index a97626fa0c1..0c65070cd5f 100644
> > --- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
> > +++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
> > @@ -1,11 +1,15 @@
> >  // SPDX-License-Identifier: GPL-2.0+ OR MIT
> >  /*
> > - * Copyright 2020 Toradex
> > + * Copyright 2020-2021 Toradex
> >   */
> > 
> >  #include "imx8mm-u-boot.dtsi"
> > 
> >  / {
> > +   binman: binman {
> > +   multiple-images;
> > +   };
> > +
> >     firmware {
> >     optee {
> >     compatible = "linaro,optee-tz";
> > @@ -91,3 +95,121 @@
> >   {
> >     u-boot,dm-spl;
> >  };
> > +
> > + {
> > +    u-boot-spl-ddr {
> > +   filename = "u-boot-spl-ddr.bin";
> > +   pad-byte = <0xff>;
> > +   align-size = <4>;
> > +   align = <4>;
> > +
> > +   u-boot-spl {
> > +   align-end = <4>;
> > +   };
> > +
> > +   blob_1: blob-ext@1 {
> > +   filename = "lpddr4_pmu_train_1d_imem.bin";
> > +   size = <0x8000>;
> > +   };
> 
> You can use the 'type' if you like, so you don't need the @:
> 
> blob_1: 1d-imem {
>     type = "blob-ext";
>     filename = "...";
>     ...

Yeah, remember, we agreed on doing such further clean-up in a separate step 
once we migrated towards using a
common binman configuration [1]. I am about to send out a v2 thereof.

[1] https://marc.info/?l=u-boot=162998010613817

> Regards,
> Simon

Cheers

Marcel


Re: imx6 DM_VIDEObroken

2021-10-07 Thread Anatolij Gustschin
On Thu, 7 Oct 2021 12:50:04 -0700
Tim Harvey thar...@gateworks.com wrote:
...
> > then vidconsole should be enabled.  
> 
> Anatolij,
> 
> That is my configuration yet vidconsole does not enable until I
> 'setenv stdout serial,vidconsole':
> Ventana > print stdout
> stdout=serial,vidconsole
> ^^^ see splash, yet no vidconsole
> Ventana > setenv stdout serial,vidconsole
> ^^^ now I see vidconsole

Tim,

something in your board config or code must be different, then.
Do you use HDMI or LVDS display?

> Do you perhaps have another board to check this behavior with on master?

I've tested with current master and a modified wandboard configuration:

U-Boot SPL 2021.10-00525-g7a508a7245-dirty (Oct 07 2021 - 23:32:09 +0200)
Trying to boot from MMC1


U-Boot 2021.10-00525-g7a508a7245-dirty (Oct 07 2021 - 23:32:09 +0200)

CPU:   Freescale i.MX6SOLO rev1.1 at 792 MHz
Reset cause: WDOG
DRAM:  512 MiB
MMC:   FSL_SDHC: 4, FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... OK
auto-detected panel HDMI
Display: HDMI (1024x768)
In:serial
Out:   vidconsole
Err:   vidconsole
Board: Wandboard rev B1
Net:   eth0: ethernet@2188000
Hit any key to stop autoboot:  0 
=> print stdout 
stdout=serial,vidconsole

HDMI monitor displays logo and video console text output starting with:
Board: Wandboard rev B1
Net:   eth0: ethernet@2188000
Hit any key to stop autoboot:  0 

It works on wandboard.

The wandboard_defconfig in master has CONFIG_CONSOLE_MUX disabled
and CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE enabled. Therefore I enabled
CONFIG_CONSOLE_MUX and disabled CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
via menuconfig for this test.
And additionally I used below patch to enable building this configuration:

diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index da995dd0f5..73e1a0701f 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -391,11 +391,11 @@ int power_init_board(void)
 /*
  * Do not overwrite the console
  * Use always serial for U-Boot console
- */
 int overwrite_console(void)
 {
return 1;
 }
+ */
 
 #ifdef CONFIG_CMD_BMODE
 static const struct boot_mode board_boot_modes[] = {


--
Anatolij


Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Alex G.




On 10/7/21 4:04 PM, Tom Rini wrote:

On Thu, Oct 07, 2021 at 03:33:32PM -0500, Alex G. wrote:



On 10/7/21 2:39 PM, Tom Rini wrote:

On Thu, Oct 07, 2021 at 02:32:42PM -0500, Alex G. wrote:



On 10/7/21 1:50 PM, Simon Glass wrote:

Hi Tom,

On Thu, 7 Oct 2021 at 12:30, Tom Rini  wrote:


On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:

Hi Tom,

On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:


On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:

Hi Tom,

On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:


On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:

Hi Tom,

On Wed, 6 Oct 2021 at 18:26, Tom Rini  wrote:


On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:


At present we must separately test for the host build for many options,
since we force them to be enabled. For example, CONFIG_FIT is always
enabled in the host tools, even if CONFIG_FIT is not enabled by the
board itself.

It would be more convenient if we could use, for example,
CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the
host. Add support for this.

With this and the tools_build() function, we should be able to remove all
the #ifdefs currently needed in code that is build by tools and targets.

This will be even nicer when we move to using CONFIG(xxx) everywhere,
since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away.

Signed-off-by: Simon Glass 
Suggested-by: Rasmus Villemoes  # b4f73886
Reviewed-by: Alexandru Gagniuc 


The problem here is we don't include  automatically
when building host stuff, I believe.  This is why doing this breaks
test_mkimage_hashes for me on am335x_evm with:
/tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
/tmp/.bm-work/am335x_evm -f 
/home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its 
/tmp/.bm-work/am335x_evm/test.fit
*** stack smashing detected ***:  terminated


Oh dear, and no CI coverage.

I was reluctant to include kconfig.h everywhere but perhaps that is
the best approach. Will take a look ASAP.


Maybe we need to think a bit harder too about how we structure
intentionally shared code.

Why not, for example, for these common algorithms, rely on typical
system headers/libraries in the tooling, which means we validated U-Boot
vs common reference, rather than just our implementations?


Do you mean we use openssl for sha1, for example?


I guess, yes.  Just flat out saying we require openssl for tools, and
doing our best to not make compatibility with libressl difficult, seems
likely to cause less headaches for people than what we already require
in terms of Python.


I'm OK with that, although I do think the problem identified here
(CONFIG_SHA256 not enabled) is somewhat sideways from that. We already


OK, I've taken what you posted on IRC and folded that in, continuing
tests now.


use separate code paths to run hashing. Perhaps we could make it
optional?

What about those people that complain about crypto libraries on their systems?


I'm not sure how big a problem that really is, currently.  I guess one
thing would be to make a separate thread on it, and put it in the next
-rc email as well, for people to explain why it would be a hardship.
That in turn, I think, is coming down to modern vs very old openssl
support, rather than having any at all.


OK I'll take a look at some point.

Or perhaps Alex might like to?


We just got a complain about OpenSSL yesterday [1]

Alex

[1] https://lists.denx.de/pipermail/u-boot/2021-October/462728.html


Oh goodness, LibreELC is a custom build system... I'll have to chime in
there, thanks.


I am in favor of keeping libcrapto separate. We still need our own code for
CRC32 and other weak or non-crypto hashes, a tidbit which makes me doubt the
wisdom of relying entirely on an external lib.

I had to make a similar decision when writing the hashes test. Originally, I
was going to use pyCrypto, crcelk, to re-hash everything and compare to
mkimage. It turned out to be neither necessarry nor efficient.


Is there perhaps a happy medium?  Or do we just need to think harder on
how to make the code U-Boot needs shared between target and host tools
clean and clear and obvious enough?


I think hard that's an honorable goal irrespective of the status of 
libcrypto. libcrypto isolation is a happy side-effect.


Alex


using device-tree fragments/overlays

2021-10-07 Thread Tim Harvey
Greetings,

I'm working on some features for the imx8mm-venice boards I support
which depend on making small changes to the dt before booting Linux.

The purpose is not to have any of this apply to the U-Boot controlling
dt but instead to the Linux kernel dt applied within ft_board_setup. I
could apply these changes with code but it would be way more readable
if there was a way to store these as fragments in the FIT image and
apply them.

The fragments would be small and have to do with two UART's routed to
a multi-protocol RS232/RS485 transceiver that can be used as either of
the following:
 - two tx/rx UART's (the default configuration for my dt's)
 - one rs232 uart with CTS/RTS flow control
 - one rs485 uart

Here would be an example dt overlay to apply over the default
arch/arm/dts/imx8mm-venice-gw73xx-0x.dts to change it from 2x RS232
UARTS with TX/RX (uart2/uart4) to RS485 half duplex:

/* For RS485 HD:
 *  - UART4_TX is DE for RS485 transmitter
 *  - RS485_EN needs to be pulled high
 *  - RS485_HALF needs to be pulled high
 *  - RS485_TERM enables on-chip termination
 */
 {
rts-gpios = < 29 GPIO_ACTIVE_HIGH>;
rs485-term-gpios = < 0 GPIO_ACTIVE_HIGH>;
};

 {
status = "disabled";
};

 {
pinctrl-names = "default";
pinctrl-0 = <_hog>;

pinctrl_hog: hoggrp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0
0x4104 /* RS485_TERM */
MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0
0x4144 /* RS485_EN */
MX8MM_IOMUXC_SAI1_RXD0_GPIO4_IO2
0x4144 /* RS485_HALF */
>;
};

pinctrl_uart2: uart2grp {
fsl,pins = <
MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX 0x140
MX8MM_IOMUXC_UART2_TXD_UART2_DCE_TX 0x140
MX8MM_IOMUXC_UART4_TXD_GPIO5_IO29   0x140
>;
};
};

Anyone do anything like this before or work with dt fragments/overlays
in U-Boot or have any other suggestions?

Best regards,

Tim


Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Tom Rini
On Thu, Oct 07, 2021 at 03:33:32PM -0500, Alex G. wrote:
> 
> 
> On 10/7/21 2:39 PM, Tom Rini wrote:
> > On Thu, Oct 07, 2021 at 02:32:42PM -0500, Alex G. wrote:
> > > 
> > > 
> > > On 10/7/21 1:50 PM, Simon Glass wrote:
> > > > Hi Tom,
> > > > 
> > > > On Thu, 7 Oct 2021 at 12:30, Tom Rini  wrote:
> > > > > 
> > > > > On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:
> > > > > > Hi Tom,
> > > > > > 
> > > > > > On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:
> > > > > > > 
> > > > > > > On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:
> > > > > > > > Hi Tom,
> > > > > > > > 
> > > > > > > > On Wed, 6 Oct 2021 at 20:52, Tom Rini  
> > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:
> > > > > > > > > > Hi Tom,
> > > > > > > > > > 
> > > > > > > > > > On Wed, 6 Oct 2021 at 18:26, Tom Rini  
> > > > > > > > > > wrote:
> > > > > > > > > > > 
> > > > > > > > > > > On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass 
> > > > > > > > > > > wrote:
> > > > > > > > > > > 
> > > > > > > > > > > > At present we must separately test for the host build 
> > > > > > > > > > > > for many options,
> > > > > > > > > > > > since we force them to be enabled. For example, 
> > > > > > > > > > > > CONFIG_FIT is always
> > > > > > > > > > > > enabled in the host tools, even if CONFIG_FIT is not 
> > > > > > > > > > > > enabled by the
> > > > > > > > > > > > board itself.
> > > > > > > > > > > > 
> > > > > > > > > > > > It would be more convenient if we could use, for 
> > > > > > > > > > > > example,
> > > > > > > > > > > > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when 
> > > > > > > > > > > > building for the
> > > > > > > > > > > > host. Add support for this.
> > > > > > > > > > > > 
> > > > > > > > > > > > With this and the tools_build() function, we should be 
> > > > > > > > > > > > able to remove all
> > > > > > > > > > > > the #ifdefs currently needed in code that is build by 
> > > > > > > > > > > > tools and targets.
> > > > > > > > > > > > 
> > > > > > > > > > > > This will be even nicer when we move to using 
> > > > > > > > > > > > CONFIG(xxx) everywhere,
> > > > > > > > > > > > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED 
> > > > > > > > > > > > stuff will go away.
> > > > > > > > > > > > 
> > > > > > > > > > > > Signed-off-by: Simon Glass 
> > > > > > > > > > > > Suggested-by: Rasmus Villemoes 
> > > > > > > > > > > >  # b4f73886
> > > > > > > > > > > > Reviewed-by: Alexandru Gagniuc 
> > > > > > > > > > > 
> > > > > > > > > > > The problem here is we don't include  
> > > > > > > > > > > automatically
> > > > > > > > > > > when building host stuff, I believe.  This is why doing 
> > > > > > > > > > > this breaks
> > > > > > > > > > > test_mkimage_hashes for me on am335x_evm with:
> > > > > > > > > > > /tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb 
> > > > > > > > > > > -i /tmp/.bm-work/am335x_evm -f 
> > > > > > > > > > > /home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its
> > > > > > > > > > >  /tmp/.bm-work/am335x_evm/test.fit
> > > > > > > > > > > *** stack smashing detected ***:  terminated
> > > > > > > > > > 
> > > > > > > > > > Oh dear, and no CI coverage.
> > > > > > > > > > 
> > > > > > > > > > I was reluctant to include kconfig.h everywhere but perhaps 
> > > > > > > > > > that is
> > > > > > > > > > the best approach. Will take a look ASAP.
> > > > > > > > > 
> > > > > > > > > Maybe we need to think a bit harder too about how we structure
> > > > > > > > > intentionally shared code.
> > > > > > > > > 
> > > > > > > > > Why not, for example, for these common algorithms, rely on 
> > > > > > > > > typical
> > > > > > > > > system headers/libraries in the tooling, which means we 
> > > > > > > > > validated U-Boot
> > > > > > > > > vs common reference, rather than just our implementations?
> > > > > > > > 
> > > > > > > > Do you mean we use openssl for sha1, for example?
> > > > > > > 
> > > > > > > I guess, yes.  Just flat out saying we require openssl for tools, 
> > > > > > > and
> > > > > > > doing our best to not make compatibility with libressl difficult, 
> > > > > > > seems
> > > > > > > likely to cause less headaches for people than what we already 
> > > > > > > require
> > > > > > > in terms of Python.
> > > > > > 
> > > > > > I'm OK with that, although I do think the problem identified here
> > > > > > (CONFIG_SHA256 not enabled) is somewhat sideways from that. We 
> > > > > > already
> > > > > 
> > > > > OK, I've taken what you posted on IRC and folded that in, continuing
> > > > > tests now.
> > > > > 
> > > > > > use separate code paths to run hashing. Perhaps we could make it
> > > > > > optional?
> > > > > > 
> > > > > > What about those people that complain about crypto libraries on 
> > > > > > their systems?
> > > > > 
> > > > > I'm not sure how big a problem that really is, currently.  I guess one
> > > > > thing would be to make a separate thread on 

Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Alex G.




On 10/7/21 2:39 PM, Tom Rini wrote:

On Thu, Oct 07, 2021 at 02:32:42PM -0500, Alex G. wrote:



On 10/7/21 1:50 PM, Simon Glass wrote:

Hi Tom,

On Thu, 7 Oct 2021 at 12:30, Tom Rini  wrote:


On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:

Hi Tom,

On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:


On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:

Hi Tom,

On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:


On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:

Hi Tom,

On Wed, 6 Oct 2021 at 18:26, Tom Rini  wrote:


On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:


At present we must separately test for the host build for many options,
since we force them to be enabled. For example, CONFIG_FIT is always
enabled in the host tools, even if CONFIG_FIT is not enabled by the
board itself.

It would be more convenient if we could use, for example,
CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the
host. Add support for this.

With this and the tools_build() function, we should be able to remove all
the #ifdefs currently needed in code that is build by tools and targets.

This will be even nicer when we move to using CONFIG(xxx) everywhere,
since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away.

Signed-off-by: Simon Glass 
Suggested-by: Rasmus Villemoes  # b4f73886
Reviewed-by: Alexandru Gagniuc 


The problem here is we don't include  automatically
when building host stuff, I believe.  This is why doing this breaks
test_mkimage_hashes for me on am335x_evm with:
/tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
/tmp/.bm-work/am335x_evm -f 
/home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its 
/tmp/.bm-work/am335x_evm/test.fit
*** stack smashing detected ***:  terminated


Oh dear, and no CI coverage.

I was reluctant to include kconfig.h everywhere but perhaps that is
the best approach. Will take a look ASAP.


Maybe we need to think a bit harder too about how we structure
intentionally shared code.

Why not, for example, for these common algorithms, rely on typical
system headers/libraries in the tooling, which means we validated U-Boot
vs common reference, rather than just our implementations?


Do you mean we use openssl for sha1, for example?


I guess, yes.  Just flat out saying we require openssl for tools, and
doing our best to not make compatibility with libressl difficult, seems
likely to cause less headaches for people than what we already require
in terms of Python.


I'm OK with that, although I do think the problem identified here
(CONFIG_SHA256 not enabled) is somewhat sideways from that. We already


OK, I've taken what you posted on IRC and folded that in, continuing
tests now.


use separate code paths to run hashing. Perhaps we could make it
optional?

What about those people that complain about crypto libraries on their systems?


I'm not sure how big a problem that really is, currently.  I guess one
thing would be to make a separate thread on it, and put it in the next
-rc email as well, for people to explain why it would be a hardship.
That in turn, I think, is coming down to modern vs very old openssl
support, rather than having any at all.


OK I'll take a look at some point.

Or perhaps Alex might like to?


We just got a complain about OpenSSL yesterday [1]

Alex

[1] https://lists.denx.de/pipermail/u-boot/2021-October/462728.html


Oh goodness, LibreELC is a custom build system... I'll have to chime in
there, thanks.


I am in favor of keeping libcrapto separate. We still need our own code 
for CRC32 and other weak or non-crypto hashes, a tidbit which makes me 
doubt the wisdom of relying entirely on an external lib.


I had to make a similar decision when writing the hashes test. 
Originally, I was going to use pyCrypto, crcelk, to re-hash everything 
and compare to mkimage. It turned out to be neither necessarry nor 
efficient.


Alex


Re: imx6 DM_VIDEObroken

2021-10-07 Thread Tim Harvey
On Mon, Oct 4, 2021 at 6:48 AM Anatolij Gustschin  wrote:
>
> On Wed, 29 Sep 2021 09:33:18 -0700
> Tim Harvey thar...@gateworks.com wrote:
> ...
> > One last question on this. I have never used U-Boot vidconsole before.
> > It does work if I 'setenv stdout serial,videconsole' but if I saveenv
> > and reboot vidconsole is not enabled. Should I expect it to be or is
> > it expected that if you want vidconsole you need to do a setenv in
> > preboot?
>
> if you have
> CONFIG_CONSOLE_MUX=y
> CONFIG_SYS_CONSOLE_IS_IN_ENV=y
>
> and
> # CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE is not set
>
> then vidconsole should be enabled.

Anatolij,

That is my configuration yet vidconsole does not enable until I
'setenv stdout serial,vidconsole':
Ventana > print stdout
stdout=serial,vidconsole
^^^ see splash, yet no vidconsole
Ventana > setenv stdout serial,vidconsole
^^^ now I see vidconsole

Do you perhaps have another board to check this behavior with on master?

Best regards,

Tim


Re: Broken build with disabling OpenSSL crypto

2021-10-07 Thread Tom Rini
On Wed, Oct 06, 2021 at 11:27:43PM +0200, Jernej Škrabec wrote:

> Hi everyone!
> 
> Commit cb9faa6f98ae ("tools: Use a single target-independent config to enable 
> OpenSSL") recently introduced option to disable usage of OpenSSL via 
> CONFIG_TOOLS_LIBCRYPTO. However, just a bit later, another commit 
> b4f3cc2c42d9 
> ("tools: kwbimage: Do not hide usage of secure header under 
> CONFIG_ARMADA_38X") made U-Boot tools hard dependent on OpenSSL. That totally 
> defeats the purpose of first commit. I suggest that it gets reverted.
> 
> I would like disable OpenSSL for my usage, since it gives me troubles when 
> cross-compiling U-Boot inside LibreELEC build system. It's not needed for our 
> case anyway.

How hard is it to specify openssl as a dependency for U-Boot, in the
LibreELEC build system?  I assume openssl is being used in other parts
of the build anyhow.  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Tom Rini
On Thu, Oct 07, 2021 at 02:32:42PM -0500, Alex G. wrote:
> 
> 
> On 10/7/21 1:50 PM, Simon Glass wrote:
> > Hi Tom,
> > 
> > On Thu, 7 Oct 2021 at 12:30, Tom Rini  wrote:
> > > 
> > > On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:
> > > > Hi Tom,
> > > > 
> > > > On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:
> > > > > 
> > > > > On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:
> > > > > > Hi Tom,
> > > > > > 
> > > > > > On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:
> > > > > > > 
> > > > > > > On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:
> > > > > > > > Hi Tom,
> > > > > > > > 
> > > > > > > > On Wed, 6 Oct 2021 at 18:26, Tom Rini  
> > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:
> > > > > > > > > 
> > > > > > > > > > At present we must separately test for the host build for 
> > > > > > > > > > many options,
> > > > > > > > > > since we force them to be enabled. For example, CONFIG_FIT 
> > > > > > > > > > is always
> > > > > > > > > > enabled in the host tools, even if CONFIG_FIT is not 
> > > > > > > > > > enabled by the
> > > > > > > > > > board itself.
> > > > > > > > > > 
> > > > > > > > > > It would be more convenient if we could use, for example,
> > > > > > > > > > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when 
> > > > > > > > > > building for the
> > > > > > > > > > host. Add support for this.
> > > > > > > > > > 
> > > > > > > > > > With this and the tools_build() function, we should be able 
> > > > > > > > > > to remove all
> > > > > > > > > > the #ifdefs currently needed in code that is build by tools 
> > > > > > > > > > and targets.
> > > > > > > > > > 
> > > > > > > > > > This will be even nicer when we move to using CONFIG(xxx) 
> > > > > > > > > > everywhere,
> > > > > > > > > > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff 
> > > > > > > > > > will go away.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Simon Glass 
> > > > > > > > > > Suggested-by: Rasmus Villemoes  
> > > > > > > > > > # b4f73886
> > > > > > > > > > Reviewed-by: Alexandru Gagniuc 
> > > > > > > > > 
> > > > > > > > > The problem here is we don't include  
> > > > > > > > > automatically
> > > > > > > > > when building host stuff, I believe.  This is why doing this 
> > > > > > > > > breaks
> > > > > > > > > test_mkimage_hashes for me on am335x_evm with:
> > > > > > > > > /tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
> > > > > > > > > /tmp/.bm-work/am335x_evm -f 
> > > > > > > > > /home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its
> > > > > > > > >  /tmp/.bm-work/am335x_evm/test.fit
> > > > > > > > > *** stack smashing detected ***:  terminated
> > > > > > > > 
> > > > > > > > Oh dear, and no CI coverage.
> > > > > > > > 
> > > > > > > > I was reluctant to include kconfig.h everywhere but perhaps 
> > > > > > > > that is
> > > > > > > > the best approach. Will take a look ASAP.
> > > > > > > 
> > > > > > > Maybe we need to think a bit harder too about how we structure
> > > > > > > intentionally shared code.
> > > > > > > 
> > > > > > > Why not, for example, for these common algorithms, rely on typical
> > > > > > > system headers/libraries in the tooling, which means we validated 
> > > > > > > U-Boot
> > > > > > > vs common reference, rather than just our implementations?
> > > > > > 
> > > > > > Do you mean we use openssl for sha1, for example?
> > > > > 
> > > > > I guess, yes.  Just flat out saying we require openssl for tools, and
> > > > > doing our best to not make compatibility with libressl difficult, 
> > > > > seems
> > > > > likely to cause less headaches for people than what we already require
> > > > > in terms of Python.
> > > > 
> > > > I'm OK with that, although I do think the problem identified here
> > > > (CONFIG_SHA256 not enabled) is somewhat sideways from that. We already
> > > 
> > > OK, I've taken what you posted on IRC and folded that in, continuing
> > > tests now.
> > > 
> > > > use separate code paths to run hashing. Perhaps we could make it
> > > > optional?
> > > > 
> > > > What about those people that complain about crypto libraries on their 
> > > > systems?
> > > 
> > > I'm not sure how big a problem that really is, currently.  I guess one
> > > thing would be to make a separate thread on it, and put it in the next
> > > -rc email as well, for people to explain why it would be a hardship.
> > > That in turn, I think, is coming down to modern vs very old openssl
> > > support, rather than having any at all.
> > 
> > OK I'll take a look at some point.
> > 
> > Or perhaps Alex might like to?
> 
> We just got a complain about OpenSSL yesterday [1]
> 
> Alex
> 
> [1] https://lists.denx.de/pipermail/u-boot/2021-October/462728.html

Oh goodness, LibreELC is a custom build system... I'll have to chime in
there, thanks.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Alex G.




On 10/7/21 1:50 PM, Simon Glass wrote:

Hi Tom,

On Thu, 7 Oct 2021 at 12:30, Tom Rini  wrote:


On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:

Hi Tom,

On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:


On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:

Hi Tom,

On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:


On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:

Hi Tom,

On Wed, 6 Oct 2021 at 18:26, Tom Rini  wrote:


On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:


At present we must separately test for the host build for many options,
since we force them to be enabled. For example, CONFIG_FIT is always
enabled in the host tools, even if CONFIG_FIT is not enabled by the
board itself.

It would be more convenient if we could use, for example,
CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the
host. Add support for this.

With this and the tools_build() function, we should be able to remove all
the #ifdefs currently needed in code that is build by tools and targets.

This will be even nicer when we move to using CONFIG(xxx) everywhere,
since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away.

Signed-off-by: Simon Glass 
Suggested-by: Rasmus Villemoes  # b4f73886
Reviewed-by: Alexandru Gagniuc 


The problem here is we don't include  automatically
when building host stuff, I believe.  This is why doing this breaks
test_mkimage_hashes for me on am335x_evm with:
/tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
/tmp/.bm-work/am335x_evm -f 
/home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its 
/tmp/.bm-work/am335x_evm/test.fit
*** stack smashing detected ***:  terminated


Oh dear, and no CI coverage.

I was reluctant to include kconfig.h everywhere but perhaps that is
the best approach. Will take a look ASAP.


Maybe we need to think a bit harder too about how we structure
intentionally shared code.

Why not, for example, for these common algorithms, rely on typical
system headers/libraries in the tooling, which means we validated U-Boot
vs common reference, rather than just our implementations?


Do you mean we use openssl for sha1, for example?


I guess, yes.  Just flat out saying we require openssl for tools, and
doing our best to not make compatibility with libressl difficult, seems
likely to cause less headaches for people than what we already require
in terms of Python.


I'm OK with that, although I do think the problem identified here
(CONFIG_SHA256 not enabled) is somewhat sideways from that. We already


OK, I've taken what you posted on IRC and folded that in, continuing
tests now.


use separate code paths to run hashing. Perhaps we could make it
optional?

What about those people that complain about crypto libraries on their systems?


I'm not sure how big a problem that really is, currently.  I guess one
thing would be to make a separate thread on it, and put it in the next
-rc email as well, for people to explain why it would be a hardship.
That in turn, I think, is coming down to modern vs very old openssl
support, rather than having any at all.


OK I'll take a look at some point.

Or perhaps Alex might like to?


We just got a complain about OpenSSL yesterday [1]

Alex

[1] https://lists.denx.de/pipermail/u-boot/2021-October/462728.html


Re: [Uboot-stm32] [PATCH v2 03/11] stm32mp1: Add support for falcon mode boot from SD card

2021-10-07 Thread Alex G.




On 10/4/21 9:57 AM, Patrick DELAUNAY wrote:

Hi,

=> if OPTEE is loaded after SPL the U-Boot configuration change (running 
in secure world or not)


I am starting to work on these issues in the branch

https://github.com/u-boot/u-boot/compare/master...patrickdelaunay:spl_optee_W2140 
https://github.com/u-boot/u-boot/commit/04ad553e9c6bee62781460d2952df4962e58ae14 
https://github.com/u-boot/u-boot/commit/aebb687a1557590bf070cf5d347854420ca1 


But it is still not working, OP-TEE is not correctly started


What do you mean by "OP-TEE is not correctly started". Here's the .its 
that I use for my FIT image. I hope this will be helpful.


/dts-v1/
;/ {
description = "U-Boot fitImage for stm32mp1";
#address-cells = <1>;
images {
optee-1 {
description = "OP-TEE secure world firmware";
data = /incbin/("firmware/tee.bin");
type = "tee";
arch = "arm";
os = "tee";
compression = "none";
load = <0xdde4>;
entry = <0xde00>;
hash-1 {
algo = "sha256";
};
};
kernel-1 {
description = "Linux kernel";
data = /incbin/("kernel/zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0xc240>;
entry = <0xc240>;
hash-1 {
algo = "sha256";
};
};
fdt-stm32mp157c-ev1.dtb {
description = "Flattened Device Tree blob";
data = /incbin/("kernel/stm32mp157c-ev1.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha256";
};
};
fdt-stm32mp157c-dk2.dtb {
description = "Flattened Device Tree blob";
data = /incbin/("kernel/stm32mp157c-dk2.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha256";
};
};
fdt-dk2-optee.dto {
description = "Flattened Device Tree blob";
data = /incbin/("firmware/dk2-optee.dto");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha256";
};
};
fdt-dk2-can1-enable.dto {
description = "Flattened Device Tree blob";
data = /incbin/("firmware/dk2-can1-enable.dto");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha256";
};
};
fdt-bootargs.dto {
description = "Flattened Device Tree blob";
data = /incbin/("firmware/bootargs.dto");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha256";
};
};
};
configurations {
default = "secure-stm32mp157c-ev1.dtb";
secure-stm32mp157c-ev1.dtb {
description = "Linux with OP-TEE for 
stm32mp157c-ev1.dtb";
kernel = "optee-1";
fdt = "fdt-stm32mp157c-ev1.dtb", "fdt-bootargs.dto";
loadables = "kernel-1";
hash-1 {
algo = "sha256";
};
};
secure-stm32mp157c-dk2.dtb {
description = "Linux with OP-TEE for 
stm32mp157c-dk2.dtb";
kernel = "optee-1";
			fdt = "fdt-stm32mp157c-dk2.dtb", "fdt-bootargs.dto", 
"fdt-dk2-can1-enable.dto", "fdt-dk2-optee.dto";

loadables = "kernel-1";
hash-1 {
algo = "sha256";
};
};
};
};



Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Simon Glass
Hi Tom,

On Thu, 7 Oct 2021 at 12:30, Tom Rini  wrote:
>
> On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:
> > Hi Tom,
> >
> > On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:
> > >
> > > On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:
> > > > Hi Tom,
> > > >
> > > > On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:
> > > > >
> > > > > On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:
> > > > > > Hi Tom,
> > > > > >
> > > > > > On Wed, 6 Oct 2021 at 18:26, Tom Rini  wrote:
> > > > > > >
> > > > > > > On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:
> > > > > > >
> > > > > > > > At present we must separately test for the host build for many 
> > > > > > > > options,
> > > > > > > > since we force them to be enabled. For example, CONFIG_FIT is 
> > > > > > > > always
> > > > > > > > enabled in the host tools, even if CONFIG_FIT is not enabled by 
> > > > > > > > the
> > > > > > > > board itself.
> > > > > > > >
> > > > > > > > It would be more convenient if we could use, for example,
> > > > > > > > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building 
> > > > > > > > for the
> > > > > > > > host. Add support for this.
> > > > > > > >
> > > > > > > > With this and the tools_build() function, we should be able to 
> > > > > > > > remove all
> > > > > > > > the #ifdefs currently needed in code that is build by tools and 
> > > > > > > > targets.
> > > > > > > >
> > > > > > > > This will be even nicer when we move to using CONFIG(xxx) 
> > > > > > > > everywhere,
> > > > > > > > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff 
> > > > > > > > will go away.
> > > > > > > >
> > > > > > > > Signed-off-by: Simon Glass 
> > > > > > > > Suggested-by: Rasmus Villemoes  # 
> > > > > > > > b4f73886
> > > > > > > > Reviewed-by: Alexandru Gagniuc 
> > > > > > >
> > > > > > > The problem here is we don't include  
> > > > > > > automatically
> > > > > > > when building host stuff, I believe.  This is why doing this 
> > > > > > > breaks
> > > > > > > test_mkimage_hashes for me on am335x_evm with:
> > > > > > > /tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
> > > > > > > /tmp/.bm-work/am335x_evm -f 
> > > > > > > /home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its
> > > > > > >  /tmp/.bm-work/am335x_evm/test.fit
> > > > > > > *** stack smashing detected ***:  terminated
> > > > > >
> > > > > > Oh dear, and no CI coverage.
> > > > > >
> > > > > > I was reluctant to include kconfig.h everywhere but perhaps that is
> > > > > > the best approach. Will take a look ASAP.
> > > > >
> > > > > Maybe we need to think a bit harder too about how we structure
> > > > > intentionally shared code.
> > > > >
> > > > > Why not, for example, for these common algorithms, rely on typical
> > > > > system headers/libraries in the tooling, which means we validated 
> > > > > U-Boot
> > > > > vs common reference, rather than just our implementations?
> > > >
> > > > Do you mean we use openssl for sha1, for example?
> > >
> > > I guess, yes.  Just flat out saying we require openssl for tools, and
> > > doing our best to not make compatibility with libressl difficult, seems
> > > likely to cause less headaches for people than what we already require
> > > in terms of Python.
> >
> > I'm OK with that, although I do think the problem identified here
> > (CONFIG_SHA256 not enabled) is somewhat sideways from that. We already
>
> OK, I've taken what you posted on IRC and folded that in, continuing
> tests now.
>
> > use separate code paths to run hashing. Perhaps we could make it
> > optional?
> >
> > What about those people that complain about crypto libraries on their 
> > systems?
>
> I'm not sure how big a problem that really is, currently.  I guess one
> thing would be to make a separate thread on it, and put it in the next
> -rc email as well, for people to explain why it would be a hardship.
> That in turn, I think, is coming down to modern vs very old openssl
> support, rather than having any at all.

OK I'll take a look at some point.

Or perhaps Alex might like to?

Regards,
Simon


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Tim Harvey
On Thu, Oct 7, 2021 at 11:37 AM Stefano Babic  wrote:
>
> Hi Tim,
>
> On 07.10.21 20:08, Tim Harvey wrote:
> > On Thu, Oct 7, 2021 at 10:35 AM Marcel Ziswiler  wrote:
> >>
> >> On Thu, 2021-10-07 at 10:26 -0700, Tim Harvey wrote:
> >>> ...
> >>> Marvell,
> >>
> >> (;-p)
> >>
> >>> Indeed that patch resolves the issue - thanks for reminding me that
> >>> hasn't made it in yet!
> >>
> >> You are very welcome. Yeah, I hope somebody starts pulling that stuff (and 
> >> everything else still in-flight)
> >> soon. As it currently still is one big disaster!
> >>
> >
> > Yes... we all seem to be colliding on the IMX8M side between binman
> > conversions, new board support, and Kconfig conversions. Stefano
> > applied a set of patches last night but there are still some pending.
>
> That's right, I am fighting due to conflicts and warnings when building.
> There are a lot of pending patches, but they cannot be applied due to
> conflicts, so it is a WIP on my side.
>
> Stefano
>

Stefano,

Your efforts are greatly appreciated! Feel free to ask for rebases on
my end at least where needed.

The sooner you can get a git pull of your tree to master the better as
well I think.

Tim


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Stefano Babic

Hi Tim,

On 07.10.21 20:08, Tim Harvey wrote:

On Thu, Oct 7, 2021 at 10:35 AM Marcel Ziswiler  wrote:


On Thu, 2021-10-07 at 10:26 -0700, Tim Harvey wrote:

...
Marvell,


(;-p)


Indeed that patch resolves the issue - thanks for reminding me that
hasn't made it in yet!


You are very welcome. Yeah, I hope somebody starts pulling that stuff (and 
everything else still in-flight)
soon. As it currently still is one big disaster!



Yes... we all seem to be colliding on the IMX8M side between binman
conversions, new board support, and Kconfig conversions. Stefano
applied a set of patches last night but there are still some pending.


That's right, I am fighting due to conflicts and warnings when building. 
There are a lot of pending patches, but they cannot be applied due to 
conflicts, so it is a WIP on my side.


Stefano




Tim



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


Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Tom Rini
On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:
> >
> > On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:
> > > >
> > > > On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:
> > > > > Hi Tom,
> > > > >
> > > > > On Wed, 6 Oct 2021 at 18:26, Tom Rini  wrote:
> > > > > >
> > > > > > On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:
> > > > > >
> > > > > > > At present we must separately test for the host build for many 
> > > > > > > options,
> > > > > > > since we force them to be enabled. For example, CONFIG_FIT is 
> > > > > > > always
> > > > > > > enabled in the host tools, even if CONFIG_FIT is not enabled by 
> > > > > > > the
> > > > > > > board itself.
> > > > > > >
> > > > > > > It would be more convenient if we could use, for example,
> > > > > > > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for 
> > > > > > > the
> > > > > > > host. Add support for this.
> > > > > > >
> > > > > > > With this and the tools_build() function, we should be able to 
> > > > > > > remove all
> > > > > > > the #ifdefs currently needed in code that is build by tools and 
> > > > > > > targets.
> > > > > > >
> > > > > > > This will be even nicer when we move to using CONFIG(xxx) 
> > > > > > > everywhere,
> > > > > > > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will 
> > > > > > > go away.
> > > > > > >
> > > > > > > Signed-off-by: Simon Glass 
> > > > > > > Suggested-by: Rasmus Villemoes  # 
> > > > > > > b4f73886
> > > > > > > Reviewed-by: Alexandru Gagniuc 
> > > > > >
> > > > > > The problem here is we don't include  automatically
> > > > > > when building host stuff, I believe.  This is why doing this breaks
> > > > > > test_mkimage_hashes for me on am335x_evm with:
> > > > > > /tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
> > > > > > /tmp/.bm-work/am335x_evm -f 
> > > > > > /home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its 
> > > > > > /tmp/.bm-work/am335x_evm/test.fit
> > > > > > *** stack smashing detected ***:  terminated
> > > > >
> > > > > Oh dear, and no CI coverage.
> > > > >
> > > > > I was reluctant to include kconfig.h everywhere but perhaps that is
> > > > > the best approach. Will take a look ASAP.
> > > >
> > > > Maybe we need to think a bit harder too about how we structure
> > > > intentionally shared code.
> > > >
> > > > Why not, for example, for these common algorithms, rely on typical
> > > > system headers/libraries in the tooling, which means we validated U-Boot
> > > > vs common reference, rather than just our implementations?
> > >
> > > Do you mean we use openssl for sha1, for example?
> >
> > I guess, yes.  Just flat out saying we require openssl for tools, and
> > doing our best to not make compatibility with libressl difficult, seems
> > likely to cause less headaches for people than what we already require
> > in terms of Python.
> 
> I'm OK with that, although I do think the problem identified here
> (CONFIG_SHA256 not enabled) is somewhat sideways from that. We already

OK, I've taken what you posted on IRC and folded that in, continuing
tests now.

> use separate code paths to run hashing. Perhaps we could make it
> optional?
> 
> What about those people that complain about crypto libraries on their systems?

I'm not sure how big a problem that really is, currently.  I guess one
thing would be to make a separate thread on it, and put it in the next
-rc email as well, for people to explain why it would be a hardship.
That in turn, I think, is coming down to modern vs very old openssl
support, rather than having any at all.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Tim Harvey
On Thu, Oct 7, 2021 at 10:35 AM Marcel Ziswiler  wrote:
>
> On Thu, 2021-10-07 at 10:26 -0700, Tim Harvey wrote:
> > ...
> > Marvell,
>
> (;-p)
>
> > Indeed that patch resolves the issue - thanks for reminding me that
> > hasn't made it in yet!
>
> You are very welcome. Yeah, I hope somebody starts pulling that stuff (and 
> everything else still in-flight)
> soon. As it currently still is one big disaster!
>

Yes... we all seem to be colliding on the IMX8M side between binman
conversions, new board support, and Kconfig conversions. Stefano
applied a set of patches last night but there are still some pending.

Tim


Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED()

2021-10-07 Thread Simon Glass
Hi Tom,

On Thu, 7 Oct 2021 at 07:42, Tom Rini  wrote:
>
> On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote:
> > Hi Tom,
> >
> > On Wed, 6 Oct 2021 at 20:52, Tom Rini  wrote:
> > >
> > > On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote:
> > > > Hi Tom,
> > > >
> > > > On Wed, 6 Oct 2021 at 18:26, Tom Rini  wrote:
> > > > >
> > > > > On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote:
> > > > >
> > > > > > At present we must separately test for the host build for many 
> > > > > > options,
> > > > > > since we force them to be enabled. For example, CONFIG_FIT is always
> > > > > > enabled in the host tools, even if CONFIG_FIT is not enabled by the
> > > > > > board itself.
> > > > > >
> > > > > > It would be more convenient if we could use, for example,
> > > > > > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for 
> > > > > > the
> > > > > > host. Add support for this.
> > > > > >
> > > > > > With this and the tools_build() function, we should be able to 
> > > > > > remove all
> > > > > > the #ifdefs currently needed in code that is build by tools and 
> > > > > > targets.
> > > > > >
> > > > > > This will be even nicer when we move to using CONFIG(xxx) 
> > > > > > everywhere,
> > > > > > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go 
> > > > > > away.
> > > > > >
> > > > > > Signed-off-by: Simon Glass 
> > > > > > Suggested-by: Rasmus Villemoes  # 
> > > > > > b4f73886
> > > > > > Reviewed-by: Alexandru Gagniuc 
> > > > >
> > > > > The problem here is we don't include  automatically
> > > > > when building host stuff, I believe.  This is why doing this breaks
> > > > > test_mkimage_hashes for me on am335x_evm with:
> > > > > /tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i 
> > > > > /tmp/.bm-work/am335x_evm -f 
> > > > > /home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its 
> > > > > /tmp/.bm-work/am335x_evm/test.fit
> > > > > *** stack smashing detected ***:  terminated
> > > >
> > > > Oh dear, and no CI coverage.
> > > >
> > > > I was reluctant to include kconfig.h everywhere but perhaps that is
> > > > the best approach. Will take a look ASAP.
> > >
> > > Maybe we need to think a bit harder too about how we structure
> > > intentionally shared code.
> > >
> > > Why not, for example, for these common algorithms, rely on typical
> > > system headers/libraries in the tooling, which means we validated U-Boot
> > > vs common reference, rather than just our implementations?
> >
> > Do you mean we use openssl for sha1, for example?
>
> I guess, yes.  Just flat out saying we require openssl for tools, and
> doing our best to not make compatibility with libressl difficult, seems
> likely to cause less headaches for people than what we already require
> in terms of Python.

I'm OK with that, although I do think the problem identified here
(CONFIG_SHA256 not enabled) is somewhat sideways from that. We already
use separate code paths to run hashing. Perhaps we could make it
optional?

What about those people that complain about crypto libraries on their systems?

Regards,
Simon


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Marcel Ziswiler
On Thu, 2021-10-07 at 10:26 -0700, Tim Harvey wrote:
> ...
> Marvell,

(;-p)

> Indeed that patch resolves the issue - thanks for reminding me that
> hasn't made it in yet!

You are very welcome. Yeah, I hope somebody starts pulling that stuff (and 
everything else still in-flight)
soon. As it currently still is one big disaster!

> Best regards,
> 
> Tim


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Tim Harvey
On Thu, Oct 7, 2021 at 10:12 AM Marcel Ziswiler  wrote:
>
> Hi Tim
>
> On Thu, 2021-10-07 at 08:52 -0700, Tim Harvey wrote:
> > )On Wed, Oct 6, 2021 at 2:44 PM Marcel Ziswiler  wrote:
> > >
> > > On Wed, 2021-10-06 at 13:17 -0700, Tim Harvey wrote:
> > > > Use binman to pack images.
> > > >
> > > > Note that imx8mm_venice supports several boards via multiple DTB's thus
> > > > in the fit node we must use:
> > > > - fit,fdt-list = "of-list"
> > > > - fdt-SEQ
> > > > - config-SEQ
> > > >
> > > > Signed-off-by: Tim Harvey 
> > >
> > > Reviewed-by: Marcel Ziswiler 
> > >
> > > > ---
> > > > v2:
> > > >  - rebase on origin/mater
> > >
> > > You probably meant master (;-p).
> > >
> > > Rest look legit.
> >
> > Marcel,
> >
> > Thanks for the review. I will submit a v3 as I forgot to include a few
> > other patches required for this that I had in v1 (using a common
> > u-boot.dtsi file)
> >
> > I am seeing 'WARNING 'u-boot-spl-ddr.bin' not found, resulting binary
> > is not-functional' until I do a 'make' a second time so there is some
> > sort of race condition with the binman blobs.
>
> Yes, remember, this still needs Peng's Makefile fix [1] as otherwise, it may 
> not quite generate all binman
> artefacts in the right order as discussed here [2].
>
> [1] https://marc.info/?l=u-boot=162908373904742
> [2] https://marc.info/?l=u-boot=162945614207220
>
> Cheers
>
> Marcel

Marvell,

Indeed that patch resolves the issue - thanks for reminding me that
hasn't made it in yet!

Best regards,

Tim


Re: [PATCH 0/3] stm32mp: Attempt to resolve unintended breakage with v2021.10-rc2

2021-10-07 Thread Alex G.

Hi Patrick,

On 9/14/21 7:26 AM, Patrick DELAUNAY wrote:

Hi Alexandru,



I think you need to update  arch/arm/mach-stm32mp/Kconfig


something like:


  config STM32MP15x
  bool "Support STMicroelectronics STM32MP15x Soc"
-    select ARCH_SUPPORT_PSCI if !TFABOOT
-    select ARM_SMCCC if TFABOOT
+    select ARCH_SUPPORT_PSCI if !TFABOOT && !SPL_OPTEE_IMAGE
+    select ARM_SMCCC if TFABOOT || SPL_OPTEE_IMAGE
  select CPU_V7A
-    select CPU_V7_HAS_NONSEC if !TFABOOT
+    select CPU_V7_HAS_NONSEC if !TFABOOT && !SPL_OPTEE_IMAGE
  select CPU_V7_HAS_VIRT
  select OF_BOARD_SETUP
  select PINCTRL_STM32
@@ -47,8 +47,8 @@ config STM32MP15x
  select STM32_SERIAL
  select SYS_ARCH_TIMER
  imply CMD_NVEDIT_INFO
-    imply SYSRESET_PSCI if TFABOOT
-    imply SYSRESET_SYSCON if !TFABOOT
+    imply SYSRESET_PSCI if TFABOOT || SPL_OPTEE_IMAGE
+    imply SYSRESET_SYSCON if !TFABOOT && !SPL_OPTEE_IMAGE
  help
      support of STMicroelectronics SOC STM32MP15x family
      STM32MP157, STM32MP153 or STM32MP151
@@ -153,7 +153,7 @@ config NR_DRAM_BANKS


This is a terrible idea. We're trying to answer a few questions:
   * Did the FSBL provide a PSCI secure monitor
   * Is u-boot running in normal or secure world

But instead of clearly defining those answers, we're trying to infer 
them from other config options. This is confusing to start with, but 
it's also wrong.


For example, SPL_OPTEE_IMAGE means "we support OPTEE images in SPL". It 
doesn't mean that we loaded an OP-TEE kernel at all. SPL with 
SPL_OPTEE_IMAGE may as well boot a legacy uboot image -- nothing 
prevents it. So to infer from this that u-boot runs in the normal world 
is wrong.


Without loss of generality, any CONFIG that conflates u-boot options 
with SPL options is likely to cause some changes down the line.



So just introduce CONFIG_TFABOOT_FIP_CONTAINER don't solve all the 
issues



I think you need to manage CONFIG_SPL_OPTEE_IMAGE
to handle specific case when OPTEE is running after SPL.


Sure, but I'd have to adjust this at runtime, not in Kconfig for the 
reasons above.


I try to experiment the OPTEE load by SPL but I don't see how 
the OP-TEE pager can be managed by SPL in the current code.

It must loaded in SYRAM at 0x2ffc, with a risk to overwrite the SPL
code loaded by rom code at 0x2ffc2500.


This consideration is not unique to SPL. I don't have that problem 
because SPL loads OP-TEE to DRAM at 0xde00. If OP-TEE wants to load 
parts of itself to SYSRAM, that happens after SPL passed control, so the 
conflict is not relevant.



or how to manage several binary, see OP-TEE header v2 support in OP-TEE,

Several file it is already supported in TF-A BL2 with FIP:

tee-header_v2.bin
tee-pager_v2.bin
tee-pageable_v2.bin


I don't know how to use use the OP-TEE pager with SPL, so I elected not to:

EXTRA_OEMAKE = "PLATFORM=${OPTEE_PLATFORM} \
CFG_WITH_PAGER=n \
CFG_NS_ENTRY_ADDR=${KERNEL_UIMAGE_LOADADDRESS} \
CROSS_COMPILE=${HOST_PREFIX} \
CFG_TEE_CORE_DEBUG=y \
CFG_TEE_CORE_LOG_LEVEL=2 \
${TZDRAM_FLAGS} \
"

TZDRAM_FLAGS = "CFG_TZDRAM_START= 0xde00\
CFG_DRAM_SIZE=0x2000 "

Alex


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Marcel Ziswiler
Hi Tim

On Thu, 2021-10-07 at 08:52 -0700, Tim Harvey wrote:
> )On Wed, Oct 6, 2021 at 2:44 PM Marcel Ziswiler  wrote:
> > 
> > On Wed, 2021-10-06 at 13:17 -0700, Tim Harvey wrote:
> > > Use binman to pack images.
> > > 
> > > Note that imx8mm_venice supports several boards via multiple DTB's thus
> > > in the fit node we must use:
> > > - fit,fdt-list = "of-list"
> > > - fdt-SEQ
> > > - config-SEQ
> > > 
> > > Signed-off-by: Tim Harvey 
> > 
> > Reviewed-by: Marcel Ziswiler 
> > 
> > > ---
> > > v2:
> > >  - rebase on origin/mater
> > 
> > You probably meant master (;-p).
> > 
> > Rest look legit.
> 
> Marcel,
> 
> Thanks for the review. I will submit a v3 as I forgot to include a few
> other patches required for this that I had in v1 (using a common
> u-boot.dtsi file)
> 
> I am seeing 'WARNING 'u-boot-spl-ddr.bin' not found, resulting binary
> is not-functional' until I do a 'make' a second time so there is some
> sort of race condition with the binman blobs.

Yes, remember, this still needs Peng's Makefile fix [1] as otherwise, it may 
not quite generate all binman
artefacts in the right order as discussed here [2].

[1] https://marc.info/?l=u-boot=162908373904742
[2] https://marc.info/?l=u-boot=162945614207220

Cheers

Marcel


Re: [PATCH 06/11] sunxi: Select SUN8I_RSB more carefully

2021-10-07 Thread Andre Przywara
On Sat, 21 Aug 2021 18:05:14 -0500
Samuel Holland  wrote:

> SUN8I_RSB should not be selected by MACH_SUN8I, because the hardware
> is not present in half of those SoCs (H3/H5, R40, and V3s). Move the
> selection to the SoCs where the hardware actually exists.

Indeed, only those SoCs below have the RSB controller.
 
> Signed-off-by: Samuel Holland 

Reviewed-by: Andre Przywara 

Cheers,
Andre

> ---
> 
>  arch/arm/mach-sunxi/Kconfig | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> index 3a1916759dc..28332008501 100644
> --- a/arch/arm/mach-sunxi/Kconfig
> +++ b/arch/arm/mach-sunxi/Kconfig
> @@ -241,6 +241,7 @@ config MACH_SUN8I_A23
>   select ARCH_SUPPORT_PSCI
>   select DRAM_SUN8I_A23
>   select PHY_SUN4I_USB
> + select SUN8I_RSB
>   select SUNXI_GEN_SUN6I
>   select SUPPORT_SPL
>   select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
> @@ -254,6 +255,7 @@ config MACH_SUN8I_A33
>   select ARCH_SUPPORT_PSCI
>   select DRAM_SUN8I_A33
>   select PHY_SUN4I_USB
> + select SUN8I_RSB
>   select SUNXI_GEN_SUN6I
>   select SUPPORT_SPL
>   select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
> @@ -264,6 +266,7 @@ config MACH_SUN8I_A83T
>   select CPU_V7A
>   select DRAM_SUN8I_A83T
>   select PHY_SUN4I_USB
> + select SUN8I_RSB
>   select SUNXI_GEN_SUN6I
>   select MMC_SUNXI_HAS_NEW_MODE
>   select MMC_SUNXI_HAS_MODE_SWITCH
> @@ -358,7 +361,6 @@ endchoice
>  # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
>  config MACH_SUN8I
>   bool
> - select SUN8I_RSB
>   select SUN6I_PRCM
>   default y if MACH_SUN8I_A23
>   default y if MACH_SUN8I_A33



Re: [PATCH v3 3/3] pwm: Add driver for cadence TTC

2021-10-07 Thread Sean Anderson




On 10/6/21 10:19 AM, Michal Simek wrote:

TTC has three modes of operations. Timer, PWM and input counters.

There is already driver for timer under CADENCE_TTC_TIMER which is used for
ZynqMP R5 configuration.
This driver is targeting PWM which is for example configuration which can
be used for fan control.
The driver has been tested on Xilinx Kria SOM platform where fan is
connected to one PL pin. When TTC output is connected via EMIO to PL pin
TTC pwm can be configured and tested for example like this:
pwm config 0 0 1 1200
pwm enable 0 0
pwm config 0 0 1 1400
pwm config 0 0 1 1600

Signed-off-by: Michal Simek 
---

Changes in v3:
- Add bind function to check pwm-cells to recognize PWM driver
- Use timer-width in prescaler calculation
- Record timer width in platdata instead of timer mask
- Also disable wave out in config function

Changes in v2:
- Detect pwm-cells property for PWM driver
- Fix all macro names
- Use BIT and GENMASK macros
- Introduce TTC_REG macro for reg offsets
- Use FIELD_PREP
- Move cadence_ttc_pwm_of_to_plat() below probe
- Introduce struct cadence_ttc_pwm_plat
- Read timer-width from DT
- Use NSEC_PER_SEC macro
- Use clock_ctrl variable instead of x - all reported by Sean

  MAINTAINERS   |   1 +
  drivers/pwm/Kconfig   |   7 +
  drivers/pwm/Makefile  |   1 +
  drivers/pwm/pwm-cadence-ttc.c | 261 ++
  4 files changed, 270 insertions(+)
  create mode 100644 drivers/pwm/pwm-cadence-ttc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 31b49c0a95f0..d0b1845384bf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -599,6 +599,7 @@ F:  drivers/mmc/zynq_sdhci.c
  F:drivers/mtd/nand/raw/zynq_nand.c
  F:drivers/net/phy/xilinx_phy.c
  F:drivers/net/zynq_gem.c
+F: drivers/pwm/pwm-cadence-ttc.c
  F:drivers/serial/serial_zynq.c
  F:drivers/reset/reset-zynqmp.c
  F:drivers/rtc/zynqmp_rtc.c
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index cf7f4c6840ce..176e703c8fbb 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -9,6 +9,13 @@ config DM_PWM
  frequency/period can be controlled along with the proportion of that
  time that the signal is high.
  
+config PWM_CADENCE_TTC

+   bool "Enable support for the Cadence TTC PWM"
+   depends on DM_PWM && !CADENCE_TTC_TIMER
+   help
+ Cadence TTC can be configured as timer which is done via
+ CONFIG_CADENCE_TTC_TIMER or as PWM. This is covering only PWM now.
+
  config PWM_CROS_EC
bool "Enable support for the Chrome OS EC PWM"
depends on DM_PWM
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 10d244bfb79d..abf5af41d2cc 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -10,6 +10,7 @@
  
  obj-$(CONFIG_DM_PWM)		+= pwm-uclass.o
  
+obj-$(CONFIG_PWM_CADENCE_TTC)	+= pwm-cadence-ttc.o

  obj-$(CONFIG_PWM_CROS_EC) += cros_ec_pwm.o
  obj-$(CONFIG_PWM_EXYNOS)  += exynos_pwm.o
  obj-$(CONFIG_PWM_IMX) += pwm-imx.o pwm-imx-util.o
diff --git a/drivers/pwm/pwm-cadence-ttc.c b/drivers/pwm/pwm-cadence-ttc.c
new file mode 100644
index ..dc3b314b0cce
--- /dev/null
+++ b/drivers/pwm/pwm-cadence-ttc.c
@@ -0,0 +1,261 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * (C) Copyright 2021 Xilinx, Inc. Michal Simek
+ */
+
+#define LOG_CATEGORY UCLASS_PWM
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CLOCK_CONTROL  0
+#define COUNTER_CONTROL0xc
+#define INTERVAL_COUNTER   0x24
+#define MATCH_1_COUNTER0x30
+
+#define CLK_FALLING_EDGE   BIT(6)
+#define CLK_SRC_EXTERNAL   BIT(5)
+#define CLK_PRESCALE_MASK  GENMASK(4, 1)
+#define CLK_PRESCALE_ENABLEBIT(0)
+
+#define COUNTER_WAVE_POL   BIT(6)
+#define COUNTER_WAVE_DISABLE   BIT(5)
+#define COUNTER_RESET  BIT(4)
+#define COUNTER_MATCH_ENABLE   BIT(3)
+#define COUNTER_DECREMENT_ENABLE   BIT(2)
+#define COUNTER_INTERVAL_ENABLEBIT(1)
+#define COUNTER_COUNTING_DISABLE   BIT(0)
+
+#define NSEC_PER_SEC   10L
+
+#define TTC_REG(reg, channel) ((reg) + (channel) * sizeof(u32))
+#define TTC_CLOCK_CONTROL(reg, channel) \
+   TTC_REG((reg) + CLOCK_CONTROL, (channel))
+#define TTC_COUNTER_CONTROL(reg, channel) \
+   TTC_REG((reg) + COUNTER_CONTROL, (channel))
+#define TTC_INTERVAL_COUNTER(reg, channel) \
+   TTC_REG((reg) + INTERVAL_COUNTER, (channel))
+#define TTC_MATCH_1_COUNTER(reg, channel) \
+   TTC_REG((reg) + MATCH_1_COUNTER, (channel))
+
+struct cadence_ttc_pwm_plat {
+   u8 *regs;
+   u32 timer_width;
+};
+
+struct cadence_ttc_pwm_priv {
+   u8 *regs;
+   u32 timer_width;
+   u32 timer_mask;
+   unsigned long frequency;
+   bool invert[2];
+};
+
+static int cadence_ttc_pwm_set_invert(struct udevice *dev, uint channel,
+  

Re: [PATCH v3 2/3] timer: cadence: Add bind function to driver

2021-10-07 Thread Sean Anderson




On 10/6/21 10:19 AM, Michal Simek wrote:

When DT node has pwm-cells property it shouldn't be bind as timer driver
but as PWM driver. That's why make sure that this property is checked.

Signed-off-by: Michal Simek 
---

Changes in v3:
- New patch in series

  drivers/timer/cadence-ttc.c | 12 
  1 file changed, 12 insertions(+)

diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c
index 2f95d45ecd7a..2eff45060ad6 100644
--- a/drivers/timer/cadence-ttc.c
+++ b/drivers/timer/cadence-ttc.c
@@ -97,6 +97,17 @@ static int cadence_ttc_of_to_plat(struct udevice *dev)
return 0;
  }
  
+static int cadence_ttc_bind(struct udevice *dev)

+{
+   const char *cells;
+
+   cells = dev_read_prop(dev, "#pwm-cells", NULL);
+   if (cells)
+   return -ENODEV;
+
+   return 0;
+}
+
  static const struct timer_ops cadence_ttc_ops = {
.get_count = cadence_ttc_get_count,
  };
@@ -114,4 +125,5 @@ U_BOOT_DRIVER(cadence_ttc) = {
.priv_auto  = sizeof(struct cadence_ttc_priv),
.probe = cadence_ttc_probe,
.ops = _ttc_ops,
+   .bind = cadence_ttc_bind,
  };



Reviewed-by: Sean Anderson 


Re: [PATCH v2] imx8mm_venice: switch to use binman to pack images

2021-10-07 Thread Tim Harvey
)On Wed, Oct 6, 2021 at 2:44 PM Marcel Ziswiler  wrote:
>
> On Wed, 2021-10-06 at 13:17 -0700, Tim Harvey wrote:
> > Use binman to pack images.
> >
> > Note that imx8mm_venice supports several boards via multiple DTB's thus
> > in the fit node we must use:
> > - fit,fdt-list = "of-list"
> > - fdt-SEQ
> > - config-SEQ
> >
> > Signed-off-by: Tim Harvey 
>
> Reviewed-by: Marcel Ziswiler 
>
> > ---
> > v2:
> >  - rebase on origin/mater
>
> You probably meant master (;-p).
>
> Rest look legit.

Marcel,

Thanks for the review. I will submit a v3 as I forgot to include a few
other patches required for this that I had in v1 (using a common
u-boot.dtsi file)

I am seeing 'WARNING 'u-boot-spl-ddr.bin' not found, resulting binary
is not-functional' until I do a 'make' a second time so there is some
sort of race condition with the binman blobs.

Adding Simon to the thread as well. I do not see this when building
the other two imx8mm boards currently using binman in master
(imx8mm_evk_defconfig / imx8mm-cl-iot-gate_defconfig)

Here is the full log in case it sheds some light on the issue. What I
notice right away is that binman issues a WARNING even before the SPL
is built.

$ make distclean imx8mm_venice_defconfig; make BINMAN_VERBOSE=3 -j8
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  YACCscripts/kconfig/zconf.tab.c
  LEX scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
scripts/kconfig/conf  --syncconfig Kconfig
  UPD include/config.h
  CFG u-boot.cfg
  GEN include/autoconf.mk.dep
  CFG spl/u-boot.cfg
  GEN include/autoconf.mk
  GEN spl/include/autoconf.mk
  UPD include/generated/dt.h
  UPD include/generated/timestamp_autogenerated.h
  CFGCHK  u-boot.cfg
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  SHIPPED scripts/dtc/pylibfdt/libfdt.i
  PYMOD   rebuild
  UPD include/config/uboot.release
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  LEX scripts/dtc/dtc-lexer.lex.c
  YACCscripts/dtc/dtc-parser.tab.h
  YACCscripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  UPD include/generated/version_autogenerated.h
  HOSTLD  scripts/dtc/dtc
  CC  lib/asm-offsets.s
  CC  arch/arm/lib/asm-offsets.s
  UPD include/generated/asm-offsets.h
  UPD include/generated/generic-asm-offsets.h
  LDS u-boot.lds
  HOSTCC  tools/gen_eth_addr
  HOSTCC  tools/gen_ethaddr_crc.o
  WRAPtools/lib/crc8.c
  HOSTCC  tools/mkenvimage.o
  HOSTCC  tools/img2srec
  HOSTCC  tools/aisimage.o
  WRAPtools/lib/crc32.c
  HOSTCC  tools/atmelimage.o
  HOSTCC  tools/os_support.o
  HOSTCC  tools/fit_common.o
  HOSTCC  tools/fit_image.o
  HOSTCC  tools/image-host.o
  WRAPtools/common/image-fit.c
  HOSTCC  tools/image-sig-host.o
  WRAPtools/common/image-fit-sig.c
  WRAPtools/common/image-cipher.c
  WRAPtools/common/fdt_region.c
  HOSTCC  tools/default_image.o
  HOSTCC  tools/lib/crc32.o
  WRAPtools/common/bootm.c
  WRAPtools/lib/fdtdec_common.c
  WRAPtools/lib/fdtdec.c
  WRAPtools/common/image.c
  HOSTCC  tools/imagetool.o
  HOSTCC  tools/imximage.o
  HOSTCC  tools/imx8image.o
  HOSTCC  tools/imx8mimage.o
  HOSTCC  tools/kwbimage.o
  WRAPtools/lib/md5.c
  HOSTCC  tools/lpc32xximage.o
  HOSTCC  tools/mxsimage.o
  HOSTCC  tools/omapimage.o
  HOSTCC  tools/pblimage.o
  HOSTCC  tools/pbl_crc32.o
  HOSTCC  tools/vybridimage.o
  HOSTCC  tools/stm32image.o
  WRAPtools/lib/rc4.c
  HOSTCC  tools/rkimage.o
  HOSTCC  tools/rkcommon.o
  HOSTCC  tools/rksd.o
  HOSTCC  tools/rkspi.o
  HOSTCC  tools/socfpgaimage.o
  HOSTCC  tools/sunxi_egon.o
  WRAPtools/lib/crc16.c
  WRAPtools/lib/sha1.c
  WRAPtools/lib/hash-checksum.c
  WRAPtools/lib/sha256.c
  WRAPtools/common/hash.c
  HOSTCC  tools/zynqimage.o
  WRAPtools/lib/sha512.c
  HOSTCC  tools/ublimage.o
  HOSTCC  tools/zynqmpimage.o
  HOSTCC  tools/zynqmpbif.o
  WRAPtools/lib/fdt-libcrypto.c
  HOSTCC  tools/libfdt/fdt.o
  HOSTCC  tools/libfdt/fdt_ro.o
  HOSTCC  tools/libfdt/fdt_wip.o
  HOSTCC  tools/libfdt/fdt_sw.o
  HOSTCC  tools/libfdt/fdt_rw.o
  HOSTCC  tools/libfdt/fdt_strerror.o
  HOSTCC  tools/libfdt/fdt_empty_tree.o
  HOSTCC  tools/libfdt/fdt_addresses.o
  HOSTCC  tools/libfdt/fdt_overlay.o
  HOSTCC  tools/gpimage.o
  HOSTCC  tools/gpimage-common.o
  HOSTCC  tools/mtk_image.o
  WRAPtools/lib/ecdsa/ecdsa-libcrypto.c
  WRAPtools/lib/rsa/rsa-sign.c
  WRAPtools/lib/rsa/rsa-verify.c
  WRAPtools/lib/rsa/rsa-mod-exp.c
  WRAPtools/lib/aes/aes-encrypt.c
  HOSTCC  tools/dumpimage.o
  WRAPtools/lib/aes/aes-decrypt.c
  HOSTCC  tools/common/image-fit.o
  HOSTCC  tools/common/image-fit-sig.o
  HOSTCC  

Re: [PULL u-boot] Please pull u-boot-amlogic-20211007

2021-10-07 Thread Tom Rini
On Thu, Oct 07, 2021 at 02:59:41PM +0200, Neil Armstrong wrote:

> Hi Tom,
> 
> Here's a bunch of changes concerning:
> - Sync DT from Linux 5.14 in order to support those new boards:
>   - Odroid-HC4: a variant of Odroid-C4 with 2 SATA ports (via PCIe-SATA 
> bridge)
>   - Beelink GS-King X: A variant of the other Beelink board with 2 SATA ports 
> (via USB3-SATA bridge)
>   - Banana Pi M5: another credit card SBC
>   - JetHub D1/H1: home automation controllers
>   - Radxa Zero: another RPi Zero sized SBC
> - Other misc changes related to DT update
> - PCIe fixup when link init fails
> - distro_bootcmd scsi_boot change so we can boot on the Odroid-HC4 SATA disks 
> over the PCIe-SATA bridge
> 
> The CI job is at 
> https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic/pipelines/9389
> 
> Thanks,
> Neil
> 
> The following changes since commit ea67f467a43e4c8852bd1ce1bb75f5dc6c3788d1:
> 
>   Merge branch '2021-10-06-assorted-improvements' (2021-10-06 13:46:31 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-amlogic.git 
> tags/u-boot-amlogic-20211007
> 
> for you to fetch changes up to 506fd30740081541d672ec2651cd23734899af76:
> 
>   doc: boards: amlogic: update for Radxa Zero (2021-10-07 13:45:46 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL] u-boot-riscv/master

2021-10-07 Thread Tom Rini
On Thu, Oct 07, 2021 at 07:51:00PM +0800, Leo Liang wrote:

> Hi Tom,
> 
> The following changes since commit ea67f467a43e4c8852bd1ce1bb75f5dc6c3788d1:
> 
>   Merge branch '2021-10-06-assorted-improvements' (2021-10-06 13:46:31 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-riscv.git 
> 
> for you to fetch changes up to 1b2b52f29402b5aaadfe4ba11bd3f29bd414:
> 
>   riscv: ae350: enable Coherence Manager for ae350 (2021-10-07 16:08:23 +0800)
> 
> CI result shows no issue: 
> https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/9388
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


RE: [PATCH v2] drivers: net: fsl-mc: add a command which dumps the MC log

2021-10-07 Thread Aluchenesei Cosmin-florin
This mail was sent by mistake. Please ignore.

-Original Message-
From: Aluchenesei Cosmin-florin 
Sent: Thursday, October 7, 2021 1:08 PM
To: joe.hershber...@ni.com; rfried@gmail.com; Priyanka Jain 

Cc: Ioana Ciornei ; u-boot@lists.denx.de; Aluchenesei 
Cosmin-florin 
Subject: [PATCH v2] drivers: net: fsl-mc: add a command which dumps the MC log

Extended fsl_mc command adding an extra option dump_log

Signed-off-by: Cosmin-Florin Aluchenesei 

Changes in v2:
- Add MC_STRUCT_BUFFER_OFFSET once to the base address of MC.
---
 drivers/net/fsl-mc/mc.c | 89 -
 include/fsl-mc/fsl_mc.h |  9 +
 2 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index 
914ec001ec..33671b3d03 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -38,6 +39,16 @@
 #define MC_BOOT_ENV_VAR"mcinitcmd"
 #define MC_DRAM_BLOCK_DEFAULT_SIZE (512UL * 1024 * 1024)
 
+#define MC_BUFFER_SIZE   (1024 * 1024 * 16)
+#define MAGIC_MC 0x4d430100
+#define MC_FW_ADDR_MASK_LOW 0xE000
+#define MC_FW_ADDR_MASK_HIGH 0X1
+#define MC_STRUCT_BUFFER_OFFSET 0x0100 #define MC_OFFSET_DELTA 
+MC_STRUCT_BUFFER_OFFSET
+
+#define LOG_HEADER_FLAG_BUFFER_WRAPAROUND 0x8000 #define 
+LAST_BYTE(a) ((a) & ~(LOG_HEADER_FLAG_BUFFER_WRAPAROUND))
+
 DECLARE_GLOBAL_DATA_PTR;
 static int mc_memset_resv_ram;
 static struct mc_version mc_ver_info;
@@ -1774,11 +1785,78 @@ err:
return err;
 }
 
+static void print_k_bytes(const void *buf, ssize_t *size) {
+   while (*size > 0) {
+   int count = printf("%s", (char *)buf);
+
+   buf += count;
+   *size -= count;
+   }
+}
+
+static void mc_dump_log(void)
+{
+   struct mc_ccsr_registers __iomem *mc_ccsr_regs = MC_CCSR_BASE_ADDR;
+   u64 high = in_le64(_ccsr_regs->reg_mcfbahr) & MC_FW_ADDR_MASK_HIGH;
+   u64 low = in_le64(_ccsr_regs->reg_mcfbalr) & MC_FW_ADDR_MASK_LOW;
+   u32 buf_len, wrapped, last_byte, magic, buf_start;
+   u64 mc_addr = (high << 32) | low;
+   struct log_header *header;
+   ssize_t size, bytes_end;
+   const void *end_of_data;
+   const void *map_addr;
+   const void *end_addr;
+   const void *cur_ptr;
+   const void *buf;
+
+   map_addr = map_sysmem(mc_addr + MC_STRUCT_BUFFER_OFFSET,
+ MC_BUFFER_SIZE);
+   header = (struct log_header *)map_addr;
+   last_byte = in_le32(>last_byte);
+   buf_len = in_le32(>buf_length);
+   magic = in_le32(>magic_word);
+   buf_start = in_le32(>buf_start);
+   buf = map_addr + buf_start - MC_OFFSET_DELTA;
+   end_addr = buf + buf_len;
+   wrapped = last_byte & LOG_HEADER_FLAG_BUFFER_WRAPAROUND;
+   end_of_data = buf + LAST_BYTE(last_byte);
+
+   if (magic != MAGIC_MC) {
+   puts("Magic number is not valid\n");
+   printf("expected = %08x, received = %08x\n", MAGIC_MC, magic);
+   goto err_magic;
+   }
+
+   if (wrapped && end_of_data != end_addr)
+   cur_ptr = end_of_data + 1;
+   else
+   cur_ptr = buf;
+
+   if (cur_ptr <= end_of_data)
+   size = end_of_data - cur_ptr;
+   else
+   size = (end_addr - cur_ptr) + (end_of_data - buf);
+
+   bytes_end = end_addr - cur_ptr;
+   if (size > bytes_end) {
+   print_k_bytes(cur_ptr, _end);
+
+   cur_ptr = buf;
+   size -= bytes_end;
+   }
+
+   print_k_bytes(buf, );
+
+err_magic:
+   unmap_sysmem(map_addr);
+}
+
 static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
 {
int err = 0;
-   if (argc < 3)
+   if (argc < 2)
goto usage;
 
switch (argv[1][0]) {
@@ -1788,6 +1866,8 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int 
argc,  #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
u64 aiop_fw_addr;
 #endif
+   if (argc < 3)
+   goto usage;
 
sub_cmd = argv[2][0];
 
@@ -1919,6 +1999,12 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, 
int argc,
}
break;
}
+   case 'd':
+   if (argc > 2)
+   goto usage;
+
+   mc_dump_log();
+   break;
default:
printf("Invalid option: %s\n", argv[1]);
goto usage;
@@ -1937,6 +2023,7 @@ U_BOOT_CMD(
"fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
"fsl_mc apply spb [spb_addr] - Apply SPB Soft Parser Blob\n"
"fsl_mc start aiop [FW_addr] - Start AIOP\n"
+   "fsl_mc dump_log - Dump MC Log\n"
 );
 
 void mc_env_boot(void)
diff --git a/include/fsl-mc/fsl_mc.h 

[PATCH v2] drivers: net: fsl-mc: add a command which dumps the MC log

2021-10-07 Thread Cosmin-Florin Aluchenesei
Extended fsl_mc command adding an extra option dump_log

Signed-off-by: Cosmin-Florin Aluchenesei 

Changes in v2:
- Add MC_STRUCT_BUFFER_OFFSET once to the base address of MC.
---
 drivers/net/fsl-mc/mc.c | 89 -
 include/fsl-mc/fsl_mc.h |  9 +
 2 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 914ec001ec..33671b3d03 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -38,6 +39,16 @@
 #define MC_BOOT_ENV_VAR"mcinitcmd"
 #define MC_DRAM_BLOCK_DEFAULT_SIZE (512UL * 1024 * 1024)
 
+#define MC_BUFFER_SIZE   (1024 * 1024 * 16)
+#define MAGIC_MC 0x4d430100
+#define MC_FW_ADDR_MASK_LOW 0xE000
+#define MC_FW_ADDR_MASK_HIGH 0X1
+#define MC_STRUCT_BUFFER_OFFSET 0x0100
+#define MC_OFFSET_DELTA MC_STRUCT_BUFFER_OFFSET
+
+#define LOG_HEADER_FLAG_BUFFER_WRAPAROUND 0x8000
+#define LAST_BYTE(a) ((a) & ~(LOG_HEADER_FLAG_BUFFER_WRAPAROUND))
+
 DECLARE_GLOBAL_DATA_PTR;
 static int mc_memset_resv_ram;
 static struct mc_version mc_ver_info;
@@ -1774,11 +1785,78 @@ err:
return err;
 }
 
+static void print_k_bytes(const void *buf, ssize_t *size)
+{
+   while (*size > 0) {
+   int count = printf("%s", (char *)buf);
+
+   buf += count;
+   *size -= count;
+   }
+}
+
+static void mc_dump_log(void)
+{
+   struct mc_ccsr_registers __iomem *mc_ccsr_regs = MC_CCSR_BASE_ADDR;
+   u64 high = in_le64(_ccsr_regs->reg_mcfbahr) & MC_FW_ADDR_MASK_HIGH;
+   u64 low = in_le64(_ccsr_regs->reg_mcfbalr) & MC_FW_ADDR_MASK_LOW;
+   u32 buf_len, wrapped, last_byte, magic, buf_start;
+   u64 mc_addr = (high << 32) | low;
+   struct log_header *header;
+   ssize_t size, bytes_end;
+   const void *end_of_data;
+   const void *map_addr;
+   const void *end_addr;
+   const void *cur_ptr;
+   const void *buf;
+
+   map_addr = map_sysmem(mc_addr + MC_STRUCT_BUFFER_OFFSET,
+ MC_BUFFER_SIZE);
+   header = (struct log_header *)map_addr;
+   last_byte = in_le32(>last_byte);
+   buf_len = in_le32(>buf_length);
+   magic = in_le32(>magic_word);
+   buf_start = in_le32(>buf_start);
+   buf = map_addr + buf_start - MC_OFFSET_DELTA;
+   end_addr = buf + buf_len;
+   wrapped = last_byte & LOG_HEADER_FLAG_BUFFER_WRAPAROUND;
+   end_of_data = buf + LAST_BYTE(last_byte);
+
+   if (magic != MAGIC_MC) {
+   puts("Magic number is not valid\n");
+   printf("expected = %08x, received = %08x\n", MAGIC_MC, magic);
+   goto err_magic;
+   }
+
+   if (wrapped && end_of_data != end_addr)
+   cur_ptr = end_of_data + 1;
+   else
+   cur_ptr = buf;
+
+   if (cur_ptr <= end_of_data)
+   size = end_of_data - cur_ptr;
+   else
+   size = (end_addr - cur_ptr) + (end_of_data - buf);
+
+   bytes_end = end_addr - cur_ptr;
+   if (size > bytes_end) {
+   print_k_bytes(cur_ptr, _end);
+
+   cur_ptr = buf;
+   size -= bytes_end;
+   }
+
+   print_k_bytes(buf, );
+
+err_magic:
+   unmap_sysmem(map_addr);
+}
+
 static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
 {
int err = 0;
-   if (argc < 3)
+   if (argc < 2)
goto usage;
 
switch (argv[1][0]) {
@@ -1788,6 +1866,8 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int 
argc,
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
u64 aiop_fw_addr;
 #endif
+   if (argc < 3)
+   goto usage;
 
sub_cmd = argv[2][0];
 
@@ -1919,6 +1999,12 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, 
int argc,
}
break;
}
+   case 'd':
+   if (argc > 2)
+   goto usage;
+
+   mc_dump_log();
+   break;
default:
printf("Invalid option: %s\n", argv[1]);
goto usage;
@@ -1937,6 +2023,7 @@ U_BOOT_CMD(
"fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
"fsl_mc apply spb [spb_addr] - Apply SPB Soft Parser Blob\n"
"fsl_mc start aiop [FW_addr] - Start AIOP\n"
+   "fsl_mc dump_log - Dump MC Log\n"
 );
 
 void mc_env_boot(void)
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index a8b072ad7c..07a46a4a1b 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2014 Freescale Semiconductor
+ * Copyright 2021 NXP
  */
 
 #ifndef __FSL_MC_H__
@@ -52,6 +53,14 @@ struct mc_ccsr_registers {
u32 reg_error[];
 };
 

[PATCH] drivers: net: fsl-mc: add a command which dumps the MC log

2021-10-07 Thread Cosmin-Florin Aluchenesei
Extended fsl_mc command adding an extra option dump_log

Signed-off-by: Cosmin-Florin Aluchenesei 
---
 drivers/net/fsl-mc/mc.c | 89 -
 include/fsl-mc/fsl_mc.h |  9 +
 2 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 914ec001ec..edf9f7224d 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -38,6 +39,16 @@
 #define MC_BOOT_ENV_VAR"mcinitcmd"
 #define MC_DRAM_BLOCK_DEFAULT_SIZE (512UL * 1024 * 1024)
 
+#define MC_BUFFER_SIZE   (1024 * 1024 * 16)
+#define MAGIC_MC 0x4d430100
+#define MC_FW_ADDR_MASK_LOW 0xE000
+#define MC_FW_ADDR_MASK_HIGH 0X1
+#define MC_STRUCT_BUFFER_OFFSET 0x0100
+#define MC_OFFSET_DELTA MC_STRUCT_BUFFER_OFFSET
+
+#define LOG_HEADER_FLAG_BUFFER_WRAPAROUND 0x8000
+#define LAST_BYTE(a) ((a) & ~(LOG_HEADER_FLAG_BUFFER_WRAPAROUND))
+
 DECLARE_GLOBAL_DATA_PTR;
 static int mc_memset_resv_ram;
 static struct mc_version mc_ver_info;
@@ -1774,11 +1785,78 @@ err:
return err;
 }
 
+static void print_k_bytes(const void *buf, ssize_t *size)
+{
+   while (*size > 0) {
+   int count = printf("%s", (char *)buf);
+
+   buf += count;
+   *size -= count;
+   }
+}
+
+static void mc_dump_log(void)
+{
+   struct mc_ccsr_registers __iomem *mc_ccsr_regs = MC_CCSR_BASE_ADDR;
+   u64 high = in_le64(_ccsr_regs->reg_mcfbahr) & MC_FW_ADDR_MASK_HIGH;
+   u64 low = in_le64(_ccsr_regs->reg_mcfbalr) & MC_FW_ADDR_MASK_LOW;
+   u64 mc_addr = (high << 32) | low | MC_STRUCT_BUFFER_OFFSET;
+   u32 buf_len, wrapped, last_byte, magic, buf_start;
+   struct log_header *header;
+   ssize_t size, bytes_end;
+   const void *end_of_data;
+   const void *map_addr;
+   const void *end_addr;
+   const void *cur_ptr;
+   const void *buf;
+
+   map_addr = map_sysmem(mc_addr + MC_STRUCT_BUFFER_OFFSET,
+ MC_BUFFER_SIZE);
+   header = (struct log_header *)map_addr;
+   last_byte = in_le32(>last_byte);
+   buf_len = in_le32(>buf_length);
+   magic = in_le32(>magic_word);
+   buf_start = in_le32(>buf_start);
+   buf = map_addr + buf_start - MC_OFFSET_DELTA;
+   end_addr = buf + buf_len;
+   wrapped = last_byte & LOG_HEADER_FLAG_BUFFER_WRAPAROUND;
+   end_of_data = buf + LAST_BYTE(last_byte);
+
+   if (magic != MAGIC_MC) {
+   puts("Magic number is not valid\n");
+   printf("expected = %08x, received = %08x\n", MAGIC_MC, magic);
+   goto err_magic;
+   }
+
+   if (wrapped && end_of_data != end_addr)
+   cur_ptr = end_of_data + 1;
+   else
+   cur_ptr = buf;
+
+   if (cur_ptr <= end_of_data)
+   size = end_of_data - cur_ptr;
+   else
+   size = (end_addr - cur_ptr) + (end_of_data - buf);
+
+   bytes_end = end_addr - cur_ptr;
+   if (size > bytes_end) {
+   print_k_bytes(cur_ptr, _end);
+
+   cur_ptr = buf;
+   size -= bytes_end;
+   }
+
+   print_k_bytes(buf, );
+
+err_magic:
+   unmap_sysmem(map_addr);
+}
+
 static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
 {
int err = 0;
-   if (argc < 3)
+   if (argc < 2)
goto usage;
 
switch (argv[1][0]) {
@@ -1788,6 +1866,8 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int 
argc,
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
u64 aiop_fw_addr;
 #endif
+   if (argc < 3)
+   goto usage;
 
sub_cmd = argv[2][0];
 
@@ -1919,6 +1999,12 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, 
int argc,
}
break;
}
+   case 'd':
+   if (argc > 2)
+   goto usage;
+
+   mc_dump_log();
+   break;
default:
printf("Invalid option: %s\n", argv[1]);
goto usage;
@@ -1937,6 +2023,7 @@ U_BOOT_CMD(
"fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
"fsl_mc apply spb [spb_addr] - Apply SPB Soft Parser Blob\n"
"fsl_mc start aiop [FW_addr] - Start AIOP\n"
+   "fsl_mc dump_log - Dump MC Log\n"
 );
 
 void mc_env_boot(void)
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index a8b072ad7c..07a46a4a1b 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2014 Freescale Semiconductor
+ * Copyright 2021 NXP
  */
 
 #ifndef __FSL_MC_H__
@@ -52,6 +53,14 @@ struct mc_ccsr_registers {
u32 reg_error[];
 };
 
+struct log_header {
+   u32 magic_word;
+   char 

[PATCH v4 2/2] board: kontron: pitx-imx8m: Add Kontron pitx-imx8m board support

2021-10-07 Thread Heiko Thiery
The Kontron pitx-imx8m is an NXP i.MX8MQ based board in the pITX
form factor.

Signed-off-by: Heiko Thiery 
---
v4: update board integration

 - migrate to IMX_CONFIG
 - convert config options to Kconfig
  - CONFIG_POWER_I2C
  - CONFIG_SPL_POWER_I2C
  - CONFIG_POWER_LEGACY
  - CONFIG_SYS_LOAD_ADDR
  - CONFIG_SYS_I2C_MXC
  - CONFIG_SYS_I2C_LEGACY
  - CONFIG_SYS_I2C_MXC_I2C1
  - CONFIG_SYS_I2C_MXC_I2C2
  - CONFIG_SYS_I2C_MXC_I2C3
  - CONFIG_SYS_LOAD_ADDR
  - CONFIG_MXC_GPIO

v3:
 - enable EFI capsule support
 - add update FIT image creation to binman config
 - change env offset to fit into eMMC boot partition

v2:
 - add support for 2/4GB variant
 - enable config options
  - CONFIG_CMD_GPT
  - CONFIG_DM_ETH_PHY
  - CONFIG_EFI_SET_TIME
 - add pxefile_addr_r env variable


 .../dts/imx8mq-kontron-pitx-imx8m-u-boot.dtsi |  163 ++
 arch/arm/mach-imx/imx8m/Kconfig   |7 +
 board/kontron/pitx_imx8m/Kconfig  |   15 +
 board/kontron/pitx_imx8m/MAINTAINERS  |7 +
 board/kontron/pitx_imx8m/Makefile |8 +
 board/kontron/pitx_imx8m/imximage.cfg |5 +
 board/kontron/pitx_imx8m/lpddr4_timing_2gb.c  | 1853 +
 board/kontron/pitx_imx8m/lpddr4_timing_4gb.c  | 1853 +
 board/kontron/pitx_imx8m/pitx_imx8m.c |  156 ++
 board/kontron/pitx_imx8m/spl.c|  322 +++
 configs/kontron_pitx_imx8m_defconfig  |   87 +
 doc/board/kontron/index.rst   |1 +
 doc/board/kontron/pitx-imx8m.rst  |   67 +
 include/configs/kontron_pitx_imx8m.h  |  110 +
 14 files changed, 4654 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-kontron-pitx-imx8m-u-boot.dtsi
 create mode 100644 board/kontron/pitx_imx8m/Kconfig
 create mode 100644 board/kontron/pitx_imx8m/MAINTAINERS
 create mode 100644 board/kontron/pitx_imx8m/Makefile
 create mode 100644 board/kontron/pitx_imx8m/imximage.cfg
 create mode 100644 board/kontron/pitx_imx8m/lpddr4_timing_2gb.c
 create mode 100644 board/kontron/pitx_imx8m/lpddr4_timing_4gb.c
 create mode 100644 board/kontron/pitx_imx8m/pitx_imx8m.c
 create mode 100644 board/kontron/pitx_imx8m/spl.c
 create mode 100644 configs/kontron_pitx_imx8m_defconfig
 create mode 100644 doc/board/kontron/pitx-imx8m.rst
 create mode 100644 include/configs/kontron_pitx_imx8m.h

diff --git a/arch/arm/dts/imx8mq-kontron-pitx-imx8m-u-boot.dtsi 
b/arch/arm/dts/imx8mq-kontron-pitx-imx8m-u-boot.dtsi
new file mode 100644
index 00..cf649b0314
--- /dev/null
+++ b/arch/arm/dts/imx8mq-kontron-pitx-imx8m-u-boot.dtsi
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#include 
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+ {
+   u-boot-spl-ddr {
+   filename = "u-boot-spl-ddr.bin";
+   pad-byte = <0xff>;
+   align-size = <4>;
+   align = <4>;
+
+   u-boot-spl {
+   align-end = <4>;
+   };
+
+   blob_1: blob-ext@1 {
+   filename = "lpddr4_pmu_train_1d_imem.bin";
+   size = <0x8000>;
+   };
+
+   blob_2: blob-ext@2 {
+   filename = "lpddr4_pmu_train_1d_dmem.bin";
+   size = <0x4000>;
+   };
+
+   blob_3: blob-ext@3 {
+   filename = "lpddr4_pmu_train_2d_imem.bin";
+   size = <0x8000>;
+   };
+
+   blob_4: blob-ext@4 {
+   filename = "lpddr4_pmu_train_2d_dmem.bin";
+   size = <0x4000>;
+   };
+   };
+
+   spl {
+   filename = "spl.bin";
+
+   mkimage {
+   args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
+
+   blob {
+   filename = "u-boot-spl-ddr.bin";
+   };
+   };
+   };
+
+   itb {
+   filename = "u-boot.itb";
+
+   fit {
+   description = "Configuration to load ATF before U-Boot";
+   #address-cells = <1>;
+   fit,external-offset = ;
+
+   images {
+   uboot {
+   description = "U-Boot (64-bit)";
+   type = "standalone";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+
+   u-boot-nodtb {
+   };
+   };
+
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = 

[PATCH 7/7] imx: ventana: fix USB hub reset

2021-10-07 Thread sbabic
> Remove board_ehci_hcd_init function that is not used with DM_USB
> and replace its functionality with device-tree configuraton that treats
> USB HUB RST# as a gpio enable for the usbh1 vbus regulator.
> Signed-off-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2] imx: spl: fix imx8m secure boot

2021-10-07 Thread sbabic
> cherry-picked from NXP code:
> 719d665a87c6: ("MLK-20467 imx8m: Fix issue for booting signed image through 
> uuu")
> which fixes secure boot on imx8m based boards. Problem was
> that FIT header and so IVT header too, was loaded to
> memallocated address. So the ivt header address coded
> in IVT itself does not fit with the real position.
> Signed-off-by: Heiko Schocher 
> Tested-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH 1/7] imx: ventana: add part command

2021-10-07 Thread sbabic
> Add part command for obtaining info about disk partitions.
> Signed-off-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] mtd: nand: mxs_nand_spl: Add nand_spl_adjust_offset

2021-10-07 Thread sbabic
> Since the mxs_nand_spl has implemented adjust read offset in
> nand_spl_load_image, so we don't need to check the bad block in
> nand_spl_adjust_offset. Directly return the offset to continue
> read by nand_spl_load_image.
> Signed-off-by: Ye Li 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] misc: ocotp: Allow disabling ocotp driver in SPL

2021-10-07 Thread sbabic
> From: Michael Scott 
> This allows removal of the OCOTP driver when SPL is enabled.
> Disabling OCOTP reduces SPL size efficiently.
> Signed-off-by: Michael Scott 
> Co-developed-by: Oleksandr Suvorov 
> Signed-off-by: Oleksandr Suvorov 
> Reviewed-by: Peng Fan 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v3] imx8mm-cl-iot-gate: Split the defconfigs

2021-10-07 Thread sbabic
> Currently imx8mm-cl-iot-gate_defconfig fails to produce a working boot
> binary due to the lack of fip.bin:
> "  BINMAN  all
> Image 'main-section' is missing external blobs and is non-functional: blob-ext
> Some images are invalid"
> To make the build process more consistent with the other i.MX8M targets,
> split the defconfig in two:
> - imx8mm-cl-iot-gate_defconfig: standard defconfig that only 
> requires ATF / DDR firmware.
> - imx8mm-cl-iot-gate-optee_defconfig: "more advanced" defconfig that
> requires ATF / Optee / mbedtls / DDR firmware.
> Signed-off-by: Fabio Estevam 
> Tested-by: Ying-Chun Liu (PaulLiu) 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] imx: mx7: spl: fix CONFIG_SPL_MAX_SIZE definition

2021-10-07 Thread sbabic
> The CONFIG_SPL_MAX_SIZE definition did not account for all areas that
> are used by the boot ROM according to the manual, causing boot failures
> due to truncated SPL images when actually hitting this limit.
> Signed-off-by: Matthias Schiffer 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2 4/5] board: gateworks: venice: update thermal temp thresholds per cpu grade

2021-10-07 Thread sbabic
> Update the passive/critical thermal zone dt config per CPU temperature
> grade.
> Signed-off-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH][RFC] tree: imx: remove old fit generator script

2021-10-07 Thread sbabic
> Since derivatives are moving to binman from usage of the FIT generator
> script, and considering the warning introduced in f4a43d2925
> ("Makefile: Warn against using CONFIG_SPL_FIT_GENERATOR"), usage of FIT
> generator is discouraged.
> Current FIT generator also generates broken output, since commit
> 3f04db891a ("image: Check for unit addresses in FITs") prohibits using
> '@' for unit addresses but the generator script still emits the old
> sematics.
> Remove the generator script and corresponding call in Makefile, all
> derivatives should be migrated to binman in order to provide binary
> images.
> Signed-off-by: Andrey Zhizhikin 
> Reviewed-by: Simon Glass 
> Reviewed-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v6 1/2] imx: imx6ul: Add support for Kontron Electronics SL/BL i.MX6UL/ULL boards (N63xx/N64xx)

2021-10-07 Thread sbabic
> From: Frieder Schrempf 
> This adds support for i.MX6UL/ULL-based evaluation kits with SoMs by
> Kontron Electronics GmbH.
> Currently there are the following SoM flavors (SoM-Line):
>   * N6310: SOM with i.MX6UL-2, 256MB RAM, 256MB SPI NAND
>   * N6311: SOM with i.MX6UL-2, 512MB RAM, 512MB SPI NAND
>   * N6411: SOM with i.MX6ULL, 512MB RAM, 512MB SPI NAND
> And the according evaluation boards (Board-Line):
>   * N6310-S: Baseboard with SOM N6310, eMMC, display (optional), ...
>   * N6311-S: Baseboard with SOM N6311, eMMC, display (optional), ...
>   * N6411-S: Baseboard with SOM N6411, eMMC, display (optional), ...
> Currently U-Boot describes i.MX6UL and i.MX6ULL through separate config
> options at compile-time. Though the differences are so minor, that for
> the scope of these SoMs we just use a single defconfig that is compatible
> with both SoCs.
> Signed-off-by: Frieder Schrempf 
> Reviewed-by: Stefano Babic 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] arm: imx8m: Fix pad DSE issue for i.MX8MM/MN/MP

2021-10-07 Thread sbabic
> According to 8MM/MN/MP reference manual, their pad registers only have
> 4 valid DSE values. And DSE2 and DSE4 are different with current
> definitions in iomux-v3.h. Fix the issue to align with manual.
> Signed-off-by: Ye Li 
> Acked-by: Peng Fan 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH 6/7] imx: ventana: update LVDS support

2021-10-07 Thread sbabic
> Enable LVDS display detection and panel-specific configuration
> Make I2C based LVDS detection and configuration model specific:
> - not all boards support LVDS connectors; fail detection that do not
>   support LVDS to avoid misdetecting an I2C device as a display
> - GPIO configuration is panel specific; use panel name where needed
> Signed-off-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2 1/1] arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

2021-10-07 Thread sbabic
> From: "Ying-Chun Liu (PaulLiu)" 
> When purchasing imx8mm-cl-iot-gate it is able to customize the
> memory size. It could be 1GB, 2GB and 4GB. We implement
> board_phys_sdram_size() to detect the memory size for usage.
> Signed-off-by: Ying-Chun Liu (PaulLiu) 
> Cc: Fabio Estevam 
> Cc: Frieder Schrempf 
> Cc: uboot-imx 
> Reviewed-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH 2/3] imx8mq_evk: Increase CONFIG_SYS_BOOTM_LEN to 64MB

2021-10-07 Thread sbabic
> The BSP platform LmP supports the board NXP iMX8M Plus EVK. The
> kernel size in LmP exceeds 32Mb. Increase the maximum size
> of an uncompressed kernel to fix the following error:
> Uncompressing Kernel Image
> Error: inflate() returned -5
> Image too large: increase CONFIG_SYS_BOOTM_LEN
> Must RESET board to recover
> Signed-off-by: Oleksandr Suvorov 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v1 1/2] spl_fit. add hook to make fixes after fit header is loaded

2021-10-07 Thread sbabic
> add hook function spl_load_simple_fit_fix_load()
> which is called after fit image header is loaded.
> Signed-off-by: Heiko Schocher 
> Reviewed-by: Simon Glass 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH 1/1] mx7ulp: Update wdog disable sequence

2021-10-07 Thread sbabic
> From: Ye Li 
> Update the mx7ulp wdog disable sequence to avoid potential reset
> issue in unlock or refresh sequence. Both sequence need two words
> write to wdog CNT register in 16 bus clocks window, if miss the
> window, the write will cause violation in wdog and reset the chip.
> Current u-boot code is using writel() function which has a DMB
> barrier to order the memory access. The DMB between two words write
> may introduce some delay in certain circumstance, causing the wdog
> reset due to 16 bus clock window requirement.
> Also, WDOG1 might have been enabled already depending on FUSE hence
> we need to be as close as possible to its reconfiguration timing
> requirement of 128 bus clock limit.
> This patch replaces writel() function by __raw_writel() to avoid such
> issue, and improve to check if watchdog is already disabled or
> unlocked.
> Signed-off-by: Ye Li 
> Co-developed-by: Jorge Ramirez-Ortiz 
> Signed-off-by: Jorge Ramirez-Ortiz 
> Co-developed-by: Ricardo Salveti 
> Signed-off-by: Ricardo Salveti 
> Signed-off-by: Oleksandr Suvorov 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] ARM: dts: imx6-apalis: enable watchdog

2021-10-07 Thread sbabic
> From: Ricardo Salveti 
> Add u-boot.dtsi specific to imx6-apalis with a watchdog enabled.
> If OP-TEE is loaded by SPL, it may use a watchdog to handle fails of
> u-boot running. Enable the watchdog in SPL to use it by OP-TEE.
> Signed-off-by: Ricardo Salveti 
> Signed-off-by: Oleksandr Suvorov 
> Reviewed-by: Igor Opaniuk 
> Reviewed-by: Peng Fan 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] mtd: nand: Fix typo in MXC Kconfig symbol description

2021-10-07 Thread sbabic
> From: Haolin Li 
> Trivial typo fix.
> Signed-off-by: Haolin Li 
> Reviewed-by: Michal Simek 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH 1/3] imx8mm_evk: Increase CONFIG_SYS_BOOTM_LEN to 64MB

2021-10-07 Thread sbabic
> The BSP platform LmP supports the board NXP iMX8M Mini EVK. The
> kernel size in LmP exceeds 32Mb. Increase the maximum size
> of an uncompressed kernel to fix the following error:
> Uncompressing Kernel Image
> Error: inflate() returned -5
> Image too large: increase CONFIG_SYS_BOOTM_LEN
> Must RESET board to recover
> Signed-off-by: Oleksandr Suvorov 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2] arm: dts: imx8mp: Generate single bootable binary

2021-10-07 Thread sbabic
> binman conversion made flashing flash.bin
> and u-boot.itb necessary. Update binman config
> to create a single flash.bin image again.
> This updates imx8mp_evk and phyCORE-i.MX8MP as they share the
> same binman config.
> Updated also imx8mp_evk documentation.
> Tested on phyCORE-i.MX8MP.
> Signed-off-by: Teresa Remmet 
> Reviewed-by: Fabio Estevam 
> Reviewed-by: Heiko Schocher 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2 5/5] arm: dts: imx8mm-venice*: remove thermal zone overrides

2021-10-07 Thread sbabic
> Remove the unnecessary thermal zone overrides.
> Signed-off-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2 3/5] arm: dts: imx8mm-venice-gw700x: fix mp5416 pmic config

2021-10-07 Thread sbabic
> Fix various MP5416 PMIC configurations:
>  - Update regulator names per dt-bindings
>  - ensure values fit among valid register values
>  - add required regulator-max-microamp property
>  - add regulator-always-on prop
> Signed-off-by: Tim Harvey 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


  1   2   >