RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support

2020-03-18 Thread Kuldeep Singh



> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Wednesday, March 18, 2020 4:22 PM
> To: Kuldeep Singh ; u-boot@lists.denx.de
> Cc: Kuldeep Singh 
> Subject: RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep
> Singh
> >Sent: Saturday, March 14, 220 6:44 PM
> >To: Priyanka Jain ; u-boot@lists.denx.de
> >Cc: Kuldeep Singh 
> >Subject: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> >
> >Enable FSPI controller support. So, flash environment can now be used.
> >
> >Signed-off-by: Kuldeep Singh 
> >---
> >v2:
> >-Rebased to top.
> >-Drop other patches from series as already accepted.
> >-Add ENV_SECT_SIZE value as 0x2
> >
> > configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
> > configs/lx2160aqds_tfa_defconfig | 3 +++
> > configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
> > configs/lx2160ardb_tfa_defconfig | 3 +++
> > 4 files changed, 8 insertions(+)
> >
> >diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >index 7c3b827..92fac5d 100644
> >--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> >@@ -65,6 +65,7 @@ CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> > CONFIG_FSL_DSPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >diff --git a/configs/lx2160aqds_tfa_defconfig
> >b/configs/lx2160aqds_tfa_defconfig
> >index 449b3cb..e472c12 100644
> >--- a/configs/lx2160aqds_tfa_defconfig
> >+++ b/configs/lx2160aqds_tfa_defconfig
> >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > CONFIG_SYS_TEXT_BASE=0x8200
> > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > CONFIG_ENV_SIZE=0x2000
> >+CONFIG_ENV_SECT_SIZE=0x2
> > CONFIG_ENV_OFFSET=0x50
> > CONFIG_DM_GPIO=y
> > CONFIG_FSPI_AHB_EN_4BYTE=y
> >@@ -32,6 +33,7 @@ CONFIG_OF_CONTROL=y
> > CONFIG_OF_BOARD_FIXUP=y
> > CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-qds"
> > CONFIG_ENV_IS_IN_MMC=y
> >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > CONFIG_NET_RANDOM_ETHADDR=y
> > CONFIG_DM=y
> > CONFIG_SATA_CEVA=y
> >@@ -65,6 +67,7 @@ CONFIG_DM_SCSI=y
> > CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >index d1fffb3..e754eb7 100644
> >--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> >@@ -60,6 +60,7 @@ CONFIG_DM_SCSI=y
> > CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >diff --git a/configs/lx2160ardb_tfa_defconfig
> >b/configs/lx2160ardb_tfa_defconfig
> >index 93f3e20..5d4580e 100644
> >--- a/configs/lx2160ardb_tfa_defconfig
> >+++ b/configs/lx2160ardb_tfa_defconfig
> >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > CONFIG_SYS_TEXT_BASE=0x8200
> > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > CONFIG_ENV_SIZE=0x2000
> >+CONFIG_ENV_SECT_SIZE=0x2
> > CONFIG_ENV_OFFSET=0x50
> > CONFIG_DM_GPIO=y
> > CONFIG_EMC2305=y
> >@@ -33,6 +34,7 @@ CONFIG_OF_CONTROL=y
> > CONFIG_OF_BOARD_FIXUP=y
> > CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
> > CONFIG_ENV_IS_IN_MMC=y
> >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > CONFIG_NET_RANDOM_ETHADDR=y
> > CONFIG_DM=y
> > CONFIG_SATA_CEVA=y
> >@@ -64,6 +66,7 @@ CONFIG_DM_SCSI=y
> > CONFIG_DM_SERIAL=y
> > CONFIG_SPI=y
> > CONFIG_DM_SPI=y
> >+CONFIG_NXP_FSPI=y
> > CONFIG_USB=y
> > CONFIG_DM_USB=y
> > CONFIG_USB_XHCI_HCD=y
> >--
> >2.7.4
> Reviewed-by: Priyanka Jain 
> 
> Please confirm that all dependent patches are now available in main master
> branch

Yes, all dependent patches are in master branch to make flexspi work on 
LX2160ARDB.

Thanks
Kuldeep

> 
> Regards
> Priyanka


Re: [PATCH 3/3] cmd: dm: Fixed/Added DM driver listing subcommands

2020-03-18 Thread Niel Fourie

Hi Sean, Simon,

I will write tests for all of these cases as Simon requested. Thanks, it 
did not occur to me.


On 3/17/20 7:51 PM, Sean Anderson wrote:

-void dm_dump_drivers(void)
+void dm_dump_driver_compat(void)
  {
struct driver *d = ll_entry_start(struct driver, driver);
const int n_ents = ll_entry_count(struct driver, driver);
@@ -107,6 +107,9 @@ void dm_dump_drivers(void)
puts("DriverCompatible\n");
puts("\n");
for (entry = d; entry < d + n_ents; entry++) {
+   if (!entry->of_match) {
+   continue;
+   }


This should have been fixed in version 2 of the patch [1].


Ah, I didn't know of that patch. I'll ask Tom whether I should rebase my 
patches on top of that change or not.



+
+void dm_dump_drivers(void)
+{
+   struct driver *d = ll_entry_start(struct driver, driver);
+   const int n_ents = ll_entry_count(struct driver, driver);
+   struct driver *entry;
+   struct udevice *udev;
+   struct uclass *uc;
+   int i;
+
+   puts("Driveruid uclass   Devices\n");
+   for (i = 0; i < 77; i++)
+   putc('-');


Can you print these dashes in a way which makes it obvious that they are
the correct length? E.g. do something like

puts("Driveruid uclass   Devices\n");
puts("--\n");



Ah, I was lining the dashes up with the contents instead of the heading. 
I will fix all cases to be like the above. Thanks!



+void dm_dump_static_driver_info(void)
+{
+   struct driver_info *drv = ll_entry_start(struct driver_info,
+driver_info);
+   const int n_ents = ll_entry_count(struct driver_info, driver_info);
+   struct driver_info *entry;
+
+   puts("Driver   Address\n");
+   puts("--\n");
+   for (entry = drv; entry != drv + n_ents; entry++) {
+   printf("%-20.20s @%08lx\n", entry->name,
+  (ulong)map_to_sysmem(entry->platdata));
+   }
+}


Just curious, what were you using this for?


In general I was looking for ways to query list-able capabilities of 
U-boot at run time, to show anomalies and to highlight legacy/non-ideal 
implementations when possible; it is hard to fix a problem which you 
can't see it.


Because the U_BOOT_DEVICE() devices should be used sparingly and do not 
appear in the device tree, I felt that it was useful to list them to see 
their impact. The address is useful to for eyeballing the platform data 
with md.b to distinguish between multiple driver instances...


In the hunt against legacy drivers, I am also looking at ways of 
listing/highlighting other problem-children at run time, but whether 
those patches will see light-of-day is another matter...


Best regards,
Niel Fourie

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


Re: [PATCH 3/3] cmd: dm: Fixed/Added DM driver listing subcommands

2020-03-18 Thread Niel Fourie

Hi Tom,

On 3/17/20 7:51 PM, Sean Anderson wrote:

On 3/17/20 10:09 AM, Niel Fourie wrote:

Renamed dm "drivers" subcommand to "compat" (as it listed
compatibility strings) and prevent it from segfaulting when
drivers have no of_match populated.

Added a new "drivers" subcommand to dump a list of all known DM
drivers and for each, their uclass id, uclass driver and names of
attached devices.

Added a new "static" subcommand to dump a list of DM drivers with
statically defined platform data.

Signed-off-by: Niel Fourie 
CC: Simon Glass 
---
  cmd/dm.c| 24 --
  drivers/core/dump.c | 60 -
  include/dm/util.h   |  6 +
  3 files changed, 87 insertions(+), 3 deletions(-)



In drivers/core/dump.c:
  
-void dm_dump_drivers(void)

+void dm_dump_driver_compat(void)
  {
struct driver *d = ll_entry_start(struct driver, driver);
const int n_ents = ll_entry_count(struct driver, driver);
@@ -107,6 +107,9 @@ void dm_dump_drivers(void)
puts("DriverCompatible\n");
puts("\n");
for (entry = d; entry < d + n_ents; entry++) {
+   if (!entry->of_match) {
+   continue;
+   }


This should have been fixed in version 2 of the patch [1].

[1] https://patchwork.ozlabs.org/patch/1234460/



Should I rebase my series on the version 2 of the above patch, or should 
I simply include that change in my series instead? Thanks in advance!


Best regards,
Niel Fourie

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


Re: [PATCH v2 0/5] sunxi: SPL SPI booting: Enable R40 and H6 SoCs

2020-03-18 Thread Jagan Teki
On Tue, Jan 28, 2020 at 6:17 AM Andre Przywara  wrote:
>
> This series enables the SPI booting feature for Allwinner R40 and H6
> SoCs. To achieve this, we enable our spl_spi_sunxi.c driver to deal
> with those two SoCs. The R40 is pretty straightforward, as it just needs
> its base address adjusted. This is prepared in patch 1/5 and finalised
> in patch 3/5.
> For the H6, on top of yet another different base address, the new clocks
> and slightly different pinmux setup need to be cared for.
> Patch 2/5 and 4/5 take care of that.
> Patch 5/5 enables this feature for the Pine H64 board, which comes with
> soldered SPI flash.
>
> This has been tested on the Pine H64 board and a Bananapi M2 Berry
> (with SPI flash connected to the SPI0-PortC header pins).
> For the existing SPI boot platforms this does not change the code size,
> as the toolchain is clever enough to optimise this properly.
>
> There is a similar series to enable SPI support for the sunxi-fel tool,
> which was used to test this:
> https://github.com/linux-sunxi/sunxi-tools/pull/129
>
> Cheers,
> Andre.
>
> Changelog v1 .. v2:
> - Drop already merged patch 1/6
> - rename is_new_gen_spi() to is_sun6i_gen_spi()

Applied to u-boot-sunxi/master


RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver

2020-03-18 Thread Ioana Ciornei
> Subject: Re: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver
> 
> On Thu, Mar 12, 2020 at 11:24 AM Ioana Ciornei 
> wrote:
> >
> > Add a driver for the MDIO interface integrated in the mEMAC
> > (Multi-rate Ethernet Media Access Controller) and the Fman 10G Ethernet
> MACs.
> >
> > Signed-off-by: Ioana Ciornei 
> > ---
> >  drivers/net/Kconfig   |   7 ++
> >  drivers/net/Makefile  |   1 +
> >  drivers/net/fsl_ls_mdio.c | 158
> > ++
> >  3 files changed, 166 insertions(+)
> >  create mode 100644 drivers/net/fsl_ls_mdio.c
> >
> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
> > 4d1013c98466..bc518f218da6 100644
> > --- a/drivers/net/Kconfig
> > +++ b/drivers/net/Kconfig
> > @@ -640,4 +640,11 @@ config MVMDIO
> >
> >   This driver is used by the MVPP2 and MVNETA drivers.
> >
> > +config FSL_LS_MDIO
> > +   bool "NXP Layerscape MDIO interface support"
> > +   depends on DM_MDIO
> > +   help
> > + This driver supports the MDIO bus found on the Fman 10G Ethernet
> MACs and
> > + on the mEMAC (which supports both Clauses 22 and 45).
> > +
> >  endif # NETDEVICES
> > diff --git a/drivers/net/Makefile b/drivers/net/Makefile index
> > 6e0a68834d97..6d9b8772b1a5 100644
> > --- a/drivers/net/Makefile
> > +++ b/drivers/net/Makefile
> > @@ -83,3 +83,4 @@ obj-y += mscc_eswitch/
> >  obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o
> >  obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o
> >  obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o fsl_enetc_mdio.o
> > +obj-$(CONFIG_FSL_LS_MDIO) += fsl_ls_mdio.o
> > diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c new
> > file mode 100644 index ..845c0ac1ffd8
> > --- /dev/null
> > +++ b/drivers/net/fsl_ls_mdio.c
> > @@ -0,0 +1,158 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright 2020 NXP
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
> 
> Is there a reason we have a special separate endian flag for this NIC instead 
> of
> using a platform config?
> 

The same MAC IP (mEMAC) is integrated in both gen 1 DPAA (FMan) and gen 2 DPAA 
(WRIOP - Wire Rate IO Processor) based SoCs but with different endianness 
settings.
For example, in DPAA2 it's integrated as little-endian while in DPAA1 based 
SoCs (even those that are ARM based) it’s integrated as big-endian.

This is why a different config is used and not directly the platform config.

> > +#define memac_out_32(a, v) out_le32(a, v)
> > +#define memac_clrbits_32(a, v) clrbits_le32(a, v) #define
> > +memac_setbits_32(a, v) setbits_le32(a, v) #else
> > +#define memac_out_32(a, v) out_be32(a, v)
> > +#define memac_clrbits_32(a, v) clrbits_be32(a, v) #define
> > +memac_setbits_32(a, v) setbits_be32(a, v) #endif
> > +
> > +static u32 memac_in_32(u32 *reg)
> > +{
> > +#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
> > +   return in_le32(reg);
> > +#else
> > +   return in_be32(reg);
> > +#endif
> > +}
> > +
> > +struct fsl_ls_mdio_priv {
> > +   void *regs_base;
> > +};
> > +
> > +static int dm_fsl_ls_mdio_read(struct udevice *dev, int addr,
> > +  int devad, int reg) {
> > +   struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
> > +   struct memac_mdio_controller *regs;
> > +   u32 mdio_ctl;
> > +   u32 c45 = 1;
> > +
> > +   regs = (struct memac_mdio_controller *)(priv->regs_base);
> > +   if (devad == MDIO_DEVAD_NONE) {
> > +   c45 = 0; /* clause 22 */
> > +   devad = reg & 0x1f;
> > +   memac_clrbits_32(>mdio_stat, MDIO_STAT_ENC);
> > +   } else {
> > +   memac_setbits_32(>mdio_stat, MDIO_STAT_ENC);
> > +   }
> > +
> > +   /* Wait till the bus is free */
> > +   while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
> > +   ;
> > +
> > +   /* Set the Port and Device Addrs */
> > +   mdio_ctl = MDIO_CTL_PORT_ADDR(addr) |
> MDIO_CTL_DEV_ADDR(devad);
> > +   memac_out_32(>mdio_ctl, mdio_ctl);
> > +
> > +   /* Set the register address */
> > +   if (c45)
> > +   memac_out_32(>mdio_addr, reg & 0x);
> > +
> > +   /* Wait till the bus is free */
> > +   while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
> > +   ;
> > +
> > +   /* Initiate the read */
> > +   mdio_ctl |= MDIO_CTL_READ;
> > +   memac_out_32(>mdio_ctl, mdio_ctl);
> > +
> > +   /* Wait till the MDIO write is complete */
> > +   while ((memac_in_32(>mdio_data)) & MDIO_DATA_BSY)
> > +   ;
> > +
> > +   /* Return all Fs if nothing was there */
> > +   if (memac_in_32(>mdio_stat) & MDIO_STAT_RD_ER)
> > +   return 0x;
> > +
> > +   return memac_in_32(>mdio_data) & 0x;
> > +   return 0;
> > +}
> > +
> > +static int dm_fsl_ls_mdio_write(struct udevice *dev, int addr, int devad,
> > +

[PATCH v2 13/14] configs: ls2088ardb: enable CONFIG_DM_ETH and related

2020-03-18 Thread Ioana Ciornei
Enable CONFIG_DM_ETH and CONFIG_DM_MDIO and related configs for the
LS2088ARDB board.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig | 4 
 configs/ls2088ardb_qspi_defconfig | 4 
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig  | 4 
 configs/ls2088ardb_tfa_defconfig  | 4 
 4 files changed, 16 insertions(+)

diff --git a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig 
b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
index ae4a6820ff62..56e6c21163aa 100644
--- a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
@@ -16,6 +16,7 @@ CONFIG_BOOTDELAY=10
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -39,8 +40,11 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls2088ardb_qspi_defconfig 
b/configs/ls2088ardb_qspi_defconfig
index 1ad5f3b367e6..5cba149821b0 100644
--- a/configs/ls2088ardb_qspi_defconfig
+++ b/configs/ls2088ardb_qspi_defconfig
@@ -19,6 +19,7 @@ CONFIG_BOOTARGS="console=ttyS1,115200 root=/dev/ram0 
earlycon=uart8250,mmio,0x21
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -45,8 +46,11 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
index c0d0a99c8ad5..5a4edd88ae0d 100644
--- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
@@ -22,6 +22,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_CMD_IMLS=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -54,8 +55,11 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index ccbaaf7a5c6e..670bb5299af9 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -23,6 +23,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_CMD_IMLS=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -62,8 +63,11 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_CORTINA=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
-- 
2.17.1



[PATCH v2 12/14] configs: ls1088ardb: enable CONFIG_DM_ETH and related

2020-03-18 Thread Ioana Ciornei
Enable CONFIG_DM_ETH and CONFIG_DM_MDIO and related configs for the
LS1088ARDB board.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 configs/ls1088ardb_qspi_SECURE_BOOT_defconfig| 5 +
 configs/ls1088ardb_qspi_defconfig| 5 +
 configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig | 5 +
 configs/ls1088ardb_sdcard_qspi_defconfig | 5 +
 configs/ls1088ardb_tfa_SECURE_BOOT_defconfig | 5 +
 configs/ls1088ardb_tfa_defconfig | 5 +
 include/configs/ls1088ardb.h | 2 ++
 7 files changed, 32 insertions(+)

diff --git a/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig 
b/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
index 3f654e2e1d0c..4d98b41ec11f 100644
--- a/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
@@ -21,6 +21,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -40,8 +41,12 @@ CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls1088ardb_qspi_defconfig 
b/configs/ls1088ardb_qspi_defconfig
index 935d76b4bed9..94593984d902 100644
--- a/configs/ls1088ardb_qspi_defconfig
+++ b/configs/ls1088ardb_qspi_defconfig
@@ -22,6 +22,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -43,8 +44,12 @@ CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig 
b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
index 562cbdd3abd3..b2a61b76d96f 100644
--- a/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -52,8 +53,12 @@ CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls1088ardb_sdcard_qspi_defconfig 
b/configs/ls1088ardb_sdcard_qspi_defconfig
index 1e6fdceca1e0..728611f6dd52 100644
--- a/configs/ls1088ardb_sdcard_qspi_defconfig
+++ b/configs/ls1088ardb_sdcard_qspi_defconfig
@@ -32,6 +32,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -53,8 +54,12 @@ CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig
index 0086039e5241..53641703cb6f 100644
--- a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig
@@ -24,6 +24,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -47,8 +48,12 @@ CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/ls1088ardb_tfa_defconfig b/configs/ls1088ardb_tfa_defconfig
index a7908e95b5c0..211ae7717104 100644
--- a/configs/ls1088ardb_tfa_defconfig
+++ b/configs/ls1088ardb_tfa_defconfig
@@ -25,6 +25,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -52,8 +53,12 @@ CONFIG_DM_SPI_FLASH=y
 # CONFIG_SPI_FLASH_BAR is not set
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
+CONFIG_FSL_LS_MDIO=y
 

[PATCH v2 10/14] arm: dts: ls2088ardb: add DPMAC and PHY nodes

2020-03-18 Thread Ioana Ciornei
In order to maintain compatibility with the Linux DTS, the entire fsl-mc
node is added but instead of being probed by a dedicated bus driver it
will be a simple-mfd.

Also, annotate the external MDIO nodes and describe the PHYs (4 x AQR405
and 4 x CS4340). Also, add phy-handles for the dpmacs to their
associated PHY.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 arch/arm/dts/fsl-ls2080a.dtsi | 75 +--
 arch/arm/dts/fsl-ls2088a-rdb-qspi.dts | 88 +++
 2 files changed, 157 insertions(+), 6 deletions(-)

diff --git a/arch/arm/dts/fsl-ls2080a.dtsi b/arch/arm/dts/fsl-ls2080a.dtsi
index 7ff854caecd5..fb5777e268e4 100644
--- a/arch/arm/dts/fsl-ls2080a.dtsi
+++ b/arch/arm/dts/fsl-ls2080a.dtsi
@@ -50,12 +50,6 @@
interrupts = <0 32 0x1>; /* edge triggered */
};
 
-   fsl_mc: fsl-mc@80c00 {
-   compatible = "fsl,qoriq-mc";
-   reg = <0x0008 0x0c00 0 0x40>,/* MC portal base */
- <0x 0x0834 0 0x4>; /* MC control reg */
-   };
-
i2c0: i2c@200 {
status = "disabled";
compatible = "fsl,vf610-i2c";
@@ -200,6 +194,75 @@
status = "disabled";
};
 
+   fsl_mc: fsl-mc@80c00 {
+   compatible = "fsl,qoriq-mc", "simple-mfd";
+   reg = <0x0008 0x0c00 0 0x40>,/* MC portal base */
+ <0x 0x0834 0 0x4>; /* MC control reg */
+   #address-cells = <3>;
+   #size-cells = <1>;
+
+   /*
+* Region type 0x0 - MC portals
+* Region type 0x1 - QBMAN portals
+*/
+   ranges = <0x0 0x0 0x0 0x8 0x0c00 0x400
+   0x1 0x0 0x0 0x8 0x1800 0x800>;
+
+   dpmacs {
+   compatible = "simple-mfd";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dpmac1: dpmac@1 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x1>;
+   status = "disabled";
+   };
+
+   dpmac2: dpmac@2 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x2>;
+   status = "disabled";
+   };
+
+   dpmac3: dpmac@3 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x3>;
+   status = "disabled";
+   };
+
+   dpmac4: dpmac@4 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x4>;
+   status = "disabled";
+   };
+
+   dpmac5: dpmac@5 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x5>;
+   status = "disabled";
+   };
+
+   dpmac6: dpmac@6 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x6>;
+   status = "disabled";
+   };
+
+   dpmac7: dpmac@7 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x7>;
+   status = "disabled";
+   };
+
+   dpmac8: dpmac@8 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x8>;
+   status = "disabled";
+   };
+   };
+   };
+
emdio1: mdio@8B96000 {
compatible = "fsl,ls-mdio";
reg = <0x0 0x8B96000 0x0 0x1000>;
diff --git a/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts 
b/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts
index 72b2177b70d9..16b9aeec966c 100644
--- a/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts
+++ b/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts
@@ -21,6 +21,94 @@
};
 };
 
+ {
+   status = "okay";
+   phy-handle = <_phy1>;
+   phy-connection-type = "xfi";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy2>;
+   phy-connection-type = "xfi";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy3>;
+   phy-connection-type = "xfi";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy4>;
+   phy-connection-type = "xfi";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy1>;
+   phy-connection-type = "xfi";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy2>;
+   phy-connection-type = "xfi";
+};
+
+ {
+   status = "okay";
+   

[PATCH v2 08/14] arm: dts: ls1088a: add external MDIO nodes

2020-03-18 Thread Ioana Ciornei
Add the External MDIO1 device node found in the WRIOP global memory
region. This is needed for management of external PHYs.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 arch/arm/dts/fsl-ls1088a.dtsi | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi
index abc8b21a112e..314961685070 100644
--- a/arch/arm/dts/fsl-ls1088a.dtsi
+++ b/arch/arm/dts/fsl-ls1088a.dtsi
@@ -197,4 +197,19 @@
method = "smc";
};
 
+   emdio1: mdio@8B96000 {
+   compatible = "fsl,ls-mdio";
+   reg = <0x0 0x8B96000 0x0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
+
+   emdio2: mdio@8B97000 {
+   compatible = "fsl,ls-mdio";
+   reg = <0x0 0x8B97000 0x0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
 };
-- 
2.17.1



Re: [RFC RFT PATCH] env: spl: filter the variables in default environment of SPL or TPL

2020-03-18 Thread Wolfgang Denk
Dear Patrick,

In message <20200318143602.23253-1-patrick.delau...@st.com> you wrote:
> Use a new option CONFIG_SPL_ENV_VARS to filter the variables included
> in the default environment used in SPL (and TPL).
>
> That allows to reduce the size of default_environment[].

Sorry, but NAK.  we had this discussion a couple of times before.
It is mandatory that both SPL and U-Boot proper will use the _same_
environment, including the same default environment, or all kind of
havoc may result.  Just think of situations where Falcon Mode is
being used and SPL and U-Boot proper would be using different
settings.

If your default environment is too big for the SPL, then make it
smaller.  If you need additional settings in U-Boot, there are many
ways to load thise there.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"If that makes any sense to you, you have a big problem."
  -- C. Durance, Computer Science 234


[PATCH v2 11/14] arm: dts: ls1088ardb: add DPMAC and PHY nodes

2020-03-18 Thread Ioana Ciornei
In order to maintain compatibility with the Linux DTS, the entire fsl-mc
node is added but instead of being probed by a dedicated bus driver it
will be a simple-mfd.

Also, annotate the external MDIO nodes and describe the PHYs (8 x
VSC8514, AQR105). Also, add phy-handles for the dpmacs to their
associated PHY.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 arch/arm/dts/fsl-ls1088a-rdb.dts | 102 +++
 arch/arm/dts/fsl-ls1088a.dtsi|  87 --
 2 files changed, 183 insertions(+), 6 deletions(-)

diff --git a/arch/arm/dts/fsl-ls1088a-rdb.dts b/arch/arm/dts/fsl-ls1088a-rdb.dts
index 0fe351973dc5..46a5780547fe 100644
--- a/arch/arm/dts/fsl-ls1088a-rdb.dts
+++ b/arch/arm/dts/fsl-ls1088a-rdb.dts
@@ -17,6 +17,108 @@
};
 };
 
+ {
+   status = "okay";
+   phy-connection-type = "xgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy1>;
+   phy-connection-type = "xgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy5>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy6>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy7>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy8>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy1>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy2>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy3>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy4>;
+   phy-connection-type = "qsgmii";
+};
+
+ {
+   status = "okay";
+
+   /* Freescale F104 PHY1 */
+   mdio1_phy1: emdio1_phy@1 {
+   reg = <0x1c>;
+   };
+   mdio1_phy2: emdio1_phy@2 {
+   reg = <0x1d>;
+   };
+   mdio1_phy3: emdio1_phy@3 {
+   reg = <0x1e>;
+   };
+   mdio1_phy4: emdio1_phy@4 {
+   reg = <0x1f>;
+   };
+
+   /* F104 PHY2 */
+   mdio1_phy5: emdio1_phy@5 {
+   reg = <0x0c>;
+   };
+   mdio1_phy6: emdio1_phy@6 {
+   reg = <0x0d>;
+   };
+   mdio1_phy7: emdio1_phy@7 {
+   reg = <0x0e>;
+   };
+   mdio1_phy8: emdio1_phy@8 {
+   reg = <0x0f>;
+   };
+};
+
+ {
+   status = "okay";
+
+   /* Aquantia AQR105 10G PHY */
+   mdio2_phy1: emdio2_phy@1 {
+   compatible = "ethernet-phy-ieee802.3-c45";
+   interrupts = <0 2 0x4>;
+   reg = <0x0>;
+   };
+};
+
  {
status = "okay";
u-boot,dm-pre-reloc;
diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi
index 314961685070..133cacb93e39 100644
--- a/arch/arm/dts/fsl-ls1088a.dtsi
+++ b/arch/arm/dts/fsl-ls1088a.dtsi
@@ -82,12 +82,6 @@
interrupts = <0 32 0x1>; /* edge triggered */
};
 
-   fsl_mc: fsl-mc@80c00 {
-   compatible = "fsl,qoriq-mc";
-   reg = <0x0008 0x0c00 0 0x40>,/* MC portal base */
- <0x 0x0834 0 0x4>; /* MC control reg */
-   };
-
dspi: dspi@210 {
compatible = "fsl,vf610-dspi";
#address-cells = <1>;
@@ -197,6 +191,87 @@
method = "smc";
};
 
+   fsl_mc: fsl-mc@80c00 {
+   compatible = "fsl,qoriq-mc", "simple-mfd";
+   reg = <0x0008 0x0c00 0 0x40>,/* MC portal base */
+ <0x 0x0834 0 0x4>; /* MC control reg */
+   #address-cells = <3>;
+   #size-cells = <1>;
+
+   /*
+* Region type 0x0 - MC portals
+* Region type 0x1 - QBMAN portals
+*/
+   ranges = <0x0 0x0 0x0 0x8 0x0c00 0x400
+ 0x1 0x0 0x0 0x8 0x1800 0x800>;
+
+   dpmacs {
+   compatible = "simple-mfd";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dpmac1: dpmac@1 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x1>;
+   status = "disabled";
+   };
+
+   dpmac2: dpmac@2 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x2>;
+   status = "disabled";
+   };
+
+   dpmac3: dpmac@3 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x3>;
+   status = 

RE: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access flash memory as per spi-mem

2020-03-18 Thread Kuldeep Singh



> -Original Message-
> From: Priyanka Jain (OSS) 
> Sent: Wednesday, March 18, 2020 4:03 PM
> To: Kuldeep Singh ; u-boot@lists.denx.de
> Cc: Kuldeep Singh 
> Subject: RE: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command
> access flash memory as per spi-mem
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Kuldeep
> Singh
> >Sent: Wednesday, March 18, 2020 11:57 AM
> >To: Priyanka Jain ; u-boot@lists.denx.de
> >Cc: Kuldeep Singh 
> >Subject: [Patch v3 2/2] configs: ls2080ardb: Make BOOT command access
> >flash memory as per spi-mem
> >
> >BOOT command currently access spi-nor flash memory directly. As per
> >spi- mem framework, flash memory access via absolute addresses is no
> >more possible.
> >Use flash APIs to access memory instead of directly using it.
> >
> >Signed-off-by: Kuldeep Singh 
> >---
> >v3:
> >-Rebase
> >
> >v2:
> >-Rebase to top
> >-Reword commit message
> >
> > include/configs/ls2080ardb.h | 14 ++
> > 1 file changed, 10 insertions(+), 4 deletions(-)
> >
> >diff --git a/include/configs/ls2080ardb.h
> >b/include/configs/ls2080ardb.h index
> >d36e928..b8e5dd3 100644
> >--- a/include/configs/ls2080ardb.h
> >+++ b/include/configs/ls2080ardb.h
> >@@ -508,10 +508,13 @@ unsigned long get_board_sys_clk(void);
> >
> > #ifdef CONFIG_TFABOOT
> > #define QSPI_NOR_BOOTCOMMAND
> > \
> >+"sf probe 0:0; "\
> >+"sf read 0x806c 0x6c 0x4; "
> > \
> > "env exists mcinitcmd && env exists secureboot "\
> >-"&& esbc_validate 0x206C; "
> > \
> >+"&& esbc_validate 0x806c; "
> > \
> >+"sf read 0x80d0 0xd0 0x10; "\
> > "env exists mcinitcmd && "  \
> >-"fsl_mc lazyapply dpl 0x20d0; " \
> >+"fsl_mc lazyapply dpl 0x80d0; " \
> > "run distro_bootcmd;run qspi_bootcmd; "
> > \
> > "env exists secureboot && esbc_halt;"
> >
> >@@ -538,10 +541,13 @@ unsigned long get_board_sys_clk(void);  #ifdef
> >CONFIG_QSPI_BOOT
> > /* Try to boot an on-QSPI kernel first, then do normal distro boot */
> >#define CONFIG_BOOTCOMMAND
> > \
> >+"sf probe 0:0; "\
> >+"sf read 0x806c 0x6c 0x4; "
> > \
> > "env exists mcinitcmd && env exists secureboot "\
> >-"&& esbc_validate 0x206C; "
> > \
> >+"&& esbc_validate 0x806C; "
> > \
> >+"sf read 0x80d0 0xd0 0x10; "\
> > "env exists mcinitcmd && "  \
> >-"fsl_mc lazyapply dpl 0x20d0; " \
> >+"fsl_mc lazyapply dpl 0x80d0; " \
> > "run distro_bootcmd;run qspi_bootcmd; "
> > \
> > "env exists secureboot && esbc_halt;"
> > #elif defined(CONFIG_SD_BOOT)
> >--
> >2.7.4
> Same comment as previous, please provide testing status for both secure
> and non-secure boot

These 2 patches are valid when new qspi driver is accepted.
i.e depends on https://patchwork.ozlabs.org/project/uboot/list/?series=159796

Moreover, I will give you status/logs for both secure and non-secure boot.

Thanks
Kuldeep
 

> Regards
> Priyanka



[PATCH v2 03/14] drivers: net: fsl-mc: add support for CONFIG_DM_ETH

2020-03-18 Thread Ioana Ciornei
Make any adjustments necessary in order to support DPAA2 devices probed
using CONFIG_DM_ETH. While at it, fixup some styling issues aroung the
switch-case statement.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 drivers/net/fsl-mc/mc.c | 48 ++---
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 07bbcc9b2311..fee372968a38 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -174,9 +174,21 @@ enum mc_fixup_type {
 };
 
 static int mc_fixup_mac_addr(void *blob, int nodeoffset,
+#ifdef CONFIG_DM_ETH
+const char *propname, struct udevice *eth_dev,
+#else
 const char *propname, struct eth_device *eth_dev,
+#endif
 enum mc_fixup_type type)
 {
+#ifdef CONFIG_DM_ETH
+   struct eth_pdata *plat = dev_get_platdata(eth_dev);
+   unsigned char *enetaddr = plat->enetaddr;
+   int eth_index = eth_dev->seq;
+#else
+   unsigned char *enetaddr = eth_dev->enetaddr;
+   int eth_index = eth_dev->index;
+#endif
int err = 0, len = 0, size, i;
unsigned char env_enetaddr[ARP_HLEN];
unsigned int enetaddr_32[ARP_HLEN];
@@ -184,23 +196,22 @@ static int mc_fixup_mac_addr(void *blob, int nodeoffset,
 
switch (type) {
case MC_FIXUP_DPL:
-   /* DPL likes its addresses on 32 * ARP_HLEN bits */
-   for (i = 0; i < ARP_HLEN; i++)
-   enetaddr_32[i] = cpu_to_fdt32(eth_dev->enetaddr[i]);
-   val = enetaddr_32;
-   len = sizeof(enetaddr_32);
-   break;
-
+   /* DPL likes its addresses on 32 * ARP_HLEN bits */
+   for (i = 0; i < ARP_HLEN; i++)
+   enetaddr_32[i] = cpu_to_fdt32(enetaddr[i]);
+   val = enetaddr_32;
+   len = sizeof(enetaddr_32);
+   break;
case MC_FIXUP_DPC:
-   val = eth_dev->enetaddr;
-   len = ARP_HLEN;
-   break;
+   val = enetaddr;
+   len = ARP_HLEN;
+   break;
}
 
/* MAC address property present */
if (fdt_get_property(blob, nodeoffset, propname, NULL)) {
/* u-boot MAC addr randomly assigned - leave the present one */
-   if (!eth_env_get_enetaddr_by_index("eth", eth_dev->index,
+   if (!eth_env_get_enetaddr_by_index("eth", eth_index,
   env_enetaddr))
return err;
} else {
@@ -250,7 +261,11 @@ const char *dpl_get_connection_endpoint(void *blob, char 
*endpoint)
 }
 
 static int mc_fixup_dpl_mac_addr(void *blob, int dpmac_id,
+#ifdef CONFIG_DM_ETH
+struct udevice *eth_dev)
+#else
 struct eth_device *eth_dev)
+#endif
 {
int objoff = fdt_path_offset(blob, "/objects");
int dpmacoff = -1, dpnioff = -1;
@@ -334,7 +349,11 @@ void fdt_fsl_mc_fixup_iommu_map_entry(void *blob)
 }
 
 static int mc_fixup_dpc_mac_addr(void *blob, int dpmac_id,
+#ifdef CONFIG_DM_ETH
+struct udevice *eth_dev)
+#else
 struct eth_device *eth_dev)
+#endif
 {
int nodeoffset = fdt_path_offset(blob, "/board_info/ports"), noff;
int err = 0;
@@ -377,8 +396,13 @@ static int mc_fixup_dpc_mac_addr(void *blob, int dpmac_id,
 static int mc_fixup_mac_addrs(void *blob, enum mc_fixup_type type)
 {
int i, err = 0, ret = 0;
-   char ethname[ETH_NAME_LEN];
+#ifdef CONFIG_DM_ETH
+#define ETH_NAME_LEN 20
+   struct udevice *eth_dev;
+#else
struct eth_device *eth_dev;
+#endif
+   char ethname[ETH_NAME_LEN];
 
for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++) {
/* port not enabled */
-- 
2.17.1



[PATCH v2 06/14] arm: dts: lx2160a: add external MDIO nodes

2020-03-18 Thread Ioana Ciornei
Add the External MDIO device nodes found in the WRIOP global memory
region. This is needed for management of external PHYs.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 arch/arm/dts/fsl-lx2160a.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/dts/fsl-lx2160a.dtsi b/arch/arm/dts/fsl-lx2160a.dtsi
index 42ce4379eceb..15f18bc4a5f7 100644
--- a/arch/arm/dts/fsl-lx2160a.dtsi
+++ b/arch/arm/dts/fsl-lx2160a.dtsi
@@ -363,4 +363,24 @@
bus-range = <0x0 0xff>;
ranges = <0x8200 0x0 0x4000 0xa8 0x4000 0x0 
0x4000>;
};
+
+   /* WRIOP0: 0x8b8_, E-MDIO1: 0x1_6000 */
+   emdio1: mdio@8b96000 {
+   compatible = "fsl,ls-mdio";
+   reg = <0x0 0x8b96000 0x0 0x1000>;
+   interrupts = ;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
+
+   /* WRIOP0: 0x8b8_, E-MDIO2: 0x1_7000 */
+   emdio2: mdio@8b97000 {
+   compatible = "fsl,ls-mdio";
+   reg = <0x0 0x8b97000 0x0 0x1000>;
+   interrupts = ;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
 };
-- 
2.17.1



RE: [Patch v3 1/3] mtd: spi-nor-ids: Enable SPI_NOR_OCTAL_READ flag for mt35xu*

2020-03-18 Thread Priyanka Jain (OSS)
>-Original Message-
>From: U-Boot  On Behalf Of Kuldeep Singh
>Sent: Saturday, March 14, 2020 6:24 PM
>To: Priyanka Jain ; Jagan Teki
>; Vignesh R ; u-
>b...@lists.denx.de
>Cc: Kuldeep Singh 
>Subject: [Patch v3 1/3] mtd: spi-nor-ids: Enable SPI_NOR_OCTAL_READ flag for
>mt35xu*
>
>Commit 658df8bd9464 ("mtd: spi-nor-core: Add octal mode support") enables
>octal mode(1-1-8) support in spi-nor framework.
>
>mt35xu512aba and mt35xu02g supports SINGLE and OCTAL I/O. Hence,
>enable SPI_NOR_OCTAL_READ flag for these flashes.
>
>Signed-off-by: Kuldeep Singh 
>Reviewed-by: Vignesh Raghavendra 
>---
>v3: No change
>v2: Reword commit message
>
> drivers/mtd/spi/spi-nor-ids.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c 
>index
>973b6f8..334c074 100644
>--- a/drivers/mtd/spi/spi-nor-ids.c
>+++ b/drivers/mtd/spi/spi-nor-ids.c
>@@ -182,8 +182,8 @@ const struct flash_info spi_nor_ids[] = {
>   { INFO("n25q00",  0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR
>| SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
>   { INFO("n25q00a", 0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR
>| SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
>   { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K |
>USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
>-  { INFO("mt35xu512aba", 0x2c5b1a, 0,  128 * 1024,  512, USE_FSR |
>SPI_NOR_4B_OPCODES) },
>-  { INFO("mt35xu02g",  0x2c5b1c, 0, 128 * 1024,  2048, USE_FSR |
>SPI_NOR_4B_OPCODES) },
>+  { INFO("mt35xu512aba", 0x2c5b1a, 0,  128 * 1024,  512, USE_FSR |
>SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) },
>+  { INFO("mt35xu02g",  0x2c5b1c, 0, 128 * 1024,  2048, USE_FSR |
>+SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) },
> #endif
> #ifdef CONFIG_SPI_FLASH_SPANSION  /* SPANSION */
>   /* Spansion/Cypress -- single (large) sector size only, at least
>--
>2.7.4
Reviewed-by: Priyanka Jain 
Jagan,

Please help to pick this patch or provide ack.

Thanks
Priyanka


U-CLASS SPI Bus and Devices

2020-03-18 Thread Rudolf J Streif
I ran into an issue today with a U-CLASS SPI NOR flash device on a NXP
FlexSPI controller. U-Boot started correctly from the flash device but
using 'sf probe 0:0' would always return 'Invalid bus 0 (err=-19)'. This
error message is emitted by spi_get_bus_and_cs() in
drivers/spi/spi-uclass.c. I traced the issue to
uclass_get_device_by_seq() in drivers/core/uclass.c.

The function first searches the device list for a device that already
claimed the sequence number (dev->seq). If not found it would look if a
device requested that sequence number (dev->seq_req). That would always
fail for my device. The bus had not been probed yet and hence dev->seq
was -1 and the device also had dev->req_seq set to -1.

The board is using a device tree hence it would only make sense to set
the requested sequence number via the device tree. However, there is no
such thing and even if there was it might not be specified.

Consequently, the device was never probed although the driver was
correctly set up via device tree.

I worked around it by simply setting dev->req_seq of the first device
that had it set to -1 to the sequence number the search function was
looking for (see patch below). It solved my problem but I don't know if
that is the right way of addressing it. I could not find any other
solution for this particular problem anywhere.

Rudi



From 0f05ab964fcc7d29d8d467e663d7daa72328cf66 Mon Sep 17 00:00:00 2001
From: Rudolf J Streif 
Date: Tue, 17 Mar 2020 17:13:07 -0700
Subject: [PATCH] Fix issue with SPI device sequence number

If the requested sequence number for a SPI device was -1 (any)
then the device would never be probed. This fix simply assigns
the sequence number asked for at probing to the device if it has
not been probed yet and the requested sequence number is -1.

Signed-off-by: Rudolf J Streif 
---
 drivers/core/uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index fc3157de39..e791103153 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -310,6 +310,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int
seq_or_req_seq,

    uclass_foreach_dev(dev, uc) {
    debug("   - %d %d '%s'\n", dev->req_seq, dev->seq,
dev->name);
+   if (find_req_seq && dev->req_seq == -1)
+   dev->req_seq = seq_or_req_seq;
    if ((find_req_seq ? dev->req_seq : dev->seq) ==
    seq_or_req_seq) {
    *devp = dev;
-- 
2.23.0





signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/5] t210: do not enable PLLE and UPHY PLL HW PWRSEQ

2020-03-18 Thread JC Kuo
Please refer to "Notes" section in p1337 of Tegra_X1_TRM_DP07225001_v1.3p.pdf.
There are some implementation considerations for boot software.

Thanks,
JC

On 3/18/20 1:44 AM, Tom Warren wrote:
> -Original Message-
> From: Stephen Warren  
> Sent: Tuesday, March 17, 2020 10:30 AM
> To: Tom Warren 
> Cc: u-boot@lists.denx.de; Jui Chang Kuo 
> Subject: Re: [PATCH 2/5] t210: do not enable PLLE and UPHY PLL HW PWRSEQ
> 
> External email: Use caution opening links or attachments
> 
> 
> On 3/16/20 1:40 PM, twar...@nvidia.com wrote:
>> From: JC Kuo 
>>
>> This commit removes the programming sequence that enables PLLE and 
>> UPHY PLL hardware power sequencers. Per TRM, boot software should 
>> enable PLLE and UPHY PLLs in software controlled power-on state and 
>> should power down PLL before jumping into kernel or the next stage boot 
>> software.
>>
>> Adds call to board_cleanup_before_linux to facilitate this.
> 
> This directly contradicts what's in Tegra_X1_TRM_DP07225001_v1.3p.pdf,
> pages 1340/1341, which is what the code currently implements. Was a newer 
> internal-only TRM published that changed the recommended programming flow?
> [Tom] JC wrote this, I'll let him answer, but I'll check my TRM to see what 
> the most recent version is. This code is exactly what we have in downstream 
> T210 U-Boot.
> 

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver

2020-03-18 Thread Ioana Ciornei
> Subject: RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver
> 
> >-Original Message-
> >From: U-Boot  On Behalf Of Ioana Ciornei
> >Sent: Thursday, March 12, 2020 9:36 PM
> >To: Priyanka Jain ; joe.hershber...@ni.com; u-
> >b...@lists.denx.de
> >Cc: Florin Laurentiu Chiculita ;
> >Madalin Bucur (OSS) ; Ioana Ciornei
> >
> >Subject: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver
> >
> >Add a driver for the MDIO interface integrated in the mEMAC (Multi-rate
> >Ethernet Media Access Controller) and the Fman 10G Ethernet MACs.
> >
> >Signed-off-by: Ioana Ciornei 
> >---
> > drivers/net/Kconfig   |   7 ++
> > drivers/net/Makefile  |   1 +
> > drivers/net/fsl_ls_mdio.c | 158 ++
> > 3 files changed, 166 insertions(+)
> > create mode 100644 drivers/net/fsl_ls_mdio.c
> >
> >diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
> >4d1013c98466..bc518f218da6 100644
> >--- a/drivers/net/Kconfig
> >+++ b/drivers/net/Kconfig
> >@@ -640,4 +640,11 @@ config MVMDIO
> >
> >   This driver is used by the MVPP2 and MVNETA drivers.
> >
> >+config FSL_LS_MDIO
> Please use prefix NXP for new configs
> >+bool "NXP Layerscape MDIO interface support"
> >+depends on DM_MDIO
> >+help
> >+  This driver supports the MDIO bus found on the Fman 10G Ethernet
> >MACs and
> >+  on the mEMAC (which supports both Clauses 22 and 45).
> >+
> > endif # NETDEVICES
> >diff --git a/drivers/net/Makefile b/drivers/net/Makefile index
> >6e0a68834d97..6d9b8772b1a5 100644
> >--- a/drivers/net/Makefile
> >+++ b/drivers/net/Makefile
> >@@ -83,3 +83,4 @@ obj-y += mscc_eswitch/
> > obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o
> > obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o
> > obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o fsl_enetc_mdio.o
> >+obj-$(CONFIG_FSL_LS_MDIO) += fsl_ls_mdio.o
> >diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c new
> >file mode
> >100644 index ..845c0ac1ffd8
> >--- /dev/null
> >+++ b/drivers/net/fsl_ls_mdio.c
> >@@ -0,0 +1,158 @@
> >+// SPDX-License-Identifier: GPL-2.0+
> >+/*
> >+ * Copyright 2020 NXP
> >+ */
> >+
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+#include 
> >+
> >+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
> >+#define memac_out_32(a, v)  out_le32(a, v)
> >+#define memac_clrbits_32(a, v)  clrbits_le32(a, v)
> >+#define memac_setbits_32(a, v)  setbits_le32(a, v)
> >+#else
> >+#define memac_out_32(a, v)  out_be32(a, v)
> >+#define memac_clrbits_32(a, v)  clrbits_be32(a, v)
> >+#define memac_setbits_32(a, v)  setbits_be32(a, v)
> >+#endif
> >+
> >+static u32 memac_in_32(u32 *reg)
> >+{
> >+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
> >+return in_le32(reg);
> >+#else
> >+return in_be32(reg);
> >+#endif
> >+}
> >+
> >+struct fsl_ls_mdio_priv {
> >+void *regs_base;
> >+};
> >+
> >+static int dm_fsl_ls_mdio_read(struct udevice *dev, int addr,
> >+   int devad, int reg)
> >+{
> >+struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
> >+struct memac_mdio_controller *regs;
> >+u32 mdio_ctl;
> >+u32 c45 = 1;
> >+
> >+regs = (struct memac_mdio_controller *)(priv->regs_base);
> >+if (devad == MDIO_DEVAD_NONE) {
> >+c45 = 0; /* clause 22 */
> >+devad = reg & 0x1f;
>
> I don't see devad getting used in below code.
>

It it used below in setting up the port and device address.
Below is the exact snippet:

+   mdio_ctl = MDIO_CTL_PORT_ADDR(addr) | MDIO_CTL_DEV_ADDR(devad);
+   memac_out_32(>mdio_ctl, mdio_ctl);

> >+memac_clrbits_32(>mdio_stat, MDIO_STAT_ENC);
> >+} else {
> >+memac_setbits_32(>mdio_stat, MDIO_STAT_ENC);
> >+}
> >+
> >+/* Wait till the bus is free */
> >+while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
> >+;
> >+
> >+/* Set the Port and Device Addrs */
> >+mdio_ctl = MDIO_CTL_PORT_ADDR(addr) |
> >MDIO_CTL_DEV_ADDR(devad);
> >+memac_out_32(>mdio_ctl, mdio_ctl);
> >+
> >+/* Set the register address */
> >+if (c45)
> >+memac_out_32(>mdio_addr, reg & 0x);
> >+
> >+/* Wait till the bus is free */
> >+while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
> >+;
> >+
> >+/* Initiate the read */
> >+mdio_ctl |= MDIO_CTL_READ;
> >+memac_out_32(>mdio_ctl, mdio_ctl);
> >+
> >+/* Wait till the MDIO write is complete */
> >+while ((memac_in_32(>mdio_data)) & MDIO_DATA_BSY)
> >+;
> >+
> >+/* Return all Fs if nothing was there */
> >+if (memac_in_32(>mdio_stat) & MDIO_STAT_RD_ER)
> >+return 0x;
> >+
> >+return memac_in_32(>mdio_data) & 0x;
> >+return 0;
> >+}
> >+
> >+static int dm_fsl_ls_mdio_write(struct udevice *dev, int addr, int devad,
> >+int reg, u16 val)
> >+{
> >+struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
> >+struct memac_mdio_controller *regs;
> >+u32 

[PATCH] dlmalloc: Add an option to default malloc to init

2020-03-18 Thread marek . bykowski
From: Marek Bykowski 

If a system wants the malloc to get moved around from one to another
memory range it should call mem_malloc_init() with the updated memory
ranges. However setting aside the new memory alone isn't enough.
It should also bring the bins and static bookkeeping data to init.

One of the use cases could be SPL U-Boot that allocates first to
the (limited) static memory and then when needs more memory, and
the DDR memory becomes available, moves the pools around.

Note that defaulting the malloc to init discards all the memory
previously allocated.

Signed-off-by: Marek Bykowski 
---
 Kconfig   | 14 ++
 common/dlmalloc.c | 41 ++---
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/Kconfig b/Kconfig
index 1f0904f704..958553c90a 100644
--- a/Kconfig
+++ b/Kconfig
@@ -209,6 +209,20 @@ if EXPERT
  When disabling this, please check if malloc calls, maybe
  should be replaced by calloc - if one expects zeroed memory.
 
+config SYS_MALLOC_DEFAULT_TO_INIT
+   bool "Default malloc to init while reserving the memory for it"
+   default n
+   help
+ It may happen that one needs to move the dynamic allocation
+ from one to another memory range, eg. when moving the malloc
+ from the limited static to a potentially large dynamic (DDR)
+ memory.
+
+ If so then on top of setting the updated memory aside one
+ needs to bring the malloc init.
+
+ If such a scenario is sought choose yes.
+
 config TOOLS_DEBUG
bool "Enable debug information for tools"
help
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 6f12a18d54..8b2796e280 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -280,6 +280,7 @@ nextchunk-> 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space (may be 0 bytes long).
.   .
.   |
+
 nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 `foot:' | Size of chunk, in bytes   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -574,6 +575,10 @@ static void malloc_bin_reloc(void)
 static inline void malloc_bin_reloc(void) {}
 #endif
 
+#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
+static void malloc_init(void);
+#endif
+
 ulong mem_malloc_start = 0;
 ulong mem_malloc_end = 0;
 ulong mem_malloc_brk = 0;
@@ -604,6 +609,10 @@ void mem_malloc_init(ulong start, ulong size)
mem_malloc_end = start + size;
mem_malloc_brk = start;
 
+#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
+   malloc_init();
+#endif
+
debug("using memory %#lx-%#lx for malloc()\n", mem_malloc_start,
  mem_malloc_end);
 #ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT
@@ -708,7 +717,36 @@ static unsigned int max_n_mmaps = 0;
 static unsigned long max_mmapped_mem = 0;
 #endif
 
+#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
+static void malloc_init(void)
+{
+   int i, j;
+
+   debug("bins (av_ array) are at %p\n", (void *)av_);
+
+   av_[0] = NULL; av_[1] = NULL;
+   for (i = 2, j = 2; i < NAV * 2 + 2; i += 2, j++) {
+   av_[i] = bin_at(j - 2);
+   av_[i + 1] = bin_at(j - 2);
+
+   /* Just print the first few bins so that
+* we can see there are alright.
+*/
+   if (i < 10)
+   debug("av_[%d]=%lx av_[%d]=%lx\n",
+ i, (ulong)av_[i],
+ i + 1, (ulong)av_[i + 1]);
+   }
 
+   /* Init the static bookkeeping as well */
+   sbrk_base = (char *)(-1);
+   max_sbrked_mem = 0;
+   max_total_mem = 0;
+#ifdef DEBUG
+   memset((void *)_mallinfo, 0, sizeof(struct mallinfo));
+#endif
+}
+#endif
 
 /*
   Debugging support
@@ -1051,9 +1089,6 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; 
size_t new_size;
 
 #endif /* HAVE_MMAP */
 
-
-
-
 /*
   Extend the top-most chunk by obtaining memory from system.
   Main interface to sbrk (but see also malloc_trim).
-- 
2.21.0.896.g6a6c0f1



Re: [PATCH 3/3] cmd: dm: Fixed/Added DM driver listing subcommands

2020-03-18 Thread Tom Rini
On Wed, Mar 18, 2020 at 01:22:03PM +0100, Niel Fourie wrote:
> Hi Tom,
> 
> On 3/17/20 7:51 PM, Sean Anderson wrote:
> > On 3/17/20 10:09 AM, Niel Fourie wrote:
> > > Renamed dm "drivers" subcommand to "compat" (as it listed
> > > compatibility strings) and prevent it from segfaulting when
> > > drivers have no of_match populated.
> > > 
> > > Added a new "drivers" subcommand to dump a list of all known DM
> > > drivers and for each, their uclass id, uclass driver and names of
> > > attached devices.
> > > 
> > > Added a new "static" subcommand to dump a list of DM drivers with
> > > statically defined platform data.
> > > 
> > > Signed-off-by: Niel Fourie 
> > > CC: Simon Glass 
> > > ---
> > >   cmd/dm.c| 24 --
> > >   drivers/core/dump.c | 60 -
> > >   include/dm/util.h   |  6 +
> > >   3 files changed, 87 insertions(+), 3 deletions(-)
> > > 
> 
> In drivers/core/dump.c:
> > > -void dm_dump_drivers(void)
> > > +void dm_dump_driver_compat(void)
> > >   {
> > >   struct driver *d = ll_entry_start(struct driver, driver);
> > >   const int n_ents = ll_entry_count(struct driver, driver);
> > > @@ -107,6 +107,9 @@ void dm_dump_drivers(void)
> > >   puts("DriverCompatible\n");
> > >   puts("\n");
> > >   for (entry = d; entry < d + n_ents; entry++) {
> > > + if (!entry->of_match) {
> > > + continue;
> > > + }
> > 
> > This should have been fixed in version 2 of the patch [1].
> > 
> > [1] https://patchwork.ozlabs.org/patch/1234460/
> > 
> 
> Should I rebase my series on the version 2 of the above patch, or should I
> simply include that change in my series instead? Thanks in advance!

Please rebase on top of, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] image-fit: Allow loading FIT image for VxWorks

2020-03-18 Thread Bin Meng
From: Lihua Zhao 

This adds the check against IH_OS_VXWORKS during FIT image load,
to allow loading FIT image for VxWorks.

Signed-off-by: Lihua Zhao 
Signed-off-by: Bin Meng 
Reviewed-by: Bin Meng 
---

 common/image-fit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 4435bc4..6da69d2 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -2007,7 +2007,8 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
fit_image_check_os(fit, noffset, IH_OS_LINUX) ||
fit_image_check_os(fit, noffset, IH_OS_U_BOOT) ||
fit_image_check_os(fit, noffset, IH_OS_OPENRTOS) ||
-   fit_image_check_os(fit, noffset, IH_OS_EFI);
+   fit_image_check_os(fit, noffset, IH_OS_EFI) ||
+   fit_image_check_os(fit, noffset, IH_OS_VXWORKS);
 
/*
 * If either of the checks fail, we should report an error, but
-- 
2.7.4



RE: [PATCH v5 00/17] Enable ARM Trusted Firmware for U-Boot

2020-03-18 Thread Ang, Chee Hong
Any comment on this v5 patchsets ?

> From: "Ang, Chee Hong" 
> 
> v5 changes:
> This is another revision without the System Manager driver to handle the
> secure/non-secure access. DW MAC and MMC drivers will make direct calls to
> the high-level API to ATF if it's running in EL2 on Stratix10/Agilex 
> otherwise these
> drivers work as it is.
> 
> [PATCH v5 08/17] arm: socfpga: Define SMC function identifiers for PSCI SiP
> services
> - Add documentation for high-level API supported by ATF:
>   - INTEL_SIP_SMC_FUNCID_HPS_SET_PHYINTF (For setting PHY interface)
>   - INTEL_SIP_SMC_FUNCID_HPS_SET_SDMMC_CCLK (For setting SDMMC clock
> phase)
> 
> [PATCH v5 10/17] mmc: dwmmc: socfpga: Add ATF support for MMC driver
> - Call 'INTEL_SIP_SMC_FUNCID_HPS_SET_SDMMC_CCLK' if U-Boot running in
> EL2 (non-secure)
> 
> [PATCH v5 11/17] net: designware: socfpga: Add ATF support for MAC driver
> - Call 'INTEL_SIP_SMC_FUNCID_HPS_SET_PHYINTF' if U-Boot running in EL2
> (non-secure)
> 
> [PATCH v5 17/17] configs: socfpga: Add defconfig for Agilex and Stratix 10 
> with
> ATF support
> - Keep the existing Stratix10/Agilex defconfigs and add new defconfigs with 
> ATF
> support
> 
> v4:
> https://lists.denx.de/pipermail/u-boot/2020-March/402289.html
> 
> These patchsets have dependency on:
> https://lists.denx.de/pipermail/u-boot/2019-September/384906.html
> 
> Ang, Chee Hong (1):
>   configs: socfpga: Add defconfig for Agilex and Stratix 10 with ATF
> support
> 
> Chee Hong Ang (16):
>   configs: agilex: Remove CONFIG_OF_EMBED
>   arm: socfpga: add fit source file for pack itb with ATF
>   arm: socfpga: Add function for checking description from FIT image
>   arm: socfpga: Load FIT image with ATF support
>   arm: socfpga: Override 'lowlevel_init' to support ATF
>   arm: socfpga: Disable "spin-table" method for booting Linux
>   arm: socfpga: Add SMC helper function for Intel SOCFPGA (64bits)
>   arm: socfpga: Define SMC function identifiers for PSCI SiP services
>   arm: socfpga: soc64: Remove PHY interface setup from misc arch init
>   mmc: dwmmc: socfpga: Add ATF support for MMC driver
>   net: designware: socfpga: Add ATF support for MAC driver
>   arm: socfpga: Add ATF support for Reset Manager driver
>   arm: socfpga: stratix10: Initialize timer in SPL
>   arm: socfpga: Add ATF support to query FPGA configuration status
>   arm: socfpga: stratix10: Add ATF support for FPGA reconfig driver
>   arm: socfpga: mailbox: Add 'SYSTEM_RESET' PSCI support to
> mbox_reset_cold()
> 
>  arch/arm/mach-socfpga/Kconfig  |   2 -
>  arch/arm/mach-socfpga/Makefile |   2 +
>  arch/arm/mach-socfpga/board.c  |  10 +
>  arch/arm/mach-socfpga/include/mach/misc.h  |   3 +
>  arch/arm/mach-socfpga/lowlevel_init_64.S   |  81 
>  arch/arm/mach-socfpga/mailbox_s10.c|   4 +
>  arch/arm/mach-socfpga/misc_s10.c   | 121 ++
>  arch/arm/mach-socfpga/reset_manager_s10.c  |  10 +
>  arch/arm/mach-socfpga/timer_s10.c  |   3 +-
>  board/altera/soc64/its/fit_spl_atf.its |  52 +++
>  ...ilex_defconfig => socfpga_agilex_atf_defconfig} |   8 +-
>  configs/socfpga_agilex_defconfig   |   1 -
>  ...x_defconfig => socfpga_stratix10_atf_defconfig} |  23 +-
>  drivers/fpga/stratix10.c   | 141 ++-
>  drivers/mmc/socfpga_dw_mmc.c   |  21 +
>  drivers/net/dwmac_socfpga.c|  43 +-
>  include/configs/socfpga_soc64_common.h |   4 +
>  include/linux/intel-smc.h  | 445 
> +
>  18 files changed, 871 insertions(+), 103 deletions(-)  create mode 100644
> arch/arm/mach-socfpga/lowlevel_init_64.S
>  create mode 100644 board/altera/soc64/its/fit_spl_atf.its
>  copy configs/{socfpga_agilex_defconfig => socfpga_agilex_atf_defconfig}
> (87%)  copy configs/{socfpga_agilex_defconfig =>
> socfpga_stratix10_atf_defconfig} (68%)  create mode 100644
> include/linux/intel-smc.h
> 
> --
> 2.7.4



[PATCH v2 09/14] arm: dts: lx2160ardb: add DPMAC and PHY nodes

2020-03-18 Thread Ioana Ciornei
In order to maintain compatibility with the Linux DTS, the entire fsl-mc
node is added but instead of being probed by a dedicated bus driver it
will be a simple-mfd.

Also, annotate the EMDIO1 node and describe the 2 AR8035 RGMII PHYs and
the 2 AQR107 PHYs. Also, add phy-handles for the dpmacs to their
associated PHY.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 arch/arm/dts/fsl-lx2160a-rdb.dts | 52 
 arch/arm/dts/fsl-lx2160a.dtsi| 45 +++
 2 files changed, 97 insertions(+)

diff --git a/arch/arm/dts/fsl-lx2160a-rdb.dts b/arch/arm/dts/fsl-lx2160a-rdb.dts
index e542c6992ab8..584744368394 100644
--- a/arch/arm/dts/fsl-lx2160a-rdb.dts
+++ b/arch/arm/dts/fsl-lx2160a-rdb.dts
@@ -21,6 +21,58 @@
};
 };
 
+ {
+   status = "okay";
+   phy-handle = <_phy1>;
+   phy-connection-type = "usxgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy2>;
+   phy-connection-type = "usxgmii";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy1>;
+   phy-connection-type = "rgmii-id";
+};
+
+ {
+   status = "okay";
+   phy-handle = <_phy2>;
+   phy-connection-type = "rgmii-id";
+};
+
+ {
+   status = "okay";
+   rgmii_phy1: ethernet-phy@1 {
+   /* AR8035 PHY - "compatible" property not strictly needed */
+   compatible = "ethernet-phy-id004d.d072";
+   reg = <0x1>;
+   /* Poll mode - no "interrupts" property defined */
+   };
+   rgmii_phy2: ethernet-phy@2 {
+   /* AR8035 PHY - "compatible" property not strictly needed */
+   compatible = "ethernet-phy-id004d.d072";
+   reg = <0x2>;
+   /* Poll mode - no "interrupts" property defined */
+   };
+   aquantia_phy1: ethernet-phy@4 {
+   /* AQR107 PHY - "compatible" property not strictly needed */
+   compatible = "ethernet-phy-ieee802.3-c45";
+   interrupts = ;
+   reg = <0x4>;
+   };
+   aquantia_phy2: ethernet-phy@5 {
+   /* AQR107 PHY - "compatible" property not strictly needed */
+   compatible = "ethernet-phy-ieee802.3-c45";
+   interrupts = ;
+   reg = <0x5>;
+   };
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/dts/fsl-lx2160a.dtsi b/arch/arm/dts/fsl-lx2160a.dtsi
index 15f18bc4a5f7..17ecdc569b37 100644
--- a/arch/arm/dts/fsl-lx2160a.dtsi
+++ b/arch/arm/dts/fsl-lx2160a.dtsi
@@ -364,6 +364,51 @@
ranges = <0x8200 0x0 0x4000 0xa8 0x4000 0x0 
0x4000>;
};
 
+   fsl_mc: fsl-mc@80c00 {
+   compatible = "fsl,qoriq-mc", "simple-mfd";
+   reg = <0x0008 0x0c00 0 0x40>,
+ <0x 0x0834 0 0x4>;
+   #address-cells = <3>;
+   #size-cells = <1>;
+
+   /*
+* Region type 0x0 - MC portals
+* Region type 0x1 - QBMAN portals
+*/
+   ranges = <0x0 0x0 0x0 0x8 0x0c00 0x400
+ 0x1 0x0 0x0 0x8 0x1800 0x800>;
+
+   dpmacs {
+   compatible = "simple-mfd";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dpmac3: dpmac@3 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x3>;
+   status = "disabled";
+   };
+
+   dpmac4: dpmac@4 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x4>;
+   status = "disabled";
+   };
+
+   dpmac17: dpmac@11 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x11>;
+   status = "disabled";
+   };
+
+   dpmac18: dpmac@12 {
+   compatible = "fsl,qoriq-mc-dpmac";
+   reg = <0x12>;
+   status = "disabled";
+   };
+   };
+   };
+
/* WRIOP0: 0x8b8_, E-MDIO1: 0x1_6000 */
emdio1: mdio@8b96000 {
compatible = "fsl,ls-mdio";
-- 
2.17.1



[PATCH v2 14/14] configs: lx2160ardb: enable CONFIG_DM_ETH and related

2020-03-18 Thread Ioana Ciornei
Enable CONFIG_DM_ETH and CONFIG_DM_MDIO and related configs for the
LX2160ARDB board.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 4 
 configs/lx2160ardb_tfa_defconfig | 4 
 2 files changed, 8 insertions(+)

diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig 
b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
index d1fffb399e99..2aee388e412f 100644
--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
@@ -21,6 +21,7 @@ CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 
earlycon=pl011,mmio32,0x2
 CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -48,7 +49,10 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_CORTINA=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index 93f3e200c036..bcd1c594455b 100644
--- a/configs/lx2160ardb_tfa_defconfig
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -22,6 +22,7 @@ CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 
earlycon=pl011,mmio32,0x2
 CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
+CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -52,7 +53,10 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_AQUANTIA=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_CORTINA=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
 CONFIG_E1000=y
+CONFIG_FSL_LS_MDIO=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
-- 
2.17.1



RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver

2020-03-18 Thread Priyanka Jain (OSS)
>-Original Message-
>From: Ioana Ciornei 
>Sent: Wednesday, March 18, 2020 5:33 PM
>To: Priyanka Jain (OSS) ;
>joe.hershber...@ni.com; u-boot@lists.denx.de
>Cc: Florin Laurentiu Chiculita ; Madalin
>Bucur (OSS) 
>Subject: RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver
>
>> Subject: RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO
>> driver
>>
>> >-Original Message-
>> >From: U-Boot  On Behalf Of Ioana
>> >Ciornei
>> >Sent: Thursday, March 12, 2020 9:36 PM
>> >To: Priyanka Jain ; joe.hershber...@ni.com; u-
>> >b...@lists.denx.de
>> >Cc: Florin Laurentiu Chiculita ;
>> >Madalin Bucur (OSS) ; Ioana Ciornei
>> >
>> >Subject: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver
>> >
>> >Add a driver for the MDIO interface integrated in the mEMAC
>> >(Multi-rate Ethernet Media Access Controller) and the Fman 10G Ethernet
>MACs.
>> >
>> >Signed-off-by: Ioana Ciornei 
>> >---
>> > drivers/net/Kconfig   |   7 ++
>> > drivers/net/Makefile  |   1 +
>> > drivers/net/fsl_ls_mdio.c | 158
>> >++
>> > 3 files changed, 166 insertions(+)
>> > create mode 100644 drivers/net/fsl_ls_mdio.c
>> >
>> >diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>> >4d1013c98466..bc518f218da6 100644
>> >--- a/drivers/net/Kconfig
>> >+++ b/drivers/net/Kconfig
>> >@@ -640,4 +640,11 @@ config MVMDIO
>> >
>> >  This driver is used by the MVPP2 and MVNETA drivers.
>> >
>> >+config FSL_LS_MDIO
>> Please use prefix NXP for new configs
>> >+   bool "NXP Layerscape MDIO interface support"
>> >+   depends on DM_MDIO
>> >+   help
>> >+ This driver supports the MDIO bus found on the Fman 10G Ethernet
>> >MACs and
>> >+ on the mEMAC (which supports both Clauses 22 and 45).
>> >+
>> > endif # NETDEVICES
>> >diff --git a/drivers/net/Makefile b/drivers/net/Makefile index
>> >6e0a68834d97..6d9b8772b1a5 100644
>> >--- a/drivers/net/Makefile
>> >+++ b/drivers/net/Makefile
>> >@@ -83,3 +83,4 @@ obj-y += mscc_eswitch/
>> > obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o
>> > obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o
>> > obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o fsl_enetc_mdio.o
>> >+obj-$(CONFIG_FSL_LS_MDIO) += fsl_ls_mdio.o
>> >diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c
>> >new file mode
>> >100644 index ..845c0ac1ffd8
>> >--- /dev/null
>> >+++ b/drivers/net/fsl_ls_mdio.c
>> >@@ -0,0 +1,158 @@
>> >+// SPDX-License-Identifier: GPL-2.0+
>> >+/*
>> >+ * Copyright 2020 NXP
>> >+ */
>> >+
>> >+#include 
>> >+#include 
>> >+#include 
>> >+#include 
>> >+#include 
>> >+#include 
>> >+
>> >+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
>> >+#define memac_out_32(a, v) out_le32(a, v)
>> >+#define memac_clrbits_32(a, v) clrbits_le32(a, v)
>> >+#define memac_setbits_32(a, v) setbits_le32(a, v)
>> >+#else
>> >+#define memac_out_32(a, v) out_be32(a, v)
>> >+#define memac_clrbits_32(a, v) clrbits_be32(a, v)
>> >+#define memac_setbits_32(a, v) setbits_be32(a, v)
>> >+#endif
>> >+
>> >+static u32 memac_in_32(u32 *reg)
>> >+{
>> >+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
>> >+   return in_le32(reg);
>> >+#else
>> >+   return in_be32(reg);
>> >+#endif
>> >+}
>> >+
>> >+struct fsl_ls_mdio_priv {
>> >+   void *regs_base;
>> >+};
>> >+
>> >+static int dm_fsl_ls_mdio_read(struct udevice *dev, int addr,
>> >+  int devad, int reg)
>> >+{
>> >+   struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
>> >+   struct memac_mdio_controller *regs;
>> >+   u32 mdio_ctl;
>> >+   u32 c45 = 1;
>> >+
>> >+   regs = (struct memac_mdio_controller *)(priv->regs_base);
>> >+   if (devad == MDIO_DEVAD_NONE) {
>> >+   c45 = 0; /* clause 22 */
>> >+   devad = reg & 0x1f;
>>
>> I don't see devad getting used in below code.
>>
>
>It it used below in setting up the port and device address.
>Below is the exact snippet:
>
>+  mdio_ctl = MDIO_CTL_PORT_ADDR(addr) |
>MDIO_CTL_DEV_ADDR(devad);
Thanks for pointing.
Priyanka



Re: [RFC 08/14] efi_loader: capsule: support firmware update

2020-03-18 Thread Sughosh Ganu
On Tue, 17 Mar 2020 at 07:42, AKASHI Takahiro 
wrote:

> A capsule tagged with the guid, EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID,
> is handled as a firmware update object.
> What efi_update_capsule() basically does is to load any firmware management
> protocol (or fmp) drivers contained in a capsule, find out an appropriate
> fmp driver and then invoke its set_image() interface against each binary
> in a capsule.
> In this commit, however, installing drivers is not supported yet.
>
> The result of applying a capsule is set to be stored in "Capsule"
> variable, but its implementation is deferred to a fmp driver.
>
> Signed-off-by: AKASHI Takahiro 
> ---
>  include/efi_api.h| 127 +++
>  lib/efi_loader/Kconfig   |  12 +++
>  lib/efi_loader/efi_capsule.c | 165 +++
>  lib/efi_loader/efi_setup.c   |   4 +
>  4 files changed, 308 insertions(+)
>




> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index f3e2a555a6b9..f3526beed681 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -14,10 +14,164 @@
>  #include 
>




>  /*
>   * Launch a capsule
>   */
> @@ -54,6 +208,17 @@ efi_status_t EFIAPI efi_update_capsule(
> ret = EFI_SUCCESS;
> for (i = 0, capsule = *capsule_header_array; i < capsule_count;
>  i++, capsule = *(++capsule_header_array)) {
> +   EFI_PRINT("EFI Capsule (guid:%pUl)\n",
> >capsule_guid);
> +   if (!guidcmp(>capsule_guid,
> +_guid_firmware_management_capsule_id))
> +   ret  = efi_capsule_update_firmware(
> +   (struct
> efi_firmware_management_capsule_header *)
> +   ((void *)capsule +
> sizeof(*capsule)));
>

Instead of sizeof(*capsule), please use header_size member of
efi_capsule_header. The spec mentions that the size of the capsule header
might be larger than the capsule header structure. Moreover, when testing
with a capsule built from the edk2 capsule generation script, i do see that
the header_size is greater than sizeof(efi_capsule_header).

-sughosh


RE: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver

2020-03-18 Thread Priyanka Jain (OSS)
>-Original Message-
>From: U-Boot  On Behalf Of Ioana Ciornei
>Sent: Thursday, March 12, 2020 9:36 PM
>To: Priyanka Jain ; joe.hershber...@ni.com; u-
>b...@lists.denx.de
>Cc: Florin Laurentiu Chiculita ; Madalin
>Bucur (OSS) ; Ioana Ciornei
>
>Subject: [PATCH 01/14] drivers: net: add Layerscape mEMAC MDIO driver
>
>Add a driver for the MDIO interface integrated in the mEMAC (Multi-rate
>Ethernet Media Access Controller) and the Fman 10G Ethernet MACs.
>
>Signed-off-by: Ioana Ciornei 
>---
> drivers/net/Kconfig   |   7 ++
> drivers/net/Makefile  |   1 +
> drivers/net/fsl_ls_mdio.c | 158 ++
> 3 files changed, 166 insertions(+)
> create mode 100644 drivers/net/fsl_ls_mdio.c
>
>diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index
>4d1013c98466..bc518f218da6 100644
>--- a/drivers/net/Kconfig
>+++ b/drivers/net/Kconfig
>@@ -640,4 +640,11 @@ config MVMDIO
>
> This driver is used by the MVPP2 and MVNETA drivers.
>
>+config FSL_LS_MDIO
Please use prefix NXP for new configs
>+  bool "NXP Layerscape MDIO interface support"
>+  depends on DM_MDIO
>+  help
>+This driver supports the MDIO bus found on the Fman 10G Ethernet
>MACs and
>+on the mEMAC (which supports both Clauses 22 and 45).
>+
> endif # NETDEVICES
>diff --git a/drivers/net/Makefile b/drivers/net/Makefile index
>6e0a68834d97..6d9b8772b1a5 100644
>--- a/drivers/net/Makefile
>+++ b/drivers/net/Makefile
>@@ -83,3 +83,4 @@ obj-y += mscc_eswitch/
> obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o
> obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o
> obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o fsl_enetc_mdio.o
>+obj-$(CONFIG_FSL_LS_MDIO) += fsl_ls_mdio.o
>diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c new file 
>mode
>100644 index ..845c0ac1ffd8
>--- /dev/null
>+++ b/drivers/net/fsl_ls_mdio.c
>@@ -0,0 +1,158 @@
>+// SPDX-License-Identifier: GPL-2.0+
>+/*
>+ * Copyright 2020 NXP
>+ */
>+
>+#include 
>+#include 
>+#include 
>+#include 
>+#include 
>+#include 
>+
>+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
>+#define memac_out_32(a, v)out_le32(a, v)
>+#define memac_clrbits_32(a, v)clrbits_le32(a, v)
>+#define memac_setbits_32(a, v)setbits_le32(a, v)
>+#else
>+#define memac_out_32(a, v)out_be32(a, v)
>+#define memac_clrbits_32(a, v)clrbits_be32(a, v)
>+#define memac_setbits_32(a, v)setbits_be32(a, v)
>+#endif
>+
>+static u32 memac_in_32(u32 *reg)
>+{
>+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
>+  return in_le32(reg);
>+#else
>+  return in_be32(reg);
>+#endif
>+}
>+
>+struct fsl_ls_mdio_priv {
>+  void *regs_base;
>+};
>+
>+static int dm_fsl_ls_mdio_read(struct udevice *dev, int addr,
>+ int devad, int reg)
>+{
>+  struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
>+  struct memac_mdio_controller *regs;
>+  u32 mdio_ctl;
>+  u32 c45 = 1;
>+
>+  regs = (struct memac_mdio_controller *)(priv->regs_base);
>+  if (devad == MDIO_DEVAD_NONE) {
>+  c45 = 0; /* clause 22 */
>+  devad = reg & 0x1f;
I don't see devad getting used in below code. 
>+  memac_clrbits_32(>mdio_stat, MDIO_STAT_ENC);
>+  } else {
>+  memac_setbits_32(>mdio_stat, MDIO_STAT_ENC);
>+  }
>+
>+  /* Wait till the bus is free */
>+  while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
>+  ;
>+
>+  /* Set the Port and Device Addrs */
>+  mdio_ctl = MDIO_CTL_PORT_ADDR(addr) |
>MDIO_CTL_DEV_ADDR(devad);
>+  memac_out_32(>mdio_ctl, mdio_ctl);
>+
>+  /* Set the register address */
>+  if (c45)
>+  memac_out_32(>mdio_addr, reg & 0x);
>+
>+  /* Wait till the bus is free */
>+  while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
>+  ;
>+
>+  /* Initiate the read */
>+  mdio_ctl |= MDIO_CTL_READ;
>+  memac_out_32(>mdio_ctl, mdio_ctl);
>+
>+  /* Wait till the MDIO write is complete */
>+  while ((memac_in_32(>mdio_data)) & MDIO_DATA_BSY)
>+  ;
>+
>+  /* Return all Fs if nothing was there */
>+  if (memac_in_32(>mdio_stat) & MDIO_STAT_RD_ER)
>+  return 0x;
>+
>+  return memac_in_32(>mdio_data) & 0x;
>+  return 0;
>+}
>+
>+static int dm_fsl_ls_mdio_write(struct udevice *dev, int addr, int devad,
>+  int reg, u16 val)
>+{
>+  struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
>+  struct memac_mdio_controller *regs;
>+  u32 mdio_ctl;
>+  u32 c45 = 1;
>+
>+  regs = (struct memac_mdio_controller *)(priv->regs_base);
>+  if (devad == MDIO_DEVAD_NONE) {
>+  c45 = 0; /* clause 22 */
>+  devad = reg & 0x1f;
Sane commen as above
>+  memac_clrbits_32(>mdio_stat, MDIO_STAT_ENC);
>+  } else {
>+  memac_setbits_32(>mdio_stat, MDIO_STAT_ENC);
>+  }
>+
>+  /* Wait till the bus is free */
>+  while 

[PATCH] condfigs: ls1046aqds: support distro boot

2020-03-18 Thread Biwen Li
Add support of distro boot for ls1046aqds

Signed-off-by: Biwen Li 
---
 include/configs/ls1046a_common.h |  8 +++-
 include/configs/ls1046aqds.h | 20 +---
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/include/configs/ls1046a_common.h b/include/configs/ls1046a_common.h
index 07570187f5..111bc9a7b9 100644
--- a/include/configs/ls1046a_common.h
+++ b/include/configs/ls1046a_common.h
@@ -227,7 +227,7 @@
"fdt_high=0x\0" \
"initrd_high=0x\0"  \
"fdt_addr=0x64f0\0" \
-   "kernel_addr=0x6500\0"  \
+   "kernel_addr=0x6100\0"  \
"scriptaddr=0x8000\0"   \
"scripthdraddr=0x8008\0"\
"fdtheader_addr_r=0x8010\0" \
@@ -274,6 +274,12 @@
"&& sf read $kernelheader_addr_r $kernelheader_start "  \
"$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
"bootm $load_addr#$board\0" \
+   "nor_bootcmd=echo Trying load from nor..;"  \
+   "cp.b $kernel_addr $load_addr " \
+   "$kernel_size; env exists secureboot "  \
+   "&& cp.b $kernelheader_addr $kernelheader_addr_r "  \
+   "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
+   "bootm $load_addr#$board\0" \
"sd_bootcmd=echo Trying load from SD ..;"   \
"mmcinfo; mmc read $load_addr " \
"$kernel_addr_sd $kernel_size_sd && "   \
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index eea738e602..d5d96c4ed5 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -457,19 +457,17 @@ unsigned long get_board_ddr_clk(void);
 
 #undef CONFIG_BOOTCOMMAND
 #ifdef CONFIG_TFABOOT
-#define QSPI_NOR_BOOTCOMMAND   "sf probe && sf read $kernel_load "\
-   "e f0 && bootm $kernel_load"
-#define IFC_NOR_BOOTCOMMAND"cp.b $kernel_start $kernel_load " \
-   "$kernel_size && bootm $kernel_load"
-#define SD_BOOTCOMMAND "mmc info; mmc read $kernel_load" \
-   "$kernel_addr_sd $kernel_size_sd && 
bootm $kernel_load"
+#define IFC_NOR_BOOTCOMMAND "run distro_bootcmd; run nor_bootcmd; "\
+  "env exists secureboot && esbc_halt;;"
+#define SD_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; "  \
+  "env exists secureboot && esbc_halt;;"
 #else
-#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
-#define CONFIG_BOOTCOMMAND "sf probe && sf read $kernel_load "\
-   "e f0 && bootm $kernel_load"
+#if defined(CONFIG_SD_BOOT)
+#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; "  \
+  "env exists secureboot && esbc_halt;;"
 #else
-#define CONFIG_BOOTCOMMAND "cp.b $kernel_start $kernel_load " \
-   "$kernel_size && bootm $kernel_load"
+#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run nor_bootcmd; " \
+  "env exists secureboot && esbc_halt;;"
 #endif
 #endif
 
-- 
2.17.1



RE: [PATCH] lx2160a: Add dhcp in boot_targets

2020-03-18 Thread Priyanka Jain (OSS)
>-Original Message-
>From: U-Boot  On Behalf Of Meenakshi
>Aggarwal
>Sent: Wednesday, March 11, 2020 8:52 PM
>To: u-boot@lists.denx.de; Priyanka Jain 
>Cc: Meenakshi Aggarwal 
>Subject: [PATCH] lx2160a: Add dhcp in boot_targets
>
>Add dhcp in supported boot_targets for lx2160.
>
>Signed-off-by: Meenakshi Aggarwal 
>---
> include/configs/lx2160a_common.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/include/configs/lx2160a_common.h
>b/include/configs/lx2160a_common.h
>index 0b0075a..ba10dc5 100644
>--- a/include/configs/lx2160a_common.h
>+++ b/include/configs/lx2160a_common.h
>@@ -287,7 +287,8 @@ int select_i2c_ch_pca9547_sec(unsigned char ch);
>#define BOOT_TARGET_DEVICES(func) \
>   func(USB, usb, 0) \
>   func(MMC, mmc, 0) \
>-  func(SCSI, scsi, 0)
>+  func(SCSI, scsi, 0) \
>+  func(DHCP, dhcp, na)
> #include 
>
> #endif /* __LX2_COMMON_H */
>--
>1.9.1
Reviewed-by: Priyanka Jain 


RE: [PATCH] armv8: ls1028a: add dhcp boot target device

2020-03-18 Thread Priyanka Jain (OSS)
>-Original Message-
>From: U-Boot  On Behalf Of
>andy.t...@nxp.com
>Sent: Tuesday, March 10, 2020 9:01 AM
>To: Priyanka Jain 
>Cc: Sudhanshu Gupta ; u-boot@lists.denx.de;
>Andy Tang 
>Subject: [PATCH] armv8: ls1028a: add dhcp boot target device
>
>From: Yuantian Tang 
>
>Add DHCP boot target device to enable command bootcmd_dhcp.
>
>Signed-off-by: Yuantian Tang 
>---
> include/configs/ls1028a_common.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/include/configs/ls1028a_common.h
>b/include/configs/ls1028a_common.h
>index 98320e22e9..94ba08acb4 100644
>--- a/include/configs/ls1028a_common.h
>+++ b/include/configs/ls1028a_common.h
>@@ -70,7 +70,8 @@
> #define BOOT_TARGET_DEVICES(func) \
>   func(MMC, mmc, 0) \
>   func(MMC, mmc, 1) \
>-  func(USB, usb, 0)
>+  func(USB, usb, 0) \
>+  func(DHCP, dhcp, na)
> #include 
>
> /* Initial environment variables */
>--
>2.17.1
Reviewed-by: Priyanka Jain 


RE: [PATCH 02/14] drivers: net: ldpaa: add support for probing based on the DTS

2020-03-18 Thread Ioana Ciornei
> Subject: Re: [PATCH 02/14] drivers: net: ldpaa: add support for probing based 
> on
> the DTS
> 
> On Thu, Mar 12, 2020 at 11:26 AM Ioana Ciornei 
> wrote:
> >
> > When CONFIG_DM_ETH is enabled DPAA2 network interfaces will now probe
> > based on DTS nodes with the "fsl,qoriq-mc-dpmac" compatible.
> > In this case, transform the ldpaa_eth driver into a UCLASS_ETH driver
> > and reuse the _open()/_tx()/_stop() functions already inplemented.
> >
> > For the moment, the ldpaa_eth driver will support both configurations:
> > with or without CONFIG_DM_ETH enabled. Any 'struct eth_device'
> > occurrence now has a matching 'struct udevice' made mutually exclusive
> > based on the state of CONFIG_DM_ETH.
> >
> > Signed-off-by: Florin Laurentiu Chiculita
> > 
> > Signed-off-by: Ioana Ciornei 
> > ---
> >  drivers/net/ldpaa_eth/ldpaa_eth.c | 230 +-
> >  drivers/net/ldpaa_eth/ldpaa_eth.h |   6 +
> >  2 files changed, 204 insertions(+), 32 deletions(-)
> >
> > diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c
> > b/drivers/net/ldpaa_eth/ldpaa_eth.c
> > index a3b9c152b256..bbfe479ed1c9 100644
> > --- a/drivers/net/ldpaa_eth/ldpaa_eth.c
> > +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
> > @@ -12,6 +12,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >
> > @@ -19,6 +20,7 @@
> >  #include "ldpaa_eth.h"
> >
> >  #ifdef CONFIG_PHYLIB
> > +#ifndef CONFIG_DM_ETH
> 
> Please use positive logic here and throughout. Add the DM code here before the
> non-DM code.

Sure. Will change in v2.

> 
> >  static int init_phy(struct eth_device *dev)  {
> > struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv
> > *)dev->priv; @@ -62,6 +64,19 @@ static int init_phy(struct eth_device
> > *dev)
> >
> > return ret;
> >  }
> > +#else
> > +static void init_phy(struct udevice *dev) {
> > +   struct ldpaa_eth_priv *priv = dev_get_priv(dev);
> > +
> > +   priv->phy = dm_eth_phy_connect(dev);
> > +
> > +   if (!priv->phy)
> > +   return;
> > +
> > +   phy_config(priv->phy);
> > +}
> > +#endif
> >  #endif
> >
> >  #ifdef DEBUG
> > @@ -128,9 +143,15 @@ static void ldpaa_eth_get_dpni_counter(void)
> > }
> >  }
> >
> > +#ifdef CONFIG_DM_ETH
> > +static void ldpaa_eth_get_dpmac_counter(struct udevice *dev) {
> > +   struct ldpaa_eth_priv *priv = dev_get_priv(dev); #else
> >  static void ldpaa_eth_get_dpmac_counter(struct eth_device *net_dev)
> > {
> > struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv
> > *)net_dev->priv;
> > +#endif
> > int err = 0;
> > u64 value;
> >
> > @@ -263,9 +284,16 @@ error:
> > return;
> >  }
> >
> > +#ifdef CONFIG_DM_ETH
> > +static int ldpaa_eth_pull_dequeue_rx(struct udevice *dev,
> > +int flags, uchar **packetp) {
> > +   struct ldpaa_eth_priv *priv = dev_get_priv(dev); #else
> >  static int ldpaa_eth_pull_dequeue_rx(struct eth_device *dev)  {
> > struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv
> > *)dev->priv;
> > +#endif
> > const struct ldpaa_dq *dq;
> > const struct dpaa_fd *fd;
> > int i = 5, err = 0, status;
> > @@ -322,9 +350,15 @@ static int ldpaa_eth_pull_dequeue_rx(struct
> eth_device *dev)
> > return err;
> >  }
> >
> > +#ifdef CONFIG_DM_ETH
> > +static int ldpaa_eth_tx(struct udevice *dev, void *buf, int len) {
> > +   struct ldpaa_eth_priv *priv = dev_get_priv(dev); #else
> >  static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int
> > len)  {
> > struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv
> > *)net_dev->priv;
> > +#endif
> > struct dpaa_fd fd;
> > u64 buffer_start;
> > int data_offset, err;
> > @@ -400,15 +434,32 @@ error:
> > return err;
> >  }
> >
> > +static struct phy_device *ldpaa_get_phydev(struct ldpaa_eth_priv
> > +*priv) { #ifdef CONFIG_DM_ETH
> > +   return priv->phy;
> > +#else
> > +#ifdef CONFIG_PHYLIB
> > +   struct phy_device *phydev = NULL;
> > +   int phy_num;
> > +
> > +   /* start the phy devices one by one and update the dpmac state */
> > +   for (phy_num = 0; phy_num < WRIOP_MAX_PHY_NUM; phy_num++) {
> > +   phydev = wriop_get_phy_dev(priv->dpmac_id, phy_num);
> > +   if (phydev)
> > +   return phydev;
> > +   }
> > +   return NULL;
> > +#endif
> > +#endif
> > +}
> > +
> >  static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv *priv,
> >  struct dpmac_link_state *state)  {
> > phy_interface_t enet_if;
> > -   int phys_detected;
> > -#ifdef CONFIG_PHYLIB
> > struct phy_device *phydev = NULL;
> > -   int err, phy_num;
> > -#endif
> > +   int err;
> >
> > /* let's start off with maximum capabilities */
> > enet_if = wriop_get_enet_if(priv->dpmac_id);
> > @@ -420,39 +471,28 @@ static int ldpaa_get_dpmac_state(struct
> ldpaa_eth_priv *priv,
> 

RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support

2020-03-18 Thread Kuldeep Singh



> -Original Message-
> From: Kuldeep Singh
> Sent: Wednesday, March 18, 2020 5:15 PM
> To: Priyanka Jain (OSS) ; u-boot@lists.denx.de
> Subject: RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> 
> 
> 
> > -Original Message-
> > From: Priyanka Jain (OSS) 
> > Sent: Wednesday, March 18, 2020 4:22 PM
> > To: Kuldeep Singh ; u-boot@lists.denx.de
> > Cc: Kuldeep Singh 
> > Subject: RE: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> >
> > >-Original Message-
> > >From: U-Boot  On Behalf Of Kuldeep
> > Singh
> > >Sent: Saturday, March 14, 220 6:44 PM
> > >To: Priyanka Jain ; u-boot@lists.denx.de
> > >Cc: Kuldeep Singh 
> > >Subject: [RESEND Patch v2] configs: lx2160a: Enable FSPI support
> > >
> > >Enable FSPI controller support. So, flash environment can now be used.
> > >
> > >Signed-off-by: Kuldeep Singh 
> > >---
> > >v2:
> > >-Rebased to top.
> > >-Drop other patches from series as already accepted.
> > >-Add ENV_SECT_SIZE value as 0x2
> > >
> > > configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
> > > configs/lx2160aqds_tfa_defconfig | 3 +++
> > > configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
> > > configs/lx2160ardb_tfa_defconfig | 3 +++
> > > 4 files changed, 8 insertions(+)
> > >
> > >diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >index 7c3b827..92fac5d 100644
> > >--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
> > >@@ -65,6 +65,7 @@ CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > > CONFIG_FSL_DSPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >diff --git a/configs/lx2160aqds_tfa_defconfig
> > >b/configs/lx2160aqds_tfa_defconfig
> > >index 449b3cb..e472c12 100644
> > >--- a/configs/lx2160aqds_tfa_defconfig
> > >+++ b/configs/lx2160aqds_tfa_defconfig
> > >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > > CONFIG_SYS_TEXT_BASE=0x8200
> > > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > > CONFIG_ENV_SIZE=0x2000
> > >+CONFIG_ENV_SECT_SIZE=0x2
> > > CONFIG_ENV_OFFSET=0x50
> > > CONFIG_DM_GPIO=y
> > > CONFIG_FSPI_AHB_EN_4BYTE=y
> > >@@ -32,6 +33,7 @@ CONFIG_OF_CONTROL=y
> CONFIG_OF_BOARD_FIXUP=y
> > >CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-qds"
> > > CONFIG_ENV_IS_IN_MMC=y
> > >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > > CONFIG_NET_RANDOM_ETHADDR=y
> > > CONFIG_DM=y
> > > CONFIG_SATA_CEVA=y
> > >@@ -65,6 +67,7 @@ CONFIG_DM_SCSI=y
> > > CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >index d1fffb3..e754eb7 100644
> > >--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
> > >@@ -60,6 +60,7 @@ CONFIG_DM_SCSI=y
> > > CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >diff --git a/configs/lx2160ardb_tfa_defconfig
> > >b/configs/lx2160ardb_tfa_defconfig
> > >index 93f3e20..5d4580e 100644
> > >--- a/configs/lx2160ardb_tfa_defconfig
> > >+++ b/configs/lx2160ardb_tfa_defconfig
> > >@@ -4,6 +4,7 @@ CONFIG_TFABOOT=y
> > > CONFIG_SYS_TEXT_BASE=0x8200
> > > CONFIG_SYS_MALLOC_F_LEN=0x6000
> > > CONFIG_ENV_SIZE=0x2000
> > >+CONFIG_ENV_SECT_SIZE=0x2
> > > CONFIG_ENV_OFFSET=0x50
> > > CONFIG_DM_GPIO=y
> > > CONFIG_EMC2305=y
> > >@@ -33,6 +34,7 @@ CONFIG_OF_CONTROL=y
> CONFIG_OF_BOARD_FIXUP=y
> > >CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
> > > CONFIG_ENV_IS_IN_MMC=y
> > >+CONFIG_ENV_IS_IN_SPI_FLASH=y
> > > CONFIG_NET_RANDOM_ETHADDR=y
> > > CONFIG_DM=y
> > > CONFIG_SATA_CEVA=y
> > >@@ -64,6 +66,7 @@ CONFIG_DM_SCSI=y
> > > CONFIG_DM_SERIAL=y
> > > CONFIG_SPI=y
> > > CONFIG_DM_SPI=y
> > >+CONFIG_NXP_FSPI=y
> > > CONFIG_USB=y
> > > CONFIG_DM_USB=y
> > > CONFIG_USB_XHCI_HCD=y
> > >--
> > >2.7.4
> > Reviewed-by: Priyanka Jain 
> >
> > Please confirm that all dependent patches are now available in main
> > master branch
> 
> Yes, all dependent patches are in master branch to make flexspi work on
> LX2160ARDB.

Please find bundle link for flexspi patches.
Link: https://patchwork.ozlabs.org/bundle/kuldeep/flexspi/
This bundle also include last 2 patches(octal bus-width) of series 
https://patchwork.ozlabs.org/project/uboot/list/?series=164377
Since 1st is not accepted by Jagan, single I/O mode will be set right now and 
with merger of 1st patch, octal I/O will be used.
So, there's no harm in going with these 2 patches.

Thanks
Kuldeep

> 
> Thanks
> Kuldeep
> 
> >
> > Regards
> > Priyanka


[PATCH] configs: a64-olinuxino-emmc: add eMMC boot part config commands

2020-03-18 Thread Petr Štetiar
mmc bootbus and partconf commands are needed in order to be able to
configure booting from separate boot0/boot1 eMMC partitions.

Signed-off-by: Petr Štetiar 
---
 configs/a64-olinuxino-emmc_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/a64-olinuxino-emmc_defconfig 
b/configs/a64-olinuxino-emmc_defconfig
index 8443a6dae9e3..9a96a964b1dc 100644
--- a/configs/a64-olinuxino-emmc_defconfig
+++ b/configs/a64-olinuxino-emmc_defconfig
@@ -12,6 +12,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-olinuxino-emmc"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SUN8I_EMAC=y
+CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y


[RFC RFT PATCH] env: spl: filter the variables in default environment of SPL or TPL

2020-03-18 Thread Patrick Delaunay
Use a new option CONFIG_SPL_ENV_VARS to filter the variables included
in the default environment used in SPL (and TPL).

That allows to reduce the size of default_environment[].

If the new configuration flags CONFIG_SPL_ENV_VARS is
- "" the default environment is empty (default)
- list of variables (comma separated) to keept in SPL/TPL
  (it searches ^= in u-boot-initial-env)
- "*" the variables are not filtered

Signed-off-by: Patrick Delaunay 
---
Hi,

I propose this patch to reduce the SPL/TPL size when they support the
U-Boot environment.

But I need feedback, review and test (mainly for first boot when
environment in storage device is empty) to:
- confirm this patch can be acceptable
- confirm my assumptions on the list of variable used in SPL:
  empty by default in this first version.

This patch adds a filter on the environment variables present
in default environment of U-Boot, so SPL/TPL only include the required
variables.

I assumed the SPL/TPL environment can be empty by default (I filter all
the variables) because I think the environment is only needed when it is
loaded from external storage device; on cold boot and before to save env,
the content of default environment it is not necessary (To be confirmed).

For example, with falcon mode SPL need the environment to have the bootcmd
(load address , the file name to load and the the bootargs) only after
a first boot and after a correct 'env save' in U-Boot.

But I can update the default value for CONFIG_SPL_ENV_VARS to add
some generic variable to solve any raised issues:
.flags
.callback
cpu
arch
vendor
soc

PS: the current behavior (no filter) is kept when
CONFIG_SPL_ENV_VARS = "*"

I propose this patch after remarks on previous patch v4
env: Add CONFIG_ENV_FULL_SUPPORT

http://patchwork.ozlabs.org/patch/1171180/

It is a preliminary step for v5 of this serie.

Patrick


 Makefile  | 32 ++--
 env/Kconfig   | 11 +++
 include/env_default.h |  4 
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fa687f13a5..425709ed02 100644
--- a/Makefile
+++ b/Makefile
@@ -1843,6 +1843,34 @@ $(timestamp_h): $(srctree)/Makefile FORCE
 $(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE
$(call filechk,defaultenv.h)
 
+# ---
+# the SPL default environment is filtered by CONFIG_SPL_ENV_VARS
+spl_defaultenv_h := include/generated/spl_defaultenv_autogenerated.h
+
+quiet_cmd_gensplenv = GENENV $@
+
+ifeq ($(CONFIG_SPL_ENV_VARS),"*")
+cmd_gensplenv = cp $< $@
+else
+ifeq ($(CONFIG_SPL_ENV_VARS),"")
+cmd_gensplenv = echo '\0'  > $@
+else
+# use grep to filter SPL env with patern "^\(var1\|var2\)=",
+# with $CONFIG_SPL_ENV_VARS = "var1,var2"
+cmd_gensplenv = grep "^\($(subst $(comma),\|,$(CONFIG_SPL_ENV_VARS:"%"=%))\)=" 
$< > $@
+endif
+endif
+
+u-boot-spl-initial-env: u-boot-initial-env FORCE
+   $(call cmd,gensplenv)
+
+$(spl_defaultenv_h): u-boot-spl-initial-env
+   $(call filechk,defaultenv.h)
+
+spl_prepare: prepare $(spl_defaultenv_h)
+
+PHONY += spl_prepare
+
 # ---
 quiet_cmd_cpp_lds = LDS $@
 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
@@ -1855,7 +1883,7 @@ spl/u-boot-spl.bin: spl/u-boot-spl
@:
$(SPL_SIZE_CHECK)
 
-spl/u-boot-spl: tools prepare \
+spl/u-boot-spl: tools prepare spl_prepare \
$(if 
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
$(if 
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
$(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
@@ -1872,7 +1900,7 @@ spl/u-boot-spl.sfp: spl/u-boot-spl
 spl/boot.bin: spl/u-boot-spl
@:
 
-tpl/u-boot-tpl.bin: tools prepare \
+tpl/u-boot-tpl.bin: tools prepare spl_prepare \
$(if 
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb)
$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
$(TPL_SIZE_CHECK)
diff --git a/env/Kconfig b/env/Kconfig
index 0d6f559b39..ff7a8c1d6c 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -588,7 +588,18 @@ config ENV_VARS_UBOOT_RUNTIME_CONFIG
  run-time determined information about the hardware to the
  environment.  These will be named board_name, board_rev.
 
+config SPL_ENV_VARS
+   string "list of variables keept in SPL/TPL default environment"
+   default ""
+   help
+   List of variables, coma separated, included in the default
+   environment in SPL and TPL.
+   It is used to reduce the size impact of environment in SPL/TPL
+   None variable are included when the option is empty "".
+   The filtre is deactivated when option is "*".
+
 if SPL_ENV_SUPPORT
+
 config 

[PATCH v2 05/14] board: ls2088ardb: transition to DM_ETH

2020-03-18 Thread Ioana Ciornei
In case CONFIG_DM_ETH is enabled, no hardcoding is necessary for
DPAA2 Ethernet devices. Compile out any unnecessary setup when
CONFIG_DM_ETH is activated.
Also, force the PCI devices to be enumerated at probe time.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - used the positive logic (ifdef CONFIG_DM_ETH instead of ifndef)

 board/freescale/ls2080ardb/eth_ls2080rdb.c | 7 +++
 board/freescale/ls2080ardb/ls2080ardb.c| 4 
 2 files changed, 11 insertions(+)

diff --git a/board/freescale/ls2080ardb/eth_ls2080rdb.c 
b/board/freescale/ls2080ardb/eth_ls2080rdb.c
index b0f276e8397c..f0f6ca53cb05 100644
--- a/board/freescale/ls2080ardb/eth_ls2080rdb.c
+++ b/board/freescale/ls2080ardb/eth_ls2080rdb.c
@@ -23,6 +23,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_eth_init(bd_t *bis)
 {
+#ifndef CONFIG_DM_ETH
 #if defined(CONFIG_FSL_MC_ENET)
int i, interface;
struct memac_mdio_info mdio_info;
@@ -99,6 +100,7 @@ int board_eth_init(bd_t *bis)
 
cpu_eth_init(bis);
 #endif /* CONFIG_FSL_MC_ENET */
+#endif /* !CONFIG_DM_ETH */
 
 #ifdef CONFIG_PHY_AQUANTIA
/*
@@ -112,7 +114,12 @@ int board_eth_init(bd_t *bis)
gd->jt->mdio_phydev_for_ethname = mdio_phydev_for_ethname;
gd->jt->miiphy_set_current_dev = miiphy_set_current_dev;
 #endif
+
+#ifdef CONFIG_DM_ETH
+   return 0;
+#else
return pci_eth_init(bis);
+#endif
 }
 
 #if defined(CONFIG_RESET_PHY_R)
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index 282aaf47fb88..5e2fc7cc9833 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -244,6 +244,10 @@ int board_init(void)
sec_init();
 #endif
 
+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
+   pci_init();
+#endif
+
return 0;
 }
 
-- 
2.17.1



[PATCH v2 02/14] drivers: net: ldpaa: add support for probing based on the DTS

2020-03-18 Thread Ioana Ciornei
When CONFIG_DM_ETH is enabled DPAA2 network interfaces will now probe
based on DTS nodes with the "fsl,qoriq-mc-dpmac" compatible.
In this case, transform the ldpaa_eth driver into a UCLASS_ETH driver
and reuse the _open()/_tx()/_stop() functions already inplemented.

For the moment, the ldpaa_eth driver will support both configurations:
with or without CONFIG_DM_ETH enabled. Any 'struct eth_device' occurrence
now has a matching 'struct udevice' made mutually exclusive based on the
state of CONFIG_DM_ETH.

Signed-off-by: Florin Laurentiu Chiculita 
Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - used the positive logic (ifdef CONFIG_DM_ETH instead of ifndef)

 drivers/net/ldpaa_eth/ldpaa_eth.c | 231 +-
 drivers/net/ldpaa_eth/ldpaa_eth.h |   6 +
 2 files changed, 205 insertions(+), 32 deletions(-)

diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c 
b/drivers/net/ldpaa_eth/ldpaa_eth.c
index a3b9c152b256..f589a482b734 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -19,6 +20,19 @@
 #include "ldpaa_eth.h"
 
 #ifdef CONFIG_PHYLIB
+#ifdef CONFIG_DM_ETH
+static void init_phy(struct udevice *dev)
+{
+   struct ldpaa_eth_priv *priv = dev_get_priv(dev);
+
+   priv->phy = dm_eth_phy_connect(dev);
+
+   if (!priv->phy)
+   return;
+
+   phy_config(priv->phy);
+}
+#else
 static int init_phy(struct eth_device *dev)
 {
struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)dev->priv;
@@ -63,6 +77,7 @@ static int init_phy(struct eth_device *dev)
return ret;
 }
 #endif
+#endif
 
 #ifdef DEBUG
 
@@ -128,9 +143,15 @@ static void ldpaa_eth_get_dpni_counter(void)
}
 }
 
+#ifdef CONFIG_DM_ETH
+static void ldpaa_eth_get_dpmac_counter(struct udevice *dev)
+{
+   struct ldpaa_eth_priv *priv = dev_get_priv(dev);
+#else
 static void ldpaa_eth_get_dpmac_counter(struct eth_device *net_dev)
 {
struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
+#endif
int err = 0;
u64 value;
 
@@ -263,9 +284,16 @@ error:
return;
 }
 
+#ifdef CONFIG_DM_ETH
+static int ldpaa_eth_pull_dequeue_rx(struct udevice *dev,
+int flags, uchar **packetp)
+{
+   struct ldpaa_eth_priv *priv = dev_get_priv(dev);
+#else
 static int ldpaa_eth_pull_dequeue_rx(struct eth_device *dev)
 {
struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)dev->priv;
+#endif
const struct ldpaa_dq *dq;
const struct dpaa_fd *fd;
int i = 5, err = 0, status;
@@ -322,9 +350,15 @@ static int ldpaa_eth_pull_dequeue_rx(struct eth_device 
*dev)
return err;
 }
 
+#ifdef CONFIG_DM_ETH
+static int ldpaa_eth_tx(struct udevice *dev, void *buf, int len)
+{
+   struct ldpaa_eth_priv *priv = dev_get_priv(dev);
+#else
 static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len)
 {
struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
+#endif
struct dpaa_fd fd;
u64 buffer_start;
int data_offset, err;
@@ -400,15 +434,32 @@ error:
return err;
 }
 
+static struct phy_device *ldpaa_get_phydev(struct ldpaa_eth_priv *priv)
+{
+#ifdef CONFIG_DM_ETH
+   return priv->phy;
+#else
+#ifdef CONFIG_PHYLIB
+   struct phy_device *phydev = NULL;
+   int phy_num;
+
+   /* start the phy devices one by one and update the dpmac state */
+   for (phy_num = 0; phy_num < WRIOP_MAX_PHY_NUM; phy_num++) {
+   phydev = wriop_get_phy_dev(priv->dpmac_id, phy_num);
+   if (phydev)
+   return phydev;
+   }
+   return NULL;
+#endif
+#endif
+}
+
 static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv *priv,
 struct dpmac_link_state *state)
 {
phy_interface_t enet_if;
-   int phys_detected;
-#ifdef CONFIG_PHYLIB
struct phy_device *phydev = NULL;
-   int err, phy_num;
-#endif
+   int err;
 
/* let's start off with maximum capabilities */
enet_if = wriop_get_enet_if(priv->dpmac_id);
@@ -420,39 +471,28 @@ static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv 
*priv,
state->rate = SPEED_1000;
break;
}
-   state->up = 1;
 
-   phys_detected = 0;
-#ifdef CONFIG_PHYLIB
+   state->up = 1;
state->options |= DPMAC_LINK_OPT_AUTONEG;
+   phydev = ldpaa_get_phydev(priv);
 
-   /* start the phy devices one by one and update the dpmac state */
-   for (phy_num = 0; phy_num < WRIOP_MAX_PHY_NUM; phy_num++) {
-   phydev = wriop_get_phy_dev(priv->dpmac_id, phy_num);
-   if (!phydev)
-   continue;
-
-   phys_detected++;
+   if (phydev) {
err = phy_startup(phydev);
if (err) {
printf("%s: Could not initialize\n", 

[PATCH v2 01/14] drivers: net: add Layerscape mEMAC MDIO driver

2020-03-18 Thread Ioana Ciornei
Add a driver for the MDIO interface integrated in the mEMAC (Multi-rate
Ethernet Media Access Controller) and the Fman 10G Ethernet MACs.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - refactor the mdio read/write code for code reuse

 drivers/net/Kconfig   |   7 ++
 drivers/net/Makefile  |   1 +
 drivers/net/fsl_ls_mdio.c | 146 ++
 3 files changed, 154 insertions(+)
 create mode 100644 drivers/net/fsl_ls_mdio.c

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 4d1013c98466..bc518f218da6 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -640,4 +640,11 @@ config MVMDIO
 
  This driver is used by the MVPP2 and MVNETA drivers.
 
+config FSL_LS_MDIO
+   bool "NXP Layerscape MDIO interface support"
+   depends on DM_MDIO
+   help
+ This driver supports the MDIO bus found on the Fman 10G Ethernet MACs 
and
+ on the mEMAC (which supports both Clauses 22 and 45).
+
 endif # NETDEVICES
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6e0a68834d97..6d9b8772b1a5 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -83,3 +83,4 @@ obj-y += mscc_eswitch/
 obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o
 obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o
 obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o fsl_enetc_mdio.o
+obj-$(CONFIG_FSL_LS_MDIO) += fsl_ls_mdio.o
diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c
new file mode 100644
index ..6d8332d19ae0
--- /dev/null
+++ b/drivers/net/fsl_ls_mdio.c
@@ -0,0 +1,146 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
+#define memac_out_32(a, v) out_le32(a, v)
+#define memac_clrbits_32(a, v) clrbits_le32(a, v)
+#define memac_setbits_32(a, v) setbits_le32(a, v)
+#else
+#define memac_out_32(a, v) out_be32(a, v)
+#define memac_clrbits_32(a, v) clrbits_be32(a, v)
+#define memac_setbits_32(a, v) setbits_be32(a, v)
+#endif
+
+static u32 memac_in_32(u32 *reg)
+{
+#ifdef CONFIG_SYS_MEMAC_LITTLE_ENDIAN
+   return in_le32(reg);
+#else
+   return in_be32(reg);
+#endif
+}
+
+struct fsl_ls_mdio_priv {
+   void *regs_base;
+};
+
+static u32 fsl_ls_mdio_setup_operation(struct udevice *dev, int addr, int 
devad,
+  int reg)
+{
+   struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
+   struct memac_mdio_controller *regs;
+   u32 mdio_ctl;
+   u32 c45 = 1;
+
+   regs = (struct memac_mdio_controller *)(priv->regs_base);
+   if (devad == MDIO_DEVAD_NONE) {
+   c45 = 0; /* clause 22 */
+   devad = reg & 0x1f;
+   memac_clrbits_32(>mdio_stat, MDIO_STAT_ENC);
+   } else {
+   memac_setbits_32(>mdio_stat, MDIO_STAT_ENC);
+   }
+
+   /* Wait till the bus is free */
+   while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
+   ;
+
+   /* Set the Port and Device Addrs */
+   mdio_ctl = MDIO_CTL_PORT_ADDR(addr) | MDIO_CTL_DEV_ADDR(devad);
+   memac_out_32(>mdio_ctl, mdio_ctl);
+
+   /* Set the register address */
+   if (c45)
+   memac_out_32(>mdio_addr, reg & 0x);
+
+   /* Wait till the bus is free */
+   while ((memac_in_32(>mdio_stat)) & MDIO_STAT_BSY)
+   ;
+
+   return mdio_ctl;
+}
+
+static int dm_fsl_ls_mdio_read(struct udevice *dev, int addr,
+  int devad, int reg)
+{
+   struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
+   struct memac_mdio_controller *regs;
+   u32 mdio_ctl;
+
+   regs = (struct memac_mdio_controller *)(priv->regs_base);
+   mdio_ctl = fsl_ls_mdio_setup_operation(dev, addr, devad, reg);
+
+   /* Initiate the read */
+   mdio_ctl |= MDIO_CTL_READ;
+   memac_out_32(>mdio_ctl, mdio_ctl);
+
+   /* Wait till the MDIO write is complete */
+   while ((memac_in_32(>mdio_data)) & MDIO_DATA_BSY)
+   ;
+
+   /* Return all Fs if nothing was there */
+   if (memac_in_32(>mdio_stat) & MDIO_STAT_RD_ER)
+   return 0x;
+
+   return memac_in_32(>mdio_data) & 0x;
+}
+
+static int dm_fsl_ls_mdio_write(struct udevice *dev, int addr, int devad,
+   int reg, u16 val)
+{
+   struct fsl_ls_mdio_priv *priv = dev_get_priv(dev);
+   struct memac_mdio_controller *regs;
+
+   regs = (struct memac_mdio_controller *)(priv->regs_base);
+   fsl_ls_mdio_setup_operation(dev, addr, devad, reg);
+
+   /* Write the value to the register */
+   memac_out_32(>mdio_data, MDIO_DATA(val));
+
+   /* Wait till the MDIO write is complete */
+   while ((memac_in_32(>mdio_data)) & MDIO_DATA_BSY)
+   ;
+
+   return 0;
+}
+
+static const struct mdio_ops fsl_ls_mdio_ops = {
+   .read = dm_fsl_ls_mdio_read,
+   .write = dm_fsl_ls_mdio_write,
+};
+
+static 

[PATCH v2 07/14] arm: dts: ls2088a: add external MDIO nodes

2020-03-18 Thread Ioana Ciornei
Add the External MDIO1 device node found in the WRIOP global memory
region. This is needed for management of external PHYs.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 arch/arm/dts/fsl-ls2080a.dtsi | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/dts/fsl-ls2080a.dtsi b/arch/arm/dts/fsl-ls2080a.dtsi
index 99ed33af95b4..7ff854caecd5 100644
--- a/arch/arm/dts/fsl-ls2080a.dtsi
+++ b/arch/arm/dts/fsl-ls2080a.dtsi
@@ -200,4 +200,19 @@
status = "disabled";
};
 
+   emdio1: mdio@8B96000 {
+   compatible = "fsl,ls-mdio";
+   reg = <0x0 0x8B96000 0x0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
+
+   emdio2: mdio@8B97000 {
+   compatible = "fsl,ls-mdio";
+   reg = <0x0 0x8B97000 0x0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
 };
-- 
2.17.1



[PATCH v2 04/14] board: ls1088ardb: transition to DM_ETH

2020-03-18 Thread Ioana Ciornei
In case CONFIG_DM_ETH is enabled, no hardcoding is necessary for
DPAA2 Ethernet devices. Compile out any unnecessary setup when
CONFIG_DM_ETH is activated.
Also, force the PCI devices to be enumerated at probe time.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 board/freescale/ls1088a/eth_ls1088ardb.c | 2 ++
 board/freescale/ls1088a/ls1088a.c| 5 +
 2 files changed, 7 insertions(+)

diff --git a/board/freescale/ls1088a/eth_ls1088ardb.c 
b/board/freescale/ls1088a/eth_ls1088ardb.c
index 01f56db0a1bf..f56ce7d9ae8e 100644
--- a/board/freescale/ls1088a/eth_ls1088ardb.c
+++ b/board/freescale/ls1088a/eth_ls1088ardb.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 
+#ifndef CONFIG_DM_ETH
 int board_eth_init(bd_t *bis)
 {
 #if defined(CONFIG_FSL_MC_ENET)
@@ -95,6 +96,7 @@ int board_eth_init(bd_t *bis)
 
return pci_eth_init(bis);
 }
+#endif
 
 #if defined(CONFIG_RESET_PHY_R)
 void reset_phy(void)
diff --git a/board/freescale/ls1088a/ls1088a.c 
b/board/freescale/ls1088a/ls1088a.c
index 0bd397a0beb6..225e787c7577 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -801,6 +801,11 @@ int board_init(void)
 #ifdef CONFIG_FSL_LS_PPA
ppa_init();
 #endif
+
+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
+   pci_init();
+#endif
+
return 0;
 }
 
-- 
2.17.1



[PATCH v2 00/14] net: ldpaa_eth: transition to CONFIG_DM_ETH

2020-03-18 Thread Ioana Ciornei
This patch set targets to add support for CONFIG_DM_ETH in DPAA2 based
SoCs. We start by adding a DM MDIO driver for the MDIO interface found
on the mEMAC. The next two patches start the transition of the ldpaa_eth
and fsl-mc drivers towards using the 'struct udevice' and probing on DTS
nodes.

Any unnecessary configurations made for the DPAA2 ethernet devices are
compiled out when CONFIG_DM_ETH. This is because any information
necessary is available in its associated DTS node.

For the moment, only configs of RDB boards are transitioned to
CONFIG_DM_ETH since its more of a straightforward move than for the QDS
ones.

As an example, the 'dm tree' output for a LS2088ARDB board looks
something like the following:

=> dm tree
 Class Index  Probed  DriverName
---
(...)
 simple_bus0  [ + ]   generic_simple_bus|-- fsl-mc@80c00
 simple_bus1  [ + ]   generic_simple_bus|   `-- dpmacs
 eth   0  [ + ]   ldpaa_eth |   |-- DPMAC1@xfi
 eth   1  [ + ]   ldpaa_eth |   |-- DPMAC2@xfi
 eth   2  [ + ]   ldpaa_eth |   |-- DPMAC3@xfi
 eth   3  [ + ]   ldpaa_eth |   |-- DPMAC4@xfi
 eth   4  [ + ]   ldpaa_eth |   |-- DPMAC5@xfi
 eth   5  [ + ]   ldpaa_eth |   |-- DPMAC6@xfi
 eth   6  [ + ]   ldpaa_eth |   |-- DPMAC7@xfi
 eth   7  [ + ]   ldpaa_eth |   `-- DPMAC8@xfi
 mdio  0  [ + ]   fsl_ls_mdio   |-- mdio@8B96000
 mdio  1  [ + ]   fsl_ls_mdio   `-- mdio@8B97000

Changes in v2:
 - used the positive logic (ifdef CONFIG_DM_ETH instead of ifndef)
 - refactor the mdio read/write code for code reuse

Ioana Ciornei (14):
  drivers: net: add Layerscape mEMAC MDIO driver
  drivers: net: ldpaa: add support for probing based on the DTS
  drivers: net: fsl-mc: add support for CONFIG_DM_ETH
  board: ls1088ardb: transition to DM_ETH
  board: ls2088ardb: transition to DM_ETH
  arm: dts: lx2160a: add external MDIO nodes
  arm: dts: ls2088a: add external MDIO nodes
  arm: dts: ls1088a: add external MDIO nodes
  arm: dts: lx2160ardb: add DPMAC and PHY nodes
  arm: dts: ls2088ardb: add DPMAC and PHY nodes
  arm: dts: ls1088ardb: add DPMAC and PHY nodes
  configs: ls1088ardb: enable CONFIG_DM_ETH and related
  configs: ls2088ardb: enable CONFIG_DM_ETH and related
  configs: lx2160ardb: enable CONFIG_DM_ETH and related

 arch/arm/dts/fsl-ls1088a-rdb.dts  | 102 
 arch/arm/dts/fsl-ls1088a.dtsi | 102 +++-
 arch/arm/dts/fsl-ls2080a.dtsi |  90 ++-
 arch/arm/dts/fsl-ls2088a-rdb-qspi.dts |  88 +++
 arch/arm/dts/fsl-lx2160a-rdb.dts  |  52 
 arch/arm/dts/fsl-lx2160a.dtsi |  65 +
 board/freescale/ls1088a/eth_ls1088ardb.c  |   2 +
 board/freescale/ls1088a/ls1088a.c |   5 +
 board/freescale/ls2080ardb/eth_ls2080rdb.c|   7 +
 board/freescale/ls2080ardb/ls2080ardb.c   |   4 +
 configs/ls1088ardb_qspi_SECURE_BOOT_defconfig |   5 +
 configs/ls1088ardb_qspi_defconfig |   5 +
 ...1088ardb_sdcard_qspi_SECURE_BOOT_defconfig |   5 +
 configs/ls1088ardb_sdcard_qspi_defconfig  |   5 +
 configs/ls1088ardb_tfa_SECURE_BOOT_defconfig  |   5 +
 configs/ls1088ardb_tfa_defconfig  |   5 +
 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig |   4 +
 configs/ls2088ardb_qspi_defconfig |   4 +
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig  |   4 +
 configs/ls2088ardb_tfa_defconfig  |   4 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig  |   4 +
 configs/lx2160ardb_tfa_defconfig  |   4 +
 drivers/net/Kconfig   |   7 +
 drivers/net/Makefile  |   1 +
 drivers/net/fsl-mc/mc.c   |  48 +++-
 drivers/net/fsl_ls_mdio.c | 146 +++
 drivers/net/ldpaa_eth/ldpaa_eth.c | 231 +++---
 drivers/net/ldpaa_eth/ldpaa_eth.h |   6 +
 include/configs/ls1088ardb.h  |   2 +
 29 files changed, 956 insertions(+), 56 deletions(-)
 create mode 100644 drivers/net/fsl_ls_mdio.c

-- 
2.17.1



Re: [RFC 11/14] efi_loader: variable: export variables table for runtime access

2020-03-18 Thread Sughosh Ganu
On Tue, 17 Mar 2020 at 07:42, AKASHI Takahiro 
wrote:

> There are platforms on which OS's won't be able to access UEFI variables
> at runtime (i.e. after ExitBootServices).
> With this patch, all the UEFI variables are exported as a configuration
> table so as to enable retrieving variables' values from the table, and
> later modifying them via capsule-on-disk if necessary.
>
> The idea is based on Peter's proposal[1] in boot-arch ML.
>
> [1]
> https://lists.linaro.org/pipermail/boot-architecture/2018-October/000883.html
>
> Signed-off-by: AKASHI Takahiro 
> ---
>  include/efi_loader.h  |   7 +++
>  lib/efi_loader/Kconfig|  10 
>  lib/efi_loader/efi_boottime.c |  10 
>  lib/efi_loader/efi_capsule.c  |   4 ++
>  lib/efi_loader/efi_variable.c | 109 ++
>  5 files changed, 140 insertions(+)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 79bdf9586d24..93ed5502821c 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -183,6 +183,8 @@ extern const efi_guid_t efi_guid_hii_string_protocol;
>  extern const efi_guid_t efi_guid_capsule_report;
>  /* GUID of firmware management protocol */
>  extern const efi_guid_t efi_guid_firmware_management_protocol;
> +/* GUID of runtime variable access */
> +extern const efi_guid_t efi_guid_variable_storage;
>
>  /* GUID of RNG protocol */
>  extern const efi_guid_t efi_guid_rng_protocol;
> @@ -659,6 +661,10 @@ efi_status_t EFIAPI efi_query_variable_info(
> u64 *remaining_variable_storage_size,
> u64 *maximum_variable_size);
>
> +#ifdef CONFIG_EFI_VARIABLE_EXPORT
> +efi_status_t efi_install_variables_table(void);
> +#endif
> +
>  /*
>   * See section 3.1.3 in the v2.7 UEFI spec for more details on
>   * the layout of EFI_LOAD_OPTION.  In short it is:
> @@ -683,6 +689,7 @@ struct efi_load_option {
>  void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data);
>  unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8
> **data);
>  efi_status_t efi_bootmgr_load(efi_handle_t *handle);
> +efi_status_t efi_install_variables_table(void);
>
>  /* Capsule update */
>  efi_status_t EFIAPI efi_update_capsule(
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 616e2acbe102..edb8d19059ea 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -41,6 +41,16 @@ config EFI_SET_TIME
>   Provide the SetTime() runtime service at boottime. This service
>   can be used by an EFI application to adjust the real time clock.
>
> +config EFI_VARIABLE_EXPORT
> +   bool "Export variables table as configuration table"
> +   depends on !EFI_VARIABLE_RUNTIME_ACCESS
> +   depends on  EFI_CAPSULE_UPDATE_VARIABLE
> +   default y
> +   help
> + Select this option if you want to export UEFI variables as
> + configuration table so that OS can still get UEFI variable's
> + value.
> +
>  config EFI_DEVICE_PATH_TO_TEXT
> bool "Device path to text protocol"
> default y
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index c2a789b4f910..406644e4da67 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -2898,6 +2898,16 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t
> image_handle,
> if (ret != EFI_SUCCESS)
> return EFI_EXIT(EFI_INVALID_PARAMETER);
>
> +#ifdef CONFIG_EFI_VARIABLE_EXPORT
> +   /* Install variables database as a configuration table */
> +   ret = efi_install_variables_table();
> +   if (ret != EFI_SUCCESS)
> +   return EFI_EXIT(ret);
> +#endif
> +   /*
> +* TODO: remove a table after image is terminated.
> +*/
> +
> image_obj->exit_data_size = exit_data_size;
> image_obj->exit_data = exit_data;
>
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 1293270aea95..6b737aec1b28 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -18,7 +18,11 @@ static const efi_guid_t
> efi_guid_firmware_management_capsule_id =
> EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID;
>  const efi_guid_t efi_guid_firmware_management_protocol =
> EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID;
> +#ifdef CONFIG_EFI_VARIABLE_EXPORT
> +const efi_guid_t efi_guid_variable_storage = EFI_VARIABLE_STORAGE_GUID;
> +#else
>  static const efi_guid_t efi_guid_variable_storage =
> EFI_VARIABLE_STORAGE_GUID;
> +#endif
>

Need to remove the static keyword here. The build fails when
CONFIG_EFI_VARIABLE_EXPORT is not defined, with the extern declaration now
being done in efi_loader.h

-sughosh


Re: [GIT PULL] TI changes for next branch targeting v2020.07

2020-03-18 Thread Tom Rini
On Tue, Mar 17, 2020 at 01:39:45PM +0530, Lokesh Vutla wrote:

> Hi Tom,
> 
> Please find the pull request for next branch targeting v2020.07 merge window
> containing TI specific changes.
> 
> Gitlab build tests: 
> https://gitlab.denx.de/u-boot/custodians/u-boot-ti/pipelines/2444
> 
> Thanks and regards,
> Lokesh
> 
> The following changes since commit 548ce227d3d852455c6395c0cec30af0cda77b09:
> 
>   Prepare v2020.04-rc3 (2020-02-26 07:53:20 -0500)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-ti.git tags/ti-v2020.07-next
> 
> for you to fetch changes up to 445b45042c63c79546124489362ba4e64b61bfdc:
> 
>   remoteproc: k3-r5: Fix rproc init failure on Split-mode _only_ devices 
> (2020-03-16 12:33:19 +0530)
> 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] Please pull from u-boot-i2c/next

2020-03-18 Thread Tom Rini
On Tue, Mar 17, 2020 at 06:26:28AM +0100, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull from u-boot-i2c next
> 
> There is patch "[v2] bootcounter: add DM support for memory based bootcounter"
> http://patchwork.ozlabs.org/patch/1247674/
> 
> which was assigned to me, not really i2c related, but I added it to this pull
> request. If you think, you should pick it up, I can remove it.
> 
> Travis build:
> https://travis-ci.org/github/hsdenx/u-boot-i2c/builds/662944932
> 
> The following changes since commit e24f0a39d0daa2d8c597650aeb3f559d44a195ae:
> 
>   Merge branch '2020-03-12-rsa-improvements' into next (2020-03-12 12:45:27 
> -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-i2c.git 
> tags/20200316-for-next
> 
> for you to fetch changes up to 80e8b8add057d2c947394d9d57fc2dcc7ff886d1:
> 
>   bootcounter: add DM support for memory based bootcounter (2020-03-16 
> 08:05:00 +0100)
> 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 0/2] sunxi: clean up defconfig files

2020-03-18 Thread Jagan Teki
On Thu, Feb 20, 2020 at 11:21 PM Andre Przywara  wrote:
>
> With some recent additions and some old cruft, there are some config
> options that were defined in *almost* every board defconfig file for
> Allwinner SoCs.
> This "almost" seems to point to bugs, either those options were missed by
> mistake or failed to properly synchronise (when a new board defconfig
> comes into the tree and just missed some automatic update).
>
> This series defines those common symbols in their respective Kconfig
> files or in the ARCH_SUNXI definition, then removes them from all the
> defconfigs.
>
> This fixes those boards that suffered from a missing definition, also
> cleans up all board defconfigs by moving not-board-specific options out
> of there.
>
> Rationale for why those options are generic are given in the commit
> message of 1/2.
>
> Cheers,
> Andre
>
> Andre Przywara (2):
>   sunxi: Move common defconfig options to Kconfig
>   sunxi: Remove no longer needed default options from defconfigs

Applied to u-boot-sunxi/master


Re: [U-Boot] Pull request: u-boot-riscv/master

2020-03-18 Thread Tom Rini
On Tue, Mar 17, 2020 at 04:03:57PM +0800, ub...@andestech.com wrote:

> Hi Tom,
> 
> Please pull some riscv updates:
> 
> - Fix sbi_remote_sfence_vma{,_asid}.
> - Avoid calling sbi_clear_ipi().
> - Add new SBI v0.2 extensions support.
> 
> https://travis-ci.org/github/rickchen36/u-boot-riscv/builds/663341855
> 
> Thanks
> Rick
> 
> 
> The following changes since commit a4df9d8ab848ea4ff10b247ae435b0a14bbbd066:
> 
>   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell (2020-03-16 
> 12:33:24 -0400)
> 
> are available in the Git repository at:
> 
>   g...@gitlab.denx.de:u-boot/custodians/u-boot-riscv.git
> 
> for you to fetch changes up to 5bde2152d42515f7af46d210d7edf14e3b10d5f5:
> 
>   riscv: Implement new SBI v0.2 extensions (2020-03-17 11:29:54 +0800)
> 

Applied to u-boot/master, thanks!


-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request for UEFI sub-system for efi-2020-04-rc4 (4)

2020-03-18 Thread Tom Rini
On Wed, Mar 18, 2020 at 10:34:44AM +0100, Heinrich Schuchardt wrote:

> The following changes since commit a4df9d8ab848ea4ff10b247ae435b0a14bbbd066:
> 
>   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
> (2020-03-16 12:33:24 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-efi.git
> tags/efi-2020-04-rc4-4
> 
> for you to fetch changes up to 74b44875357378c83e4bd150c0b759ca6ae6563a:
> 
>   efi_loader: correct a definition of struct efi_capsule_header
> (2020-03-17 08:29:52 +0100)
> 
> No errors were reported by Gitlab:
> https://gitlab.denx.de/u-boot/custodians/u-boot-efi/pipelines/2454
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request: u-boot-sunxi/master

2020-03-18 Thread Tom Rini
On Wed, Mar 18, 2020 at 03:42:40PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR.
> 
> thanks,
> Jagan.
> 
> The following changes since commit a4df9d8ab848ea4ff10b247ae435b0a14bbbd066:
> 
>   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell (2020-03-16 
> 12:33:24 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi master
> 
> for you to fetch changes up to 3586cb82277e8af9eae38b354bb8b2aee38ee377:
> 
>   Revert "sunxi: psci: avoid error address-of-packed-member" (2020-03-18 
> 15:37:08 +0530)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v3 21/23] travis/gitlab/azure: Simplify the exit code for test.py

2020-03-18 Thread Simon Glass
It seems unnecessary to read the exit code and then check it again. Drop
this and just let the test.py provide the exit code directly.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update travis, azure also

 .azure-pipelines.yml | 4 
 .gitlab-ci.yml   | 6 +-
 .travis.yml  | 6 +-
 3 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 612e645d0a..28a6583319 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -259,10 +259,6 @@ jobs:
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
   # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if 
not
   ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} 
${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir 
"$UBOOT_TRAVIS_BUILD_DIR";
-  ret=$?;
-  if [[ $ret -ne 0 ]]; then
-  exit $ret;
-  fi
   # the below corresponds to .gitlab-ci.yml "after_script"
   rm -rf /tmp/uboot-test-hooks /tmp/venv
   EOF
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 065ac769f9..64d8b1bdfc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -45,11 +45,7 @@ stages:
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
   ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
 ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
---build-dir "$UBOOT_TRAVIS_BUILD_DIR";
-  ret=$?;
-  if [[ $ret -ne 0 ]]; then
-exit $ret;
-  fi
+--build-dir "$UBOOT_TRAVIS_BUILD_DIR"
 
 build all 32bit ARM platforms:
   tags: [ 'all' ]
diff --git a/.travis.yml b/.travis.yml
index 5be4c54403..757e425467 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -147,11 +147,7 @@ script:
  pip install -r test/py/requirements.txt;
  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
-   --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
- ret=$?;
- if [[ $ret -ne 0 ]]; then
-   exit $ret;
- fi;
+   --build-dir "$UBOOT_TRAVIS_BUILD_DIR" || exit;
  if [[ -n "${TEST_PY_TOOLS}" ]]; then
export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 23/23] test/py: Allow using buildman to build U-Boot

2020-03-18 Thread Simon Glass
It is a pain to have to set the CROSS_COMPILE environment variable when
using test.py's --build option. It is possible to get this using the -A
option from buildman. But it seems better to just use buildman to do the
build when it is available.

However using buildman adds a new dependency to the test system which we
want to avoid. So leave the default as is and add a flag to make it use
buildman.

Note that most of these changes relate to test.py and the parts of the
travis/gitlab/azure scripts which relate to running test and building a
suitable U-Boot to run the tests on.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Convert this into an option, leaving the default as is

 test/py/README.md   | 13 -
 test/py/conftest.py | 30 +-
 2 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/test/py/README.md b/test/py/README.md
index 3cbe01b73e..2e5025258d 100644
--- a/test/py/README.md
+++ b/test/py/README.md
@@ -138,6 +138,9 @@ command-line option; see the next section.
   before running the tests. If using this option, make sure that any
   environment variables required by the build process are already set, such as
   `$CROSS_COMPILE`.
+- `--buildman` indicates that `--build` should use buildman to build U-Boot.
+  There is no need to set $CROSS_COMPILE` in this case since buildman handles
+  it.
 - `--build-dir` sets the directory containing the compiled U-Boot binaries.
   If omitted, this is `${source_dir}/build-${board_type}`.
 - `--result-dir` sets the directory to write results, such as log files,
@@ -333,7 +336,7 @@ PATH=$HOME/ubtest/bin:$PATH \
 
 If you want the test script to compile U-Boot for you too, then you likely
 need to set `$CROSS_COMPILE` to allow this, and invoke the test script as
-follow:
+follows:
 
 ```bash
 CROSS_COMPILE=arm-none-eabi- \
@@ -342,6 +345,14 @@ CROSS_COMPILE=arm-none-eabi- \
 ./test/py/test.py --bd seaboard --build
 ```
 
+or, using buildman to handle it:
+
+```bash
+PATH=$HOME/ubtest/bin:$PATH \
+PYTHONPATH=${HOME}/ubtest/py/${HOSTNAME}:${PYTHONPATH} \
+./test/py/test.py --bd seaboard --build --buildman
+```
+
 ## Writing tests
 
 Please refer to the pytest documentation for details of writing pytest tests.
diff --git a/test/py/conftest.py b/test/py/conftest.py
index 34ac4fb062..e3392ff6bc 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -70,6 +70,8 @@ def pytest_addoption(parser):
 help='U-Boot board identity/instance')
 parser.addoption('--build', default=False, action='store_true',
 help='Compile U-Boot before running tests')
+parser.addoption('--buildman', default=False, action='store_true',
+help='Use buildman to build U-Boot (assuming --build is given)')
 parser.addoption('--gdbserver', default=None,
 help='Run sandbox under gdbserver. The argument is the channel '+
 'over which gdbserver should communicate, e.g. localhost:1234')
@@ -140,16 +142,26 @@ def pytest_configure(config):
 log = multiplexed_log.Logfile(result_dir + '/test-log.html')
 
 if config.getoption('build'):
-if build_dir != source_dir:
-o_opt = 'O=%s' % build_dir
+if config.getoption('buildman'):
+if build_dir != source_dir:
+dest_args = ['-o', build_dir, '-w']
+else:
+dest_args = ['-i']
+cmds = (['buildman', '--board', board_type] + dest_args,)
+name = 'buildman'
 else:
-o_opt = ''
-cmds = (
-['make', o_opt, '-s', board_type + '_defconfig'],
-['make', o_opt, '-s', '-j8'],
-)
-with log.section('make'):
-runner = log.get_runner('make', sys.stdout)
+if build_dir != source_dir:
+o_opt = 'O=%s' % build_dir
+else:
+o_opt = ''
+cmds = (
+['make', o_opt, '-s', board_type + '_defconfig'],
+['make', o_opt, '-s', '-j8'],
+)
+name = 'make'
+
+with log.section(name):
+runner = log.get_runner(name, sys.stdout)
 for cmd in cmds:
 runner.run(cmd, cwd=source_dir)
 runner.close()
-- 
2.25.1.481.gfbce0eb801-goog



RE: [PATCH v4 3/3] env: Add CONFIG_ENV_FULL_SUPPORT

2020-03-18 Thread Patrick DELAUNAY
Hi,

> From: Patrick DELAUNAY 
> Sent: jeudi 3 octobre 2019 09:24
> To: u-boot@lists.denx.de
> 
> Add a new flag CONFIG_ENV_FULL_SUPPORT to compile all
> the environment features (attributes, callbacks
> and flags) in U-Boot, TPL and SPL.
> 
> This flag replace the existing flags for SPL and TPL
> (CONFIG_SPL_ENV_SUPPORT / CONFIG_TPL_ENV_SUPPORT), because
> the same support of environment features is mandatory for U-Boot,
> SPL and TPL.
> 
> To deactivate the load/save environment support in SPL / TPL,
> the board need to activate CONFIG_SPL_ENV_IS_NOWHERE or
> CONFIG_TPL_ENV_IS_NOWHERE.
> 
> With this patch, the environment is activated by default in SPL
> and TPL, which include the content of default_environment[] as
> U-boot. To avoid to increase their size, this patch also add
> 3 new confif : CONFIG_$(SPL_TPL_)ENV_DEFAULT.
> It is deactivated by default for SPL/TPL and activated by
> default for U-Boot, the default environment for SPL/TPL is empty
> and it will be populated only when it will be loaded from storage
> medium.
> 
> All the test on CONFIG_SPL_ENV_SUPPORT are replaced by the
> ENV_IS_SOMEWHERE macro, which tests if the environment is
> storage medium.
> 
> Signed-off-by: Patrick Delaunay 
> ---
Hi Tom,

I try to solve default environment size issue in patch =

http://patchwork.ozlabs.org/patch/1257545/
[RFC RFT PATCH] env: spl: filter the variables in default environment of SPL or 
TPL

But as it is not acceptable and I don't see other solution, 
I won't push v5 and I considere this serie abandoned.

http://patchwork.ozlabs.org/patch/1171180/

Thanks

Patrick


[PATCH v2 00/14] vboot: Fix forged-configuration vulnerability

2020-03-18 Thread Simon Glass
When booting a FIT, if 'bootm' is used without a specified configuration,
U-Boot will use the default one provided in the FIT. But it does not
actually check that the signature is for that configuration.

This means that it is possible to duplicate a configuration conf-1 to
produce conf-2 (with all the signatures intact), set the default
configuration to conf-2 and then boot the image. U-Boot will verify conf-2
(in fact since hashed-nodes specifies the conf-1 nodes it will effectively
verify conf-1). Then it will happily boot conf-2 even though it might have
a different kernel.

This series corrects this problem and adds a test to verify it. It also
updates fit_check_sign to allow the configuration to be specified.

This vulnerability was found by Dmitry Janushkevich and Andrea Barisani of
F-Secure, who also wrote the vboot_forge script included here.

This is CVE-2020-10648

Changes in v2:
- Bring in new vboot_forge file from the authors

Simon Glass (14):
  image: Correct comment for fit_conf_get_node()
  image: Be a little more verbose when checking signatures
  image: Return an error message from fit_config_verify_sig()
  test: vboot: Drop unnecessary parameter for fit_check_sign
  test: vboot: Add a test for a forged configuration
  test: vboot: Parameterise the test
  image: Check hash-nodes when checking configurations
  image: Load the correct configuration in fit_check_sign
  fit_check_sign: Allow selecting the configuration to verify
  test: vboot: Tidy up the code a little
  test: vboot: Fix pylint errors
  image: Use constants for 'required' and 'key-name-hint'
  test: vboot: Move key creation into a function
  test: vboot: Reduce fake kernel size to 500 bytes

 common/bootm.c   |   6 +-
 common/image-cipher.c|   2 +-
 common/image-fit.c   |  26 +--
 common/image-sig.c   |  49 +++-
 include/image.h  |  24 +-
 lib/rsa/rsa-sign.c   |   6 +-
 test/py/tests/test_vboot.py  | 155 +++--
 test/py/tests/vboot_forge.py | 423 +++
 tools/fdt_host.h |   3 +-
 tools/fit_check_sign.c   |   8 +-
 tools/image-host.c   |  17 +-
 11 files changed, 601 insertions(+), 118 deletions(-)
 create mode 100644 test/py/tests/vboot_forge.py

-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v2 01/14] image: Correct comment for fit_conf_get_node()

2020-03-18 Thread Simon Glass
This should mention that conf_uname can be NULL and should be in the
header file. Fix this.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 common/image-fit.c | 18 --
 include/image.h| 20 
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 4435bc4f1d..7cf02b4574 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1712,24 +1712,6 @@ int fit_conf_find_compat(const void *fit, const void 
*fdt)
return best_match_offset;
 }
 
-/**
- * fit_conf_get_node - get node offset for configuration of a given unit name
- * @fit: pointer to the FIT format image header
- * @conf_uname: configuration node unit name
- *
- * fit_conf_get_node() finds a configuration (within the '/configurations'
- * parent node) of a provided unit name. If configuration is found its node
- * offset is returned to the caller.
- *
- * When NULL is provided in second argument fit_conf_get_node() will search
- * for a default configuration node instead. Default configuration node unit
- * name is retrieved from FIT_DEFAULT_PROP property of the '/configurations'
- * node.
- *
- * returns:
- * configuration node offset when found (>=0)
- * negative number on failure (FDT_ERR_* code)
- */
 int fit_conf_get_node(const void *fit, const char *conf_uname)
 {
int noffset, confs_noffset;
diff --git a/include/image.h b/include/image.h
index b316d167d8..512243f159 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1092,7 +1092,27 @@ int fit_image_check_comp(const void *fit, int noffset, 
uint8_t comp);
 int fit_check_format(const void *fit);
 
 int fit_conf_find_compat(const void *fit, const void *fdt);
+
+/**
+ * fit_conf_get_node - get node offset for configuration of a given unit name
+ * @fit: pointer to the FIT format image header
+ * @conf_uname: configuration node unit name (NULL to use default)
+ *
+ * fit_conf_get_node() finds a configuration (within the '/configurations'
+ * parent node) of a provided unit name. If configuration is found its node
+ * offset is returned to the caller.
+ *
+ * When NULL is provided in second argument fit_conf_get_node() will search
+ * for a default configuration node instead. Default configuration node unit
+ * name is retrieved from FIT_DEFAULT_PROP property of the '/configurations'
+ * node.
+ *
+ * returns:
+ * configuration node offset when found (>=0)
+ * negative number on failure (FDT_ERR_* code)
+ */
 int fit_conf_get_node(const void *fit, const char *conf_uname);
+
 int fit_conf_get_prop_node_count(const void *fit, int noffset,
const char *prop_name);
 int fit_conf_get_prop_node_index(const void *fit, int noffset,
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v2 02/14] image: Be a little more verbose when checking signatures

2020-03-18 Thread Simon Glass
It is useful to be a little more specific about what is being checked.
Update a few messages to help with this.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 common/image-fit.c | 2 +-
 tools/image-host.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 7cf02b4574..a5c85ede8d 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1951,7 +1951,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
fit_uname = fit_get_name(fit, noffset, NULL);
}
if (noffset < 0) {
-   puts("Could not find subimage node\n");
+   printf("Could not find subimage node type '%s'\n", prop_name);
bootstage_error(bootstage_id + BOOTSTAGE_SUB_SUBNODE);
return -ENOENT;
}
diff --git a/tools/image-host.c b/tools/image-host.c
index 76a361b9d6..b3ec197dc9 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -1034,7 +1034,8 @@ int fit_check_sign(const void *fit, const void *key)
if (!cfg_noffset)
return -1;
 
-   printf("Verifying Hash Integrity ... ");
+   printf("Verifying Hash Integrity for node '%s'... ",
+  fdt_get_name(fit, cfg_noffset, NULL));
ret = fit_config_verify(fit, cfg_noffset);
if (ret)
return ret;
-- 
2.25.1.481.gfbce0eb801-goog



Re: [RFC 03/14] efi_loader: export a couple of protocol related functions

2020-03-18 Thread Heinrich Schuchardt

On 3/17/20 3:12 AM, AKASHI Takahiro wrote:

This is a preparatory patch.
Those functions will be used in an implementation of UEFI firmware
management protocol as part of my capsule update patch.

Signed-off-by: AKASHI Takahiro 


Merged into U-Boot master

Best regards

Heinrich


[PATCH v6 08/12] arm: dts: actions: s700: add u-boot specific dtsi file

2020-03-18 Thread Amit Singh Tomar
Devices like uart and clk are needed to be enabled before relocation.
this patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.

Reviewed-by: Andre Przywara 
Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Added reviwed-by tag.
Changes since v4:
* Moved it to 08/11 to 06/11.
Changes since v3:
* Replaced dtsi with dts in subject line along with arm:dts:
  to the prefix.
Changes since v2:
* Added License.
Changes since v1:
* This is newly added file that was *not* present in v1 and
  contains u-boot specific changes. 
---
 arch/arm/dts/s700-u-boot.dtsi | 18 ++
 1 file changed, 18 insertions(+)
 create mode 100644 arch/arm/dts/s700-u-boot.dtsi

diff --git a/arch/arm/dts/s700-u-boot.dtsi b/arch/arm/dts/s700-u-boot.dtsi
new file mode 100644
index 000..a527ccc
--- /dev/null
+++ b/arch/arm/dts/s700-u-boot.dtsi
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Amit Singh Tomar 
+ */
+
+/{
+   soc {
+   u-boot,dm-pre-reloc;
+   };
+};
+
+ {
+   u-boot,dm-pre-reloc;
+};
+
+ {
+   u-boot,dm-pre-reloc;
+};
-- 
2.7.4



[PATCH v6 05/12] arm: dts: actions: s900: add u-boot specific dtsi file

2020-03-18 Thread Amit Singh Tomar
Devices like uart and clk are needed to be enabled before relocation.
This patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.

Reviewed-by: Manivannan Sadhasivam 
Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* No changes.
Changes since v4:
* This patch is re-ordered, moved from 08/11 to 04/11.
Changes since v3:
* Replaced dtsi with dts in subject line along with arm:dts:
  to the prefix.
* Added reviewed-by tag.
Changes since v2:
* Newly added patch, not there in v2/v1.
---
 arch/arm/dts/s900-u-boot.dtsi | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 arch/arm/dts/s900-u-boot.dtsi

diff --git a/arch/arm/dts/s900-u-boot.dtsi b/arch/arm/dts/s900-u-boot.dtsi
new file mode 100644
index 000..a95f2cc
--- /dev/null
+++ b/arch/arm/dts/s900-u-boot.dtsi
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ */
+
+/{
+   soc {
+   u-boot,dm-pre-reloc;
+   };
+};
+
+ {
+   u-boot,dm-pre-reloc;
+};
+
+ {
+   u-boot,dm-pre-reloc;
+};
-- 
2.7.4



[PATCH v6 07/12] arm: actions: add S700 SoC device tree

2020-03-18 Thread Amit Singh Tomar
This patch adds .dtsi file(sync with Linux 5.5-rc6 with hash "b3a987b0264d")
and required binding for S700 SoC that is a 64-bit Quad-core ARM
Cortex-A53 cores.

It also provisions dts file to be built based on selected
platform(CONFIG_MACH_S900/S700).

Reviewed-by: Andre Przywara 
Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Added reviwed-by tag.
Changes since v4:
* Move it to 07/11 from 05/11.
Changes since v3:
* Updated commit message to the Linux tag to
  which the dtsi file is synced.   
Changes since v2:
* Synced DTS bindings with Linux 5.5.
Changes since v1:
* Moved the u-boot specific changes to s700-u-boot.dtsi, now
  s700.dtsi is in complete sync with Linux 4.20.
---
 arch/arm/dts/Makefile  |   6 +-
 arch/arm/dts/s700.dtsi | 248 +
 include/dt-bindings/clock/actions,s700-cmu.h   | 118 
 include/dt-bindings/reset/actions,s700-reset.h |  34 
 4 files changed, 404 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/s700.dtsi
 create mode 100644 include/dt-bindings/clock/actions,s700-cmu.h
 create mode 100644 include/dt-bindings/reset/actions,s700-reset.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9c593b2..308c76b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -64,8 +64,10 @@ dtb-$(CONFIG_KIRKWOOD) += \
kirkwood-pogo_e02.dtb \
kirkwood-sheevaplug.dtb
 
-dtb-$(CONFIG_ARCH_OWL) += \
-   bubblegum_96.dtb
+dtb-$(CONFIG_MACH_S900) += \
+bubblegum_96.dtb
+dtb-$(CONFIG_MACH_S700) += \
+s700-cubieboard7.dtb
 
 dtb-$(CONFIG_ROCKCHIP_PX30) += \
px30-evb.dtb \
diff --git a/arch/arm/dts/s700.dtsi b/arch/arm/dts/s700.dtsi
new file mode 100644
index 000..2006ad5
--- /dev/null
+++ b/arch/arm/dts/s700.dtsi
@@ -0,0 +1,248 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Andreas Färber
+ */
+
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "actions,s700";
+   interrupt-parent = <>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   };
+
+   cpu1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x1>;
+   enable-method = "psci";
+   };
+
+   cpu2: cpu@2 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x2>;
+   enable-method = "psci";
+   };
+
+   cpu3: cpu@3 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x3>;
+   enable-method = "psci";
+   };
+   };
+
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   secmon@1f00 {
+   reg = <0x0 0x1f00 0x0 0x100>;
+   no-map;
+   };
+   };
+
+   psci {
+   compatible = "arm,psci-0.2";
+   method = "smc";
+   };
+
+   arm-pmu {
+   compatible = "arm,cortex-a53-pmu";
+   interrupts = ,
+,
+,
+;
+   interrupt-affinity = <>, <>, <>, <>;
+   };
+
+   timer {
+   compatible = "arm,armv8-timer";
+   interrupts = ,
+,
+,
+;
+   };
+
+   hosc: hosc {
+   compatible = "fixed-clock";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+   losc: losc {
+   compatible = "fixed-clock";
+   clock-frequency = <32768>;
+   #clock-cells = <0>;
+   };
+
+   soc {
+   compatible = "simple-bus";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   gic: interrupt-controller@e00f1000 {
+   compatible = "arm,gic-400";
+   reg = <0x0 0xe00f1000 0x0 0x1000>,
+ <0x0 0xe00f2000 0x0 0x2000>,
+ <0x0 0xe00f4000 0x0 0x2000>,
+ <0x0 0xe00f6000 0x0 0x2000>;
+   interrupts = ;
+   interrupt-controller;
+   

[PATCH v6 12/12] doc: boards: add Cubieboard7 documentation

2020-03-18 Thread Amit Singh Tomar
This adds build and flash steps for Actions S700
based Cubieboard7 board.

Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* No changes.
Changes since v4:
* No changes.
Changes since v3:
* Convert plain text documentation to reStructuredText format.
Changes since v2:
* No Change.
Changes since v1:
* No Change.
---
 doc/board/actions/cubieboard7.rst | 115 ++
 doc/board/actions/index.rst   |  10 
 doc/board/index.rst   |   1 +
 3 files changed, 126 insertions(+)
 create mode 100644 doc/board/actions/cubieboard7.rst
 create mode 100644 doc/board/actions/index.rst

diff --git a/doc/board/actions/cubieboard7.rst 
b/doc/board/actions/cubieboard7.rst
new file mode 100644
index 000..ce39e6b
--- /dev/null
+++ b/doc/board/actions/cubieboard7.rst
@@ -0,0 +1,115 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright (C) 2020 Amit Singh Tomar 
+
+ACTIONS
+
+
+About this
+--
+
+This document describes build and flash steps for Actions S700 SoC based 
Cubieboard7
+board.
+
+Cubieboard7 initial configuration
+-
+
+Default Cubieboard7 comes with pre-installed Android where U-Boot is 
configured with
+a bootdelay of 0, entering a prompt by pressing keys does not seem to work.
+
+Though, one can enter ADFU mode and flash debian image(from host machine) where
+getting into u-boot prompt is easy.
+
+Enter ADFU Mode
+
+
+Before write the firmware, let the development board entering the ADFU mode: 
insert
+one end of the USB cable to the PC, press and hold the ADFU button, and then 
connect
+the other end of the USB cable to the Mini USB port of the development board, 
release
+the ADFU button, after connecting it will enter the ADFU mode.
+
+Check whether entered ADFU Mode
+
+
+The user needs to run the following command on the PC side to check if the ADFU
+device is detected. ID realted to "Actions Semiconductor Co., Ltd"  means that
+the PC side has been correctly detected ADFU device, the development board
+also enter into the ADFU mode.
+
+.. code-block:: none
+
+   $ lsusb
+   Bus 001 Device 005: ID 04f2:b2eb Chicony Electronics Co., Ltd
+   Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 
[ThinkPad]
+   Bus 001 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
+   Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
+   Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+   Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
+   Bus 003 Device 013: ID 10d6:10d6 Actions Semiconductor Co., Ltd
+   Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+
+Flashing debian image
+-
+
+.. code-block:: none
+
+   $ sudo ./ActionsFWU.py --fw=debian-stretch-desktop-cb7-emmc-v2.0.fw
+   ActionsFWU.py   : 1.0.150828.0830
+   libScript.so: 2.3.150825.0951
+   libFileSystem.so: 2.3.150825.0952
+   libProduction.so: 2.3.150915.1527
+   =burn all partition
+   FW_VER: 3.10.37.180608
+   3% DOWNLOAD ADFUDEC ...
+   5% DOWNLOAD BOOT PARA ...
+   7% SWITCH ADFUDEC ...
+   12% DOWNLOAD BL31 ...
+   13% DOWNLOAD BL32 ...
+   15% DOWNLOAD VMLINUX ...
+   20% DOWNLOAD INITRD ...
+   24% DOWNLOAD FDT ...
+   27% DOWNLOAD ADFUS ...
+   30% SWITCH ADFUS ...
+   32% DOWNLOAD MBR ...
+   35% DOWNLOAD PARTITIONS ...
+   WRITE_MBRC_PARTITION
+   35% write p0 size = 2048 : ok
+   WRITE_BOOT_PARTITION
+   35% write p1 size = 2048 : ok
+   WRITE_MISC_PARTITION
+   36% write p2 size = 98304 : ok
+   WRITE_SYSTEM_PARTITION
+   94% write p3 size = 4608000 : ok
+   FORMAT_SWAP_PARTITION
+   94% write p4 size = 20480 : ok
+   95% TRANSFER OVER ...
+   Firmware upgrade successfully!
+
+Debian image can be downloaded from here[1].
+
+Once debian image is flashed, one can get into u-boot prompt by pressing any 
key and from
+there run ums command(make sure, usb cable is connected between host and 
target):
+
+.. code-block:: none
+
+   owl> ums 0 mmc 1
+
+Above command would mount debian image partition on host machine.
+
+Building U-BOOT proper image
+
+
+.. code-block:: none
+
+   $ make clean
+   $ export CROSS_COMPILE=aarch64-linux-gnu-
+   $ make ARCH=arm cubieboard7_defconfig
+   $ make -j16
+   $ mkimage -A arm -T firmware -C none -O u-boot -a 0x1100 -e 0x1100 
-d u-boot-dtb.bin u-boot-dtb.img  >/dev/null
+
+u-boot-dtb.img can now be flashed to debian image partition mounted on host 
machine.
+
+.. code-block:: none
+
+   $ sudo dd if=u-boot-dtb.img of=/dev/sdb bs=1024 seek=3072
+
+[1]: 
https://pan.baidu.com/s/1uawPr0Jao2HgWFLZCLzHAg#list/path=%2FCubieBoard_Download%2FBoard%2FCubieBoard7%2F%E6%96%B9%E7%B3%96%E6%96%B9%E6%A1%88%E5%BC%80%E5%8F%91%E8%B5%84%E6%96%99%2FImage%2FDebian%2FV2.1-test=%2F
diff --git a/doc/board/actions/index.rst b/doc/board/actions/index.rst
new file mode 100644
index 

Re: [PATCH v2 12/14] image: Use constants for 'required' and 'key-name-hint'

2020-03-18 Thread Philippe REYNES



> Objet: [PATCH v2 12/14] image: Use constants for 'required' and 
> 'key-name-hint'

> These are used in multiple places so update them to use a shared #define.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Philippe Reynes 

> ---
> 
> Changes in v2: None
> 
> common/image-cipher.c | 2 +-
> common/image-fit.c | 6 +++---
> common/image-sig.c | 8 +---
> include/image.h | 4 +++-
> lib/rsa/rsa-sign.c | 6 +++---
> tools/image-host.c | 8 
> 6 files changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/common/image-cipher.c b/common/image-cipher.c
> index cee3b03ee5..f50c3d31bd 100644
> --- a/common/image-cipher.c
> +++ b/common/image-cipher.c
> @@ -88,7 +88,7 @@ static int fit_image_setup_decrypt(struct image_cipher_info
> *info,
> return -1;
> }
> 
> - info->keyname = fdt_getprop(fit, cipher_noffset, "key-name-hint", NULL);
> + info->keyname = fdt_getprop(fit, cipher_noffset, FIT_KEY_HINT, NULL);
> if (!info->keyname) {
> printf("Can't get key name\n");
> return -1;
> diff --git a/common/image-fit.c b/common/image-fit.c
> index a5c85ede8d..c8ff77526c 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -168,7 +168,7 @@ static void fit_image_print_data(const void *fit, int
> noffset, const char *p,
> int value_len;
> char *algo;
> const char *padding;
> - int required;
> + bool required;
> int ret, i;
> 
> debug("%s %s node: '%s'\n", p, type,
> @@ -179,8 +179,8 @@ static void fit_image_print_data(const void *fit, int
> noffset, const char *p,
> return;
> }
> printf("%s", algo);
> - keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
> - required = fdt_getprop(fit, noffset, "required", NULL) != NULL;
> + keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
> + required = fdt_getprop(fit, noffset, FIT_KEY_REQUIRED, NULL) != NULL;
> if (keyname)
> printf(":%s", keyname);
> if (required)
> diff --git a/common/image-sig.c b/common/image-sig.c
> index 03143a4040..6563effcf3 100644
> --- a/common/image-sig.c
> +++ b/common/image-sig.c
> @@ -229,7 +229,7 @@ static int fit_image_setup_verify(struct image_sign_info
> *info,
> padding_name = RSA_DEFAULT_PADDING_NAME;
> 
> memset(info, '\0', sizeof(*info));
> - info->keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
> + info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
> info->fit = (void *)fit;
> info->node_offset = noffset;
> info->name = algo_name;
> @@ -340,7 +340,8 @@ int fit_image_verify_required_sigs(const void *fit, int
> image_noffset,
> const char *required;
> int ret;
> 
> - required = fdt_getprop(sig_blob, noffset, "required", NULL);
> + required = fdt_getprop(sig_blob, noffset, FIT_KEY_REQUIRED,
> + NULL);
> if (!required || strcmp(required, "image"))
> continue;
> ret = fit_image_verify_sig(fit, image_noffset, data, size,
> @@ -557,7 +558,8 @@ int fit_config_verify_required_sigs(const void *fit, int
> conf_noffset,
> const char *required;
> int ret;
> 
> - required = fdt_getprop(sig_blob, noffset, "required", NULL);
> + required = fdt_getprop(sig_blob, noffset, FIT_KEY_REQUIRED,
> + NULL);
> if (!required || strcmp(required, "conf"))
> continue;
> ret = fit_config_verify_sig(fit, conf_noffset, sig_blob,
> diff --git a/include/image.h b/include/image.h
> index 512243f159..3ffc0fdd68 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -939,12 +939,14 @@ int booti_setup(ulong image, ulong *relocated_addr, 
> ulong
> *size,
> #define FIT_IMAGES_PATH "/images"
> #define FIT_CONFS_PATH "/configurations"
> 
> -/* hash/signature node */
> +/* hash/signature/key node */
> #define FIT_HASH_NODENAME "hash"
> #define FIT_ALGO_PROP "algo"
> #define FIT_VALUE_PROP "value"
> #define FIT_IGNORE_PROP "uboot-ignore"
> #define FIT_SIG_NODENAME "signature"
> +#define FIT_KEY_REQUIRED "required"
> +#define FIT_KEY_HINT "key-name-hint"
> 
> /* cipher node */
> #define FIT_CIPHER_NODENAME "cipher"
> diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
> index 6400ef63d6..580c744709 100644
> --- a/lib/rsa/rsa-sign.c
> +++ b/lib/rsa/rsa-sign.c
> @@ -792,8 +792,8 @@ int rsa_add_verify_data(struct image_sign_info *info, void
> *keydest)
> }
> 
> if (!ret) {
> - ret = fdt_setprop_string(keydest, node, "key-name-hint",
> - info->keyname);
> + ret = fdt_setprop_string(keydest, node, FIT_KEY_HINT,
> + info->keyname);
> }
> if (!ret)
> ret = fdt_setprop_u32(keydest, node, "rsa,num-bits", bits);
> @@ -815,7 +815,7 @@ int rsa_add_verify_data(struct image_sign_info *info, void
> *keydest)
> info->name);
> }
> if (!ret && info->require_keys) {
> - ret = fdt_setprop_string(keydest, node, "required",
> + ret = fdt_setprop_string(keydest, node, FIT_KEY_REQUIRED,
> info->require_keys);
> }
> done:
> diff --git a/tools/image-host.c b/tools/image-host.c
> index dfea48e894..4e57ddea96 100644
> --- a/tools/image-host.c
> +++ b/tools/image-host.c
> @@ -170,7 +170,7 @@ static int fit_image_setup_sig(struct image_sign_info 
> *info,
> 
> memset(info, '\0', sizeof(*info));
> info->keydir = keydir;
> - info->keyname = 

[PATCH v6 10/12] actions: Move defconfig options to Kconfig

2020-03-18 Thread Amit Singh Tomar
This patch moves some of the config options from bubblegum_96_defconfig
to platform specific Kconfig file.

Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Newly added patch, was not there in earlier versions. 
---
 arch/arm/mach-owl/Kconfig  | 16 
 configs/bubblegum_96_defconfig |  5 -
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
index 1d59d8f..0bd02e2 100644
--- a/arch/arm/mach-owl/Kconfig
+++ b/arch/arm/mach-owl/Kconfig
@@ -25,4 +25,20 @@ config SYS_SOC
 default "s900" if MACH_S900
 default "s700" if MACH_S700
 
+config DISTRO_DEFAULTS
+   default y
+
+config NR_DRAM_BANKS
+   default 1
+
+config SYS_RELOC_GD_ENV_ADDR
+   default y
+
+config SYS_PROMPT
+   string "Shell prompt"
+   default "U-Boot => "
+
+config DISPLAY_BOARDINFO
+   default n
+
 endif
diff --git a/configs/bubblegum_96_defconfig b/configs/bubblegum_96_defconfig
index e76e9a2..0883167 100644
--- a/configs/bubblegum_96_defconfig
+++ b/configs/bubblegum_96_defconfig
@@ -1,19 +1,14 @@
 CONFIG_ARM=y
 CONFIG_ARCH_OWL=y
 CONFIG_ENV_SIZE=0x2000
-CONFIG_NR_DRAM_BANKS=1
 CONFIG_MACH_S900=y
 CONFIG_IDENT_STRING="\nBubblegum-96"
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyOWL5,115200n8"
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
-CONFIG_SYS_PROMPT="U-Boot => "
 CONFIG_CMD_MD5SUM=y
 CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIMER=y
 CONFIG_DEFAULT_DEVICE_TREE="bubblegum_96"
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-- 
2.7.4



[PATCH v6 09/12] arm: add support Actions Semi S700

2020-03-18 Thread Amit Singh Tomar
This patch adds basic support for Actions Semi based S700
SoC, which is driven by common owl framework.

Reviewed-by: Andre Przywara 
Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Added reviewed-by tag.
Changes since v4:
* Moved it to 09/11 to 04/11.
Changes since v3:
* Added "SoC" keyword to Actions Semi S700.
Changes since v2:
* Fixed the commit message.
* Checked for the clk->id.
* Added a .data member with SoC type.
* Removed #ifdefs from few places.
Changes since v1:
* Moved CLK and CLK_OWL symbols from defconfig to arch/arm/Kconfig.
---
 arch/arm/mach-owl/Kconfig |  6 ++
 include/configs/s700.h| 13 +
 2 files changed, 19 insertions(+)
 create mode 100644 include/configs/s700.h

diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
index d0be2b5..1d59d8f 100644
--- a/arch/arm/mach-owl/Kconfig
+++ b/arch/arm/mach-owl/Kconfig
@@ -8,6 +8,10 @@ config MACH_S900
 bool "Actions Semi S900 SoC"
 select ARM64
 
+config MACH_S700
+bool "Actions Semi S700 SoC"
+select ARM64
+
 endchoice
 
 config SYS_TEXT_BASE
@@ -15,8 +19,10 @@ config SYS_TEXT_BASE
 
 config SYS_CONFIG_NAME
 default "s900" if MACH_S900
+default "s700" if MACH_S700
 
 config SYS_SOC
 default "s900" if MACH_S900
+default "s700" if MACH_S700
 
 endif
diff --git a/include/configs/s700.h b/include/configs/s700.h
new file mode 100644
index 000..fab0d04
--- /dev/null
+++ b/include/configs/s700.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ */
+
+#ifndef _CONFIG_S700_H_
+#define _CONFIG_S700_H_
+
+/*
+ * Include common owl configuration where most the settings are
+ */
+#include 
+
+#endif
-- 
2.7.4



[PATCH v6 11/12] arm: add Cubieboard7 board support

2020-03-18 Thread Amit Singh Tomar
The Cubieboard is a single board computer containing a
Actions S700 SoC(with 4 ARMv8 Cortex-A53 cores).

This patch adds respective defconfig alongwith .dts(copied
from Linux v5.5-rc6 with hash "b3a987b0264d").

Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Trimmed of the cubieboard7_defconfig.
Changes since v4:
* No changes.
Changes since v3:
* added reviewed-by: tag.
Changes since v2:
* No changes.   
Changes since v1:
* No changes.   
---
 arch/arm/dts/s700-cubieboard7.dts | 92 +++
 configs/cubieboard7_defconfig |  9 
 2 files changed, 101 insertions(+)
 create mode 100644 arch/arm/dts/s700-cubieboard7.dts
 create mode 100644 configs/cubieboard7_defconfig

diff --git a/arch/arm/dts/s700-cubieboard7.dts 
b/arch/arm/dts/s700-cubieboard7.dts
new file mode 100644
index 000..63e375c
--- /dev/null
+++ b/arch/arm/dts/s700-cubieboard7.dts
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Andreas Färber
+ */
+
+/dts-v1/;
+
+#include "s700.dtsi"
+
+/ {
+   compatible = "cubietech,cubieboard7", "actions,s700";
+   model = "CubieBoard7";
+
+   aliases {
+   serial3 = 
+   };
+
+   chosen {
+   stdout-path = "serial3:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x8000>;
+   };
+
+   memory@1,e000 {
+   device_type = "memory";
+   reg = <0x1 0xe000 0x0 0x0>;
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_default>;
+};
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_default>;
+};
+
+ {
+   status = "disabled";
+   pinctrl-names = "default";
+   pinctrl-0 = <_default>;
+};
+
+ {
+   i2c0_default: i2c0_default {
+   pinmux {
+   groups = "i2c0_mfp";
+   function = "i2c0";
+   };
+   pinconf {
+   pins = "i2c0_sclk", "i2c0_sdata";
+   bias-pull-up;
+   };
+   };
+
+   i2c1_default: i2c1_default {
+   pinmux {
+   groups = "i2c1_dummy";
+   function = "i2c1";
+   };
+   pinconf {
+   pins = "i2c1_sclk", "i2c1_sdata";
+   bias-pull-up;
+   };
+   };
+
+   i2c2_default: i2c2_default {
+   pinmux {
+   groups = "i2c2_dummy";
+   function = "i2c2";
+   };
+   pinconf {
+   pins = "i2c2_sclk", "i2c2_sdata";
+   bias-pull-up;
+   };
+   };
+};
+
+ {
+   clocks = <>;
+};
+
+ {
+   status = "okay";
+};
diff --git a/configs/cubieboard7_defconfig b/configs/cubieboard7_defconfig
new file mode 100644
index 000..d12c293
--- /dev/null
+++ b/configs/cubieboard7_defconfig
@@ -0,0 +1,9 @@
+CONFIG_ARM=y
+CONFIG_ARCH_OWL=y
+CONFIG_MACH_S700=y
+CONFIG_IDENT_STRING="\ncubieboard7"
+CONFIG_BOOTDELAY=5
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyOWL3,115200n8"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DEFAULT_DEVICE_TREE="s700-cubieboard7"
-- 
2.7.4



[PATCH v3 10/23] travis: Don't copy files into .bm-work/

2020-03-18 Thread Simon Glass
At present if TEST_PY_BD is empty the script copies various files into a
directory, to no purpose. This happens because UBOOT_TRAVIS_BUILD_DIR is
set before TEST_PY_BD is tested.

Move the 'if' to fix this.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add a new patch to avoid copying files into .bm-work/

 .travis.yml | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index c59bd7790b..f6e3a5d3af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -130,12 +130,12 @@ script:
  # never prevent any test from running. That way, we can always pass
  # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
  # value.
- - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
-   cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
-   cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
-   cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
-   cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
-   if [[ "${TEST_PY_BD}" != "" ]]; then
+ - if [[ "${TEST_PY_BD}" != "" ]]; then
+ export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
+ cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
+ cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
+ cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
+ cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
  virtualenv -p /usr/bin/python3 /tmp/venv;
  . /tmp/venv/bin/activate;
  pip install -r test/py/requirements.txt;
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 05/23] buildman: Update help for -d

2020-03-18 Thread Simon Glass
This help is a bit ambiguous. It only does anything if asked to show size
changes with -S. Update the help and the function comments.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Reword the commit message for clarity

 tools/buildman/builder.py | 6 +++---
 tools/buildman/cmdline.py | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 081c1d0901..a41d0b316e 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -337,7 +337,7 @@ class Builder:
 
 show_errors: True to show summarised error/warning info
 show_sizes: Show size deltas
-show_detail: Show detail for each board
+show_detail: Show size delta detail for each board if show_sizes
 show_bloat: Show detail for each function
 list_error_boards: Show the boards which caused each error/warning
 show_config: Show config deltas
@@ -1000,7 +1000,7 @@ class Builder:
 board.target
 board_dict: Dict containing boards for which we built this
 commit, keyed by board.target. The value is an Outcome object.
-show_detail: Show detail for each board
+show_detail: Show size delta detail for each board
 show_bloat: Show detail for each function
 """
 arch_list = {}
@@ -1117,7 +1117,7 @@ class Builder:
 environment: Dictionary keyed by environment variable, Each
  value is the value of environment variable.
 show_sizes: Show image size deltas
-show_detail: Show detail for each board
+show_detail: Show size delta detail for each board if show_sizes
 show_bloat: Show detail for each function
 show_config: Show config changes
 show_environment: Show environment changes
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index c7b4bf6b4a..74b410010d 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -31,7 +31,7 @@ def ParseArgs():
   help='Reconfigure for every commit (disable incremental build)')
 parser.add_option('-d', '--detail', dest='show_detail',
   action='store_true', default=False,
-  help='Show detailed information for each board in summary')
+  help='Show detailed size delta for each board in the -S summary')
 parser.add_option('-D', '--config-only', action='store_true', 
default=False,
   help="Don't build, just configure each commit")
 parser.add_option('-e', '--show_errors', action='store_true',
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 07/23] buildman: Be more selective about which directories to remove

2020-03-18 Thread Simon Glass
At present buildman removes any directory it doesn't intend to write
output into. This is overly expansive since if the output directory
happens to be somewhere with existing files, they may be removed. Using
an existing directory for buildman is not a good practice, but since the
result might be catastrophic, it is best to guard against it.

A previous commit[1] fixed this by refusing to write to a subdirectory
of the current directory, assumed to have U-Boot source code. But we can
do better by only removing directories that look like the ones buildman
creates.

Update the code to do this and add a test.

Signed-off-by: Simon Glass 

[1] 409fc029c40 tools: buildman: Don't use the working dir as build dir

---

Changes in v3: None
Changes in v2: None

 tools/buildman/builder.py | 27 ++-
 tools/buildman/test.py| 20 
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index a41d0b316e..30ec4254f8 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -485,6 +485,7 @@ class Builder:
 if self.commits:
 commit = self.commits[commit_upto]
 subject = commit.subject.translate(trans_valid_chars)
+# See _GetOutputSpaceRemovals() which parses this name
 commit_dir = ('%02d_of_%02d_g%s_%s' % (commit_upto + 1,
 self.commit_count, commit.hash, subject[:20]))
 elif not self.no_subdirs:
@@ -1525,12 +1526,15 @@ class Builder:
 for thread in range(max_threads):
 self._PrepareThread(thread, setup_git)
 
-def _PrepareOutputSpace(self):
+def _GetOutputSpaceRemovals(self):
 """Get the output directories ready to receive files.
 
-We delete any output directories which look like ones we need to
-create. Having left over directories is confusing when the user wants
-to check the output manually.
+Figure out what needs to be deleted in the output directory before it
+can be used. We only delete old buildman directories which have the
+expected name pattern. See _GetOutputDir().
+
+Returns:
+List of full paths of directories to remove
 """
 if not self.commits:
 return
@@ -1541,7 +1545,20 @@ class Builder:
 to_remove = []
 for dirname in glob.glob(os.path.join(self.base_dir, '*')):
 if dirname not in dir_list:
-to_remove.append(dirname)
+leaf = dirname[len(self.base_dir) + 1:]
+m =  re.match('[0-9]+_of_[0-9]+_g[0-9a-f]+_.*', leaf)
+if m:
+to_remove.append(dirname)
+return to_remove
+
+def _PrepareOutputSpace(self):
+"""Get the output directories ready to receive files.
+
+We delete any output directories which look like ones we need to
+create. Having left over directories is confusing when the user wants
+to check the output manually.
+"""
+to_remove = self._GetOutputSpaceRemovals()
 if to_remove:
 Print('Removing %d old build directories' % len(to_remove),
   newline=False)
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index acd862b3b0..2aaedf44ac 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -22,6 +22,7 @@ import commit
 import terminal
 import test_util
 import toolchain
+import tools
 
 use_network = True
 
@@ -469,6 +470,25 @@ class TestBuild(unittest.TestCase):
 self.assertEqual('HOSTCC=clang CC=clang',
  tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS))
 
+def testPrepareOutputSpace(self):
+def _Touch(fname):
+tools.WriteFile(os.path.join(base_dir, fname), b'')
+
+base_dir = tempfile.mkdtemp()
+
+# Add various files that we want removed and left alone
+to_remove = ['01_of_22_g0982734987_title', '102_of_222_g92bf_title',
+ '01_of_22_g2938abd8_title']
+to_leave = ['something_else', '01-something.patch', '01_of_22_another']
+for name in to_remove + to_leave:
+_Touch(name)
+
+build = builder.Builder(self.toolchains, base_dir, None, 1, 2)
+build.commits = self.commits
+build.commit_count = len(commits)
+result = set(build._GetOutputSpaceRemovals())
+expected = set([os.path.join(base_dir, f) for f in to_remove])
+self.assertEqual(expected, result)
 
 if __name__ == "__main__":
 unittest.main()
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 12/23] gitlab/azure: Use the -w option for sandbox_spl

2020-03-18 Thread Simon Glass
Avoid needing to know about the internal .bm-work directory, by passing
the -w flag to buildman.

This does not affect travis since the previous commit already used the -w
flag.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update azure also

 .azure-pipelines.yml | 4 ++--
 .gitlab-ci.yml   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index f66d58aa76..182482a93a 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -136,10 +136,10 @@ jobs:
   virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
   pip install pyelftools
-  export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl
+  export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
   export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
   export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
-  ./tools/buildman/buildman -o /tmp -P sandbox_spl
+  ./tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w sandbox_spl
   ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
   ./tools/buildman/buildman -t
   ./tools/dtoc/dtoc -t
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 55943bb3a2..248e0530d2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -167,10 +167,10 @@ Run binman, buildman, dtoc and patman testsuites:
   virtualenv -p /usr/bin/python3 /tmp/venv;
   . /tmp/venv/bin/activate;
   pip install pyelftools;
-  export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl;
+  export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
   export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
   export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
-  ./tools/buildman/buildman -o /tmp -P sandbox_spl;
+  ./tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w sandbox_spl;
   ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
   ./tools/buildman/buildman -t;
   ./tools/dtoc/dtoc -t;
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 11/23] travis: Split the building into two parts

2020-03-18 Thread Simon Glass
Buildman is used in two ways:

- to build a selection of boards (with no testing)
- to build a single board (and run pytest)

The gitlab and azure scrips do this in separate places, but travis does
not. To aid the refactoring process and keep the following patches in sync
across all three environments, split the code out in travis as well.

Use the buildman -w option for the single board. It is easier to
understand since it specifies the output directory directly. Also it
avoids needing to look at the internal .bm-work directory.

This initially creates some duplicate code, but by the end of the series
we have two completely different build paths with different arguments.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add a new patch to split travis building into two parts

 .travis.yml | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index f6e3a5d3af..f3703085ba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -118,7 +118,8 @@ script:
  #
  # From buildman, exit code 129 means warnings only.  If we've been asked to
  # use clang only do one configuration.
- - if [[ "${BUILDMAN}" != "" ]]; then
+ # Build a selection of boards if TEST_PY_BD is empty
+ - if [[ "${BUILDMAN}" != "" ]] && [[ "${TEST_PY_BD}" == "" ]]; then
  ret=0;
  tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
@@ -130,12 +131,20 @@ script:
  # never prevent any test from running. That way, we can always pass
  # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
  # value.
+ # Build just the one board needed for testing, if TEST_PY_BD is non-empty
  - if [[ "${TEST_PY_BD}" != "" ]]; then
- export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
+ export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/${TEST_PY_BD};
  cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
  cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
  cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
  cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
+ ret=0;
+ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E ${BUILDMAN}
+   ${OVERRIDE}|| ret=$?;
+ if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+   tools/buildman/buildman -sde -o ${UBOOT_TRAVIS_BUILD_DIR} -w 
${BUILDMAN};
+   exit $ret;
+ fi;
  virtualenv -p /usr/bin/python3 /tmp/venv;
  . /tmp/venv/bin/activate;
  pip install -r test/py/requirements.txt;
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 09/23] buildman: Drop the -a option

2020-03-18 Thread Simon Glass
There is no point in setting the ARCH environment variable since the
U-Boot build system no-longer uses it.

It seems safe to drop this feature since it was only recently added.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Drop mention of -a in the README also

Changes in v2:
- Add a new patch to drop the -a option

 tools/buildman/README |  4 ++--
 tools/buildman/cmdline.py |  2 --
 tools/buildman/control.py | 17 ++---
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index 116a0ee545..4cf0114157 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1072,8 +1072,8 @@ Other options
 
 Buildman has various other command-line options. Try --help to see them.
 
-To find out what architecture or toolchain prefix buildman will use for a 
build,
-see the -a and -A options.
+To find out what toolchain prefix buildman will use for a build, use the -A
+option.
 
 To request that compiler warnings be promoted to errors, use -E. This passes 
the
 -Werror flag to the compiler. Note that the build can still produce warnings
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index f387aeb1cf..17ea015a95 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -13,8 +13,6 @@ def ParseArgs():
 args: command lin arguments
 """
 parser = OptionParser()
-parser.add_option('-a', '--print-arch', action='store_true',
-  help='Print the architecture for a board (ARCH=)')
 parser.add_option('-A', '--print-prefix', action='store_true',
   help='Print the tool-chain prefix for a board (CROSS_COMPILE=)')
 parser.add_option('-b', '--branch', type='string',
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 7d31863c63..5ddc598c95 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -85,16 +85,15 @@ def ShowActions(series, why_selected, boards_selected, 
builder, options,
 for warning in board_warnings:
 print(col.Color(col.YELLOW, warning))
 
-def ShowToolchainInfo(boards, toolchains, print_arch, print_prefix):
+def ShowToolchainPrefix(boards, toolchains):
 """Show information about a the tool chain used by one or more boards
 
-The function checks that all boards use the same toolchain.
+The function checks that all boards use the same toolchain, then prints
+the correct value for CROSS_COMPILE.
 
 Args:
 boards: Boards object containing selected boards
 toolchains: Toolchains object containing available toolchains
-print_arch: True to print ARCH value
-print_prefix: True to print CROSS_COMPILE value
 
 Return:
 None on success, string error message otherwise
@@ -107,10 +106,7 @@ def ShowToolchainInfo(boards, toolchains, print_arch, 
print_prefix):
 return 'Supplied boards must share one toolchain'
 return False
 tc = tc_set.pop()
-if print_arch:
-print(tc.GetEnvArgs(toolchain.VAR_ARCH))
-if print_prefix:
-print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
+print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
 return None
 
 def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
@@ -206,9 +202,8 @@ def DoBuildman(options, args, toolchains=None, 
make_func=None, boards=None,
 if not len(selected):
 sys.exit(col.Color(col.RED, 'No matching boards found'))
 
-if options.print_arch or options.print_prefix:
-err = ShowToolchainInfo(boards, toolchains, options.print_arch,
-options.print_prefix)
+if options.print_prefix:
+err = ShowToolchainInfo(boards, toolchains)
 if err:
 sys.exit(col.Color(col.RED, err))
 return 0
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 15/23] travis/gitlab/azure: Drop the buildman -d flag

2020-03-18 Thread Simon Glass
This has no effect since -S is not given also. Drop it.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update travis, azure also

 .azure-pipelines.yml |  4 ++--
 .gitlab-ci.yml   | 10 +-
 .travis.yml  |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 3d5b12ba3e..684359b88b 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -249,7 +249,7 @@ jobs:
   ret=0;
   tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} 
${OVERRIDE} || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -sdeP --board ${TEST_PY_BD};
+  tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
   exit $ret;
   fi;
   fi
@@ -401,7 +401,7 @@ jobs:
   ret=0;
   tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || 
ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
+  tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
   exit $ret;
   fi;
   fi
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2cd6209222..36c2ecfa43 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -34,7 +34,7 @@ stages:
 tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} ${OVERRIDE}
   || ret=$?;
 if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -sdeP --board ${TEST_PY_BD};
+  tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
   exit $ret;
 fi;
   fi
@@ -65,7 +65,7 @@ build all 32bit ARM platforms:
 - ret=0;
   ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-./tools/buildman/buildman -o /tmp -sdeP;
+./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
 
@@ -79,7 +79,7 @@ build all 64bit ARM platforms:
 - ret=0;
   ./tools/buildman/buildman -o /tmp -P -E aarch64 || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-./tools/buildman/buildman -o /tmp -sdeP;
+./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
 
@@ -90,7 +90,7 @@ build all PowerPC platforms:
 - ret=0;
   ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-./tools/buildman/buildman -o /tmp -sdeP;
+./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
 
@@ -101,7 +101,7 @@ build all other platforms:
 - ret=0;
   ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-./tools/buildman/buildman -o /tmp -sdeP;
+./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
 
diff --git a/.travis.yml b/.travis.yml
index 42a3923565..d7c16326ff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -123,7 +123,7 @@ script:
  ret=0;
  tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-   tools/buildman/buildman -sdeP ${BUILDMAN};
+   tools/buildman/buildman -seP ${BUILDMAN};
exit $ret;
  fi;
fi
@@ -142,7 +142,7 @@ script:
  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E
--board ${TEST_PY_BD} ${OVERRIDE}|| ret=$?;
  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-   tools/buildman/buildman -sde -o ${UBOOT_TRAVIS_BUILD_DIR} -w
+   tools/buildman/buildman -se -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  --board ${TEST_PY_BD};
exit $ret;
  fi;
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 13/23] travis/gitlab/azure: Use --board buildman flag with test.py

2020-03-18 Thread Simon Glass
The current method of selecting the board to build with test.py is a bit
error-prone, e.g. with "^sandbox$" it actually builds 5 boards (all of
those in the sandbox architecture).

Use the (newish) --board flag instead, to get the same result.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update travis, azure also

 .azure-pipelines.yml | 46 -
 .gitlab-ci.yml   | 47 +-
 .travis.yml  | 49 ++--
 3 files changed, 72 insertions(+), 70 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 182482a93a..8092545642 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -158,90 +158,90 @@ jobs:
   matrix:
 sandbox:
   TEST_PY_BD: "sandbox"
-  BUILDMAN: "^sandbox$"
+  BUILDMAN: "sandbox"
 sandbox_clang:
   TEST_PY_BD: "sandbox"
-  BUILDMAN: "^sandbox$"
+  BUILDMAN: "sandbox"
   OVERRIDE: "-O clang-7"
 sandbox_spl:
   TEST_PY_BD: "sandbox_spl"
   TEST_PY_TEST_SPEC: "test_ofplatdata"
-  BUILDMAN: "^sandbox_spl$"
+  BUILDMAN: "sandbox_spl"
 sandbox_flattree:
   TEST_PY_BD: "sandbox_flattree"
-  BUILDMAN: "^sandbox_flattree$"
+  BUILDMAN: "sandbox_flattree"
 evb_ast2500:
   TEST_PY_BD: "evb-ast2500"
   TEST_PY_ID: "--id qemu"
-  BUILDMAN: "^evb-ast2500$"
+  BUILDMAN: "evb-ast2500"
 vexpress_ca15_tc2:
   TEST_PY_BD: "vexpress_ca15_tc2"
   TEST_PY_ID: "--id qemu"
-  BUILDMAN: "^vexpress_ca15_tc2$"
+  BUILDMAN: "vexpress_ca15_tc2"
 vexpress_ca9x4:
   TEST_PY_BD: "vexpress_ca9x4"
   TEST_PY_ID: "--id qemu"
-  BUILDMAN: "^vexpress_ca9x4$"
+  BUILDMAN: "vexpress_ca9x4"
 integratorcp_cm926ejs:
   TEST_PY_BD: "integratorcp_cm926ejs"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^integratorcp_cm926ejs$"
+  BUILDMAN: "integratorcp_cm926ejs"
 qemu_arm:
   TEST_PY_BD: "qemu_arm"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu_arm$"
+  BUILDMAN: "qemu_arm"
 qemu_arm64:
   TEST_PY_BD: "qemu_arm64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu_arm64$"
+  BUILDMAN: "qemu_arm64"
 qemu_mips:
   TEST_PY_BD: "qemu_mips"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu_mips$"
+  BUILDMAN: "qemu_mips"
 qemu_mipsel:
   TEST_PY_BD: "qemu_mipsel"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu_mipsel$"
+  BUILDMAN: "qemu_mipsel"
 qemu_mips64:
   TEST_PY_BD: "qemu_mips64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu_mips64$"
+  BUILDMAN: "qemu_mips64"
 qemu_mips64el:
   TEST_PY_BD: "qemu_mips64el"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu_mips64el$"
+  BUILDMAN: "qemu_mips64el"
 qemu_ppce500:
   TEST_PY_BD: "qemu-ppce500"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu-ppce500$"
+  BUILDMAN: "qemu-ppce500"
 qemu_riscv64:
   TEST_PY_BD: "qemu-riscv64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu-riscv64$"
+  BUILDMAN: "qemu-riscv64"
 qemu_x86:
   TEST_PY_BD: "qemu-x86"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu-x86$"
+  BUILDMAN: "qemu-x86"
 qemu_x86_64:
   TEST_PY_BD: "qemu-x86_64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^qemu-x86_64$"
+  BUILDMAN: "qemu-x86_64"
 zynq_zc702:
   TEST_PY_BD: "zynq_zc702"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^zynq_zc702$"
+  BUILDMAN: "zynq_zc702"
 xilinx_versal_virt:
   TEST_PY_BD: "xilinx_versal_virt"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^xilinx_versal_virt$"
+  BUILDMAN: "xilinx_versal_virt"
 xtfpga:
   TEST_PY_BD: "xtfpga"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "^xtfpga$"
+  BUILDMAN: "xtfpga"
 steps:
   - script: |
   cat << EOF > test.sh
@@ -269,9 +269,9 @@ jobs:
   cd ${WORK_DIR}
   if [[ "${BUILDMAN}" != "" ]]; then
   ret=0;
-  tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || 
ret=$?;
+  tools/buildman/buildman -o /tmp -P -E --board ${BUILDMAN} 
${OVERRIDE} || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -sdeP 

[PATCH v3 16/23] gitlab/azure: Drop unnecessary if..fi when using test.py

2020-03-18 Thread Simon Glass
Since TEST_PY_BD is always defined we can drop this check.

This does not affect travis since it has a single, unified script.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update azure also

 .azure-pipelines.yml | 22 +-
 .gitlab-ci.yml   | 30 +-
 2 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 684359b88b..96f279853e 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -245,13 +245,11 @@ jobs:
   cp /opt/grub/grubarm.efi ~/grub_arm.efi
   # the below corresponds to .gitlab-ci.yml "script"
   cd ${WORK_DIR}
-  if [[ "${TEST_PY_BD}" != "" ]]; then
-  ret=0;
-  tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} 
${OVERRIDE} || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
-  exit $ret;
-  fi;
+  ret=0;
+  tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} 
${OVERRIDE} || ret=$?;
+  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
+  exit $ret;
   fi
   virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
@@ -259,12 +257,10 @@ jobs:
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
   export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
-  if [[ "${TEST_PY_BD}" != "" ]]; then
-  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k 
"${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" --build-dir 
"$UBOOT_TRAVIS_BUILD_DIR";
-  ret=$?;
-  if [[ $ret -ne 0 ]]; then
-  exit $ret;
-  fi;
+  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k 
"${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" --build-dir 
"$UBOOT_TRAVIS_BUILD_DIR";
+  ret=$?;
+  if [[ $ret -ne 0 ]]; then
+  exit $ret;
   fi
   # the below corresponds to .gitlab-ci.yml "after_script"
   rm -rf /tmp/uboot-test-hooks /tmp/venv
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 36c2ecfa43..b29d59d942 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,14 +29,12 @@ stages:
   script:
 # From buildman, exit code 129 means warnings only.  If we've been asked to
 # use clang only do one configuration.
-- if [[ "${TEST_PY_BD}" != "" ]]; then
-ret=0;
-tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} ${OVERRIDE}
-  || ret=$?;
-if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
-  exit $ret;
-fi;
+- ret=0;
+  tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} ${OVERRIDE}
+|| ret=$?;
+  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
+exit $ret;
   fi
 # "not a_test_which_does_not_exist" is a dummy -k parameter which will
 # never prevent any test from running. That way, we can always pass
@@ -48,15 +46,13 @@ stages:
 - export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
   export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
-  if [[ "${TEST_PY_BD}" != "" ]]; then
-./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
-  -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
-  --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
-ret=$?;
-if [[ $ret -ne 0 ]]; then
-  exit $ret;
-fi;
-  fi;
+  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
+-k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
+--build-dir "$UBOOT_TRAVIS_BUILD_DIR";
+  ret=$?;
+  if [[ $ret -ne 0 ]]; then
+exit $ret;
+  fi
 
 build all 32bit ARM platforms:
   tags: [ 'all' ]
-- 
2.25.1.481.gfbce0eb801-goog



RE: [PATCH 1/2] mmc: t210: Add autocal and tap/trim updates for SDMMC1/3

2020-03-18 Thread Tom Warren
[Tom] see below

-Original Message-
From: Jaehoon Chung  
Sent: Tuesday, March 17, 2020 4:48 PM
To: Tom Warren ; u-boot@lists.denx.de
Subject: Re: [PATCH 1/2] mmc: t210: Add autocal and tap/trim updates for 
SDMMC1/3

External email: Use caution opening links or attachments


On 3/17/20 6:59 AM, twar...@nvidia.com wrote:
> From: Tom Warren 
>
> As per the T210 TRM, when running at 3.3v, the SDMMC1 tap/trim and 
> autocal values need to be set to condition the signals correctly 
> before talking to the SD-card. This is the same as what's being done 
> in CBoot, but it gets reset when the SDMMC1 HW is soft-reset during SD 
> driver init, so needs to be repeated here. Also set autocal and 
> tap/trim for SDMMC3, although no T210 boards use it for SD-card at this time.
>
> Signed-off-by: Tom Warren 
> ---
>  arch/arm/include/asm/arch-tegra/tegra_mmc.h | 20 +--
>  drivers/mmc/tegra_mmc.c | 84 
> ++---
>  2 files changed, 92 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-tegra/tegra_mmc.h 
> b/arch/arm/include/asm/arch-tegra/tegra_mmc.h
> index a2b6f63..a8bfa46 100644
> --- a/arch/arm/include/asm/arch-tegra/tegra_mmc.h
> +++ b/arch/arm/include/asm/arch-tegra/tegra_mmc.h
> @@ -2,7 +2,7 @@
>  /*
>   * (C) Copyright 2009 SAMSUNG Electronics
>   * Minkyu Kang 
> - * Portions Copyright (C) 2011-2012 NVIDIA Corporation
> + * Portions Copyright (C) 2011-2012,2019 NVIDIA Corporation
>   */
>
>  #ifndef __TEGRA_MMC_H_
> @@ -52,7 +52,7 @@ struct tegra_mmc {
>   unsigned char   admaerr;/* offset 54h */
>   unsigned char   res4[3];/* RESERVED, offset 55h-57h */
>   unsigned long   admaaddr;   /* offset 58h-5Fh */
> - unsigned char   res5[0xa0]; /* RESERVED, offset 60h-FBh */
> + unsigned char   res5[0x9c]; /* RESERVED, offset 60h-FBh */

Is comment right? "RESERVED, offset 60h-FBh"..
[Tom] yes, the comment was/is correct, it's the number of reserved bytes that 
was wrong - 0x9C is correct.

>   unsigned short  slotintstatus;  /* offset FCh */
>   unsigned short  hcver;  /* HOST Version */
>   unsigned intvenclkctl;  /* _VENDOR_CLOCK_CNTRL_0,100h */
> @@ -127,11 +127,23 @@ struct tegra_mmc {
>
>  #define TEGRA_MMC_NORINTSIGEN_XFER_COMPLETE  (1 << 1)
>
> -/* SDMMC1/3 settings from section 24.6 of T30 TRM */
> +/* SDMMC1/3 settings from SDMMCx Initialization Sequence of TRM */
>  #define MEMCOMP_PADCTRL_VREF 7
> -#define AUTO_CAL_ENABLED (1 << 29)
> +#define AUTO_CAL_ENABLE  (1 << 29)
> +#if defined(CONFIG_TEGRA210)
> +#define AUTO_CAL_ACTIVE  (1 << 31)
> +#define AUTO_CAL_START   (1 << 31)
> +#define AUTO_CAL_PD_OFFSET   (0x7D << 8)
> +#define AUTO_CAL_PU_OFFSET   (0 << 0)
> +#define IO_TRIM_BYPASS_MASK  (1 << 2)
> +#define TRIM_VAL_SHIFT   24
> +#define TRIM_VAL_MASK(0x1F << TRIM_VAL_SHIFT)
> +#define TAP_VAL_SHIFT16
> +#define TAP_VAL_MASK (0xFF << TAP_VAL_SHIFT)
> +#else
>  #define AUTO_CAL_PD_OFFSET   (0x70 << 8)
>  #define AUTO_CAL_PU_OFFSET   (0x62 << 0)
> +#endif
>
>  #endif   /* __ASSEMBLY__ */
>  #endif   /* __TEGRA_MMC_H_ */
> diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 
> f022e93..a4bd679 100644
> --- a/drivers/mmc/tegra_mmc.c
> +++ b/drivers/mmc/tegra_mmc.c
> @@ -3,7 +3,7 @@
>   * (C) Copyright 2009 SAMSUNG Electronics
>   * Minkyu Kang 
>   * Jaehoon Chung 
> - * Portions Copyright 2011-2016 NVIDIA Corporation
> + * Portions Copyright 2011-2019 NVIDIA Corporation
>   */
>
>  #include 
> @@ -15,6 +15,9 @@
>  #include 
>  #include   #include 
> +#if defined(CONFIG_TEGRA210)
> +#include 
> +#endif
>
>  struct tegra_mmc_plat {
>   struct mmc_config cfg;
> @@ -30,6 +33,7 @@ struct tegra_mmc_priv {
>   struct gpio_desc wp_gpio;   /* Write Protect GPIO */
>   unsigned int version;   /* SDHCI spec. version */
>   unsigned int clock; /* Current clock (MHz) */
> + int mmc_id; /* peripheral id */
>  };
>
>  static void tegra_mmc_set_power(struct tegra_mmc_priv *priv, @@ 
> -446,16 +450,19 @@ static int tegra_mmc_set_ios(struct udevice *dev)
>
>  static void tegra_mmc_pad_init(struct tegra_mmc_priv *priv)  { -#if 
> defined(CONFIG_TEGRA30)
> +#if defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA210)
>   u32 val;
> + u16 clk_con;
> + int timeout;
> + int id = priv->mmc_id;
>
> - debug("%s: sdmmc address = %08x\n", __func__, (unsigned int)priv->reg);
> + debug("%s: sdmmc address = %p, id = %d\n", __func__,
> + priv->reg, id);
>
>   /* Set the pad drive strength for SDMMC1 or 3 only */
> - if (priv->reg != (void *)0x7800 &&
> - priv->reg != (void *)0x78000400) {
> + if (id != PERIPH_ID_SDMMC1 && id != PERIPH_ID_SDMMC3) {
>   debug("%s: settings are only valid for SDMMC1/SDMMC3!\n",
> -   __func__);
> +

U-CLASS SPI Bus and Devices

2020-03-18 Thread Rudolf J Streif

I ran into an issue today with a U-CLASS SPI NOR flash device on a NXP
FlexSPI controller. U-Boot started correctly from the flash device but
using 'sf probe 0:0' would always return 'Invalid bus 0 (err=-19)'. This
error message is emitted by spi_get_bus_and_cs() in
drivers/spi/spi-uclass.c. I traced the issue to
uclass_get_device_by_seq() in drivers/core/uclass.c.

The function first searches the device list for a device that already
claimed the sequence number (dev->seq). If not found it would look if a
device requested that sequence number (dev->seq_req). That would always
fail for my device. The bus had not been probed yet and hence dev->seq
was -1 and the device also had dev->req_seq set to -1.

The board is using a device tree hence it would only make sense to set
the requested sequence number via the device tree. However, there is no
such thing and even if there was it might not be specified.

Consequently, the device was never probed although the driver was
correctly set up via device tree.

I worked around it by simply setting dev->req_seq of the first device
that had it set to -1 to the sequence number the search function was
looking for (see patch below). It solved my problem but I don't know if
that is the right way of addressing it. I could not find any other
solution for this particular problem anywhere.

Rudi



From 0f05ab964fcc7d29d8d467e663d7daa72328cf66 Mon Sep 17 00:00:00 2001
From: Rudolf J Streif 
Date: Tue, 17 Mar 2020 17:13:07 -0700
Subject: [PATCH] Fix issue with SPI device sequence number

If the requested sequence number for a SPI device was -1 (any)
then the device would never be probed. This fix simply assigns
the sequence number asked for at probing to the device if it has
not been probed yet and the requested sequence number is -1.

Signed-off-by: Rudolf J Streif 
---
 drivers/core/uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index fc3157de39..e791103153 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -310,6 +310,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int
seq_or_req_seq,

    uclass_foreach_dev(dev, uc) {
    debug("   - %d %d '%s'\n", dev->req_seq, dev->seq,
dev->name);
+   if (find_req_seq && dev->req_seq == -1)
+   dev->req_seq = seq_or_req_seq;
    if ((find_req_seq ? dev->req_seq : dev->seq) ==
    seq_or_req_seq) {
    *devp = dev;

-- 
2.23.0







signature.asc
Description: OpenPGP digital signature


[PATCH v2] powerpc: allow opting out of WATCHDOG_RESET() from timer interrupt

2020-03-18 Thread Rasmus Villemoes
When using CONFIG_(SPL_)WDT, the watchdog_reset function is a lot more
complicated than just poking a few SOC-specific registers - it
involves accessing all kinds of global data, and if the interrupt
happens at the wrong time (say, in the middle of an WATCHDOG_RESET()
call from ordinary code), that can end up corrupting said global data.

Also, having WATCHDOG_RESET() called automatically from the timer
interrupt runs counter to the idea of a watchdog device - if the board
runs into an infinite loops with interrupts still enabled, the
watchdog will never fire.

Allow the board to opt out of this behaviour by setting
CONFIG_SYS_WATCHDOG_FREQ to 0 - as that setting is currently
nonsensical, it cannot affect any existing boards.

Signed-off-by: Rasmus Villemoes 
---
v2: add comment explaining the semantics of setting CONFIG_SYS_WATCHDOG_FREQ to 
0.

 arch/powerpc/lib/interrupts.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index 64ee0cc210..b213e40578 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -79,7 +79,12 @@ void timer_interrupt(struct pt_regs *regs)
timestamp++;
 
 #if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG)
-   if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0)
+   /*
+* Setting CONFIG_SYS_WATCHDOG_FREQ to 0 can be used to
+* disable calling WATCHDOG_RESET() from the timer interrupt
+* function.
+*/
+   if (CONFIG_SYS_WATCHDOG_FREQ && (timestamp % 
(CONFIG_SYS_WATCHDOG_FREQ)) == 0)
WATCHDOG_RESET ();
 #endif/* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
 
-- 
2.23.0



[PATCH v3 14/23] travis/gitlab/azure: Drop BUILDMAN variable with test.py

2020-03-18 Thread Simon Glass
This is not needed in the test.py part of the config, now since we use the
same name as the pytests.

Drop BUILDMAN, retaining it only for the 'build' parts of the config, i.e.
where we build multiple boards and don't run any tests.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update travis, azure also

 .azure-pipelines.yml | 28 +++-
 .gitlab-ci.yml   | 27 +++
 .travis.yml  | 27 +++
 3 files changed, 9 insertions(+), 73 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 8092545642..3d5b12ba3e 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -158,90 +158,69 @@ jobs:
   matrix:
 sandbox:
   TEST_PY_BD: "sandbox"
-  BUILDMAN: "sandbox"
 sandbox_clang:
   TEST_PY_BD: "sandbox"
-  BUILDMAN: "sandbox"
   OVERRIDE: "-O clang-7"
 sandbox_spl:
   TEST_PY_BD: "sandbox_spl"
   TEST_PY_TEST_SPEC: "test_ofplatdata"
-  BUILDMAN: "sandbox_spl"
 sandbox_flattree:
   TEST_PY_BD: "sandbox_flattree"
-  BUILDMAN: "sandbox_flattree"
 evb_ast2500:
   TEST_PY_BD: "evb-ast2500"
   TEST_PY_ID: "--id qemu"
-  BUILDMAN: "evb-ast2500"
 vexpress_ca15_tc2:
   TEST_PY_BD: "vexpress_ca15_tc2"
   TEST_PY_ID: "--id qemu"
-  BUILDMAN: "vexpress_ca15_tc2"
 vexpress_ca9x4:
   TEST_PY_BD: "vexpress_ca9x4"
   TEST_PY_ID: "--id qemu"
-  BUILDMAN: "vexpress_ca9x4"
 integratorcp_cm926ejs:
   TEST_PY_BD: "integratorcp_cm926ejs"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "integratorcp_cm926ejs"
 qemu_arm:
   TEST_PY_BD: "qemu_arm"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu_arm"
 qemu_arm64:
   TEST_PY_BD: "qemu_arm64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu_arm64"
 qemu_mips:
   TEST_PY_BD: "qemu_mips"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu_mips"
 qemu_mipsel:
   TEST_PY_BD: "qemu_mipsel"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu_mipsel"
 qemu_mips64:
   TEST_PY_BD: "qemu_mips64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu_mips64"
 qemu_mips64el:
   TEST_PY_BD: "qemu_mips64el"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu_mips64el"
 qemu_ppce500:
   TEST_PY_BD: "qemu-ppce500"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu-ppce500"
 qemu_riscv64:
   TEST_PY_BD: "qemu-riscv64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu-riscv64"
 qemu_x86:
   TEST_PY_BD: "qemu-x86"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu-x86"
 qemu_x86_64:
   TEST_PY_BD: "qemu-x86_64"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "qemu-x86_64"
 zynq_zc702:
   TEST_PY_BD: "zynq_zc702"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "zynq_zc702"
 xilinx_versal_virt:
   TEST_PY_BD: "xilinx_versal_virt"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "xilinx_versal_virt"
 xtfpga:
   TEST_PY_BD: "xtfpga"
   TEST_PY_ID: "--id qemu"
   TEST_PY_TEST_SPEC: "not sleep"
-  BUILDMAN: "xtfpga"
 steps:
   - script: |
   cat << EOF > test.sh
@@ -251,7 +230,6 @@ jobs:
   export TEST_PY_BD="${TEST_PY_BD}"
   export TEST_PY_ID="${TEST_PY_ID}"
   export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
-  export BUILDMAN="${BUILDMAN}"
   export OVERRIDE="${OVERRIDE}"
   EOF
   cat << "EOF" >> test.sh
@@ -267,11 +245,11 @@ jobs:
   cp /opt/grub/grubarm.efi ~/grub_arm.efi
   # the below corresponds to .gitlab-ci.yml "script"
   cd ${WORK_DIR}
-  if [[ "${BUILDMAN}" != "" ]]; then
+  if [[ "${TEST_PY_BD}" != "" ]]; then
   ret=0;
-  tools/buildman/buildman -o /tmp -P -E --board ${BUILDMAN} 
${OVERRIDE} || ret=$?;
+  tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} 
${OVERRIDE} || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -sdeP --board ${BUILDMAN};
+  tools/buildman/buildman -o /tmp -sdeP --board ${TEST_PY_BD};
   exit $ret;
   fi;
   fi
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f48cad752..2cd6209222 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,12 +29,12 @@ stages:
   script:
 # From buildman, exit code 129 

[PATCH v3 17/23] gitlab/azure: Use -w flag for all test.py builds

2020-03-18 Thread Simon Glass
Avoid needing to know about the internal .bm-work directory, by passing
the -w flag to buildman.

This is not needed on travis since the -w flag is already used (from a
previous patch).

Drop the -P flag since this has no effect if -w is used.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Leave in the repeated call to buildman
- Update azure also

 .azure-pipelines.yml |  6 +++---
 .gitlab-ci.yml   | 11 ++-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 96f279853e..b7222db97f 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -245,16 +245,16 @@ jobs:
   cp /opt/grub/grubarm.efi ~/grub_arm.efi
   # the below corresponds to .gitlab-ci.yml "script"
   cd ${WORK_DIR}
+  export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
   ret=0;
-  tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} 
${OVERRIDE} || ret=$?;
+  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E --board 
${TEST_PY_BD} ${OVERRIDE} || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-  tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
+  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -se 
--board ${TEST_PY_BD};
   exit $ret;
   fi
   virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
   pip install -r test/py/requirements.txt
-  export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
   export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
   ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k 
"${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" --build-dir 
"$UBOOT_TRAVIS_BUILD_DIR";
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b29d59d942..38f2cba69f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,11 +29,13 @@ stages:
   script:
 # From buildman, exit code 129 means warnings only.  If we've been asked to
 # use clang only do one configuration.
+- export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
 - ret=0;
-  tools/buildman/buildman -o /tmp -P -E --board ${TEST_PY_BD} ${OVERRIDE}
-|| ret=$?;
+  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E
+--board ${TEST_PY_BD} ${OVERRIDE} || ret=$?;
   if [[ $ret -ne 0 && $ret -ne 129 ]]; then
-tools/buildman/buildman -o /tmp -seP --board ${TEST_PY_BD};
+tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -se
+   --board ${TEST_PY_BD};
 exit $ret;
   fi
 # "not a_test_which_does_not_exist" is a dummy -k parameter which will
@@ -43,8 +45,7 @@ stages:
 - virtualenv -p /usr/bin/python3 /tmp/venv
 - . /tmp/venv/bin/activate
 - pip install -r test/py/requirements.txt
-- export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
-  export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
+- export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
   ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
 -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 18/23] travis/gitlab/azure: Use bash to avoid a_test_which_does_not_exist

2020-03-18 Thread Simon Glass
Bash allows for variables to expand only if non-empty:

$ var=test
$ echo ${var:+"$var"}
test
$ echo ${var:+"-k $var"}
-k test
$ var=
$ echo ${var:+"-k $var"}

Use this feature to avoid the workaround.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add a comment about the obscure bash feature
- Update travis, azure also

 .azure-pipelines.yml | 3 ++-
 .gitlab-ci.yml   | 7 ++-
 .travis.yml  | 7 ++-
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index b7222db97f..50d00fa899 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -257,7 +257,8 @@ jobs:
   pip install -r test/py/requirements.txt
   export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
-  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k 
"${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" --build-dir 
"$UBOOT_TRAVIS_BUILD_DIR";
+  # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if 
not
+  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} 
${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir 
"$UBOOT_TRAVIS_BUILD_DIR";
   ret=$?;
   if [[ $ret -ne 0 ]]; then
   exit $ret;
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 38f2cba69f..48b90b2ba3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,17 +38,14 @@ stages:
--board ${TEST_PY_BD};
 exit $ret;
   fi
-# "not a_test_which_does_not_exist" is a dummy -k parameter which will
-# never prevent any test from running. That way, we can always pass
-# "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
-# value.
 - virtualenv -p /usr/bin/python3 /tmp/venv
 - . /tmp/venv/bin/activate
 - pip install -r test/py/requirements.txt
+# "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
 - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
   export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
   ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
--k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
+${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
 --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
   ret=$?;
   if [[ $ret -ne 0 ]]; then
diff --git a/.travis.yml b/.travis.yml
index d7c16326ff..887654ca96 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -127,11 +127,8 @@ script:
exit $ret;
  fi;
fi
- # "not a_test_which_does_not_exist" is a dummy -k parameter which will
- # never prevent any test from running. That way, we can always pass
- # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
- # value.
  # Build just the one board needed for testing, if TEST_PY_BD is non-empty
+ # Note: "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  - if [[ "${TEST_PY_BD}" != "" ]]; then
  export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/${TEST_PY_BD};
  cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
@@ -150,7 +147,7 @@ script:
  . /tmp/venv/bin/activate;
  pip install -r test/py/requirements.txt;
  ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
-   -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
+   ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
--build-dir "$UBOOT_TRAVIS_BUILD_DIR";
  ret=$?;
  if [[ $ret -ne 0 ]]; then
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 22/23] travis/gitlab/azure: Drop repeated buildman call with test.py

2020-03-18 Thread Simon Glass
It does not seem to be necessary to run buildman again to show errors,
since any errors can be shown by the first invocation and there is only
a single board being built. Update this to simplify the code, using the
-e flag to make sure errors are shown.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add new patch to drop the repeated buildman call

 .azure-pipelines.yml | 10 +++---
 .gitlab-ci.yml   | 10 ++
 .travis.yml  | 10 ++
 3 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 28a6583319..27bc249629 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -246,13 +246,9 @@ jobs:
   # the below corresponds to .gitlab-ci.yml "script"
   cd ${WORK_DIR}
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
-  ret=0;
-  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W 
--board ${TEST_PY_BD} ${OVERRIDE} || ret=$?;
-  if [[ $ret -ne 0 ]]; then
-  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -se 
--board ${TEST_PY_BD};
-  exit $ret;
-  fi
-  virtualenv -p /usr/bin/python3 /tmp/venv
+  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e 
--board ${TEST_PY_BD} ${OVERRIDE}
+
+virtualenv -p /usr/bin/python3 /tmp/venv
   . /tmp/venv/bin/activate
   pip install -r test/py/requirements.txt
   export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 64d8b1bdfc..d171641576 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,14 +29,8 @@ stages:
   script:
 # If we've been asked to use clang only do one configuration.
 - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
-- ret=0;
-  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W
---board ${TEST_PY_BD} ${OVERRIDE} || ret=$?;
-  if [[ $ret -ne 0 ]]; then
-tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -se
-   --board ${TEST_PY_BD};
-exit $ret;
-  fi
+- tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
+--board ${TEST_PY_BD} ${OVERRIDE}
 - virtualenv -p /usr/bin/python3 /tmp/venv
 - . /tmp/venv/bin/activate
 - pip install -r test/py/requirements.txt
diff --git a/.travis.yml b/.travis.yml
index 757e425467..37fd8e483a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -134,14 +134,8 @@ script:
  cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
  cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
  cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi 
$UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
- ret=0;
- tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W
-   --board ${TEST_PY_BD} ${OVERRIDE}|| ret=$?;
- if [[ $ret -ne 0 ]]; then
-   tools/buildman/buildman -se -o ${UBOOT_TRAVIS_BUILD_DIR} -w
- --board ${TEST_PY_BD};
-   exit $ret;
- fi;
+ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
+   --board ${TEST_PY_BD} ${OVERRIDE} || exit;
  virtualenv -p /usr/bin/python3 /tmp/venv;
  . /tmp/venv/bin/activate;
  pip install -r test/py/requirements.txt;
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 20/23] travis/gitlab/azure: Enable test_handoff

2020-03-18 Thread Simon Glass
Ensure that this SPL test runs on gitlab.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Update travis, azure also

 .azure-pipelines.yml | 2 +-
 .gitlab-ci.yml   | 2 +-
 .travis.yml  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index a97a3f8b19..612e645d0a 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -163,7 +163,7 @@ jobs:
   OVERRIDE: "-O clang-7"
 sandbox_spl:
   TEST_PY_BD: "sandbox_spl"
-  TEST_PY_TEST_SPEC: "test_ofplatdata"
+  TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff"
 sandbox_flattree:
   TEST_PY_BD: "sandbox_flattree"
 evb_ast2500:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 501e3ff3ab..065ac769f9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -188,7 +188,7 @@ sandbox_spl test.py:
   tags: [ 'all' ]
   variables:
 TEST_PY_BD: "sandbox_spl"
-TEST_PY_TEST_SPEC: "test_ofplatdata"
+TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff"
   <<: *buildman_and_testpy_dfn
 
 evb-ast2500 test.py:
diff --git a/.travis.yml b/.travis.yml
index bf3ef4860b..5be4c54403 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -404,7 +404,7 @@ matrix:
 - name: "test/py sandbox_spl"
   env:
 - TEST_PY_BD="sandbox_spl"
-  TEST_PY_TEST_SPEC="test_ofplatdata"
+  TEST_PY_TEST_SPEC="test_ofplatdata or test_handoff"
   TOOLCHAIN="i386"
   TEST_PY_TOOLS="yes"
 - name: "test/py sandbox_flattree"
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 19/23] travis/gitlab/azure: Use -W to avoid warnings check

2020-03-18 Thread Simon Glass
We can use the -W flag to tell buildman to ignore warnings. Since we also
have -E defined, compiler warnings are promoted to errors, so they will
still cause a failure. But migration warnings of the form:

= WARNING ==
This board does not use CONFIG_DM. CONFIG_DM will be
compulsory starting with the v2020.01 release.
Failure to update may result in board removal.
See doc/driver-model/migration.rst for more info.

will now be ignored.

Signed-off-by: Simon Glass 
Fixes: 329f5ef51d2 (travis.yml: run buildman with option -E)
---

Changes in v3:
- Bring back the -E flag and add -W
- Rewrite the commit message

Changes in v2:
- Add Fixes tag
- Just drop the -E flag
- Update travis, azure also

 .azure-pipelines.yml |  8 
 .gitlab-ci.yml   | 23 +++
 .travis.yml  | 13 ++---
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 50d00fa899..a97a3f8b19 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -247,8 +247,8 @@ jobs:
   cd ${WORK_DIR}
   export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
   ret=0;
-  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E --board 
${TEST_PY_BD} ${OVERRIDE} || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W 
--board ${TEST_PY_BD} ${OVERRIDE} || ret=$?;
+  if [[ $ret -ne 0 ]]; then
   tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -se 
--board ${TEST_PY_BD};
   exit $ret;
   fi
@@ -396,8 +396,8 @@ jobs:
   cat << "EOF" >> build.sh
   if [[ "${BUILDMAN}" != "" ]]; then
   ret=0;
-  tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || 
ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  tools/buildman/buildman -o /tmp -P -W ${BUILDMAN} ${OVERRIDE} || 
ret=$?;
+  if [[ $ret -ne 0 ]]; then
   tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
   exit $ret;
   fi;
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 48b90b2ba3..501e3ff3ab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,13 +27,12 @@ stages:
   after_script:
 - rm -rf /tmp/uboot-test-hooks /tmp/venv
   script:
-# From buildman, exit code 129 means warnings only.  If we've been asked to
-# use clang only do one configuration.
+# If we've been asked to use clang only do one configuration.
 - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
 - ret=0;
-  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E
+  tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W
 --board ${TEST_PY_BD} ${OVERRIDE} || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  if [[ $ret -ne 0 ]]; then
 tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -se
--board ${TEST_PY_BD};
 exit $ret;
@@ -57,8 +56,8 @@ build all 32bit ARM platforms:
   stage: world build
   script:
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
+  if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
@@ -71,8 +70,8 @@ build all 64bit ARM platforms:
 - . /tmp/venv/bin/activate
 - pip install pyelftools
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E aarch64 || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
+  if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
@@ -82,8 +81,8 @@ build all PowerPC platforms:
   stage: world build
   script:
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
+  if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
@@ -93,8 +92,8 @@ build all other platforms:
   stage: world build
   script:
 - ret=0;
-  ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?;
-  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+  ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
+  if [[ $ret -ne 0 ]]; then
 ./tools/buildman/buildman -o /tmp -seP;
 exit $ret;
   fi;
diff --git a/.travis.yml b/.travis.yml
index 887654ca96..bf3ef4860b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -116,13 +116,12 @@ script:
  # Comments must be outside the command strings below, or the Travis parser
  # will get confused.
  #
- # From buildman, exit code 129 means 

Antwort: [PATCH v2 32/39] irq: Add a method to convert an interrupt to ACPI

2020-03-18 Thread Wolfgang Wallner
Hi Simon,

I'm resending this mail, as my email client has broken the formating
in the first attempt, sorry.


"Simon Glass"  schrieb am 09.03.2020 04:44:56:

> Von: "Simon Glass" 
> An: "U-Boot Mailing List" , 
> Kopie: "Bin Meng" , "Wolfgang Wallner" 
> , "Andy Shevchenko" 
> , "Simon Glass" 
> Datum: 09.03.2020 04:46
> Betreff: [PATCH v2 32/39] irq: Add a method to convert an interrupt to 
ACPI
> 
> When generating ACPI tables we need to convert IRQs in U-Boot to the 
ACPI
> structures required by ACPI. This is a SoC-specific conversion and 
cannot
> be handled by generic code, so add a new IRQ method to do the 
conversion.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2: None
> 
>  drivers/misc/irq-uclass.c | 18 +++-
>  include/acpi_device.h | 27 +++
>  include/irq.h | 41 +
>  lib/acpi/acpi_device.c| 94 +++
>  4 files changed, 178 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/irq-uclass.c b/drivers/misc/irq-uclass.c
> index 61aa10e465..b4a8b7b429 100644
> --- a/drivers/misc/irq-uclass.c
> +++ b/drivers/misc/irq-uclass.c
> @@ -153,8 +153,6 @@ int irq_request(struct udevice *dev, struct irq 
*irq)
> const struct irq_ops *ops;
> 
> log_debug("(dev=%p, irq=%p)\n", dev, irq);
> -   if (!irq)
> -  return 0;

Why is this code dropped?

> ops = irq_get_ops(dev);
> 
> irq->dev = dev;
> @@ -176,6 +174,22 @@ int irq_first_device_type(enum irq_dev_t type, 
> struct udevice **devp)
> return 0;
>  }
> 
> +#if CONFIG_IS_ENABLED(ACPIGEN)
> +int irq_get_acpi(const struct irq *irq, struct acpi_irq *acpi_irq)
> +{
> +   struct irq_ops *ops;
> +
> +   if (!irq_is_valid(irq))
> +  return -EINVAL;
> +
> +   ops = irq_get_ops(irq->dev);
> +   if (!ops->get_acpi)
> +  return -ENOSYS;
> +
> +   return ops->get_acpi(irq, acpi_irq);
> +}
> +#endif
> +
>  UCLASS_DRIVER(irq) = {
> .id  = UCLASS_IRQ,
> .name  = "irq",
> diff --git a/include/acpi_device.h b/include/acpi_device.h
> index acd26c0f54..50ba9b66aa 100644
> --- a/include/acpi_device.h
> +++ b/include/acpi_device.h
> @@ -545,6 +545,33 @@ int acpi_dp_write(struct acpi_ctx *ctx, struct 
> acpi_dp *table);
>  int acpi_device_write_gpio_desc(struct acpi_ctx *ctx,
>  const struct gpio_desc *desc);
> 
> +/**
> + * acpi_device_write_interrupt_irq() - Write an interrupt to ACPI
> + *
> + * This creates an interrupt descriptor for an interrupt, including
> information
> + * ACPI needs to use it.
> + *
> + * @req_irq: Interrupt to write
> + * @return 0 if OK, -ve on error
> + */
> +int acpi_device_write_interrupt_irq(struct acpi_ctx *ctx,
> +const struct irq *req_irq);
> +
> +/**
> + * acpi_device_write_interrupt_or_gpio() - Write interrupt or GPIO to 
ACPI
> + *
> + * This reads the an interrupt from the device tree, if available. If 
not it

typo: "the an"

The description of what this function should do is rather vague.
At least I'm not sure how it is meant to work.

> + * reads the first GPIO with the name @prop.
> + *
> + * If an interrupt is found, that is written to ACPI. If not, but an 
GPIO is
> + * found, that is written.
> + *
> + * @return 0 if OK, -ve if neither an interrupt nor a GPIO could 
befound, or
> + * some other error occurred
> + */
> +int acpi_device_write_interrupt_or_gpio(struct acpi_ctx *ctx,
> +   struct udevice *dev, const char *prop);
> +
>  /**
>   * acpi_device_write_i2c_dev() - Write an I2C device to ACPI, including
>   * information ACPI needs to use it.
> diff --git a/include/irq.h b/include/irq.h
> index d4948e6dc4..8527e4dd79 100644
> --- a/include/irq.h
> +++ b/include/irq.h
> @@ -8,6 +8,7 @@
>  #ifndef __irq_H
>  #define __irq_H
> 
> +struct acpi_irq;
>  struct ofnode_phandle_args;
> 
>  /*
> @@ -26,10 +27,12 @@ enum irq_dev_t {
>   *
>   * @dev: IRQ device that handles this irq
>   * @id: ID to identify this irq with the device
> + * @flags: Flags associated with this interrupt (IRQ_TYPE_...)
>   */
>  struct irq {
> struct udevice *dev;
> ulong id;
> +   ulong flags;
>  };
> 
>  /**
> @@ -121,10 +124,36 @@ struct irq_ops {
>  * @return 0 if OK, or a negative error code.
>  */
> int (*free)(struct irq *irq);
> +
> +#if CONFIG_IS_ENABLED(ACPIGEN)
> +   /**
> +* get_acpi() - Get the ACPI info for an irq
> +*
> +* This converts a irq to an ACPI structure for adding to the ACPI
> +* tables.
> +*
> +* @irq:   irq to convert
> +* @acpi_irq:   Output ACPI interrupt information
> +* @return ACPI pin number or -ve on error
> +*/
> +   int (*get_acpi)(const struct irq *irq, struct acpi_irq *acpi_irq);
> +#endif
>  };
> 
>  #define irq_get_ops(dev)   ((struct irq_ops *)(dev)->driver->ops)
> 
> +/**
> + * irq_is_valid() - Check if an IRQ is valid
> + *
> + * @irq:   IRQ description containing device and ID, e.g. previously
> + *  returned by irq_get_by_index()
> + * @return true if valid, false if not

Re: [RFC 04/14] efi_loader: correct a definition of struct efi_capsule_header

2020-03-18 Thread Heinrich Schuchardt

On 3/17/20 3:12 AM, AKASHI Takahiro wrote:

See UEFI specification, section 8.5.3.
In addition, the structure, efi_capsule_header, should be "packed"
as it is a serialized binary format in a capsule file.

Signed-off-by: AKASHI Takahiro 


Merged into U-Boot master.

Best regards

Heinrich


[PATCH v6 04/12] arm: dts: sync dts for Action Semi S900

2020-03-18 Thread Amit Singh Tomar
Synchronize device tree bindings with v5.5-rc6 tag with commit id
"b3a987b0264d".

Also, it removes older clock binding defined for S900 along with undocumented
compatible string "actions,s900-serial" from serial driver and adapts clock
driver to cater to new bindings.

Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Moved it 04/11 from 03/11.
* removed the undocumented compatible string "actions,s900-serial".
* removed the reviewed-by tag. 
Changes since v4:
* This patch is re-ordered, moved from 07/11 to 03/11.
* Used the commit-id(12 chars long) in commit message.
Changes since v3:
* Added Reviewed-by: tag.
Changes since v2:
* Newly added patch, not there in v2/v1.
---
 arch/arm/dts/s900.dtsi | 322 +++--
 drivers/clk/owl/clk_s900.c |   6 +-
 drivers/serial/serial_owl.c|   1 -
 include/dt-bindings/clock/actions,s900-cmu.h   | 129 ++
 include/dt-bindings/clock/s900_cmu.h   |  77 --
 include/dt-bindings/reset/actions,s900-reset.h |  65 +
 6 files changed, 498 insertions(+), 102 deletions(-)
 create mode 100644 include/dt-bindings/clock/actions,s900-cmu.h
 delete mode 100644 include/dt-bindings/clock/s900_cmu.h
 create mode 100644 include/dt-bindings/reset/actions,s900-reset.h

diff --git a/arch/arm/dts/s900.dtsi b/arch/arm/dts/s900.dtsi
index 2bbb30a..eb35cf7 100644
--- a/arch/arm/dts/s900.dtsi
+++ b/arch/arm/dts/s900.dtsi
@@ -1,17 +1,94 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Device Tree Source for Actions Semi S900 SoC
-//
-// Copyright (C) 2015 Actions Semi Co., Ltd.
-// Copyright (C) 2018 Manivannan Sadhasivam 
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Andreas Färber
+ */
 
-/dts-v1/;
-#include 
+#include 
+#include 
+#include 
+#include 
 
 / {
compatible = "actions,s900";
-   #address-cells = <0x2>;
-   #size-cells = <0x2>;
+   interrupt-parent = <>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   };
+
+   cpu1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x1>;
+   enable-method = "psci";
+   };
+
+   cpu2: cpu@2 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x2>;
+   enable-method = "psci";
+   };
+
+   cpu3: cpu@3 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a53";
+   reg = <0x0 0x3>;
+   enable-method = "psci";
+   };
+   };
+
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   secmon@1f00 {
+   reg = <0x0 0x1f00 0x0 0x100>;
+   no-map;
+   };
+   };
+
+   psci {
+   compatible = "arm,psci-0.2";
+   method = "smc";
+   };
+
+   arm-pmu {
+   compatible = "arm,cortex-a53-pmu";
+   interrupts = ,
+,
+,
+;
+   interrupt-affinity = <>, <>, <>, <>;
+   };
+
+   timer {
+   compatible = "arm,armv8-timer";
+   interrupts = ,
+,
+,
+;
+   };
+
+   hosc: hosc {
+   compatible = "fixed-clock";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
 
losc: losc {
compatible = "fixed-clock";
@@ -26,28 +103,231 @@
};
 
soc {
-   u-boot,dm-pre-reloc;
compatible = "simple-bus";
-   #address-cells = <0x2>;
-   #size-cells = <0x2>;
+   #address-cells = <2>;
+   #size-cells = <2>;
ranges;
 
+   gic: interrupt-controller@e00f1000 {
+   compatible = "arm,gic-400";
+   reg = <0x0 0xe00f1000 0x0 0x1000>,
+ <0x0 0xe00f2000 0x0 0x2000>,
+ <0x0 0xe00f4000 0x0 0x2000>,
+ <0x0 0xe00f6000 0x0 0x2000>;
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <3>;
+   

[PATCH v6 01/12] arm: actions: Add common framework for Actions Owl Semi SoCs

2020-03-18 Thread Amit Singh Tomar
This commit adds common arch support for Actions Semi Owl
series SoCs and removes the Bubblegum96 board files.

Signed-off-by: Amit Singh Tomar 
---
Chanes since v5:
* No change.
Chanes since v4:
* No change.
Changes since v3:
* Corrected the file list entry in MAINTAINERS file.
Changes since v2:
* Moved the file list details to root MAINTAINERS file.
* Updated the commit message as suggested by Mani.
* Used the "Owl" keyword to describe SoC family.
Changes since v1:
* Moved S700 specific changes to patch 4 of 9.
* Moved couple of symbols from defconfig to arch/arm/Kconfig
  and platform owl Kconfig.
---
 MAINTAINERS  |  2 +
 arch/arm/Kconfig |  3 +-
 arch/arm/mach-owl/Kconfig| 29 ++
 arch/arm/mach-owl/Makefile   |  1 +
 arch/arm/mach-owl/soc.c  | 57 
 board/ucRobotics/bubblegum_96/Kconfig| 15 
 board/ucRobotics/bubblegum_96/MAINTAINERS|  6 ---
 board/ucRobotics/bubblegum_96/Makefile   |  3 --
 board/ucRobotics/bubblegum_96/bubblegum_96.c | 57 
 configs/bubblegum_96_defconfig   |  4 +-
 include/configs/bubblegum_96.h   | 40 ---
 include/configs/owl-common.h | 40 +++
 include/configs/s900.h   | 16 
 13 files changed, 130 insertions(+), 143 deletions(-)
 create mode 100644 arch/arm/mach-owl/soc.c
 delete mode 100644 board/ucRobotics/bubblegum_96/Kconfig
 delete mode 100644 board/ucRobotics/bubblegum_96/MAINTAINERS
 delete mode 100644 board/ucRobotics/bubblegum_96/Makefile
 delete mode 100644 board/ucRobotics/bubblegum_96/bubblegum_96.c
 delete mode 100644 include/configs/bubblegum_96.h
 create mode 100644 include/configs/owl-common.h
 create mode 100644 include/configs/s900.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 92dda40..e1c03cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -275,6 +275,8 @@ F:  arch/arm/mach-owl/
 F: board/ucRobotics/
 F: drivers/clk/owl/
 F: drivers/serial/serial_owl.c
+F: include/configs/owl-common.h
+F: configs/bubblegum_96_defconfig
 
 ARM RENESAS RMOBILE/R-CAR
 M: Nobuhiro Iwamatsu 
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5d36788..1cfdcb6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -873,9 +873,9 @@ config ARCH_MX5
 
 config ARCH_OWL
bool "Actions Semi OWL SoCs"
-   select ARM64
select DM
select DM_SERIAL
+   select OWL_SERIAL
select OF_CONTROL
imply CMD_DM
 
@@ -1865,7 +1865,6 @@ source "board/spear/spear600/Kconfig"
 source "board/spear/x600/Kconfig"
 source "board/st/stv0991/Kconfig"
 source "board/tcl/sl50/Kconfig"
-source "board/ucRobotics/bubblegum_96/Kconfig"
 source "board/birdland/bav335x/Kconfig"
 source "board/toradex/colibri_pxa270/Kconfig"
 source "board/variscite/dart_6ul/Kconfig"
diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
index 199e772..d0be2b5 100644
--- a/arch/arm/mach-owl/Kconfig
+++ b/arch/arm/mach-owl/Kconfig
@@ -1,27 +1,22 @@
 if ARCH_OWL
 
-config SYS_SOC
-   default "owl"
-
 choice
-prompt "Actions Semi OWL SoCs board select"
+prompt "Actions Semi Owl SoC Variant"
 optional
 
-config TARGET_BUBBLEGUM_96
-   bool "96Boards Bubblegum-96"
-   help
- Support for 96Boards Bubblegum-96. This board complies with
- 96Board Consumer Edition Specification. Features:
- - Actions Semi S900 SoC (4xCortex A53, Power VR G6230 GPU)
- - 2GiB RAM
- - 8GiB eMMC, uSD slot
- - WiFi, Bluetooth and GPS module
- - 2x Host, 1x Device USB port
- - HDMI
- - 20-pin low speed and 40-pin high speed expanders, 6 LED, 3 buttons
+config MACH_S900
+bool "Actions Semi S900 SoC"
+select ARM64
 
 endchoice
 
-source "board/ucRobotics/bubblegum_96/Kconfig"
+config SYS_TEXT_BASE
+default 0x1100
+
+config SYS_CONFIG_NAME
+default "s900" if MACH_S900
+
+config SYS_SOC
+default "s900" if MACH_S900
 
 endif
diff --git a/arch/arm/mach-owl/Makefile b/arch/arm/mach-owl/Makefile
index 1b43dc2..0b181c6 100644
--- a/arch/arm/mach-owl/Makefile
+++ b/arch/arm/mach-owl/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0+
 
+obj-y += soc.o
 obj-y += sysmap-s900.o
diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c
new file mode 100644
index 000..409cbd3
--- /dev/null
+++ b/arch/arm/mach-owl/soc.c
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Actions Semi Owl SoCs platform support.
+ *
+ * Copyright (C) 2018 Manivannan Sadhasivam 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * dram_init - sets uboots idea of sdram size
+ */
+int dram_init(void)
+{

[PATCH v6 03/12] serial: actions: add compatible string

2020-03-18 Thread Amit Singh Tomar
This patch adds "actions,owl-uart" string to the owl uart driver. It
is also defined in Linux kernel.

Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Moved it to from 06/11 to 03/11.
* Used appropriate commit message.
* Removed the reviwed-by tag.
Changes since v4:
* Moved it to from 09/11 to 06/11.
Changes since v3:
* Used only owl-uart for compatible string.
Changes since v2:
* No changes.   
Changes since v1:
* No changes.
---
 drivers/serial/serial_owl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c
index 7ead73e..539acdc 100644
--- a/drivers/serial/serial_owl.c
+++ b/drivers/serial/serial_owl.c
@@ -121,6 +121,7 @@ static const struct dm_serial_ops owl_serial_ops = {
 
 static const struct udevice_id owl_serial_ids[] = {
{ .compatible = "actions,s900-serial" },
+   { .compatible = "actions,owl-uart" },
{ }
 };
 
-- 
2.7.4



[PATCH v6 06/12] clk: actions: Add common clock driver

2020-03-18 Thread Amit Singh Tomar
This patch converts S900 clock driver to something common that can
be used for other SoCs, for instance S700(few of clk registers are same).

Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* Removed the white space errors from "clk_owl.h".
Changes since v4:
* Removed parentheses from "regs_s700.h"
* Moved this patch, from 03/11 to 05/11.
* Merged owl_uart_clk_enable() into owl_clk_enable.
Changes since v3:
* Fixed register spelling.
* Removed the ethernet related clocks.
* Returned -EINVAL instead 0.
Changes since v2:
* Fixed the commit message.
* Checked for the clk->id.
* Added a .data member with SoC type.
* Removed #ifdefs from few places.
Changes since v1:
* Moved CLK and CLK_OWL symbols from defconfig to arch/arm/Kconfig.
---
 arch/arm/Kconfig  |   2 +
 arch/arm/include/asm/arch-owl/clk_s900.h  |  57 ---
 arch/arm/include/asm/arch-owl/regs_s700.h |  56 +++
 configs/bubblegum_96_defconfig|   3 -
 drivers/clk/owl/Kconfig   |   8 +-
 drivers/clk/owl/Makefile  |   2 +-
 drivers/clk/owl/clk_owl.c | 152 ++
 drivers/clk/owl/clk_owl.h |  65 +
 drivers/clk/owl/clk_s900.c| 137 ---
 9 files changed, 278 insertions(+), 204 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-owl/clk_s900.h
 create mode 100644 arch/arm/include/asm/arch-owl/regs_s700.h
 create mode 100644 drivers/clk/owl/clk_owl.c
 create mode 100644 drivers/clk/owl/clk_owl.h
 delete mode 100644 drivers/clk/owl/clk_s900.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1cfdcb6..dba4d8c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -876,6 +876,8 @@ config ARCH_OWL
select DM
select DM_SERIAL
select OWL_SERIAL
+   select CLK
+   select CLK_OWL
select OF_CONTROL
imply CMD_DM
 
diff --git a/arch/arm/include/asm/arch-owl/clk_s900.h 
b/arch/arm/include/asm/arch-owl/clk_s900.h
deleted file mode 100644
index 88e88f7..000
--- a/arch/arm/include/asm/arch-owl/clk_s900.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Actions Semi S900 Clock Definitions
- *
- * Copyright (C) 2015 Actions Semi Co., Ltd.
- * Copyright (C) 2018 Manivannan Sadhasivam 
- *
- */
-
-#ifndef _OWL_CLK_S900_H_
-#define _OWL_CLK_S900_H_
-
-#include 
-
-struct owl_clk_priv {
-   phys_addr_t base;
-};
-
-/* BUSCLK register definitions */
-#define CMU_PDBGDIV_8  7
-#define CMU_PDBGDIV_SHIFT  26
-#define CMU_PDBGDIV_DIV(CMU_PDBGDIV_8 << CMU_PDBGDIV_SHIFT)
-#define CMU_PERDIV_8   7
-#define CMU_PERDIV_SHIFT   20
-#define CMU_PERDIV_DIV (CMU_PERDIV_8 << CMU_PERDIV_SHIFT)
-#define CMU_NOCDIV_2   1
-#define CMU_NOCDIV_SHIFT   19
-#define CMU_NOCDIV_DIV (CMU_NOCDIV_2 << CMU_NOCDIV_SHIFT)
-#define CMU_DMMCLK_SRC_APLL2
-#define CMU_DMMCLK_SRC_SHIFT   10
-#define CMU_DMMCLK_SRC (CMU_DMMCLK_SRC_APLL << CMU_DMMCLK_SRC_SHIFT)
-#define CMU_APBCLK_DIV BIT(8)
-#define CMU_NOCCLK_SRC BIT(7)
-#define CMU_AHBCLK_DIV BIT(4)
-#define CMU_CORECLK_MASK   3
-#define CMU_CORECLK_CPLL   BIT(1)
-#define CMU_CORECLK_HOSC   BIT(0)
-
-/* COREPLL register definitions */
-#define CMU_COREPLL_EN BIT(9)
-#define CMU_COREPLL_HOSC_ENBIT(8)
-#define CMU_COREPLL_OUT(1104 / 24)
-
-/* DEVPLL register definitions */
-#define CMU_DEVPLL_CLK BIT(12)
-#define CMU_DEVPLL_EN  BIT(8)
-#define CMU_DEVPLL_OUT (660 / 6)
-
-/* UARTCLK register definitions */
-#define CMU_UARTCLK_SRC_DEVPLL BIT(16)
-
-/* DEVCLKEN1 register definitions */
-#define CMU_DEVCLKEN1_UART5BIT(21)
-
-#define PLL_STABILITY_WAIT_US  50
-
-#endif
diff --git a/arch/arm/include/asm/arch-owl/regs_s700.h 
b/arch/arm/include/asm/arch-owl/regs_s700.h
new file mode 100644
index 000..2f21c15
--- /dev/null
+++ b/arch/arm/include/asm/arch-owl/regs_s700.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Actions Semi S700 Register Definitions
+ *
+ */
+
+#ifndef _OWL_REGS_S700_H_
+#define _OWL_REGS_S700_H_
+
+#define CMU_COREPLL0x
+#define CMU_DEVPLL 0x0004
+#define CMU_DDRPLL 0x0008
+#define CMU_NANDPLL0x000C
+#define CMU_DISPLAYPLL 0x0010
+#define CMU_AUDIOPLL   0x0014
+#define CMU_TVOUTPLL   0x0018
+#define CMU_BUSCLK 0x001C
+#define CMU_SENSORCLK  0x0020
+#define CMU_LCDCLK 0x0024
+#define CMU_DSIPLLCLK  0x0028
+#define CMU_CSICLK 0x002C
+#define CMU_DECLK  0x0030
+#define CMU_SICLK  0x0034
+#define CMU_BUSCLK10x0038
+#define CMU_HDECLK 0x003C
+#define CMU_VDECLK 0x0040
+#define CMU_VCECLK 

[PATCH v6 02/12] arm: actions: rename sysmap-s900 to sysmap-owl

2020-03-18 Thread Amit Singh Tomar
Now that memory maps(for both S700 and S900 SoCs) can be managed using
a common file, rename sysmap-s900 to sysmap-owl to reflect the same.

Reviewed-by: Manivannan Sadhasivam 
Signed-off-by: Amit Singh Tomar 
---
Changes since v5:
* No changes.
Changes since v4:
* No changes.
Changes since v3:
* Added reviewed-by tag.
Changes since v2:
* Fixed the commit message and header.
Changes since v1:
* compile sysmap-owl.c against CONFIG_ARM64 now.
---
 arch/arm/mach-owl/Makefile  |  2 +-
 arch/arm/mach-owl/sysmap-owl.c  | 32 
 arch/arm/mach-owl/sysmap-s900.c | 32 
 3 files changed, 33 insertions(+), 33 deletions(-)
 create mode 100644 arch/arm/mach-owl/sysmap-owl.c
 delete mode 100644 arch/arm/mach-owl/sysmap-s900.c

diff --git a/arch/arm/mach-owl/Makefile b/arch/arm/mach-owl/Makefile
index 0b181c6..f3a69eb 100644
--- a/arch/arm/mach-owl/Makefile
+++ b/arch/arm/mach-owl/Makefile
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 obj-y += soc.o
-obj-y += sysmap-s900.o
+obj-$(CONFIG_ARM64) += sysmap-owl.o
diff --git a/arch/arm/mach-owl/sysmap-owl.c b/arch/arm/mach-owl/sysmap-owl.c
new file mode 100644
index 000..81f6ca2
--- /dev/null
+++ b/arch/arm/mach-owl/sysmap-owl.c
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Memory map for Actions Semi Owl series SoCs.
+ *
+ * Copyright (C) 2015 Actions Semi Co., Ltd.
+ * Copyright (C) 2018 Manivannan Sadhasivam 
+ */
+
+#include 
+#include 
+
+static struct mm_region owl_mem_map[] = {
+   {
+   .virt = 0x0UL, /* DDR */
+   .phys = 0x0UL, /* DDR */
+   .size = 0x8000UL,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+PTE_BLOCK_INNER_SHARE
+   }, {
+   .virt = 0xE000UL, /* Peripheral block */
+   .phys = 0xE000UL, /* Peripheral block */
+   .size = 0x0800UL,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* List terminator */
+   0,
+   }
+};
+
+struct mm_region *mem_map = owl_mem_map;
diff --git a/arch/arm/mach-owl/sysmap-s900.c b/arch/arm/mach-owl/sysmap-s900.c
deleted file mode 100644
index f78b639..000
--- a/arch/arm/mach-owl/sysmap-s900.c
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Actions Semi S900 Memory map
- *
- * Copyright (C) 2015 Actions Semi Co., Ltd.
- * Copyright (C) 2018 Manivannan Sadhasivam 
- */
-
-#include 
-#include 
-
-static struct mm_region s900_mem_map[] = {
-   {
-   .virt = 0x0UL, /* DDR */
-   .phys = 0x0UL, /* DDR */
-   .size = 0x8000UL,
-   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
-PTE_BLOCK_INNER_SHARE
-   }, {
-   .virt = 0xE000UL, /* Peripheral block */
-   .phys = 0xE000UL, /* Peripheral block */
-   .size = 0x0800UL,
-   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
-PTE_BLOCK_NON_SHARE |
-PTE_BLOCK_PXN | PTE_BLOCK_UXN
-   }, {
-   /* List terminator */
-   0,
-   }
-};
-
-struct mm_region *mem_map = s900_mem_map;
-- 
2.7.4



Re: [RFC PATCH v2] cmd: mp: change the command name from cpu to mp

2020-03-18 Thread Bin Meng
On Sat, Mar 14, 2020 at 10:50 PM Pragnesh Patel
 wrote:
>
> When CONFIG_CMD_CPU and CONFIG_MP both are enabled, U-Boot compilation
> gives an error of "multiple definition of `_u_boot_list_2_cmd_2_cpu'"
> so cpu command(cmd/cpu.c) and mp command(cmd/mp.c) should have different
> command name.
>
> Signed-off-by: Pragnesh Patel 
> ---
>  cmd/mp.c | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)
>

Reviewed-by: Bin Meng 


[PATCH v3 06/23] buildman: Allow ignoring warnings in the return code

2020-03-18 Thread Simon Glass
Sometimes we don't want buildman to return failure if it seems warnings.
Add a -W option to support this. If buildman detects warnings (and no
errors) it will return an exit code of 0 (success).

Note that the definition of 'warnings' includes the migration warnings
produced by U-Boot, such as:

= WARNING ==
This board does not use CONFIG_DM_MMC. Please update
...


Signed-off-by: Simon Glass 
---

Changes in v3:
- Add more documentation on -W and the interaction with -E
- Expand the commit message

Changes in v2: None

 tools/buildman/README | 20 ++--
 tools/buildman/cmdline.py |  2 ++
 tools/buildman/control.py |  2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index aea9f2..116a0ee545 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1070,16 +1070,32 @@ This will write the full build into /tmp/build 
including object files.
 Other options
 =
 
-Buildman has various other command line options. Try --help to see them.
+Buildman has various other command-line options. Try --help to see them.
 
 To find out what architecture or toolchain prefix buildman will use for a 
build,
 see the -a and -A options.
 
+To request that compiler warnings be promoted to errors, use -E. This passes 
the
+-Werror flag to the compiler. Note that the build can still produce warnings
+with -E, e.g. the migration warnings:
+
+= WARNING ==
+This board does not use CONFIG_DM_MMC. Please update
+...
+
+
 When doing builds, Buildman's return code will reflect the overall result:
 
 0 (success) No errors or warnings found
 128 Errors found
-129 Warnings found
+129 Warnings found (only if no -W)
+
+You can use -W to tell Buildman to return 0 (success) instead of 129 when
+warnings are found. Note that it can be useful to combine -E and -W. This means
+that all compiler warnings will produce failures (code 128) and all other
+warnings will produce success (since 129 is changed to 0).
+
+If there are both warnings and errors, errors win, so buildman returns 128.
 
 
 How to change from MAKEALL
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 74b410010d..f387aeb1cf 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -108,6 +108,8 @@ def ParseArgs():
   default=False, help='Run make with V=1, logging all output')
 parser.add_option('-w', '--work-in-output', action='store_true',
   default=False, help='Use the output directory as the work directory')
+parser.add_option('-W', '--ignore-warnings', action='store_true',
+  default=False, help='Return success even if there are warnings')
 parser.add_option('-x', '--exclude', dest='exclude',
   type='string', action='append',
   help='Specify a list of boards to exclude, separated by comma')
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 5d80400f7a..ded4360250 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -386,6 +386,6 @@ def DoBuildman(options, args, toolchains=None, 
make_func=None, boards=None,
 options.keep_outputs, options.verbose)
 if fail:
 return 128
-elif warned:
+elif warned and not options.ignore_warnings:
 return 129
 return 0
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 03/23] buildman: Document the members of BuilderJob

2020-03-18 Thread Simon Glass
This class has a few more members now. Add documentation for them and fix
a nit in the 'commits' comment.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 tools/buildman/builderthread.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 570c1f6595..1e52ef8295 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -39,11 +39,15 @@ class BuilderJob:
 
 Members:
 board: Board object to build
-commits: List of commit options to build.
+commits: List of Commit objects to build
+keep_outputs: True to save build output files
+step: 1 to process every commit, n to process every nth commit
 """
 def __init__(self):
 self.board = None
 self.commits = []
+self.keep_outputs = False
+self.step = 1
 
 
 class ResultThread(threading.Thread):
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 02/23] main: Drop show_boot_progress() prototype

2020-03-18 Thread Simon Glass
This is defined in bootstage.h and is not called in this file anyway. Drop
it.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 common/main.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/common/main.c b/common/main.c
index ec8994ad45..06d7ff56d6 100644
--- a/common/main.c
+++ b/common/main.c
@@ -15,11 +15,6 @@
 #include 
 #include 
 
-/*
- * Board-specific Platform code can reimplement show_boot_progress () if needed
- */
-__weak void show_boot_progress(int val) {}
-
 static void run_preboot_environment_command(void)
 {
char *p;
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 04/23] bulidman: Add support for a simple build

2020-03-18 Thread Simon Glass
It is useful to run a simple build and put all the output in a single
directory. Add a -w option to support this.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 tools/buildman/README   | 11 ++
 tools/buildman/builder.py   | 15 +++--
 tools/buildman/builderthread.py | 28 ---
 tools/buildman/cmdline.py   |  2 ++
 tools/buildman/control.py   | 10 -
 tools/buildman/func_test.py | 39 +
 6 files changed, 90 insertions(+), 15 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index c1ac0d0f58..aea9f2 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1056,6 +1056,17 @@ toolchain. For example:
buildman -O clang-7 --board sandbox
 
 
+Doing a simple build
+
+
+In some cases you just want to build a single board and get the full output, 
use
+the -w option, for example:
+
+   buildman -o /tmp/build --board sandbox -w
+
+This will write the full build into /tmp/build including object files.
+
+
 Other options
 =
 
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 3fd4fac695..081c1d0901 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -174,6 +174,8 @@ class Builder:
 in_tree: Build U-Boot in-tree instead of specifying an output
 directory separate from the source code. This option is really
 only useful for testing in-tree builds.
+work_in_output: Use the output directory as the work directory and
+don't write to a separate output directory.
 
 Private members:
 _base_board_dict: Last-summarised Dict of boards
@@ -224,7 +226,7 @@ class Builder:
  no_subdirs=False, full_path=False, verbose_build=False,
  incremental=False, per_board_out_dir=False,
  config_only=False, squash_config_y=False,
- warnings_as_errors=False):
+ warnings_as_errors=False, work_in_output=False):
 """Create a new Builder object
 
 Args:
@@ -250,10 +252,15 @@ class Builder:
 config_only: Only configure each build, don't build it
 squash_config_y: Convert CONFIG options with the value 'y' to '1'
 warnings_as_errors: Treat all compiler warnings as errors
+work_in_output: Use the output directory as the work directory and
+don't write to a separate output directory.
 """
 self.toolchains = toolchains
 self.base_dir = base_dir
-self._working_dir = os.path.join(base_dir, '.bm-work')
+if work_in_output:
+self._working_dir = base_dir
+else:
+self._working_dir = os.path.join(base_dir, '.bm-work')
 self.threads = []
 self.do_make = self.Make
 self.gnu_make = gnu_make
@@ -280,6 +287,7 @@ class Builder:
 self.config_only = config_only
 self.squash_config_y = squash_config_y
 self.config_filenames = BASE_CONFIG_FILENAMES
+self.work_in_output = work_in_output
 if not self.squash_config_y:
 self.config_filenames += EXTRA_CONFIG_FILENAMES
 
@@ -1474,6 +1482,8 @@ class Builder:
 Args:
 thread_num: Number of thread to check.
 """
+if self.work_in_output:
+return self._working_dir
 return os.path.join(self._working_dir, '%02d' % thread_num)
 
 def _PrepareThread(self, thread_num, setup_git):
@@ -1571,6 +1581,7 @@ class Builder:
 job.board = brd
 job.commits = commits
 job.keep_outputs = keep_outputs
+job.work_in_output = self.work_in_output
 job.step = self._step
 self.queue.put(job)
 
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 1e52ef8295..7561f39942 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -42,12 +42,15 @@ class BuilderJob:
 commits: List of Commit objects to build
 keep_outputs: True to save build output files
 step: 1 to process every commit, n to process every nth commit
+work_in_output: Use the output directory as the work directory and
+don't write to a separate output directory.
 """
 def __init__(self):
 self.board = None
 self.commits = []
 self.keep_outputs = False
 self.step = 1
+self.work_in_output = False
 
 
 class ResultThread(threading.Thread):
@@ -118,7 +121,7 @@ class BuilderThread(threading.Thread):
 **kwargs)
 
 def RunCommit(self, commit_upto, brd, work_dir, do_config, config_only,
-  force_build, force_build_failures):
+  force_build, force_build_failures, work_in_output):
 """Build a particular commit.
 
 If the build is already done, and we are not 

[PATCH v3 00/23] gitlab: Simplify the test script

2020-03-18 Thread Simon Glass
At present there are several things in the gitlab, travis and azure
scripts which work around limitations in buildman. With a few small
feature additions these can be removed.

This series adds some new features to buildman and simplifies the script:
- Option to run a single build in a specified output directory
- Allow ignoring warnings
- Removes a restriction on the build output directory

It also
- adds a way for test.py to use buildman for the --build option
- makes one change to azure since the same approach should be possible there
- fixes a few minor problems noticed in main and sandbox docs
- removes the -a buildman flag which serves no purpose

Note: I tested that this works OK on travis, gitlab and azure.

There is something funny about azure - the test called
"Run binman, buildman, dtoc and patman testsuites" fails the 'buildman -t'
test but azure reports success.

Changes in v3:
- Add more documentation on -W and the interaction with -E
- Bring back the -E flag and add -W
- Drop mention of -a in the README also
- Expand the commit message
- Rewrite the commit message

Changes in v2:
- Add Fixes tag
- Add a comment about the obscure bash feature
- Add a new patch to avoid copying files into .bm-work/
- Add a new patch to drop the -a option
- Add a new patch to split travis building into two parts
- Add new patch to drop the repeated buildman call
- Convert this into an option, leaving the default as is
- Just drop the -E flag
- Leave in the repeated call to buildman
- Reword the commit message for clarity
- Update azure also
- Update travis, azure also

Simon Glass (23):
  sandbox: Add documentation about required/useful packages
  main: Drop show_boot_progress() prototype
  buildman: Document the members of BuilderJob
  bulidman: Add support for a simple build
  buildman: Update help for -d
  buildman: Allow ignoring warnings in the return code
  buildman: Be more selective about which directories to remove
  buildman: Allow building within a subdir of the current dir
  buildman: Drop the -a option
  travis: Don't copy files into .bm-work/
  travis: Split the building into two parts
  gitlab/azure: Use the -w option for sandbox_spl
  travis/gitlab/azure: Use --board buildman flag with test.py
  travis/gitlab/azure: Drop BUILDMAN variable with test.py
  travis/gitlab/azure: Drop the buildman -d flag
  gitlab/azure: Drop unnecessary if..fi when using test.py
  gitlab/azure: Use -w flag for all test.py builds
  travis/gitlab/azure: Use bash to avoid a_test_which_does_not_exist
  travis/gitlab/azure: Use -W to avoid warnings check
  travis/gitlab/azure: Enable test_handoff
  travis/gitlab/azure: Simplify the exit code for test.py
  travis/gitlab/azure: Drop repeated buildman call with test.py
  test/py: Allow using buildman to build U-Boot

 .azure-pipelines.yml| 57 +-
 .gitlab-ci.yml  | 85 ++---
 .travis.yml | 63 
 common/main.c   |  5 --
 doc/arch/sandbox.rst| 10 
 test/py/README.md   | 13 -
 test/py/conftest.py | 30 
 tools/buildman/README   | 35 --
 tools/buildman/builder.py   | 51 +++-
 tools/buildman/builderthread.py | 34 +
 tools/buildman/cmdline.py   |  8 ++--
 tools/buildman/control.py   | 52 +++-
 tools/buildman/func_test.py | 46 +-
 tools/buildman/test.py  | 20 
 14 files changed, 269 insertions(+), 240 deletions(-)

-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 01/23] sandbox: Add documentation about required/useful packages

2020-03-18 Thread Simon Glass
Quite a few packages are used by sandbox or tools. Add a list of these to
help people setting up for the first time.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 doc/arch/sandbox.rst | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
index e577a95716..6a1c6fc552 100644
--- a/doc/arch/sandbox.rst
+++ b/doc/arch/sandbox.rst
@@ -34,6 +34,16 @@ integers can only be built on 64-bit hosts.
 Note that standalone/API support is not available at present.
 
 
+Prerequisites
+-
+
+Here are some packages that are worth installing if you are doing sandbox or
+tools development in U-Boot:
+
+   python3-pytest lzma lzma-alone lz4 python3 python3-virtualenv
+   libssl1.0-dev
+
+
 Basic Operation
 ---
 
-- 
2.25.1.481.gfbce0eb801-goog



[PATCH v3 08/23] buildman: Allow building within a subdir of the current dir

2020-03-18 Thread Simon Glass
This is useful in some situations, in particular with -w and when building
in-tree. Now that we are more careful about what we remove in
_PrepareOutputSpace(), it should be safe to relax this restriction.

Update the progress information also so it is clear what buildman is
doing. Remove files can take a long time.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 tools/buildman/builder.py   |  3 ++-
 tools/buildman/control.py   | 23 ---
 tools/buildman/func_test.py |  9 -
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 30ec4254f8..70c55c588a 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1560,10 +1560,11 @@ class Builder:
 """
 to_remove = self._GetOutputSpaceRemovals()
 if to_remove:
-Print('Removing %d old build directories' % len(to_remove),
+Print('Removing %d old build directories...' % len(to_remove),
   newline=False)
 for dirname in to_remove:
 shutil.rmtree(dirname)
+Print('done')
 
 def BuildBoards(self, commits, board_selected, keep_outputs, verbose):
 """Build all commits for a list of boards
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index ded4360250..7d31863c63 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -85,28 +85,6 @@ def ShowActions(series, why_selected, boards_selected, 
builder, options,
 for warning in board_warnings:
 print(col.Color(col.YELLOW, warning))
 
-def CheckOutputDir(output_dir):
-"""Make sure that the output directory is not within the current directory
-
-If we try to use an output directory which is within the current directory
-(which is assumed to hold the U-Boot source) we may end up deleting the
-U-Boot source code. Detect this and print an error in this case.
-
-Args:
-output_dir: Output directory path to check
-"""
-path = os.path.realpath(output_dir)
-cwd_path = os.path.realpath('.')
-while True:
-if os.path.realpath(path) == cwd_path:
-Print("Cannot use output directory '%s' since it is within the 
current directory '%s'" %
-  (path, cwd_path))
-sys.exit(1)
-parent = os.path.dirname(path)
-if parent == path:
-break
-path = parent
-
 def ShowToolchainInfo(boards, toolchains, print_arch, print_prefix):
 """Show information about a the tool chain used by one or more boards
 
@@ -331,7 +309,6 @@ def DoBuildman(options, args, toolchains=None, 
make_func=None, boards=None,
 output_dir = os.path.join(options.output_dir, dirname)
 if clean_dir and os.path.exists(output_dir):
 shutil.rmtree(output_dir)
-CheckOutputDir(output_dir)
 builder = Builder(toolchains, output_dir, options.git_dir,
 options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
 show_unknown=options.show_unknown, step=options.step,
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index f9f8f80593..2a256a9263 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -534,15 +534,6 @@ class TestFunctional(unittest.TestCase):
 self.assertEqual(self._builder.count, self._total_builds)
 self.assertEqual(self._builder.fail, 0)
 
-def testBadOutputDir(self):
-"""Test building with an output dir the same as out current dir"""
-self._test_branch = '/__dev/__testbranch'
-with self.assertRaises(SystemExit):
-self._RunControl('-b', self._test_branch, '-o', os.getcwd())
-with self.assertRaises(SystemExit):
-self._RunControl('-b', self._test_branch, '-o',
- os.path.join(os.getcwd(), 'test'))
-
 def testWorkInOutput(self):
 """Test the -w option which should write directly to the output dir"""
 board_list = board.Boards()
-- 
2.25.1.481.gfbce0eb801-goog



RE: [RFC RFT PATCH] env: spl: filter the variables in default environment of SPL or TPL

2020-03-18 Thread Patrick DELAUNAY
Hi Wolfgang,

> From: Wolfgang Denk 
> Sent: mercredi 18 mars 2020 15:51
> To: Patrick DELAUNAY 
> Cc: u-boot@lists.denx.de; Bin Meng ; Fabio Estevam
> ; Heinrich Schuchardt ; Jagan
> Teki ; Joe Hershberger
> ; Kever Yang ; Marek
> Vasut ; Simon Glass ; U-Boot STM32
> 
> Subject: Re: [RFC RFT PATCH] env: spl: filter the variables in default
> environment of SPL or TPL
> 
> Dear Patrick,
> 
> In message <20200318143602.23253-1-patrick.delau...@st.com> you wrote:
> > Use a new option CONFIG_SPL_ENV_VARS to filter the variables included
> > in the default environment used in SPL (and TPL).
> >
> > That allows to reduce the size of default_environment[].
> 
> Sorry, but NAK.  we had this discussion a couple of times before.
> It is mandatory that both SPL and U-Boot proper will use the _same_ 
> environment,
> including the same default environment, or all kind of havoc may result.  
> Just think
> of situations where Falcon Mode is being used and SPL and U-Boot proper would
> be using different settings.
> 
> If your default environment is too big for the SPL, then make it smaller.  If 
> you
> need additional settings in U-Boot, there are many ways to load thise there.

Thanks for the answer, 
so it was clearly not an option and I abandon this patch.

To complete my answer, today I don't have issue with SPL environment size on 
the stm32 targets,

I propose this patch only to solve issue with my previous proposed patch on 
other target

- [U-Boot,v4,3/3] env: Add CONFIG_ENV_FULL_SUPPORT
- [U-Boot,v4,2/3] env: introduce macro ENV_IS_IN_SOMEWHERE

This proposal raise many size issue for other boards when I activated
CONFIG_SPL_ENV_SUPPORT and CONFIG_SPL_ENV_IS_NOWHERE by default

Today I don’t see solution except accept the current situation:
for some target, the environment isn't supported/activated in SPL, even default 
one
(when CONFIG_SPL_ENV_SUPPORT not activated, the env source files aren't 
compiled)

So I will also abandon the previous patchset
- http://patchwork.ozlabs.org/patch/1171180/ 
- http://patchwork.ozlabs.org/patch/1171098/

Patrick

> Best regards,
> 
> Wolfgang Denk
> 
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de "If
> that makes any sense to you, you have a big problem."
>   -- C. Durance, Computer Science 234


Antwort: [PATCH v2 33/39] acpi: Add support for SSDT generation

2020-03-18 Thread Wolfgang Wallner
Hi Simon,

"Simon Glass"  schrieb am 09.03.2020 04:44:57:

> Betreff: [PATCH v2 33/39] acpi: Add support for SSDT generation
> 
> Some devices need to generate code for the Secondary System Descriptor
> Table (SSDT). Add a method to handle this.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2:
> - Switch parameter order of _acpi_fill_ssdt() and make it static
> 
>  arch/sandbox/dts/test.dts |  2 ++
>  drivers/core/acpi.c   | 14 +
>  include/dm/acpi.h | 23 ++
>  test/dm/acpi.c| 41 ++-
>  4 files changed, 79 insertions(+), 1 deletion(-)
> 

[snip]

> diff --git a/test/dm/acpi.c b/test/dm/acpi.c
> index feb380b26c..305d8395ff 100644
> --- a/test/dm/acpi.c
> +++ b/test/dm/acpi.c
> @@ -7,6 +7,7 @@

[snip]

>  static const struct udevice_id testacpi_ids[] = {
> @@ -313,3 +325,30 @@ static int dm_test_acpi_cmd_dump(struct 
unit_test_state *uts)
> return 0;
>  }
>  DM_TEST(dm_test_acpi_cmd_dump, DM_TESTF_SCAN_PDATA | 
DM_TESTF_SCAN_FDT);
> +
> +/* Test acpi_fill_ssdt() */
> +static int dm_test_acpi_fill_ssdt(struct unit_test_state *uts)
> +{
> +   struct acpi_ctx ctx;
> +   u8 *buf;
> +
> +   buf = malloc(BUF_SIZE);
> +   ut_assertnonnull(buf);
> +
> +   ctx.current = buf;
> +   buf[4] = 'z';   /* sentinal */

nit: sentinel ?

> +   ut_assertok(acpi_fill_ssdt());
> +
> +   /* These values come from acpi-test's acpi-ssdt-test-data property 
*/
> +   ut_asserteq('a', buf[0]);
> +   ut_asserteq('b', buf[1]);
> +
> +   /* These values come from acpi-test2's acpi-ssdt-test-data property 
*/
> +   ut_asserteq('c', buf[2]);
> +   ut_asserteq('d', buf[3]);
> +
> +   ut_asserteq('z', buf[4]);
> +
> +   return 0;
> +}
> +DM_TEST(dm_test_acpi_fill_ssdt, DM_TESTF_SCAN_PDATA | 
DM_TESTF_SCAN_FDT);
> -- 
> 2.25.1.481.gfbce0eb801-goog
> 

Reviewed-by: Wolfgang Wallner 




[PATCH v6 00/12] Actions S700 SoC support

2020-03-18 Thread Amit Singh Tomar
This adds Cubieboard7[1] support based on Action Semi's S700 SoC[2], It's 
Quad-core ARMv8 SoC
with Cortex-A53 cores. Peripheral like UART seems to be compatible with S900 
SoC(basic support
for it is alreay present in u-boot).

This series(v6) does following changes:

* [PATCH v5 06/11] becomes [PATCH v6 03/11]
* [PATCH v5 03/11] becomes [PATCH v6 04/11]
* Introduce a new patch to move defconfig options to Kconfig which is [PATCH v6 
10/12]

Previous series(v5)[3] just re-orders the patches so that U-BOOT(with 
bubblegum96_defconfig) builds
after every patch of the series(suggested by Andre).

S700 support is tested[4] on Cubieboard7 board and S900 support is just 
compiled tested.

This patch series can be tested using below tree:
https://github.com/Atomar25/u-boot/commits/s700_v6

[1]: http://www.cubietech.com/product-detail/cubieboard7/
[2]: http://www.actions-semi.com/en/productview.aspx?id=225
[3]: 
http://u-boot.10912.n7.nabble.com/PATCH-v5-00-11-Actions-S700-SoC-support-td402752.html#a402762
[4]: https://paste.ubuntu.com/p/xK9pWTy5Hc/

Amit Singh Tomar (12):
  arm: actions: Add common framework for Actions Owl Semi SoCs
  arm: actions: rename sysmap-s900 to sysmap-owl
  serial: actions: add compatible string
  arm: dts: sync dts for Action Semi S900
  arm: dts: actions: s900: add u-boot specific dtsi file
  clk: actions: Add common clock driver
  arm: actions: add S700 SoC device tree
  arm: dts: actions: s700: add u-boot specific dtsi file
  arm: add support Actions Semi S700
  actions: Move defconfig options to Kconfig
  arm: add Cubieboard7 board support
  doc: boards: add Cubieboard7 documentation

 MAINTAINERS|   2 +
 arch/arm/Kconfig   |   5 +-
 arch/arm/dts/Makefile  |   6 +-
 arch/arm/dts/s700-cubieboard7.dts  |  92 +++
 arch/arm/dts/s700-u-boot.dtsi  |  18 ++
 arch/arm/dts/s700.dtsi | 248 +++
 arch/arm/dts/s900-u-boot.dtsi  |  17 ++
 arch/arm/dts/s900.dtsi | 322 +++--
 arch/arm/include/asm/arch-owl/clk_s900.h   |  57 -
 arch/arm/include/asm/arch-owl/regs_s700.h  |  56 +
 arch/arm/mach-owl/Kconfig  |  51 ++--
 arch/arm/mach-owl/Makefile |   3 +-
 arch/arm/mach-owl/soc.c|  57 +
 arch/arm/mach-owl/sysmap-owl.c |  32 +++
 arch/arm/mach-owl/sysmap-s900.c|  32 ---
 board/ucRobotics/bubblegum_96/Kconfig  |  15 --
 board/ucRobotics/bubblegum_96/MAINTAINERS  |   6 -
 board/ucRobotics/bubblegum_96/Makefile |   3 -
 board/ucRobotics/bubblegum_96/bubblegum_96.c   |  57 -
 configs/bubblegum_96_defconfig |  12 +-
 configs/cubieboard7_defconfig  |   9 +
 doc/board/actions/cubieboard7.rst  | 115 +
 doc/board/actions/index.rst|  10 +
 doc/board/index.rst|   1 +
 drivers/clk/owl/Kconfig|   8 +-
 drivers/clk/owl/Makefile   |   2 +-
 drivers/clk/owl/clk_owl.c  | 152 
 drivers/clk/owl/clk_owl.h  |  65 +
 drivers/clk/owl/clk_s900.c | 137 ---
 drivers/serial/serial_owl.c|   2 +-
 include/configs/bubblegum_96.h |  40 ---
 include/configs/owl-common.h   |  40 +++
 include/configs/s700.h |  13 +
 include/configs/s900.h |  16 ++
 include/dt-bindings/clock/actions,s700-cmu.h   | 118 +
 include/dt-bindings/clock/actions,s900-cmu.h   | 129 ++
 include/dt-bindings/clock/s900_cmu.h   |  77 --
 include/dt-bindings/reset/actions,s700-reset.h |  34 +++
 include/dt-bindings/reset/actions,s900-reset.h |  65 +
 39 files changed, 1638 insertions(+), 486 deletions(-)
 create mode 100644 arch/arm/dts/s700-cubieboard7.dts
 create mode 100644 arch/arm/dts/s700-u-boot.dtsi
 create mode 100644 arch/arm/dts/s700.dtsi
 create mode 100644 arch/arm/dts/s900-u-boot.dtsi
 delete mode 100644 arch/arm/include/asm/arch-owl/clk_s900.h
 create mode 100644 arch/arm/include/asm/arch-owl/regs_s700.h
 create mode 100644 arch/arm/mach-owl/soc.c
 create mode 100644 arch/arm/mach-owl/sysmap-owl.c
 delete mode 100644 arch/arm/mach-owl/sysmap-s900.c
 delete mode 100644 board/ucRobotics/bubblegum_96/Kconfig
 delete mode 100644 board/ucRobotics/bubblegum_96/MAINTAINERS
 delete mode 100644 board/ucRobotics/bubblegum_96/Makefile
 delete mode 100644 board/ucRobotics/bubblegum_96/bubblegum_96.c
 create mode 100644 configs/cubieboard7_defconfig
 create mode 100644 doc/board/actions/cubieboard7.rst
 create mode 100644 doc/board/actions/index.rst
 create mode 100644 drivers/clk/owl/clk_owl.c
 create mode 100644 drivers/clk/owl/clk_owl.h
 delete mode 

Re: [PATCH v3 2/5] cmd: bootefi: Parse reserved-memory node from DT

2020-03-18 Thread Heinrich Schuchardt

On 3/17/20 11:01 PM, Heinrich Schuchardt wrote:

On 3/17/20 10:19 PM, Atish Patra wrote:

Currently, bootefi only parses memory reservation block to setup
EFI reserved memory mappings. However, it doesn't parse the
reserved-memory[1] device tree node that also can contain the
reserved memory regions.

Add capability to parse reserved-memory node and update the EFI memory
mappings accordingly.

1. source>/doc/device-tree-bindings/reserved-memory/reserved-memory.txt]


Signed-off-by: Atish Patra 
---
  cmd/bootefi.c | 44 +++-
  1 file changed, 35 insertions(+), 9 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 24fc42ae898e..291cb2d69ff6 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -149,6 +149,20 @@ done:
  return ret;
  }

+static void efi_reserve_memory(uint64_t addr, uint64_t size)
+{
+    uint64_t pages;
+
+    /* Convert from sandbox address space. */
+    addr = (uintptr_t)map_sysmem(addr, 0);
+    pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
+    addr &= ~EFI_PAGE_MASK;
+    if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
+   false) != EFI_SUCCESS)
+    printf("Reserved memory mapping failed addr %llx size %llx\n",
+  (unsigned long long)addr, (unsigned long long)size);
+}
+
  /**
   * efi_carve_out_dt_rsv() - Carve out DT reserved memory ranges
   *
@@ -161,7 +175,8 @@ done:
  static void efi_carve_out_dt_rsv(void *fdt)
  {
  int nr_rsv, i;
-    uint64_t addr, size, pages;
+    uint64_t addr, size;
+    int nodeoffset, subnode;

  nr_rsv = fdt_num_mem_rsv(fdt);

@@ -169,15 +184,26 @@ static void efi_carve_out_dt_rsv(void *fdt)
  for (i = 0; i < nr_rsv; i++) {
  if (fdt_get_mem_rsv(fdt, i, , ) != 0)
  continue;
+    efi_reserve_memory(addr, size);
+    }

-    /* Convert from sandbox address space. */
-    addr = (uintptr_t)map_sysmem(addr, 0);
-
-    pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
-    addr &= ~EFI_PAGE_MASK;
-    if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
-   false) != EFI_SUCCESS)
-    printf("FDT memrsv map %d: Failed to add to map\n", i);
+    /* process reserved-memory */
+    nodeoffset = fdt_subnode_offset(fdt, 0, "reserved-memory");
+    if (nodeoffset < 0)
+    return;
+    subnode = fdt_first_subnode(fdt, nodeoffset);
+    while (subnode >= 0) {
+    /* check if this subnode has a reg property */
+    addr = fdtdec_get_addr_size_auto_noparent(fdt, subnode,
+  "reg", 0,
+  (fdt_size_t *),
+  true);
+    if (addr == FDT_ADDR_T_NONE) {
+    debug("failed to read address/size\n");
+    continue;


As you do not update subnode you never leave the loop, cf.
https://lists.denx.de/pipermail/u-boot/2020-March/402891.html

Best regards

Heinrich


Corrected and merged into origin/master.

Best regards

Heinrich




+    }
+    efi_reserve_memory(addr, size);
+    subnode = fdt_next_subnode(fdt, subnode);
  }
  }








[PATCH] menu: add support for client defined statusline function

2020-03-18 Thread Thirupathaiah Annapureddy
Currently displaying status line is done in a weak function
menu_display_statusline().

bootmenu.c overrides the weak default function.
It calls menu_default_choice() and interprets the data as
struct bootmenu_entry.

pxe boot also uses common menu code for pxe menus.
If there is a system that enables both bootmenu and pxe,
menu_display_statusline() defined in bootmenu.c will be called
and it will interpret struct pxe_label as struct bootmenu_entry.
This leads to data aborts and pxe menu corruptions.

This patch adds support for client defined statusline function
to resolve the above bug.

Signed-off-by: Thirupathaiah Annapureddy 
---
 cmd/bootmenu.c  | 61 +
 cmd/pxe_utils.c |  2 +-
 common/menu.c   | 13 +++
 include/menu.h  |  2 +-
 4 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 3dc2c854ac..f1562883f5 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -365,6 +365,34 @@ cleanup:
return NULL;
 }
 
+static void menu_display_statusline(struct menu *m)
+{
+   struct bootmenu_entry *entry;
+   struct bootmenu_data *menu;
+
+   if (menu_default_choice(m, (void *)) < 0)
+   return;
+
+   menu = entry->menu;
+
+   printf(ANSI_CURSOR_POSITION, 1, 1);
+   puts(ANSI_CLEAR_LINE);
+   printf(ANSI_CURSOR_POSITION, 2, 1);
+   puts("  *** U-Boot Boot Menu ***");
+   puts(ANSI_CLEAR_LINE_TO_END);
+   printf(ANSI_CURSOR_POSITION, 3, 1);
+   puts(ANSI_CLEAR_LINE);
+
+   /* First 3 lines are bootmenu header + 2 empty lines between entries */
+   printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
+   puts(ANSI_CLEAR_LINE);
+   printf(ANSI_CURSOR_POSITION, menu->count + 6, 1);
+   puts("  Press UP/DOWN to move, ENTER to select");
+   puts(ANSI_CLEAR_LINE_TO_END);
+   printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
+   puts(ANSI_CLEAR_LINE);
+}
+
 static void bootmenu_show(int delay)
 {
int init = 0;
@@ -396,8 +424,9 @@ static void bootmenu_show(int delay)
if (!bootmenu)
return;
 
-   menu = menu_create(NULL, bootmenu->delay, 1, bootmenu_print_entry,
-  bootmenu_choice_entry, bootmenu);
+   menu = menu_create(NULL, bootmenu->delay, 1, menu_display_statusline,
+  bootmenu_print_entry, bootmenu_choice_entry,
+  bootmenu);
if (!menu) {
bootmenu_destroy(bootmenu);
return;
@@ -445,34 +474,6 @@ cleanup:
 #endif
 }
 
-void menu_display_statusline(struct menu *m)
-{
-   struct bootmenu_entry *entry;
-   struct bootmenu_data *menu;
-
-   if (menu_default_choice(m, (void *)) < 0)
-   return;
-
-   menu = entry->menu;
-
-   printf(ANSI_CURSOR_POSITION, 1, 1);
-   puts(ANSI_CLEAR_LINE);
-   printf(ANSI_CURSOR_POSITION, 2, 1);
-   puts("  *** U-Boot Boot Menu ***");
-   puts(ANSI_CLEAR_LINE_TO_END);
-   printf(ANSI_CURSOR_POSITION, 3, 1);
-   puts(ANSI_CLEAR_LINE);
-
-   /* First 3 lines are bootmenu header + 2 empty lines between entries */
-   printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
-   puts(ANSI_CLEAR_LINE);
-   printf(ANSI_CURSOR_POSITION, menu->count + 6, 1);
-   puts("  Press UP/DOWN to move, ENTER to select");
-   puts(ANSI_CLEAR_LINE_TO_END);
-   printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
-   puts(ANSI_CLEAR_LINE);
-}
-
 #ifdef CONFIG_AUTOBOOT_MENU_SHOW
 int menu_show(int bootdelay)
 {
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 53af04d7dc..c244bfb10d 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -1237,7 +1237,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
 * Create a menu and add items for all the labels.
 */
m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
-   cfg->prompt, label_print, NULL, NULL);
+   cfg->prompt, NULL, label_print, NULL, NULL);
 
if (!m)
return NULL;
diff --git a/common/menu.c b/common/menu.c
index 7b66d199a9..5fb2ffbd06 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -36,6 +36,7 @@ struct menu {
int timeout;
char *title;
int prompt;
+   void (*display_statusline)(struct menu *);
void (*item_data_print)(void *);
char *(*item_choice)(void *);
void *item_choice_data;
@@ -106,10 +107,6 @@ static inline void *menu_item_destroy(struct menu *m,
return NULL;
 }
 
-__weak void menu_display_statusline(struct menu *m)
-{
-}
-
 /*
  * Display a menu so the user can make a choice of an item. First display its
  * title, if any, and then each item in the menu.
@@ -120,7 +117,8 @@ static inline void menu_display(struct menu *m)
puts(m->title);
putc('\n');
}
-   menu_display_statusline(m);
+   if (m->display_statusline)
+  

  1   2   3   >