RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job ring driver model

2021-11-22 Thread Gaurav Jain
Hello Andrey

> -Original Message-
> From: ZHIZHIKIN Andrey 
> Sent: Monday, November 22, 2021 10:51 PM
> To: Gaurav Jain ; u-boot@lists.denx.de
> Cc: Stefano Babic ; Fabio Estevam ;
> Peng Fan ; Simon Glass ; Priyanka
> Jain ; Ye Li ; Horia Geanta
> ; Ji Luo ; Franck Lenormand
> ; Silvano Di Ninno ;
> Sahil Malhotra ; Pankaj Gupta
> ; Varun Sethi ; dl-uboot-imx
> ; Shengzhou Liu ; Mingkai Hu
> ; Rajesh Bhagat ; Meenakshi
> Aggarwal ; Wasim Khan
> ; Alison Wang ; Pramod
> Kumar ; Andy Tang ;
> Adrian Alonso ; Vladimir Oltean
> ; Michael Walle 
> Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job
> ring driver model
> 
> Caution: EXT Email
> 
> Hello Gaurav,
> 
> > -Original Message-
> > From: Gaurav Jain 
> > Sent: Monday, November 22, 2021 8:29 AM
> > To: ZHIZHIKIN Andrey ; u-
> > b...@lists.denx.de
> > Cc: Stefano Babic ; Fabio Estevam
> > ; Peng Fan ; Simon Glass
> > ; Priyanka Jain ; Ye Li
> > ; Horia Geanta ; Ji Luo
> > ; Franck Lenormand ; Silvano
> > Di Ninno ; Sahil Malhotra
> > ; Pankaj Gupta ; Varun
> > Sethi ; dl-uboot-imx ; Shengzhou
> > Liu ; Mingkai Hu ; Rajesh
> > Bhagat ; Meenakshi Aggarwal
> > ; Wasim Khan ;
> Alison
> > Wang ; Pramod Kumar
> ;
> > Andy Tang ; Adrian Alonso ;
> > Vladimir Oltean 
> > Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for
> > CAAM Job ring driver model
> >
> >
> > Hello Andrey
> >
> > > -Original Message-
> > > From: ZHIZHIKIN Andrey 
> > > Sent: Wednesday, November 17, 2021 6:33 PM
> > > To: Gaurav Jain ; u-boot@lists.denx.de
> > > Cc: Stefano Babic ; Fabio Estevam
> > > ; Peng Fan ; Simon Glass
> > > ; Priyanka Jain ; Ye Li
> > > ; Horia Geanta ; Ji Luo
> > > ; Franck Lenormand ;
> > > Silvano Di Ninno ; Sahil Malhotra
> > > ; Pankaj Gupta ; Varun
> > > Sethi ; dl-uboot-imx ; Shengzhou
> > > Liu ; Mingkai Hu ; Rajesh
> > > Bhagat ; Meenakshi Aggarwal
> > > ; Wasim Khan ;
> > > Alison Wang ; Pramod Kumar
> > > ; Andy Tang ; Adrian
> > > Alonso ; Vladimir Oltean 
> > > Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for
> > > CAAM Job ring driver model
> > >
> > > Caution: EXT Email
> > >
> > > Hello Gaurav,
> > >
> > > > -Original Message-
> > > > From: Gaurav Jain 
> > > > Sent: Wednesday, November 17, 2021 12:26 PM
> > > > To: ZHIZHIKIN Andrey ; u-
> > > > b...@lists.denx.de
> > > > Cc: Stefano Babic ; Fabio Estevam
> > > > ; Peng Fan ; Simon Glass
> > > > ; Priyanka Jain ; Ye Li
> > > > ; Horia Geanta ; Ji Luo
> > > > ; Franck Lenormand ;
> > > Silvano
> > > > Di Ninno ; Sahil Malhotra
> > > > ; Pankaj Gupta ;
> > > Varun
> > > > Sethi ; dl-uboot-imx ;
> > > Shengzhou
> > > > Liu ; Mingkai Hu ;
> > > Rajesh
> > > > Bhagat ; Meenakshi Aggarwal
> > > > ; Wasim Khan ;
> > > Alison
> > > > Wang ; Pramod Kumar
> > > ;
> > > > Andy Tang ; Adrian Alonso
> > > ;
> > > > Vladimir Oltean 
> > > > Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support
> > > > for CAAM Job ring driver model
> > > >
> > > >
> > > > Hello Andrey
> > > >
> > > > > -Original Message-
> > > > > From: ZHIZHIKIN Andrey 
> > > > > Sent: Tuesday, November 16, 2021 9:24 PM
> > > > > To: Gaurav Jain ; u-boot@lists.denx.de
> > > > > Cc: Stefano Babic ; Fabio Estevam
> > > > > ; Peng Fan ; Simon Glass
> > > > > ; Priyanka Jain ; Ye Li
> > > > > ; Horia Geanta ; Ji Luo
> > > > > ; Franck Lenormand ;
> > > > > Silvano Di Ninno ; Sahil Malhotra
> > > > > ; Pankaj Gupta ;
> > > Varun
> > > > > Sethi ; dl-uboot-imx ;
> > > Shengzhou
> > > > > Liu ; Mingkai Hu ;
> > > Rajesh
> > > > > Bhagat ; Meenakshi Aggarwal
> > > > > ; Wasim Khan ;
> > > > > Alison Wang ; Pramod Kumar
> > > > > ; Andy Tang ;
> > > Adrian
> > > > > Alonso ; Vladimir Oltean
> > > > > 
> > > > > Subject: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for
> > > > > CAAM Job ring driver model
> > > > >
> > > > > Caution: EXT Email
> > > > >
> > > > > Hello Gaurav,
> > > > >
> > > > > > -Original Message-
> > > > > > From: U-Boot  On Behalf Of
> > > > > > Gaurav Jain
> > > > > > Sent: Monday, November 15, 2021 8:00 AM
> > > > > > To: u-boot@lists.denx.de
> > > > > > Cc: Stefano Babic ; Fabio Estevam
> > > > > > ; Peng Fan ; Simon Glass
> > > > > > ; Priyanka Jain ; Ye
> > > > > > Li ; Horia Geanta ; Ji
> > > > > > Luo ; Franck Lenormand
> > > > > > ; Silvano Di Ninno
> > > > > > ; Sahil malhotra
> > > > > > ; Pankaj Gupta ;
> > > > > > Varun Sethi ; NXP i . MX U-Boot Team
> > > > > > ; Shengzhou Liu ;
> > > > > > Mingkai Hu ; Rajesh Bhagat
> > > > > > ;
> > > > > Meenakshi
> > > > > > Aggarwal ; Wasim Khan
> > > > > > ; Alison Wang ;
> > > Pramod
> > > > > Kumar
> > > > > > ; Tang Yuantian ;
> > > > > > Adrian Alonso ; Vladimir Oltean
> > > > > > ; Gaurav Jain 
> > > > > > Subject: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job
> > > > > > ring driver model
> > > > > >
> > > > > >
> > > > > > added device tree support for job ring driver.
> > > > > > sec is initialized based on job ring information processed
> > >

[PATCH] board: ls1043ardb: force PCI device enumeration

2021-11-22 Thread Martin Schiller
Commit eb1986804d1d ("configs: enable DM_ETH support for LS1043ARDB")
resulted in the PCI bus no longer being implicitly enumerated.

However, this is necessary for the fdt pcie fixups to work.

Therefore, similar to commit 8b6558bd4187 ("board: ls1088ardb:
transition to DM_ETH"), pci_init() is now called in the board_init()
routine when CONFIG_DM_ETH is active.

Signed-off-by: Martin Schiller 
CC: Priyanka Jain 
CC: Camelia Groza 
---
 board/freescale/ls1043ardb/ls1043ardb.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/board/freescale/ls1043ardb/ls1043ardb.c 
b/board/freescale/ls1043ardb/ls1043ardb.c
index beef26b084..1764c9336c 100644
--- a/board/freescale/ls1043ardb/ls1043ardb.c
+++ b/board/freescale/ls1043ardb/ls1043ardb.c
@@ -219,6 +219,10 @@ int board_init(void)
ppa_init();
 #endif
 
+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
+   pci_init();
+#endif
+
 #ifdef CONFIG_U_QE
u_qe_init();
 #endif
-- 
2.20.1



Re: [PATCH] board: ls1046ardb: force PCI device enumeration

2021-11-22 Thread Martin Schiller

On 2021-11-22 17:30, Camelia Alexandra Groza (OSS) wrote:

-Original Message-
From: U-Boot  On Behalf Of Martin 
Schiller

Sent: Wednesday, November 17, 2021 13:59
To: u-boot@lists.denx.de
Cc: Martin Schiller ; Priyanka Jain 


Subject: [PATCH] board: ls1046ardb: force PCI device enumeration

Commit 045ecf899252 ("configs: enable DM_ETH support for LS1046ARDB")
resulted in the PCI bus no longer being implicitly enumerated.

However, this is necessary for the fdt pcie fixups to work.

Therefore, similar to commit 8b6558bd4187 ("board: ls1088ardb:
transition to DM_ETH"), pci_init() is now called in the board_init()
routine when CONFIG_DM_ETH is active.

Signed-off-by: Martin Schiller 
CC: Priyanka Jain 
---
 board/freescale/ls1046ardb/ls1046ardb.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/board/freescale/ls1046ardb/ls1046ardb.c
b/board/freescale/ls1046ardb/ls1046ardb.c
index 93ef903f29..d0abfe8869 100644
--- a/board/freescale/ls1046ardb/ls1046ardb.c
+++ b/board/freescale/ls1046ardb/ls1046ardb.c
@@ -93,6 +93,10 @@ int board_init(void)
ppa_init();
 #endif

+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
+   pci_init();
+#endif
+
/* invert AQR105 IRQ pins polarity */
out_be32(&scfg->intpcr, AQR105_IRQ_MASK);



Hi

Thank you for the patch. A very similar fix is needed for the 
ls1043ardb board.

Are you interested to send a patch for that as well?



Hi

Yes, I can do that. But I can't test it due to lack of hardware.


Acked-by: Camelia Groza 


Re: Please pull u-boot-net/next

2021-11-22 Thread Tom Rini
On Tue, Nov 23, 2021 at 05:25:27AM +0200, Ramon Fried wrote:

> this PR includes the following net changes for next:
> 
> - Various DSA additions
> - bootp: fix for VCI string
> - tsec: support for promiscuous mode
> - add Aspeed MDIO driver
> The following changes since commit 2ad8d0cb950da2233a2ec030533f4e54c6d04126:
> 
>   Merge branch 'efi-2022-01' of
> https://source.denx.de/u-boot/custodians/u-boot-efi (2021-11-20
> 09:36:37 -0500)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-net.git/
> 
> for you to fetch changes up to 8fc7def2838f40298ba2d86447dc8974de94a243:
> 
>   net: phy: realtek: Add tx/rx delay config for 8211e (2021-11-21
> 21:32:32 +0200)

Since this is for next please make it based on -next and not master,
thanks!

-- 
Tom


signature.asc
Description: PGP signature


Please pull u-boot-net/next

2021-11-22 Thread Ramon Fried
this PR includes the following net changes for next:

- Various DSA additions
- bootp: fix for VCI string
- tsec: support for promiscuous mode
- add Aspeed MDIO driver
The following changes since commit 2ad8d0cb950da2233a2ec030533f4e54c6d04126:

  Merge branch 'efi-2022-01' of
https://source.denx.de/u-boot/custodians/u-boot-efi (2021-11-20
09:36:37 -0500)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-net.git/

for you to fetch changes up to 8fc7def2838f40298ba2d86447dc8974de94a243:

  net: phy: realtek: Add tx/rx delay config for 8211e (2021-11-21
21:32:32 +0200)


Bin Meng (3):
  net: dsa: Use true instead of 1 in the set_promisc() call
  net: fec_mxc: Declare 'promisc' as bool
  net: tsec: Make redundant_init() static

Dylan Hung (1):
  drivers: net: add Aspeed MDIO driver

Peter Hoyes (1):
  cmd: pxe_utils: Check fdtcontroladdr in label_boot

Samuel Holland (1):
  net: phy: realtek: Add tx/rx delay config for 8211e

Vladimir Oltean (11):
  net: phy: mscc: add support for VSC8502 in dual RGMII mode
  net: tsec: add support for promiscuous mode
  include: import if_vlan.h from Linux
  net: dsa: allow drivers to get the port OF node
  net: introduce a helper to determine whether to use in-band autoneg
  net: dsa: felix: configure the in-band autoneg property based on
OF node info
  net: dsa: add driver for NXP SJA1105 L2 switch
  net: dsa: sja1105: add support for SGMII
  arm: dts: ls1021a-tsn: add sja1105 and eth2 bindings
  configs: ls1021a-tsn: enable sja1105 switch driver
  configs: ls1021a-tsn: enable the generation of random Ethernet
MAC addresses

Walter Stoll (1):
  net: bootp: Correct VCI string transmission

 arch/arm/dts/ls1021a-tsn.dts|  103 +
 boot/pxe_utils.c|8 +-
 configs/ls1021atsn_qspi_defconfig   |3 +
 configs/ls1021atsn_sdcard_defconfig |3 +
 configs/pine64_plus_defconfig   |1 -
 drivers/core/of_extra.c |   12 +
 drivers/net/Kconfig |   23 +
 drivers/net/Makefile|2 +
 drivers/net/aspeed_mdio.c   |  128 ++
 drivers/net/fec_mxc.h   |2 +-
 drivers/net/mscc_eswitch/felix_switch.c |   10 +-
 drivers/net/phy/Kconfig |   10 -
 drivers/net/phy/mscc.c  |   56 +
 drivers/net/phy/realtek.c   |   69 +-
 drivers/net/sja1105.c   | 3376 +++
 drivers/net/tsec.c  |   22 +-
 include/dm/of_extra.h   |   14 +
 include/linux/if_vlan.h |   26 +
 include/net/dsa.h   |   12 +
 include/tsec.h  |2 +
 net/bootp.c |2 +-
 net/dsa-uclass.c|   22 +-
 22 files changed, 3854 insertions(+), 52 deletions(-)
 create mode 100644 drivers/net/aspeed_mdio.c
 create mode 100644 drivers/net/sja1105.c
 create mode 100644 include/linux/if_vlan.h

Thanks,
Ramon


Re: Please pull u-boot-net/next

2021-11-22 Thread Ramon Fried
On Wed, Nov 17, 2021 at 4:09 PM Tom Rini  wrote:
>
> On Tue, Nov 16, 2021 at 08:08:36AM +0200, Ramon Fried wrote:
> > On Mon, Nov 15, 2021 at 7:37 PM Tom Rini  wrote:
> > >
> > > On Wed, Nov 10, 2021 at 07:58:42PM +0200, Ramon Fried wrote:
> > >
> > > > his PR includes the following net changes for next:
> > > >
> > > > - Various DSA additions
> > > > - bootp: fix for VCI string
> > > > - tsec: support for promiscuous mode
> > > > - macb: Fix for random MAC address not saved to the environment.
> > > > The following changes since commit 
> > > > e8e9c6f48400989c5fc54467576f8d535bd713e6:
> > > >
> > > >  Merge https://source.denx.de/u-boot/custodians/u-boot-samsung
> > > > (2021-11-09 15:05:33 -0500)
> > > >
> > > > are available in the Git repository at:
> > > >
> > > >  https://source.denx.de/u-boot/custodians/u-boot-net.git/
> > > >
> > > > for you to fetch changes up to 23a438b2d05db54c95315094fe9ac8fe0c46213e:
> > > >
> > > >  net: uclass: Save ethernet MAC address when generated (2021-11-10
> > > > 19:55:01 +0200)
> > >
> > > As it seems we're still actively discussing the implications of:
> > >
> > > > Michal Simek (1):
> > > >  net: uclass: Save ethernet MAC address when generated
> > >
> > > Can you please re-spin with that dropped?  Thanks!
> >
> > I sure can, but I'm against that. the patch should stay IMO.
> > I saw the thread, it actually started in IRC, where I already gave my 
> > opinion.
>
> I'm cycling back to this again because setting aside that I'm not
> convinced yet this is the right path, it's also an incomplete patch
> because the help text for NET_RANDOM_ETHADDR specifically says the
> environment is not updated, which is no longer true after that patch and
> needs to be corrected.
>
> --
> Tom
Sending a new one in a new thread.


RE: [PATCH V2] clk: introduce u-boot,ignore-clk-defaults

2021-11-22 Thread Peng Fan (OSS)
> Subject: Re: [PATCH V2] clk: introduce u-boot,ignore-clk-defaults
> 
> On Mon, Nov 22, 2021 at 11:33:27AM +0800, Peng Fan (OSS) wrote:
> > + Rob
> >
> > On 2021/11/20 20:57, Tom Rini wrote:
> > > On Sat, Nov 20, 2021 at 12:10:54PM +, Peng Fan (OSS) wrote:
> > > > > Subject: [PATCH V2] clk: introduce u-boot,ignore-clk-defaults
> > > > >
> > > > > From: Peng Fan 
> > > > >
> > > > > Current code has a force clk_set_defaults in multiple stages,
> > > > > U-Boot reuse the same device tree and Linux Kernel device tree,
> > > > > but we not register all the clks as Linux Kernel, so
> > > > > clk_set_defaults will fail and cause the clk provider registeration 
> > > > > fail.
> > > > >
> > > > > So introduce a new property to ignore the default settings which
> > > > > could be used by any node that wanna ignore default settings.
> > > > >
> > > > > Reviewed-by: Simon Glass 
> > > > > Signed-off-by: Peng Fan 
> > > > > ---
> > > > >
> > > > > V2:
> > > > >   Add R-b tag
> > > > >   Tom, Simon
> > > > > After a thought, I think still put it as a u-boot thing.
> assigned-clock-x is
> > > > > actually Linux specific, however I could not add the new property
> to Linux,
> > > > > because we are supporting SystemReady-IR, we need the
> > > > > assigned-clock-x property
> > > > > in linux working and ignore it in U-Boot.
> > > >
> > > > Any more thoughts?
> > >
> > > Just my continued request that you treat this as generic and submit
> > > the binding upstream so it can be in the device tree for the platform.
> > >
> >
> > As Sean said, this is to serve cast that linux and U-Boot use the same
> > device tree, I mean U-Boot runtime export device tree to linux for
> > SR-IR (system-ready IR) booting.
> >
> > Linux needs assigned-clocks to some reason, but U-Boot not need that
> > because the driver not added the support or not a must to have that.
> >
> > Because assigned-clocks failure in U-Boot will cause probe fail now,
> > the device driver will report failure.
> >
> > You mean rename this to "ignore-clk-defaults" or keep
> > "u-boot,ignore-clk-defauls" or "firmware,ignore-clk-defaults" to linux
> > device tree binding?
> >
> > I could try to send to linux kernel with "firmware" as a prefix.
> 
> What I mean is that first I'm not seeing the description of the property as
> being clear enough, either in commit message or the binding itself.
> That's why in my mind I keep seeing this as "we set the properties
> linux,assigned-clocks and u-boot,ignore-clk-defaults" and I don't know why
> we need both.  Is there not something we can do based on seeing
> linux,assigned-clocks ?  Showing something that makes use of the property
> you're wishing to add would be helpful.  In fact, some specific dts snippets
> would be helpful to understand what's going on here.

clk: clock-controller@3038 {
compatible = "fsl,imx8mp-ccm";
reg = <0x3038 0x1>;
#clock-cells = <1>;
clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, <&clk_ext2>,
 <&clk_ext3>, <&clk_ext4>;
clock-names = "osc_32k", "osc_24m", "clk_ext1", "clk_ext2",
  "clk_ext3", "clk_ext4";
assigned-clocks = <&clk IMX8MP_CLK_A53_SRC>,
  <&clk IMX8MP_CLK_A53_CORE>,
  <&clk IMX8MP_CLK_NOC>,
  <&clk IMX8MP_CLK_NOC_IO>,
  <&clk IMX8MP_CLK_GIC>,
  <&clk IMX8MP_CLK_AUDIO_AHB>,
  <&clk IMX8MP_CLK_AUDIO_AXI_SRC>,
  <&clk IMX8MP_CLK_IPG_AUDIO_ROOT>,
  <&clk IMX8MP_AUDIO_PLL1>,
  <&clk IMX8MP_AUDIO_PLL2>;
assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
 <&clk IMX8MP_ARM_PLL_OUT>,
 <&clk IMX8MP_SYS_PLL2_1000M>,
 <&clk IMX8MP_SYS_PLL1_800M>,
 <&clk IMX8MP_SYS_PLL2_500M>,
 <&clk IMX8MP_SYS_PLL1_800M>,
 <&clk IMX8MP_SYS_PLL1_800M>;
assigned-clock-rates = <0>, <0>,
   <10>,
   <8>,
   <5>,
   <4>,
   <8>,
   <4>,
   <393216000>,
   <361267200>;
u-boot,ignore-clk-defaults;
};

The above node is that I wanna have in U-Boot device tree.
This node is same as the one used in linux device tree except the new
property introduced here.

In i.MX U-Boot, we not support the clks here in the clk driver, but linux needs 
the assigned-clocks property, so I could not delete it
because U-Boot runtime export the device tree to Linux.

So add a new property here for U-Boot specific usage, if the property
is

RE: [PATCH 21/23] video: Support virtio devices with the splash screen

2021-11-22 Thread Peng Fan (OSS)
> Subject: Re: [PATCH 21/23] video: Support virtio devices with the splash
> screen
> 
> On 11/20/21 5:24 AM, Simon Glass wrote:
> > This is useful for showing a logo when booting from qemu.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >  common/splash_source.c | 14 ++
> >  include/splash.h   |  1 +
> >  include/virtio.h   |  1 +
> >  3 files changed, 16 insertions(+)
> >
> > diff --git a/common/splash_source.c b/common/splash_source.c index
> > d05670f5ee8..2c03cbdf928 100644
> > --- a/common/splash_source.c
> > +++ b/common/splash_source.c
> > @@ -20,6 +20,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> > @@ -179,6 +180,16 @@ static inline int splash_init_sata(void)  }
> > #endif
> >
> > +static int splash_init_virtio(void)
> > +{
> > +   if (!IS_ENABLED(CONFIG_VIRTIO)) {
> > +   printf("Cannot load splash image: no virtio support\n");
> > +   return -ENOSYS;
> > +   } else {
> > +   return virtio_init();
> > +   }
> 
> Doesn't need to add "else" ?

Checkpatch would report warning remove else per my understanding.

-Peng

> 
> Best Regards,
> Jaehoon Chung
> 
> > +}
> > +
> >  #ifdef CONFIG_CMD_UBIFS
> >  static int splash_mount_ubifs(struct splash_location *location)  { @@
> > -233,6 +244,9 @@ static int splash_load_fs(struct splash_location *location,
> u32 bmp_load_addr)
> > if (location->storage == SPLASH_STORAGE_SATA)
> > res = splash_init_sata();
> >
> > +   if (location->storage == SPLASH_STORAGE_VIRTIO)
> > +   res = splash_init_virtio();
> > +
> > if (location->ubivol != NULL)
> > res = splash_mount_ubifs(location);
> >
> > diff --git a/include/splash.h b/include/splash.h index
> > 7fd2de8fea1..33e45e69416 100644
> > --- a/include/splash.h
> > +++ b/include/splash.h
> > @@ -30,6 +30,7 @@ enum splash_storage {
> > SPLASH_STORAGE_MMC,
> > SPLASH_STORAGE_USB,
> > SPLASH_STORAGE_SATA,
> > +   SPLASH_STORAGE_VIRTIO,
> >  };
> >
> >  enum splash_flags {
> > diff --git a/include/virtio.h b/include/virtio.h index
> > a42bdad6b87..34e2bfdcdd3 100644
> > --- a/include/virtio.h
> > +++ b/include/virtio.h
> > @@ -20,6 +20,7 @@
> >  #ifndef __VIRTIO_H__
> >  #define __VIRTIO_H__
> >
> > +#include 
> >  #include 
> >  #include 
> >  #define VIRTIO_ID_NET  1 /* virtio net */
> >



Re: [PATCH 21/23] video: Support virtio devices with the splash screen

2021-11-22 Thread Jaehoon Chung
On 11/20/21 5:24 AM, Simon Glass wrote:
> This is useful for showing a logo when booting from qemu.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  common/splash_source.c | 14 ++
>  include/splash.h   |  1 +
>  include/virtio.h   |  1 +
>  3 files changed, 16 insertions(+)
> 
> diff --git a/common/splash_source.c b/common/splash_source.c
> index d05670f5ee8..2c03cbdf928 100644
> --- a/common/splash_source.c
> +++ b/common/splash_source.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -179,6 +180,16 @@ static inline int splash_init_sata(void)
>  }
>  #endif
>  
> +static int splash_init_virtio(void)
> +{
> + if (!IS_ENABLED(CONFIG_VIRTIO)) {
> + printf("Cannot load splash image: no virtio support\n");
> + return -ENOSYS;
> + } else {
> + return virtio_init();
> + }

Doesn't need to add "else" ?

Best Regards,
Jaehoon Chung

> +}
> +
>  #ifdef CONFIG_CMD_UBIFS
>  static int splash_mount_ubifs(struct splash_location *location)
>  {
> @@ -233,6 +244,9 @@ static int splash_load_fs(struct splash_location 
> *location, u32 bmp_load_addr)
>   if (location->storage == SPLASH_STORAGE_SATA)
>   res = splash_init_sata();
>  
> + if (location->storage == SPLASH_STORAGE_VIRTIO)
> + res = splash_init_virtio();
> +
>   if (location->ubivol != NULL)
>   res = splash_mount_ubifs(location);
>  
> diff --git a/include/splash.h b/include/splash.h
> index 7fd2de8fea1..33e45e69416 100644
> --- a/include/splash.h
> +++ b/include/splash.h
> @@ -30,6 +30,7 @@ enum splash_storage {
>   SPLASH_STORAGE_MMC,
>   SPLASH_STORAGE_USB,
>   SPLASH_STORAGE_SATA,
> + SPLASH_STORAGE_VIRTIO,
>  };
>  
>  enum splash_flags {
> diff --git a/include/virtio.h b/include/virtio.h
> index a42bdad6b87..34e2bfdcdd3 100644
> --- a/include/virtio.h
> +++ b/include/virtio.h
> @@ -20,6 +20,7 @@
>  #ifndef __VIRTIO_H__
>  #define __VIRTIO_H__
>  
> +#include 
>  #include 
>  #include 
>  #define VIRTIO_ID_NET1 /* virtio net */
> 



Re: [PATCH v2 12/14] mmc: mediatek: add support for MediaTek MT7621 SoC

2021-11-22 Thread Jaehoon Chung
On 11/19/21 10:37 AM, Weijie Gao wrote:
> This patch adds SDXC support for MediaTek MT7621 SoC
> 
> Signed-off-by: Weijie Gao 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> v2 changes: none
> ---
>  drivers/mmc/mtk-sd.c | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
> index 8599f095bc..1199052a89 100644
> --- a/drivers/mmc/mtk-sd.c
> +++ b/drivers/mmc/mtk-sd.c
> @@ -1746,6 +1746,18 @@ static const struct msdc_compatible mt7620_compat = {
>   .default_pad_dly = true,
>  };
>  
> +static const struct msdc_compatible mt7621_compat = {
> + .clk_div_bits = 8,
> + .pad_tune0 = false,
> + .async_fifo = true,
> + .data_tune = true,
> + .busy_check = false,
> + .stop_clk_fix = false,
> + .enhance_rx = false,
> + .builtin_pad_ctrl = true,
> + .default_pad_dly = true,
> +};
> +
>  static const struct msdc_compatible mt7622_compat = {
>   .clk_div_bits = 12,
>   .pad_tune0 = true,
> @@ -1794,6 +1806,7 @@ static const struct msdc_compatible mt8183_compat = {
>  
>  static const struct udevice_id msdc_ids[] = {
>   { .compatible = "mediatek,mt7620-mmc", .data = (ulong)&mt7620_compat },
> + { .compatible = "mediatek,mt7621-mmc", .data = (ulong)&mt7621_compat },
>   { .compatible = "mediatek,mt7622-mmc", .data = (ulong)&mt7622_compat },
>   { .compatible = "mediatek,mt7623-mmc", .data = (ulong)&mt7623_compat },
>   { .compatible = "mediatek,mt8512-mmc", .data = (ulong)&mt8512_compat },
> 



[PATCH 5/5] test: fix pylint error in u_boot_console_exec_attach.py

2021-11-22 Thread Heinrich Schuchardt
* provide module docstring

Signed-off-by: Heinrich Schuchardt 
---
 test/py/u_boot_console_exec_attach.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/py/u_boot_console_exec_attach.py 
b/test/py/u_boot_console_exec_attach.py
index 27834b55cd..8dd8cc1230 100644
--- a/test/py/u_boot_console_exec_attach.py
+++ b/test/py/u_boot_console_exec_attach.py
@@ -2,8 +2,10 @@
 # Copyright (c) 2015 Stephen Warren
 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
 
-# Logic to interact with U-Boot running on real hardware, typically via a
-# physical serial port.
+"""
+Logic to interact with U-Boot running on real hardware, typically via a
+physical serial port.
+"""
 
 import sys
 from u_boot_spawn import Spawn
-- 
2.32.0



[PATCH 3/5] test: fix pylint errors in u_boot_utils.py

2021-11-22 Thread Heinrich Schuchardt
* there is no os.path.unlink() method
* don't inherit from object
* add module docstring
* move imports to the top
* avoid unused variable

Signed-off-by: Heinrich Schuchardt 
---
 test/py/u_boot_utils.py | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py
index e816c7fbb6..089eda5434 100644
--- a/test/py/u_boot_utils.py
+++ b/test/py/u_boot_utils.py
@@ -1,17 +1,20 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
 
-# Utility code shared across multiple tests.
+"""
+Utility code shared across multiple tests.
+"""
 
 import hashlib
 import inspect
 import os
 import os.path
-import pytest
+import pathlib
 import signal
 import sys
 import time
 import re
+import pytest
 
 def md5sum_data(data):
 """Calculate the MD5 hash of some data.
@@ -48,7 +51,7 @@ def md5sum_file(fn, max_length=None):
 data = fh.read(*params)
 return md5sum_data(data)
 
-class PersistentRandomFile(object):
+class PersistentRandomFile:
 """Generate and store information about a persistent file containing
 random data."""
 
@@ -144,7 +147,7 @@ def wait_until_file_open_fails(fn, ignore_errors):
 Nothing.
 """
 
-for i in range(100):
+for _ in range(100):
 fh = attempt_to_open_file(fn)
 if not fh:
 return
@@ -192,9 +195,9 @@ def run_and_log_expect_exception(u_boot_console, cmd, 
retcode, msg):
 try:
 runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)
 runner.run(cmd)
-except Exception as e:
-assert(retcode == runner.exit_status)
-assert(msg in runner.output)
+except Exception:
+assert retcode == runner.exit_status
+assert msg in runner.output
 else:
 raise Exception("Expected an exception with retcode %d message '%s',"
 "but it was not raised" % (retcode, msg))
@@ -279,17 +282,17 @@ class PersistentFileHelperCtxMgr(object):
 if filename_timestamp < self.module_timestamp:
 self.log.action('Removing stale generated file ' +
 self.filename)
-os.unlink(self.filename)
+pathlib.Path(self.filename).unlink()
 
 def __exit__(self, extype, value, traceback):
 if extype:
 try:
-os.path.unlink(self.filename)
-except:
+pathlib.Path(self.filename).unlink()
+except Exception:
 pass
 return
 logged = False
-for i in range(20):
+for _ in range(20):
 filename_timestamp = os.path.getmtime(self.filename)
 if filename_timestamp > self.module_timestamp:
 break
-- 
2.32.0



[PATCH 0/5] test: fix pylint warnings

2021-11-22 Thread Heinrich Schuchardt
Fix pylint warning like:

* missing docstring
* incorrect indentation
* don't inherit from object
* unused variable

Heinrich Schuchardt (5):
  test: fix pylint errors in multiplexed_log.py
  test: fix pylint errors in u_boot_spawn.py
  test: fix pylint errors in u_boot_utils.py
  test: fix pylint error in u_boot_console_sandbox.py
  test: fix pylint error in u_boot_console_exec_attach.py

 test/py/multiplexed_log.py| 14 --
 test/py/u_boot_console_exec_attach.py |  6 --
 test/py/u_boot_console_sandbox.py |  4 +++-
 test/py/u_boot_spawn.py   | 26 +-
 test/py/u_boot_utils.py   | 25 ++---
 5 files changed, 42 insertions(+), 33 deletions(-)

-- 
2.32.0



[PATCH 1/5] test: fix pylint errors in multiplexed_log.py

2021-11-22 Thread Heinrich Schuchardt
* don't inherit from object
* remove superfluous comprehension
* add module docstring

Signed-off-by: Heinrich Schuchardt 
---
 test/py/multiplexed_log.py | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
index 545a774302..442edada12 100644
--- a/test/py/multiplexed_log.py
+++ b/test/py/multiplexed_log.py
@@ -2,8 +2,10 @@
 # Copyright (c) 2015 Stephen Warren
 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
 
-# Generate an HTML-formatted log file containing multiple streams of data,
-# each represented in a well-delineated/-structured fashion.
+"""
+Generate an HTML-formatted log file containing multiple streams of data,
+each represented in a well-delineated/-structured fashion.
+"""
 
 import datetime
 import html
@@ -178,7 +180,7 @@ class RunAndLog(object):
 raise exception
 return output
 
-class SectionCtxMgr(object):
+class SectionCtxMgr:
 """A context manager for Python's "with" statement, which allows a certain
 portion of test code to be logged to a separate section of the log file.
 Objects of this type should be created by factory functions in the Logfile
@@ -206,7 +208,7 @@ class SectionCtxMgr(object):
 def __exit__(self, extype, value, traceback):
 self.log.end_section(self.marker)
 
-class Logfile(object):
+class Logfile:
 """Generates an HTML-formatted log file containing multiple streams of
 data, each represented in a well-delineated/-structured fashion."""
 
@@ -320,8 +322,8 @@ $(document).ready(function () {
 # The set of characters that should be represented as hexadecimal codes in
 # the log file.
 _nonprint = {ord('%')}
-_nonprint.update({c for c in range(0, 32) if c not in (9, 10)})
-_nonprint.update({c for c in range(127, 256)})
+_nonprint.update(c for c in range(0, 32) if c not in (9, 10))
+_nonprint.update(range(127, 256))
 
 def _escape(self, data):
 """Render data format suitable for inclusion in an HTML document.
-- 
2.32.0



[PATCH 2/5] test: fix pylint errors in u_boot_spawn.py

2021-11-22 Thread Heinrich Schuchardt
* don't inherit from object
* imports should be on the top level
* avoid unused variable names
* avoid unnecessary else after raise

Signed-off-by: Heinrich Schuchardt 
---
 test/py/u_boot_spawn.py | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index e34cb217e8..7c48d96210 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
 
-# Logic to spawn a sub-process and interact with its stdio.
+"""
+Logic to spawn a sub-process and interact with its stdio.
+"""
 
 import os
 import re
@@ -9,12 +11,12 @@ import pty
 import signal
 import select
 import time
+import traceback
 
 class Timeout(Exception):
 """An exception sub-class that indicates that a timeout occurred."""
-pass
 
-class Spawn(object):
+class Spawn:
 """Represents the stdio of a freshly created sub-process. Commands may be
 sent to the process, and responses waited for.
 
@@ -58,14 +60,14 @@ class Spawn(object):
 os.execvp(args[0], args)
 except:
 print('CHILD EXECEPTION:')
-import traceback
 traceback.print_exc()
 finally:
 os._exit(255)
 
 try:
 self.poll = select.poll()
-self.poll.register(self.fd, select.POLLIN | select.POLLPRI | 
select.POLLERR | select.POLLHUP | select.POLLNVAL)
+self.poll.register(self.fd, select.POLLIN | select.POLLPRI | 
select.POLLERR |
+   select.POLLHUP | select.POLLNVAL)
 except:
 self.close()
 raise
@@ -106,7 +108,7 @@ class Spawn(object):
 elif os.WIFSIGNALED(status):
 signum = os.WTERMSIG(status)
 self.exit_code = -signum
-self.exit_info = 'signal %d (%s)' % (signum, 
signal.Signals(signum))
+self.exit_info = 'signal %d (%s)' % (signum, 
signal.Signals(signum).name)
 self.waited = True
 return False, self.exit_code, self.exit_info
 
@@ -196,13 +198,11 @@ class Spawn(object):
 # shouldn't and explain why. This is much more friendly 
than
 # just dying with an I/O error
 if err.errno == 5:  # Input/output error
-alive, exit_code, info = self.checkalive()
+alive, _, info = self.checkalive()
 if alive:
-raise
-else:
-raise ValueError('U-Boot exited with %s' % info)
-else:
-raise
+raise err
+raise ValueError('U-Boot exited with %s' % info)
+raise err
 if self.logfile_read:
 self.logfile_read.write(c)
 self.buf += c
@@ -227,7 +227,7 @@ class Spawn(object):
 """
 
 os.close(self.fd)
-for i in range(100):
+for _ in range(100):
 if not self.isalive():
 break
 time.sleep(0.1)
-- 
2.32.0



[PATCH 4/5] test: fix pylint error in u_boot_console_sandbox.py

2021-11-22 Thread Heinrich Schuchardt
* provide module docstring

Signed-off-by: Heinrich Schuchardt 
---
 test/py/u_boot_console_sandbox.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/py/u_boot_console_sandbox.py 
b/test/py/u_boot_console_sandbox.py
index 836f5a9e2b..7e1eb0e0b4 100644
--- a/test/py/u_boot_console_sandbox.py
+++ b/test/py/u_boot_console_sandbox.py
@@ -2,7 +2,9 @@
 # Copyright (c) 2015 Stephen Warren
 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
 
-# Logic to interact with the sandbox port of U-Boot, running as a sub-process.
+"""
+Logic to interact with the sandbox port of U-Boot, running as a sub-process.
+"""
 
 import time
 from u_boot_spawn import Spawn
-- 
2.32.0



Re: [PATCH] phy: zynqmp: Add serdes/psgtr driver

2021-11-22 Thread Sean Anderson




On 11/18/21 7:30 AM, Michal Simek wrote:

Add PSGTR driver for Xilinx ZynqMP.
The most of configurations are taken from Linux kernel psgtr driver.

USB3.0 and SGMII configurations are tested on SOM. In SGMII case also
IOU_SLCR reg is updated to get proper clock setup and signal detection
configuration.


Are USB3 and SGMII all that's been tested? I noticed that the kernel
driver has DP- and SATA-specific stuff which has been left out.
Presumably they are not supported?

Perhaps also note that the termination fix is not implemented.


Signed-off-by: Michal Simek 
---

  MAINTAINERS  |   1 +
  drivers/phy/Kconfig  |   7 +
  drivers/phy/Makefile |   1 +
  drivers/phy/phy-zynqmp.c | 690 +++
  4 files changed, 699 insertions(+)
  create mode 100644 drivers/phy/phy-zynqmp.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1eb71cbdad12..d1e9fbd4a279 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -611,6 +611,7 @@ F:  drivers/mmc/zynq_sdhci.c
  F:drivers/mtd/nand/raw/zynq_nand.c
  F:drivers/net/phy/xilinx_phy.c
  F:drivers/net/zynq_gem.c
+F: drivers/phy/phy-zynqmp.c
  F:drivers/serial/serial_zynq.c
  F:drivers/reset/reset-zynqmp.c
  F:drivers/rtc/zynqmp_rtc.c
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 4767d215f337..d79798429b18 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -281,6 +281,13 @@ config PHY_IMX8MQ_USB
help
  Support the USB3.0 PHY in NXP i.MX8MQ SoC

+config PHY_XILINX_ZYNQMP
+   tristate "Xilinx ZynqMP PHY driver"
+   depends on PHY && ARCH_ZYNQMP
+   help
+ Enable this to support ZynqMP High Speed Gigabit Transceiver
+ that is part of ZynqMP SoC.
+
  source "drivers/phy/rockchip/Kconfig"
  source "drivers/phy/cadence/Kconfig"
  source "drivers/phy/ti/Kconfig"
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 13a8ade8919f..bf9b40932fe3 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -38,5 +38,6 @@ obj-$(CONFIG_MT76X8_USB_PHY) += mt76x8-usb-phy.o
  obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o
  obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
  obj-$(CONFIG_PHY_IMX8MQ_USB) += phy-imx8mq-usb.o
+obj-$(CONFIG_PHY_XILINX_ZYNQMP) += phy-zynqmp.o
  obj-y += cadence/
  obj-y += ti/
diff --git a/drivers/phy/phy-zynqmp.c b/drivers/phy/phy-zynqmp.c
new file mode 100644
index ..d6fe8dcef74e
--- /dev/null
+++ b/drivers/phy/phy-zynqmp.c
@@ -0,0 +1,690 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * phy-zynqmp.c - PHY driver for Xilinx ZynqMP GT.
+ *
+ * Copyright (C) 2018-2021 Xilinx Inc.
+ *
+ * Author: Anurag Kumar Vulisha 
+ * Author: Subbaraya Sundeep 
+ * Author: Laurent Pinchart 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+/*
+ * Lane Registers
+ */
+
+/* TX De-emphasis parameters */
+#define L0_TX_ANA_TM_180x0048
+#define L0_TX_ANA_TM_118   0x01d8
+#define L0_TX_ANA_TM_118_FORCE_17_0BIT(0)
+
+/* DN Resistor calibration code parameters */
+#define L0_TXPMA_ST_3  0x0b0c
+#define L0_DN_CALIB_CODE   0x3f
+
+/* PMA control parameters */
+#define L0_TXPMD_TM_45 0x0cb4
+#define L0_TXPMD_TM_48 0x0cc0
+#define L0_TXPMD_TM_45_OVER_DP_MAINBIT(0)
+#define L0_TXPMD_TM_45_ENABLE_DP_MAIN  BIT(1)
+#define L0_TXPMD_TM_45_OVER_DP_POST1   BIT(2)
+#define L0_TXPMD_TM_45_ENABLE_DP_POST1 BIT(3)
+#define L0_TXPMD_TM_45_OVER_DP_POST2   BIT(4)
+#define L0_TXPMD_TM_45_ENABLE_DP_POST2 BIT(5)
+
+/* PCS control parameters */
+#define L0_TM_DIG_60x106c
+#define L0_TM_DIS_DESCRAMBLE_DECODER   0x0f
+#define L0_TX_DIG_61   0x00f4
+#define L0_TM_DISABLE_SCRAMBLE_ENCODER 0x0f
+
+/* PLL Test Mode register parameters */
+#define L0_TM_PLL_DIG_37   0x2094
+#define L0_TM_COARSE_CODE_LIMIT0x10
+
+/* PLL SSC step size offsets */
+#define L0_PLL_SS_STEPS_0_LSB  0x2368
+#define L0_PLL_SS_STEPS_1_MSB  0x236c
+#define L0_PLL_SS_STEP_SIZE_0_LSB  0x2370
+#define L0_PLL_SS_STEP_SIZE_1  0x2374
+#define L0_PLL_SS_STEP_SIZE_2  0x2378
+#define L0_PLL_SS_STEP_SIZE_3_MSB  0x237c
+#define L0_PLL_STATUS_READ_1   0x23e4
+
+/* SSC step size parameters */
+#define STEP_SIZE_0_MASK   0xff
+#define STEP_SIZE_1_MASK   0xff
+#define STEP_SIZE_2_MASK   0xff
+#define STEP_SIZE_3_MASK   0x3
+#define STEP_SIZE_SHIFT8
+#define FORCE_STEP_SIZE0x10
+#define FORCE_STEPS0x20
+#define STEPS_0_MASK   0xff
+#define STEPS_1_MASK   0x07
+
+/* Reference clock selection parameters */
+#define L0_Ln_REF_CLK_SEL(n)   (0x2860 + (n) * 4)
+#define L0_REF_

RE: [PATCH v5 11/16] crypto/fsl: Fix kick_trng

2021-11-22 Thread ZHIZHIKIN Andrey
Hello Gaurav,

> -Original Message-
> From: U-Boot  On Behalf Of Gaurav Jain
> Sent: Monday, November 15, 2021 8:00 AM
> To: u-boot@lists.denx.de
> Cc: Stefano Babic ; Fabio Estevam ; Peng 
> Fan
> ; Simon Glass ; Priyanka Jain
> ; Ye Li ; Horia Geanta
> ; Ji Luo ; Franck Lenormand
> ; Silvano Di Ninno ; Sahil
> malhotra ; Pankaj Gupta ; Varun
> Sethi ; NXP i . MX U-Boot Team ; Shengzhou
> Liu ; Mingkai Hu ; Rajesh Bhagat
> ; Meenakshi Aggarwal ; 
> Wasim
> Khan ; Alison Wang ; Pramod Kumar
> ; Tang Yuantian ; Adrian Alonso
> ; Vladimir Oltean 
> Subject: [PATCH v5 11/16] crypto/fsl: Fix kick_trng
> 
> 
> From: Ye Li 
> 
> fix hwrng performance issue in kernel.

This patch is missing some context information, specifically which performance
issue does exist in the Kernel (with some quantification), and how is it 
addressed
here.

This function introduced with this patch already exist in the Kernel [1], and 
the
implementation does differ from Kernel one. Specifically, this patch lowers the
number of test samples that are run to decide whether the entropy generated by
TRNG is sufficiently random: it reduces the monobit count range, poker test 
limits,
and number or runs for consecutive 0's and 1's.

Considering the fact that after TRNG is initialized - JDKEK, TDKEK and TDSK are
preloaded from the RNG and are locked until the next PoR, Kernel will not
re-initialize the TRNG (in fact, there is a check that is done in the Kernel 
not to
touch RNG if it is already initialized [2]), and this would leave the Crypto 
facilities
running in the Kernel to use entropy model that is defined here. In this case, 
at
least a justification of this change should be made clear - e.g. significant 
speed
improvement over reduced entropy (with quantifiable numbers).

In addition, with those new parameter set, would the RNG pass FIPS 140-2 test?

> 
> Signed-off-by: Ye Li 
> Acked-by: Gaurav Jain >
> ---
>  drivers/crypto/fsl/jr.c | 109 ++--
>  include/fsl_sec.h   |   1 +
>  2 files changed, 94 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
> index 9b751aca9b..ef136988b6 100644
> --- a/drivers/crypto/fsl/jr.c
> +++ b/drivers/crypto/fsl/jr.c
> @@ -602,30 +602,107 @@ static u8 get_rng_vid(ccsr_sec_t *sec)
>   */
>  static void kick_trng(int ent_delay, ccsr_sec_t *sec)
>  {
> +   u32 samples  = 512; /* number of bits to generate and test */
> +   u32 mono_min = 195;
> +   u32 mono_max = 317;
> +   u32 mono_range  = mono_max - mono_min;
> +   u32 poker_min = 1031;
> +   u32 poker_max = 1600;
> +   u32 poker_range = poker_max - poker_min + 1;
> +   u32 retries= 2;
> +   u32 lrun_max   = 32;
> +   s32 run_1_min   = 27;
> +   s32 run_1_max   = 107;
> +   s32 run_1_range = run_1_max - run_1_min;
> +   s32 run_2_min   = 7;
> +   s32 run_2_max   = 62;
> +   s32 run_2_range = run_2_max - run_2_min;
> +   s32 run_3_min   = 0;
> +   s32 run_3_max   = 39;
> +   s32 run_3_range = run_3_max - run_3_min;
> +   s32 run_4_min   = -1;
> +   s32 run_4_max   = 26;
> +   s32 run_4_range = run_4_max - run_4_min;
> +   s32 run_5_min   = -1;
> +   s32 run_5_max   = 18;
> +   s32 run_5_range = run_5_max - run_5_min;
> +   s32 run_6_min   = -1;
> +   s32 run_6_max   = 17;
> +   s32 run_6_range = run_6_max - run_6_min;
> +   u32 val;

Why does those values are lowered with respect to what is provided by
default? A bit more explanation on why those primes are chosen here
would be good to have, together with documenting default values (so
people can compare).

> +
> struct rng4tst __iomem *rng =
> (struct rng4tst __iomem *)&sec->rng;
> -   u32 val;
> 
> -   /* put RNG4 into program mode */
> -   sec_setbits32(&rng->rtmctl, RTMCTL_PRGM);
> -   /* rtsdctl bits 0-15 contain "Entropy Delay, which defines the
> -* length (in system clocks) of each Entropy sample taken
> -* */
> +   /* Put RNG in program mode */
> +   /* Setting both RTMCTL:PRGM and RTMCTL:TRNG_ACC causes TRNG to
> +* properly invalidate the entropy in the entropy register and
> +* force re-generation.
> +*/
> +   sec_setbits32(&rng->rtmctl, RTMCTL_PRGM | RTMCTL_ACC);
> +
> +   /* Configure the RNG Entropy Delay
> +* Performance-wise, it does not make sense to
> +* set the delay to a value that is lower
> +* than the last one that worked (i.e. the state handles
> +* were instantiated properly. Thus, instead of wasting
> +* time trying to set the values controlling the sample
> +* frequency, the function simply returns.
> +*/
> val = sec_in32(&rng->rtsdctl);
> -   val = (val & ~RTSDCTL_ENT_DLY_MASK) |
> - (ent_delay << RTSDCTL_ENT_DLY_SHIFT);
> +   val &= RTSDCTL_ENT_DLY_MASK;
> +   val >>= RTSDCTL_E

RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job ring driver model

2021-11-22 Thread ZHIZHIKIN Andrey
Hello Gaurav,

> -Original Message-
> From: Gaurav Jain 
> Sent: Monday, November 22, 2021 8:29 AM
> To: ZHIZHIKIN Andrey ; u-
> b...@lists.denx.de
> Cc: Stefano Babic ; Fabio Estevam ; Peng 
> Fan
> ; Simon Glass ; Priyanka Jain
> ; Ye Li ; Horia Geanta
> ; Ji Luo ; Franck Lenormand
> ; Silvano Di Ninno ; Sahil
> Malhotra ; Pankaj Gupta ; Varun
> Sethi ; dl-uboot-imx ; Shengzhou Liu
> ; Mingkai Hu ; Rajesh Bhagat
> ; Meenakshi Aggarwal ; 
> Wasim
> Khan ; Alison Wang ; Pramod Kumar
> ; Andy Tang ; Adrian Alonso
> ; Vladimir Oltean 
> Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job 
> ring
> driver model
> 
> 
> Hello Andrey
> 
> > -Original Message-
> > From: ZHIZHIKIN Andrey 
> > Sent: Wednesday, November 17, 2021 6:33 PM
> > To: Gaurav Jain ; u-boot@lists.denx.de
> > Cc: Stefano Babic ; Fabio Estevam ;
> > Peng Fan ; Simon Glass ; Priyanka
> > Jain ; Ye Li ; Horia Geanta
> > ; Ji Luo ; Franck Lenormand
> > ; Silvano Di Ninno
> > ; Sahil Malhotra ;
> > Pankaj Gupta ; Varun Sethi ;
> > dl-uboot-imx ; Shengzhou Liu
> > ; Mingkai Hu ; Rajesh
> > Bhagat ; Meenakshi Aggarwal
> > ; Wasim Khan ;
> > Alison Wang ; Pramod Kumar
> > ; Andy Tang ; Adrian
> > Alonso ; Vladimir Oltean 
> > Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job
> > ring driver model
> >
> > Caution: EXT Email
> >
> > Hello Gaurav,
> >
> > > -Original Message-
> > > From: Gaurav Jain 
> > > Sent: Wednesday, November 17, 2021 12:26 PM
> > > To: ZHIZHIKIN Andrey ; u-
> > > b...@lists.denx.de
> > > Cc: Stefano Babic ; Fabio Estevam
> > > ; Peng Fan ; Simon Glass
> > > ; Priyanka Jain ; Ye Li
> > > ; Horia Geanta ; Ji Luo
> > > ; Franck Lenormand ;
> > Silvano
> > > Di Ninno ; Sahil Malhotra
> > > ; Pankaj Gupta ;
> > Varun
> > > Sethi ; dl-uboot-imx ;
> > Shengzhou
> > > Liu ; Mingkai Hu ;
> > Rajesh
> > > Bhagat ; Meenakshi Aggarwal
> > > ; Wasim Khan ;
> > Alison
> > > Wang ; Pramod Kumar
> > ;
> > > Andy Tang ; Adrian Alonso
> > ;
> > > Vladimir Oltean 
> > > Subject: RE: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for
> > > CAAM Job ring driver model
> > >
> > >
> > > Hello Andrey
> > >
> > > > -Original Message-
> > > > From: ZHIZHIKIN Andrey 
> > > > Sent: Tuesday, November 16, 2021 9:24 PM
> > > > To: Gaurav Jain ; u-boot@lists.denx.de
> > > > Cc: Stefano Babic ; Fabio Estevam
> > > > ; Peng Fan ; Simon Glass
> > > > ; Priyanka Jain ; Ye Li
> > > > ; Horia Geanta ; Ji Luo
> > > > ; Franck Lenormand ;
> > > > Silvano Di Ninno ; Sahil Malhotra
> > > > ; Pankaj Gupta ;
> > Varun
> > > > Sethi ; dl-uboot-imx ;
> > Shengzhou
> > > > Liu ; Mingkai Hu ;
> > Rajesh
> > > > Bhagat ; Meenakshi Aggarwal
> > > > ; Wasim Khan ;
> > > > Alison Wang ; Pramod Kumar
> > > > ; Andy Tang ;
> > Adrian
> > > > Alonso ; Vladimir Oltean 
> > > > Subject: [EXT] RE: [PATCH v5 01/16] crypto/fsl: Add support for CAAM
> > > > Job ring driver model
> > > >
> > > > Caution: EXT Email
> > > >
> > > > Hello Gaurav,
> > > >
> > > > > -Original Message-
> > > > > From: U-Boot  On Behalf Of Gaurav
> > > > > Jain
> > > > > Sent: Monday, November 15, 2021 8:00 AM
> > > > > To: u-boot@lists.denx.de
> > > > > Cc: Stefano Babic ; Fabio Estevam
> > > > > ; Peng Fan ; Simon Glass
> > > > > ; Priyanka Jain ; Ye Li
> > > > > ; Horia Geanta ; Ji Luo
> > > > > ; Franck Lenormand ;
> > > > > Silvano Di Ninno ; Sahil malhotra
> > > > > ; Pankaj Gupta ;
> > > > > Varun Sethi ; NXP i . MX U-Boot Team
> > > > > ; Shengzhou Liu ;
> > > > > Mingkai Hu ; Rajesh Bhagat
> > > > > ;
> > > > Meenakshi
> > > > > Aggarwal ; Wasim Khan
> > > > > ; Alison Wang ;
> > Pramod
> > > > Kumar
> > > > > ; Tang Yuantian ;
> > > > > Adrian Alonso ; Vladimir Oltean
> > > > > ; Gaurav Jain 
> > > > > Subject: [PATCH v5 01/16] crypto/fsl: Add support for CAAM Job
> > > > > ring driver model
> > > > >
> > > > >
> > > > > added device tree support for job ring driver.
> > > > > sec is initialized based on job ring information processed from
> > > > > device tree.
> > > > >
> > > > > Signed-off-by: Gaurav Jain 
> > > > > Reviewed-by: Ye Li 
> > > > > ---
> > > > >  cmd/Kconfig |   1 +
> > > > >  drivers/crypto/fsl/Kconfig  |   7 +
> > > > >  drivers/crypto/fsl/Makefile |   4 +-
> > > > >  drivers/crypto/fsl/jr.c | 316 
> > > > > +++-
> > > > >  drivers/crypto/fsl/jr.h |  14 ++
> > > > >  5 files changed, 232 insertions(+), 110 deletions(-)
> > > > >
> >
> > [snip]
> >
> > > > > sec_out32(&sec->mcfgr, mcr);
> > > > > +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_IMX8M)
> > > >
> > > > This would effectively reserve the JR0 on _all_ i.MX8M derivatives is S
> > World.
> > > This code is to set any JR DID in SPL so that the job ring can be 
> > > configured.
> > >
> > > >
> > > > Current implementation only has JR0 reserved in S World on imx8mm
> > > > derivative, but this new addition extends this to imx8mn, imx8mp and
> > imx8mq.
> > > Current imp

Re: [PATCH v2 1/2] lib/circbuf: Make circbuf selectable symbol

2021-11-22 Thread Loic Poulain
Hi Wolfgang,

On Mon, 22 Nov 2021 at 13:50, Wolfgang Denk  wrote:
>
> Dear Loic Poulain,
>
> In message <1637584252-15617-1-git-send-email-loic.poul...@linaro.org> you 
> wrote:
> > It is currenly only used from usbtty driver but make it properly
> > selectable via Kconfig symbol, for future usage.
> >
> > Signed-off-by: Loic Poulain 
> > ---
> >  v2: no change
> >
> >  lib/Kconfig  | 3 +++
> >  lib/Makefile | 8 +++-
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/Kconfig b/lib/Kconfig
> > index c535147..1bd54d8 100644
> > --- a/lib/Kconfig
> > +++ b/lib/Kconfig
> > @@ -290,6 +290,9 @@ config TRACE_EARLY_ADDR
> > the size is too small then the message which says the amount of 
> > early
> > data being coped will the the same as the
> >
> > +config CIRCBUF
> > +bool
> > +
> >  source lib/dhry/Kconfig
>
> Please add a description what this symbos is doing.

It's not a user selectable symbol, adding description will break that, right?

Regards,
Loic


RE: [PATCH] board: ls1046ardb: force PCI device enumeration

2021-11-22 Thread Camelia Alexandra Groza (OSS)
> -Original Message-
> From: U-Boot  On Behalf Of Martin Schiller
> Sent: Wednesday, November 17, 2021 13:59
> To: u-boot@lists.denx.de
> Cc: Martin Schiller ; Priyanka Jain 
> Subject: [PATCH] board: ls1046ardb: force PCI device enumeration
> 
> Commit 045ecf899252 ("configs: enable DM_ETH support for LS1046ARDB")
> resulted in the PCI bus no longer being implicitly enumerated.
> 
> However, this is necessary for the fdt pcie fixups to work.
> 
> Therefore, similar to commit 8b6558bd4187 ("board: ls1088ardb:
> transition to DM_ETH"), pci_init() is now called in the board_init()
> routine when CONFIG_DM_ETH is active.
> 
> Signed-off-by: Martin Schiller 
> CC: Priyanka Jain 
> ---
>  board/freescale/ls1046ardb/ls1046ardb.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/board/freescale/ls1046ardb/ls1046ardb.c
> b/board/freescale/ls1046ardb/ls1046ardb.c
> index 93ef903f29..d0abfe8869 100644
> --- a/board/freescale/ls1046ardb/ls1046ardb.c
> +++ b/board/freescale/ls1046ardb/ls1046ardb.c
> @@ -93,6 +93,10 @@ int board_init(void)
>   ppa_init();
>  #endif
> 
> +#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
> + pci_init();
> +#endif
> +
>   /* invert AQR105 IRQ pins polarity */
>   out_be32(&scfg->intpcr, AQR105_IRQ_MASK);
> 

Hi

Thank you for the patch. A very similar fix is needed for the ls1043ardb board.
Are you interested to send a patch for that as well?

Acked-by: Camelia Groza 



Re: [PATCH v2 2/2] usb: gadget: Add CDC ACM function

2021-11-22 Thread Loic Poulain
Hi Pali,

On Mon, 22 Nov 2021 at 16:48, Pali Rohár  wrote:
>
> Hello! I have just few notes, see below.
>
> > diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> > index f560068..d5d891b 100644
> > --- a/drivers/usb/gadget/Makefile
> > +++ b/drivers/usb/gadget/Makefile
> > @@ -30,6 +30,7 @@ obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += 
> > f_mass_storage.o
> >  obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
> >  obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o
> >  obj-$(CONFIG_USB_FUNCTION_ROCKUSB) += f_rockusb.o
> > +obj-$(CONFIG_USB_FUNCTION_ACM)   += f_acm.o
> >  endif
> >  endif
> >  ifdef CONFIG_USB_ETHER
> > diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
> > new file mode 100644
> > index 000..3ea3b4a
> > --- /dev/null
> > +++ b/drivers/usb/gadget/f_acm.c
> ...
> > +static struct usb_cdc_header_desc acm_header_desc = {
> > + .bLength =  sizeof(acm_header_desc),
> > + .bDescriptorType =  USB_DT_CS_INTERFACE,
> > + .bDescriptorSubType =   USB_CDC_HEADER_TYPE,
> > + .bcdCDC =   cpu_to_le16(0x0110),
>
> This is global structure initialization. So should not it use
> __constant_cpu_to_le16() macro instead of cpu_to_le16()? I guess that on
> armel or x86 is cpu_to_le16() just identity macro, but on big endian
> systems it is needed to use constant initialization. Other gadget
> drivers are using those __constant_cpu* macros.

Indeed, going to use it.

>
> > +};
> ...
> > +int drv_usb_acm_stdio_init(void)
> > +{
> > + struct stdio_dev stdio;
> > +
> > + strcpy(stdio.name, "stdio_acm");
>
> Just suggestion: What about "usbacm" or just "acm"?

usbacm sounds good.

>
> > + stdio.flags = DEV_FLAGS_INPUT | DEV_FLAGS_OUTPUT;
> > + stdio.tstc = acm_stdio_tstc;
> > + stdio.getc = acm_stdio_getc;
> > + stdio.putc = acm_stdio_putc;
> > + stdio.puts = acm_stdio_puts;
> > + stdio.start = acm_stdio_start;
> > + stdio.stop = acm_stdio_stop;
> > + stdio.priv = NULL;
> > + stdio.ext = 0;
> > +
> > + return stdio_register(&stdio);
> > +}
> > diff --git a/include/stdio_dev.h b/include/stdio_dev.h
> > index 8fb9a12..d584793 100644
> > --- a/include/stdio_dev.h
> > +++ b/include/stdio_dev.h
> > @@ -103,6 +103,7 @@ int drv_lcd_init(void);
> >  int drv_video_init(void);
> >  int drv_keyboard_init(void);
> >  int drv_usbtty_init(void);
> > +int drv_usb_acm_stdio_init(void);
>
> Other functions do not have stdio in name too. So what about shorting
> it? E.g. just drv_usbacm_init()?

Yes, I've named it _stdio because it's a subpart of the driver. There
is the core cdc_acm function implementation and one client of this
function which is stdio. But I'm fine with shortening that.

Regards,
Loic


Re: [PATCH v2 2/2] usb: gadget: Add CDC ACM function

2021-11-22 Thread Pali Rohár
Hello! I have just few notes, see below.

> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> index f560068..d5d891b 100644
> --- a/drivers/usb/gadget/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -30,6 +30,7 @@ obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
>  obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
>  obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o
>  obj-$(CONFIG_USB_FUNCTION_ROCKUSB) += f_rockusb.o
> +obj-$(CONFIG_USB_FUNCTION_ACM)   += f_acm.o
>  endif
>  endif
>  ifdef CONFIG_USB_ETHER
> diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
> new file mode 100644
> index 000..3ea3b4a
> --- /dev/null
> +++ b/drivers/usb/gadget/f_acm.c
...
> +static struct usb_cdc_header_desc acm_header_desc = {
> + .bLength =  sizeof(acm_header_desc),
> + .bDescriptorType =  USB_DT_CS_INTERFACE,
> + .bDescriptorSubType =   USB_CDC_HEADER_TYPE,
> + .bcdCDC =   cpu_to_le16(0x0110),

This is global structure initialization. So should not it use
__constant_cpu_to_le16() macro instead of cpu_to_le16()? I guess that on
armel or x86 is cpu_to_le16() just identity macro, but on big endian
systems it is needed to use constant initialization. Other gadget
drivers are using those __constant_cpu* macros.

> +};
...
> +int drv_usb_acm_stdio_init(void)
> +{
> + struct stdio_dev stdio;
> +
> + strcpy(stdio.name, "stdio_acm");

Just suggestion: What about "usbacm" or just "acm"?

> + stdio.flags = DEV_FLAGS_INPUT | DEV_FLAGS_OUTPUT;
> + stdio.tstc = acm_stdio_tstc;
> + stdio.getc = acm_stdio_getc;
> + stdio.putc = acm_stdio_putc;
> + stdio.puts = acm_stdio_puts;
> + stdio.start = acm_stdio_start;
> + stdio.stop = acm_stdio_stop;
> + stdio.priv = NULL;
> + stdio.ext = 0;
> +
> + return stdio_register(&stdio);
> +}
> diff --git a/include/stdio_dev.h b/include/stdio_dev.h
> index 8fb9a12..d584793 100644
> --- a/include/stdio_dev.h
> +++ b/include/stdio_dev.h
> @@ -103,6 +103,7 @@ int drv_lcd_init(void);
>  int drv_video_init(void);
>  int drv_keyboard_init(void);
>  int drv_usbtty_init(void);
> +int drv_usb_acm_stdio_init(void);

Other functions do not have stdio in name too. So what about shorting
it? E.g. just drv_usbacm_init()?

>  int drv_nc_init(void);
>  int drv_jtag_console_init(void);
>  int cbmemc_init(void);
> -- 
> 2.7.4
> 


Re: [PATCH] sdhci: zynqmp: Setting up clock frequency based on DT

2021-11-22 Thread Michal Simek

Hi,

On 11/19/21 18:16, Sean Anderson wrote:



On 11/18/21 7:03 AM, Michal Simek wrote:

Using clock-frequency property to define desired clock speed for
controllers.

Signed-off-by: Michal Simek 
---

  drivers/mmc/zynq_sdhci.c | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 5cea4c695e8d..ee87907939fe 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -58,6 +58,7 @@ struct arasan_sdhci_plat {
  struct arasan_sdhci_priv {
  struct sdhci_host *host;
  struct arasan_sdhci_clk_data clk_data;
+    u32 frequency;
  u8 deviceid;
  u8 bank;
  u8 no_1p8;
@@ -721,6 +722,14 @@ static int arasan_sdhci_probe(struct udevice *dev)
  return ret;
  }
+    if (priv->frequency) {
+    ret = clk_set_rate(&clk, priv->frequency);
+    if (IS_ERR_VALUE(ret)) {
+    dev_err(dev, "failed to set clock rate\n");
+    return ret;
+    }
+    }
+
  clock = clk_get_rate(&clk);
  if (IS_ERR_VALUE(clock)) {
  dev_err(dev, "failed to get rate\n");
@@ -804,6 +813,7 @@ static int arasan_sdhci_of_to_plat(struct udevice 
*dev)

  if (IS_ERR(priv->host->ioaddr))
  return PTR_ERR(priv->host->ioaddr);
+    priv->frequency = dev_read_u32_default(dev, "clock-frequency", 0);
  priv->deviceid = dev_read_u32_default(dev, "xlnx,device_id", -1);
  priv->bank = dev_read_u32_default(dev, "xlnx,mio-bank", 0);
  priv->no_1p8 = dev_read_bool(dev, "no-1-8-v");



Why not just assigned-clock-rates? Are there any existing users with 
just clock-frequency?


There is no user of it now in public domain. I was looking for the right 
properly and found only clock-frequency but assigned-clock-rates works 
for me. Will test and send v2.


Thanks,
Michal



[PATCH v2 2/4] configs: add khadas-vim3{l}_android for AOSP support

2021-11-22 Thread Mattijs Korpershoek
The Khadas VIM3 and VIM3L board are well supported in AOSP[1].
However, there is no mainline U-Boot support for it.
The U-Boot used in AOSP is based on a vendor tree [2]

Add all the necessary bits to flash and boot Android for both Khadas
VIM3 and VIM3L boards.

For Android instructions, refer to [1]

[1] https://source.android.com/setup/build/devices#vim3_and_vim3l_boards
[2] https://gitlab.com/baylibre/amlogic/atv/u-boot
Signed-off-by: Guillaume La Roque 
Signed-off-by: Mattijs Korpershoek 
---
 board/amlogic/vim3/MAINTAINERS |   2 +
 configs/khadas-vim3_android_defconfig  | 107 +
 configs/khadas-vim3l_android_defconfig | 107 +
 include/configs/khadas-vim3_android.h  |  34 
 include/configs/khadas-vim3l_android.h |  34 
 include/configs/meson64_android.h  |  12 +++
 6 files changed, 296 insertions(+)
 create mode 100644 configs/khadas-vim3_android_defconfig
 create mode 100644 configs/khadas-vim3l_android_defconfig
 create mode 100644 include/configs/khadas-vim3_android.h
 create mode 100644 include/configs/khadas-vim3l_android.h

diff --git a/board/amlogic/vim3/MAINTAINERS b/board/amlogic/vim3/MAINTAINERS
index 92b426f66d..e185d80ce1 100644
--- a/board/amlogic/vim3/MAINTAINERS
+++ b/board/amlogic/vim3/MAINTAINERS
@@ -4,6 +4,8 @@ S:  Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/vim3/
 F: configs/khadas-vim3_defconfig
+F: configs/khadas-vim3_android_defconfig
 F: configs/khadas-vim3l_defconfig
+F: configs/khadas-vim3l_android_defconfig
 F: doc/board/amlogic/khadas-vim3.rst
 F: doc/board/amlogic/khadas-vim3l.rst
diff --git a/configs/khadas-vim3_android_defconfig 
b/configs/khadas-vim3_android_defconfig
new file mode 100644
index 00..9305a54b1b
--- /dev/null
+++ b/configs/khadas-vim3_android_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="vim3"
+CONFIG_SYS_CONFIG_NAME="khadas-vim3_android"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x1
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-a311d-khadas-vim3"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" khadas-vim3"
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_AVB_VERIFY=y
+# CONFIG_CMD_BDI is not set
+CONFIG_CMD_ADTIMG=y
+CONFIG_CMD_ABOOTIMG=y
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_BCB=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_AVB=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_ADC=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x600
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=2
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_NVME=y
+CONFIG_PCI=y
+CONFIG_PCIE_DW_MESON=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MESON_SPIFC=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_LIBAVB=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/khadas-vim3l_android_defconfig 
b/configs/khadas-vim3l_android_defconfig
new file mode 100644
index 00..5eed79b263
--- /dev/null
+++ b/configs/khadas-vim3l_android_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="vim3"
+CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x1
+CONFIG_DM_GPIO=y
+CONF

[PATCH v2 3/4] configs: prepare khadas-vim3{l}_ab_android for AOSP support

2021-11-22 Thread Mattijs Korpershoek
In AOSP, both VIM3 and VIM3L have 2 bootloader flavors,
depending on A/B enablement.

For example, for vim3l, the naming is:
- u-boot_kvim3l_noab.bin : legacy support
- u-boot_kvim3l_ab.bin   : A/B support

Prepare a defconfig to support u-boot_kvim3_ab.bin and
u-boot_kvim3l_ab.bin.

This is identical to khadas-vim3{l}_ab_android but will be updated in
the next commit.

Also update partitioning tables for A/B support.

Signed-off-by: Mattijs Korpershoek 
---
 board/amlogic/vim3/MAINTAINERS|   2 +
 configs/khadas-vim3_android_ab_defconfig  | 107 ++
 configs/khadas-vim3l_android_ab_defconfig | 107 ++
 include/configs/khadas-vim3_android.h |  16 
 include/configs/khadas-vim3l_android.h|  16 
 5 files changed, 248 insertions(+)
 create mode 100644 configs/khadas-vim3_android_ab_defconfig
 create mode 100644 configs/khadas-vim3l_android_ab_defconfig

diff --git a/board/amlogic/vim3/MAINTAINERS b/board/amlogic/vim3/MAINTAINERS
index e185d80ce1..d8848495c7 100644
--- a/board/amlogic/vim3/MAINTAINERS
+++ b/board/amlogic/vim3/MAINTAINERS
@@ -5,7 +5,9 @@ L:  u-boot-amlo...@groups.io
 F: board/amlogic/vim3/
 F: configs/khadas-vim3_defconfig
 F: configs/khadas-vim3_android_defconfig
+F: configs/khadas-vim3_android_ab_defconfig
 F: configs/khadas-vim3l_defconfig
 F: configs/khadas-vim3l_android_defconfig
+F: configs/khadas-vim3l_android_ab_defconfig
 F: doc/board/amlogic/khadas-vim3.rst
 F: doc/board/amlogic/khadas-vim3l.rst
diff --git a/configs/khadas-vim3_android_ab_defconfig 
b/configs/khadas-vim3_android_ab_defconfig
new file mode 100644
index 00..9305a54b1b
--- /dev/null
+++ b/configs/khadas-vim3_android_ab_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="vim3"
+CONFIG_SYS_CONFIG_NAME="khadas-vim3_android"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x1
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-a311d-khadas-vim3"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" khadas-vim3"
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_AVB_VERIFY=y
+# CONFIG_CMD_BDI is not set
+CONFIG_CMD_ADTIMG=y
+CONFIG_CMD_ABOOTIMG=y
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_BCB=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_AVB=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_BUTTON=y
+CONFIG_BUTTON_ADC=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x600
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=2
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_NVME=y
+CONFIG_PCI=y
+CONFIG_PCIE_DW_MESON=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MESON_SPIFC=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_LIBAVB=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/khadas-vim3l_android_ab_defconfig 
b/configs/khadas-vim3l_android_ab_defconfig
new file mode 100644
index 00..5eed79b263
--- /dev/null
+++ b/configs/khadas-vim3l_android_ab_defconfig
@@ -0,0 +1,107 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="vim3"
+CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x1
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-khadas-vim3l"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff80300

[PATCH v2 4/4] configs: khadas-vim3{l}_android_ab: enable A/B support

2021-11-22 Thread Mattijs Korpershoek
meson64_android.h also relies on CMD_AB_SELECT so enable that as well.

Signed-off-by: Guillaume La Roque 
Signed-off-by: Mattijs Korpershoek 
---
 configs/khadas-vim3_android_ab_defconfig  | 2 ++
 configs/khadas-vim3l_android_ab_defconfig | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configs/khadas-vim3_android_ab_defconfig 
b/configs/khadas-vim3_android_ab_defconfig
index 9305a54b1b..88325c37db 100644
--- a/configs/khadas-vim3_android_ab_defconfig
+++ b/configs/khadas-vim3_android_ab_defconfig
@@ -17,6 +17,7 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
 CONFIG_AVB_VERIFY=y
+CONFIG_ANDROID_AB=y
 # CONFIG_CMD_BDI is not set
 CONFIG_CMD_ADTIMG=y
 CONFIG_CMD_ABOOTIMG=y
@@ -33,6 +34,7 @@ CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_AB_SELECT=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_AVB=y
 CONFIG_OF_CONTROL=y
diff --git a/configs/khadas-vim3l_android_ab_defconfig 
b/configs/khadas-vim3l_android_ab_defconfig
index 5eed79b263..608b54dca2 100644
--- a/configs/khadas-vim3l_android_ab_defconfig
+++ b/configs/khadas-vim3l_android_ab_defconfig
@@ -17,6 +17,7 @@ CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
 CONFIG_AVB_VERIFY=y
+CONFIG_ANDROID_AB=y
 # CONFIG_CMD_BDI is not set
 CONFIG_CMD_ADTIMG=y
 CONFIG_CMD_ABOOTIMG=y
@@ -33,6 +34,7 @@ CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_AB_SELECT=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_AVB=y
 CONFIG_OF_CONTROL=y
-- 
2.32.0



[PATCH v2 1/4] configs: meson64_android: add board specific env settings

2021-11-22 Thread Mattijs Korpershoek
This allows us to define extra board variables, such as "board" and
"board_name".

Signed-off-by: Guillaume La Roque 
Signed-off-by: Mattijs Korpershoek 
---
 include/configs/meson64_android.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/meson64_android.h 
b/include/configs/meson64_android.h
index 7cd1ab0341..56dc9fcb07 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -23,6 +23,10 @@
 #define CONTROL_PARTITION "misc"
 #endif
 
+#ifndef EXTRA_ANDROID_ENV_SETTINGS
+#define EXTRA_ANDROID_ENV_SETTINGS ""
+#endif
+
 #if defined(CONFIG_CMD_AVB)
 #define AVB_VERIFY_CHECK \
"if test \"${force_avb}\" -eq 1; then " \
@@ -264,6 +268,7 @@
"fi;"
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
+   EXTRA_ANDROID_ENV_SETTINGS\
"partitions=" PARTS_DEFAULT "\0"  \
"mmcdev=2\0"  \
ANDROIDBOOT_GET_CURRENT_SLOT_CMD  \
-- 
2.32.0



[PATCH v2 0/4] meson64_android: add support for vim3/vim3l boards

2021-11-22 Thread Mattijs Korpershoek
The VIM3 and VIM3L boards are well supported in the
Android Open Source project via the yukawa [1] platform.

Their U-Boot version, despite being public [2] is not in mainline.

[1] https://android.googlesource.com/device/amlogic/yukawa
[2] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/tree/u-boot/v2021.07/integ

Add defconfigs for both vim3, vim3l to support
traditional and A/B booting/partitioning schemes.

Changes in v2:
* Squashed defconfig changes for initial support
* Split out partitition changes for A/B

v1:
* 
https://lore.kernel.org/u-boot/2029100829.843139-1-mkorpersh...@baylibre.com/T/#t


Mattijs Korpershoek (4):
  configs: meson64_android: add board specific env settings
  configs: add khadas-vim3{l}_android for AOSP support
  configs: prepare khadas-vim3{l}_ab_android for AOSP support
  configs: khadas-vim3{l}_android_ab: enable A/B support

 board/amlogic/vim3/MAINTAINERS|   4 +
 configs/khadas-vim3_android_ab_defconfig  | 109 ++
 configs/khadas-vim3_android_defconfig | 107 +
 configs/khadas-vim3l_android_ab_defconfig | 109 ++
 configs/khadas-vim3l_android_defconfig| 107 +
 include/configs/khadas-vim3_android.h |  50 ++
 include/configs/khadas-vim3l_android.h|  50 ++
 include/configs/meson64_android.h |  17 
 8 files changed, 553 insertions(+)
 create mode 100644 configs/khadas-vim3_android_ab_defconfig
 create mode 100644 configs/khadas-vim3_android_defconfig
 create mode 100644 configs/khadas-vim3l_android_ab_defconfig
 create mode 100644 configs/khadas-vim3l_android_defconfig
 create mode 100644 include/configs/khadas-vim3_android.h
 create mode 100644 include/configs/khadas-vim3l_android.h

-- 
2.32.0



[PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment

2021-11-22 Thread Tom Rini
From: Michal Simek 

When a MAC address is randomly generated we currently only update the
appropriate data structure.  For consistency and to re-align with
historic usage, it should be also saved to the appropriate environment
variable as well.

Cc: Wolfgang Denk 
Signed-off-by: Michal Simek 
Reviewed-by: Ramon Fried 
[trini: Update Kconfig, handle legacy networking case as well]
Signed-off-by: Tom Rini 
---
Changes in v3:
- Update Kconfig help text with Wolfgang's suggestion
- Reword the commit message to hopefully be clearer

Changes in v2:
- Update Kconfig help text to reflect this change.
- Update the legacy path to match.
---
 net/Kconfig  | 9 +
 net/eth-uclass.c | 2 ++
 net/eth_legacy.c | 2 ++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/net/Kconfig b/net/Kconfig
index 7a2d14501881..cabe93c6bd29 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -27,10 +27,11 @@ config BOOTP_SEND_HOSTNAME
 config NET_RANDOM_ETHADDR
bool "Random ethaddr if unset"
help
- Selecting this will allow the Ethernet interface to function
- even when the ethaddr variable for that interface is unset.
- A new MAC address will be generated on every boot and it will
- not be added to the environment.
+ Selecting this will allow the Ethernet interface to function even
+ when the ethaddr variable for that interface is unset.  In this case,
+ a random MAC address in the locally administered address space is
+ generated. It will be saved to the appropriate environment variable,
+ too.
 
 config NETCONSOLE
bool "NetConsole support"
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 0da0e85be031..58c308f33276 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -583,6 +583,8 @@ static int eth_post_probe(struct udevice *dev)
net_random_ethaddr(pdata->enetaddr);
printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
   dev->name, dev_seq(dev), pdata->enetaddr);
+   eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
+ pdata->enetaddr);
 #else
printf("\nError: %s address not set.\n",
   dev->name);
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index f383ccce0b92..e7f53b958b2e 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -164,6 +164,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char 
*base_name,
net_random_ethaddr(dev->enetaddr);
printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
   dev->name, eth_number, dev->enetaddr);
+   eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
+ pdata->enetaddr);
 #else
printf("\nError: %s address not set.\n",
   dev->name);
-- 
2.25.1



Re: [PATCH v2] board: stemmy: Increase boot image to 64 MB

2021-11-22 Thread Tom Rini
On Sat, Nov 20, 2021 at 11:55:42PM +0100, Linus Walleij wrote:

> When using a recent kernel with a bunch of compiled-in
> stuff the kernel image easily becomes bigger than 8 MB
> yielding this error:
> 
>   Loading Kernel Image
>   Image too large: increase CONFIG_SYS_BOOTM_LEN
>   Must RESET board to recover
> 
> Fix this by bumping to SZ_64MB.
> 
> Cc: Stephan Gerhold 
> Signed-off-by: Linus Walleij 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH V2] clk: introduce u-boot,ignore-clk-defaults

2021-11-22 Thread Tom Rini
On Mon, Nov 22, 2021 at 11:33:27AM +0800, Peng Fan (OSS) wrote:
> + Rob
> 
> On 2021/11/20 20:57, Tom Rini wrote:
> > On Sat, Nov 20, 2021 at 12:10:54PM +, Peng Fan (OSS) wrote:
> > > > Subject: [PATCH V2] clk: introduce u-boot,ignore-clk-defaults
> > > > 
> > > > From: Peng Fan 
> > > > 
> > > > Current code has a force clk_set_defaults in multiple stages, U-Boot 
> > > > reuse the
> > > > same device tree and Linux Kernel device tree, but we not register all 
> > > > the clks
> > > > as Linux Kernel, so clk_set_defaults will fail and cause the clk 
> > > > provider
> > > > registeration fail.
> > > > 
> > > > So introduce a new property to ignore the default settings which could 
> > > > be
> > > > used by any node that wanna ignore default settings.
> > > > 
> > > > Reviewed-by: Simon Glass 
> > > > Signed-off-by: Peng Fan 
> > > > ---
> > > > 
> > > > V2:
> > > >   Add R-b tag
> > > >   Tom, Simon
> > > > After a thought, I think still put it as a u-boot thing. 
> > > > assigned-clock-x is
> > > > actually Linux specific, however I could not add the new property 
> > > > to Linux,
> > > > because we are supporting SystemReady-IR, we need the
> > > > assigned-clock-x property
> > > > in linux working and ignore it in U-Boot.
> > > 
> > > Any more thoughts?
> > 
> > Just my continued request that you treat this as generic and submit the
> > binding upstream so it can be in the device tree for the platform.
> > 
> 
> As Sean said, this is to serve cast that linux and U-Boot use the same
> device tree, I mean U-Boot runtime export device tree to linux for SR-IR
> (system-ready IR) booting.
> 
> Linux needs assigned-clocks to some reason, but U-Boot not need that because
> the driver not added the support or not a must to have that.
> 
> Because assigned-clocks failure in U-Boot will cause probe fail now,
> the device driver will report failure.
> 
> You mean rename this to "ignore-clk-defaults" or keep
> "u-boot,ignore-clk-defauls" or "firmware,ignore-clk-defaults" to linux
> device tree binding?
> 
> I could try to send to linux kernel with "firmware" as a prefix.

What I mean is that first I'm not seeing the description of the property
as being clear enough, either in commit message or the binding itself.
That's why in my mind I keep seeing this as "we set the properties
linux,assigned-clocks and u-boot,ignore-clk-defaults" and I don't know why we
need both.  Is there not something we can do based on seeing
linux,assigned-clocks ?  Showing something that makes use of the property
you're wishing to add would be helpful.  In fact, some specific dts
snippets would be helpful to understand what's going on here.

Second, if we need a new property here then yes, it goes upstream and
you put u-boot,has-not-clk-foo or firmware,has-not-clk-foo or whatever
in the boards dts file.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] lib/circbuf: Make circbuf selectable symbol

2021-11-22 Thread Wolfgang Denk
Dear Loic Poulain,

In message <1637584252-15617-1-git-send-email-loic.poul...@linaro.org> you 
wrote:
> It is currenly only used from usbtty driver but make it properly
> selectable via Kconfig symbol, for future usage.
>
> Signed-off-by: Loic Poulain 
> ---
>  v2: no change
>
>  lib/Kconfig  | 3 +++
>  lib/Makefile | 8 +++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/lib/Kconfig b/lib/Kconfig
> index c535147..1bd54d8 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -290,6 +290,9 @@ config TRACE_EARLY_ADDR
> the size is too small then the message which says the amount of early
> data being coped will the the same as the
>  
> +config CIRCBUF
> +bool
> +
>  source lib/dhry/Kconfig

Please add a description what this symbos is doing.

Thanks.


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
Old programmers never die, they just become managers.


[PATCH v2 2/2] usb: gadget: Add CDC ACM function

2021-11-22 Thread Loic Poulain
Add support for CDC ACM using the new UDC and gadget API. This protocol
can be used for serial over USB data transfer and is widely supported
by various OS (GNU/Linux, MS-Windows, OSX...). The usual purpose of
such link is to access device debug console and can be useful for
products not exposing regular UART to the user.

A default stdio device named 'stdio_acm' is created, and can be used
to redirect console to USB link over CDC ACM:

> setenv stdin stdio_acm; setenv stdout stdio_acm

Signed-off-by: Loic Poulain 
---
 v2: - remove possible infinite recursipe print loop
 - Remove acmconsole command, start function along the stdio device

 common/stdio.c  |   3 +
 drivers/usb/gadget/Kconfig  |   9 +
 drivers/usb/gadget/Makefile |   1 +
 drivers/usb/gadget/f_acm.c  | 672 
 include/stdio_dev.h |   1 +
 5 files changed, 686 insertions(+)
 create mode 100644 drivers/usb/gadget/f_acm.c

diff --git a/common/stdio.c b/common/stdio.c
index 4083e4e..2862823 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -381,6 +381,9 @@ int stdio_add_devices(void)
 #ifdef CONFIG_USB_TTY
drv_usbtty_init();
 #endif
+#ifdef CONFIG_USB_FUNCTION_ACM
+   drv_usb_acm_stdio_init ();
+#endif
if (IS_ENABLED(CONFIG_NETCONSOLE))
drv_nc_init();
 #ifdef CONFIG_JTAG_CONSOLE
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 327ea86..d81a9c5 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -182,6 +182,15 @@ config USB_FUNCTION_THOR
  Enable Tizen's THOR download protocol support in U-Boot. It
  allows downloading images into memory and flash them to target device.
 
+config USB_FUNCTION_ACM
+   bool "Enable CDC ACM gadget"
+   select SYS_STDIO_DEREGISTER
+   select CIRCBUF
+   help
+ ACM serial link. This function can be used to create a stdio device to
+ interoperate with MS-Windows hosts or with the Linux-USB "cdc-acm"
+ driver.
+
 endif # USB_GADGET_DOWNLOAD
 
 config USB_ETHER
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index f560068..d5d891b 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
 obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
 obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o
 obj-$(CONFIG_USB_FUNCTION_ROCKUSB) += f_rockusb.o
+obj-$(CONFIG_USB_FUNCTION_ACM) += f_acm.o
 endif
 endif
 ifdef CONFIG_USB_ETHER
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
new file mode 100644
index 000..3ea3b4a
--- /dev/null
+++ b/drivers/usb/gadget/f_acm.c
@@ -0,0 +1,672 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * USB CDC serial (ACM) function driver
+ *
+ * Copyright (C) 2003 Al Borchers (alborch...@steinerpoint.com)
+ * Copyright (C) 2008 by David Brownell
+ * Copyright (C) 2008 by Nokia Corporation
+ * Copyright (C) 2009 by Samsung Electronics
+ * Copyright (c) 2021, Linaro Ltd 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define REQ_SIZE_MAX   512
+
+struct f_acm {
+   int ctrl_id;
+   int data_id;
+
+   struct usb_ep *ep_in;
+   struct usb_ep *ep_out;
+   struct usb_ep *ep_notify;
+
+   struct usb_request *req_in;
+   struct usb_request *req_out;
+
+   bool connected;
+   bool tx_on;
+
+   circbuf_t rx_buf;
+   circbuf_t tx_buf;
+
+   struct usb_function usb_function;
+
+   struct usb_cdc_line_coding line_coding;
+   u16 handshake_bits;
+#define ACM_CTRL_RTS   BIT(1)  /* unused with full duplex */
+#define ACM_CTRL_DTR   BIT(0)  /* host is ready for data r/w */
+
+   int controller_index;
+};
+
+static struct f_acm *default_acm_function;
+
+static inline struct f_acm *func_to_acm(struct usb_function *f)
+{
+   return container_of(f, struct f_acm, usb_function);
+}
+
+static inline struct f_acm *stdio_to_acm(struct stdio_dev *s)
+{
+   /* stdio dev is cloned on registration, do not use container_of */
+   return s->priv;
+}
+
+static struct usb_interface_assoc_descriptor
+acm_iad_descriptor = {
+   .bLength =  sizeof(acm_iad_descriptor),
+   .bDescriptorType =  USB_DT_INTERFACE_ASSOCIATION,
+   .bFirstInterface =  0,
+   .bInterfaceCount =  2,  // control + data
+   .bFunctionClass =   USB_CLASS_COMM,
+   .bFunctionSubClass =USB_CDC_SUBCLASS_ACM,
+   .bFunctionProtocol =USB_CDC_ACM_PROTO_AT_V25TER,
+};
+
+static struct usb_interface_descriptor acm_control_intf_desc = {
+   .bLength =  USB_DT_INTERFACE_SIZE,
+   .bDescriptorType =  USB_DT_INTERFACE,
+   .bNumEndpoints =1,
+   .bInterfaceClass =  USB_CLASS_COMM,
+   .bInterfaceSubClass =   USB_CDC_SUBCLASS_ACM,
+   .bInterf

[PATCH v2 1/2] lib/circbuf: Make circbuf selectable symbol

2021-11-22 Thread Loic Poulain
It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain 
---
 v2: no change

 lib/Kconfig  | 3 +++
 lib/Makefile | 8 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index c535147..1bd54d8 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -290,6 +290,9 @@ config TRACE_EARLY_ADDR
  the size is too small then the message which says the amount of early
  data being coped will the the same as the
 
+config CIRCBUF
+bool
+
 source lib/dhry/Kconfig
 
 menu "Security support"
diff --git a/lib/Makefile b/lib/Makefile
index 8ba745f..4daeee2 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,7 +29,13 @@ ifneq ($(CONFIG_CHARSET),)
 obj-y += charset.o
 endif
 endif
-obj-$(CONFIG_USB_TTY) += circbuf.o
+
+ifdef CONFIG_USB_TTY
+obj-y += circbuf.o
+else
+obj-$(CONFIG_CIRCBUF) += circbuf.o
+endif
+
 obj-y += crc8.o
 obj-y += crc16.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o
-- 
2.7.4



Re: [PATCH 3/3] cmd: add acmconsole command

2021-11-22 Thread Pali Rohár
On Monday 22 November 2021 11:33:15 Loic Poulain wrote:
> Hi Pali,
> 
> On Tue, 16 Nov 2021 at 20:36, Pali Rohár  wrote:
> >
> > Hello!
> >
> > On Tuesday 16 November 2021 20:05:07 Loic Poulain wrote:
> > > Hi Pali,
> > >
> > > Sorry for the late reply,
> > >
> > > On Mon, 27 Sept 2021 at 22:04, Pali Rohár  wrote:
> > > >
> > > > On Thursday 19 August 2021 13:13:06 Loic Poulain wrote:
> > > > > This command allows to start CDC ACM function and redirect console
> > > > > (stdin, stdout, stderr) to USB (acmconsole start). The console can
> > > > > then be accessed through the USB host for debugging purpose. The
> > > > > host can stop the session (acmconsole stop) to revert back console
> > > > > to serial and unregister CDC ACM USB function.
> > > >
> > > > Hello!
> > > >
> > > > Could you rather implement this CDC ACM gadget in a way that calling
> > > > 'setenv stdout cdc_acm' (or 'setenv stdout usbtty') would do this
> > > > console redirect? Like it is supported for current usbtty or vga output
> > > > code.
> > > >
> > > > Then this acmconsole command would not be needed at all.
> > >
> > > Yes, that would be good, but AFAIR I restricted this cdc_acm usage to
> > > this command because we can't have fine grained control like e.g.
> > > using cdc_acm as stdout only, when used, it should necessarily be
> > > STDIN (at least). The reason is because of the single-tasking nature
> > > of u-boot, and the fact that we need to poll the USB controller for
> > > events via the 'usb_gadget_handle_interrupts()' function.
> >
> > There was already discussion that custom commands for activating drivers
> > are against driver model design. See:
> > https://lore.kernel.org/u-boot/20211026151742.42b0fcfa@thinkpad/
> >
> > So I think that there should not be any driver specific command which
> > just activates device (in this case console).
> 
> That's a bit different here since it's not a standard
> device/peripheral driver but a USB function, which is something the
> 'user' can decide to enable or not, all the other USB functions have
> dedicated commands AFAIK. It's not clear otherwise at which place we
> should register the acm_console? should it be unconditionally
> registered at init?

I really do not know. But for me it could make sense that activation
happens when calling standard "setenv std* cdc_acm" commands...


Re: [PATCH 3/3] efi_loader: Extend PCR's for firmware measurements

2021-11-22 Thread Ilias Apalodimas
On Thu, Nov 18, 2021 at 11:47:51AM +0530, Ruchika Gupta wrote:
> Firmwares before U-Boot may be capable of doing tpm measurements
> and passing them to U-Boot in the form of eventlog. However there
> may be scenarios where the firmwares don't have TPM driver and
> are not capable of extending the measurements in the PCRs. To
> cater to such platforms, read the PCR0 to determine if the
> previous firmwares have extended the PCR0. If not, then extend
> the PCR's as the eventlog is parsed.
> 
> Signed-off-by: Ruchika Gupta 
> ---
>  lib/efi_loader/efi_tcg2.c | 86 +++
>  1 file changed, 86 insertions(+)
> 
> diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
> index c97766eae3..cbd0c7d224 100644
> --- a/lib/efi_loader/efi_tcg2.c
> +++ b/lib/efi_loader/efi_tcg2.c
> @@ -178,6 +178,43 @@ static efi_status_t tcg2_pcr_extend(struct udevice *dev, 
> u32 pcr_index,
>   return EFI_SUCCESS;
>  }
>  
> +/* tcg2_pcr_read - Read PCRs for a TPM2 device for a given tpml_digest_values
> + *
> + * @dev: device
> + * @digest_list: list of digest algorithms to extend
> + *
> + * @Return: status code
> + */
> +static efi_status_t tcg2_pcr_read(struct udevice *dev, u32 pcr_index,
> + struct tpml_digest_values *digest_list)
> +{
> + struct tpm_chip_priv *priv;
> + unsigned int updates, pcr_select_min;
> + u32 rc;
> + size_t i;
> +
> + priv = dev_get_uclass_priv(dev);
> + if (!priv)
> + return EFI_DEVICE_ERROR;
> +
> + pcr_select_min = priv->pcr_select_min;
> +
> + for (i = 0; i < digest_list->count; i++) {
> + u16 hash_alg = digest_list->digests[i].hash_alg;
> + u8 *digest = (u8 *)&digest_list->digests[i].digest;
> +
> + rc = tpm2_pcr_read(dev, pcr_index, pcr_select_min,
> + hash_alg, digest, alg_to_len(hash_alg),
> + &updates);
> + if (rc) {
> + EFI_PRINT("Failed to read PCR\n");
> + return EFI_DEVICE_ERROR;
> + }
> + }
> +
> + return EFI_SUCCESS;
> +}
> +
>  /* tcg2_agile_log_append - Append an agile event to out eventlog
>   *
>   * @pcr_index:   PCR index
> @@ -1488,10 +1525,12 @@ static efi_status_t efi_init_event_log(struct udevice 
> *dev)
>   struct tcg_pcr_event *event_header = NULL;
>   struct tpml_digest_values digest_list;
>   size_t spec_event_size;
> + bool extend_pcr = false;
>   efi_status_t ret;
>   u32 pcr, pos;
>   u64 base;
>   u32 sz;
> + int i;
>  
>   ret = platform_get_tpm2_device(&dev);
>   if (ret != EFI_SUCCESS)
> @@ -1541,6 +1580,26 @@ static efi_status_t efi_init_event_log(struct udevice 
> *dev)
>   goto free_pool;
>   }
>  
> + ret = tcg2_pcr_read(dev, 0, &digest_list);
> + if (ret) {
> + log_err("Error reading PCR 0\n");
> + goto free_pool;
> + }
> +
> + /*
> +  * If PCR0 is 0, previous firmware didn't have the capability
> +  * to extend the PCR. In this scenario, extend the PCR as
> +  * the eventlog is parsed.
> +  */
> + for (i = 0; i < digest_list.count; i++) {
> + u8 buffer[TPM2_DIGEST_LEN] =  { 0 };
> + u16 hash_alg = digest_list.digests[i].hash_alg;
> +
> + if (!memcmp((u8 *)&digest_list.digests[i].digest,
> + buffer, alg_to_len(hash_alg)))
> + extend_pcr = true;
> + }
> +
>   while (pos < sz) {
>   ret = tcg2_parse_event(dev, buffer, sz, &pos,
>  &digest_list, &pcr);
> @@ -1548,6 +1607,33 @@ static efi_status_t efi_init_event_log(struct udevice 
> *dev)
>   log_err("Error parsing event\n");
>   goto free_pool;
>   }
> +
> + if (pcr != 0) {
> + /*
> +  * Eventlog passed by firmware should extend
> +  * PCR0 only.

I don't get this comment.  The previous stage bootloader could extend any
PCR (0-7) as long as it adheres to the PC client spec right?
I think we just need the logic below here,  were we decide to start with an
empty eventlog if the prior stage boot loader doesn't expose one.

> +  */
> + log_err("Invalid PCR\n");
> + goto free_pool;
> + }
> +
> + if (extend_pcr) {
> + ret = tcg2_pcr_extend(dev, pcr, &digest_list);
> + if (ret != EFI_SUCCESS) {
> +

Re: [PATCH 1/3] efi_loader: Add check for event log passed from firmware

2021-11-22 Thread Ilias Apalodimas
Hi Ruchika, 
>  

[...]

> +static efi_status_t efi_init_event_log(struct udevice *dev)
>  {
>   /*
>* vendor_info_size is currently set to 0, we need to change the length
>* and allocate the flexible array member if this changes
>*/
>   struct tcg_pcr_event *event_header = NULL;
> - struct udevice *dev;
> + struct tpml_digest_values digest_list;
>   size_t spec_event_size;
>   efi_status_t ret;
> + u32 pcr, pos;
> + u64 base;
> + u32 sz;
>  
>   ret = platform_get_tpm2_device(&dev);
>   if (ret != EFI_SUCCESS)
> @@ -1266,26 +1507,65 @@ static efi_status_t efi_init_event_log(void)
>* last log entry
>*/
>   memset(event_log.buffer, 0xff, TPM2_EVENT_LOG_SIZE);
> +
> + /*
> +  * The log header is defined to be in SHA1 event log entry format.
> +  * Setup event header
> +  */
> + event_header =  (struct tcg_pcr_event *)event_log.buffer;
>   event_log.pos = 0;
>   event_log.last_event_size = 0;
>   event_log.get_event_called = false;
>   event_log.truncated = false;
>  
>   /*
> -  * The log header is defined to be in SHA1 event log entry format.
> -  * Setup event header
> +  * Check if earlier firmware have passed any eventlog. Different
> +  * platforms can use different ways to do so
>*/
> - event_header =  (struct tcg_pcr_event *)event_log.buffer;
> - put_unaligned_le32(0, &event_header->pcr_index);
> - put_unaligned_le32(EV_NO_ACTION, &event_header->event_type);
> - memset(&event_header->digest, 0, sizeof(event_header->digest));
> - ret = create_specid_event(dev, (void *)((uintptr_t)event_log.buffer + 
> sizeof(*event_header)),
> -   &spec_event_size);
> - if (ret != EFI_SUCCESS)
> - goto free_pool;
> - put_unaligned_le32(spec_event_size, &event_header->event_size);
> - event_log.pos = spec_event_size + sizeof(*event_header);
> - event_log.last_event_size = event_log.pos;
> + ret = platform_get_eventlog(dev, &base, &sz);

I think we can refactor this slightly and make it easier to read. 
Can we merge the logic of getting + validating the eventlog in 
platform_get_eventlog(). Then just return EFI_X and continue from
there.

> + if (ret == EFI_SUCCESS && sz < TPM2_EVENT_LOG_SIZE) {
> + void *buffer = (void *)base;
> +
> + pos = 0;
> + /* Parse the eventlog to check for its validity */
> + ret = parse_event_log_header(buffer, sz, &pos);
> + if (ret || pos > sz) {
> + ret = EFI_COMPROMISED_DATA;
> + goto free_pool;
> + }
> +
> + ret = parse_specid_event(dev, buffer, sz, &pos, &digest_list);
> + if (ret || pos > sz) {
> + log_err("Error parsing SPEC ID Event\n");
> + ret = EFI_COMPROMISED_DATA;
> + goto free_pool;
> + }
> +
> + while (pos < sz) {
> + ret = tcg2_parse_event(dev, buffer, sz, &pos,
> +&digest_list, &pcr);
> + if (ret) {
> + log_err("Error parsing event\n");
> + goto free_pool;
> + }
> + }
> +
> + memcpy(event_log.buffer, buffer, sz);
> + event_log.pos = sz;
> + } else {
> + put_unaligned_le32(0, &event_header->pcr_index);
> + put_unaligned_le32(EV_NO_ACTION, &event_header->event_type);
> + memset(&event_header->digest, 0, sizeof(event_header->digest));
> + ret = create_specid_event(dev,
> +   (void *)((uintptr_t)event_log.buffer +
> +sizeof(*event_header)),
> +   &spec_event_size);
> + if (ret != EFI_SUCCESS)
> + goto free_pool;
> + put_unaligned_le32(spec_event_size, &event_header->event_size);
> + event_log.pos = spec_event_size + sizeof(*event_header);
> + event_log.last_event_size = event_log.pos;
> + }
>  
>   ret = create_final_event();
>   if (ret != EFI_SUCCESS)
> @@ -1664,7 +1944,7 @@ efi_status_t efi_tcg2_register(void)
>   return EFI_SUCCESS;
>   }
>  
> - ret = efi_init_event_log();
> + ret = efi_init_event_log(dev);
>   if (ret != EFI_SUCCESS)
>   goto fail;
>  
> -- 
> 2.25.1
> 


Thanks
/Ilias


Re: [PATCH] configs: amlogic: Disable CONFIG_NET_RANDOM_ETHADDR when unnecessary

2021-11-22 Thread Vyacheslav

Sounds right for jethub boards.

Signed-off-by: Vyacheslav Bocharov 

22.11.2021 14:07, Neil Armstrong пишет:

On Meson GXL, GXM, AXG, G12A, G12B & SM1 SoCs, we can generate an unique
MAC address if none valid found in the eFuses storage.

Only the GXBB based boards doesn't have a fallback way to generate an
unique MAC address, so we rely on CONFIG_NET_RANDOM_ETHADDR to have
a valid one.

An exception is the Radxa Zero board who doesn't have Ethernet on board
so depends on an (or multiple) eventual USB adapters, so leaving the
CONFIG_NET_RANDOM_ETHADDR configs seems safer.

Suggested-by: Tom Rini 
Signed-off-by: Neil Armstrong 
---
  configs/bananapi-m5_defconfig| 1 -
  configs/beelink-gsking-x_defconfig   | 1 -
  configs/beelink-gtking_defconfig | 1 -
  configs/beelink-gtkingpro_defconfig  | 1 -
  configs/jethub_j80_defconfig | 1 -
  configs/khadas-vim2_defconfig| 1 -
  configs/khadas-vim3_defconfig| 1 -
  configs/khadas-vim3l_defconfig   | 1 -
  configs/khadas-vim_defconfig | 1 -
  configs/libretech-ac_defconfig   | 1 -
  configs/libretech-cc_defconfig   | 1 -
  configs/libretech-cc_v2_defconfig| 1 -
  configs/libretech-s905d-pc_defconfig | 1 -
  configs/libretech-s912-pc_defconfig  | 1 -
  configs/odroid-c4_defconfig  | 1 -
  configs/odroid-hc4_defconfig | 1 -
  configs/odroid-n2_defconfig  | 1 -
  configs/p212_defconfig   | 1 -
  configs/s400_defconfig   | 1 -
  configs/sei510_defconfig | 1 -
  configs/sei610_defconfig | 1 -
  configs/u200_defconfig   | 1 -
  configs/wetek-core2_defconfig| 1 -
  23 files changed, 23 deletions(-)

diff --git a/configs/bananapi-m5_defconfig b/configs/bananapi-m5_defconfig
index 7ca14a5f6a..4bf81b2faa 100644
--- a/configs/bananapi-m5_defconfig
+++ b/configs/bananapi-m5_defconfig
@@ -25,7 +25,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_ADC=y
  CONFIG_SARADC_MESON=y
  CONFIG_MMC_MESON_GX=y
diff --git a/configs/beelink-gsking-x_defconfig 
b/configs/beelink-gsking-x_defconfig
index 54ac1c9315..e60e754f56 100644
--- a/configs/beelink-gsking-x_defconfig
+++ b/configs/beelink-gsking-x_defconfig
@@ -26,7 +26,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_MMC_MESON_GX=y
  CONFIG_MTD=y
  CONFIG_DM_MTD=y
diff --git a/configs/beelink-gtking_defconfig b/configs/beelink-gtking_defconfig
index 7735c70e3f..2ec3221563 100644
--- a/configs/beelink-gtking_defconfig
+++ b/configs/beelink-gtking_defconfig
@@ -26,7 +26,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_MMC_MESON_GX=y
  CONFIG_MTD=y
  CONFIG_DM_MTD=y
diff --git a/configs/beelink-gtkingpro_defconfig 
b/configs/beelink-gtkingpro_defconfig
index 93c5739672..60d316d80a 100644
--- a/configs/beelink-gtkingpro_defconfig
+++ b/configs/beelink-gtkingpro_defconfig
@@ -26,7 +26,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_MMC_MESON_GX=y
  CONFIG_MTD=y
  CONFIG_DM_MTD=y
diff --git a/configs/jethub_j80_defconfig b/configs/jethub_j80_defconfig
index ad6bec0c43..eb1e4c4a53 100644
--- a/configs/jethub_j80_defconfig
+++ b/configs/jethub_j80_defconfig
@@ -33,7 +33,6 @@ CONFIG_CMD_REGULATOR=y
  CONFIG_PARTITION_TYPE_GUID=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_SARADC_MESON=y
  CONFIG_DM_I2C=y
  CONFIG_SYS_I2C_MESON=y
diff --git a/configs/khadas-vim2_defconfig b/configs/khadas-vim2_defconfig
index c852f7f3f9..81cff3cee8 100644
--- a/configs/khadas-vim2_defconfig
+++ b/configs/khadas-vim2_defconfig
@@ -29,7 +29,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_SARADC_MESON=y
  CONFIG_MMC_MESON_GX=y
  CONFIG_MTD=y
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index a225a564b2..65050efd3f 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -30,7 +30,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_ADC=y
  CONFIG_SARADC_MESON=y
  CONFIG_BUTTON=y
diff --git a/configs/khadas-vim3l_defconfig b/configs/khadas-vim3l_defconfig
index 9d94c31891..b9162c9f1e 100644
--- a/configs/khadas-vim3l_defconfig
+++ b/configs/khadas-vim3l_defconfig
@@ -30,7 +30,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_OF_CONTROL=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_ADC=y
  CONFIG_SARADC_MESON=y
  CONFIG_BUTTON=y
diff --git a/configs/khadas-vim

[PATCH] configs: amlogic: Disable CONFIG_NET_RANDOM_ETHADDR when unnecessary

2021-11-22 Thread Neil Armstrong
On Meson GXL, GXM, AXG, G12A, G12B & SM1 SoCs, we can generate an unique
MAC address if none valid found in the eFuses storage.

Only the GXBB based boards doesn't have a fallback way to generate an
unique MAC address, so we rely on CONFIG_NET_RANDOM_ETHADDR to have
a valid one.

An exception is the Radxa Zero board who doesn't have Ethernet on board
so depends on an (or multiple) eventual USB adapters, so leaving the
CONFIG_NET_RANDOM_ETHADDR configs seems safer.

Suggested-by: Tom Rini 
Signed-off-by: Neil Armstrong 
---
 configs/bananapi-m5_defconfig| 1 -
 configs/beelink-gsking-x_defconfig   | 1 -
 configs/beelink-gtking_defconfig | 1 -
 configs/beelink-gtkingpro_defconfig  | 1 -
 configs/jethub_j80_defconfig | 1 -
 configs/khadas-vim2_defconfig| 1 -
 configs/khadas-vim3_defconfig| 1 -
 configs/khadas-vim3l_defconfig   | 1 -
 configs/khadas-vim_defconfig | 1 -
 configs/libretech-ac_defconfig   | 1 -
 configs/libretech-cc_defconfig   | 1 -
 configs/libretech-cc_v2_defconfig| 1 -
 configs/libretech-s905d-pc_defconfig | 1 -
 configs/libretech-s912-pc_defconfig  | 1 -
 configs/odroid-c4_defconfig  | 1 -
 configs/odroid-hc4_defconfig | 1 -
 configs/odroid-n2_defconfig  | 1 -
 configs/p212_defconfig   | 1 -
 configs/s400_defconfig   | 1 -
 configs/sei510_defconfig | 1 -
 configs/sei610_defconfig | 1 -
 configs/u200_defconfig   | 1 -
 configs/wetek-core2_defconfig| 1 -
 23 files changed, 23 deletions(-)

diff --git a/configs/bananapi-m5_defconfig b/configs/bananapi-m5_defconfig
index 7ca14a5f6a..4bf81b2faa 100644
--- a/configs/bananapi-m5_defconfig
+++ b/configs/bananapi-m5_defconfig
@@ -25,7 +25,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ADC=y
 CONFIG_SARADC_MESON=y
 CONFIG_MMC_MESON_GX=y
diff --git a/configs/beelink-gsking-x_defconfig 
b/configs/beelink-gsking-x_defconfig
index 54ac1c9315..e60e754f56 100644
--- a/configs/beelink-gsking-x_defconfig
+++ b/configs/beelink-gsking-x_defconfig
@@ -26,7 +26,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
diff --git a/configs/beelink-gtking_defconfig b/configs/beelink-gtking_defconfig
index 7735c70e3f..2ec3221563 100644
--- a/configs/beelink-gtking_defconfig
+++ b/configs/beelink-gtking_defconfig
@@ -26,7 +26,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
diff --git a/configs/beelink-gtkingpro_defconfig 
b/configs/beelink-gtkingpro_defconfig
index 93c5739672..60d316d80a 100644
--- a/configs/beelink-gtkingpro_defconfig
+++ b/configs/beelink-gtkingpro_defconfig
@@ -26,7 +26,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
diff --git a/configs/jethub_j80_defconfig b/configs/jethub_j80_defconfig
index ad6bec0c43..eb1e4c4a53 100644
--- a/configs/jethub_j80_defconfig
+++ b/configs/jethub_j80_defconfig
@@ -33,7 +33,6 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_PARTITION_TYPE_GUID=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SARADC_MESON=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MESON=y
diff --git a/configs/khadas-vim2_defconfig b/configs/khadas-vim2_defconfig
index c852f7f3f9..81cff3cee8 100644
--- a/configs/khadas-vim2_defconfig
+++ b/configs/khadas-vim2_defconfig
@@ -29,7 +29,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SARADC_MESON=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD=y
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index a225a564b2..65050efd3f 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -30,7 +30,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ADC=y
 CONFIG_SARADC_MESON=y
 CONFIG_BUTTON=y
diff --git a/configs/khadas-vim3l_defconfig b/configs/khadas-vim3l_defconfig
index 9d94c31891..b9162c9f1e 100644
--- a/configs/khadas-vim3l_defconfig
+++ b/configs/khadas-vim3l_defconfig
@@ -30,7 +30,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ADC=y
 CONFIG_SARADC_MESON=y
 CONFIG_BUTTON=y
diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig
index 5565635ab1..81eeff4982 100644
--- a/configs/khadas-vim_defconfig
+++ b/configs/khadas-vim_defconfig
@@ -27,7 +27,6 @@ CONFIG_CMD_USB_MAS

Re: [PATCHv2] net: uclass: Save ethernet MAC address when generated

2021-11-22 Thread Wolfgang Denk
Dear Tom,

In message <20211120155358.376540-1-tr...@konsulko.com> you wrote:
>
> When MAC address is randomly generated it should be also saved to
> variables. This step is there when MAC address is passed via pdata but not
> when it is randomly generated.

"saved to variables" ? Which variables? In C code?  In the
environment?

This is not clear here.

> Selecting this will allow the Ethernet interface to function
> -   even when the ethaddr variable for that interface is unset.
> -   A new MAC address will be generated on every boot and it will
> -   not be added to the environment.
> +   even when the ethaddr variable for that interface is unset by
> +   generating a new MAC address in the locally administered address
> +   space and setting the appropriate environment variable.

Same here: "ethaddr variable" - I guess this refers to the
environment variable?  Then we should write that.

Hmmm: "when the ethaddr variable ... is unset by generating ... and
setting the appropriate environment variable."  this is misleading,
as the "ethaddr variable" is not unset by setting the env var.

Suggestion:

Selecting this will allow the Ethernet interface to function
even when the ethaddr variable for that interface is unset.
In this case, a random MAC address in the locally
administered address space is generated. It will be saved to
the appropriate environment variable, too.

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
A conservative is a man with two perfectly good legs  who  has  never
learned to walk.  - Franklin D. Roosevelt


Re: [PATCH 2/3] tpm: use more algorithms than sha256 on pcr_read

2021-11-22 Thread Ilias Apalodimas
Hi Ruchika, 

[...]
> -   void *data, unsigned int *updates);
> +   u32 algorithm, void *data, u32 digest_len,

This goes into a tpm_u16() call.  It doesn't break anything currently, but
shouldn't we define this as u16 ?

> +   unsigned int *updates);
>  
>  /**
>   * Issue a TPM2_GetCapability command.  This implementation is limited
> diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
> index 235f8c20d4..9f86eab814 100644
> --- a/lib/tpm-v2.c
> +++ b/lib/tpm-v2.c
> @@ -254,7 +254,8 @@ u32 tpm2_nv_write_value(struct udevice *dev, u32 index, 
> const void *data,
>  }
>  
>  u32 tpm2_pcr_read(struct udevice *dev, u32 idx, unsigned int idx_min_sz,
> -   void *data, unsigned int *updates)
> +   u32 algorithm, void *data, u32 digest_len,
> +   unsigned int *updates)
>  {
>   u8 idx_array_sz = max(idx_min_sz, DIV_ROUND_UP(idx, 8));
>   u8 command_v2[COMMAND_BUFFER_SIZE] = {
> @@ -264,7 +265,7 @@ u32 tpm2_pcr_read(struct udevice *dev, u32 idx, unsigned 
> int idx_min_sz,
>  
>   /* TPML_PCR_SELECTION */
>   tpm_u32(1), /* Number of selections */
> - tpm_u16(TPM2_ALG_SHA256),   /* Algorithm of the hash */
> + tpm_u16(algorithm), /* Algorithm of the hash */
>   idx_array_sz,   /* Array size for selection */
>   /* bitmap(idx) Selected PCR bitmap */
>   };
> @@ -283,10 +284,13 @@ u32 tpm2_pcr_read(struct udevice *dev, u32 idx, 
> unsigned int idx_min_sz,
>   if (ret)
>   return ret;
>  
> + if (digest_len > response_len)
> + return TPM_LIB_ERROR;
> +
>   if (unpack_byte_string(response, response_len, "ds",
>  10, &counter,
> -response_len - TPM2_DIGEST_LEN, data,
> -TPM2_DIGEST_LEN))
> +response_len - digest_len, data,
> +digest_len))
>   return TPM_LIB_ERROR;
>  
>   if (updates)
> -- 
> 2.25.1
> 


Cheers
/Ilias


Re: [PATCH] net: zynq: Add support for mdio bus address decoding

2021-11-22 Thread Ramon Fried
On Mon, Nov 22, 2021 at 9:40 AM Michal Simek  wrote:
>
>
>
> On 11/21/21 20:11, Ramon Fried wrote:
> > On Thu, Nov 18, 2021 at 2:06 PM Michal Simek  
> > wrote:
> >>
> >> There are flying two configurations around.
> > Can you rephrase ? I don't understand.
>
> The first configuration is
> eth {
> phy-handle = <&phy0>;
>  phy0: ethernet-phy@21 {
> ...
> };
> };
>
> The second is (based on mdio.yaml)
> eth {
> phy-handle = <&phy0>;
> mdio {
> phy0: ethernet-phy@21 {
> ...
> };
> };
> };
>
> Xilinx dts files are using both ways. But the second case is not fully
> when you have one mdio bus shared with at least 2 phys where one phy is
> connected to another gem controller.
> This code is updating logic which finds which gen controller is mdio bus
> owner.
>
> Please let me know if you want me to update commit message.
>
> Thanks,
> Michal
>
>
> >> The first (already supported) has phy as subnode of gem node.
> >> The second has mdio subnode (with mdio name) which has phy subnode.
> >>
> >> This patch adds support for the second case where mdio subnode
> >> is found driver will look at its parent to find out which gem is handling
> >> MDIO bus.
> >>
> >> Signed-off-by: Michal Simek 
> >> ---
> >>
> >>   drivers/net/zynq_gem.c | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> >> index 033021f1cbfc..91957757727d 100644
> >> --- a/drivers/net/zynq_gem.c
> >> +++ b/drivers/net/zynq_gem.c
> >> @@ -804,6 +804,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev)
> >>SPEED_1000);
> >>
> >>  parent = ofnode_get_parent(phandle_args.node);
> >> +   if (ofnode_name_eq(parent, "mdio"))
> >> +   parent = ofnode_get_parent(parent);
> >> +
> >>  addr = ofnode_get_addr(parent);
> >>  if (addr != FDT_ADDR_T_NONE) {
> >>  debug("MDIO bus not found %s\n", dev->name);
> >> --
> >> 2.33.1
> >>
"There are flying two configurations around."
The above sentence is semantically incorrect, just fix that.


Re: [PATCH] net: zynq: Add support for GEM reset

2021-11-22 Thread Ramon Fried
On Mon, Nov 22, 2021 at 9:34 AM Michal Simek  wrote:
>
>
>
> On 11/21/21 20:12, Ramon Fried wrote:
> > On Thu, Nov 18, 2021 at 2:08 PM Michal Simek  
> > wrote:
> >>
> >> Perform reset before core initialization.
> > Does it fix any apparent issue ? How did it work before that ?
>
> Standard flow which I would say close to 99% users are using getting all
> IPs out of reset that there is no need to reset IP again. This is
> because of all low level initialization is done in previous bootloader
> stage.
> In SOM case which we are working on these IPs are not touched by
> previous bootloader stage that's why reset needs to be called before IP
> is accessed to make sure that it is in correct state.
>
> Thanks,
> Michal
>
>
> >>
> >> Signed-off-by: Michal Simek 
> >> ---
> >>
> >>   drivers/net/zynq_gem.c | 26 ++
> >>   1 file changed, 26 insertions(+)
> >>
> >> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> >> index 91957757727d..5cbe8d28304b 100644
> >> --- a/drivers/net/zynq_gem.c
> >> +++ b/drivers/net/zynq_gem.c
> >> @@ -21,6 +21,7 @@
> >>   #include 
> >>   #include 
> >>   #include 
> >> +#include 
> >>   #include 
> >>   #include 
> >>   #include 
> >> @@ -217,6 +218,7 @@ struct zynq_gem_priv {
> >>  bool int_pcs;
> >>  bool dma_64bit;
> >>  u32 clk_en_info;
> >> +   struct reset_ctl_bulk resets;
> >>   };
> >>
> >>   static int phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 
> >> regnum,
> >> @@ -688,12 +690,36 @@ static int zynq_gem_miiphy_write(struct mii_dev 
> >> *bus, int addr, int devad,
> >>  return phywrite(priv, addr, reg, value);
> >>   }
> >>
> >> +static int zynq_gem_reset_init(struct udevice *dev)
> >> +{
> >> +   struct zynq_gem_priv *priv = dev_get_priv(dev);
> >> +   int ret;
> >> +
> >> +   ret = reset_get_bulk(dev, &priv->resets);
> >> +   if (ret == -ENOTSUPP || ret == -ENOENT)
> >> +   return 0;
> >> +   else if (ret)
> >> +   return ret;
> >> +
> >> +   ret = reset_deassert_bulk(&priv->resets);
> >> +   if (ret) {
> >> +   reset_release_bulk(&priv->resets);
> >> +   return ret;
> >> +   }
> >> +
> >> +   return 0;
> >> +}
> >> +
> >>   static int zynq_gem_probe(struct udevice *dev)
> >>   {
> >>  void *bd_space;
> >>  struct zynq_gem_priv *priv = dev_get_priv(dev);
> >>  int ret;
> >>
> >> +   ret = zynq_gem_reset_init(dev);
> >> +   if (ret)
> >> +   return ret;
> >> +
> >>  /* Align rxbuffers to ARCH_DMA_MINALIGN */
> >>  priv->rxbuffers = memalign(ARCH_DMA_MINALIGN, RX_BUF * 
> >> PKTSIZE_ALIGN);
> >>  if (!priv->rxbuffers)
> >> --
> >> 2.33.1
> >>
Can you add the above description to the commit message ?


Re: [PATCH 3/3] cmd: add acmconsole command

2021-11-22 Thread Loic Poulain
Hi Pali,

On Tue, 16 Nov 2021 at 20:36, Pali Rohár  wrote:
>
> Hello!
>
> On Tuesday 16 November 2021 20:05:07 Loic Poulain wrote:
> > Hi Pali,
> >
> > Sorry for the late reply,
> >
> > On Mon, 27 Sept 2021 at 22:04, Pali Rohár  wrote:
> > >
> > > On Thursday 19 August 2021 13:13:06 Loic Poulain wrote:
> > > > This command allows to start CDC ACM function and redirect console
> > > > (stdin, stdout, stderr) to USB (acmconsole start). The console can
> > > > then be accessed through the USB host for debugging purpose. The
> > > > host can stop the session (acmconsole stop) to revert back console
> > > > to serial and unregister CDC ACM USB function.
> > >
> > > Hello!
> > >
> > > Could you rather implement this CDC ACM gadget in a way that calling
> > > 'setenv stdout cdc_acm' (or 'setenv stdout usbtty') would do this
> > > console redirect? Like it is supported for current usbtty or vga output
> > > code.
> > >
> > > Then this acmconsole command would not be needed at all.
> >
> > Yes, that would be good, but AFAIR I restricted this cdc_acm usage to
> > this command because we can't have fine grained control like e.g.
> > using cdc_acm as stdout only, when used, it should necessarily be
> > STDIN (at least). The reason is because of the single-tasking nature
> > of u-boot, and the fact that we need to poll the USB controller for
> > events via the 'usb_gadget_handle_interrupts()' function.
>
> There was already discussion that custom commands for activating drivers
> are against driver model design. See:
> https://lore.kernel.org/u-boot/20211026151742.42b0fcfa@thinkpad/
>
> So I think that there should not be any driver specific command which
> just activates device (in this case console).

That's a bit different here since it's not a standard
device/peripheral driver but a USB function, which is something the
'user' can decide to enable or not, all the other USB functions have
dedicated commands AFAIK. It's not clear otherwise at which place we
should register the acm_console? should it be unconditionally
registered at init?

Regards,
Loic


Re: [PATCH v2 0/2] env: setenv add resolve value option

2021-11-22 Thread Art Nikpal
On Mon, Nov 22, 2021 at 4:52 PM Wolfgang Denk  wrote:
>
> Dear Artem,
>
> In message 
>  you 
> wrote:
> > > >
> > > > next examples just demonstrate how its works for already defined env
> > > > variables which contain other variables (like storred env variables)
> > >
> > > Which next examples?
> >
> > Usage examples (from commit message):
> >
> > => setenv a hello; setenv b world; setenv c '${a} ${b}'
> > => setenv -r d '${c}! ${a}...'
> > => printenv d
> > d=hello world! hello...
>
> This is a very simple example, and I showed you how you can solve
> this one by just omitting the apostrophes:
>
> => setenv a hello; setenv b world; setenv c ${a} ${b}
> => setenv d ${c}! ${a}...
> => printenv d
> d=hello world! hello...
>

sure i know it and its easy, but we still have some misunderstanding,
and i will try explain again our problem

our problem (TASK)

we have:
some env variables which already defined and we totally dont know
about content ( for example its was improved by `env import` or loaded
from env storage  and  "setenv a hello; setenv b world; setenv c '${a}
${b}'; setenv d '${c}! ${a}...' ;"  just example how emulate this env
state )

we need:
setup/resolve env variable for example from d (and need resolve all
sub included vars)
=> setenv -r e $d
=> printenv e
=> e=hello world! hello...

please explain how we can get it without -r (deep resolve option) via
standard way ?


>
> I _think_ what you actually have in mind is something like this:
>
> => setenv a hello
> => setenv b world
> => setenv c '${a} ${b}'
> => setenv a goodbye
> => setenv b sunshine
>
> something to set d to: '${c}! ${a}...'
>
> => printenv d
>
> Here my simple approach does not show what you want to have:
>
> => setenv a hello
> => setenv b world
> => setenv c ${a} ${b}
> => setenv a goodbye
> => setenv b sunshine
> => setenv d ${c}! ${a}...
> => printenv d
> d=hello world! goodbye...
>
> That's because here evaluation takes place at assignment, but you
> want it when used - but being recursive here is neither a good idea
> nor standard.
>
> How would you do it in a standard posix shell?  You would have to
> use "eval", like that:
>
> $ a=hello
> $ b=world
> $ c='${a} ${b}'
> $ a=goodbye
> $ b=sunshine
> $ d=$(eval echo $c)
> $ echo $d
> goodbye sunshine
>
> But please note that "eval" is _not_ recursive!!
>
> $ a='$b'
> $ eval echo $c
> $b sunshine
>
> And this is why I object against this patch.
>
> Oh, and in U-Boot you could write this as:
>
> => setenv a hello
> => setenv b world
> => setenv c '${a} ${b}'
> => setenv a goodbye
> => setenv b sunshine
> => setenv foo "setenv d ${c}! ${a}..."
> => run foo
> => printenv d
> d=goodbye sunshine! goodbye...
>
> And yes, here you have to be careful about using ' or " as there is
> no recursion like you might expect.
>
> So yes, it would be nice if we had "eval" (which will ocme with the
> hush update), and no, "eval" does not recurse either.
>
>
>
> 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
> Real computer scientists despise the idea of actual  hardware.  Hard-
> ware has limitations, software doesn't. It's a real shame that Turing
> machines are so poor at I/O.


Re: [PATCH 5/5] configs: khadas-vim3{l}_android_ab: enable A/B support

2021-11-22 Thread Mattijs Korpershoek
Hi Neil,

Thank you for your review.

Neil Armstrong  writes:

> Hi,
>
> On 19/11/2021 11:08, Mattijs Korpershoek wrote:
>> meson64_android.h also relies on CMD_AB_SELECT so enable that as well.
>> 
>> Signed-off-by: Guillaume La Roque 
>> Signed-off-by: Mattijs Korpershoek 
>> ---
>>  configs/khadas-vim3_android_ab_defconfig  |  2 ++
>>  configs/khadas-vim3l_android_ab_defconfig |  2 ++
>>  include/configs/khadas-vim3_android.h | 16 
>>  include/configs/khadas-vim3l_android.h| 16 
>>  4 files changed, 36 insertions(+)
>> 
>> diff --git a/configs/khadas-vim3_android_ab_defconfig 
>> b/configs/khadas-vim3_android_ab_defconfig
>> index 9305a54b1b..88325c37db 100644
>> --- a/configs/khadas-vim3_android_ab_defconfig
>> +++ b/configs/khadas-vim3_android_ab_defconfig
>> @@ -17,6 +17,7 @@ CONFIG_OF_BOARD_SETUP=y
>>  # CONFIG_DISPLAY_CPUINFO is not set
>>  CONFIG_MISC_INIT_R=y
>>  CONFIG_AVB_VERIFY=y
>> +CONFIG_ANDROID_AB=y
>>  # CONFIG_CMD_BDI is not set
>>  CONFIG_CMD_ADTIMG=y
>>  CONFIG_CMD_ABOOTIMG=y
>> @@ -33,6 +34,7 @@ CONFIG_CMD_SPI=y
>>  CONFIG_CMD_USB=y
>>  CONFIG_CMD_USB_MASS_STORAGE=y
>>  # CONFIG_CMD_SETEXPR is not set
>> +CONFIG_CMD_AB_SELECT=y
>>  CONFIG_CMD_REGULATOR=y
>>  CONFIG_CMD_AVB=y
>>  CONFIG_OF_CONTROL=y
>> diff --git a/configs/khadas-vim3l_android_ab_defconfig 
>> b/configs/khadas-vim3l_android_ab_defconfig
>> index 5eed79b263..608b54dca2 100644
>> --- a/configs/khadas-vim3l_android_ab_defconfig
>> +++ b/configs/khadas-vim3l_android_ab_defconfig
>> @@ -17,6 +17,7 @@ CONFIG_OF_BOARD_SETUP=y
>>  # CONFIG_DISPLAY_CPUINFO is not set
>>  CONFIG_MISC_INIT_R=y
>>  CONFIG_AVB_VERIFY=y
>> +CONFIG_ANDROID_AB=y
>>  # CONFIG_CMD_BDI is not set
>>  CONFIG_CMD_ADTIMG=y
>>  CONFIG_CMD_ABOOTIMG=y
>> @@ -33,6 +34,7 @@ CONFIG_CMD_SPI=y
>>  CONFIG_CMD_USB=y
>>  CONFIG_CMD_USB_MASS_STORAGE=y
>>  # CONFIG_CMD_SETEXPR is not set
>> +CONFIG_CMD_AB_SELECT=y
>>  CONFIG_CMD_REGULATOR=y
>>  CONFIG_CMD_AVB=y
>>  CONFIG_OF_CONTROL=y
>> diff --git a/include/configs/khadas-vim3_android.h 
>> b/include/configs/khadas-vim3_android.h
>> index a6f6dd0a7a..da6adf6c41 100644
>> --- a/include/configs/khadas-vim3_android.h
>> +++ b/include/configs/khadas-vim3_android.h
>> @@ -12,6 +12,21 @@
>>  #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
>>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>>  
>> +#if defined(CONFIG_CMD_AB_SELECT)
>> +#define PARTS_DEFAULT \
>> +"uuid_disk=${uuid_gpt_disk};" \
>> +"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
>> +"name=misc,size=512K,uuid=${uuid_gpt_misc};" \
>> +"name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \
>> +"name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \
>> +"name=vbmeta_a,size=512K,uuid=${uuid_gpt_vbmeta_a};" \
>> +"name=vbmeta_b,size=512K,uuid=${uuid_gpt_vbmeta_b};" \
>> +"name=boot_a,size=32M,bootable,uuid=${uuid_gpt_boot_a};" \
>> +"name=boot_b,size=32M,bootable,uuid=${uuid_gpt_boot_b};" \
>> +"name=super,size=3072M,uuid=${uuid_gpt_super};" \
>> +"name=userdata,size=11282M,uuid=${uuid_gpt_userdata};" \
>> +"name=rootfs,size=-,uuid=" ROOT_UUID
>> +#else
>>  #define PARTS_DEFAULT \
>>  "uuid_disk=${uuid_gpt_disk};" \
>>  "name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
>> @@ -24,6 +39,7 @@
>>  "name=super,size=1792M,uuid=${uuid_gpt_super};" \
>>  "name=userdata,size=12786M,uuid=${uuid_gpt_userdata};" \
>>  "name=rootfs,size=-,uuid=" ROOT_UUID
>> +#endif
>>  
>>  #define EXTRA_ANDROID_ENV_SETTINGS \
>>  "board=vim3\0" \
>> diff --git a/include/configs/khadas-vim3l_android.h 
>> b/include/configs/khadas-vim3l_android.h
>> index 7affc3e448..b1768e2d82 100644
>> --- a/include/configs/khadas-vim3l_android.h
>> +++ b/include/configs/khadas-vim3l_android.h
>> @@ -12,6 +12,21 @@
>>  #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
>>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>>  
>> +#if defined(CONFIG_CMD_AB_SELECT)
>> +#define PARTS_DEFAULT \
>> +"uuid_disk=${uuid_gpt_disk};" \
>> +"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
>> +"name=misc,size=512K,uuid=${uuid_gpt_misc};" \
>> +"name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \
>> +"name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \
>> +"name=vbmeta_a,size=512K,uuid=${uuid_gpt_vbmeta_a};" \
>> +"name=vbmeta_b,size=512K,uuid=${uuid_gpt_vbmeta_b};" \
>> +"name=boot_a,size=32M,bootable,uuid=${uuid_gpt_boot_a};" \
>> +"name=boot_b,size=32M,bootable,uuid=${uuid_gpt_boot_b};" \
>> +"name=super,size=3072M,uuid=${uuid_gpt_super};" \
>> +"name=userdata,size=11282M,uuid=${uuid_gpt_userdata};" \
>> +"name=rootfs,size=-,uuid=" ROOT_UUID
>> +#else
>>  #define PARTS_DEFAULT \
>>  "uuid_disk=${uuid_gpt_disk};" \
>>  "name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
>> @@ -24,6 +39,7 @@
>>  "name=super,size=1792M,uuid=${uuid_gpt_super};" \
>>  "name=userdata,size=12786M,uuid=${uuid_gpt_userdata};" \
>>  "name=rootfs,size=-,uui

Re: [PATCH 3/5] boards: meson: add khadas vim3{l} android support

2021-11-22 Thread Mattijs Korpershoek
Hi Neil,

Thank you for your review.

Neil Armstrong  writes:

> Hi,
>
> On 19/11/2021 11:08, Mattijs Korpershoek wrote:
>> Add all the necessary bits to flash and boot Android for both Khadas
>> VIM3 and VIM3L boards.
>> 
>> For Android instructions, refer to [1]
>> 
>> [1] https://source.android.com/setup/build/devices#vim3_and_vim3l_boards
>> Signed-off-by: Guillaume La Roque 
>> Signed-off-by: Mattijs Korpershoek 
>> ---
>>  configs/khadas-vim3_android_defconfig  | 16 ++--
>>  configs/khadas-vim3l_android_defconfig | 16 ++--
>>  include/configs/khadas-vim3_android.h  | 34 ++
>>  include/configs/khadas-vim3l_android.h | 34 ++
>>  include/configs/meson64_android.h  | 12 +
>>  5 files changed, 108 insertions(+), 4 deletions(-)
>>  create mode 100644 include/configs/khadas-vim3_android.h
>>  create mode 100644 include/configs/khadas-vim3l_android.h
>> 
>> diff --git a/configs/khadas-vim3_android_defconfig 
>> b/configs/khadas-vim3_android_defconfig
>> index a225a564b2..9305a54b1b 100644
>> --- a/configs/khadas-vim3_android_defconfig
>> +++ b/configs/khadas-vim3_android_defconfig
>> @@ -1,9 +1,10 @@
>>  CONFIG_ARM=y
>>  CONFIG_SYS_BOARD="vim3"
>> +CONFIG_SYS_CONFIG_NAME="khadas-vim3_android"
>>  CONFIG_ARCH_MESON=y
>>  CONFIG_SYS_TEXT_BASE=0x0100
>>  CONFIG_NR_DRAM_BANKS=1
>> -CONFIG_ENV_SIZE=0x2000
>> +CONFIG_ENV_SIZE=0x1
>>  CONFIG_DM_GPIO=y
>>  CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-a311d-khadas-vim3"
>>  CONFIG_MESON_G12A=y
>> @@ -15,9 +16,14 @@ CONFIG_SYS_LOAD_ADDR=0x100
>>  CONFIG_OF_BOARD_SETUP=y
>>  # CONFIG_DISPLAY_CPUINFO is not set
>>  CONFIG_MISC_INIT_R=y
>> +CONFIG_AVB_VERIFY=y
>>  # CONFIG_CMD_BDI is not set
>> +CONFIG_CMD_ADTIMG=y
>> +CONFIG_CMD_ABOOTIMG=y
>>  # CONFIG_CMD_IMI is not set
>> +CONFIG_CMD_BCB=y
>>  CONFIG_CMD_GPIO=y
>> +CONFIG_CMD_GPT=y
>>  CONFIG_CMD_I2C=y
>>  # CONFIG_CMD_LOADS is not set
>>  CONFIG_CMD_MMC=y
>> @@ -28,6 +34,7 @@ CONFIG_CMD_USB=y
>>  CONFIG_CMD_USB_MASS_STORAGE=y
>>  # CONFIG_CMD_SETEXPR is not set
>>  CONFIG_CMD_REGULATOR=y
>> +CONFIG_CMD_AVB=y
>>  CONFIG_OF_CONTROL=y
>>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>>  CONFIG_NET_RANDOM_ETHADDR=y
>> @@ -35,6 +42,11 @@ CONFIG_ADC=y
>>  CONFIG_SARADC_MESON=y
>>  CONFIG_BUTTON=y
>>  CONFIG_BUTTON_ADC=y
>> +CONFIG_USB_FUNCTION_FASTBOOT=y
>> +CONFIG_FASTBOOT_BUF_ADDR=0x600
>> +CONFIG_FASTBOOT_FLASH=y
>> +CONFIG_FASTBOOT_FLASH_MMC_DEV=2
>> +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
>>  CONFIG_DM_I2C=y
>>  CONFIG_SYS_I2C_MESON=y
>>  CONFIG_MMC_MESON_GX=y
>> @@ -79,7 +91,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
>>  CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
>>  CONFIG_USB_GADGET_DWC2_OTG=y
>>  CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
>> -CONFIG_USB_GADGET_DOWNLOAD=y
>>  CONFIG_DM_VIDEO=y
>>  # CONFIG_VIDEO_BPP8 is not set
>>  # CONFIG_VIDEO_BPP16 is not set
>> @@ -92,4 +103,5 @@ CONFIG_VIDEO_BMP_RLE8=y
>>  CONFIG_BMP_16BPP=y
>>  CONFIG_BMP_24BPP=y
>>  CONFIG_BMP_32BPP=y
>> +CONFIG_LIBAVB=y
>>  CONFIG_OF_LIBFDT_OVERLAY=y
>> diff --git a/configs/khadas-vim3l_android_defconfig 
>> b/configs/khadas-vim3l_android_defconfig
>> index 9d94c31891..5eed79b263 100644
>> --- a/configs/khadas-vim3l_android_defconfig
>> +++ b/configs/khadas-vim3l_android_defconfig
>> @@ -1,9 +1,10 @@
>>  CONFIG_ARM=y
>>  CONFIG_SYS_BOARD="vim3"
>> +CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android"
>>  CONFIG_ARCH_MESON=y
>>  CONFIG_SYS_TEXT_BASE=0x0100
>>  CONFIG_NR_DRAM_BANKS=1
>> -CONFIG_ENV_SIZE=0x2000
>> +CONFIG_ENV_SIZE=0x1
>>  CONFIG_DM_GPIO=y
>>  CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-khadas-vim3l"
>>  CONFIG_MESON_G12A=y
>> @@ -15,9 +16,14 @@ CONFIG_SYS_LOAD_ADDR=0x100
>>  CONFIG_OF_BOARD_SETUP=y
>>  # CONFIG_DISPLAY_CPUINFO is not set
>>  CONFIG_MISC_INIT_R=y
>> +CONFIG_AVB_VERIFY=y
>>  # CONFIG_CMD_BDI is not set
>> +CONFIG_CMD_ADTIMG=y
>> +CONFIG_CMD_ABOOTIMG=y
>>  # CONFIG_CMD_IMI is not set
>> +CONFIG_CMD_BCB=y
>>  CONFIG_CMD_GPIO=y
>> +CONFIG_CMD_GPT=y
>>  CONFIG_CMD_I2C=y
>>  # CONFIG_CMD_LOADS is not set
>>  CONFIG_CMD_MMC=y
>> @@ -28,6 +34,7 @@ CONFIG_CMD_USB=y
>>  CONFIG_CMD_USB_MASS_STORAGE=y
>>  # CONFIG_CMD_SETEXPR is not set
>>  CONFIG_CMD_REGULATOR=y
>> +CONFIG_CMD_AVB=y
>>  CONFIG_OF_CONTROL=y
>>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>>  CONFIG_NET_RANDOM_ETHADDR=y
>> @@ -35,6 +42,11 @@ CONFIG_ADC=y
>>  CONFIG_SARADC_MESON=y
>>  CONFIG_BUTTON=y
>>  CONFIG_BUTTON_ADC=y
>> +CONFIG_USB_FUNCTION_FASTBOOT=y
>> +CONFIG_FASTBOOT_BUF_ADDR=0x600
>> +CONFIG_FASTBOOT_FLASH=y
>> +CONFIG_FASTBOOT_FLASH_MMC_DEV=2
>> +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
>>  CONFIG_DM_I2C=y
>>  CONFIG_SYS_I2C_MESON=y
>>  CONFIG_MMC_MESON_GX=y
>> @@ -79,7 +91,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
>>  CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
>>  CONFIG_USB_GADGET_DWC2_OTG=y
>>  CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
>> -CONFIG_USB_GADGET_DOWNLOAD=y
>>  CONFIG_DM_VIDEO=y
>>  # CONFIG_VIDEO_BPP8 is not set
>>  # CONFIG_VIDEO_BPP16 is not set
>> @@ -92,4 +103,5 @@ CONFIG_VIDEO_BMP_RLE8=y

Re: [PATCH 2/4] stm32mp15: remove configs dependency on CONFIG_TFABOOT

2021-11-22 Thread Ilias Apalodimas
On Mon, 22 Nov 2021 at 10:09, Patrice CHOTARD
 wrote:
>
> Hi Patrick
>
> On 10/11/21 9:52 AM, Patrick Delaunay wrote:
> > Remove the dependency on CONFIG_TFABOOT in stm32mp Kconfig
> > - always activate the ARCH config: CONFIG_ARCH_SUPPORT_PSCI
> >   and CONFIG_CPU_V7_HAS_NONSEC
> > - CONFIG_ARMV7_NONSEC is deactivated in trusted defconfig
> > - the correct sysreset driver is activated in each defconfig:
> >   CONFIG_SYSRESET_PSCI or SYSRESET_SYSCON
> >
> > Reported-by: Alexandru Gagniuc 
> > Signed-off-by: Patrick Delaunay 
> > ---
> >
> >  arch/arm/mach-stm32mp/Kconfig | 8 ++--
> >  configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig| 1 +
> >  configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig   | 1 +
> >  .../stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig   | 1 +
> >  configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig   | 1 +
> >  configs/stm32mp15_basic_defconfig | 1 +
> >  configs/stm32mp15_defconfig   | 3 +++
> >  configs/stm32mp15_dhcom_basic_defconfig   | 1 +
> >  configs/stm32mp15_dhcor_basic_defconfig   | 1 +
> >  configs/stm32mp15_trusted_defconfig   | 3 +++
> >  10 files changed, 15 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> > index 69d56c23e1..4ef0daeab2 100644
> > --- a/arch/arm/mach-stm32mp/Kconfig
> > +++ b/arch/arm/mach-stm32mp/Kconfig
> > @@ -35,10 +35,9 @@ config ENV_SIZE
> >
> >  config STM32MP15x
> >   bool "Support STMicroelectronics STM32MP15x Soc"
> > - select ARCH_SUPPORT_PSCI if !TFABOOT
> > - select ARM_SMCCC if TFABOOT
> > + select ARCH_SUPPORT_PSCI
> >   select CPU_V7A
> > - select CPU_V7_HAS_NONSEC if !TFABOOT
> > + select CPU_V7_HAS_NONSEC
> >   select CPU_V7_HAS_VIRT
> >   select OF_BOARD_SETUP
> >   select PINCTRL_STM32
> > @@ -47,8 +46,6 @@ config STM32MP15x
> >   select STM32_SERIAL
> >   select SYS_ARCH_TIMER
> >   imply CMD_NVEDIT_INFO
> > - imply SYSRESET_PSCI if TFABOOT
> > - imply SYSRESET_SYSCON if !TFABOOT
> >   help
> >   support of STMicroelectronics SOC STM32MP15x family
> >   STM32MP157, STM32MP153 or STM32MP151
> > @@ -153,7 +150,6 @@ config NR_DRAM_BANKS
> >
> >  config DDR_CACHEABLE_SIZE
> >   hex "Size of the DDR marked cacheable in pre-reloc stage"
> > - default 0x1000 if TFABOOT
> >   default 0x4000
> >   help
> >   Define the size of the DDR marked as cacheable in U-Boot
> > diff --git a/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig 
> > b/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
> > index 14bf6d1376..ecc5ec1ffe 100644
> > --- a/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
> > +++ b/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
> > @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
> >  CONFIG_DM_RTC=y
> >  CONFIG_RTC_STM32=y
> >  CONFIG_SERIAL_RX_BUFFER=y
> > +CONFIG_SYSRESET_SYSCON=y
> >  CONFIG_WDT=y
> >  CONFIG_WDT_STM32MP=y
> >  CONFIG_LZO=y
> > diff --git a/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig 
> > b/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
> > index 648ecbfc67..fc5b5f370b 100644
> > --- a/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
> > +++ b/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
> > @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
> >  CONFIG_DM_RTC=y
> >  CONFIG_RTC_STM32=y
> >  CONFIG_SERIAL_RX_BUFFER=y
> > +CONFIG_SYSRESET_SYSCON=y
> >  CONFIG_WDT=y
> >  CONFIG_WDT_STM32MP=y
> >  CONFIG_LZO=y
> > diff --git a/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig 
> > b/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
> > index f422ffbeda..4faa4e3ce4 100644
> > --- a/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
> > +++ b/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
> > @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
> >  CONFIG_DM_RTC=y
> >  CONFIG_RTC_STM32=y
> >  CONFIG_SERIAL_RX_BUFFER=y
> > +CONFIG_SYSRESET_SYSCON=y
> >  CONFIG_WDT=y
> >  CONFIG_WDT_STM32MP=y
> >  CONFIG_LZO=y
> > diff --git a/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig 
> > b/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
> > index 244d9ccf4e..bab81bfa92 100644
> > --- a/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
> > +++ b/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
> > @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
> >  CONFIG_DM_RTC=y
> >  CONFIG_RTC_STM32=y
> >  CONFIG_SERIAL_RX_BUFFER=y
> > +CONFIG_SYSRESET_SYSCON=y
> >  CONFIG_WDT=y
> >  CONFIG_WDT_STM32MP=y
> >  CONFIG_LZO=y
> > diff --git a/configs/stm32mp15_basic_defconfig 
> > b/configs/stm32mp15_basic_defconfig
> > index 77ed82c99f..6b3c2d6150 100644
> > --- a/configs/stm32mp15_basic_defconfig
> > +++ b/configs/stm32mp15_basic_defconfig
> > @@ -147,6 +147,7 @@ CONFIG_SPI=y
> >  CONFIG_DM_SPI=y
> > 

Re: serial download on imx8mp

2021-11-22 Thread Michael Nazzareno Trimarchi
Hi

On Mon, Nov 22, 2021 at 10:18 AM Peng Fan (OSS)  wrote:
>
>
>
> On 2021/10/22 15:37, Rasmus Villemoes wrote:
> > Hi
> >
> > I'm having trouble getting serial download to work on an imx8mp evk. I'm
> > building on top of v2021.10.
> >
> > The SPL + U-Boot proper that I build work fine when I write them to an
> > SD card and boot from that, also boot from eMMC with the same binaries
> > works fine.
> >
> > I can also succesfully get the SPL to load and run via USB, and I can
> > _partially_ load the u-boot.itb; in the sense that I can see that
> > bl31.bin runs: I get the lines
> >
> > NOTICE:  BL31: v2.4(release):lf-5.10.52-2.1.0-rc1-39-gbb4957067
> > NOTICE:  BL31: Built : 04:45:39, Sep  8 2021
> >
> > on the serial console (same as when happens when booting via sd or
> > emmc), but then the board just hangs.
>
> DDR init pass, right?
> Do you have a jtag to debug? THis board supports openOCD, you could give
> a try.
>
> bl31 boots up and no more log, it is hard to tell where the issue is.
>
> Better confirm whether bl31 jumps to U-Boot.
>

Try to revert 2707faf01f0

e/o

Add USB_BOOT here
+#ifdef CONFIG_ENV_IS_IN_MMC
+   case SD1_BOOT:
+   case SD2_BOOT:
+   case SD3_BOOT:
+   case MMC1_BOOT:
+   case MMC2_BOOT:
+   case MMC3_BOOT:
+   env_loc =  ENVL_MMC;
+   break;
+#endif
+   default:

e/o
in soc.c

or add ENV_IS_NOWHERE = y in your config

Michael




> Regards
> Peng
>
>
>
> >
> > Now, extracting the u-boot.itb from the
> > imx-boot-imx8mpevk-sd.bin-flash_evk file I found inside
> > LF_v5.10.52-2.1.0_images_IMX8MPEVK.zip, I can actually get _that_
> > u-boot.itb to run on top of the SPL that I built, so I think my SPL is
> > alright (after all, it does manages to hand control over to BL31). That
> > u-boot.itb is
> >
> >U-Boot 2021.04-lf_v2021.04+g1c0116f3da
> >
> > Vanilla v2021.04 shows the same symptoms of being unable to boot via
> > serial download. So I did a bisect between v2021.04 and 1c0116f3da. That
> > bisect lands at
> >
> > commit 3a053a1bd6bc03eaffe82648a318b065d70d1bd0 (refs/bisect/boots)
> > Author: Ye Li 
> > Date:   Tue Apr 21 20:14:29 2020 -0700
> >
> >  MLK-23574-39 imx8mp_evk: Update iMX8MP EVK board codes
> >
> > so I suppose _something_ in that commit fixed it, but unfortunately
> >
> >   board/freescale/imx8mp_evk/imx8mp_evk.c | 332
> > +++-
> >   board/freescale/imx8mp_evk/spl.c|  79 -
> >   configs/imx8mp_evk_defconfig|  66 +++--
> >   include/configs/imx8mp_evk.h| 156
> > ++---
> >   4 files changed, 561 insertions(+), 72 deletions(-)
> >
> > means I have no idea what part of it is missing in mainline, or if there
> > are more bits and pieces scattered around that are prerequisites for
> > getting it to work.
> >
> > But it's really odd, because once the entire image has been downloaded,
> > the components of the FIT have been loaded to the proper addresses and
> > control handed over to BL31, I don't see how U-Boot proper (the very
> > same binary that's used when booting from sd or emmc) can fail, and
> > U-Boot shouldn't really need to know or care about where it was loaded from.
> >
> > Rasmus
> >



-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
mich...@amarulasolutions.com
__

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
i...@amarulasolutions.com
www.amarulasolutions.com


Re: serial download on imx8mp

2021-11-22 Thread Peng Fan (OSS)




On 2021/10/22 15:37, Rasmus Villemoes wrote:

Hi

I'm having trouble getting serial download to work on an imx8mp evk. I'm
building on top of v2021.10.

The SPL + U-Boot proper that I build work fine when I write them to an
SD card and boot from that, also boot from eMMC with the same binaries
works fine.

I can also succesfully get the SPL to load and run via USB, and I can
_partially_ load the u-boot.itb; in the sense that I can see that
bl31.bin runs: I get the lines

NOTICE:  BL31: v2.4(release):lf-5.10.52-2.1.0-rc1-39-gbb4957067
NOTICE:  BL31: Built : 04:45:39, Sep  8 2021

on the serial console (same as when happens when booting via sd or
emmc), but then the board just hangs.


DDR init pass, right?
Do you have a jtag to debug? THis board supports openOCD, you could give 
a try.


bl31 boots up and no more log, it is hard to tell where the issue is.

Better confirm whether bl31 jumps to U-Boot.

Regards
Peng





Now, extracting the u-boot.itb from the
imx-boot-imx8mpevk-sd.bin-flash_evk file I found inside
LF_v5.10.52-2.1.0_images_IMX8MPEVK.zip, I can actually get _that_
u-boot.itb to run on top of the SPL that I built, so I think my SPL is
alright (after all, it does manages to hand control over to BL31). That
u-boot.itb is

   U-Boot 2021.04-lf_v2021.04+g1c0116f3da

Vanilla v2021.04 shows the same symptoms of being unable to boot via
serial download. So I did a bisect between v2021.04 and 1c0116f3da. That
bisect lands at

commit 3a053a1bd6bc03eaffe82648a318b065d70d1bd0 (refs/bisect/boots)
Author: Ye Li 
Date:   Tue Apr 21 20:14:29 2020 -0700

 MLK-23574-39 imx8mp_evk: Update iMX8MP EVK board codes

so I suppose _something_ in that commit fixed it, but unfortunately

  board/freescale/imx8mp_evk/imx8mp_evk.c | 332
+++-
  board/freescale/imx8mp_evk/spl.c|  79 -
  configs/imx8mp_evk_defconfig|  66 +++--
  include/configs/imx8mp_evk.h| 156
++---
  4 files changed, 561 insertions(+), 72 deletions(-)

means I have no idea what part of it is missing in mainline, or if there
are more bits and pieces scattered around that are prerequisites for
getting it to work.

But it's really odd, because once the entire image has been downloaded,
the components of the FIT have been loaded to the proper addresses and
control handed over to BL31, I don't see how U-Boot proper (the very
same binary that's used when booting from sd or emmc) can fail, and
U-Boot shouldn't really need to know or care about where it was loaded from.

Rasmus



Re: [PATCH V3 1/5] imx: imx8mq_evk: switch to binman

2021-11-22 Thread Peng Fan (OSS)




On 2021/11/12 1:24, Heiko Thiery wrote:

Hi Peng,

Am Fr., 22. Okt. 2021 um 04:07 Uhr schrieb Peng Fan (OSS)
:


From: Peng Fan 

Switch to use binman to pack images


After switching to binman you will hit the same issue I have in the
u-boot CI. The mkimage step will fail because the hdmi firmware blob
can not be found [1]. There is already a discuusion ongoing how to fix
that [2].


It should not. I not met failure before, let me try again.

Thanks,
Peng.



[1] 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2021-October%2F464338.html&data=04%7C01%7Cpeng.fan%40nxp.com%7C801faca45846458ee4a908d9a5383734%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637722483129948474%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KOwwQdaUvADXP5PEoniPUrcJ8tfsqb4wBF1KnfZmYqA%3D&reserved=0
[2] 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2021-November%2F466181.html&data=04%7C01%7Cpeng.fan%40nxp.com%7C801faca45846458ee4a908d9a5383734%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637722483129948474%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hLEvWAvxTEHffELh1cTIgILUm%2FsDbZFO86L0lP1WWGk%3D&reserved=0



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

diff --git a/arch/arm/dts/imx8mq-evk-u-boot.dtsi 
b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
index 2cfc12b7e0..6f9c81462e 100644
--- a/arch/arm/dts/imx8mq-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
@@ -1,5 +1,7 @@
  // SPDX-License-Identifier: (GPL-2.0 OR MIT)

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

Re: [PATCH V3 1/5] imx: imx8mq_evk: switch to binman

2021-11-22 Thread Peng Fan (OSS)




On 2021/11/11 22:41, Patrick Wildt wrote:

On Fri, Oct 22, 2021 at 10:42:16AM +0800, Peng Fan (OSS) wrote:

From: Peng Fan 

Switch to use binman to pack images

Signed-off-by: Peng Fan 


I'm unsure how to reply to this.  On the one hand I really like to see
this go in, on the other hand this changes the expectation of what
flash.bin is.  We had the same discussion for i.MX8MM.

Because historically, flash.bin is SPL+U-Boot.itb, and for i.MX8MM
people have changed the binman config to generate a single bootable
file again: 028abfd9b1576b45cf756b9a0c978cfe17906314

So, I would ask you to adjust the imx8mq-u-boot.dts changes in the same
way as done for i.MX8MM.  You should be able to see the differences
by diffing e.g. these files:


ok, thanks for pointing this to me, I'll modify the file to output a
single flash.bin as i.MX8MM.

THanks,
Peng.



diff -u arch/arm/dts/imx8mq-u-boot.dtsi arch/arm/dts/imx8mm-evk-u-boot.dtsi


---
  arch/arm/dts/imx8mq-evk-u-boot.dtsi |   2 +
  arch/arm/dts/imx8mq-u-boot.dtsi | 122 
  arch/arm/mach-imx/imx8m/Kconfig |   1 +
  board/freescale/imx8mq_evk/Kconfig  |   2 +-
  board/freescale/imx8mq_evk/imximage.cfg |  11 +++
  configs/imx8mq_evk_defconfig|   2 +-
  6 files changed, 138 insertions(+), 2 deletions(-)
  create mode 100644 arch/arm/dts/imx8mq-u-boot.dtsi
  create mode 100644 board/freescale/imx8mq_evk/imximage.cfg

diff --git a/arch/arm/dts/imx8mq-evk-u-boot.dtsi 
b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
index 2cfc12b7e0..6f9c81462e 100644
--- a/arch/arm/dts/imx8mq-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
@@ -1,5 +1,7 @@
  // SPDX-License-Identifier: (GPL-2.0 OR MIT)
  
+#include "imx8mq-u-boot.dtsi"

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

Re: [PATCH V3 4/5] imx: imx8mq use common imximage.cfg

2021-11-22 Thread Peng Fan (OSS)




On 2021/11/12 1:21, Heiko Thiery wrote:

Hi Peng,

Am Fr., 22. Okt. 2021 um 04:08 Uhr schrieb Peng Fan (OSS)
:


From: Peng Fan 

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

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

diff --git a/arch/arm/mach-imx/imx8m/imximage.cfg 
b/arch/arm/mach-imx/imx8m/imximage.cfg
index 714b24273b..9c6eaf0a6d 100644
--- a/arch/arm/mach-imx/imx8m/imximage.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage.cfg
@@ -1,17 +1,11 @@
  /* SPDX-License-Identifier: GPL-2.0+ */
  /*
- * Copyright 2018 NXP
+ * Copyright 2018-2021 NXP
   */

  #define __ASSEMBLY__

  FIT
  BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi_imx8m.bin
-LOADER spl/u-boot-spl-ddr.bin  0x7E1000
-SECOND_LOADER  u-boot.itb  0x4020 0x6
-
-DDR_FW lpddr4_pmu_train_1d_imem.bin
-DDR_FW lpddr4_pmu_train_1d_dmem.bin
-DDR_FW lpddr4_pmu_train_2d_imem.bin
-DDR_FW lpddr4_pmu_train_2d_dmem.bin
+SIGNED_HDMIsigned_hdmi.bin
+LOADER mkimage.flash.mkimage   0x7e1000


This file is only a temporarily created file by binman. You should use
the output file .. here it should be flash.bin.

But as Patrick already pointed out, we should create the final
flash.bin like before. I also have a patch for adding a new im8mq
board pending that has this already implemented.[1].


Thanks, I'll check and rework the patchset.

Thanks,
Peng.



[1] 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20211014180824.10681-2-heiko.thiery%40gmail.com%2F&data=04%7C01%7Cpeng.fan%40nxp.com%7C080150fe94714852252808d9a537b028%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637722480863078675%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Yqxm1zT0476ZVGrAMgBzKAUevZRAO2fI4LC5b3C6%2BMg%3D&reserved=0


diff --git a/board/freescale/imx8mq_evk/Kconfig 
b/board/freescale/imx8mq_evk/Kconfig
index a7c49744b3..c4d20ad7c7 100644
--- a/board/freescale/imx8mq_evk/Kconfig
+++ b/board/freescale/imx8mq_evk/Kconfig
@@ -10,6 +10,6 @@ config SYS_CONFIG_NAME
 default "imx8mq_evk"

  config IMX_CONFIG
-   default "board/freescale/imx8mq_evk/imximage.cfg"
+   default "arch/arm/mach-imx/imx8m/imximage.cfg"

  endif
diff --git a/board/freescale/imx8mq_evk/imximage.cfg 
b/board/freescale/imx8mq_evk/imximage.cfg
deleted file mode 100644
index 74f12b30d2..00
--- a/board/freescale/imx8mq_evk/imximage.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2021 NXP
- */
-
-#define __ASSEMBLY__
-
-FIT
-BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/board/google/imx8mq_phanbell/Kconfig 
b/board/google/imx8mq_phanbell/Kconfig
index e59b03cb17..54cfb99952 100644
--- a/board/google/imx8mq_phanbell/Kconfig
+++ b/board/google/imx8mq_phanbell/Kconfig
@@ -10,6 +10,6 @@ config SYS_CONFIG_NAME
 default "imx8mq_phanbell"

  config IMX_CONFIG
-   default "board/google/imx8mq_phanbell/imximage.cfg"
+   default "arch/arm/mach-imx/imx8m/imximage.cfg"

  endif
diff --git a/board/google/imx8mq_phanbell/imximage.cfg 
b/board/google/imx8mq_phanbell/imximage.cfg
deleted file mode 100644
index 74f12b30d2..00
--- a/board/google/imx8mq_phanbell/imximage.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2021 NXP
- */
-
-#define __ASSEMBLY__
-
-FIT
-BOOT_FROM  sd
-SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
diff --git a/board/technexion/pico-imx8mq/Kconfig 
b/board/technexion/pico-imx8mq/Kconfig
index 97655517d8..628b051149 100644
--- a/board/technexion/pico-imx8mq/Kconfig
+++ b/board/technexion/pico-imx8mq/Kconfig
@@ -10,6 +10,6 @@ config SYS_CONFIG_NAME
 default "pico-imx8mq"

  config IMX_CONFIG
-   default "board/technexion/pico-imx8mq/imximage.cfg"
+   default "arch/arm/mach-imx/imx8m/imximage.cfg"

  endif
diff --git a/board/technexion/pico-imx8mq/imximage.cfg 
b/board/technexion/pico-imx8mq/imximage.cfg
deleted file mode 100644
index 74f12b30d2..00
--- a/board/technexion/pico-imx8mq/imximage.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2021 NXP
- */
-
-#define __ASSEMBLY__
-
-FIT
-BOOT_FROM  sd
-SIGNED_HDMIs

Re: [PATCH v2 0/2] env: setenv add resolve value option

2021-11-22 Thread Wolfgang Denk
Dear Artem,

In message  
you wrote:
> > >
> > > next examples just demonstrate how its works for already defined env
> > > variables which contain other variables (like storred env variables)
> >
> > Which next examples?
>
> Usage examples (from commit message):
>
> => setenv a hello; setenv b world; setenv c '${a} ${b}'
> => setenv -r d '${c}! ${a}...'
> => printenv d
> d=hello world! hello...

This is a very simple example, and I showed you how you can solve
this one by just omitting the apostrophes:

=> setenv a hello; setenv b world; setenv c ${a} ${b}
=> setenv d ${c}! ${a}...
=> printenv d
d=hello world! hello...


I _think_ what you actually have in mind is something like this:

=> setenv a hello
=> setenv b world
=> setenv c '${a} ${b}'
=> setenv a goodbye
=> setenv b sunshine

something to set d to: '${c}! ${a}...'

=> printenv d

Here my simple approach does not show what you want to have:

=> setenv a hello
=> setenv b world
=> setenv c ${a} ${b}
=> setenv a goodbye
=> setenv b sunshine
=> setenv d ${c}! ${a}...
=> printenv d
d=hello world! goodbye...

That's because here evaluation takes place at assignment, but you
want it when used - but being recursive here is neither a good idea
nor standard.

How would you do it in a standard posix shell?  You would have to
use "eval", like that:

$ a=hello
$ b=world
$ c='${a} ${b}'
$ a=goodbye
$ b=sunshine
$ d=$(eval echo $c)
$ echo $d
goodbye sunshine

But please note that "eval" is _not_ recursive!!

$ a='$b'
$ eval echo $c
$b sunshine

And this is why I object against this patch.

Oh, and in U-Boot you could write this as:

=> setenv a hello
=> setenv b world
=> setenv c '${a} ${b}'
=> setenv a goodbye
=> setenv b sunshine
=> setenv foo "setenv d ${c}! ${a}..."
=> run foo
=> printenv d 
d=goodbye sunshine! goodbye...

And yes, here you have to be careful about using ' or " as there is
no recursion like you might expect.

So yes, it would be nice if we had "eval" (which will ocme with the
hush update), and no, "eval" does not recurse either.



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
Real computer scientists despise the idea of actual  hardware.  Hard-
ware has limitations, software doesn't. It's a real shame that Turing
machines are so poor at I/O.


Re: [PATCH 4/4] stm32mp15: tidy up #ifdefs in cpu.c

2021-11-22 Thread Patrice CHOTARD
Hi Patrick

On 10/11/21 9:52 AM, Patrick Delaunay wrote:
> We should avoid #ifdef in C modules and the unused functions
> are eliminated by the linker.
> 
> Use the more readable IS_ENABLE() instead.
> 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  arch/arm/mach-stm32mp/cpu.c | 34 +++---
>  1 file changed, 15 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
> index 7421ea42a1..325d710100 100644
> --- a/arch/arm/mach-stm32mp/cpu.c
> +++ b/arch/arm/mach-stm32mp/cpu.c
> @@ -93,7 +93,6 @@ u8 early_tlb[PGTABLE_SIZE] __section(".data") 
> __aligned(0x4000);
>  
>  struct lmb lmb;
>  
> -#if defined(CONFIG_SPL_BUILD)
>  static void security_init(void)
>  {
>   /* Disable the backup domain write protection */
> @@ -208,7 +207,6 @@ static void update_bootmode(void)
>   TAMP_BOOT_MODE_MASK,
>   boot_mode << TAMP_BOOT_MODE_SHIFT);
>  }
> -#endif /* defined(CONFIG_SPL_BUILD) */
>  
>  u32 get_bootmode(void)
>  {
> @@ -286,28 +284,26 @@ int arch_cpu_init(void)
>   /* early armv7 timer init: needed for polling */
>   timer_init();
>  
> -#if defined(CONFIG_SPL_BUILD)
> - security_init();
> - update_bootmode();
> -#endif
> + if (IS_ENABLED(CONFIG_SPL_BUILD)) {
> + security_init();
> + update_bootmode();
> + }
>  /* reset copro state in SPL, when used, or in U-Boot */
> -#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
> - /* Reset Coprocessor state unless it wakes up from Standby power mode */
> - if (!(readl(PWR_MCUCR) & PWR_MCUCR_SBF)) {
> - writel(TAMP_COPRO_STATE_OFF, TAMP_COPRO_STATE);
> - writel(0, TAMP_COPRO_RSC_TBL_ADDRESS);
> + if (!IS_ENABLED(CONFIG_SPL) || IS_ENABLED(CONFIG_SPL_BUILD)) {
> + /* Reset Coprocessor state unless it wakes up from Standby 
> power mode */
> + if (!(readl(PWR_MCUCR) & PWR_MCUCR_SBF)) {
> + writel(TAMP_COPRO_STATE_OFF, TAMP_COPRO_STATE);
> + writel(0, TAMP_COPRO_RSC_TBL_ADDRESS);
> + }
>   }
> -#endif
>  
>   boot_mode = get_bootmode();
>  
>   if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL) &&
>   (boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART)
>   gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
> -#if defined(CONFIG_DEBUG_UART) && defined(CONFIG_SPL_BUILD)
> - else
> + else if (IS_ENABLED(CONFIG_DEBUG_UART) && IS_ENABLED(CONFIG_SPL_BUILD))
>   debug_uart_init();
> -#endif
>  
>   return 0;
>  }
> @@ -461,7 +457,7 @@ void get_soc_name(char name[SOC_NAME_SIZE])
>soc_type[type], soc_pkg[pkg], soc_rev[rev]);
>  }
>  
> -#if defined(CONFIG_DISPLAY_CPUINFO)
> +/* used when CONFIG_DISPLAY_CPUINFO is activated */
>  int print_cpuinfo(void)
>  {
>   char name[SOC_NAME_SIZE];
> @@ -471,7 +467,6 @@ int print_cpuinfo(void)
>  
>   return 0;
>  }
> -#endif /* CONFIG_DISPLAY_CPUINFO */
>  
>  static void setup_boot_mode(void)
>  {
> @@ -601,13 +596,15 @@ static void setup_boot_mode(void)
>   */
>  __weak int setup_mac_address(void)
>  {
> -#if defined(CONFIG_NET)
>   int ret;
>   int i;
>   u32 otp[2];
>   uchar enetaddr[6];
>   struct udevice *dev;
>  
> + if (!IS_ENABLED(CONFIG_NET))
> + return 0;
> +
>   /* MAC already in environment */
>   if (eth_env_get_enetaddr("ethaddr", enetaddr))
>   return 0;
> @@ -634,7 +631,6 @@ __weak int setup_mac_address(void)
>   ret = eth_env_set_enetaddr("ethaddr", enetaddr);
>   if (ret)
>   log_err("Failed to set mac address %pM from OTP: %d\n", 
> enetaddr, ret);
> -#endif
>  
>   return 0;
>  }
> 
Reviewed-by: Patrice Chotard 
Thanks
Patrice


Re: [PATCH 3/4] stm32mp15: replace CONFIG_TFABOOT when it is possible

2021-11-22 Thread Patrice CHOTARD
Hi Patrick

On 10/11/21 9:52 AM, Patrick Delaunay wrote:
> In some part of STM32MP15 support the CONFIG_TFABOOT can be replaced
> by other config: CONFIG_ARMV7_PSCI and CONFIG_ARM_SMCCC.
> 
> This patch also simplifies the code in cpu.c, stm32mp1_ram.c and
> clk_stml32mp1.c as execution of U-Boot in sysram (boot without SPL and
> without TFA) is not supported: the associated initialization code is
> present only in SPL.
> 
> This cleanup patch is a preliminary step to support SPL load of OP-TEE
> in secure world, with SPL in secure world and U-Boot in no-secure world.
> 
> Reported-by: Alexandru Gagniuc 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  arch/arm/mach-stm32mp/bsec.c| 10 +-
>  arch/arm/mach-stm32mp/cpu.c | 20 +++-
>  board/st/stm32mp1/stm32mp1.c|  6 +-
>  drivers/clk/clk_stm32mp1.c  |  4 +---
>  drivers/ram/stm32mp1/stm32mp1_ram.c | 13 ++---
>  include/configs/stm32mp1.h  |  2 +-
>  6 files changed, 25 insertions(+), 30 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
> index e517acdd01..27d1829501 100644
> --- a/arch/arm/mach-stm32mp/bsec.c
> +++ b/arch/arm/mach-stm32mp/bsec.c
> @@ -295,7 +295,7 @@ static int stm32mp_bsec_read_otp(struct udevice *dev, u32 
> *val, u32 otp)
>   u32 tmp_data = 0;
>   int ret;
>  
> - if (IS_ENABLED(CONFIG_TFABOOT))
> + if (IS_ENABLED(CONFIG_ARM_SMCCC) && !IS_ENABLED(CONFIG_SPL_BUILD))
>   return stm32_smc(STM32_SMC_BSEC,
>STM32_SMC_READ_OTP,
>otp, 0, val);
> @@ -326,7 +326,7 @@ static int stm32mp_bsec_read_shadow(struct udevice *dev, 
> u32 *val, u32 otp)
>  {
>   struct stm32mp_bsec_plat *plat;
>  
> - if (IS_ENABLED(CONFIG_TFABOOT))
> + if (IS_ENABLED(CONFIG_ARM_SMCCC) && !IS_ENABLED(CONFIG_SPL_BUILD))
>   return stm32_smc(STM32_SMC_BSEC,
>STM32_SMC_READ_SHADOW,
>otp, 0, val);
> @@ -350,7 +350,7 @@ static int stm32mp_bsec_write_otp(struct udevice *dev, 
> u32 val, u32 otp)
>  {
>   struct stm32mp_bsec_plat *plat;
>  
> - if (IS_ENABLED(CONFIG_TFABOOT))
> + if (IS_ENABLED(CONFIG_ARM_SMCCC) && !IS_ENABLED(CONFIG_SPL_BUILD))
>   return stm32_smc_exec(STM32_SMC_BSEC,
> STM32_SMC_PROG_OTP,
> otp, val);
> @@ -365,7 +365,7 @@ static int stm32mp_bsec_write_shadow(struct udevice *dev, 
> u32 val, u32 otp)
>  {
>   struct stm32mp_bsec_plat *plat;
>  
> - if (IS_ENABLED(CONFIG_TFABOOT))
> + if (IS_ENABLED(CONFIG_ARM_SMCCC) && !IS_ENABLED(CONFIG_SPL_BUILD))
>   return stm32_smc_exec(STM32_SMC_BSEC,
> STM32_SMC_WRITE_SHADOW,
> otp, val);
> @@ -377,7 +377,7 @@ static int stm32mp_bsec_write_shadow(struct udevice *dev, 
> u32 val, u32 otp)
>  
>  static int stm32mp_bsec_write_lock(struct udevice *dev, u32 val, u32 otp)
>  {
> - if (!IS_ENABLED(CONFIG_TFABOOT))
> + if (!IS_ENABLED(CONFIG_ARM_SMCCC) || IS_ENABLED(CONFIG_SPL_BUILD))
>   return -ENOTSUPP;
>  
>   if (val == 1)
> diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
> index 0263ffe96a..7421ea42a1 100644
> --- a/arch/arm/mach-stm32mp/cpu.c
> +++ b/arch/arm/mach-stm32mp/cpu.c
> @@ -93,8 +93,7 @@ u8 early_tlb[PGTABLE_SIZE] __section(".data") 
> __aligned(0x4000);
>  
>  struct lmb lmb;
>  
> -#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
> -#ifndef CONFIG_TFABOOT
> +#if defined(CONFIG_SPL_BUILD)
>  static void security_init(void)
>  {
>   /* Disable the backup domain write protection */
> @@ -154,7 +153,6 @@ static void security_init(void)
>   writel(BIT(0), RCC_MP_AHB5ENSETR);
>   writel(0x0, GPIOZ_SECCFGR);
>  }
> -#endif /* CONFIG_TFABOOT */
>  
>  /*
>   * Debug init
> @@ -166,7 +164,7 @@ static void dbgmcu_init(void)
>* done in TF-A for TRUSTED boot and
>* DBGMCU access is controlled by BSEC_DENABLE.DBGSWENABLE
>   */
> - if (!IS_ENABLED(CONFIG_TFABOOT) && bsec_dbgswenable()) {
> + if (bsec_dbgswenable()) {
>   setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
>   setbits_le32(DBGMCU_APB4FZ1, DBGMCU_APB4FZ1_IWDG2);
>   }
> @@ -184,10 +182,7 @@ void spl_board_init(void)
>   if (ret)
>   log_warning("BSEC probe failed: %d\n", ret);
>  }
> -#endif /* !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD) */
>  
> -#if !defined(CONFIG_TFABOOT) && \
> - (!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
>  /* get bootmode from ROM code boot context: saved in TAMP register */
>  static void update_bootmode(void)
>  {
> @@ -213,7 +208,7 @@ static void update_bootmode(void)
>   TAMP_BOOT_MODE_MASK,
>   boot_mode << TAMP_BOOT_MODE_SHIFT);
>  }
> -#endif
> +#endif /* define

Re: [PATCH v2 0/2] env: setenv add resolve value option

2021-11-22 Thread Art Nikpal
On Sat, Nov 20, 2021 at 8:36 PM Wolfgang Denk  wrote:
>
> Dear Artem,
>
> In message 
>  you 
> wrote:
> >
> > next examples just demonstrate how its works for already defined env
> > variables which contain other variables (like storred env variables)
>
> Which next examples?
>
> > sure I know about this ! see my prev message please .
>
> Which exact message are you referring to here?
>
> > Why not have this new opportunity ?
>
> I think the suggested code is adding more problems than it solves.
>
> > > have in mind, as you speak of "deep resolve". But then, I'm first
> > > missing an explanation (and documentation) of what "deep resolve"
> >
> > recurrent  resolving for variables
>
> Your implementation of recursion has an arbiotrary and undocumented
> depth limit.

we can improve it if it will be really necessary

> Also, I cannot see a way to prevent resolving in case I
> want to keep something like "$foo" in the result.
>

`setenv -r` resolve only bracked vars like ${VAR} if u need keen some
$VAR just use it without brackets
or just use same setenv without -r option - whats a problem ?

> But that's to be expected from such a non-standard way.
>

we can use setenv with -r or without this option (default standard way)
again didn't see problems  (setenv -r is special option especially for
non standard way )

> Why don't you stick with what "eval" in a standard shell does?
>

show me please how can i do it via standard way maybe i miss something ?

> > > actually means in this context, i. e. how many levels down you
> > > evaluat.   Oh...  the code has "int max_loop = 32;" - this is a
> >
> > i think its will be enough
>
> It is a reallybad habt to implement code with arbitrary limits, as
> it will blow into your face (or more likely that of an innocent
> user) rather sooner than later.  It's even worse that this limit is
> nowhere documented.
>
> > 1) this option did not broke any exist compatibilities
> > 2) there we talk not only about uboot shell, same time will be useful
> > to have env_resolve for internal c usage, because env_set dont have
> > this feature
>
> I did not say that an "eval" like construct would not be useful.
> But uncontrolled recursion with an undocumented depth limit is
> a problem.
>
> > yes i'm informed  about this plans  (and think its happens  not  so
> > soon - but i provide some simple elegant solution already)
> > but again we dont have env_resolve for internal c usage which must be
> > very useful
>
> On the CLI, we use the "run" command to get the desired effect. Yes,
> this is neither perfect nor elegant. But you can use that in C code
> as well.
>
> > will be easy get useful features via simple solution ( deep resolve
> > all vars by one line )
>
> I understand what you want, but this is not a good way to solve the
> problem.  I'd really rather see such efforts invested in helping
> Francis with the hush update - which will make such code unnecessary.
>
> 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
> Success in marriage is not so much finding the right person as it  is
> being the right person.


[PATCH] test: address some pylint warnings

2021-11-22 Thread Heinrich Schuchardt
* remove unused variables
* module description must precede import statements
* fix inconsistent return values

Signed-off-by: Heinrich Schuchardt 
---
 test/py/tests/test_efi_loader.py   | 10 +-
 test/py/tests/test_efi_selftest.py |  6 ++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py
index fc8d6b8655..85473a9049 100644
--- a/test/py/tests/test_efi_loader.py
+++ b/test/py/tests/test_efi_loader.py
@@ -6,9 +6,6 @@
 
 # Test efi loader implementation
 
-import pytest
-import u_boot_utils
-
 """
 Note: This test relies on boardenv_* containing configuration values to define
 which network environment is available for testing. Without this, the parts
@@ -50,6 +47,9 @@ env__efi_loader_helloworld_file = {
 }
 """
 
+import pytest
+import u_boot_utils
+
 net_set_up = False
 
 def test_efi_pre_commands(u_boot_console):
@@ -80,7 +80,7 @@ def test_efi_setup_dhcp(u_boot_console):
 env_vars = u_boot_console.config.env.get('env__net_static_env_vars', 
None)
 if not env_vars:
 pytest.skip('No DHCP server available')
-return None
+return
 
 u_boot_console.run_command('setenv autoload no')
 output = u_boot_console.run_command('dhcp')
@@ -193,7 +193,7 @@ def test_efi_grub_net(u_boot_console):
 check_smbios = 
u_boot_console.config.env.get('env__efi_loader_check_smbios', False)
 if check_smbios:
 u_boot_console.wait_for('grub>')
-output = u_boot_console.run_command('lsefisystab', 
wait_for_prompt=False, wait_for_echo=False)
+u_boot_console.run_command('lsefisystab', wait_for_prompt=False, 
wait_for_echo=False)
 u_boot_console.wait_for('SMBIOS')
 
 # Then exit cleanly
diff --git a/test/py/tests/test_efi_selftest.py 
b/test/py/tests/test_efi_selftest.py
index 63218efbc2..0161a6ea24 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -73,8 +73,7 @@ def test_efi_selftest_text_input(u_boot_console):
 This function calls the text input EFI selftest.
 """
 u_boot_console.run_command(cmd='setenv efi_selftest text input')
-output = u_boot_console.run_command(cmd='bootefi selftest',
-wait_for_prompt=False)
+u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
 m = u_boot_console.p.expect([r'To terminate type \'x\''])
 if m != 0:
 raise Exception('No prompt for \'text input\' test')
@@ -143,8 +142,7 @@ def test_efi_selftest_text_input_ex(u_boot_console):
 This function calls the extended text input EFI selftest.
 """
 u_boot_console.run_command(cmd='setenv efi_selftest extended text input')
-output = u_boot_console.run_command(cmd='bootefi selftest',
-wait_for_prompt=False)
+u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
 m = u_boot_console.p.expect([r'To terminate type \'CTRL\+x\''])
 if m != 0:
 raise Exception('No prompt for \'text input\' test')
-- 
2.32.0



Re: [PATCH 3/5] boards: meson: add khadas vim3{l} android support

2021-11-22 Thread Neil Armstrong
Hi,

On 19/11/2021 11:08, Mattijs Korpershoek wrote:
> Add all the necessary bits to flash and boot Android for both Khadas
> VIM3 and VIM3L boards.
> 
> For Android instructions, refer to [1]
> 
> [1] https://source.android.com/setup/build/devices#vim3_and_vim3l_boards
> Signed-off-by: Guillaume La Roque 
> Signed-off-by: Mattijs Korpershoek 
> ---
>  configs/khadas-vim3_android_defconfig  | 16 ++--
>  configs/khadas-vim3l_android_defconfig | 16 ++--
>  include/configs/khadas-vim3_android.h  | 34 ++
>  include/configs/khadas-vim3l_android.h | 34 ++
>  include/configs/meson64_android.h  | 12 +
>  5 files changed, 108 insertions(+), 4 deletions(-)
>  create mode 100644 include/configs/khadas-vim3_android.h
>  create mode 100644 include/configs/khadas-vim3l_android.h
> 
> diff --git a/configs/khadas-vim3_android_defconfig 
> b/configs/khadas-vim3_android_defconfig
> index a225a564b2..9305a54b1b 100644
> --- a/configs/khadas-vim3_android_defconfig
> +++ b/configs/khadas-vim3_android_defconfig
> @@ -1,9 +1,10 @@
>  CONFIG_ARM=y
>  CONFIG_SYS_BOARD="vim3"
> +CONFIG_SYS_CONFIG_NAME="khadas-vim3_android"
>  CONFIG_ARCH_MESON=y
>  CONFIG_SYS_TEXT_BASE=0x0100
>  CONFIG_NR_DRAM_BANKS=1
> -CONFIG_ENV_SIZE=0x2000
> +CONFIG_ENV_SIZE=0x1
>  CONFIG_DM_GPIO=y
>  CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-a311d-khadas-vim3"
>  CONFIG_MESON_G12A=y
> @@ -15,9 +16,14 @@ CONFIG_SYS_LOAD_ADDR=0x100
>  CONFIG_OF_BOARD_SETUP=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_MISC_INIT_R=y
> +CONFIG_AVB_VERIFY=y
>  # CONFIG_CMD_BDI is not set
> +CONFIG_CMD_ADTIMG=y
> +CONFIG_CMD_ABOOTIMG=y
>  # CONFIG_CMD_IMI is not set
> +CONFIG_CMD_BCB=y
>  CONFIG_CMD_GPIO=y
> +CONFIG_CMD_GPT=y
>  CONFIG_CMD_I2C=y
>  # CONFIG_CMD_LOADS is not set
>  CONFIG_CMD_MMC=y
> @@ -28,6 +34,7 @@ CONFIG_CMD_USB=y
>  CONFIG_CMD_USB_MASS_STORAGE=y
>  # CONFIG_CMD_SETEXPR is not set
>  CONFIG_CMD_REGULATOR=y
> +CONFIG_CMD_AVB=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_NET_RANDOM_ETHADDR=y
> @@ -35,6 +42,11 @@ CONFIG_ADC=y
>  CONFIG_SARADC_MESON=y
>  CONFIG_BUTTON=y
>  CONFIG_BUTTON_ADC=y
> +CONFIG_USB_FUNCTION_FASTBOOT=y
> +CONFIG_FASTBOOT_BUF_ADDR=0x600
> +CONFIG_FASTBOOT_FLASH=y
> +CONFIG_FASTBOOT_FLASH_MMC_DEV=2
> +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
>  CONFIG_DM_I2C=y
>  CONFIG_SYS_I2C_MESON=y
>  CONFIG_MMC_MESON_GX=y
> @@ -79,7 +91,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
>  CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
>  CONFIG_USB_GADGET_DWC2_OTG=y
>  CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
> -CONFIG_USB_GADGET_DOWNLOAD=y
>  CONFIG_DM_VIDEO=y
>  # CONFIG_VIDEO_BPP8 is not set
>  # CONFIG_VIDEO_BPP16 is not set
> @@ -92,4 +103,5 @@ CONFIG_VIDEO_BMP_RLE8=y
>  CONFIG_BMP_16BPP=y
>  CONFIG_BMP_24BPP=y
>  CONFIG_BMP_32BPP=y
> +CONFIG_LIBAVB=y
>  CONFIG_OF_LIBFDT_OVERLAY=y
> diff --git a/configs/khadas-vim3l_android_defconfig 
> b/configs/khadas-vim3l_android_defconfig
> index 9d94c31891..5eed79b263 100644
> --- a/configs/khadas-vim3l_android_defconfig
> +++ b/configs/khadas-vim3l_android_defconfig
> @@ -1,9 +1,10 @@
>  CONFIG_ARM=y
>  CONFIG_SYS_BOARD="vim3"
> +CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android"
>  CONFIG_ARCH_MESON=y
>  CONFIG_SYS_TEXT_BASE=0x0100
>  CONFIG_NR_DRAM_BANKS=1
> -CONFIG_ENV_SIZE=0x2000
> +CONFIG_ENV_SIZE=0x1
>  CONFIG_DM_GPIO=y
>  CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-khadas-vim3l"
>  CONFIG_MESON_G12A=y
> @@ -15,9 +16,14 @@ CONFIG_SYS_LOAD_ADDR=0x100
>  CONFIG_OF_BOARD_SETUP=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_MISC_INIT_R=y
> +CONFIG_AVB_VERIFY=y
>  # CONFIG_CMD_BDI is not set
> +CONFIG_CMD_ADTIMG=y
> +CONFIG_CMD_ABOOTIMG=y
>  # CONFIG_CMD_IMI is not set
> +CONFIG_CMD_BCB=y
>  CONFIG_CMD_GPIO=y
> +CONFIG_CMD_GPT=y
>  CONFIG_CMD_I2C=y
>  # CONFIG_CMD_LOADS is not set
>  CONFIG_CMD_MMC=y
> @@ -28,6 +34,7 @@ CONFIG_CMD_USB=y
>  CONFIG_CMD_USB_MASS_STORAGE=y
>  # CONFIG_CMD_SETEXPR is not set
>  CONFIG_CMD_REGULATOR=y
> +CONFIG_CMD_AVB=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_NET_RANDOM_ETHADDR=y
> @@ -35,6 +42,11 @@ CONFIG_ADC=y
>  CONFIG_SARADC_MESON=y
>  CONFIG_BUTTON=y
>  CONFIG_BUTTON_ADC=y
> +CONFIG_USB_FUNCTION_FASTBOOT=y
> +CONFIG_FASTBOOT_BUF_ADDR=0x600
> +CONFIG_FASTBOOT_FLASH=y
> +CONFIG_FASTBOOT_FLASH_MMC_DEV=2
> +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
>  CONFIG_DM_I2C=y
>  CONFIG_SYS_I2C_MESON=y
>  CONFIG_MMC_MESON_GX=y
> @@ -79,7 +91,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
>  CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
>  CONFIG_USB_GADGET_DWC2_OTG=y
>  CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
> -CONFIG_USB_GADGET_DOWNLOAD=y
>  CONFIG_DM_VIDEO=y
>  # CONFIG_VIDEO_BPP8 is not set
>  # CONFIG_VIDEO_BPP16 is not set
> @@ -92,4 +103,5 @@ CONFIG_VIDEO_BMP_RLE8=y
>  CONFIG_BMP_16BPP=y
>  CONFIG_BMP_24BPP=y
>  CONFIG_BMP_32BPP=y
> +CONFIG_LIBAVB=y
>  CONFIG_OF_LIBFDT_OVERLAY=y
> diff --git a/include/configs/khadas-vim3_android.h 
> b/include/configs/khadas-vim3_android.h
>

Re: [PATCH 5/5] configs: khadas-vim3{l}_android_ab: enable A/B support

2021-11-22 Thread Neil Armstrong
Hi,

On 19/11/2021 11:08, Mattijs Korpershoek wrote:
> meson64_android.h also relies on CMD_AB_SELECT so enable that as well.
> 
> Signed-off-by: Guillaume La Roque 
> Signed-off-by: Mattijs Korpershoek 
> ---
>  configs/khadas-vim3_android_ab_defconfig  |  2 ++
>  configs/khadas-vim3l_android_ab_defconfig |  2 ++
>  include/configs/khadas-vim3_android.h | 16 
>  include/configs/khadas-vim3l_android.h| 16 
>  4 files changed, 36 insertions(+)
> 
> diff --git a/configs/khadas-vim3_android_ab_defconfig 
> b/configs/khadas-vim3_android_ab_defconfig
> index 9305a54b1b..88325c37db 100644
> --- a/configs/khadas-vim3_android_ab_defconfig
> +++ b/configs/khadas-vim3_android_ab_defconfig
> @@ -17,6 +17,7 @@ CONFIG_OF_BOARD_SETUP=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_MISC_INIT_R=y
>  CONFIG_AVB_VERIFY=y
> +CONFIG_ANDROID_AB=y
>  # CONFIG_CMD_BDI is not set
>  CONFIG_CMD_ADTIMG=y
>  CONFIG_CMD_ABOOTIMG=y
> @@ -33,6 +34,7 @@ CONFIG_CMD_SPI=y
>  CONFIG_CMD_USB=y
>  CONFIG_CMD_USB_MASS_STORAGE=y
>  # CONFIG_CMD_SETEXPR is not set
> +CONFIG_CMD_AB_SELECT=y
>  CONFIG_CMD_REGULATOR=y
>  CONFIG_CMD_AVB=y
>  CONFIG_OF_CONTROL=y
> diff --git a/configs/khadas-vim3l_android_ab_defconfig 
> b/configs/khadas-vim3l_android_ab_defconfig
> index 5eed79b263..608b54dca2 100644
> --- a/configs/khadas-vim3l_android_ab_defconfig
> +++ b/configs/khadas-vim3l_android_ab_defconfig
> @@ -17,6 +17,7 @@ CONFIG_OF_BOARD_SETUP=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_MISC_INIT_R=y
>  CONFIG_AVB_VERIFY=y
> +CONFIG_ANDROID_AB=y
>  # CONFIG_CMD_BDI is not set
>  CONFIG_CMD_ADTIMG=y
>  CONFIG_CMD_ABOOTIMG=y
> @@ -33,6 +34,7 @@ CONFIG_CMD_SPI=y
>  CONFIG_CMD_USB=y
>  CONFIG_CMD_USB_MASS_STORAGE=y
>  # CONFIG_CMD_SETEXPR is not set
> +CONFIG_CMD_AB_SELECT=y
>  CONFIG_CMD_REGULATOR=y
>  CONFIG_CMD_AVB=y
>  CONFIG_OF_CONTROL=y
> diff --git a/include/configs/khadas-vim3_android.h 
> b/include/configs/khadas-vim3_android.h
> index a6f6dd0a7a..da6adf6c41 100644
> --- a/include/configs/khadas-vim3_android.h
> +++ b/include/configs/khadas-vim3_android.h
> @@ -12,6 +12,21 @@
>  #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>  
> +#if defined(CONFIG_CMD_AB_SELECT)
> +#define PARTS_DEFAULT \
> + "uuid_disk=${uuid_gpt_disk};" \
> + "name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
> + "name=misc,size=512K,uuid=${uuid_gpt_misc};" \
> + "name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \
> + "name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \
> + "name=vbmeta_a,size=512K,uuid=${uuid_gpt_vbmeta_a};" \
> + "name=vbmeta_b,size=512K,uuid=${uuid_gpt_vbmeta_b};" \
> + "name=boot_a,size=32M,bootable,uuid=${uuid_gpt_boot_a};" \
> + "name=boot_b,size=32M,bootable,uuid=${uuid_gpt_boot_b};" \
> + "name=super,size=3072M,uuid=${uuid_gpt_super};" \
> + "name=userdata,size=11282M,uuid=${uuid_gpt_userdata};" \
> + "name=rootfs,size=-,uuid=" ROOT_UUID
> +#else
>  #define PARTS_DEFAULT \
>   "uuid_disk=${uuid_gpt_disk};" \
>   "name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
> @@ -24,6 +39,7 @@
>   "name=super,size=1792M,uuid=${uuid_gpt_super};" \
>   "name=userdata,size=12786M,uuid=${uuid_gpt_userdata};" \
>   "name=rootfs,size=-,uuid=" ROOT_UUID
> +#endif
>  
>  #define EXTRA_ANDROID_ENV_SETTINGS \
>   "board=vim3\0" \
> diff --git a/include/configs/khadas-vim3l_android.h 
> b/include/configs/khadas-vim3l_android.h
> index 7affc3e448..b1768e2d82 100644
> --- a/include/configs/khadas-vim3l_android.h
> +++ b/include/configs/khadas-vim3l_android.h
> @@ -12,6 +12,21 @@
>  #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
>  #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
>  
> +#if defined(CONFIG_CMD_AB_SELECT)
> +#define PARTS_DEFAULT \
> + "uuid_disk=${uuid_gpt_disk};" \
> + "name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
> + "name=misc,size=512K,uuid=${uuid_gpt_misc};" \
> + "name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \
> + "name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \
> + "name=vbmeta_a,size=512K,uuid=${uuid_gpt_vbmeta_a};" \
> + "name=vbmeta_b,size=512K,uuid=${uuid_gpt_vbmeta_b};" \
> + "name=boot_a,size=32M,bootable,uuid=${uuid_gpt_boot_a};" \
> + "name=boot_b,size=32M,bootable,uuid=${uuid_gpt_boot_b};" \
> + "name=super,size=3072M,uuid=${uuid_gpt_super};" \
> + "name=userdata,size=11282M,uuid=${uuid_gpt_userdata};" \
> + "name=rootfs,size=-,uuid=" ROOT_UUID
> +#else
>  #define PARTS_DEFAULT \
>   "uuid_disk=${uuid_gpt_disk};" \
>   "name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
> @@ -24,6 +39,7 @@
>   "name=super,size=1792M,uuid=${uuid_gpt_super};" \
>   "name=userdata,size=12786M,uuid=${uuid_gpt_userdata};" \
>   "name=rootfs,size=-,uuid=" ROOT_UUID
> +#endif
>  
>  #define EXTRA_ANDROID_ENV_SETTINGS \
>   "board=vim3l\0" \
> 


You should move this khadas-vim3l_android.h change ad

Re: [PATCH 2/4] stm32mp15: remove configs dependency on CONFIG_TFABOOT

2021-11-22 Thread Patrice CHOTARD
Hi Patrick

On 10/11/21 9:52 AM, Patrick Delaunay wrote:
> Remove the dependency on CONFIG_TFABOOT in stm32mp Kconfig
> - always activate the ARCH config: CONFIG_ARCH_SUPPORT_PSCI
>   and CONFIG_CPU_V7_HAS_NONSEC
> - CONFIG_ARMV7_NONSEC is deactivated in trusted defconfig
> - the correct sysreset driver is activated in each defconfig:
>   CONFIG_SYSRESET_PSCI or SYSRESET_SYSCON
> 
> Reported-by: Alexandru Gagniuc 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  arch/arm/mach-stm32mp/Kconfig | 8 ++--
>  configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig| 1 +
>  configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig   | 1 +
>  .../stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig   | 1 +
>  configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig   | 1 +
>  configs/stm32mp15_basic_defconfig | 1 +
>  configs/stm32mp15_defconfig   | 3 +++
>  configs/stm32mp15_dhcom_basic_defconfig   | 1 +
>  configs/stm32mp15_dhcor_basic_defconfig   | 1 +
>  configs/stm32mp15_trusted_defconfig   | 3 +++
>  10 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> index 69d56c23e1..4ef0daeab2 100644
> --- a/arch/arm/mach-stm32mp/Kconfig
> +++ b/arch/arm/mach-stm32mp/Kconfig
> @@ -35,10 +35,9 @@ config ENV_SIZE
>  
>  config STM32MP15x
>   bool "Support STMicroelectronics STM32MP15x Soc"
> - select ARCH_SUPPORT_PSCI if !TFABOOT
> - select ARM_SMCCC if TFABOOT
> + select ARCH_SUPPORT_PSCI
>   select CPU_V7A
> - select CPU_V7_HAS_NONSEC if !TFABOOT
> + select CPU_V7_HAS_NONSEC
>   select CPU_V7_HAS_VIRT
>   select OF_BOARD_SETUP
>   select PINCTRL_STM32
> @@ -47,8 +46,6 @@ config STM32MP15x
>   select STM32_SERIAL
>   select SYS_ARCH_TIMER
>   imply CMD_NVEDIT_INFO
> - imply SYSRESET_PSCI if TFABOOT
> - imply SYSRESET_SYSCON if !TFABOOT
>   help
>   support of STMicroelectronics SOC STM32MP15x family
>   STM32MP157, STM32MP153 or STM32MP151
> @@ -153,7 +150,6 @@ config NR_DRAM_BANKS
>  
>  config DDR_CACHEABLE_SIZE
>   hex "Size of the DDR marked cacheable in pre-reloc stage"
> - default 0x1000 if TFABOOT
>   default 0x4000
>   help
>   Define the size of the DDR marked as cacheable in U-Boot
> diff --git a/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig 
> b/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
> index 14bf6d1376..ecc5ec1ffe 100644
> --- a/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
> +++ b/configs/stm32mp15-icore-stm32mp1-ctouch2_defconfig
> @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
>  CONFIG_DM_RTC=y
>  CONFIG_RTC_STM32=y
>  CONFIG_SERIAL_RX_BUFFER=y
> +CONFIG_SYSRESET_SYSCON=y
>  CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  CONFIG_LZO=y
> diff --git a/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig 
> b/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
> index 648ecbfc67..fc5b5f370b 100644
> --- a/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
> +++ b/configs/stm32mp15-icore-stm32mp1-edimm2.2_defconfig
> @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
>  CONFIG_DM_RTC=y
>  CONFIG_RTC_STM32=y
>  CONFIG_SERIAL_RX_BUFFER=y
> +CONFIG_SYSRESET_SYSCON=y
>  CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  CONFIG_LZO=y
> diff --git a/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig 
> b/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
> index f422ffbeda..4faa4e3ce4 100644
> --- a/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
> +++ b/configs/stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig
> @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
>  CONFIG_DM_RTC=y
>  CONFIG_RTC_STM32=y
>  CONFIG_SERIAL_RX_BUFFER=y
> +CONFIG_SYSRESET_SYSCON=y
>  CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  CONFIG_LZO=y
> diff --git a/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig 
> b/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
> index 244d9ccf4e..bab81bfa92 100644
> --- a/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
> +++ b/configs/stm32mp15-microgea-stm32mp1-microdev2_defconfig
> @@ -73,6 +73,7 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
>  CONFIG_DM_RTC=y
>  CONFIG_RTC_STM32=y
>  CONFIG_SERIAL_RX_BUFFER=y
> +CONFIG_SYSRESET_SYSCON=y
>  CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  CONFIG_LZO=y
> diff --git a/configs/stm32mp15_basic_defconfig 
> b/configs/stm32mp15_basic_defconfig
> index 77ed82c99f..6b3c2d6150 100644
> --- a/configs/stm32mp15_basic_defconfig
> +++ b/configs/stm32mp15_basic_defconfig
> @@ -147,6 +147,7 @@ CONFIG_SPI=y
>  CONFIG_DM_SPI=y
>  CONFIG_STM32_QSPI=y
>  CONFIG_STM32_SPI=y
> +CONFIG_SYSRESET_SYSCON=y
>  CONFIG_USB=y
>  CONFIG_DM_USB_GADGET=y
>  CONFIG_USB_EHCI_HCD=y
> diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig
> index 701b1510c5..9d97301075 100644
> --- a/configs/stm32mp15_defconfig
> +

Re: [PATCH v2 13/14] net: mediatek: add support for MediaTek MT7621 SoC

2021-11-22 Thread Weijie Gao
On Sun, 2021-11-21 at 21:14 +0200, Ramon Fried wrote:
> On Fri, Nov 19, 2021 at 3:37 AM Weijie Gao 
> wrote:
> > 
> > This patch adds GMAC support for MediaTek MT7621 SoC.
> > MT7621 has the same GMAC/Switch configuration as MT7623.
> > 
> > Signed-off-by: Weijie Gao 
> > ---
> > v2 changes: none
> > ---
> >  drivers/net/mtk_eth.c | 27 +--
> >  drivers/net/mtk_eth.h |  8 
> >  2 files changed, 29 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
> > index 26f02847a2..3b42c99c2a 100644
> > --- a/drivers/net/mtk_eth.c
> > +++ b/drivers/net/mtk_eth.c
> > @@ -145,7 +145,8 @@ enum mtk_switch {
> >  enum mtk_soc {
> > SOC_MT7623,
> > SOC_MT7629,
> > -   SOC_MT7622
> > +   SOC_MT7622,
> > +   SOC_MT7621
> >  };
> > 
> >  struct mtk_eth_priv {
> > @@ -669,12 +670,18 @@ static int mt7530_pad_clk_setup(struct
> > mtk_eth_priv *priv, int mode)
> >  static int mt7530_setup(struct mtk_eth_priv *priv)
> >  {
> > u16 phy_addr, phy_val;
> > -   u32 val;
> > +   u32 val, txdrv;
> > int i;
> > 
> > -   /* Select 250MHz clk for RGMII mode */
> > -   mtk_ethsys_rmw(priv, ETHSYS_CLKCFG0_REG,
> > -  ETHSYS_TRGMII_CLK_SEL362_5, 0);
> > +   if (priv->soc != SOC_MT7621) {
> > +   /* Select 250MHz clk for RGMII mode */
> > +   mtk_ethsys_rmw(priv, ETHSYS_CLKCFG0_REG,
> > +  ETHSYS_TRGMII_CLK_SEL362_5, 0);
> > +
> > +   txdrv = 8;
> > +   } else {
> > +   txdrv = 4;
> > +   }
> > 
> > /* Modify HWTRAP first to allow direct access to internal
> > PHYs */
> > mt753x_reg_read(priv, HWTRAP_REG, &val);
> > @@ -732,7 +739,8 @@ static int mt7530_setup(struct mtk_eth_priv
> > *priv)
> > /* Lower Tx Driving for TRGMII path */
> > for (i = 0 ; i < NUM_TRGMII_CTRL ; i++)
> > mt753x_reg_write(priv, MT7530_TRGMII_TD_ODT(i),
> > -(8 << TD_DM_DRVP_S) | (8 <<
> > TD_DM_DRVN_S));
> > +(txdrv << TD_DM_DRVP_S) |
> > +(txdrv << TD_DM_DRVN_S));
> > 
> > for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
> > mt753x_reg_rmw(priv, MT7530_TRGMII_RD(i), RD_TAP_M,
> > 16);
> > @@ -1437,6 +1445,12 @@ static int mtk_eth_of_to_plat(struct udevice
> > *dev)
> > return -ENODEV;
> > }
> > 
> > +   if (priv->soc == SOC_MT7621) {
> > +   /* ioremap is needed for MIPS platform */
> 
> For MIPS ? you need to io map for every platform, some platform just
> works without it.

That's my mistake. The map_sysmem called by regmap_get_range is a dummy
function for both arm and mips. But for arm the virtual address in
u-boot is identical to the physical address and I didn't notice that.

I'll make ioremap unconditional.

> > +   priv->ethsys_base =
> > +   ioremap_nocache((phys_addr_t)priv-
> > >ethsys_base, 0x100);
> > +   }
> > +
> > /* Reset controllers */
> > ret = reset_get_by_name(dev, "fe", &priv->rst_fe);
> > if (ret) {
> > @@ -1542,6 +1556,7 @@ static const struct udevice_id mtk_eth_ids[]
> > = {
> > { .compatible = "mediatek,mt7629-eth", .data = SOC_MT7629
> > },
> > { .compatible = "mediatek,mt7623-eth", .data = SOC_MT7623
> > },
> > { .compatible = "mediatek,mt7622-eth", .data = SOC_MT7622
> > },
> > +   { .compatible = "mediatek,mt7621-eth", .data = SOC_MT7621
> > },
> > {}
> >  };
> > 
> > diff --git a/drivers/net/mtk_eth.h b/drivers/net/mtk_eth.h
> > index 057ecfaabf..4a8c66c671 100644
> > --- a/drivers/net/mtk_eth.h
> > +++ b/drivers/net/mtk_eth.h
> > @@ -412,4 +412,12 @@
> >  #define PHY_POWER_SAVING_M 0x300
> >  #define PHY_POWER_SAVING_TX0x0
> > 
> > +#ifndef CONFIG_SYS_NONCACHED_MEMORY
> > +/*
> > + * noncached_alloc is provided only for ARM. Add a prototype here
> > for other
> > + * platforms to suppress compilation warning.
> > + */
> > +phys_addr_t noncached_alloc(size_t size, size_t align);
> 
> That's not the place for that. I assume that it fails on MIPS, please
> create a patch for MIPS arch.
> 

OK. I'll create patches for MIPS

> > +#endif
> > +
> >  #endif /* _MTK_ETH_H_ */
> > --
> > 2.17.1
> > 

Re: [PATCH v2 0/2] env: setenv add resolve value option

2021-11-22 Thread Art Nikpal
On Sat, Nov 20, 2021 at 8:36 PM Wolfgang Denk  wrote:
>
> Dear Artem,
>
> In message 
>  you 
> wrote:
> >
> > next examples just demonstrate how its works for already defined env
> > variables which contain other variables (like storred env variables)
>
> Which next examples?

Usage examples (from commit message):

=> setenv a hello; setenv b world; setenv c '${a} ${b}'
=> setenv -r d '${c}! ${a}...'
=> printenv d
d=hello world! hello...

>
> > sure I know about this ! see my prev message please .
>
> Which exact message are you referring to here?
>
> > Why not have this new opportunity ?
>
> I think the suggested code is adding more problems than it solves.
>
> > > have in mind, as you speak of "deep resolve". But then, I'm first
> > > missing an explanation (and documentation) of what "deep resolve"
> >
> > recurrent  resolving for variables
>
> Your implementation of recursion has an arbiotrary and undocumented
> depth limit. Also, I cannot see a way to prevent resolving in case I
> want to keep something like "$foo" in the result.
>
> But that's to be expected from such a non-standard way.
>
> Why don't you stick with what "eval" in a standard shell does?
>
> > > actually means in this context, i. e. how many levels down you
> > > evaluat.   Oh...  the code has "int max_loop = 32;" - this is a
> >
> > i think its will be enough
>
> It is a reallybad habt to implement code with arbitrary limits, as
> it will blow into your face (or more likely that of an innocent
> user) rather sooner than later.  It's even worse that this limit is
> nowhere documented.
>
> > 1) this option did not broke any exist compatibilities
> > 2) there we talk not only about uboot shell, same time will be useful
> > to have env_resolve for internal c usage, because env_set dont have
> > this feature
>
> I did not say that an "eval" like construct would not be useful.
> But uncontrolled recursion with an undocumented depth limit is
> a problem.
>
> > yes i'm informed  about this plans  (and think its happens  not  so
> > soon - but i provide some simple elegant solution already)
> > but again we dont have env_resolve for internal c usage which must be
> > very useful
>
> On the CLI, we use the "run" command to get the desired effect. Yes,
> this is neither perfect nor elegant. But you can use that in C code
> as well.
>
> > will be easy get useful features via simple solution ( deep resolve
> > all vars by one line )
>
> I understand what you want, but this is not a good way to solve the
> problem.  I'd really rather see such efforts invested in helping
> Francis with the hush update - which will make such code unnecessary.
>
> 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
> Success in marriage is not so much finding the right person as it  is
> being the right person.


Re: [PATCH 5/6] Makefile: Add a pylint checker to the build

2021-11-22 Thread Heinrich Schuchardt

On 11/22/21 04:48, Simon Glass wrote:

At present the Python code in U-Boot is somewhat inconsistent, with some
files passing pylint quite cleanly and others not.

Add a way to track progress on this clean-up, by checking that no module
has got any worse as a result of changes.

This can be used with 'make pylint'.

Signed-off-by: Simon Glass 
---

  .gitignore|   4 +
  Makefile  |  45 +++-
  doc/develop/index.rst |   8 ++
  doc/develop/python_cq.rst |  80 +++
  scripts/pylint.base   | 211 ++
  5 files changed, 347 insertions(+), 1 deletion(-)
  create mode 100644 doc/develop/python_cq.rst
  create mode 100644 scripts/pylint.base

diff --git a/.gitignore b/.gitignore
index 35034de6556..28c439f09fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,3 +98,7 @@ __pycache__

  # Python code coverage output (python3-coverage html)
  /htmlcov/
+
+# pylint files
+/pylint.cur
+/pylint.out/
diff --git a/Makefile b/Makefile
index 338ae3341e6..ef2b0a853ea 100644
--- a/Makefile
+++ b/Makefile
@@ -521,7 +521,7 @@ env_h := include/generated/environment.h

  no-dot-config-targets := clean clobber mrproper distclean \
 help %docs check% coccicheck \
-ubootversion backup tests check qcheck tcheck
+ubootversion backup tests check qcheck tcheck pylint

  config-targets := 0
  mixed-targets  := 0
@@ -2239,6 +2239,48 @@ distclean: mrproper
-type f -print | xargs rm -f
@rm -f boards.cfg CHANGELOG

+# See doc/develop/python_cq.rst
+PHONY += pylint
+PYLINT_BASE := scripts/pylint.base
+PYLINT_CUR := pylint.cur
+PYLINT_DIFF := pylint.diff
+pylint:
+   $(Q)echo "Running pylint on all files (summary in $(PYLINT_CUR); output in 
pylint.out/)"
+   $(Q)mkdir -p pylint.out
+   $(Q)rm -f pylint.out/out*
+   $(Q)find tools test -name "*.py" \
+   | xargs -n1 -P$(shell nproc 2>/dev/null || echo 1) \
+   sh -c 'pylint --reports=y --exit-zero -f parseable 
--ignore-imports=yes $$@ > pylint.out/$$(echo $$@ | tr / _ | sed s/.py//)' _
+   $(Q)sed -n 's/Your code has been rated at \([-0-9.]*\).*/\1/p; s/\*\** 
Module \(.*\)/\1/p' pylint.out/* \
+   |sed '$!N;s/\n/ /' \
+   |sort > $(PYLINT_CUR)
+   $(Q)base=$$(mktemp) cur=$$(mktemp); cut -d' ' -f1 $(PYLINT_BASE) 
>$$base; \
+   cut -d' ' -f1 $(PYLINT_CUR) >$$cur; \
+   comm -3 $$base $$cur > $(PYLINT_DIFF); \
+   if [ -s $(PYLINT_DIFF) ]; then \
+   echo "Files have been added/removed. Try:\n\tcp 
$(PYLINT_CUR) $(PYLINT_BASE)"; \
+   echo; \
+   echo "Added files:"; \
+   comm -13 $$base $$cur; \
+   echo; \
+   echo "Removed files:"; \
+   comm -23 $$base $$cur; \
+   false; \
+   else \
+   rm $$base $$cur $(PYLINT_DIFF); \
+   fi
+   $(Q)bad=false; while read base_file base_val <&3 && read cur_file cur_val 
<&4; do \
+   if awk "BEGIN {exit !($$cur_val < $$base_val)}"; then \
+   echo "$$base_file: Score was $$base_val, now 
$$cur_val"; \
+   bad=true; fi; \
+   done 3<$(PYLINT_BASE) 4<$(PYLINT_CUR); \
+   if $$bad; then \
+   echo "Some files have regressed, please fix"; \
+   false; \
+   else \
+   echo "No pylint regressions"; \
+   fi
+


This is over-engineered.

./scripts/pylint.base would have to be updated after every patch. Who
will do this?

Deleting superfluous but (according to pylint) correct code lines may
decrease the score. This is not because any new errors where introduced
but because the number of errors per line increases. But such a change
should pass CI.

This needs to be fixed before adding this series.

Your test does not detect new Python units with abysmal code.

We should simply set a minimum score (>= 8) for all units including old
ones.

Best regards

Heinrich



  backup:
F=`basename $(srctree)` ; cd .. ; \
gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
@@ -2257,6 +2299,7 @@ help:
@echo  '  check   - Run all automated tests that use sandbox'
@echo  '  qcheck  - Run quick automated tests that use sandbox'
@echo  '  tcheck  - Run quick automated tests on tools'
+   @echo  '  pylint  - Run pylint on all Python files'
@echo  ''
@echo  'Other generic targets:'
@echo  '  all - Build all necessary images depending on 
configuration'
diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 9592d193fca..97a7f4ce14a 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.