Re: [PATCH v6 8/8] doc: uefi: Update the capsule update related documentation

2022-04-13 Thread Sughosh Ganu
On Wed, 13 Apr 2022 at 11:48, AKASHI Takahiro
 wrote:
>
> On Tue, Apr 12, 2022 at 06:34:47PM +0530, Sughosh Ganu wrote:
> > Update the capsule update functionality related documentation to
> > refect the additional definitions that need to be made per platform
> > for supporting the capsule update feature.
> >
> > Signed-off-by: Sughosh Ganu 
> > ---
> >
> > Changes since V5: None
> >
> >  doc/develop/uefi/uefi.rst | 51 +--
> >  1 file changed, 49 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> > index fe337c88bd..b766aecf67 100644
> > --- a/doc/develop/uefi/uefi.rst
> > +++ b/doc/develop/uefi/uefi.rst
> > @@ -312,8 +312,8 @@ Run the following command
> >  .. code-block:: console
> >
> >  $ mkeficapsule \
> > -  --index 1 --instance 0 \
> > -  [--fit  | --raw ] \
> > +  --index  --instance 0 \
> > +  --guid  \
> >
> >
> >  Performing the update
> > @@ -333,6 +333,53 @@ won't be taken over across the reboot. If this is the 
> > case, you can skip
> >  this feature check with the Kconfig option 
> > (CONFIG_EFI_IGNORE_OSINDICATIONS)
> >  set.
> >
> > +A few values need to be defined in the board file for performing the
> > +capsule update. These values are defined in the board file by
> > +initialisation of a structure which provides information needed for
> > +capsule updates. The following structures have been defined for
> > +containing the image related information
> > +
> > +.. code-block:: c
> > +
> > + struct efi_fw_images {
>
> Why "images" (in the plural)?

Hmm, since this is to be an array of firmware images which should be
handled by the capsule update code, I used a plural form. Do you
prefer efi_fw_image instead?

>
> > + efi_guid_t image_type_id;
> > + u16 *fw_name;
> > + u8 image_index;
> > + };
>
> Why not add "version" and "last_attempt_version" which is expected
> to be easily implemented in this structure.

It can be added to this structure, yes. But we will also need to add
code in the capsule driver to update these fields accordingly. I can
take this up as a follow up task once the FWU series upstreaming is
done.

>
>
> > + struct efi_capsule_update_info {
> > + const char *dfu_string;
> > + struct efi_fw_images *images;
> > + };
> > +
> > +
> > +A string is defined which is to be used for populating the
> > +dfu_alt_info variable. This string is used by the function
> > +set_dfu_alt_info. Instead of taking the variable from the environment,
> > +the capsule update feature requires that the variable be set through
> > +the function, since that is more robust. Allowing the user to change
> > +the location of the firmware updates is not a very secure
> > +practice. Getting this information from the firmware itself is more
> > +secure, assuming the firmware has been verified by a previous stage
> > +boot loader.
> > +
> > +The firmware images structure defines the GUID values, image index
> > +values and the name of the images that are to be updated through
> > +the capsule update feature. These values are to be defined as part of
> > +an array. These GUID values would be used by the Firmware Management
> > +Protocol(FMP) to populate the image descriptor array and also
> > +displayed as part of the ESRT table. The image index values defined in
> > +the array should be one greater than the dfu alt number that
> > +corresponds to the firmware image. So, if the dfu alt number for an
> > +image is 2, the value of image index in the fw_images array for that
> > +image should be 3. The dfu alt number can be obtained by running the
> > +following command::
> > +
> > +dfu list
> > +
> > +When using the FMP for FIT images, the image index value needs to be
> > +set to 1.
>
> The explanation would be correct, but it's not quite easy to understand,
> in particular, index in case of raw.
> You should add some examples here.

I have added an example above for the raw images, as to how the image
index corresponds with the dfu alt number. Does it not suffice?

-sughosh

>
> -Takahiro Akashi
>
> > +
> >  Finally, the capsule update can be initiated by rebooting the board.
> >
> >  Enabling Capsule Authentication
> > --
> > 2.25.1
> >


Re: [PATCH] misc: Port USB251xB/xBi Hi-Speed Hub Controller Driver from Linux

2022-04-13 Thread Michal Simek




On 4/10/22 06:27, Marek Vasut wrote:

This patch adds a driver for configuration of the Microchip USB251xB/xBi
USB 2.0 hub controller series with USB 2.0 upstream connectivity, SMBus
configuration interface and two to four USB 2.0 downstream ports.

This is ported from Linux as of Linux kernel commit
5c2b9c61ae5d8 ("usb: usb251xb: add boost-up property support")


The patch is aligned with kernel as you said but I expect this hub will be 
described on i2c bus which is based on

https://lore.kernel.org/all/cal_jsqjedhx6typpukbnzv7clk6uzvjq3cyg9iy_j5dlpqv...@mail.gmail.com/

not where Rob would like to see ends.

It is not a problem with the patch from my point of view I just wanted to let 
you know that based on him it should be handled differently.


Thanks,
Michal


Re: [PATCH v1 19/24] colibri-imx6ull: fix nand bch geometry

2022-04-13 Thread Stefano Babic

Hi Marcel,

On 08.04.22 10:24, Marcel Ziswiler wrote:

Subject: [PATCH v1 19/24] colibri-imx6ull: fix nand bch geometry
Date: Fri,  8 Apr 2022 10:07:14 +0200
Message-Id: <20220408080719.342072-20-mar...@ziswiler.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20220408080719.342072-1-mar...@ziswiler.com>
References: <20220408080719.342072-1-mar...@ziswiler.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Result: 250
(mbox) Adding cc: Marcel Ziswiler  from line 
'From: Marcel Ziswiler

'

(body) Adding cc: Marcel Ziswiler  from line 
'Signed-off-by: Marcel Ziswiler

'

(cc-cmd) Adding cc: Marcel Ziswiler  from: 
'tools/patman/patman send --cc-cmd

/tmp/patman.341838'

(cc-cmd) Adding cc: u-boot@lists.denx.de from: 'tools/patman/patman send 
--cc-cmd /tmp/patman.341838'
Requested action aborted
Mails per session limit exceeded.


Hehe, looks like I hit some arbitrary email limit somewhere. Let me figure out 
how I may send the last 5
patches...


Well, I tried to reduce the number...for next time ! ;-)

I have applied just a few (quite orthogonal) of them, but due to other 
patches I merged I get conflicts. Could you rebase on top of u-boot-imx 
and then repost ? Thanks !


Best regards,
Stefano


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


Re: [PATCH v6 8/8] doc: uefi: Update the capsule update related documentation

2022-04-13 Thread AKASHI Takahiro
On Wed, Apr 13, 2022 at 12:38:05PM +0530, Sughosh Ganu wrote:
> On Wed, 13 Apr 2022 at 11:48, AKASHI Takahiro
>  wrote:
> >
> > On Tue, Apr 12, 2022 at 06:34:47PM +0530, Sughosh Ganu wrote:
> > > Update the capsule update functionality related documentation to
> > > refect the additional definitions that need to be made per platform
> > > for supporting the capsule update feature.
> > >
> > > Signed-off-by: Sughosh Ganu 
> > > ---
> > >
> > > Changes since V5: None
> > >
> > >  doc/develop/uefi/uefi.rst | 51 +--
> > >  1 file changed, 49 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> > > index fe337c88bd..b766aecf67 100644
> > > --- a/doc/develop/uefi/uefi.rst
> > > +++ b/doc/develop/uefi/uefi.rst
> > > @@ -312,8 +312,8 @@ Run the following command
> > >  .. code-block:: console
> > >
> > >  $ mkeficapsule \
> > > -  --index 1 --instance 0 \
> > > -  [--fit  | --raw ] \
> > > +  --index  --instance 0 \
> > > +  --guid  \
> > >
> > >
> > >  Performing the update
> > > @@ -333,6 +333,53 @@ won't be taken over across the reboot. If this is 
> > > the case, you can skip
> > >  this feature check with the Kconfig option 
> > > (CONFIG_EFI_IGNORE_OSINDICATIONS)
> > >  set.
> > >
> > > +A few values need to be defined in the board file for performing the
> > > +capsule update. These values are defined in the board file by
> > > +initialisation of a structure which provides information needed for
> > > +capsule updates. The following structures have been defined for
> > > +containing the image related information
> > > +
> > > +.. code-block:: c
> > > +
> > > + struct efi_fw_images {
> >
> > Why "images" (in the plural)?
> 
> Hmm, since this is to be an array of firmware images which should be
> handled by the capsule update code, I used a plural form. Do you
> prefer efi_fw_image instead?

This structure (not a variable like struct efi_fw_image foo_images[])
can only hold/represent one firmware image, right?
If so, efi_fw_image looks better.

> >
> > > + efi_guid_t image_type_id;
> > > + u16 *fw_name;
> > > + u8 image_index;
> > > + };
> >
> > Why not add "version" and "last_attempt_version" which is expected
> > to be easily implemented in this structure.
> 
> It can be added to this structure, yes. But we will also need to add
> code in the capsule driver to update these fields accordingly. I can
> take this up as a follow up task once the FWU series upstreaming is
> done.
> 
> >
> >
> > > + struct efi_capsule_update_info {
> > > + const char *dfu_string;
> > > + struct efi_fw_images *images;
> > > + };
> > > +
> > > +
> > > +A string is defined which is to be used for populating the
> > > +dfu_alt_info variable. This string is used by the function
> > > +set_dfu_alt_info. Instead of taking the variable from the environment,
> > > +the capsule update feature requires that the variable be set through
> > > +the function, since that is more robust. Allowing the user to change
> > > +the location of the firmware updates is not a very secure
> > > +practice. Getting this information from the firmware itself is more
> > > +secure, assuming the firmware has been verified by a previous stage
> > > +boot loader.
> > > +
> > > +The firmware images structure defines the GUID values, image index
> > > +values and the name of the images that are to be updated through
> > > +the capsule update feature. These values are to be defined as part of
> > > +an array. These GUID values would be used by the Firmware Management
> > > +Protocol(FMP) to populate the image descriptor array and also
> > > +displayed as part of the ESRT table. The image index values defined in
> > > +the array should be one greater than the dfu alt number that
> > > +corresponds to the firmware image. So, if the dfu alt number for an
> > > +image is 2, the value of image index in the fw_images array for that
> > > +image should be 3. The dfu alt number can be obtained by running the
> > > +following command::
> > > +
> > > +dfu list
> > > +
> > > +When using the FMP for FIT images, the image index value needs to be
> > > +set to 1.
> >
> > The explanation would be correct, but it's not quite easy to understand,
> > in particular, index in case of raw.
> > You should add some examples here.
> 
> I have added an example above for the raw images, as to how the image
> index corresponds with the dfu alt number. Does it not suffice?

I hope that it will cover not only index, but example arrays of
struct efi_fw_image and struct efi_capsule_update_info
as well as an example "dfu_alto_info".

-Takahiro Akashi

> -sughosh
> 
> >
> > -Takahiro Akashi
> >
> > > +
> > >  Finally, the capsule update can be initiated by rebooting the board.
> > >
> > >  Enabling Capsule Authentication
> > > --
> > > 2.25.1
> > >


Re: [PATCH V2 19/26] imx: imx8ulp_evk: Power down the domains may used in u-boot

2022-04-13 Thread Stefano Babic

Hi Peng,

On 13.04.22 05:00, Peng Fan (OSS) wrote:

Hi Stefano,

On 2022/4/13 1:10, Stefano Babic wrote:

Hi Peng,Ye,

On 06.04.22 08:30, Peng Fan (OSS) wrote:

From: Ye Li 

Since ATF power domain will hold the enable counter for each power 
domain,

We need to power off them before entering kernel to avoid this
power domain can't be really powered off.

Signed-off-by: Ye Li 
Signed-off-by: Peng Fan 
---
   board/freescale/imx8ulp_evk/imx8ulp_evk.c | 30 
+++

   1 file changed, 30 insertions(+)

diff --git a/board/freescale/imx8ulp_evk/imx8ulp_evk.c 
b/board/freescale/imx8ulp_evk/imx8ulp_evk.c

index b61a4cfbe8d..1bd308148f3 100644
--- a/board/freescale/imx8ulp_evk/imx8ulp_evk.c
+++ b/board/freescale/imx8ulp_evk/imx8ulp_evk.c
@@ -13,6 +13,8 @@
   #include 
   #include 
   #include 
+#include 
+#include 


But which patch is adding the file above ? I cannot find it, it is not
part of this series and of course build is broken without it.


V5 patchset should not have such issue. I just see you already picked up 
V5 in your repo.




Which series are you talking about ? This series is in V2, and yes, I 
merged the whole series with the exception of this patch, but none of 
the applied patches added imx8ulp-power.h.


Regards,
Stefano


Thanks,
Peng.



Best regards,
Stefano


   DECLARE_GLOBAL_DATA_PTR;
@@ -129,3 +131,31 @@ int board_late_init(void)
   {
   return 0;
   }
+
+void board_quiesce_devices(void)
+{
+    /* Disable the power domains may used in u-boot before entering 
kernel */

+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
+    struct udevice *scmi_devpd;
+    int ret, i;
+    struct power_domain pd;
+    ulong ids[] = { IMX8ULP_PD_FLEXSPI2, IMX8ULP_PD_USB0, 
IMX8ULP_PD_USDHC0,
+    IMX8ULP_PD_USDHC1, IMX8ULP_PD_USDHC2_USB1, 
IMX8ULP_PD_DCNANO,

+    IMX8ULP_PD_MIPI_DSI };
+
+    ret = uclass_get_device(UCLASS_POWER_DOMAIN, 0, &scmi_devpd);
+    if (ret) {
+    printf("Cannot get scmi devpd: err=%d\n", ret);
+    return;
+    }
+
+    pd.dev = scmi_devpd;
+
+    for (i = 0; i < ARRAY_SIZE(ids); i++) {
+    pd.id = ids[i];
+    ret = power_domain_off(&pd);
+    if (ret)
+    printf("power_domain_off %lu failed: err=%d\n", ids[i], 
ret);

+    }
+#endif
+}





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


Re: [PATCH v2] ARM: imx: Enable instruction cache early on on i.MX8M

2022-04-13 Thread Stefano Babic

On 13.04.22 00:41, Marek Vasut wrote:

Enable instruction cache early on to speed up the boot process on i.MX8M.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
V2: Protect the icache_enable with !CONFIG_IS_ENABLED(SYS_ICACHE_OFF),
 the symbol might be undefined in case CONFIG_(SPL_)SYS_ICACHE_OFF
 is set
---
  arch/arm/mach-imx/imx8m/soc.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index bb94ef51492..8171631db10 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -550,6 +550,11 @@ EVENT_SPY(EVT_DM_POST_INIT, imx8m_check_clock);
  int arch_cpu_init(void)
  {
struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+
+#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
+   icache_enable();
+#endif
+
/*
 * ROM might disable clock for SCTR,
 * enable the clock before timer_init.


Thanks for fast fix - I apply this before my PR.

Regards,
Stefano

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


Re: [PATCH v1 19/24] colibri-imx6ull: fix nand bch geometry

2022-04-13 Thread Marcel Ziswiler
Hi Stefano

On Wed, 2022-04-13 at 09:32 +0200, Stefano Babic wrote:
> Hi Marcel,
> 
> On 08.04.22 10:24, Marcel Ziswiler wrote:
> > > Subject: [PATCH v1 19/24] colibri-imx6ull: fix nand bch geometry
> > > Date: Fri,  8 Apr 2022 10:07:14 +0200
> > > Message-Id: <20220408080719.342072-20-mar...@ziswiler.com>
> > > X-Mailer: git-send-email 2.34.1
> > > In-Reply-To: <20220408080719.342072-1-mar...@ziswiler.com>
> > > References: <20220408080719.342072-1-mar...@ziswiler.com>
> > > MIME-Version: 1.0
> > > Content-Transfer-Encoding: 8bit
> > > 
> > > Result: 250
> > > (mbox) Adding cc: Marcel Ziswiler  from line 
> > > 'From: Marcel Ziswiler
> > '
> > > (body) Adding cc: Marcel Ziswiler  from line 
> > > 'Signed-off-by: Marcel Ziswiler
> > '
> > > (cc-cmd) Adding cc: Marcel Ziswiler  from: 
> > > 'tools/patman/patman send --cc-
> > > cmd
> > /tmp/patman.341838'
> > > (cc-cmd) Adding cc: u-boot@lists.denx.de from: 'tools/patman/patman send 
> > > --cc-cmd /tmp/patman.341838'
> > > Requested action aborted
> > > Mails per session limit exceeded.
> > 
> > Hehe, looks like I hit some arbitrary email limit somewhere. Let me figure 
> > out how I may send the last 5
> > patches...
> 
> Well, I tried to reduce the number...for next time ! ;-)

Thanks! Yeah, 50 % applied, not too bad (;-p).

> I have applied just a few (quite orthogonal) of them, but due to other 
> patches I merged I get conflicts. Could you rebase on top of u-boot-imx 
> and then repost ? Thanks !

Okay, yeah. I just noticed that now. Sure, let me rebase/repost, no biggy.

And thanks for picking up on it again!

> Best regards,
> Stefano

Cheers

Marcel


Re: [PATCH 1/2] Kconfig: Change SYS_MALLOC_F_LEN default to 0x2000

2022-04-13 Thread Kristian Amlie

For vexpress_ca9x4_defconfig:

Reviewed-by: Kristian Amlie 

--
Kristian


On 07/04/2022 18:33, Tom Rini wrote:

The most commonly used value today is 0x2000 and not 0x400.  Rework the
Kconfig logic to use this more frequently used value as the default.

Cc: Andrew F. Davis 
Cc: Alex Nemirovsky 
Cc: Alexey Brodkin 
Cc: Alison Wang 
Cc: Anastasiia Lukianenko 
Cc: Andes 
Cc: Andre Przywara 
Cc: Bharat Gooty 
Cc: David Lechner 
Cc: Dzmitry Sankouski 
Cc: Enric Balletbo i Serra 
Cc: Eugeniy Paltsev 
Cc: Fabio Estevam 
Cc: Gerald Kerma 
Cc: Gregory CLEMENT 
Cc: Holger Brunck 
Cc: Jaehoon Chung 
Cc: Jassi Brar 
Cc: Kristian Amlie 
Cc: Krzysztof Kozlowski 
Cc: Liviu Dudau 
Cc: Luka Perkov 
Cc: Lukasz Majewski 
Cc: Marek Vasut 
Cc: Masami Hiramatsu 
Cc: Matthias Brugger 
Cc: Max Filippov 
Cc: Michael Walle 
Cc: Michal Simek 
Cc: Minkyu Kang 
Cc: Nikita Kiryanov 
Cc: Nobuhiro Iwamatsu 
Cc: Oleksandr Andrushchenko 
Cc: Otavio Salvador 
Cc: Patrice Chotard 
Cc: Paul Burton 
Cc: Paul Kocialkowski 
Cc: Priyanka Jain 
Cc: Rajesh Bhagat 
Cc: Rayagonda Kokatanur 
Cc: Sergey Temerkhanov 
Cc: Simon Glass 
Cc: Stefan Bosch 
Cc: Stephan Gerhold 
Cc: Tetsuyuki Kobayashi 
Cc: Thomas Chou 
Cc: Thomas Fitzsimmons 
Cc: Thomas Weber 
Cc: Tony Dinh 
Cc: Trevor Woerner 
Cc: Vitaly Andrianov 
Cc: Vladimir Zapolskiy 
Cc: liuhao 
Cc: lixinde 
Cc: shuyiqi 
Cc: weichangzheng 
Signed-off-by: Tom Rini 
---
To make this patch more reviewable, I've omitted the defconfigs where
the in-use value is now the default value.  I've cc'd so many
maintainers however as a frequent issue when enabling more DM migrations
is SYS_MALLOC_F_LEN being too small and 0x400 not being enough and
something like 0x2000 being more reasonable, especially on platforms
that can otherwise easily handle a little more memory usage.
---
  Kconfig   | 9 +++--
  configs/10m50_defconfig   | 1 +
  configs/3c120_defconfig   | 1 +
  configs/a3y17lte_defconfig| 1 +
  configs/a5y17lte_defconfig| 1 +
  configs/a7y17lte_defconfig| 1 +
  configs/adp-ae3xx_defconfig   | 1 +
  configs/adp-ag101p_defconfig  | 1 +
  configs/am43xx_evm_qspiboot_defconfig | 1 +
  configs/armadillo-800eva_defconfig| 1 +
  configs/arndale_defconfig | 1 +
  configs/axs101_defconfig  | 1 +
  configs/axs103_defconfig  | 1 +
  configs/bcm7260_defconfig | 1 +
  configs/bcm7445_defconfig | 1 +
  configs/bcm_ns3_defconfig | 1 +
  configs/boston32r2_defconfig  | 1 +
  configs/boston32r2el_defconfig| 1 +
  configs/boston32r6_defconfig  | 1 +
  configs/boston32r6el_defconfig| 1 +
  configs/boston64r2_defconfig  | 1 +
  configs/boston64r2el_defconfig| 1 +
  configs/boston64r6_defconfig  | 1 +
  configs/boston64r6el_defconfig| 1 +
  configs/cm_t43_defconfig  | 1 +
  configs/cortina_presidio-asic-base_defconfig  | 1 +
  configs/cortina_presidio-asic-emmc_defconfig  | 1 +
  configs/cortina_presidio-asic-pnand_defconfig | 1 +
  configs/devkit3250_defconfig  | 1 +
  configs/devkit8000_defconfig  | 1 +
  configs/durian_defconfig  | 1 +
  configs/ea-lpc3250devkitv2_defconfig  | 1 +
  configs/emsdp_defconfig   | 1 +
  configs/grpeach_defconfig | 1 +
  configs/gurnard_defconfig | 1 +
  configs/highbank_defconfig| 1 +
  configs/hsdk_4xd_defconfig| 1 +
  configs/hsdk_defconfig| 1 +
  configs/igep00x0_defconfig| 1 +
  configs/iot_devkit_defconfig  | 1 +
  configs/k2e_evm_defconfig | 1 +
  configs/k2e_hs_evm_defconfig  | 1 +
  configs/k2g_evm_defconfig | 1 +
  configs/k2g_hs_evm_defconfig  | 1 +
  configs/k2hk_evm_defconfig| 1 +
  configs/k2hk_hs_evm_defconfig | 1 +
  configs/k2l_evm_defconfig | 1 +
  configs/k2l_hs_evm_defconfig  | 1 +
  configs/km_kirkwood_128m16_defconfig  | 1 +
  configs/km_kirkwood_defconfig | 1 +
  configs/km_kirkwood_pci_defconfig | 1 +
  configs/kmcoge5un_defconfig   | 1 +
  configs/kmnusa_defconfig  | 1 +
  configs/kmsuse2_defconfig | 1 +
  configs/kzm9g_defconfig   | 1 +
  configs/legoev3_defconfig | 1 +
  configs/ls2080aqds_nand_defconfig | 1 +
  configs/ls2080aqds_qspi_defconfig | 1 +
  configs/ls2080aqds_sdcard_defconfig   | 1 +
  c

Re: [PATCH v6 8/8] doc: uefi: Update the capsule update related documentation

2022-04-13 Thread Masami Hiramatsu
Hi

2022年4月13日(水) 16:33 AKASHI Takahiro :
>
> On Wed, Apr 13, 2022 at 12:38:05PM +0530, Sughosh Ganu wrote:
> > On Wed, 13 Apr 2022 at 11:48, AKASHI Takahiro
> >  wrote:
> > >
> > > On Tue, Apr 12, 2022 at 06:34:47PM +0530, Sughosh Ganu wrote:
> > > > Update the capsule update functionality related documentation to
> > > > refect the additional definitions that need to be made per platform
> > > > for supporting the capsule update feature.
> > > >
> > > > Signed-off-by: Sughosh Ganu 
> > > > ---
> > > >
> > > > Changes since V5: None
> > > >
> > > >  doc/develop/uefi/uefi.rst | 51 +--
> > > >  1 file changed, 49 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> > > > index fe337c88bd..b766aecf67 100644
> > > > --- a/doc/develop/uefi/uefi.rst
> > > > +++ b/doc/develop/uefi/uefi.rst
> > > > @@ -312,8 +312,8 @@ Run the following command
> > > >  .. code-block:: console
> > > >
> > > >  $ mkeficapsule \
> > > > -  --index 1 --instance 0 \
> > > > -  [--fit  | --raw ] \
> > > > +  --index  --instance 0 \
> > > > +  --guid  \
> > > >
> > > >
> > > >  Performing the update
> > > > @@ -333,6 +333,53 @@ won't be taken over across the reboot. If this is 
> > > > the case, you can skip
> > > >  this feature check with the Kconfig option 
> > > > (CONFIG_EFI_IGNORE_OSINDICATIONS)
> > > >  set.
> > > >
> > > > +A few values need to be defined in the board file for performing the
> > > > +capsule update. These values are defined in the board file by
> > > > +initialisation of a structure which provides information needed for
> > > > +capsule updates. The following structures have been defined for
> > > > +containing the image related information
> > > > +
> > > > +.. code-block:: c
> > > > +
> > > > + struct efi_fw_images {
> > >
> > > Why "images" (in the plural)?
> >
> > Hmm, since this is to be an array of firmware images which should be
> > handled by the capsule update code, I used a plural form. Do you
> > prefer efi_fw_image instead?
>
> This structure (not a variable like struct efi_fw_image foo_images[])
> can only hold/represent one firmware image, right?
> If so, efi_fw_image looks better.
>
> > >
> > > > + efi_guid_t image_type_id;
> > > > + u16 *fw_name;
> > > > + u8 image_index;
> > > > + };
> > >
> > > Why not add "version" and "last_attempt_version" which is expected
> > > to be easily implemented in this structure.
> >
> > It can be added to this structure, yes. But we will also need to add
> > code in the capsule driver to update these fields accordingly. I can
> > take this up as a follow up task once the FWU series upstreaming is
> > done.
> >
> > >
> > >
> > > > + struct efi_capsule_update_info {
> > > > + const char *dfu_string;
> > > > + struct efi_fw_images *images;
> > > > + };
> > > > +
> > > > +
> > > > +A string is defined which is to be used for populating the
> > > > +dfu_alt_info variable. This string is used by the function
> > > > +set_dfu_alt_info. Instead of taking the variable from the environment,
> > > > +the capsule update feature requires that the variable be set through
> > > > +the function, since that is more robust. Allowing the user to change
> > > > +the location of the firmware updates is not a very secure
> > > > +practice. Getting this information from the firmware itself is more
> > > > +secure, assuming the firmware has been verified by a previous stage
> > > > +boot loader.
> > > > +
> > > > +The firmware images structure defines the GUID values, image index
> > > > +values and the name of the images that are to be updated through
> > > > +the capsule update feature. These values are to be defined as part of
> > > > +an array. These GUID values would be used by the Firmware Management
> > > > +Protocol(FMP) to populate the image descriptor array and also
> > > > +displayed as part of the ESRT table. The image index values defined in
> > > > +the array should be one greater than the dfu alt number that
> > > > +corresponds to the firmware image. So, if the dfu alt number for an
> > > > +image is 2, the value of image index in the fw_images array for that
> > > > +image should be 3. The dfu alt number can be obtained by running the
> > > > +following command::
> > > > +
> > > > +dfu list
> > > > +
> > > > +When using the FMP for FIT images, the image index value needs to be
> > > > +set to 1.
> > >
> > > The explanation would be correct, but it's not quite easy to understand,
> > > in particular, index in case of raw.
> > > You should add some examples here.
> >
> > I have added an example above for the raw images, as to how the image
> > index corresponds with the dfu alt number. Does it not suffice?
>
> I hope that it will cover not only index, but example arrays of
> struct efi_fw_image and struct efi_capsule_update_info
> as well as an example "dfu_alto_info".


Re: [PATCH 1/2] board: gateworks: venice: add additional levels for dtb name match

2022-04-13 Thread Stefano Babic

Hi Tim,

(quite unrelated to this series): after applying tons of patches, there 
are a list that are obsolete and need to be rebased. I applied several 
of the patches you sent, some have open issues, some cannot be applied 
(as this series), as they depend on other patches too.


I would appreciate if you can check what is missing for Gateworks, and 
then repost on top of u-boot-imx (or you wait my PR to Tom, I will send 
it today).


Thanks,
Stefano

On 09.04.22 00:14, Tim Harvey wrote:

Gateworks produces many products from a single PCB with subloaded
components. Add an additional two levels of dtb name matching so that
for example a GW7400-A matches the dtb name of gw74xx.dtb

Signed-off-by: Tim Harvey 
---
  board/gateworks/venice/eeprom.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/board/gateworks/venice/eeprom.c b/board/gateworks/venice/eeprom.c
index 62b8125960c7..282d55f2ae30 100644
--- a/board/gateworks/venice/eeprom.c
+++ b/board/gateworks/venice/eeprom.c
@@ -259,8 +259,16 @@ const char *eeprom_get_dtb_name(int level, char *buf, int 
sz)
break;
case 2: /* don't care about PCB or BOM revision */
break;
+   case 3: /* don't care about last digit of model */
+   buf[strlen(buf) - 1] = 'x';
+   break;
+   case 4: /* don't care about last two digits of model */
+   buf[strlen(buf) - 1] = 'x';
+   buf[strlen(buf) - 2] = 'x';
+   break;
default:
return NULL;
+   break;
}
}
  



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


Re: [PATCH v6 5/8] test: capsule: Modify the capsule tests to use GUID values for sandbox

2022-04-13 Thread Sughosh Ganu
On Wed, 13 Apr 2022 at 12:05, AKASHI Takahiro
 wrote:
>
> On Tue, Apr 12, 2022 at 06:34:44PM +0530, Sughosh Ganu wrote:
> > The current UEFI capsule updation code uses two GUID values, one for
> > FIT images, and one for raw images across platforms. This logic is
> > being changed to have GUID values per image, per platform. Change the
> > tests for the capsule update code to reflect this change. The GUID
> > values now used are the ones specific to the sandbox platform -- one
> > for the u-boot image, and another for the u-boot environment image.
> >
> > Install the FMP instance for raw images on the sandbox variant for
> > testing the capsule update code. Install the FMP instance for the FIT
> > images on the sandbox64 and sandbox_flattree variant for testing
> > capsule update for FIT images. This is being done by splitting the
> > capsule update script for FIT and raw images.
>
> Why do we have to have different configs to test FIT and RAW capsules?

With the current design, we have an FMP instance per platform. But the
struct efi_fw_images can be extended to have a fmp member, so every
image would have an FMP instance associated with it. With that, a
platform can define multiple FMP instances. Would you prefer that?

>
> > Signed-off-by: Sughosh Ganu 
> > ---
> >
> > Changes since V5:
> > * Restart the platform before starting the tests. This is done to
> >   clear out any stale state from a previously run test.
> >
> >
> >  configs/sandbox64_defconfig   |   1 -
> >  configs/sandbox_defconfig |   1 -
> >  configs/sandbox_flattree_defconfig|   5 +
> >  test/py/tests/test_efi_capsule/conftest.py|  21 +-
> >  .../test_capsule_firmware_fit.py  | 191 ++
> >  ...rmware.py => test_capsule_firmware_raw.py} | 167 ++-
> >  6 files changed, 270 insertions(+), 116 deletions(-)
> >  create mode 100644 
> > test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py
> >  rename test/py/tests/test_efi_capsule/{test_capsule_firmware.py => 
> > test_capsule_firmware_raw.py} (75%)
> >
> > diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
> > index 88f9ecbb7f..db748bbed3 100644
> > --- a/configs/sandbox64_defconfig
> > +++ b/configs/sandbox64_defconfig
> > @@ -246,7 +246,6 @@ CONFIG_ERRNO_STR=y
> >  CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
> >  CONFIG_EFI_CAPSULE_ON_DISK=y
> >  CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
> > -CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
> >  CONFIG_EFI_SECURE_BOOT=y
> >  CONFIG_TEST_FDTDEC=y
> >  CONFIG_UNIT_TEST=y
> > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> > index cb8d590eb6..0dfc2d863d 100644
> > --- a/configs/sandbox_defconfig
> > +++ b/configs/sandbox_defconfig
> > @@ -319,7 +319,6 @@ CONFIG_SHA384=y
> >  CONFIG_ERRNO_STR=y
> >  CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
> >  CONFIG_EFI_CAPSULE_ON_DISK=y
> > -CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
> >  CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
> >  CONFIG_EFI_SECURE_BOOT=y
> >  CONFIG_TEST_FDTDEC=y
> > diff --git a/configs/sandbox_flattree_defconfig 
> > b/configs/sandbox_flattree_defconfig
> > index 24b272068a..27dd38a0c0 100644
> > --- a/configs/sandbox_flattree_defconfig
> > +++ b/configs/sandbox_flattree_defconfig
> > @@ -28,6 +28,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y
> >  CONFIG_CMD_ASKENV=y
> >  CONFIG_CMD_GREPENV=y
> >  CONFIG_CMD_ERASEENV=y
> > +CONFIG_CMD_NVEDIT_EFI=y
> >  CONFIG_CMD_NVEDIT_INFO=y
> >  CONFIG_CMD_NVEDIT_LOAD=y
> >  CONFIG_CMD_NVEDIT_SELECT=y
> > @@ -209,3 +210,7 @@ CONFIG_HEXDUMP=y
> >  CONFIG_UNIT_TEST=y
> >  CONFIG_UT_TIME=y
> >  CONFIG_UT_DM=y
> > +CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
> > +CONFIG_EFI_CAPSULE_ON_DISK=y
> > +CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
> > +CONFIG_DFU_SF=y
> > diff --git a/test/py/tests/test_efi_capsule/conftest.py 
> > b/test/py/tests/test_efi_capsule/conftest.py
> > index 9076087a12..d757415c88 100644
> > --- a/test/py/tests/test_efi_capsule/conftest.py
> > +++ b/test/py/tests/test_efi_capsule/conftest.py
> > @@ -72,7 +72,7 @@ def efi_capsule_data(request, u_boot_config):
> >
> >  # Create capsule files
> >  # two regions: one for u-boot.bin and the other for u-boot.env
> > -check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n 
> > u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old -> u-boot.env.old; echo 
> > -n u-boot-env:New > u-boot.env.new' % data_dir,
> > +check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n 
> > u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old > u-boot.env.old; echo 
> > -n u-boot-env:New > u-boot.env.new' % data_dir,
> > shell=True)
> >  check_call('sed -e \"s?BINFILE1?u-boot.bin.new?\" -e 
> > \"s?BINFILE2?u-boot.env.new?\" 
> > %s/test/py/tests/test_efi_capsule/uboot_bin_env.its > %s/uboot_bin_env.its' 
> > %
> > (u_boot_config.source_dir, data_dir),
> > @@ -80,21 +80,29 @@ def efi_capsule_data(request, u_boot_config):
> >  check_call('cd %s; %s/tools/mki

[PATCH V4 2/6] arch: arm: move COUNTER_FREQUENCY from versal to arm

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

Make COUNTER_FREQUENCY usable to armv8 and armv7-a, not limited to
versal. And update help message.

Signed-off-by: Peng Fan 
---
 arch/arm/Kconfig | 12 
 arch/arm/mach-versal/Kconfig |  6 --
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6771f14b105..d77186b77b4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -19,6 +19,18 @@ config ARM64_CRC32
  not be present on all ARMv8.0, but is always present on ARMv8.1 and
  newer.
 
+config COUNTER_FREQUENCY
+   int "Timer clock frequency"
+   depends on ARM64 || CPU_V7A
+   default 0
+   help
+ For platforms with ARMv8-A and ARMv7-A which features a system
+ counter, those platforms needs software to program the counter
+ frequency. Setup time clock frequency for certain platform.
+ 0 means no need to configure the system counter frequency.
+ For platforms needs the frequency set in U-Boot with a
+ pre-defined value, should have the macro defined as a non-zero value.
+
 config POSITION_INDEPENDENT
bool "Generate position-independent pre-relocation code"
depends on ARM64 || CPU_V7A
diff --git a/arch/arm/mach-versal/Kconfig b/arch/arm/mach-versal/Kconfig
index 0c6ad345ffd..645f06add44 100644
--- a/arch/arm/mach-versal/Kconfig
+++ b/arch/arm/mach-versal/Kconfig
@@ -24,12 +24,6 @@ config SYS_CONFIG_NAME
 config SYS_MALLOC_LEN
default 0x200
 
-config COUNTER_FREQUENCY
-   int "Timer clock frequency"
-   default 0
-   help
- Setup time clock frequency for certain platform
-
 config ZYNQ_SDHCI_MAX_FREQ
default 2
 
-- 
2.35.1



Re: [PATCH V4 6/6] arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid

2022-04-13 Thread Philipp Tomsich
On Wed, 13 Apr 2022 at 11:07, Peng Fan (OSS)  wrote:
>
> From: Peng Fan 
>
> Since COUNTER_FREQUENCY is obselete, so set cntfrq_el0 if
> CONFIG_COUNTER_FREQUENCY is valid
>
> Signed-off-by: Peng Fan 

Reviewed-by: Philipp Tomsich 


[PATCH V4 6/6] arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

Since COUNTER_FREQUENCY is obselete, so set cntfrq_el0 if
CONFIG_COUNTER_FREQUENCY is valid

Signed-off-by: Peng Fan 
---
 arch/arm/cpu/armv7/ls102xa/psci.S | 2 +-
 arch/arm/cpu/armv7/ls102xa/timer.c| 2 +-
 arch/arm/cpu/armv7/nonsec_virt.S  | 4 ++--
 arch/arm/cpu/armv7/sunxi/psci.c   | 2 +-
 arch/arm/cpu/armv8/start.S| 4 ++--
 arch/arm/mach-rockchip/rk3036-board-spl.c | 2 +-
 arch/arm/mach-rockchip/spl.c  | 2 +-
 arch/arm/mach-rockchip/tpl.c  | 2 +-
 board/sunxi/board.c   | 6 +++---
 9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/cpu/armv7/ls102xa/psci.S 
b/arch/arm/cpu/armv7/ls102xa/psci.S
index 531cfb033bc..3956178369f 100644
--- a/arch/arm/cpu/armv7/ls102xa/psci.S
+++ b/arch/arm/cpu/armv7/ls102xa/psci.S
@@ -36,7 +36,7 @@
 
.align  5
 
-#defineONE_MS  (COUNTER_FREQUENCY / 1000)
+#defineONE_MS  (CONFIG_COUNTER_FREQUENCY / 1000)
 #defineRESET_WAIT  (30 * ONE_MS)
 
 .globl psci_version
diff --git a/arch/arm/cpu/armv7/ls102xa/timer.c 
b/arch/arm/cpu/armv7/ls102xa/timer.c
index d79bf105f13..c6126b10c35 100644
--- a/arch/arm/cpu/armv7/ls102xa/timer.c
+++ b/arch/arm/cpu/armv7/ls102xa/timer.c
@@ -65,7 +65,7 @@ int timer_init(void)
/* Enable System Counter */
writel(SYS_COUNTER_CTRL_ENABLE, &sctr->cntcr);
 
-   freq = COUNTER_FREQUENCY;
+   freq = CONFIG_COUNTER_FREQUENCY;
asm("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
 
/* Set PL1 Physical Timer Ctrl */
diff --git a/arch/arm/cpu/armv7/nonsec_virt.S b/arch/arm/cpu/armv7/nonsec_virt.S
index 1773fae205c..39aeeb423f0 100644
--- a/arch/arm/cpu/armv7/nonsec_virt.S
+++ b/arch/arm/cpu/armv7/nonsec_virt.S
@@ -189,11 +189,11 @@ ENTRY(_nonsec_init)
  * we do this here instead.
  * But first check if we have the generic timer.
  */
-#ifdef COUNTER_FREQUENCY
+#if CONFIG_COUNTER_FREQUENCY
mrc p15, 0, r0, c0, c1, 1   @ read ID_PFR1
and r0, r0, #CPUID_ARM_GENTIMER_MASK@ mask arch timer bits
cmp r0, #(1 << CPUID_ARM_GENTIMER_SHIFT)
-   ldreq   r1, =COUNTER_FREQUENCY
+   ldreq   r1, =CONFIG_COUNTER_FREQUENCY
mcreq   p15, 0, r1, c14, c0, 0  @ write CNTFRQ
 #endif
 
diff --git a/arch/arm/cpu/armv7/sunxi/psci.c b/arch/arm/cpu/armv7/sunxi/psci.c
index 1ac50f558a4..d1bd6b9be41 100644
--- a/arch/arm/cpu/armv7/sunxi/psci.c
+++ b/arch/arm/cpu/armv7/sunxi/psci.c
@@ -57,7 +57,7 @@ static u32 __secure cp15_read_cntp_ctl(void)
return val;
 }
 
-#define ONE_MS (COUNTER_FREQUENCY / 1000)
+#define ONE_MS (CONFIG_COUNTER_FREQUENCY / 1000)
 
 static void __secure __mdelay(u32 ms)
 {
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index 6a6a4f86502..d328e8c08a1 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -138,9 +138,9 @@ pie_fixup_done:
 0:
msr daifclr, #0x4   /* Unmask SError interrupts */
 
-#ifdef COUNTER_FREQUENCY
+#if CONFIG_COUNTER_FREQUENCY
branch_if_not_highest_el x0, 4f
-   ldr x0, =COUNTER_FREQUENCY
+   ldr x0, =CONFIG_COUNTER_FREQUENCY
msr cntfrq_el0, x0  /* Initialize CNTFRQ */
 #endif
 
diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c 
b/arch/arm/mach-rockchip/rk3036-board-spl.c
index 6eb89e15b81..73f6d241a1c 100644
--- a/arch/arm/mach-rockchip/rk3036-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3036-board-spl.c
@@ -20,7 +20,7 @@
 void rockchip_stimer_init(void)
 {
asm volatile("mcr p15, 0, %0, c14, c0, 0"
-: : "r"(COUNTER_FREQUENCY));
+: : "r"(CONFIG_COUNTER_FREQUENCY));
 
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
writel(0x, CONFIG_ROCKCHIP_STIMER_BASE);
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index d51a0727b47..3c491f2c9ef 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -88,7 +88,7 @@ __weak void rockchip_stimer_init(void)
return;
 #ifndef CONFIG_ARM64
asm volatile("mcr p15, 0, %0, c14, c0, 0"
-: : "r"(COUNTER_FREQUENCY));
+: : "r"(CONFIG_COUNTER_FREQUENCY));
 #endif
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
writel(0x, CONFIG_ROCKCHIP_STIMER_BASE);
diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
index 3c007bb4508..a0f124864b1 100644
--- a/arch/arm/mach-rockchip/tpl.c
+++ b/arch/arm/mach-rockchip/tpl.c
@@ -37,7 +37,7 @@ __weak void rockchip_stimer_init(void)
 
 #ifndef CONFIG_ARM64
asm volatile("mcr p15, 0, %0, c14, c0, 0"
-: : "r"(COUNTER_FREQUENCY));
+: : "r"(CONFIG_COUNTER_FREQUENCY));
 #endif
 
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
diff --git a/board/sunxi/board.c b/board/sunxi/b

[PATCH V4 1/6] xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan 
Reviewed-by: Michal Simek 
---
 board/xilinx/versal/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 9940f2aeb33..2e2807eee46 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -74,7 +74,7 @@ int board_early_init_r(void)
 * Program freq register in System counter and
 * enable system counter.
 */
-   writel(COUNTER_FREQUENCY,
+   writel(CONFIG_COUNTER_FREQUENCY,
   &iou_scntr_secure->base_frequency_id_register);
 
debug("counter val 0x%x\n",
-- 
2.35.1



[PATCH V4 3/6] arch: arm: Kconfig: set default COUNTER_FREQUENCY

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

Set default COUNTER_FREQUENCY according to config header file
under include/configs/
i.MX6UL/ULL/7D/8QM/8QXP all has system counter frequency run at 8MHz,
so set default value for them.
SUNXI/EXYNOS/ROCKCHIP_RK3128/ROCKCHIP_RK3288/ROCKCHIP_RK322X/ROCKCHIP_RK3036
at 24MHz. ARCH_LX2160A at 25MHz
ARCH_ZYNQMP at 100MHz
---
 arch/arm/Kconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d77186b77b4..c45d1bd7ab9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -22,6 +22,11 @@ config ARM64_CRC32
 config COUNTER_FREQUENCY
int "Timer clock frequency"
depends on ARM64 || CPU_V7A
+   default 800 if IMX8 || MX7 || MX6UL || MX6ULL
+   default 2400 if ARCH_SUNXI || ARCH_EXYNOS || ROCKCHIP_RK3128 || \
+   ROCKCHIP_RK3288 || ROCKCHIP_RK322X || ROCKCHIP_RK3036
+   default 2500 if ARCH_LX2160A || ARCH_LX2162A || ARCH_LS1088A
+   default 1 if ARCH_ZYNQMP
default 0
help
  For platforms with ARMv8-A and ARMv7-A which features a system
-- 
2.35.1



[PATCH V4 0/6] Convert COUNTER_FREQUENCY to CONFIG_COUNTER_FREQUENCY

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

V4:
 Include arm32 support. arm32 changes merged with arm64.
 Add missing arm64 convert
 Rebased
 Pass git bisect build and CI
 Hope this works well

V3:
 Add more help info for CONFIG_COUNTER_FREQUENCY
 Drop uneeded comments
 Pass git bisect build
 Rebased

V2:
 Drop imx93 which is wrongly included

This patchset is to convert COUNTER_FREQUENCY to CONFIG_COUNTER_FREQUENCY
for arm64. arm32 is not included for now, this could be in following up
patches if this patchset is accepted.

This patchset touches lots of boards, so please help review.


Peng Fan (6):
  xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY
  arch: arm: move COUNTER_FREQUENCY from versal to arm
  arch: arm: Kconfig: set default COUNTER_FREQUENCY
  configs: set CONFIG_COUNTER_FREQUENCY
  include/configs: drop COUNTER_FREQUENCY
  arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid

 arch/arm/Kconfig| 17 +
 arch/arm/cpu/armv7/ls102xa/psci.S   |  2 +-
 arch/arm/cpu/armv7/ls102xa/timer.c  |  2 +-
 arch/arm/cpu/armv7/nonsec_virt.S|  4 ++--
 arch/arm/cpu/armv7/sunxi/psci.c |  2 +-
 arch/arm/cpu/armv8/fsl-layerscape/spintable.S   |  2 +-
 arch/arm/cpu/armv8/start.S  |  4 ++--
 arch/arm/mach-rockchip/rk3036-board-spl.c   |  2 +-
 arch/arm/mach-rockchip/spl.c|  2 +-
 arch/arm/mach-rockchip/tpl.c|  2 +-
 arch/arm/mach-versal/Kconfig|  6 --
 board/sunxi/board.c |  6 +++---
 board/xilinx/versal/board.c |  2 +-
 configs/a3y17lte_defconfig  |  1 +
 configs/a5y17lte_defconfig  |  1 +
 configs/a7y17lte_defconfig  |  1 +
 configs/apalis-imx8_defconfig   |  1 +
 configs/apalis-imx8x_defconfig  |  1 +
 configs/bubblegum_96_defconfig  |  1 +
 configs/cgtqmx8_defconfig   |  1 +
 configs/colibri-imx8x_defconfig |  1 +
 configs/cortina_presidio-asic-base_defconfig|  1 +
 configs/cortina_presidio-asic-emmc_defconfig|  1 +
 configs/cortina_presidio-asic-pnand_defconfig   |  1 +
 configs/cubieboard7_defconfig   |  1 +
 configs/deneb_defconfig |  1 +
 configs/dragonboard410c_defconfig   |  1 +
 configs/dragonboard820c_defconfig   |  1 +
 configs/espresso7420_defconfig  |  1 +
 configs/evb-px30_defconfig  |  1 +
 configs/evb-px5_defconfig   |  1 +
 configs/evb-rk3308_defconfig|  1 +
 configs/evb-rk3328_defconfig|  1 +
 configs/evb-rk3399_defconfig|  1 +
 configs/evb-rk3568_defconfig|  1 +
 configs/firefly-px30_defconfig  |  1 +
 configs/firefly-rk3399_defconfig|  1 +
 configs/hihope_rzg2_defconfig   |  1 +
 configs/hikey960_defconfig  |  1 +
 configs/hikey_defconfig |  1 +
 configs/imx8qm_mek_defconfig|  1 +
 configs/imx8qm_rom7720_a1_4G_defconfig  |  1 +
 configs/imx8qxp_mek_defconfig   |  1 +
 configs/khadas-edge-captain-rk3399_defconfig|  1 +
 configs/khadas-edge-rk3399_defconfig|  1 +
 configs/khadas-edge-v-rk3399_defconfig  |  1 +
 configs/kontron_sl28_defconfig  |  1 +
 configs/leez-rk3399_defconfig   |  1 +
 configs/ls1012a2g5rdb_qspi_defconfig|  1 +
 configs/ls1012a2g5rdb_tfa_defconfig |  1 +
 configs/ls1021aiot_qspi_defconfig   |  1 +
 configs/ls1021aiot_sdcard_defconfig |  1 +
 configs/ls1021aqds_ddr4_nor_defconfig   |  1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig|  1 +
 configs/ls1021aqds_nand_defconfig   |  1 +
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig|  1 +
 configs/ls1021aqds_nor_defconfig|  1 +
 configs/ls1021aqds_nor_lpuart_defconfig |  1 +
 configs/ls1021aqds_qspi_defconfig   |  1 +
 configs/ls1021aqds_sdcard_ifc_defconfig |  1 +
 configs/ls1021aqds_sdcard_qspi_defconfig|  1 +
 configs/ls1021atsn_qspi_defconfig   |  1 +
 configs/ls1021atsn_sdcard_defconfig |  1 +
 configs/ls1021atwr_nor_SECURE_BOOT_defconfig|  1 +
 configs/ls1021atwr_nor_defconfig|  1 +
 configs/ls1021atwr_nor_lpuart_defconfig |  1 +
 configs/ls1021atwr_qspi_defconfig   |  1 +
 .../ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |  1 +
 configs/ls1021atwr_sdcard_ifc_defconfig |  1 +
 configs/ls1021atwr_sdcard_qspi_defconfig|  1 +
 configs/ls1043aqds_defconfig|  1 +
 configs/ls1043aqds_lpuart_defconfig |  1 +
 configs/ls1043aqds_nand_defconfig 

Re: Bug in p1_p2_rdb_pc? Caching-inhibited bit for initial L2 SRAM entry in TLB

2022-04-13 Thread Pali Rohár
On Tuesday 05 April 2022 10:57:37 Pali Rohár wrote:
> Hello!
> 
> I suspect that there is a bug in board/freescale/p1_p2_rdb_pc/tlb.c code
> which configures TLB entry for initial L2 SRAM.
> 
> When L2 is 512 kB long (e.g. on P2020) then U-Boot *unsets* MAS2_I bit
> for first half of L2 and for second half of L2 U-Boot *sets* this bit.
> 
> See code:
> https://source.denx.de/u-boot/u-boot/-/blob/v2022.04/board/freescale/p1_p2_rdb_pc/tlb.c#L99-104
> 
> I do not think that one part of L2 SRAM should be configured differently
> as second part. Therefore I think that this is a bug in U-Boot code.
> 
> Do you know is correct configuration of TLB entries for initial L2 SRAM?
> 
> MAS2_I is Caching-inhibited bit which is described as:
> 
> Caching-inhibited:
> * 0 - Accesses to this page are considered cacheable.
> * 1 - The page is considered caching-inhibited. All loads and stores to
>   the page bypass the caches and are performed directly to main
>   memory. A read or write to a caching-inhibited page affects only
>   the memory element specified by the operation.

Hello! I found EREF: A Programmer’s Reference Manual for Freescale Power
Architecture Processors Supports e500 core family (e500v1, e500v2,
e500mc, e5500, e6500) e200 core family document at NXP web:

https://www.nxp.com/files-static/32bit/doc/ref_manual/EREF_RM.pdf

And section "Cache and MMU Architecture" in part 7.3.1.2.2 Unable to
Lock Conditions (page 763) contains following information:

If no exceptions occur and no overlocking condition exists, an attempt
to set a lock can fail if any of the following is true:

• The target address is marked cache-inhibited, or the storage
  attributes of the address uses a coherency protocol that does not
  support locking

So for me it looks like that L2 SRAM (which works at L2 with locked
cache lines) should not set MA2_I (cache-inhibited) bit.

Any opinion? Or you do have some more information?


[PATCH] board: gateworks: venice: add imx8mm-gw7903 support

2022-04-13 Thread sbabic
> The GW7903 is based on the i.MX 8M Mini SoC featuring:
>  - LPDDR4 DRAM
>  - eMMC FLASH
>  - microSD socket with voltage select support
>  - Gateworks System Controller
>  - M.2 A-E Socket with USB2.0 and PCIe
>  - MiniPCIe Socket with PCIe, USB2.0, and SIM
>  - IMX8M FEC
>  - RS232/RS485/RS422 serial transceiver
>  - LIS2DE12 3-axis accelerometer
>  - front panel LED's
>  - off-board isolated digital I/O
>  - Wide range DC power input
>  - 802.3at PoE
>  - PMIC
> Signed-off-by: Tim Harvey 
> Reviewed-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] clk: imx8mp: Fix 24M and 32k clock

2022-04-13 Thread sbabic
> Fix registration of 24M and 32k clock, those got applied or rebased
> incorrectly, so fill in the correct code.
> Fixes: 7a2c3be95a5 ("clk: imx8mp: Fill in DWC3 USB, USB PHY, HSIOMIX clock")
> Signed-off-by: Marek Vasut 
> Cc: Fabio Estevam 
> Cc: Peng Fan 
> Cc: Stefano Babic 
> Cc: Ye Li 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2] ARM: imx: Enable instruction cache early on on i.MX8M

2022-04-13 Thread sbabic
> Enable instruction cache early on to speed up the boot process on i.MX8M.
> Signed-off-by: Marek Vasut 
> Cc: Fabio Estevam 
> Cc: Peng Fan 
> Cc: Stefano Babic 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH] warp7: Remove duplicated "mmc dev" command

2022-04-13 Thread sbabic
> From: Fabio Estevam 
> The "mmc dev ${mmcdev}" command is done twice.
> Remove one ocurrence to avoid the duplication.
> Signed-off-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


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

2022-04-13 Thread sbabic
> This is the only place where i.MX8M code does SMCCC call, remove it.
> The output has little value as it prints some part of commit ID, and
> worse, if there is no SMC handler installed, the code outright hangs
> or crashes the system.
> By removing this one instance of SMCCC call, U-Boot no longer depends
> on SMC handlers and can boot without hanging in any case. If there is
> a need to dump this commit ID, use CMD_SMC instead and do 'smc' call
> from U-Boot shell or scripts instead of hard-coding SMCCC dependency
> into architecture code. This particular code can be replaced by:
>  => smc 0xc203 0 0 0 0 0 0
> Reviewed-by: Peng Fan 
> Signed-off-by: Marek Vasut 
> Cc: Fabio Estevam 
> Cc: Peng Fan 
> Cc: Stefano Babic 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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


[PATCH v2 02/11] toradex: globally disable video support

2022-04-13 Thread Marcel Ziswiler
From: Igor Opaniuk 

As video support is very specific depending on the exact display
customisation we decided to disable video support for all out modules
by default.

Signed-off-by: Igor Opaniuk 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 configs/apalis_imx6_defconfig  | 10 --
 configs/colibri-imx6ull-emmc_defconfig |  7 ---
 configs/colibri-imx6ull_defconfig  |  8 
 configs/colibri_imx6_defconfig | 10 --
 configs/colibri_imx7_defconfig |  8 
 configs/colibri_imx7_emmc_defconfig|  7 ---
 configs/colibri_t20_defconfig  |  5 -
 configs/colibri_vf_defconfig   |  5 -
 8 files changed, 60 deletions(-)

diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 3fa1bb58a43..cdf169df046 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -56,7 +56,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_NFS is not set
-CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
@@ -106,13 +105,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_DM_VIDEO=y
-CONFIG_VIDEO_LOGO=y
-# CONFIG_VIDEO_BPP8 is not set
-# CONFIG_VIDEO_BPP32 is not set
-CONFIG_SYS_WHITE_ON_BLACK=y
-CONFIG_VIDEO_IPUV3=y
-CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASH_SCREEN_ALIGN=y
-CONFIG_BMP_16BPP=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 8811d7749d9..0e7f29b56bc 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -37,7 +37,6 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
-CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_REGULATOR=y
@@ -79,10 +78,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_DM_VIDEO=y
-CONFIG_VIDEO_LOGO=y
-CONFIG_SYS_WHITE_ON_BLACK=y
-CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASH_SCREEN_ALIGN=y
-CONFIG_BMP_16BPP=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index b75e21799e1..b04f171549b 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -42,7 +42,6 @@ CONFIG_CMD_NAND_TORTURE=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
-CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_REGULATOR=y
@@ -95,12 +94,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_DM_VIDEO=y
-CONFIG_VIDEO_LOGO=y
-CONFIG_SYS_WHITE_ON_BLACK=y
-CONFIG_VIDEO_MXS=y
-CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASH_SCREEN_ALIGN=y
-CONFIG_BMP_16BPP=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 04b73a8b9cb..4aecb283332 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -55,7 +55,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_NFS is not set
-CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
@@ -104,13 +103,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_DM_VIDEO=y
-CONFIG_VIDEO_LOGO=y
-# CONFIG_VIDEO_BPP8 is not set
-# CONFIG_VIDEO_BPP32 is not set
-CONFIG_SYS_WHITE_ON_BLACK=y
-CONFIG_VIDEO_IPUV3=y
-CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASH_SCREEN_ALIGN=y
-CONFIG_BMP_16BPP=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 1ccc7163cfb..f3cd7a4d5ae 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -40,7 +40,6 @@ CONFIG_CMD_NAND_TORTURE=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_BOOTP_PXE is not set
-CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 # CONFIG_CMD_HASH is not set
@@ -90,12 +89,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_DM_VIDEO=y
-CONFIG_VIDEO_LOGO=y
-CONFIG_SYS_WHITE_ON_BLACK=y
-CONFIG_VIDEO_MXS=y
-CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASH_SCREEN_ALIGN=y
-CONFIG_BMP_16BPP=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/colibri_imx7_emmc_defconfig 
b/configs/colibri_imx7_emmc_defconfig
index dcac585ab38..2b97890497c 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -38,7 +38,6 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
-CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 # CONFIG_CMD_HASH is not set
@@ -83,10 +82,4 @@ CONFIG_USB_GADGET_MANUFACTUR

[PATCH v2 06/11] configs: colibri-imx7/-emmc: enable booting from usb sdp

2022-04-13 Thread Marcel Ziswiler
From: Oleksandr Suvorov 

For recovery purpose allow booting via SDP over USB as well.

Signed-off-by: Oleksandr Suvorov 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 configs/colibri_imx7_defconfig  | 1 +
 configs/colibri_imx7_emmc_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 3fb50a49bd6..d2051a5f262 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -40,6 +40,7 @@ CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND_TRIMFFS=y
 CONFIG_CMD_NAND_TORTURE=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_BOOTP_PXE is not set
 CONFIG_CMD_BOOTCOUNT=y
diff --git a/configs/colibri_imx7_emmc_defconfig 
b/configs/colibri_imx7_emmc_defconfig
index e66d94bf7d9..d0f6bf3accf 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -38,6 +38,7 @@ CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
-- 
2.34.1



[PATCH v2 04/11] toradex: drop legacy nfsboot script

2022-04-13 Thread Marcel Ziswiler
From: Igor Opaniuk 

Drop legacy nfsboot script in favor of distroboot DHCP boot.

Signed-off-by: Igor Opaniuk 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 include/configs/apalis-imx8.h |  5 -
 include/configs/apalis-tk1.h  | 11 ---
 include/configs/apalis_imx6.h | 11 ---
 include/configs/colibri-imx6ull.h | 10 --
 include/configs/colibri-imx8x.h   |  6 --
 include/configs/colibri_imx6.h| 11 ---
 include/configs/colibri_imx7.h| 10 --
 include/configs/colibri_vf.h  | 10 --
 include/configs/verdin-imx8mm.h   |  6 --
 include/configs/verdin-imx8mp.h   |  6 --
 10 files changed, 86 deletions(-)

diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index a45a6ffe7c9..a9e0dee3f56 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -50,11 +50,6 @@
"root=PARTUUID=${uuid} rootwait " \
"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
"mmcpart=1\0" \
-   "netargs=setenv bootargs console=${console},${baudrate} " \
-   "root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp" \
-   "\0" \
-   "nfsboot=run netargs; dhcp ${loadaddr} ${boot_file}; tftp ${fdt_addr} " 
\
-   "apalis-imx8/${fdt_file}; booti ${loadaddr} - ${fdt_addr}\0" \
"panel=NULL\0" \
"script=boot.scr\0" \
"update_uboot=askenv confirm Did you load u-boot-dtb.imx (y/N)?; " \
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index 10cfe1e3490..face78e1dd4 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -59,16 +59,6 @@
"update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
"mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0" \
 
-#define NFS_BOOTCMD \
-   "nfsargs=ip=:eth0:on root=/dev/nfs rw\0" \
-   "nfsboot=pci enum; run setup; setenv bootargs ${defargs} ${nfsargs} " \
-   "${setupargs} ${vidargs}; echo Booting via DHCP/TFTP/NFS...; " \
-   "run nfsdtbload; dhcp ${kernel_addr_r} " \
-   "&& run fdt_fixup && bootz ${kernel_addr_r} - ${dtbparam}\0" \
-   "nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} " \
-   "${soc}-${fdt_module}-${fdt_board}.dtb " \
-   "&& setenv dtbparam ${fdt_addr_r}\0"
-
 #define BOARD_EXTRA_ENV_SETTINGS \
"boot_file=zImage\0" \
"boot_script_dhcp=boot.scr\0" \
@@ -80,7 +70,6 @@
"fdt_board=eval\0" \
"fdt_fixup=;\0" \
"fdt_module=" FDT_MODULE "\0" \
-   NFS_BOOTCMD \
UBOOT_UPDATE \
"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
"00:14:2d:00:00:00; fi; pci enum && tftpboot ${loadaddr} " \
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index afdcf9b2f60..3a27bbb6c87 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -89,16 +89,6 @@
"ramdisk_addr_r=0x1220\0" \
"scriptaddr=0x1700\0"
 
-#define NFS_BOOTCMD \
-   "nfsargs=ip=:eth0:on root=/dev/nfs ro\0" \
-   "nfsboot=run setup; " \
-   "setenv bootargs ${defargs} ${nfsargs} ${setupargs} " \
-   "${vidargs}; echo Booting via DHCP/TFTP/NFS...; " \
-   "run nfsdtbload; dhcp ${kernel_addr_r} " \
-   "&& run fdt_fixup && bootz ${kernel_addr_r} ${dtbparam}\0" \
-   "nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} ${fdt_file} " \
-   "&& setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
-
 #ifndef CONFIG_TDX_APALIS_IMX6_V1_0
 #define FDT_FILE "imx6q-apalis-eval.dtb"
 #define FDT_FILE_V1_0 "imx6q-apalis_v1_0-eval.dtb"
@@ -115,7 +105,6 @@
"fdtfile=" FDT_FILE "\0" \
"fdt_fixup=;\0" \
MEM_LAYOUT_ENV_SETTINGS \
-   NFS_BOOTCMD \
UBOOT_UPDATE \
"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
diff --git a/include/configs/colibri-imx6ull.h 
b/include/configs/colibri-imx6ull.h
index fa4f8ce9813..11791cee6ac 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -50,15 +50,6 @@
"ramdisk_addr_r=0x8220\0" \
"scriptaddr=0x8700\0"
 
-#define NFS_BOOTCMD \
-   "nfsargs=ip=:eth0: root=/dev/nfs\0" \
-   "nfsboot=run setup; " \
-   "setenv bootargs ${defargs} ${nfsargs} " \
-   "${setupargs} ${vidargs}; echo Booting from NFS...;" \
-   "dhcp ${kernel_addr_r} && " \
-   "tftp ${fdt_addr_r} ${fdtfile} && " \
-   "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
-
 #define UBI_BOOTCMD \
"ubiargs=ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs " \
"ubi.fm_autoconvert=1\0" \
@@ -98,7 +89,6 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
MEM_LAYOUT_

[PATCH v2 07/11] configs: tdx: Do not overwrite fdtfile if it got set manually

2022-04-13 Thread Marcel Ziswiler
From: Philippe Schenker 

In case a customer wants to set fdtfile currently preboot overrides it
always with preboot just before the bootdelay. Use test -n to check
if fdtfile is already set and only set it if nothing got touched manually

Signed-off-by: Philippe Schenker 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 configs/colibri-imx6ull-emmc_defconfig | 2 +-
 configs/colibri-imx6ull_defconfig  | 2 +-
 configs/colibri_imx7_defconfig | 2 +-
 configs/colibri_imx7_emmc_defconfig| 2 +-
 configs/colibri_vf_defconfig   | 2 +-
 configs/verdin-imx8mm_defconfig| 2 +-
 configs/verdin-imx8mp_defconfig| 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 8c616178670..b22a19b5b0b 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -16,7 +16,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx6ull-colibri${variant}-${fdt_board}.dtb"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index 3ef7a6aa8d5..2fba7aaae4d 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -18,7 +18,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx6ull-colibri${variant}-${fdt_board}.dtb"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index d2051a5f262..2f61223c9eb 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -18,7 +18,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run ubiboot ; echo ; echo ubiboot failed ; run 
distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile ${soc}-colibri-${fdt_board}.dtb "
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
${soc}-colibri-${fdt_board}.dtb "
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/colibri_imx7_emmc_defconfig 
b/configs/colibri_imx7_emmc_defconfig
index d0f6bf3accf..918585da495 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -18,7 +18,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
${soc}-colibri-emmc-${fdt_board}.dtb"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig
index cf230508f2b..e140ee0f300 100644
--- a/configs/colibri_vf_defconfig
+++ b/configs/colibri_vf_defconfig
@@ -21,7 +21,7 @@ CONFIG_BOOTDELAY=1
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile ${soc}-colibri-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
${soc}-colibri-${fdt_board}.dtb"
 CONFIG_LOGLEVEL=3
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index ce567b770ab..e6d9f37623c 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -27,7 +27,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_SYSTEM_SETUP=y
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile imx8mm-verdin-${variant}-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx8mm-verdin-${variant}-${fdt_board}.dtb"
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/verdin-imx8mp_defconfig b/configs/verdin-imx8mp_defconfig
index 44fcfa1352e..a74033c8ba7 100644
--- a/configs/verdin-imx8mp_defconfig
+++ b/configs/verdin-imx8mp_defconfig
@@ -34,7 +34,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="setenv fdtfile imx8mp-verdin-${variant}-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx8mp-verdin-${variant}-${fdt_board}.dtb"
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-- 
2.34.1



[PATCH v2 03/11] toradex: set default dhcp distroboot scriptname

2022-04-13 Thread Marcel Ziswiler
From: Igor Opaniuk 

Use the same name of DHCP Distroboot script as in regular eMMC case.

Signed-off-by: Igor Opaniuk 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 include/configs/apalis-imx8.h | 1 +
 include/configs/apalis-tk1.h  | 1 +
 include/configs/apalis_imx6.h | 1 +
 include/configs/apalis_t30.h  | 3 ++-
 include/configs/colibri-imx6ull.h | 1 +
 include/configs/colibri-imx8x.h   | 1 +
 include/configs/colibri_imx6.h| 1 +
 include/configs/colibri_imx7.h| 1 +
 include/configs/colibri_t20.h | 1 +
 include/configs/colibri_t30.h | 3 ++-
 include/configs/colibri_vf.h  | 1 +
 include/configs/verdin-imx8mm.h   | 1 +
 12 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index c87bcd475ef..a45a6ffe7c9 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -38,6 +38,7 @@
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS \
"boot_file=Image\0" \
+   "boot_script_dhcp=boot.scr\0" \
"console=ttyLP1 earlycon\0" \
"fdt_addr=0x8300\0" \
"fdt_file=fsl-imx8qm-apalis-eval.dtb\0" \
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index 59c901994fd..10cfe1e3490 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -71,6 +71,7 @@
 
 #define BOARD_EXTRA_ENV_SETTINGS \
"boot_file=zImage\0" \
+   "boot_script_dhcp=boot.scr\0" \
"console=ttyS0\0" \
"defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 " \
"usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 " \
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index ea5711dba87..afdcf9b2f60 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -108,6 +108,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
"boot_file=zImage\0" \
+   "boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
"defargs=enable_wait_mode=off vmalloc=400M\0" \
"fdt_file=" FDT_FILE "\0" \
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index b7a2fb695e2..d1d518a5340 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -47,7 +47,8 @@
"mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0" \
 
 #define BOARD_EXTRA_ENV_SETTINGS \
-   UBOOT_UPDATE
+   UBOOT_UPDATE \
+   "boot_script_dhcp=boot.scr\0"
 
 #include "tegra-common-post.h"
 
diff --git a/include/configs/colibri-imx6ull.h 
b/include/configs/colibri-imx6ull.h
index 281815e0863..fa4f8ce9813 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -101,6 +101,7 @@
NFS_BOOTCMD \
UBI_BOOTCMD \
UBOOT_UPDATE \
+   "boot_script_dhcp=boot.scr\0" \
"bootubipart=ubi\0" \
"console=ttymxc0\0" \
"defargs=user_debug=30\0" \
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h
index 008fa6ef076..ee070408d41 100644
--- a/include/configs/colibri-imx8x.h
+++ b/include/configs/colibri-imx8x.h
@@ -67,6 +67,7 @@
M4_BOOT_ENV \
MEM_LAYOUT_ENV_SETTINGS \
"boot_file=Image\0" \
+   "boot_script_dhcp=boot.scr\0" \
"consoleargs=console=ttyLP3,${baudrate} earlycon\0" \
"fdt_addr=0x8300\0" \
"fdt_file=fsl-imx8qxp-colibri-dsihdmi-eval-v3.dtb\0" \
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 0d1a1bcf3df..956b59f692b 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -92,6 +92,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
"boot_file=zImage\0" \
+   "boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
"defargs=enable_wait_mode=off galcore.contiguousSize=50331648\0" \
"fdt_file=" FDT_FILE "\0" \
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index 0382724ae10..ff2c30c7f92 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -140,6 +140,7 @@
MODULE_EXTRA_ENV_SETTINGS \
UBOOT_UPDATE \
"boot_file=zImage\0" \
+   "boot_script_dhcp=boot.scr\0" \
"bootubipart=ubi\0" \
"console=ttymxc0\0" \
"defargs=\0" \
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index fdf6bb28419..f6b3ab1b041 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -24,6 +24,7 @@
 
 /* Environment in NAND, 64K is a bit excessive but erase block is 512K anyway 
*/
 #define BOARD_EXTRA_ENV_SETTINGS \
+   "boot_script_dhcp=boot.scr\0" \
"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
UBOOT_UPDATE
 
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index cbe73bf86ba..1ce0def4ddf 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -45,7 +45,8 @@

[PATCH v2 05/11] configs: toradex: enable missing fit options

2022-04-13 Thread Marcel Ziswiler
From: Oleksandr Suvorov 

Add missing support of FIT-images and enable a verbosity for
this feature.

Signed-off-by: Oleksandr Suvorov 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 configs/apalis-imx8_defconfig  | 1 +
 configs/apalis-tk1_defconfig   | 1 +
 configs/apalis_imx6_defconfig  | 1 +
 configs/colibri-imx6ull-emmc_defconfig | 1 +
 configs/colibri-imx6ull_defconfig  | 1 +
 configs/colibri-imx8x_defconfig| 1 +
 configs/colibri_imx6_defconfig | 1 +
 configs/colibri_imx7_defconfig | 2 ++
 configs/colibri_imx7_emmc_defconfig| 1 +
 configs/verdin-imx8mm_defconfig| 1 +
 10 files changed, 11 insertions(+)

diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
index 19edbbb6978..beb20f6e1c0 100644
--- a/configs/apalis-imx8_defconfig
+++ b/configs/apalis-imx8_defconfig
@@ -15,6 +15,7 @@ CONFIG_SYS_MEMTEST_END=0x8900
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_REMAKE_ELF=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index 9645c2f2108..e098b1171ee 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -12,6 +12,7 @@ CONFIG_TEGRA124=y
 CONFIG_TARGET_APALIS_TK1=y
 CONFIG_SYS_LOAD_ADDR=0x8100
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="setenv fdtfile ${soc}-${fdt_module}-${fdt_board}.dtb && 
run distro_bootcmd"
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index cdf169df046..00c9a24a5dd 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -26,6 +26,7 @@ CONFIG_SYS_MEMTEST_START=0x1000
 CONFIG_SYS_MEMTEST_END=0x1001
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout 
serial,vidconsole; setenv stdin serial,usbkbd"
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 0e7f29b56bc..8c616178670 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -13,6 +13,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x8800
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index b04f171549b..3ef7a6aa8d5 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -14,6 +14,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x8800
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
diff --git a/configs/colibri-imx8x_defconfig b/configs/colibri-imx8x_defconfig
index 80bc27b1881..0c9d6b64c1b 100644
--- a/configs/colibri-imx8x_defconfig
+++ b/configs/colibri-imx8x_defconfig
@@ -15,6 +15,7 @@ CONFIG_SYS_MEMTEST_END=0x8900
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_REMAKE_ELF=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 4aecb283332..1c65d8a7fe1 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -25,6 +25,7 @@ CONFIG_SYS_MEMTEST_START=0x1000
 CONFIG_SYS_MEMTEST_END=0x1001
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout 
serial,vidconsole; setenv stdin serial,usbkbd"
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index f3cd7a4d5ae..3fb50a49bd6 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -13,6 +13,8 @@ CONFIG_IMX_HAB=y
 CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x8c00
 CONFIG_DISTRO_DEFAULTS=y
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run ubiboot ; echo ; echo ubiboot failed ; run 
distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
diff --git a/configs/colibri_imx7_emmc_defconfig 
b/configs/colibri_imx7_emmc_defconfig
index 2b97890497c..e66d94bf7d9 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -15,6 +15,7 @@ CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x8c00
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb"
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index 94ba1f50fbb..ce567b770a

[PATCH v2 09/11] board: colibri_imx7: fix usb start on solo

2022-04-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 

This fixes the following crash when run on a Colibri iMX7S aka solo:

Colibri iMX7 # usb start
starting USB...
Bus usb@30b1: USB EHCI 1.00
Bus usb@30b2:

The i.MX 7Solo has only one single USB OTG1 but no USB host port. Trying
to initialize the nonexisting port just crashes.

While at it also drop board_usb_phy_mode() which is also no longer used
in the driver model age.

Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 board/toradex/colibri_imx7/colibri_imx7.c | 40 +--
 configs/colibri_imx7_defconfig|  1 +
 2 files changed, 9 insertions(+), 32 deletions(-)

diff --git a/board/toradex/colibri_imx7/colibri_imx7.c 
b/board/toradex/colibri_imx7/colibri_imx7.c
index 6822102d2c3..486299b5e93 100644
--- a/board/toradex/colibri_imx7/colibri_imx7.c
+++ b/board/toradex/colibri_imx7/colibri_imx7.c
@@ -319,40 +319,16 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #endif
 
 #ifdef CONFIG_USB_EHCI_MX7
-static iomux_v3_cfg_t const usb_otg2_pads[] = {
-   MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-int board_ehci_hcd_init(int port)
+int board_fix_fdt(void *rw_fdt_blob)
 {
-   switch (port) {
-   case 0:
-   break;
-   case 1:
-   if (is_cpu_type(MXC_CPU_MX7S))
-   return -ENODEV;
-
-   imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
-ARRAY_SIZE(usb_otg2_pads));
-   break;
-   default:
-   return -EINVAL;
-   }
-   return 0;
-}
+   /* i.MX 7Solo has only one single USB OTG1 but no USB host port */
+   if (is_cpu_type(MXC_CPU_MX7S)) {
+   int offset = fdt_path_offset(rw_fdt_blob, 
"/soc/bus@3080/usb@30b2");
 
-int board_usb_phy_mode(int port)
-{
-   switch (port) {
-   case 0:
-   if (gpio_get_value(USB_CDET_GPIO))
-   return USB_INIT_DEVICE;
-   else
-   return USB_INIT_HOST;
-   case 1:
-   default:
-   return USB_INIT_HOST;
+   return fdt_status_disabled(rw_fdt_blob, offset);
}
+
+   return 0;
 }
 
 #if defined(CONFIG_BOARD_LATE_INIT)
@@ -373,4 +349,4 @@ int board_late_init(void)
 }
 #endif /* CONFIG_BOARD_LATE_INIT */
 
-#endif
+#endif /* CONFIG_USB_EHCI_MX7 */
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 2f61223c9eb..0e254fd7d15 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -10,6 +10,7 @@ CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_IMX_HAB=y
+CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x8000
 CONFIG_SYS_MEMTEST_END=0x8c00
 CONFIG_DISTRO_DEFAULTS=y
-- 
2.34.1



[PATCH v2 10/11] configs: tdx: apalis_imx6: drop hw v1.0 support

2022-04-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Drop optional support for the ancient Apalis iMX6 V1.0 hardware which
had the UART wired as DCE rather than DTE.

Signed-off-by: Marcel Ziswiler 

---

Changes in v2:
- Also drop setup_dcemode_uart() and setup_iomux_dce_uart() which are
  now unused.

 board/toradex/apalis_imx6/apalis_imx6.c | 38 ++---
 include/configs/apalis_imx6.h   |  6 +---
 2 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index a78d52d3fac..5604c4646cf 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -304,13 +304,6 @@ static void setup_dtemode_uart(void)
clrbits_le32((u32 *)(UART4_BASE + UCR3), UCR3_DCD | UCR3_RI);
clrbits_le32((u32 *)(UART5_BASE + UCR3), UCR3_DCD | UCR3_RI);
 }
-static void setup_dcemode_uart(void)
-{
-   clrbits_le32((u32 *)(UART1_BASE + UFCR), UFCR_DCEDTE);
-   clrbits_le32((u32 *)(UART2_BASE + UFCR), UFCR_DCEDTE);
-   clrbits_le32((u32 *)(UART4_BASE + UFCR), UFCR_DCEDTE);
-   clrbits_le32((u32 *)(UART5_BASE + UFCR), UFCR_DCEDTE);
-}
 
 static void setup_iomux_dte_uart(void)
 {
@@ -318,12 +311,6 @@ static void setup_iomux_dte_uart(void)
imx_iomux_v3_setup_multiple_pads(uart1_pads_dte,
 ARRAY_SIZE(uart1_pads_dte));
 }
-static void setup_iomux_dce_uart(void)
-{
-   setup_dcemode_uart();
-   imx_iomux_v3_setup_multiple_pads(uart1_pads_dce,
-ARRAY_SIZE(uart1_pads_dce));
-}
 
 #ifdef CONFIG_USB_EHCI_MX6
 int board_ehci_hcd_init(int port)
@@ -665,11 +652,8 @@ int board_early_init_f(void)
 {
imx_iomux_v3_setup_multiple_pads(pwr_intb_pads,
 ARRAY_SIZE(pwr_intb_pads));
-#ifndef CONFIG_TDX_APALIS_IMX6_V1_0
setup_iomux_dte_uart();
-#else
-   setup_iomux_dce_uart();
-#endif
+
return 0;
 }
 
@@ -714,23 +698,7 @@ int board_late_init(void)
rev = get_board_revision();
snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
env_set("board_rev", env_str);
-
-#ifndef CONFIG_TDX_APALIS_IMX6_V1_0
-   if ((rev & 0xfff0) == 0x0100) {
-   char *fdt_env;
-
-   /* reconfigure the UART to DCE mode dynamically if on V1.0 HW */
-   setup_iomux_dce_uart();
-
-   /* if using the default device tree, use version for V1.0 HW */
-   fdt_env = env_get("fdt_file");
-   if ((fdt_env != NULL) && (strcmp(FDT_FILE, fdt_env) == 0)) {
-   env_set("fdt_file", FDT_FILE_V1_0);
-   printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
-   }
-   }
-#endif /* CONFIG_TDX_APALIS_IMX6_V1_0 */
-#endif /* CONFIG_REVISION_TAG */
+#endif /* CONFIG_BOARD_LATE_INIT */
 
 #ifdef CONFIG_CMD_USB_SDP
if (is_boot_from_usb()) {
@@ -1129,10 +1097,8 @@ void board_init_f(ulong dummy)
/* UART clocks enabled and gd valid - init serial console */
preloader_console_init();
 
-#ifndef CONFIG_TDX_APALIS_IMX6_V1_0
/* Make sure we use dte mode */
setup_dtemode_uart();
-#endif
 
/* DDR initialization */
spl_dram_init();
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 3a27bbb6c87..57fd3ce12d0 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -89,12 +89,8 @@
"ramdisk_addr_r=0x1220\0" \
"scriptaddr=0x1700\0"
 
-#ifndef CONFIG_TDX_APALIS_IMX6_V1_0
 #define FDT_FILE "imx6q-apalis-eval.dtb"
-#define FDT_FILE_V1_0 "imx6q-apalis_v1_0-eval.dtb"
-#else
-#define FDT_FILE "imx6q-apalis_v1_0-eval.dtb"
-#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
"boot_file=zImage\0" \
-- 
2.34.1



[PATCH v2 11/11] configs: tdx: apalis/colibri_imx6: use preboot as well

2022-04-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Use PREBOOT as well. This allows a customer to just set fdt_board as
on any other module to customize the device tree for his carrier
board.

Signed-off-by: Marcel Ziswiler 

---

Changes in v2:
- Re-based on top of Stefano's imx/master-next which dropped 13 commits
  already applied.

 configs/apalis_imx6_defconfig  | 2 ++
 configs/colibri_imx6_defconfig | 2 ++
 include/configs/apalis_imx6.h  | 5 +
 include/configs/colibri_imx6.h | 4 +---
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 00c9a24a5dd..ea4ad276e7f 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -29,6 +29,8 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout 
serial,vidconsole; setenv stdin serial,usbkbd"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx6q-apalis-${fdt_board}.dtb"
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 1c65d8a7fe1..4f38d5cb483 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -28,6 +28,8 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout 
serial,vidconsole; setenv stdin serial,usbkbd"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx6dl-colibri-${fdt_board}.dtb"
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 57fd3ce12d0..aa93d10f852 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -89,16 +89,13 @@
"ramdisk_addr_r=0x1220\0" \
"scriptaddr=0x1700\0"
 
-#define FDT_FILE "imx6q-apalis-eval.dtb"
-
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
"boot_file=zImage\0" \
"boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
"defargs=enable_wait_mode=off vmalloc=400M\0" \
-   "fdt_file=" FDT_FILE "\0" \
-   "fdtfile=" FDT_FILE "\0" \
+   "fdt_board=eval\0" \
"fdt_fixup=;\0" \
MEM_LAYOUT_ENV_SETTINGS \
UBOOT_UPDATE \
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index f7e9709e122..9ca6bef192f 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -78,15 +78,13 @@
"ramdisk_addr_r=0x1220\0" \
"scriptaddr=0x1700\0"
 
-#define FDT_FILE "imx6dl-colibri-eval-v3.dtb"
 #define CONFIG_EXTRA_ENV_SETTINGS \
BOOTENV \
"boot_file=zImage\0" \
"boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
"defargs=enable_wait_mode=off galcore.contiguousSize=50331648\0" \
-   "fdt_file=" FDT_FILE "\0" \
-   "fdtfile=" FDT_FILE "\0" \
+   "fdt_board=eval-v3\0" \
"fdt_fixup=;\0" \
MEM_LAYOUT_ENV_SETTINGS \
UBOOT_UPDATE \
-- 
2.34.1



[PATCH v2 08/11] board: toradex: drop colibri pxa270 support

2022-04-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 arch/arm/Kconfig  |   6 -
 board/toradex/colibri_pxa270/Kconfig  |  23 ---
 board/toradex/colibri_pxa270/MAINTAINERS  |   6 -
 board/toradex/colibri_pxa270/Makefile |   7 -
 board/toradex/colibri_pxa270/colibri_pxa270.c | 153 --
 board/toradex/common/tdx-cfg-block.c  |  19 +--
 configs/colibri_pxa270_defconfig  |  57 ---
 include/configs/colibri_pxa270.h  | 151 -
 include/configs/pxa-common.h  |  27 
 9 files changed, 1 insertion(+), 448 deletions(-)
 delete mode 100644 board/toradex/colibri_pxa270/Kconfig
 delete mode 100644 board/toradex/colibri_pxa270/MAINTAINERS
 delete mode 100644 board/toradex/colibri_pxa270/Makefile
 delete mode 100644 board/toradex/colibri_pxa270/colibri_pxa270.c
 delete mode 100644 configs/colibri_pxa270_defconfig
 delete mode 100644 include/configs/colibri_pxa270.h
 delete mode 100644 include/configs/pxa-common.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index efe33a58e1e..ed34fa59bd7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1833,11 +1833,6 @@ config TARGET_TEN64
  Support for Traverse Technologies Ten64 board, based
  on NXP LS1088A.
 
-config TARGET_COLIBRI_PXA270
-   bool "Support colibri_pxa270"
-   select CPU_PXA27X
-   select GPIO_EXTRA_HEADER
-
 config ARCH_UNIPHIER
bool "Socionext UniPhier SoCs"
select BOARD_LATE_INIT
@@ -2301,7 +2296,6 @@ source "board/seeed/npi_imx6ull/Kconfig"
 source "board/socionext/developerbox/Kconfig"
 source "board/st/stv0991/Kconfig"
 source "board/tcl/sl50/Kconfig"
-source "board/toradex/colibri_pxa270/Kconfig"
 source "board/traverse/ten64/Kconfig"
 source "board/variscite/dart_6ul/Kconfig"
 source "board/vscom/baltos/Kconfig"
diff --git a/board/toradex/colibri_pxa270/Kconfig 
b/board/toradex/colibri_pxa270/Kconfig
deleted file mode 100644
index f646baa3f05..000
--- a/board/toradex/colibri_pxa270/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
-if TARGET_COLIBRI_PXA270
-
-config SYS_BOARD
-   default "colibri_pxa270"
-
-config SYS_VENDOR
-   default "toradex"
-
-config SYS_CONFIG_NAME
-   default "colibri_pxa270"
-
-config TDX_CFG_BLOCK
-   default y
-
-config TDX_HAVE_NOR
-   default y
-
-config TDX_CFG_BLOCK_OFFSET
-   default "262144"
-
-source "board/toradex/common/Kconfig"
-
-endif
diff --git a/board/toradex/colibri_pxa270/MAINTAINERS 
b/board/toradex/colibri_pxa270/MAINTAINERS
deleted file mode 100644
index b378d7be5a4..000
--- a/board/toradex/colibri_pxa270/MAINTAINERS
+++ /dev/null
@@ -1,6 +0,0 @@
-COLIBRI_PXA270 BOARD
-M: Marek Vasut 
-S: Maintained
-F: board/toradex/colibri_pxa270/
-F: include/configs/colibri_pxa270.h
-F: configs/colibri_pxa270_defconfig
diff --git a/board/toradex/colibri_pxa270/Makefile 
b/board/toradex/colibri_pxa270/Makefile
deleted file mode 100644
index ea610cfea92..000
--- a/board/toradex/colibri_pxa270/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Toradex Colibri PXA270 Support
-#
-# Copyright (C) 2010 Marek Vasut 
-
-obj-y  := colibri_pxa270.o
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c 
b/board/toradex/colibri_pxa270/colibri_pxa270.c
deleted file mode 100644
index 25fbf412095..000
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ /dev/null
@@ -1,153 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Toradex Colibri PXA270 Support
- *
- * Copyright (C) 2010 Marek Vasut 
- * Copyright (C) 2016-2019 Marcel Ziswiler 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "../common/tdx-common.h"
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int board_init(void)
-{
-   /* We have RAM, disable cache */
-   dcache_disable();
-   icache_disable();
-
-   /* arch number of Toradex Colibri PXA270 */
-   gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
-
-   /* address of boot parameters */
-   gd->bd->bi_boot_params = 0xa100;
-
-   return 0;
-}
-
-int checkboard(void)
-{
-   puts("Model: Toradex Colibri PXA270\n");
-
-   return 0;
-}
-
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, struct bd_info *bd)
-{
-   return ft_common_board_setup(blob, bd);
-}
-#endif
-
-int dram_init(void)
-{
-   pxa2xx_dram_init();
-   gd->ram_size = PHYS_SDRAM_1_SIZE;
-   return 0;
-}
-
-#ifdef CONFIG_CMD_USB
-int board_usb_init(int index, enum usb_init_type init)
-{
-   writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
-   ~(UHCHR_SSEP0

[PATCH v2 00/11] toradex updates: assortment of fixes and improvements

2022-04-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 


This series contains an assortment of fixes and improvements for Toradex
computer/system on modules (CoM/SoM).

We also drop support for the Apalis iMX8X and the Colibri PXA270. The
former never evolved beyond the sample state and we no longer support
it. The latter is EOL since a while.

Changes in v2:
- Also drop setup_dcemode_uart() and setup_iomux_dce_uart() which are
  now unused.
- Re-based on top of Stefano's imx/master-next which dropped 13 commits
  already applied.

Denys Drozdov (1):
  toradex: apalis-imx8x: drop support for apalis imx8x

Igor Opaniuk (3):
  toradex: globally disable video support
  toradex: set default dhcp distroboot scriptname
  toradex: drop legacy nfsboot script

Marcel Ziswiler (4):
  board: toradex: drop colibri pxa270 support
  board: colibri_imx7: fix usb start on solo
  configs: tdx: apalis_imx6: drop hw v1.0 support
  configs: tdx: apalis/colibri_imx6: use preboot as well

Oleksandr Suvorov (2):
  configs: toradex: enable missing fit options
  configs: colibri-imx7/-emmc: enable booting from usb sdp

Philippe Schenker (1):
  configs: tdx: Do not overwrite fdtfile if it got set manually

 arch/arm/Kconfig  |   6 -
 arch/arm/dts/Makefile |   1 -
 arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi   | 139 -
 arch/arm/dts/fsl-imx8qxp-apalis.dts   | 278 --
 arch/arm/mach-imx/imx8/Kconfig|   6 -
 board/toradex/apalis-imx8x/Kconfig|  33 ---
 board/toradex/apalis-imx8x/MAINTAINERS|  10 -
 board/toradex/apalis-imx8x/Makefile   |   6 -
 .../apalis-imx8x/apalis-imx8x-imximage.cfg|  23 --
 board/toradex/apalis-imx8x/apalis-imx8x.c | 155 --
 board/toradex/apalis_imx6/apalis_imx6.c   |  38 +--
 board/toradex/colibri_imx7/colibri_imx7.c |  40 +--
 board/toradex/colibri_pxa270/Kconfig  |  23 --
 board/toradex/colibri_pxa270/MAINTAINERS  |   6 -
 board/toradex/colibri_pxa270/Makefile |   7 -
 board/toradex/colibri_pxa270/colibri_pxa270.c | 153 --
 board/toradex/common/tdx-cfg-block.c  |  32 +-
 configs/apalis-imx8_defconfig |   1 +
 configs/apalis-imx8x_defconfig|  82 --
 configs/apalis-tk1_defconfig  |   1 +
 configs/apalis_imx6_defconfig |  13 +-
 configs/colibri-imx6ull-emmc_defconfig|  10 +-
 configs/colibri-imx6ull_defconfig |  11 +-
 configs/colibri-imx8x_defconfig   |   1 +
 configs/colibri_imx6_defconfig|  13 +-
 configs/colibri_imx7_defconfig|  14 +-
 configs/colibri_imx7_emmc_defconfig   |  11 +-
 configs/colibri_pxa270_defconfig  |  57 
 configs/colibri_t20_defconfig |   5 -
 configs/colibri_vf_defconfig  |   7 +-
 configs/verdin-imx8mm_defconfig   |   3 +-
 configs/verdin-imx8mp_defconfig   |   2 +-
 doc/board/toradex/apalis-imx8x.rst|  77 -
 doc/board/toradex/index.rst   |   1 -
 include/configs/apalis-imx8.h |   6 +-
 include/configs/apalis-imx8x.h| 127 
 include/configs/apalis-tk1.h  |  12 +-
 include/configs/apalis_imx6.h |  21 +-
 include/configs/apalis_t30.h  |   3 +-
 include/configs/colibri-imx6ull.h |  11 +-
 include/configs/colibri-imx8x.h   |   7 +-
 include/configs/colibri_imx6.h|  16 +-
 include/configs/colibri_imx7.h|  11 +-
 include/configs/colibri_pxa270.h  | 151 --
 include/configs/colibri_t20.h |   1 +
 include/configs/colibri_t30.h |   3 +-
 include/configs/colibri_vf.h  |  11 +-
 include/configs/pxa-common.h  |  27 --
 include/configs/verdin-imx8mm.h   |   7 +-
 include/configs/verdin-imx8mp.h   |   6 -
 50 files changed, 53 insertions(+), 1632 deletions(-)
 delete mode 100644 arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi
 delete mode 100644 arch/arm/dts/fsl-imx8qxp-apalis.dts
 delete mode 100644 board/toradex/apalis-imx8x/Kconfig
 delete mode 100644 board/toradex/apalis-imx8x/MAINTAINERS
 delete mode 100644 board/toradex/apalis-imx8x/Makefile
 delete mode 100644 board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
 delete mode 100644 board/toradex/apalis-imx8x/apalis-imx8x.c
 delete mode 100644 board/toradex/colibri_pxa270/Kconfig
 delete mode 100644 board/toradex/colibri_pxa270/MAINTAINERS
 delete mode 100644 board/toradex/colibri_pxa270/Makefile
 delete mode 100644 board/toradex/colibri_pxa270/colibri_pxa270.c
 delete mode 100644 configs/apalis-imx8x_defconfig
 delete mode 100644 configs/colibri_pxa270_defconfig
 delete mode 100644 doc/board/toradex/apalis-imx8x.rst
 delete mode 100644 include/configs/apalis-imx8x.h
 delete mode 100644 include/configs/colibri_pxa2

[PATCH v2 01/11] toradex: apalis-imx8x: drop support for apalis imx8x

2022-04-13 Thread Marcel Ziswiler
From: Denys Drozdov 

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov 
Signed-off-by: Marcel Ziswiler 
---

(no changes since v1)

 arch/arm/dts/Makefile |   1 -
 arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi   | 139 -
 arch/arm/dts/fsl-imx8qxp-apalis.dts   | 278 --
 arch/arm/mach-imx/imx8/Kconfig|   6 -
 board/toradex/apalis-imx8x/Kconfig|  33 ---
 board/toradex/apalis-imx8x/MAINTAINERS|  10 -
 board/toradex/apalis-imx8x/Makefile   |   6 -
 .../apalis-imx8x/apalis-imx8x-imximage.cfg|  23 --
 board/toradex/apalis-imx8x/apalis-imx8x.c | 155 --
 board/toradex/common/tdx-cfg-block.c  |  13 +-
 configs/apalis-imx8x_defconfig|  82 --
 doc/board/toradex/apalis-imx8x.rst|  77 -
 doc/board/toradex/index.rst   |   1 -
 include/configs/apalis-imx8x.h| 127 
 14 files changed, 1 insertion(+), 950 deletions(-)
 delete mode 100644 arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi
 delete mode 100644 arch/arm/dts/fsl-imx8qxp-apalis.dts
 delete mode 100644 board/toradex/apalis-imx8x/Kconfig
 delete mode 100644 board/toradex/apalis-imx8x/MAINTAINERS
 delete mode 100644 board/toradex/apalis-imx8x/Makefile
 delete mode 100644 board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
 delete mode 100644 board/toradex/apalis-imx8x/apalis-imx8x.c
 delete mode 100644 configs/apalis-imx8x_defconfig
 delete mode 100644 doc/board/toradex/apalis-imx8x.rst
 delete mode 100644 include/configs/apalis-imx8x.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index df7b4addf99..fe9383fe90b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -891,7 +891,6 @@ dtb-$(CONFIG_ARCH_IMX8) += \
imx8qm-rom7720-a1.dtb \
fsl-imx8qxp-ai_ml.dtb \
fsl-imx8qxp-colibri.dtb \
-   fsl-imx8qxp-apalis.dtb \
fsl-imx8qxp-mek.dtb \
imx8-deneb.dtb \
imx8-giedi.dtb
diff --git a/arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi 
b/arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi
deleted file mode 100644
index e41911a04aa..000
--- a/arch/arm/dts/fsl-imx8qxp-apalis-u-boot.dtsi
+++ /dev/null
@@ -1,139 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+ OR MIT
-/*
- * Copyright 2020 Toradex
- */
-
-&{/imx8qx-pm} {
-
-   u-boot,dm-pre-proper;
-};
-
-&mu {
-   u-boot,dm-pre-proper;
-};
-
-&clk {
-   u-boot,dm-pre-proper;
-};
-
-&iomuxc {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio0 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio1 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio2 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio3 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio4 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio5 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio6 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_lsio_gpio7 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_dma {
-   u-boot,dm-pre-proper;
-};
-
-&pd_dma_lpuart0 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_dma_lpuart3 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_conn {
-   u-boot,dm-pre-proper;
-};
-
-&pd_conn_sdch0 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_conn_sdch1 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_conn_sdch2 {
-   u-boot,dm-pre-proper;
-};
-
-&pd_conn_enet0 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio0 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio1 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio2 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio3 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio4 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio5 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio6 {
-   u-boot,dm-pre-proper;
-};
-
-&gpio7 {
-   u-boot,dm-pre-proper;
-};
-
-&lpuart3 {
-   u-boot,dm-pre-proper;
-};
-
-&lpuart0 {
-   u-boot,dm-pre-proper;
-};
-
-&usdhc1 {
-   u-boot,dm-pre-proper;
-   /delete-property/ assigned-clock-parents;
-};
-
-&usdhc2 {
-   u-boot,dm-pre-proper;
-   /delete-property/ assigned-clock-parents;
-};
diff --git a/arch/arm/dts/fsl-imx8qxp-apalis.dts 
b/arch/arm/dts/fsl-imx8qxp-apalis.dts
deleted file mode 100644
index 9cb3d3a809b..000
--- a/arch/arm/dts/fsl-imx8qxp-apalis.dts
+++ /dev/null
@@ -1,278 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+ OR MIT
-/*
- * Copyright 2020 Toradex
- */
-
-/dts-v1/;
-
-#include "fsl-imx8qxp.dtsi"
-#include "fsl-imx8qxp-apalis-u-boot.dtsi"
-
-/ {
-   model = "Toradex Apalis iMX8X";
-   compatible = "toradex,apalis-imx8x", "fsl,imx8qxp";
-
-   chosen {
-   bootargs = "console=ttyLP1,115200";
-   stdout-path = &lpuart1;
-   };
-
-   regulators {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   reg_usb_otg1_vbus: regulator@0 {
-   compatible = "regulator-fixed";

Pull request: u-boot-imx u-boot-imx-20220412

2022-04-13 Thread Stefano Babic

Hi Tom,

please pull from u-boot-imx, thanks !

Note: I picked up Heinrich's patch for Renesas :
ARM: renesas: reduce rcar3_salvator-x image size

due to CI failure. Breakage is in master, too.

The following changes since commit 33ae8c5bebba0874fbc432914406e63fbc219080:

  Merge tag 'efi-2022-07-rc1' of 
https://source.denx.de/u-boot/custodians/u-boot-efi (2022-04-10 11:21:39 
-0400)


are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git 
tags/u-boot-imx-20220413


for you to fetch changes up to a1c711046b0d5478a702b27c6773ea6231eba057:

  board: gateworks: venice: add imx8mm-gw7903 support (2022-04-13 
09:55:26 +0200)


----
u-boot-imx-20220413

i.MX patches for 2022.07

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/11710


Adam Ford (3):
  imx: imx8mm/imx8mn_beacon: Remove redundant code
  arm: imx: imx8mm_beacon: Remove unnecessary configs
  arm: imx: imx8mn_beacon: Remove unnecessary configs

Angus Ainslie (4):
  pinctrl: nxp: don't automatically select DEVRES
  dt-bindings: imx8mq-clock: add mainline definitions
  clk: imx8mq: Add a clock driver for the imx8mq
  clk: imx8m: reduce rate table duplication

Ariel D'Alessandro (5):
  arm: dts: imx8mn_var_som: Set atf-bl31 blob entry type
  phy: nxp-c45-tja11xx: Rename functions to be c45 tja11xx specific
  iopoll: Extend read_poll_timeout macro to support variable parameters
  net: phy: Add phy_modify() accessor
  bsh: imx8mn-smm-s2/pro: Add iMX8MN BSH SMM S2 boards

Clark Wang (1):
  imx: imx8ulp: clock: Add clock support for i3c controller

Clement Faure (2):
  misc: S400_API: add ahab_release_caam
  imx: imx8ulp: release CAAM for the Cortex-A35

Clément Péron (1):
  arm: imx: parse-container: add some missing end of line

Denys Drozdov (2):
  apalis-imx6: avoid save environment unasked
  apalis-tk1: avoid save environment unasked

Elmar Albert (1):
  clk: imx8mp: Add ECSPI clocks

Fabio Estevam (8):
  warp7: Remove UART initialization code
  tbs2910: Convert to DM_SERIAL
  imx8mm-cl-iot-gate: Add SPL EEPROM support
  imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM
  imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM
  imx8mm-cl-iot-gate: Retrieve the serial number from EEPROM
  imx8mm-cl-iot-gate: Add redundand environment support
  warp7: Remove duplicated "mmc dev" command

Francesco Dolcini (2):
  mx6: ddr: Restore ralat/walat in write level calibration
  mx6: ddr: Wait before issuing the first MRS cmd

Gaurav Jain (13):
  crypto/fsl: Add support for CAAM Job ring driver model
  i.MX8M: crypto: updated device tree for supporting DM in SPL
  crypto/fsl: i.MX8M: Enable Job ring driver model.
  i.MX6: Enable Job ring driver model.
  i.MX7: Enable Job ring driver model.
  i.MX7ULP: Enable Job ring driver model.
  i.MX8: Add crypto node in device tree
  crypto/fsl: i.MX8: Enable Job ring driver model.
  Layerscape: Add crypto node in device tree
  Layerscape: Enable Job ring driver model.
  PPC: Add crypto node in device tree
  PPC: Enable Job ring driver model.
  update CAAM MAINTAINER

Heiko Thiery (6):
  ARM: imx: imx8mn-*-evk: use DM settings for PHY configuration
  ARM: imx: imx8mn-*-evk: use reset-gpios in phy node
  ARM: imx: imx8mn-*-evk: add qca, disable-smarteee phy node
  ARM: imx: imx8mn-evk: enable DM_SERIAL
  kontron-pitx-imx8m: change environment address variables
  include: configs: *imx8*: remove IMX_FEC_BASE

Heinrich Schuchardt (1):
  ARM: renesas: reduce rcar3_salvator-x image size

Jesse Taube (4):
  clk: imxrt: Use dts for anatop base address
  configs/*imxrt10*: SYS_MALLOC_LEN is too large
  ARM: dts: imxrt10..-evk: Linux moved pins-imxrt1020 to dts
  board: freescale: imxrt10..-evk: Fix missing include of serial.h

Ji Luo (1):
  imx: imx8ulp: reserve tee memory

Kshitiz Varshney (1):
  LS1043ARDB, LS1046ARDB, LS1088ARDB: Enable SPL_OF_CONTROL in 
SECURE Boot defconfig


Marcel Ziswiler (5):
  arm64: dts: imx8mm-u-boot.dtsi: imx8mp-u-boot.dtsi: use atf-bl31 type
  configs: verdin-imx8mm: verdin-imx8mp: enable dm serial
  colibri-imx6ull: fix nand bch geometry
  configs: colibri-imx6ull/-emmc: use micrel ksz8xxx phy driver
  board: colibri-imx6ull: fix detecting sd card

Marek Vasut (18):
  ARM: dts: net: dwc_eth_qos: Fix i.MX8MP compatible string
  pmic: pca9450: Add PCA9450C compatible string
  ARM: imx: imx8m: Add 933 MHz PLL settings
  imx8m: ddrphy_utils: Add 3732 MT/s mode
  ARM: imx: Decode ECSPI env location from i.MX8M ROMAPI tables
  clk: imx8mp: Fill in DWC3 USB, USB PHY, HSIOMIX clock
  phy: phy-imx8mq-u

[PATCH] gpio: aspeed: Fix incorrect offset of read back register.

2022-04-13 Thread Billy Tsai
The offset of the current read back register is the value of the gpio pin,
not the value written for the gpio output.
This patch fix it to avoid the other gpio output value controlled by the
same register being set incorrectly.

Fixes: 7ad889b0f37a ("gpio: Add Aspeed GPIO driver")
Signed-off-by: Billy Tsai 
---
 drivers/gpio/gpio-aspeed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index a8a2afcb5c..2c5415c671 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -211,7 +211,7 @@ static int aspeed_gpio_direction_output(struct udevice 
*dev, unsigned int offset
struct aspeed_gpio_priv *priv = dev_get_priv(dev);
const struct aspeed_gpio_bank *bank = to_bank(offset);
u32 dir = readl(bank_reg(priv, bank, reg_dir));
-   u32 output = readl(bank_reg(priv, bank, reg_val));
+   u32 output = readl(bank_reg(priv, bank, reg_rdata));
 
dir |= GPIO_BIT(offset);
writel(dir, bank_reg(priv, bank, reg_dir));
@@ -239,7 +239,7 @@ aspeed_gpio_set_value(struct udevice *dev, unsigned int 
offset, int value)
 {
struct aspeed_gpio_priv *priv = dev_get_priv(dev);
const struct aspeed_gpio_bank *bank = to_bank(offset);
-   u32 data = readl(bank_reg(priv, bank, reg_val));
+   u32 data = readl(bank_reg(priv, bank, reg_rdata));
 
if (value)
data |= GPIO_BIT(offset);
-- 
2.25.1



[PATCH V4 4/6] configs: set CONFIG_COUNTER_FREQUENCY

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

Set CONFIG_COUNTER_FREQUENCY according to COUNTER_FREQUENCY in
config header file.

Signed-off-by: Peng Fan 
---
 configs/a3y17lte_defconfig   | 1 +
 configs/a5y17lte_defconfig   | 1 +
 configs/a7y17lte_defconfig   | 1 +
 configs/apalis-imx8_defconfig| 1 +
 configs/apalis-imx8x_defconfig   | 1 +
 configs/bubblegum_96_defconfig   | 1 +
 configs/cgtqmx8_defconfig| 1 +
 configs/colibri-imx8x_defconfig  | 1 +
 configs/cortina_presidio-asic-base_defconfig | 1 +
 configs/cortina_presidio-asic-emmc_defconfig | 1 +
 configs/cortina_presidio-asic-pnand_defconfig| 1 +
 configs/cubieboard7_defconfig| 1 +
 configs/deneb_defconfig  | 1 +
 configs/dragonboard410c_defconfig| 1 +
 configs/dragonboard820c_defconfig| 1 +
 configs/espresso7420_defconfig   | 1 +
 configs/evb-px30_defconfig   | 1 +
 configs/evb-px5_defconfig| 1 +
 configs/evb-rk3308_defconfig | 1 +
 configs/evb-rk3328_defconfig | 1 +
 configs/evb-rk3399_defconfig | 1 +
 configs/evb-rk3568_defconfig | 1 +
 configs/firefly-px30_defconfig   | 1 +
 configs/firefly-rk3399_defconfig | 1 +
 configs/hihope_rzg2_defconfig| 1 +
 configs/hikey960_defconfig   | 1 +
 configs/hikey_defconfig  | 1 +
 configs/imx8qm_mek_defconfig | 1 +
 configs/imx8qm_rom7720_a1_4G_defconfig   | 1 +
 configs/imx8qxp_mek_defconfig| 1 +
 configs/khadas-edge-captain-rk3399_defconfig | 1 +
 configs/khadas-edge-rk3399_defconfig | 1 +
 configs/khadas-edge-v-rk3399_defconfig   | 1 +
 configs/kontron_sl28_defconfig   | 1 +
 configs/leez-rk3399_defconfig| 1 +
 configs/ls1012a2g5rdb_qspi_defconfig | 1 +
 configs/ls1012a2g5rdb_tfa_defconfig  | 1 +
 configs/ls1021aiot_qspi_defconfig| 1 +
 configs/ls1021aiot_sdcard_defconfig  | 1 +
 configs/ls1021aqds_ddr4_nor_defconfig| 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 +
 configs/ls1021aqds_nand_defconfig| 1 +
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig | 1 +
 configs/ls1021aqds_nor_defconfig | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig  | 1 +
 configs/ls1021aqds_qspi_defconfig| 1 +
 configs/ls1021aqds_sdcard_ifc_defconfig  | 1 +
 configs/ls1021aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1021atsn_qspi_defconfig| 1 +
 configs/ls1021atsn_sdcard_defconfig  | 1 +
 configs/ls1021atwr_nor_SECURE_BOOT_defconfig | 1 +
 configs/ls1021atwr_nor_defconfig | 1 +
 configs/ls1021atwr_nor_lpuart_defconfig  | 1 +
 configs/ls1021atwr_qspi_defconfig| 1 +
 configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig  | 1 +
 configs/ls1021atwr_sdcard_ifc_defconfig  | 1 +
 configs/ls1021atwr_sdcard_qspi_defconfig | 1 +
 configs/ls1043aqds_defconfig | 1 +
 configs/ls1043aqds_lpuart_defconfig  | 1 +
 configs/ls1043aqds_nand_defconfig| 1 +
 configs/ls1043aqds_nor_ddr3_defconfig| 1 +
 configs/ls1043aqds_qspi_defconfig| 1 +
 configs/ls1043aqds_sdcard_ifc_defconfig  | 1 +
 configs/ls1043aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1043aqds_tfa_defconfig | 1 +
 configs/ls1046afrwy_tfa_SECURE_BOOT_defconfig| 1 +
 configs/ls1046afrwy_tfa_defconfig| 1 +
 configs/ls1088ardb_qspi_SECURE_BOOT_defconfig| 1 +
 configs/ls1088ardb_qspi_defconfig| 1 +
 configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig | 1 +
 configs/ls1088ardb_sdcard_qspi_defconfig | 1 +
 configs/ls1088ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1088ardb_tfa_defconfig | 1 +
 configs/mt8183_pumpkin_defconfig | 1 +
 configs/mt8512_bm1_emmc_defconfig| 1 +
 configs/mt8516_pumpkin_defconfig | 1 +
 configs/mt8518_ap1_emmc_defconfig| 1 +
 configs/nanopc-t4-rk3399_defconfig   | 1 +
 configs/nanopi-m4-2gb-rk3399_defconfig   | 1 +
 configs/nanopi-m4-rk3399_defconfig   | 1 +
 configs/

[PATCH V4 5/6] include/configs: drop COUNTER_FREQUENCY

2022-04-13 Thread Peng Fan (OSS)
From: Peng Fan 

Since we have CONFIG_COUNTER_FREQUENCY enabled, no need COUNTER_FREQUENCY

Signed-off-by: Peng Fan 
---
 arch/arm/cpu/armv8/fsl-layerscape/spintable.S | 2 +-
 include/configs/apalis-imx8.h | 3 ---
 include/configs/apalis-imx8x.h| 3 ---
 include/configs/capricorn-common.h| 3 ---
 include/configs/cgtqmx8.h | 3 ---
 include/configs/colibri-imx8x.h   | 1 -
 include/configs/condor.h  | 3 ---
 include/configs/draak.h   | 3 ---
 include/configs/dragonboard410c.h | 3 ---
 include/configs/dragonboard820c.h | 3 ---
 include/configs/eagle.h   | 3 ---
 include/configs/ebisu.h   | 3 ---
 include/configs/exynos-common.h   | 1 -
 include/configs/exynos7420-common.h   | 3 ---
 include/configs/exynos78x0-common.h   | 3 ---
 include/configs/falcon.h  | 3 ---
 include/configs/hihope-rzg2.h | 3 ---
 include/configs/hikey.h   | 3 ---
 include/configs/hikey960.h| 3 ---
 include/configs/imx8qm_mek.h  | 3 ---
 include/configs/imx8qm_rom7720.h  | 3 ---
 include/configs/imx8qxp_mek.h | 3 ---
 include/configs/kontron_sl28.h| 1 -
 include/configs/ls1012a_common.h  | 3 ---
 include/configs/ls1021aiot.h  | 1 -
 include/configs/ls1021aqds.h  | 1 -
 include/configs/ls1021atsn.h  | 1 -
 include/configs/ls1021atwr.h  | 1 -
 include/configs/ls1028a_common.h  | 3 ---
 include/configs/ls1043a_common.h  | 3 ---
 include/configs/ls1046a_common.h  | 3 ---
 include/configs/ls1088aqds.h  | 1 -
 include/configs/ls1088ardb.h  | 1 -
 include/configs/ls2080a_common.h  | 2 --
 include/configs/lx2160a_common.h  | 1 -
 include/configs/mt8183.h  | 1 -
 include/configs/mt8512.h  | 1 -
 include/configs/mt8516.h  | 1 -
 include/configs/mt8518.h  | 1 -
 include/configs/mx6_common.h  | 1 -
 include/configs/mx7_common.h  | 1 -
 include/configs/owl-common.h  | 3 ---
 include/configs/p2371-2180.h  | 3 ---
 include/configs/p2771-.h  | 3 ---
 include/configs/p3450-.h  | 3 ---
 include/configs/presidio_asic.h   | 3 +--
 include/configs/px30_common.h | 1 -
 include/configs/rk3036_common.h   | 1 -
 include/configs/rk3128_common.h   | 1 -
 include/configs/rk322x_common.h   | 1 -
 include/configs/rk3288_common.h   | 1 -
 include/configs/rk3308_common.h   | 1 -
 include/configs/rk3328_common.h   | 1 -
 include/configs/rk3368_common.h   | 1 -
 include/configs/rk3399_common.h   | 1 -
 include/configs/rk3568_common.h   | 1 -
 include/configs/salvator-x.h  | 3 ---
 include/configs/sdm845.h  | 3 ---
 include/configs/silinux-ek874.h   | 3 ---
 include/configs/socfpga_soc64_common.h| 5 -
 include/configs/sunxi-common.h| 1 -
 include/configs/ten64.h   | 1 -
 include/configs/thunderx_88xx.h   | 3 ---
 include/configs/ulcb.h| 3 ---
 include/configs/vexpress_aemv8.h  | 3 ---
 include/configs/xilinx_versal.h   | 5 -
 include/configs/xilinx_zynqmp.h   | 5 -
 67 files changed, 2 insertions(+), 147 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spintable.S 
b/arch/arm/cpu/armv8/fsl-layerscape/spintable.S
index d6bd1884599..1eb0c2d4a7e 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spintable.S
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spintable.S
@@ -113,6 +113,6 @@ _dead_loop:
.align 3
.global __real_cntfrq
 __real_cntfrq:
-   .quad COUNTER_FREQUENCY
+   .quad CONFIG_COUNTER_FREQUENCY
/* Secondary Boot Code ends here */
 __secondary_boot_code_end:
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index c87bcd475ef..e759f18fe46 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -84,7 +84,4 @@
 #define CONFIG_SYS_PBSIZE  (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
 
-/* Generic Timer Definitions */
-#define COUNTER_FREQUENCY  800 /* 8MHz */
-
 #endif /* __APALIS_IMX8_H */
diff --git a/include/configs/apalis-imx8x.h b/include/configs/apalis-imx8x.h
index 71a80f38bbb..17f1981643f 100644
--- a/include/configs/apalis-imx8x.h
+++ b/include/configs/apalis-imx8x.h
@@ -115,9 +115,6 @@
 #define CONFIG_SYS_PBSIZE

Re: [PATCH] build: allow a downstream suffix in the version shown during boot

2022-04-13 Thread Nicolas Boulenguez
> Why do you need this, instead of just using CONFIG_LOCALVERSION?

Because we were not aware of this option.
Thanks for the hint and sorry for the noise.


RFC: Updating i.MX8M CPU thermal trip-point at runtime

2022-04-13 Thread Andrejs Cainikovs

Hi everyone,

Recent issue that I had to deal with sparkled a discussion within my 
team, and seems like we are not sure what would be a proper way to go, 
even if there are multiple ways to do it. We decided to ask this 
question to open-source community, in case someone has thoughts about it.


At Toradex we have multiple computer on modules, each of those has few 
variants - different memory sizes, with or without WiFi/BT, etc. One of 
the options is also a temperature grade - IT and non-IT. Obviously, we 
want to keep number of device trees as minimal as possible, since number 
of device trees grows exponentially if we add a new option via device 
tree, i.e. imx8mm-verdin-it-wifi-dev.dts + imx8mm-verdin-nonit-wifi-dev.dts.


Hence, we are working on a change that would update trips temperatures 
in Linux device tree on the fly, setting them to whatever is read from 
CPU fuses. Now, the question is - where would be the best place to do 
it? So far we were thinking about following options:


- Patching U-Boot thermal driver so that it would propagate max 
temperature to Linux device tree.
- Patching U-Boot board files to update Linux device tree via 
ft_board_setup(). This, however, will result in a duplicate code among 
different boards within same SoC family.

- Anything else not listed here.

I would appreciate any comments or thoughts regarding this topic. Thanks,

Best regards,
Andrejs Cainikovs.


Re: [PATCH v2 08/18] pci: Fix use of flags in dm_pci_map_bar()

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> The flags parameter of dm_pci_map_bar() is used for PCI region flags
> rather than memory mapping flags. Fix the type to match that of the
> region flags and stop using the regions flags as memory mapping flags.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/pci/pci-uclass.c | 10 +-
>  include/pci.h|  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 33dda2..8bbeb62f2e 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -1533,8 +1533,8 @@ static phys_addr_t dm_pci_map_ea_virt(struct udevice 
> *dev, int ea_off,
> return addr;
>  }
>
> -static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
> -  int ea_off, struct pci_child_plat *pdata)
> +static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int ea_off,
> +  struct pci_child_plat *pdata)
>  {
> int ea_cnt, i, entry_size;
> int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2;
> @@ -1577,13 +1577,13 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, 
> int bar, int flags,
> addr += dm_pci_map_ea_virt(dev, ea_off, pdata);
>
> /* size ignored for now */
> -   return map_physmem(addr, 0, flags);
> +   return map_physmem(addr, 0, MAP_NOCACHE);
> }
>
> return 0;
>  }
>
> -void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
> +void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags)

Why is this change (int => unsigned long) necessary?

>  {
> struct pci_child_plat *pdata = dev_get_parent_plat(dev);
> struct udevice *udev = dev;
> @@ -1608,7 +1608,7 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int 
> flags)
>  */
> ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
> if (ea_off)
> -   return dm_pci_map_ea_bar(udev, bar, flags, ea_off, pdata);
> +   return dm_pci_map_ea_bar(udev, bar, ea_off, pdata);
>
> /* read BAR address */
> dm_pci_read_config32(udev, bar, &bar_response);
> diff --git a/include/pci.h b/include/pci.h
> index 673c95c6bb..5ba82826f4 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -1472,7 +1472,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, 
> phys_addr_t addr,
>   * @flags: Flags for the region type (PCI_REGION_...)
>   * @return: pointer to the virtual address to use or 0 on error
>   */
> -void *dm_pci_map_bar(struct udevice *dev, int bar, int flags);
> +void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags);
>
>  /**
>   * dm_pci_find_next_capability() - find a capability starting from an offset
> --

Regards,
Bin


Re: [PATCH v2 09/18] pci: Add config for Enhanced Allocation

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Add a config to control whether Enhanced Allocation is supported by the
> driver.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/pci/Kconfig  |  7 +++
>  drivers/pci/pci-uclass.c | 25 +++--
>  2 files changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index 47cd074aa1..fd2203420c 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -67,6 +67,13 @@ config PCI_SRIOV
>   if available on a PCI Physical Function device and probe for
>   applicable drivers.
>
> +config PCI_ENHANCED_ALLOCATION
> +   bool "Enable support for Enhanced Allocation of resources"
> +   default y
> +   help
> + Enable support for Enhanced Allocation which can be used by 
> supported
> + devices in place of traditional BARS for allocation of resources.
> +

Why do we need a config option for EA as it can be figured out in the run time?

>  config PCI_ARID
>  bool "Enable Alternate Routing-ID support for PCI"
>  help
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 8bbeb62f2e..719656eb3a 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -645,7 +645,11 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
> return log_msg_ret("probe", -EINVAL);
> }
>
> -   ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
> +   if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION))
> +   ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
> +   else
> +   ea_pos = 0;
> +
> if (ea_pos) {
> dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),
> ®);
> @@ -1600,15 +1604,16 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, 
> unsigned long flags)
> udev = pdata->pfdev;
> }
>
> -   /*
> -* if the function supports Enhanced Allocation use that instead of
> -* BARs
> -* Incase of virtual functions, pdata will help read VF BEI
> -* and EA entry size.
> -*/
> -   ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
> -   if (ea_off)
> -   return dm_pci_map_ea_bar(udev, bar, ea_off, pdata);
> +   if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION)) {
> +   /*
> +* If the function supports Enhanced Allocation use that
> +* instead of BARs. Incase of virtual functions, pdata will
> +* help read VF BEI and EA entry size.
> +*/
> +   ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
> +   if (ea_off)
> +   return dm_pci_map_ea_bar(udev, bar, ea_off, pdata);
> +   }
>
> /* read BAR address */
> dm_pci_read_config32(udev, bar, &bar_response);
> --

Regards,
Bin


Re: [PATCH v2 06/18] virtio: pci: Check virtio capability is in bounds

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Ensure the virtio PCI capabilities are contained within the bounds of
> the device's configuration space. The expected size of the capability is
> passed when searching for the capability to enforce this check.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/virtio/virtio_pci_modern.c | 20 
>  1 file changed, 16 insertions(+), 4 deletions(-)
>

Reviewed-by: Bin Meng 


Re: [PATCH v2 07/18] virtio: pci: Read entire capability into memory

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Read the virtio PCI capability out of the device configuration space to
> a struct rather than accessing fields directly from the configuration
> space as they are needed. This both makes access to the fields easier
> and avoids re-reading fields.
>
> Re-reading fields could result in time-of-check to time-of-use problems,
> should the value in the configuration space change. The range check of
> the `bar` field and the later call to `dm_pci_read_bar32()` is an
> example of where this could happen.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/virtio/virtio_pci_modern.c | 72 --
>  1 file changed, 38 insertions(+), 34 deletions(-)
>

Reviewed-by: Bin Meng 


Re: [PATCH v2 11/18] pci: Range check address conversions

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> When converting between PCI bus and physical addresses, include a length
> parameter that can be used to check that the entire range fits within
> one of the PCI regions. This prevents an address being returned that
> might be only partially valid for the range it is going to be used for.
>
> Where the range check is not wanted, passing a length of 0 will have the
> same behaviour as before this change.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/pci/pci-uclass.c | 57 
>  include/pci.h| 20 +++---
>  2 files changed, 46 insertions(+), 31 deletions(-)
>

Reviewed-by: Bin Meng 


Re: [PATCH v2 12/18] test: pci: Test PCI address conversion functions

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Add tests for the functions dm_pci_bus_to_phys() and
> dm_pci_phys_to_bus() which convert between PCI bus addresses and
> physical addresses based on the ranges declared for the PCI controller.
>
> The ranges of bus#1 are used for the tests, adding a translation to one
> of the ranges to cover more cases.
>
> Signed-off-by: Andrew Scull 
> ---
>  arch/sandbox/dts/test.dts |   2 +-
>  test/dm/pci.c | 102 ++
>  2 files changed, 103 insertions(+), 1 deletion(-)
>
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index 48ca3e1e47..76c75e08e7 100644
> --- a/arch/sandbox/dts/test.dts
> +++ b/arch/sandbox/dts/test.dts
> @@ -979,7 +979,7 @@
> #address-cells = <3>;
> #size-cells = <2>;
> ranges = <0x0200 0 0x3000 0x3000 0 0x2000 // MEM0
> - 0x0200 0 0x3100 0x3100 0 0x2000 // MEM1
> + 0x0200 0 0x3100 0x3e00 0 0x2000 // MEM1
>   0x0100 0 0x4000 0x4000 0 0x2000>;
> sandbox,dev-info = <0x08 0x00 0x1234 0x5678
> 0x0c 0x00 0x1234 0x5678
> diff --git a/test/dm/pci.c b/test/dm/pci.c
> index 00e4440a9d..9789103c7d 100644
> --- a/test/dm/pci.c
> +++ b/test/dm/pci.c
> @@ -376,3 +376,105 @@ static int dm_test_pci_region_multi(struct 
> unit_test_state *uts)
> return 0;
>  }
>  DM_TEST(dm_test_pci_region_multi, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> +
> +/*
> + * Test the translation of PCI bus addresses to physical addresses using the
> + * ranges from bus#1.
> + */
> +static int dm_test_pci_bus_to_phys(struct unit_test_state *uts)
> +{
> +   struct udevice *dev;
> +   phys_addr_t phys_addr;
> +
> +   ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &dev));
> +
> +   /* Before any of the ranges. */
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x2000, 0x400, 
> PCI_REGION_MEM);
> +   ut_asserteq(0, phys_addr);
> +
> +   /* Identity range: whole, start, mid, end */
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x2fff, 0x2000, 
> PCI_REGION_MEM);

I guess you wanted to test 0x2000 with 0x2000 range, for checking
the overlap of the start address?

> +   ut_asserteq(0, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3000, 0x2000, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3000, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3000, 0x1000, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3000, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3abc, 0x12, PCI_REGION_MEM);
> +   ut_asserteq(0x3abc, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3800, 0x1800, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3800, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x30008000, 0x1801, 
> PCI_REGION_MEM);
> +   ut_asserteq(0, phys_addr);
> +
> +   /* Translated range: whole, start, mid, end */
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x30ff, 0x2000, 
> PCI_REGION_MEM);

0x30fff000?

> +   ut_asserteq(0, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3100, 0x2000, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3e00, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3100, 0x1000, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3e00, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x31000abc, 0x12, PCI_REGION_MEM);
> +   ut_asserteq(0x3e000abc, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x31000800, 0x1800, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3e000800, phys_addr);
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x31008000, 0x1801, 
> PCI_REGION_MEM);
> +   ut_asserteq(0, phys_addr);
> +
> +   /* Beyond all of the ranges. */
> +   phys_addr = dm_pci_bus_to_phys(dev, 0x3200, 0x400, 
> PCI_REGION_MEM);
> +   ut_asserteq(0, phys_addr);
> +
> +   return 0;
> +}
> +DM_TEST(dm_test_pci_bus_to_phys, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> +
> +/*
> + * Test the translation of physical addresses to PCI bus addresses using the
> + * ranges from bus#1.
> + */
> +static int dm_test_pci_phys_to_bus(struct unit_test_state *uts)
> +{
> +   struct udevice *dev;
> +   phys_addr_t phys_addr;

This should be pci_addr_t bus_addr

> +
> +   ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &dev));
> +
> +   /* Before any of the ranges. */
> +   phys_addr = dm_pci_phys_to_bus(dev, 0x2000, 0x400, 
> PCI_REGION_MEM);
> +   ut_asserteq(0, phys_addr);
> +
> +   /* Identity range: whole, start, mid, end */
> +   phys_addr = dm_pci_phys_to_bus(dev, 0x2fff, 0x2000, 
> PCI_REGION_MEM);
> +   ut_asserteq(0, phys_addr);
> +   phys_addr = dm_pci_phys_to_bus(dev, 0x3000, 0x2000, 
> PCI_REGION_MEM);
> +   ut_asserteq(0x3000,

Re: [PATCH v2 13/18] pci: Map bars with offset and length

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Evolve dm_pci_map_bar() to include an offset and length parameter. These
> allow a portion of the memory to be mapped and range checks to be
> applied.
>
> Passing both the offset and length as zero results in the previous
> behaviour and this is used to migtate the previous callers.

migtate?

>
> Signed-off-by: Andrew Scull 
> ---
>  arch/x86/cpu/baytrail/cpu.c |  2 +-
>  drivers/ata/ahci.c  |  8 +++
>  drivers/gpio/octeon_gpio.c  |  2 +-
>  drivers/i2c/designware_i2c_pci.c|  2 +-
>  drivers/i2c/intel_i2c.c |  2 +-
>  drivers/i2c/octeon_i2c.c|  2 +-
>  drivers/mmc/octeontx_hsmmc.c|  2 +-
>  drivers/mmc/pci_mmc.c   |  2 +-
>  drivers/mtd/nand/raw/octeontx_bch.c |  4 ++--
>  drivers/mtd/nand/raw/octeontx_nand.c|  2 +-
>  drivers/net/bnxt/bnxt.c |  6 +++---
>  drivers/net/fsl_enetc.c |  2 +-
>  drivers/net/fsl_enetc_mdio.c|  2 +-
>  drivers/net/mscc_eswitch/felix_switch.c |  4 ++--
>  drivers/net/octeontx/bgx.c  |  2 +-
>  drivers/net/octeontx/nic_main.c |  2 +-
>  drivers/net/octeontx/nicvf_main.c   |  2 +-
>  drivers/net/octeontx/smi.c  |  2 +-
>  drivers/net/octeontx2/cgx.c |  2 +-
>  drivers/net/octeontx2/rvu_af.c  |  2 +-
>  drivers/net/octeontx2/rvu_pf.c  |  2 +-
>  drivers/net/pch_gbe.c   |  2 +-
>  drivers/nvme/nvme_pci.c |  4 ++--
>  drivers/pci/pci-uclass.c| 28 +
>  drivers/spi/octeon_spi.c|  2 +-
>  drivers/usb/host/ohci-pci.c |  2 +-
>  drivers/virtio/virtio_pci_legacy.c  |  2 +-
>  include/pci.h   |  5 -
>  test/dm/pci.c   | 12 +--
>  29 files changed, 63 insertions(+), 50 deletions(-)
>

Regards,
Bin


Re: [PATCH] misc: Port USB251xB/xBi Hi-Speed Hub Controller Driver from Linux

2022-04-13 Thread Marek Vasut

On 4/13/22 09:27, Michal Simek wrote:



On 4/10/22 06:27, Marek Vasut wrote:

This patch adds a driver for configuration of the Microchip USB251xB/xBi
USB 2.0 hub controller series with USB 2.0 upstream connectivity, SMBus
configuration interface and two to four USB 2.0 downstream ports.

This is ported from Linux as of Linux kernel commit
5c2b9c61ae5d8 ("usb: usb251xb: add boost-up property support")


The patch is aligned with kernel as you said but I expect this hub will 
be described on i2c bus which is based on
https://lore.kernel.org/all/cal_jsqjedhx6typpukbnzv7clk6uzvjq3cyg9iy_j5dlpqv...@mail.gmail.com/ 



not where Rob would like to see ends.

It is not a problem with the patch from my point of view I just wanted 
to let you know that based on him it should be handled differently.


Can you include me in that discussion ?

However, it seems the discussion is not about USB251x , but some other 
hub which is connected over HSIC, not USB, that's likey why Rob wants it 
described differently than this hub.


Re: [PATCH 0/6] introduce Arm FF-A support

2022-04-13 Thread Abdellatif El Khlifi
On Tue, Apr 12, 2022 at 08:28:42AM -0500, Rob Herring wrote:
> On Tue, Apr 12, 2022 at 7:01 AM Tom Rini  wrote:
> >
> > On Tue, Apr 12, 2022 at 12:43:15PM +0100, Abdellatif El Khlifi wrote:
> > > On Thu, Apr 07, 2022 at 08:58:11AM -0400, Tom Rini wrote:
> > > > On Thu, Apr 07, 2022 at 01:54:24PM +0100, Abdellatif El Khlifi wrote:
> > > > > On Wed, Apr 06, 2022 at 03:47:11PM -0400, Tom Rini wrote:
> > > > > > On Tue, Mar 29, 2022 at 04:16:53PM +0100, 
> > > > > > abdellatif.elkhl...@arm.com wrote:
> > > > > > > From: Abdellatif El Khlifi 
> > > > > > >
> > > > > > > This patchset adds support for Arm FF-A (Arm Firmware Framework 
> > > > > > > for Armv8-A v1.0).
> > > > > > >
> > > > > > > FF-A support is generic by design and can be used by any Arm 
> > > > > > > platform.
> > > > > > >
> > > > > > > The features added are as follows:
> > > > > > >
> > > > > > > 1/ FF-A device driver
> > > > > > > 2/ armffa command
> > > > > > > 3/ FF-A Sandbox driver
> > > > > > > 4/ FF-A Sandbox test cases
> > > > > > > 5/ FF-A MM communication
> > > > > > >
> > > > > > >
> > > > > > > The suggested design sees FF-A as a data bus allowing data 
> > > > > > > exchange with the firmware
> > > > > > > running under TrustZone HW (such as Optee). The same approach was 
> > > > > > > followed in the
> > > > > > > FF-A driver in Linux kernel 
> > > > > > > (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/arm_ffa/bus.c?h=v5.15#n211))
> > > > > > >
> > > > > > > u-boot boards using FF-A can provide a device tree node in a 
> > > > > > > -u-boot.dtsi file.
> > > > > > > Since the node can not be hosted in Linux device tree, we suggest 
> > > > > > > using u-boot device tree.
> > > > > >
> > > > > > Why can't the node be in the upstream tree?  It should be, so that 
> > > > > > it
> > > > > > can be shared between all users.  Especially since there's in-Linux
> > > > > > users?
> > > > > >
> > > > > > --
> > > > > > Tom
> > > > >
> > > > > Linux already has an FF-A bus driver and doesn't use a device tree 
> > > > > node for FF-A.
> > > > >
> > > > > The Linux driver registers FF-A as a bus:
> > > > >
> > > > > int arm_ffa_bus_init(void)
> > > > > {
> > > > >   return bus_register(&ffa_bus_type);
> > > > > }
> > > > >
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/arm_ffa/bus.c?h=v5.15#n211
> > > > >
> > > > > So, there is no user for the node in Linux. That's why we suggest 
> > > > > hosting the node in the u-boot device tree (a u-boot.dtsi file)
> > > >
> > > > OK, but you can still push it upstream as it's not required to have an
> > > > in tree user.
> > >
> > > During the review of Corstone-1000 patchset, Rui Silva had a discussion 
> > > with the Linux device tree maintainer
> > > (Rob Herring). Rob is not in favour of an FFA node in the kernel device 
> > > tree. This is why we are including the FFA node
> > > in u-boot device tree (u-boot.dtsi files).
> 
> Sigh. There is not a 'kernel device tree' and a 'u-boot device tree'.
> There is only 1. For SystemReadyIR compliance, that is a hard
> requirement.
> 
> > I'm a bit confused now, can you please link to the kernel thread?  Or
> > Rob, can you chime in here please?
> 
> The FFA DT binding was rejected in favor of making FFA discoverable.
> The FFA spec was amended to address that. DT is only for what we
> failed to make discoverable. For hardware, we're stuck with it. We
> shouldn't repeat that for software interfaces.
> 
> Rob

Guys,

Since we can not add an FFA node in the device tree, we will make FFA a 
discoverable bus.
So, we will manually create the udevice, binding it to the driver and probing 
it.
Manually means directly calling device_bind and device_probe APIs.

Any thoughts about this approach ?

Abdellatif



[PATCH v2 01/12] virtio_ring: Merge identical variables

2022-04-13 Thread Andrew Scull
The variables `total_sg` and `descs_used` have the same value. Replace
the few uses of `total_sg` with `descs_used` to simplify the situation.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_ring.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 7f1cbc5932..a6922ce1b8 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -20,17 +20,16 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg 
*sgs[],
  unsigned int out_sgs, unsigned int in_sgs)
 {
struct vring_desc *desc;
-   unsigned int total_sg = out_sgs + in_sgs;
-   unsigned int i, n, avail, descs_used, uninitialized_var(prev);
+   unsigned int descs_used = out_sgs + in_sgs;
+   unsigned int i, n, avail, uninitialized_var(prev);
int head;
 
-   WARN_ON(total_sg == 0);
+   WARN_ON(descs_used == 0);
 
head = vq->free_head;
 
desc = vq->vring.desc;
i = head;
-   descs_used = total_sg;
 
if (vq->num_free < descs_used) {
debug("Can't add buf len %i - avail = %i\n",
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 02/12] virtio_ring: Add helper to attach vring descriptor

2022-04-13 Thread Andrew Scull
Move the logic for attaching a descriptor to its own function.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_ring.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index a6922ce1b8..8e0cb3d666 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -16,6 +16,18 @@
 #include 
 #include 
 
+static unsigned int virtqueue_attach_desc(struct virtqueue *vq, unsigned int i,
+ struct virtio_sg *sg, u16 flags)
+{
+   struct vring_desc *desc = &vq->vring.desc[i];
+
+   desc->addr = cpu_to_virtio64(vq->vdev, (u64)(uintptr_t)sg->addr);
+   desc->len = cpu_to_virtio32(vq->vdev, sg->length);
+   desc->flags = cpu_to_virtio16(vq->vdev, flags);
+
+   return virtio16_to_cpu(vq->vdev, desc->next);
+}
+
 int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[],
  unsigned int out_sgs, unsigned int in_sgs)
 {
@@ -45,26 +57,14 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg 
*sgs[],
}
 
for (n = 0; n < out_sgs; n++) {
-   struct virtio_sg *sg = sgs[n];
-
-   desc[i].flags = cpu_to_virtio16(vq->vdev, VRING_DESC_F_NEXT);
-   desc[i].addr = cpu_to_virtio64(vq->vdev, (u64)(size_t)sg->addr);
-   desc[i].len = cpu_to_virtio32(vq->vdev, sg->length);
-
prev = i;
-   i = virtio16_to_cpu(vq->vdev, desc[i].next);
+   i = virtqueue_attach_desc(vq, i, sgs[n], VRING_DESC_F_NEXT);
}
for (; n < (out_sgs + in_sgs); n++) {
-   struct virtio_sg *sg = sgs[n];
-
-   desc[i].flags = cpu_to_virtio16(vq->vdev, VRING_DESC_F_NEXT |
-   VRING_DESC_F_WRITE);
-   desc[i].addr = cpu_to_virtio64(vq->vdev,
-  (u64)(uintptr_t)sg->addr);
-   desc[i].len = cpu_to_virtio32(vq->vdev, sg->length);
+   u16 flags = VRING_DESC_F_NEXT | VRING_DESC_F_WRITE;
 
prev = i;
-   i = virtio16_to_cpu(vq->vdev, desc[i].next);
+   i = virtqueue_attach_desc(vq, i, sgs[n], flags);
}
/* Last one doesn't continue */
desc[prev].flags &= cpu_to_virtio16(vq->vdev, ~VRING_DESC_F_NEXT);
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 03/12] virtio_ring: Maintain a shadow copy of descriptors

2022-04-13 Thread Andrew Scull
The shared descriptors should only be written by the guest driver,
however, the device is still able to overwrite and corrupt them.
Maintain a private shadow copy of the descriptors for the driver to
use for state tracking, removing the need to read from the shared
descriptors.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_ring.c | 49 
 include/virtio_ring.h| 10 
 2 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 8e0cb3d666..69fd8c6aa0 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -19,13 +19,21 @@
 static unsigned int virtqueue_attach_desc(struct virtqueue *vq, unsigned int i,
  struct virtio_sg *sg, u16 flags)
 {
+   struct vring_desc_shadow *desc_shadow = &vq->vring_desc_shadow[i];
struct vring_desc *desc = &vq->vring.desc[i];
 
-   desc->addr = cpu_to_virtio64(vq->vdev, (u64)(uintptr_t)sg->addr);
-   desc->len = cpu_to_virtio32(vq->vdev, sg->length);
-   desc->flags = cpu_to_virtio16(vq->vdev, flags);
+   /* Update the shadow descriptor. */
+   desc_shadow->addr = (u64)(uintptr_t)sg->addr;
+   desc_shadow->len = sg->length;
+   desc_shadow->flags = flags;
 
-   return virtio16_to_cpu(vq->vdev, desc->next);
+   /* Update the shared descriptor to match the shadow. */
+   desc->addr = cpu_to_virtio64(vq->vdev, desc_shadow->addr);
+   desc->len = cpu_to_virtio32(vq->vdev, desc_shadow->len);
+   desc->flags = cpu_to_virtio16(vq->vdev, desc_shadow->flags);
+   desc->next = cpu_to_virtio16(vq->vdev, desc_shadow->next);
+
+   return desc_shadow->next;
 }
 
 int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[],
@@ -67,7 +75,8 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg 
*sgs[],
i = virtqueue_attach_desc(vq, i, sgs[n], flags);
}
/* Last one doesn't continue */
-   desc[prev].flags &= cpu_to_virtio16(vq->vdev, ~VRING_DESC_F_NEXT);
+   vq->vring_desc_shadow[prev].flags &= ~VRING_DESC_F_NEXT;
+   desc[prev].flags = cpu_to_virtio16(vq->vdev, 
vq->vring_desc_shadow[prev].flags);
 
/* We're using some buffers from the free list. */
vq->num_free -= descs_used;
@@ -136,17 +145,16 @@ void virtqueue_kick(struct virtqueue *vq)
 static void detach_buf(struct virtqueue *vq, unsigned int head)
 {
unsigned int i;
-   __virtio16 nextflag = cpu_to_virtio16(vq->vdev, VRING_DESC_F_NEXT);
 
/* Put back on free list: unmap first-level descriptors and find end */
i = head;
 
-   while (vq->vring.desc[i].flags & nextflag) {
-   i = virtio16_to_cpu(vq->vdev, vq->vring.desc[i].next);
+   while (vq->vring_desc_shadow[i].flags & VRING_DESC_F_NEXT) {
+   i = vq->vring_desc_shadow[i].next;
vq->num_free++;
}
 
-   vq->vring.desc[i].next = cpu_to_virtio16(vq->vdev, vq->free_head);
+   vq->vring_desc_shadow[i].next = vq->free_head;
vq->free_head = head;
 
/* Plus final descriptor */
@@ -199,8 +207,7 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int 
*len)
virtio_store_mb(&vring_used_event(&vq->vring),
cpu_to_virtio16(vq->vdev, vq->last_used_idx));
 
-   return (void *)(uintptr_t)virtio64_to_cpu(vq->vdev,
- vq->vring.desc[i].addr);
+   return (void *)(uintptr_t)vq->vring_desc_shadow[i].addr;
 }
 
 static struct virtqueue *__vring_new_virtqueue(unsigned int index,
@@ -209,6 +216,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int 
index,
 {
unsigned int i;
struct virtqueue *vq;
+   struct vring_desc_shadow *vring_desc_shadow;
struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
struct udevice *vdev = uc_priv->vdev;
 
@@ -216,10 +224,17 @@ static struct virtqueue *__vring_new_virtqueue(unsigned 
int index,
if (!vq)
return NULL;
 
+   vring_desc_shadow = calloc(vring.num, sizeof(struct vring_desc_shadow));
+   if (!vring_desc_shadow) {
+   free(vq);
+   return NULL;
+   }
+
vq->vdev = vdev;
vq->index = index;
vq->num_free = vring.num;
vq->vring = vring;
+   vq->vring_desc_shadow = vring_desc_shadow;
vq->last_used_idx = 0;
vq->avail_flags_shadow = 0;
vq->avail_idx_shadow = 0;
@@ -237,7 +252,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int 
index,
/* Put everything in free lists */
vq->free_head = 0;
for (i = 0; i < vring.num - 1; i++)
-   vq->vring.desc[i].next = cpu_to_virtio16(vdev, i + 1);
+   vq->vring_desc_shadow[i].next = i + 1;
 
return vq;
 }
@@ -290,6 +305,7 @@ struct virtqueue *vring_

[PATCH v2 04/12] virtio_ring: Check used descriptors are chain heads

2022-04-13 Thread Andrew Scull
When the device returns used buffers, it should refer to the descriptor
that is the head of the descriptor chain for that buffer. Confirm this
to be the case by tracking the head of descriptor chains that have been
made available to the device.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_ring.c | 12 
 include/virtio_ring.h|  2 ++
 2 files changed, 14 insertions(+)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 69fd8c6aa0..383d574cb0 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -84,6 +84,9 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg 
*sgs[],
/* Update free pointer */
vq->free_head = i;
 
+   /* Mark the descriptor as the head of a chain. */
+   vq->vring_desc_shadow[head].chain_head = true;
+
/*
 * Put entry in available array (but don't update avail->idx
 * until they do sync).
@@ -146,6 +149,9 @@ static void detach_buf(struct virtqueue *vq, unsigned int 
head)
 {
unsigned int i;
 
+   /* Unmark the descriptor as the head of a chain. */
+   vq->vring_desc_shadow[head].chain_head = false;
+
/* Put back on free list: unmap first-level descriptors and find end */
i = head;
 
@@ -196,6 +202,12 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int 
*len)
return NULL;
}
 
+   if (unlikely(!vq->vring_desc_shadow[i].chain_head)) {
+   printf("(%s.%d): id %u is not a head\n",
+  vq->vdev->name, vq->index, i);
+   return NULL;
+   }
+
detach_buf(vq, i);
vq->last_used_idx++;
/*
diff --git a/include/virtio_ring.h b/include/virtio_ring.h
index 52cbe77c0a..c77c212cff 100644
--- a/include/virtio_ring.h
+++ b/include/virtio_ring.h
@@ -61,6 +61,8 @@ struct vring_desc_shadow {
u32 len;
u16 flags;
u16 next;
+   /* Metadata about the descriptor. */
+   bool chain_head;
 };
 
 struct vring_avail {
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 05/12] dm: test: virtio: Test the virtio ring

2022-04-13 Thread Andrew Scull
The virtio ring is the basis of virtio communication. Test its basic
functionality and its resilience against corruption from the device.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 test/dm/virtio.c | 72 
 1 file changed, 72 insertions(+)

diff --git a/test/dm/virtio.c b/test/dm/virtio.c
index 9a7e658cce..adef10592c 100644
--- a/test/dm/virtio.c
+++ b/test/dm/virtio.c
@@ -130,3 +130,75 @@ static int dm_test_virtio_remove(struct unit_test_state 
*uts)
return 0;
 }
 DM_TEST(dm_test_virtio_remove, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test all of the virtio ring */
+static int dm_test_virtio_ring(struct unit_test_state *uts)
+{
+   struct udevice *bus, *dev;
+   struct virtio_dev_priv *uc_priv;
+   struct virtqueue *vq;
+   struct virtio_sg sg[2];
+   struct virtio_sg *sgs[2];
+   unsigned int len;
+   u8 buffer[2][32];
+
+   /* check probe success */
+   ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
+   ut_assertnonnull(bus);
+
+   /* check the child virtio-blk device is bound */
+   ut_assertok(device_find_first_child(bus, &dev));
+   ut_assertnonnull(dev);
+
+   /*
+* fake the virtio device probe by filling in uc_priv->vdev
+* which is used by virtio_find_vqs/virtio_del_vqs.
+*/
+   uc_priv = dev_get_uclass_priv(bus);
+   ut_assertnonnull(uc_priv);
+   uc_priv->vdev = dev;
+
+   /* prepare the scatter-gather buffer */
+   sg[0].addr = buffer[0];
+   sg[0].length = sizeof(buffer[0]);
+   sg[1].addr = buffer[1];
+   sg[1].length = sizeof(buffer[1]);
+   sgs[0] = &sg[0];
+   sgs[1] = &sg[1];
+
+   /* read a buffer and report written size from device */
+   ut_assertok(virtio_find_vqs(dev, 1, &vq));
+   ut_assertok(virtqueue_add(vq, sgs, 0, 1));
+   vq->vring.used->idx = 1;
+   vq->vring.used->ring[0].id = 0;
+   vq->vring.used->ring[0].len = 0x53355885;
+   ut_asserteq_ptr(buffer, virtqueue_get_buf(vq, &len));
+   ut_asserteq(0x53355885, len);
+   ut_assertok(virtio_del_vqs(dev));
+
+   /* rejects used descriptors that aren't a chain head */
+   ut_assertok(virtio_find_vqs(dev, 1, &vq));
+   ut_assertok(virtqueue_add(vq, sgs, 0, 2));
+   vq->vring.used->idx = 1;
+   vq->vring.used->ring[0].id = 1;
+   vq->vring.used->ring[0].len = 0x53355885;
+   ut_assertnull(virtqueue_get_buf(vq, &len));
+   ut_assertok(virtio_del_vqs(dev));
+
+   /* device changes to descriptor are ignored */
+   ut_assertok(virtio_find_vqs(dev, 1, &vq));
+   ut_assertok(virtqueue_add(vq, sgs, 0, 1));
+   vq->vring.desc[0].addr = cpu_to_virtio64(dev, 0xbadbad11);
+   vq->vring.desc[0].len = cpu_to_virtio32(dev, 0x11badbad);
+   vq->vring.desc[0].flags = cpu_to_virtio16(dev, VRING_DESC_F_NEXT);
+   vq->vring.desc[0].next = cpu_to_virtio16(dev, U16_MAX);
+   vq->vring.used->idx = 1;
+   vq->vring.used->ring[0].id = 0;
+   vq->vring.used->ring[0].len = 6;
+   ut_asserteq_ptr(buffer, virtqueue_get_buf(vq, &len));
+   ut_asserteq(6, len);
+   ut_assertok(virtio_del_vqs(dev));
+
+   return 0;
+}
+DM_TEST(dm_test_virtio_ring, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 06/12] virtio: sandbox: Fix device features bitfield

2022-04-13 Thread Andrew Scull
The virtio sandbox transport was setting the device features value to
the bit index rather than shifting a bit to the right index. Fix this
using the bit manipulation macros.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_sandbox.c | 2 +-
 test/dm/virtio.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_sandbox.c b/drivers/virtio/virtio_sandbox.c
index aafb7beb94..a73b123454 100644
--- a/drivers/virtio/virtio_sandbox.c
+++ b/drivers/virtio/virtio_sandbox.c
@@ -160,7 +160,7 @@ static int virtio_sandbox_probe(struct udevice *udev)
struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
 
/* fake some information for testing */
-   priv->device_features = VIRTIO_F_VERSION_1;
+   priv->device_features = BIT_ULL(VIRTIO_F_VERSION_1);
uc_priv->device = VIRTIO_ID_BLOCK;
uc_priv->vendor = ('u' << 24) | ('b' << 16) | ('o' << 8) | 't';
 
diff --git a/test/dm/virtio.c b/test/dm/virtio.c
index adef10592c..aa4e3d778e 100644
--- a/test/dm/virtio.c
+++ b/test/dm/virtio.c
@@ -77,7 +77,7 @@ static int dm_test_virtio_all_ops(struct unit_test_state *uts)
ut_assertok(virtio_get_status(dev, &status));
ut_asserteq(0, status);
ut_assertok(virtio_get_features(dev, &features));
-   ut_asserteq(VIRTIO_F_VERSION_1, features);
+   ut_asserteq_64(BIT_ULL(VIRTIO_F_VERSION_1), features);
ut_assertok(virtio_set_features(dev));
ut_assertok(virtio_find_vqs(dev, nvqs, vqs));
ut_assertok(virtio_del_vqs(dev));
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 07/12] test: dm: virtio: Test notify before del_vqs

2022-04-13 Thread Andrew Scull
The virtqueue is passed to virtio_notify() so move the virtqueue
deletion to the end of the test when it's no longer needed. This wasn't
causing any problems because the sandbox virtio transport driver doesn't
do anything for notifications, but it could cause problems if things
change and it was a bad example.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 test/dm/virtio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/dm/virtio.c b/test/dm/virtio.c
index aa4e3d778e..ff1dea323c 100644
--- a/test/dm/virtio.c
+++ b/test/dm/virtio.c
@@ -80,8 +80,8 @@ static int dm_test_virtio_all_ops(struct unit_test_state *uts)
ut_asserteq_64(BIT_ULL(VIRTIO_F_VERSION_1), features);
ut_assertok(virtio_set_features(dev));
ut_assertok(virtio_find_vqs(dev, nvqs, vqs));
-   ut_assertok(virtio_del_vqs(dev));
ut_assertok(virtio_notify(dev, vqs[0]));
+   ut_assertok(virtio_del_vqs(dev));
 
return 0;
 }
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 09/12] virtio: sandbox: Bind RNG rather than block device

2022-04-13 Thread Andrew Scull
The virtio-rng driver is extremely simple, making it suitable for
testing more of the virtio uclass logic. Have the sandbox driver bind
the virtio-rng driver rather than the virtio-blk driver so it can be
used in tests.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_sandbox.c | 2 +-
 test/dm/Makefile| 2 +-
 test/dm/virtio_device.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/virtio/virtio_sandbox.c b/drivers/virtio/virtio_sandbox.c
index a73b123454..5484ae3a1a 100644
--- a/drivers/virtio/virtio_sandbox.c
+++ b/drivers/virtio/virtio_sandbox.c
@@ -161,7 +161,7 @@ static int virtio_sandbox_probe(struct udevice *udev)
 
/* fake some information for testing */
priv->device_features = BIT_ULL(VIRTIO_F_VERSION_1);
-   uc_priv->device = VIRTIO_ID_BLOCK;
+   uc_priv->device = VIRTIO_ID_RNG;
uc_priv->vendor = ('u' << 24) | ('b' << 16) | ('o' << 8) | 't';
 
return 0;
diff --git a/test/dm/Makefile b/test/dm/Makefile
index fa54f7cba3..6c467b145e 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -108,7 +108,7 @@ obj-$(CONFIG_DM_USB) += usb.o
 obj-$(CONFIG_DM_VIDEO) += video.o
 ifeq ($(CONFIG_VIRTIO_SANDBOX),y)
 obj-y += virtio.o
-obj-$(CONFIG_VIRTIO_BLK) += virtio_device.o
+obj-$(CONFIG_VIRTIO_RNG) += virtio_device.o
 endif
 ifeq ($(CONFIG_WDT_GPIO)$(CONFIG_WDT_SANDBOX),yy)
 obj-y += wdt.o
diff --git a/test/dm/virtio_device.c b/test/dm/virtio_device.c
index 46f4798fc2..f5f2349750 100644
--- a/test/dm/virtio_device.c
+++ b/test/dm/virtio_device.c
@@ -25,10 +25,10 @@ static int dm_test_virtio_base(struct unit_test_state *uts)
ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
ut_assertnonnull(bus);
 
-   /* check the child virtio-blk device is bound */
+   /* check the child virtio-rng device is bound */
ut_assertok(device_find_first_child(bus, &dev));
ut_assertnonnull(dev);
-   ut_assertok(strcmp(dev->name, "virtio-blk#0"));
+   ut_asserteq_str("virtio-rng#0", dev->name);
 
/* check driver status */
ut_assertok(virtio_get_status(dev, &status));
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 08/12] test: dm: virtio: Split out virtio device tests

2022-04-13 Thread Andrew Scull
Virtio tests that find a child device require the virtio device driver
to be included in the build so it can probe. The sandbox virtio
transport driver currently reports a virtio-blk device so make sure the
corresponding driver is built before running tests that need it.

Signed-off-by: Andrew Scull 
---
 test/dm/Makefile|   5 +-
 test/dm/virtio.c| 171 
 test/dm/virtio_device.c | 186 
 3 files changed, 190 insertions(+), 172 deletions(-)
 create mode 100644 test/dm/virtio_device.c

diff --git a/test/dm/Makefile b/test/dm/Makefile
index d46552fbf3..fa54f7cba3 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -106,7 +106,10 @@ obj-$(CONFIG_TEE) += tee.o
 obj-$(CONFIG_TIMER) += timer.o
 obj-$(CONFIG_DM_USB) += usb.o
 obj-$(CONFIG_DM_VIDEO) += video.o
-obj-$(CONFIG_VIRTIO_SANDBOX) += virtio.o
+ifeq ($(CONFIG_VIRTIO_SANDBOX),y)
+obj-y += virtio.o
+obj-$(CONFIG_VIRTIO_BLK) += virtio_device.o
+endif
 ifeq ($(CONFIG_WDT_GPIO)$(CONFIG_WDT_SANDBOX),yy)
 obj-y += wdt.o
 endif
diff --git a/test/dm/virtio.c b/test/dm/virtio.c
index ff1dea323c..3e108cdc35 100644
--- a/test/dm/virtio.c
+++ b/test/dm/virtio.c
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -15,78 +14,6 @@
 #include 
 #include 
 
-/* Basic test of the virtio uclass */
-static int dm_test_virtio_base(struct unit_test_state *uts)
-{
-   struct udevice *bus, *dev;
-   u8 status;
-
-   /* check probe success */
-   ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
-   ut_assertnonnull(bus);
-
-   /* check the child virtio-blk device is bound */
-   ut_assertok(device_find_first_child(bus, &dev));
-   ut_assertnonnull(dev);
-   ut_assertok(strcmp(dev->name, "virtio-blk#0"));
-
-   /* check driver status */
-   ut_assertok(virtio_get_status(dev, &status));
-   ut_asserteq(VIRTIO_CONFIG_S_ACKNOWLEDGE, status);
-
-   return 0;
-}
-DM_TEST(dm_test_virtio_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-
-/* Test all of the virtio uclass ops */
-static int dm_test_virtio_all_ops(struct unit_test_state *uts)
-{
-   struct udevice *bus, *dev;
-   struct virtio_dev_priv *uc_priv;
-   uint offset = 0, len = 0, nvqs = 1;
-   void *buffer = NULL;
-   u8 status;
-   u32 counter;
-   u64 features;
-   struct virtqueue *vqs[2];
-
-   /* check probe success */
-   ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
-   ut_assertnonnull(bus);
-
-   /* check the child virtio-blk device is bound */
-   ut_assertok(device_find_first_child(bus, &dev));
-   ut_assertnonnull(dev);
-
-   /*
-* fake the virtio device probe by filling in uc_priv->vdev
-* which is used by virtio_find_vqs/virtio_del_vqs.
-*/
-   uc_priv = dev_get_uclass_priv(bus);
-   ut_assertnonnull(uc_priv);
-   uc_priv->vdev = dev;
-
-   /* test virtio_xxx APIs */
-   ut_assertok(virtio_get_config(dev, offset, buffer, len));
-   ut_assertok(virtio_set_config(dev, offset, buffer, len));
-   ut_asserteq(-ENOSYS, virtio_generation(dev, &counter));
-   ut_assertok(virtio_set_status(dev, VIRTIO_CONFIG_S_DRIVER_OK));
-   ut_assertok(virtio_get_status(dev, &status));
-   ut_asserteq(VIRTIO_CONFIG_S_DRIVER_OK, status);
-   ut_assertok(virtio_reset(dev));
-   ut_assertok(virtio_get_status(dev, &status));
-   ut_asserteq(0, status);
-   ut_assertok(virtio_get_features(dev, &features));
-   ut_asserteq_64(BIT_ULL(VIRTIO_F_VERSION_1), features);
-   ut_assertok(virtio_set_features(dev));
-   ut_assertok(virtio_find_vqs(dev, nvqs, vqs));
-   ut_assertok(virtio_notify(dev, vqs[0]));
-   ut_assertok(virtio_del_vqs(dev));
-
-   return 0;
-}
-DM_TEST(dm_test_virtio_all_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-
 /* Test of the virtio driver that does not have required driver ops */
 static int dm_test_virtio_missing_ops(struct unit_test_state *uts)
 {
@@ -104,101 +31,3 @@ static int dm_test_virtio_missing_ops(struct 
unit_test_state *uts)
return 0;
 }
 DM_TEST(dm_test_virtio_missing_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-
-/* Test removal of virtio device driver */
-static int dm_test_virtio_remove(struct unit_test_state *uts)
-{
-   struct udevice *bus, *dev;
-
-   /* check probe success */
-   ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
-   ut_assertnonnull(bus);
-
-   /* check the child virtio-blk device is bound */
-   ut_assertok(device_find_first_child(bus, &dev));
-   ut_assertnonnull(dev);
-
-   /* set driver status to VIRTIO_CONFIG_S_DRIVER_OK */
-   ut_assertok(virtio_set_status(dev, VIRTIO_CONFIG_S_DRIVER_OK));
-
-   /* check the device can be successfully removed */
-   dev_or_flags(dev, DM_FLAG_ACTIVATED);
-   ut_asserteq(-EKEYREJECTED, device_remove(bus, DM_REMOVE_ACTIVE_ALL))

[PATCH v2 10/12] test: dm: virtio: Test virtio device driver probing

2022-04-13 Thread Andrew Scull
Once the virtio-rng driver has been bound, probe it to trigger the pre
and post child probe hooks of the virtio uclass driver. Check the status
of the virtio device to confirm it reached the expected state.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 test/dm/virtio_device.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/test/dm/virtio_device.c b/test/dm/virtio_device.c
index f5f2349750..d0195e6bf0 100644
--- a/test/dm/virtio_device.c
+++ b/test/dm/virtio_device.c
@@ -34,6 +34,15 @@ static int dm_test_virtio_base(struct unit_test_state *uts)
ut_assertok(virtio_get_status(dev, &status));
ut_asserteq(VIRTIO_CONFIG_S_ACKNOWLEDGE, status);
 
+   /* probe the virtio-rng driver */
+   ut_assertok(device_probe(dev));
+
+   /* check the device was reset and the driver picked up the device */
+   ut_assertok(virtio_get_status(dev, &status));
+   ut_asserteq(VIRTIO_CONFIG_S_DRIVER |
+   VIRTIO_CONFIG_S_DRIVER_OK |
+   VIRTIO_CONFIG_S_FEATURES_OK, status);
+
return 0;
 }
 DM_TEST(dm_test_virtio_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 11/12] virtio: rng: Check length before copying

2022-04-13 Thread Andrew Scull
Check the length of data written by the device is consistent with the
size of the buffers to avoid out-of-bounds memory accesses in case
values aren't consistent.

Signed-off-by: Andrew Scull 
Cc: Sughosh Ganu 
Reviewed-by: Simon Glass 
---
 drivers/virtio/virtio_rng.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/virtio/virtio_rng.c b/drivers/virtio/virtio_rng.c
index 9314c0a03e..b85545c2ee 100644
--- a/drivers/virtio/virtio_rng.c
+++ b/drivers/virtio/virtio_rng.c
@@ -41,6 +41,9 @@ static int virtio_rng_read(struct udevice *dev, void *data, 
size_t len)
while (!virtqueue_get_buf(priv->rng_vq, &rsize))
;
 
+   if (rsize > sg.length)
+   return -EIO;
+
memcpy(ptr, buf, rsize);
len -= rsize;
ptr += rsize;
-- 
2.35.1.1178.g4f1659d476-goog



[PATCH v2 12/12] test: dm: virtio_rng: Test virtio-rng with faked device

2022-04-13 Thread Andrew Scull
Add a regression test for virtio-rng reading beyond the end of its
buffer if the virtio device provides an invalid length.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 test/dm/Makefile |  1 +
 test/dm/virtio_rng.c | 52 
 2 files changed, 53 insertions(+)
 create mode 100644 test/dm/virtio_rng.c

diff --git a/test/dm/Makefile b/test/dm/Makefile
index 6c467b145e..ba08c19515 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -109,6 +109,7 @@ obj-$(CONFIG_DM_VIDEO) += video.o
 ifeq ($(CONFIG_VIRTIO_SANDBOX),y)
 obj-y += virtio.o
 obj-$(CONFIG_VIRTIO_RNG) += virtio_device.o
+obj-$(CONFIG_VIRTIO_RNG) += virtio_rng.o
 endif
 ifeq ($(CONFIG_WDT_GPIO)$(CONFIG_WDT_SANDBOX),yy)
 obj-y += wdt.o
diff --git a/test/dm/virtio_rng.c b/test/dm/virtio_rng.c
new file mode 100644
index 00..ff5646b4e1
--- /dev/null
+++ b/test/dm/virtio_rng.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Google, Inc.
+ * Written by Andrew Scull 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* This is a brittle means of getting access to the virtqueue */
+struct virtio_rng_priv {
+   struct virtqueue *rng_vq;
+};
+
+/* Test the virtio-rng driver validates the used size */
+static int dm_test_virtio_rng_check_len(struct unit_test_state *uts)
+{
+   struct udevice *bus, *dev;
+   struct virtio_rng_priv *priv;
+   u8 buffer[16];
+
+   /* check probe success */
+   ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
+   ut_assertnonnull(bus);
+
+   /* check the child virtio-rng device is bound */
+   ut_assertok(device_find_first_child(bus, &dev));
+   ut_assertnonnull(dev);
+
+   /* probe the virtio-rng driver */
+   ut_assertok(device_probe(dev));
+
+   /* simulate the device returning the buffer with too much data */
+   priv = dev_get_priv(dev);
+   priv->rng_vq->vring.used->idx = 1;
+   priv->rng_vq->vring.used->ring[0].id = 0;
+   priv->rng_vq->vring.used->ring[0].len = U32_MAX;
+
+   /* check the driver gracefully handles the error */
+   ut_asserteq(-EIO, dm_rng_read(dev, buffer, sizeof(buffer)));
+
+   return 0;
+}
+DM_TEST(dm_test_virtio_rng_check_len, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-- 
2.35.1.1178.g4f1659d476-goog



Re: [PATCH] bosch: Add inital board support for ACC

2022-04-13 Thread Philip Oberfichtner
Hi Stefano,

On Mon, 2022-04-11 at 17:45 +0200, Stefano Babic wrote:
> Hi Philipp,
> 
> On 02.03.22 10:39, Philip Oberfichtner wrote:
> > The Bosch ACC (Air Center Control) Board is based on the i.MX6D.
> 
> [snip]
> 
> > diff --git a/include/configs/imx6q-acc.h b/include/configs/imx6q-
> > acc.h
> > new file mode 100644
> > index 00..caa11df49f
> > --- /dev/null
> > +++ b/include/configs/imx6q-acc.h
> > @@ -0,0 +1,165 @@
> > +/* SPDX-License-Identifier: GPL-2.0+
> > + *
> > + * Copyright (c) 2017 DENX Software Engineering GmbH, Heiko
> > Schocher 
> > + * Copyright (c) 2019 Bosch Thermotechnik GmbH
> > + */
> > +
> > +#ifndef __IMX6Q_ACC_H
> > +#define __IMX6Q_ACC_H
> > +
> > +#include 
> > +#include "mx6_common.h"
> > +
> > +/* Environment settings */
> > +#define CONFIG_ENV_ACCESS_IGNORE_FORCE
> > +
> > +#ifdef CONFIG_SYS_BOOT_EMMC
> > +#define MMC_ROOTFS_DEV 0
> > +#define MMC_ROOTFS_PART 2
> > +#endif
> > +
> > +/* Allow to overwrite serial and ethaddr */
> > +#define CONFIG_ENV_OVERWRITE
> > +
> > +#ifdef CONFIG_SYS_BOOT_EMMC
> > +/* eMMC Boot */
> > +#define ENV_EXTRA \
> > +   "mmcdev=" __stringify(MMC_ROOTFS_DEV) "\0" \
> > +   "mmcpart=" __stringify(MMC_ROOTFS_PART) "\0" \
> > +   "fitpart=1\0" \
> > +   "optargs=ro quiet systemd.gpt_auto=false\0" \
> > +   "production=1\0" \
> > +   "mmcautodetect=yes\0" \
> > +   "mmcrootfstype=ext4\0" \
> > +   "finduuid=part uuid mmc ${mmcdev}:${mmcpart} uuid\0" \
> > +   "mmcargs=run finduuid; setenv bootargs " \
> > +   "root=PARTUUID=${uuid} ${optargs}
> > rootfstype=${mmcrootfstype}\0" \
> > +   "mmc_mmc_fit=run env_persist; run setbm; run mmcloadfit; "
> > \
> > +   "run auth_fit_or_reset; run mmcargs addcon; " \
> > +   "bootm ${fit_addr}#${bootconf}\0" \
> > +   "bootset=0\0" \
> > +   "setbm=if test ${bootset} -eq 1; " \
> > +   "then setenv mmcpart 4; setenv fitpart 3; " \
> > +   "else; setenv mmcpart 2; setenv fitpart 1; fi\0" \
> > +   "handle_ustate=if test ${ustate} -eq 2; then setenv ustate
> > 3; fi\0" \
> > +   "switch_bootset=if test ${bootset} -eq 1; then setenv
> > bootset 0; " \
> > +   "else; setenv bootset 1;fi\0" \
> > +   "env_persisted=0\0" \
> > +   "env_persist=if test ${env_persisted} != 1; " \
> > +   "then env set env_persisted 1; run save_env; fi;\0"
> > \
> > +   "save_env=env save; env save\0" \
> > +   "altbootcmd=run handle_ustate; run switch_bootset; run
> > save_env; run bootcmd\0"
> > +
> > +#define CONFIG_ENV_FLAGS_LIST_STATIC \
> 
> 
> > +   "addcon:so," \
> > +   "altbootcmd:so," \
> > +   "auth_fit_or_reset:so," \
> > +   "baudrate:do," \
> > +   "bootcmd:so," \
> > +   "bootcount:da," \
> > +   "bootdelay:do," \
> > +   "bootlimit:do," \
> > +   "bootset:ba," \
> > +   "clone_pending:ba," \
> > +   "console:so," \
> > +   "endurance_test:ba," \
> > +   "env_persist:so," \
> > +   "env_persisted:ba," \
> > +   "ethaddr:so," \
> > +   "factory_reset:ba," \
> > +   "fdtcontroladdr:xa," \
> > +   "finduuid:so," \
> > +   "fit_addr:do," \
> > +   "fitpart:da," \
> > +   "handle_ustate:so," \
> > +   "loadaddr:xo," \
> > +   "mmc_mmc_fit:so," \
> > +   "mmcargs:so," \
> > +   "mmcautodetect:so," \
> > +   "mmcdev:do," \
> > +   "mmcfit_name:so," \
> > +   "mmcloadfit:so," \
> > +   "mmcpart:da," \
> > +   "mmcrootfstype:so," \
> > +   "optargs:so," \
> > +   "production:ba," \
> > +   "save_env:so," \
> > +   "setbm:so," \
> > +   "silent:so," \
> > +   "switch_bootset:so," \
> > +   "ustate:da"
> 
> This is the list of the variables that are allowed to be changed. 
> Generally, this list is very short to avoid that an attacker can
> change 
> a lot. I wonder that on this board the list is very long - sure that 
> this is ok ?
> 

Thanks for the hint. For V2 I will enable CONFIG_ENV_WRITEABLE_LIST and
shorten this list. This will also involve a 'env_get_location'
implementation in the board file.

> 
> > +
> > +#else //CONFIG_SYS_BOOT_EMMC
> 
> CONFIG_ are not allowed and they are rejected during build. Any
> CONFIG_ 
> switch should go into Kbuild. It is not useful here, so just rename 
> local defines in this file with something different as CONFIG_
> (ENV_FLAG
> 
> Rather the CI hits the comments, too, so please drop them. Not only, 
> there are some CONFIG_ that are already defined in Kbuild. Sure that
> you 
> have to redefine all of them or you can just add them to 
> configs/imx6q_acc_defconfig ?
> 
> You can check the error reported here:
> 
> https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/420785

For V2 I will migrate CONFIG_MII and CONFIG_SYS_MEMTEST* to Kconfig,
the remainder of CONFIG_* used is whitelisted.

Concerning the CONFIG_SYS_BOOT_EMMC: This is defined in
board/bosch/acc/Kconfig and u

U-boot may fail to boot because of stale d-cache entry

2022-04-13 Thread Jeungwoo Yoo
During initialization, U-Boot may rely on clean caches for the code and data in 
the memory area where its binary is located. Cleaning that cache area could be 
a responsibility of the loader of U-Boot (e.g., BL2 from ARM Trusted Firmware). 
Otherwise, it may be hard for U-Boot to avoid using corrupted data. The 
situation may be different for memory areas outside of the U-Boot binary. 
That's probably why we can see the call to "invalidate_dcache_all" in the 
function "dcache_enable" in "u-boot/arch/arm/cpu/armv8/cache_v8.c". However, 
this function invalidates all cache, and U-Boot initializes its data in the 
binary before invoking "dcache_enable". This makes it inconsistent with any of 
the 3 following possibilities to make assumptions about the cache state:

  1.  It is assumed that all data cache may be dirty when U-Boot receives 
control. In this case, all data cache should be invalidated before any data is 
initialized. Otherwise, the stale cache entries may overwrite the initialized 
data in physical memory at any time, even before the data cache is enabled [3]. 
Besides, data cache hits are also permitted by the architecture when the cache 
is disabled [2].
  2.  It is assumed that the responsibility of the loader of U-Boot is to clean 
the cache for the area of the U-Boot binary, but the other memory areas may 
correspond to dirty caches. This would match the assumptions made by the Linux 
kernel (see "Caches, MMUs" in "Documentation/arm64/booting.txt" in Linux). In 
this case, U-Boot should only invalidate caches for the memory areas outside 
the U-Boot binary, and it should do so before initializing these memory areas.
  3.  It is assumed that the responsibility of the previously running firmware 
is to clean the complete data cache before passing control to U-Boot. In this 
case, it is unclear why U-Boot invalidates the data cache itself.

Because the current implementation in U-Boot is not consistent with any of the 
above assumptions, we come across memory corruption in our use cases. 
Specifically, U-Boot initializes the Global Data structure (pointed to by the 
variable 'gd') as zero before using it. The member variable of the Global Data 
structure, 'gd->arch.tlb_fillptr', is set after page table installation and is 
used to determine whether the page tables are set up already or not [1]. If the 
variable 'gd->arch.tlb_fillptr' value is zero, u-boot will set up a page table. 
Otherwise, u-boot will skip setting up the page table to avoid duplicated page 
table settings. However, we experience a stale D-cache entry where the variable 
'gd->arch.tlb_fillptr' is located. In our use case, this stale entry overwrites 
the variable in physical memory when U-Boot invalidates the data cache because 
we run U-Boot in EL1 with stage 2 translation enabled, which promotes the cache 
invalidation into clean and invalidate [4]. In our virtualized use case, the 
pointer corruption is guaranteed this way, but in non-virtualized use cases, 
such corruption is also possible because the cache is not guaranteed to stay 
dirty [3].


I would like to propose U-Boot to follow the same set of assumptions as in 
Linux. That is, to assume that the cache is only clean for the memory area 
where the U-Boot binary is loaded (see 2. above).


[1] Based on latest master branch when writing this report: commit hash: 
e7fb67df319cec410c20906bbf33936a6f7479b2

(File path: u-boot/arch/arm/cpu/armv8/cache_v8.c)

/* to activate the MMU we need to set up virtual memory */
__weak void mmu_setup(void)
{
int el;
/* Set up page tables only once */
if (!gd->arch.tlb_fillptr)
setup_all_pgtables();
el = current_el();
set_ttbr_tcr_mair(el, gd->arch.tlb_addr, get_tcr(el, NULL, NULL),
  MEMORY_ATTRIBUTES);
/* enable the mmu */
set_sctlr(get_sctlr() | CR_M);
}


[2] ARM DDI 0487D.a ID103018; D4.4.5 Behavior of caches at reset

If an implementation permits cache hits when the Cacheability control fields 
force all memory locations to be treated as Non-cacheable then the cache 
initialization routine must:

— Provide a mechanism to ensure the correct initialization of the caches.

— Be documented clearly as part of the documentation of the device.

In particular, if an implementation permits cache hits when the Cacheability 
controls force all memory locations to be treated as Non-cacheable, and the 
cache contents are not invalidated at reset, the initialization routine must 
avoid any possibility of running from an uninitialized cache. It is acceptable 
for an initialization routine to require a fixed instruction sequence to be 
placed in a restricted range of memory.


[3] ARM DDI 0487D.a ID103018; D4.4.1 General behavior of the caches

An unlocked entry in a cache might not remain in that cache. The architecture 
does not guarantee that an unlocked cache entry remains in the cache or remains 
incoherent with the rest of memory. Software must not assume that an unlocked 
item that remain

Re: [PATCH v2 14/18] pci: Match region flags using a mask

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> When converting addresses, apply a mask to the region flags during
> lookup. This allows the caller to specify which flags are important and
> which are not, for example to exclude system memory regions.
>
> The behaviour of the function is changed such that they don't
> preferentially search for a non-system memory region. However, system
> memory regions are added after other regions in decode_regions() leading
> to a similar outcome.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/pci/pci-uclass.c | 110 +--
>  include/pci.h|  18 ---
>  test/dm/pci.c|  60 +++--
>  3 files changed, 67 insertions(+), 121 deletions(-)
>
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 033c52bb4e..5069ada66d 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -1394,27 +1394,27 @@ void dm_pci_write_bar32(struct udevice *dev, int 
> barnum, u32 addr)
> dm_pci_write_config32(dev, bar, addr);
>  }
>
> -static int _dm_pci_bus_to_phys(struct udevice *ctlr, pci_addr_t bus_addr,
> -  size_t len, unsigned long flags,
> -  unsigned long skip_mask, phys_addr_t *pa)
> +phys_addr_t dm_pci_bus_to_phys(struct udevice *dev, pci_addr_t bus_addr,
> +  size_t len, unsigned long mask,
> +  unsigned long flags)
>  {
> -   struct pci_controller *hose = dev_get_uclass_priv(ctlr);
> +   struct udevice *ctlr;
> +   struct pci_controller *hose;
> struct pci_region *res;
> pci_addr_t offset;
> int i;
>
> -   if (hose->region_count == 0) {
> -   *pa = bus_addr;
> -   return 0;
> -   }
> +   /* The root controller has the region information */
> +   ctlr = pci_get_controller(dev);
> +   hose = dev_get_uclass_priv(ctlr);
> +
> +   if (hose->region_count == 0)
> +   return bus_addr;
>
> for (i = 0; i < hose->region_count; i++) {
> res = &hose->regions[i];
>
> -   if (((res->flags ^ flags) & PCI_REGION_TYPE) != 0)
> -   continue;
> -
> -   if (res->flags & skip_mask)
> +   if ((res->flags & mask) != flags)
> continue;
>
> if (bus_addr < res->bus_start)
> @@ -1427,69 +1427,34 @@ static int _dm_pci_bus_to_phys(struct udevice *ctlr, 
> pci_addr_t bus_addr,
> if (len > res->size - offset)
> continue;
>
> -   *pa = res->phys_start + offset;
> -   return 0;
> +   return res->phys_start + offset;
> }
>
> -   return 1;
> +   puts("pci_hose_bus_to_phys: invalid physical address\n");
> +   return 0;
>  }
>
> -phys_addr_t dm_pci_bus_to_phys(struct udevice *dev, pci_addr_t bus_addr,
> -  size_t len, unsigned long flags)
> +pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr,
> + size_t len, unsigned long mask,
> + unsigned long flags)
>  {
> -   phys_addr_t phys_addr = 0;
> struct udevice *ctlr;
> -   int ret;
> -
> -   /* The root controller has the region information */
> -   ctlr = pci_get_controller(dev);
> -
> -   /*
> -* if PCI_REGION_MEM is set we do a two pass search with preference
> -* on matches that don't have PCI_REGION_SYS_MEMORY set
> -*/
> -   if ((flags & PCI_REGION_TYPE) == PCI_REGION_MEM) {
> -   ret = _dm_pci_bus_to_phys(ctlr, bus_addr, len,
> - flags, PCI_REGION_SYS_MEMORY,
> - &phys_addr);
> -   if (!ret)
> -   return phys_addr;
> -   }
> -
> -   ret = _dm_pci_bus_to_phys(ctlr, bus_addr, len, flags, 0, &phys_addr);
> -
> -   if (ret)
> -   puts("pci_hose_bus_to_phys: invalid physical address\n");
> -
> -   return phys_addr;
> -}
> -
> -static int _dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr,
> -  size_t len, unsigned long flags,
> -  unsigned long skip_mask, pci_addr_t *ba)
> -{
> +   struct pci_controller *hose;
> struct pci_region *res;
> -   struct udevice *ctlr;
> phys_addr_t offset;
> int i;
> -   struct pci_controller *hose;
>
> /* The root controller has the region information */
> ctlr = pci_get_controller(dev);
> hose = dev_get_uclass_priv(ctlr);
>
> -   if (hose->region_count == 0) {
> -   *ba = phys_addr;
> -   return 0;
> -   }
> +   if (hose->region_count == 0)
> +   return phys_addr;
>
> for (i = 0; i < hose->region_count; i++)

Re: [PATCH v2 15/18] pci: Update dm_pci_bus_to_virt() parameters

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Add mask parameter and reorder length parameter to match the other PCI
> address conversion functions. Using PCI_REGION_TYPE as the mask gives
> the old behaviour.
>
> It's converted from a macro to an inline function as the length
> parameter is now used twice, but should only be calculated once.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/bios_emulator/atibios.c |  4 ++--
>  drivers/pci/pci-uclass.c|  4 ++--
>  include/pci.h   | 19 ++-
>  3 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
> index 9547470a2f..cdc5ba6ad9 100644
> --- a/drivers/bios_emulator/atibios.c
> +++ b/drivers/bios_emulator/atibios.c
> @@ -368,8 +368,8 @@ void *PCI_mapBIOSImage(struct udevice *pcidev)
> return NULL;
> }
>
> -   BIOSImage = dm_pci_bus_to_virt(pcidev, BIOSImageBus,
> -  PCI_REGION_MEM, 0, MAP_NOCACHE);
> +   BIOSImage = dm_pci_bus_to_virt(pcidev, BIOSImageBus, 0, 
> PCI_REGION_TYPE,
> +  PCI_REGION_MEM, MAP_NOCACHE);
>
> /*Change the PCI BAR registers to map it onto the bus.*/
> dm_pci_write_config32(pcidev, BIOSImageBAR, 0);
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 5069ada66d..676052090a 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -1602,8 +1602,8 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, 
> size_t offset, size_t len,
>  * a PCI range, but a better check would be to probe for the size of
>  * the bar and prevent overflow more locally.
>  */
> -   return dm_pci_bus_to_virt(udev, pci_bus_addr + offset, flags, len,
> - MAP_NOCACHE);
> +   return dm_pci_bus_to_virt(udev, pci_bus_addr + offset, len,
> + PCI_REGION_TYPE, flags, MAP_NOCACHE);
>  }
>
>  static int _dm_pci_find_next_capability(struct udevice *dev, u8 pos, int cap)
> diff --git a/include/pci.h b/include/pci.h
> index 8198265269..683efcd1be 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -11,6 +11,8 @@
>  #ifndef _PCI_H
>  #define _PCI_H
>
> +#include 
> +
>  #define PCI_CFG_SPACE_SIZE 256
>  #define PCI_CFG_SPACE_EXP_SIZE 4096
>
> @@ -1584,9 +1586,14 @@ int dm_pci_flr(struct udevice *dev);
>
>  #define dm_pci_virt_to_bus(dev, addr, flags) \
> dm_pci_phys_to_bus(dev, (virt_to_phys(addr)), 0, PCI_REGION_TYPE, 
> (flags))
> -#define dm_pci_bus_to_virt(dev, addr, flags, len, map_flags) \
> -   map_physmem(dm_pci_bus_to_phys(dev, (addr), (len), PCI_REGION_TYPE, 
> (flags)), \
> -   (len), (map_flags))
> +
> +static inline void *dm_pci_bus_to_virt(struct udevice *dev, pci_addr_t addr,
> +  size_t len, unsigned long mask,
> +  unsigned long flags,
> +  unsigned long map_flags) {
> +   return map_physmem(dm_pci_bus_to_phys(dev, addr, len, mask, flags),
> +  len, map_flags);
> +}
>
>  #define dm_pci_phys_to_mem(dev, addr) \
> dm_pci_phys_to_bus((dev), (addr), 0, PCI_REGION_TYPE, PCI_REGION_MEM)
> @@ -1600,11 +1607,13 @@ int dm_pci_flr(struct udevice *dev);
>  #define dm_pci_virt_to_mem(dev, addr) \
> dm_pci_virt_to_bus((dev), (addr), PCI_REGION_MEM)
>  #define dm_pci_mem_to_virt(dev, addr, len, map_flags) \
> -   dm_pci_bus_to_virt((dev), (addr), PCI_REGION_MEM, (len), (map_flags))
> +   dm_pci_bus_to_virt((dev), (addr), (len), PCI_REGION_TYPE, \
> +  PCI_REGION_MEM, (map_flags))
>  #define dm_pci_virt_to_io(dev, addr) \
> dm_pci_virt_to_bus((dev), (addr), PCI_REGION_IO)
>  #define dm_pci_io_to_virt(dev, addr, len, map_flags) \
> -   dm_pci_bus_to_virt((dev), (addr), PCI_REGION_IO, (len), (map_flags))
> +   dm_pci_bus_to_virt((dev), (addr), (len), PCI_REGION_TYPE, \
> +  PCI_REGION_IO, (map_flags))
>
>  /**
>   * dm_pci_find_device() - find a device by vendor/device ID
> --

I believe this patch should be squashed into patch #14 for bisectablitly.

Regards,
Bin


[PATCH v1 01/12] configs: stm32f746-disco: Concatenate spl and u-boot binaries

2022-04-13 Thread Patrice Chotard
This allows to concatenate spl and u-boot binaries together.
Previously, both binaries has to be flashed separately at the correct
offset (spl at offset 0 and u-boot at offset 0x8000).
With this patch, only one binary is generated (u-boot-with-spl.bin)
and has to be copied in flash at offset 0 using openocd for example
or simply copied in exported mass storage.

Signed-off-by: Patrice Chotard 
---

 configs/stm32f746-disco_defconfig | 1 +
 include/configs/stm32f746-disco.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/stm32f746-disco_defconfig 
b/configs/stm32f746-disco_defconfig
index ee7e3293ad..aabffac75f 100644
--- a/configs/stm32f746-disco_defconfig
+++ b/configs/stm32f746-disco_defconfig
@@ -9,6 +9,7 @@ CONFIG_DEFAULT_DEVICE_TREE="stm32f746-disco"
 CONFIG_SPL_TEXT_BASE=0x800
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x8008000
 CONFIG_BOOTDELAY=3
diff --git a/include/configs/stm32f746-disco.h 
b/include/configs/stm32f746-disco.h
index 8ad4bb99c8..b93acdcc1f 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -49,6 +49,7 @@
 #define CONFIG_SYS_UBOOT_START 0x080083FD
 #define CONFIG_SYS_UBOOT_BASE  (CONFIG_SYS_FLASH_BASE + \
 CONFIG_SYS_SPL_LEN)
+#define CONFIG_SPL_PAD_TO  0x8000
 
 /* DT blob (fdt) address */
 #define CONFIG_SYS_FDT_BASE(CONFIG_SYS_FLASH_BASE + \
-- 
2.17.1



[PATCH v1 00/12] stm32: add new board support, defconfig and documentation

2022-04-13 Thread Patrice Chotard
Add new stm32746g-eval board support
Add defconfig for SPL and none SPL mode for STM32F7 boards.
Add documentation on how to build and flash STM32 MCUs.

Patrice Chotard (12):
  configs: stm32f746-disco: Concatenate spl and u-boot binaries
  configs: stm32f746-disco: Rename stm32f746-disco_defconfig to
stm32f746-disco_spl_defconfig
  configs: stm32f746-disco: Add stm32f746-disco_defconfig
  configs: stm32f769-disco: Rename stm32f769-disco_defconfig to
stm32f769-disco_spl_defconfig
  configs: stm32f769-disco: Add stm32f769-disco_defconfig
  configs: stm32f769-disco: Migrate SPL flags to defconfig
  configs: stm32f746-disco: Migrate SPL flags to defconfig
  board: stm32f746-disco: Fix dram_init() in none SPL config
  configs: stm32f746-disco: use CONFIG_DEFAULT_DEVICE_TREE as fdtfile
  configs: stm32746g-eval: Add stm32746g-eval_defconfig
  configs: stm32746g-eval: Add stm32746g-eval_spl_defconfig
  doc: Add documentation for STM32 MCUs

 arch/arm/mach-stm32/Kconfig|  20 ---
 board/st/stm32f429-discovery/MAINTAINERS   |   1 +
 board/st/stm32f429-evaluation/MAINTAINERS  |   1 +
 board/st/stm32f469-discovery/MAINTAINERS   |   1 +
 board/st/stm32f746-disco/MAINTAINERS   |   5 +
 board/st/stm32f746-disco/stm32f746-disco.c |   2 +-
 board/st/stm32h743-disco/MAINTAINERS   |   1 +
 board/st/stm32h743-eval/MAINTAINERS|   1 +
 board/st/stm32h750-art-pi/MAINTAINERS  |   1 +
 configs/stm32746g-eval_defconfig   |  64 +++
 configs/stm32746g-eval_spl_defconfig   |  86 ++
 configs/stm32f746-disco_defconfig  |   7 +-
 configs/stm32f746-disco_spl_defconfig  |  86 ++
 configs/stm32f769-disco_defconfig  |   7 +-
 configs/stm32f769-disco_spl_defconfig  |  87 ++
 doc/board/st/index.rst |   1 +
 doc/board/st/stm32_MCU.rst | 186 +
 include/configs/stm32f746-disco.h  |   3 +-
 18 files changed, 526 insertions(+), 34 deletions(-)
 create mode 100644 configs/stm32746g-eval_defconfig
 create mode 100644 configs/stm32746g-eval_spl_defconfig
 create mode 100644 configs/stm32f746-disco_spl_defconfig
 create mode 100644 configs/stm32f769-disco_spl_defconfig
 create mode 100644 doc/board/st/stm32_MCU.rst

-- 
2.17.1



[PATCH v1 02/12] configs: stm32f746-disco: Rename stm32f746-disco_defconfig to stm32f746-disco_spl_defconfig

2022-04-13 Thread Patrice Chotard
The current stm32f746-disco_defconfig file supports SPL, rename it to
stm32f746-disco_spl_defconfig to reflect the supported configuration.

Signed-off-by: Patrice Chotard 
---

 board/st/stm32f746-disco/MAINTAINERS | 1 +
 .../{stm32f746-disco_defconfig => stm32f746-disco_spl_defconfig} | 0
 2 files changed, 1 insertion(+)
 rename configs/{stm32f746-disco_defconfig => stm32f746-disco_spl_defconfig} 
(100%)

diff --git a/board/st/stm32f746-disco/MAINTAINERS 
b/board/st/stm32f746-disco/MAINTAINERS
index 3bbb513ad7..06d366e8a2 100644
--- a/board/st/stm32f746-disco/MAINTAINERS
+++ b/board/st/stm32f746-disco/MAINTAINERS
@@ -4,4 +4,5 @@ S:  Maintained
 F: board/st/stm32f746-disco
 F: include/configs/stm32f746-disco.h
 F: configs/stm32f746-disco_defconfig
+F: configs/stm32f746-disco_spl_defconfig
 F: configs/stm32f769-disco_defconfig
diff --git a/configs/stm32f746-disco_defconfig 
b/configs/stm32f746-disco_spl_defconfig
similarity index 100%
rename from configs/stm32f746-disco_defconfig
rename to configs/stm32f746-disco_spl_defconfig
-- 
2.17.1



[PATCH v1 03/12] configs: stm32f746-disco: Add stm32f746-disco_defconfig

2022-04-13 Thread Patrice Chotard
Add stm32f746-disco_defconfig for stm32f746 discovery board to
build U-Boot proper.

Signed-off-by: Patrice Chotard 
---

 configs/stm32f746-disco_defconfig | 64 +++
 1 file changed, 64 insertions(+)
 create mode 100644 configs/stm32f746-disco_defconfig

diff --git a/configs/stm32f746-disco_defconfig 
b/configs/stm32f746-disco_defconfig
new file mode 100644
index 00..2c70bac9cd
--- /dev/null
+++ b/configs/stm32f746-disco_defconfig
@@ -0,0 +1,64 @@
+CONFIG_ARM=y
+CONFIG_ARCH_STM32=y
+CONFIG_SYS_TEXT_BASE=0x0800
+CONFIG_SYS_MALLOC_LEN=0x10
+CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="stm32f746-disco"
+CONFIG_STM32F7=y
+CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_SYS_LOAD_ADDR=0x8008000
+CONFIG_BOOTDELAY=3
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_SYS_PROMPT="U-Boot > "
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+# CONFIG_ISO_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_ARM_PL180_MMCI=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_STM32_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_PHY_SMSC=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_STM32_QSPI=y
+CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_MAX_XRES=480
+CONFIG_VIDEO_STM32_MAX_YRES=640
+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_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH v1 04/12] configs: stm32f769-disco: Rename stm32f769-disco_defconfig to stm32f769-disco_spl_defconfig

2022-04-13 Thread Patrice Chotard
The current stm32f769-disco_defconfig file supports SPL, rename it to
stm32f769-disco_spl_defconfig to reflect the supported configuration.

Signed-off-by: Patrice Chotard 
---

 board/st/stm32f746-disco/MAINTAINERS | 1 +
 .../{stm32f769-disco_defconfig => stm32f769-disco_spl_defconfig} | 0
 2 files changed, 1 insertion(+)
 rename configs/{stm32f769-disco_defconfig => stm32f769-disco_spl_defconfig} 
(100%)

diff --git a/board/st/stm32f746-disco/MAINTAINERS 
b/board/st/stm32f746-disco/MAINTAINERS
index 06d366e8a2..68f61fd5ff 100644
--- a/board/st/stm32f746-disco/MAINTAINERS
+++ b/board/st/stm32f746-disco/MAINTAINERS
@@ -6,3 +6,4 @@ F:  include/configs/stm32f746-disco.h
 F: configs/stm32f746-disco_defconfig
 F: configs/stm32f746-disco_spl_defconfig
 F: configs/stm32f769-disco_defconfig
+F: configs/stm32f769-disco_spl_defconfig
diff --git a/configs/stm32f769-disco_defconfig 
b/configs/stm32f769-disco_spl_defconfig
similarity index 100%
rename from configs/stm32f769-disco_defconfig
rename to configs/stm32f769-disco_spl_defconfig
-- 
2.17.1



[PATCH v1 06/12] configs: stm32f769-disco: Migrate SPL flags to defconfig

2022-04-13 Thread Patrice Chotard
Migrate SPL flags to stm32f769-disco_spl_defconfig

Signed-off-by: Patrice Chotard 
---

 configs/stm32f769-disco_spl_defconfig | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/configs/stm32f769-disco_spl_defconfig 
b/configs/stm32f769-disco_spl_defconfig
index 0ba0184359..4e8a72ed0e 100644
--- a/configs/stm32f769-disco_spl_defconfig
+++ b/configs/stm32f769-disco_spl_defconfig
@@ -3,12 +3,19 @@ CONFIG_ARCH_STM32=y
 CONFIG_SYS_TEXT_BASE=0x08008000
 CONFIG_SYS_MALLOC_LEN=0x10
 CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="stm32f769-disco"
 CONFIG_SPL_TEXT_BASE=0x800
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_SPL=y
+CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x8008000
 CONFIG_BOOTDELAY=3
@@ -18,6 +25,11 @@ CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
 # CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_XIP_SUPPORT=y
+CONFIG_SPL_DM_RESET=y
 CONFIG_SYS_PROMPT="U-Boot > "
 CONFIG_CMD_GPT=y
 # CONFIG_RANDOM_UUID is not set
@@ -29,15 +41,16 @@ CONFIG_CMD_LINK_LOCAL=y
 CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIMER=y
-# CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_ISO_PARTITION is not set
-# CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NETCONSOLE=y
-# CONFIG_SPL_BLK is not set
-# CONFIG_SPL_DM_MMC is not set
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_SPL_CLK=y
 CONFIG_ARM_PL180_MMCI=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
@@ -51,9 +64,13 @@ CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_MII=y
 # CONFIG_PINCTRL_FULL is not set
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_RAM=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
+CONFIG_SPL_TIMER=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
 CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
-- 
2.17.1



[PATCH v1 05/12] configs: stm32f769-disco: Add stm32f769-disco_defconfig

2022-04-13 Thread Patrice Chotard
Add stm32f769-disco_defconfig for stm32f769 discovery board to
build U-Boot proper.

Signed-off-by: Patrice Chotard 
---

 configs/stm32f769-disco_defconfig | 65 +++
 1 file changed, 65 insertions(+)
 create mode 100644 configs/stm32f769-disco_defconfig

diff --git a/configs/stm32f769-disco_defconfig 
b/configs/stm32f769-disco_defconfig
new file mode 100644
index 00..3c112882cc
--- /dev/null
+++ b/configs/stm32f769-disco_defconfig
@@ -0,0 +1,65 @@
+CONFIG_ARM=y
+CONFIG_ARCH_STM32=y
+CONFIG_SYS_TEXT_BASE=0x0800
+CONFIG_SYS_MALLOC_LEN=0x10
+CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="stm32f769-disco"
+CONFIG_STM32F7=y
+CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_SYS_LOAD_ADDR=0x8008000
+CONFIG_BOOTDELAY=3
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_SYS_PROMPT="U-Boot > "
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+# CONFIG_ISO_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_ARM_PL180_MMCI=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_STM32_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_PHY_SMSC=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_STM32_QSPI=y
+CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=480
+CONFIG_VIDEO_STM32_MAX_YRES=800
+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_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH v1 09/12] configs: stm32f746-disco: use CONFIG_DEFAULT_DEVICE_TREE as fdtfile

2022-04-13 Thread Patrice Chotard
As stm32f46-disco, stm32f769-disco and stm32746g-eval are very similar
except their respective device tree file. These 3 boards uses the same
TARGET_STM32F746_DISCO flag (so same include/configs/stm32f746-disco.h
and same board file board/st/stm32f746-disco/stm32f746-disco.c)

To be able to compile these 3 boards, replace the hard-coded device-tree
name in include/configs/stm32f746-disco.h by CONFIG_DEFAULT_DEVICE_TREE
which is set in each board defconfig file with the correct value.

Signed-off-by: Patrice Chotard 
---

 include/configs/stm32f746-disco.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/stm32f746-disco.h 
b/include/configs/stm32f746-disco.h
index b93acdcc1f..cc3d4b4449 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -34,7 +34,7 @@
 #include 
 #define CONFIG_EXTRA_ENV_SETTINGS  \
"kernel_addr_r=0xC0008000\0"\
-   "fdtfile=stm32f746-disco.dtb\0" \
+   "fdtfile="CONFIG_DEFAULT_DEVICE_TREE".dtb\0"\
"fdt_addr_r=0xC0408000\0"   \
"scriptaddr=0xC0418000\0"   \
"pxefile_addr_r=0xC0428000\0" \
-- 
2.17.1



[PATCH v1 08/12] board: stm32f746-disco: Fix dram_init() in none SPL config

2022-04-13 Thread Patrice Chotard
Replace CONFIG_SUPPORT_SPL by CONFIG_SPL_BUILD to allow
dram_init() execution when using none SPL defconfig
(stm32f746-disco_defconfig).

Signed-off-by: Patrice Chotard 
---

 board/st/stm32f746-disco/stm32f746-disco.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/st/stm32f746-disco/stm32f746-disco.c 
b/board/st/stm32f746-disco/stm32f746-disco.c
index 95d83e73ee..ed36e3170f 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -29,7 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-#ifndef CONFIG_SUPPORT_SPL
+#ifndef CONFIG_SPL_BUILD
int rv;
struct udevice *dev;
rv = uclass_get_device(UCLASS_RAM, 0, &dev);
-- 
2.17.1



[PATCH v1 07/12] configs: stm32f746-disco: Migrate SPL flags to defconfig

2022-04-13 Thread Patrice Chotard
Migrate SPL flags to stm32f746-disco_spl_defconfig

Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32/Kconfig   | 20 
 configs/stm32f746-disco_spl_defconfig | 24 
 2 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
index a439dbd10f..a44ebf2597 100644
--- a/arch/arm/mach-stm32/Kconfig
+++ b/arch/arm/mach-stm32/Kconfig
@@ -25,26 +25,6 @@ config STM32F7
select PINCTRL
select PINCTRL_STM32
select RAM
-   select SPL
-   select SPL_BOARD_INIT
-   select SPL_CLK
-   select SPL_DM
-   select SPL_DM_RESET
-   select SPL_DM_SEQ_ALIAS
-   select SPL_DRIVERS_MISC
-   select SPL_GPIO
-   select SPL_LIBCOMMON_SUPPORT
-   select SPL_LIBGENERIC_SUPPORT
-   select SPL_MTD_SUPPORT
-   select SPL_OF_CONTROL
-   select SPL_OF_LIBFDT
-   select SPL_OF_TRANSLATE
-   select SPL_PINCTRL
-   select SPL_RAM
-   select SPL_SERIAL
-   select SPL_SYS_MALLOC_SIMPLE
-   select SPL_TIMER
-   select SPL_XIP_SUPPORT
select STM32_RCC
select STM32_RESET
select STM32_SDRAM
diff --git a/configs/stm32f746-disco_spl_defconfig 
b/configs/stm32f746-disco_spl_defconfig
index aabffac75f..03308b987c 100644
--- a/configs/stm32f746-disco_spl_defconfig
+++ b/configs/stm32f746-disco_spl_defconfig
@@ -3,12 +3,18 @@ CONFIG_ARCH_STM32=y
 CONFIG_SYS_TEXT_BASE=0x08008000
 CONFIG_SYS_MALLOC_LEN=0x10
 CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="stm32f746-disco"
 CONFIG_SPL_TEXT_BASE=0x800
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_SPL=y
 CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x8008000
@@ -20,6 +26,11 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_LATE_INIT=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_XIP_SUPPORT=y
+CONFIG_SPL_DM_RESET=y
 CONFIG_SYS_PROMPT="U-Boot > "
 CONFIG_CMD_GPT=y
 # CONFIG_RANDOM_UUID is not set
@@ -31,15 +42,16 @@ CONFIG_CMD_LINK_LOCAL=y
 CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIMER=y
-# CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_ISO_PARTITION is not set
-# CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NETCONSOLE=y
-# CONFIG_SPL_BLK is not set
-# CONFIG_SPL_DM_MMC is not set
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_SPL_CLK=y
 CONFIG_ARM_PL180_MMCI=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
@@ -53,9 +65,13 @@ CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_MII=y
 # CONFIG_PINCTRL_FULL is not set
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_RAM=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
+CONFIG_SPL_TIMER=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
 CONFIG_VIDEO_STM32=y
-- 
2.17.1



[PATCH v1 10/12] configs: stm32746g-eval: Add stm32746g-eval_defconfig

2022-04-13 Thread Patrice Chotard
Add stm32746g-eval_defconfig for stm32746g evaluation board to
build U-Boot proper.

Full board description can be found here :
https://www.st.com/en/evaluation-tools/stm32746g-eval.html

Signed-off-by: Patrice Chotard 
---

 board/st/stm32f746-disco/MAINTAINERS |  1 +
 configs/stm32746g-eval_defconfig | 64 
 2 files changed, 65 insertions(+)
 create mode 100644 configs/stm32746g-eval_defconfig

diff --git a/board/st/stm32f746-disco/MAINTAINERS 
b/board/st/stm32f746-disco/MAINTAINERS
index 68f61fd5ff..7f128a8b69 100644
--- a/board/st/stm32f746-disco/MAINTAINERS
+++ b/board/st/stm32f746-disco/MAINTAINERS
@@ -5,5 +5,6 @@ F:  board/st/stm32f746-disco
 F: include/configs/stm32f746-disco.h
 F: configs/stm32f746-disco_defconfig
 F: configs/stm32f746-disco_spl_defconfig
+F: configs/stm32746g-eval_defconfig
 F: configs/stm32f769-disco_defconfig
 F: configs/stm32f769-disco_spl_defconfig
diff --git a/configs/stm32746g-eval_defconfig b/configs/stm32746g-eval_defconfig
new file mode 100644
index 00..9f79b5a2b4
--- /dev/null
+++ b/configs/stm32746g-eval_defconfig
@@ -0,0 +1,64 @@
+CONFIG_ARM=y
+CONFIG_ARCH_STM32=y
+CONFIG_SYS_TEXT_BASE=0x0800
+CONFIG_SYS_MALLOC_LEN=0x10
+CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="stm32746g-eval"
+CONFIG_STM32F7=y
+CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_SYS_LOAD_ADDR=0x8008000
+CONFIG_BOOTDELAY=3
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_SYS_PROMPT="U-Boot > "
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+# CONFIG_ISO_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_ARM_PL180_MMCI=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_STM32_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_PHY_SMSC=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_STM32_QSPI=y
+CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_MAX_XRES=480
+CONFIG_VIDEO_STM32_MAX_YRES=640
+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_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH v1 11/12] configs: stm32746g-eval: Add stm32746g-eval_spl_defconfig

2022-04-13 Thread Patrice Chotard
Add stm32746g-eval_spl_defconfig for stm32746g evaluation board to
build SPL.

Signed-off-by: Patrice Chotard 
---

 board/st/stm32f746-disco/MAINTAINERS |  1 +
 configs/stm32746g-eval_spl_defconfig | 86 
 2 files changed, 87 insertions(+)
 create mode 100644 configs/stm32746g-eval_spl_defconfig

diff --git a/board/st/stm32f746-disco/MAINTAINERS 
b/board/st/stm32f746-disco/MAINTAINERS
index 7f128a8b69..bc0952c563 100644
--- a/board/st/stm32f746-disco/MAINTAINERS
+++ b/board/st/stm32f746-disco/MAINTAINERS
@@ -6,5 +6,6 @@ F:  include/configs/stm32f746-disco.h
 F: configs/stm32f746-disco_defconfig
 F: configs/stm32f746-disco_spl_defconfig
 F: configs/stm32746g-eval_defconfig
+F: configs/stm32746g-eval_spl_defconfig
 F: configs/stm32f769-disco_defconfig
 F: configs/stm32f769-disco_spl_defconfig
diff --git a/configs/stm32746g-eval_spl_defconfig 
b/configs/stm32746g-eval_spl_defconfig
new file mode 100644
index 00..169a9c5b23
--- /dev/null
+++ b/configs/stm32746g-eval_spl_defconfig
@@ -0,0 +1,86 @@
+CONFIG_ARM=y
+CONFIG_ARCH_STM32=y
+CONFIG_SYS_TEXT_BASE=0x08008000
+CONFIG_SYS_MALLOC_LEN=0x10
+CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="stm32746g-eval"
+CONFIG_SPL_TEXT_BASE=0x800
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_STM32F7=y
+CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_SPL=y
+CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_SYS_LOAD_ADDR=0x8008000
+CONFIG_BOOTDELAY=3
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_XIP_SUPPORT=y
+CONFIG_SPL_DM_RESET=y
+CONFIG_SYS_PROMPT="U-Boot > "
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+# CONFIG_ISO_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_SPL_CLK=y
+CONFIG_ARM_PL180_MMCI=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_STM32_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_PHY_SMSC=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_RAM=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_STM32_QSPI=y
+CONFIG_SPL_TIMER=y
+CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_MAX_XRES=480
+CONFIG_VIDEO_STM32_MAX_YRES=640
+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_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH v1 12/12] doc: Add documentation for STM32 MCUs

2022-04-13 Thread Patrice Chotard
Add documentation for STM32 MCUs (F4, F7 and H7 series).

Signed-off-by: Patrice Chotard 

---

 board/st/stm32f429-discovery/MAINTAINERS  |   1 +
 board/st/stm32f429-evaluation/MAINTAINERS |   1 +
 board/st/stm32f469-discovery/MAINTAINERS  |   1 +
 board/st/stm32f746-disco/MAINTAINERS  |   1 +
 board/st/stm32h743-disco/MAINTAINERS  |   1 +
 board/st/stm32h743-eval/MAINTAINERS   |   1 +
 board/st/stm32h750-art-pi/MAINTAINERS |   1 +
 doc/board/st/index.rst|   1 +
 doc/board/st/stm32_MCU.rst| 186 ++
 9 files changed, 194 insertions(+)
 create mode 100644 doc/board/st/stm32_MCU.rst

diff --git a/board/st/stm32f429-discovery/MAINTAINERS 
b/board/st/stm32f429-discovery/MAINTAINERS
index fdb62e98e8..7661a15fdd 100644
--- a/board/st/stm32f429-discovery/MAINTAINERS
+++ b/board/st/stm32f429-discovery/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32F429-DISCOVERY BOARD
 M: Kamil Lulko 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32f429-discovery/
 F: include/configs/stm32f429-discovery.h
 F: configs/stm32f429-discovery_defconfig
diff --git a/board/st/stm32f429-evaluation/MAINTAINERS 
b/board/st/stm32f429-evaluation/MAINTAINERS
index 29d00ef27e..b272893ef7 100644
--- a/board/st/stm32f429-evaluation/MAINTAINERS
+++ b/board/st/stm32f429-evaluation/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32F429-EVALUATION BOARD
 M: Patrice Chotard 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32f429-evaluation/
 F: include/configs/stm32f429-evaluation.h
 F: configs/stm32f429-evaluation_defconfig
diff --git a/board/st/stm32f469-discovery/MAINTAINERS 
b/board/st/stm32f469-discovery/MAINTAINERS
index 5a6a78b39e..a95f93f6f6 100644
--- a/board/st/stm32f469-discovery/MAINTAINERS
+++ b/board/st/stm32f469-discovery/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32F469-DISCOVERY BOARD
 M: Patrice Chotard 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32f469-discovery/
 F: include/configs/stm32f469-discovery.h
 F: configs/stm32f469-discovery_defconfig
diff --git a/board/st/stm32f746-disco/MAINTAINERS 
b/board/st/stm32f746-disco/MAINTAINERS
index bc0952c563..18e4c99c4f 100644
--- a/board/st/stm32f746-disco/MAINTAINERS
+++ b/board/st/stm32f746-disco/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32F746 DISCOVERY BOARD
 M: Vikas Manocha 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32f746-disco
 F: include/configs/stm32f746-disco.h
 F: configs/stm32f746-disco_defconfig
diff --git a/board/st/stm32h743-disco/MAINTAINERS 
b/board/st/stm32h743-disco/MAINTAINERS
index 60fbe344f8..f4ecef3aa5 100644
--- a/board/st/stm32h743-disco/MAINTAINERS
+++ b/board/st/stm32h743-disco/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32H743 DISCOVERY BOARD
 M: Patrice Chotard 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32h743-disco
 F: include/configs/stm32h743-disco.h
 F: configs/stm32h743-disco_defconfig
diff --git a/board/st/stm32h743-eval/MAINTAINERS 
b/board/st/stm32h743-eval/MAINTAINERS
index fda93db777..b69e0d4abb 100644
--- a/board/st/stm32h743-eval/MAINTAINERS
+++ b/board/st/stm32h743-eval/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32H743 EVALUATION BOARD
 M: Patrice Chotard 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32h743-eval
 F: include/configs/stm32h743-eval.h
 F: configs/stm32h743-eval_defconfig
diff --git a/board/st/stm32h750-art-pi/MAINTAINERS 
b/board/st/stm32h750-art-pi/MAINTAINERS
index 9578833068..2fd69e6d1c 100644
--- a/board/st/stm32h750-art-pi/MAINTAINERS
+++ b/board/st/stm32h750-art-pi/MAINTAINERS
@@ -1,6 +1,7 @@
 STM32H750 ART PI BOARD
 M: Dillon Min 
 S: Maintained
+F: doc/board/st/
 F: board/st/stm32h750-art-pi
 F: include/configs/stm32h750-art-pi.h
 F: configs/stm32h750-art-pi_defconfig
diff --git a/doc/board/st/index.rst b/doc/board/st/index.rst
index 9bba42f1da..2a8a4ef3b8 100644
--- a/doc/board/st/index.rst
+++ b/doc/board/st/index.rst
@@ -8,3 +8,4 @@ STMicroelectronics
 
st-dt
stm32mp1
+   stm32_MCU
diff --git a/doc/board/st/stm32_MCU.rst b/doc/board/st/stm32_MCU.rst
new file mode 100644
index 00..84f7c0016e
--- /dev/null
+++ b/doc/board/st/stm32_MCU.rst
@@ -0,0 +1,186 @@
+.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+.. sectionauthor:: Patrice Chotard 
+
+STM32 MCU boards
+=
+
+This is a quick instruction for setup STM32 MCU boards.
+
+Supported devices
+-
+
+U-Boot supports the following STMP32 MCU SoCs:
+
+ - STM32F429
+ - STM32F469
+ - STM32F746
+ - STM32F769
+ - STM32H743
+ - STM32H750
+
+SoCs information:
+-
+STM32F4 series are Cortex-M4 MCU.
+STM32F7 and STM32H7 series are Cortex-M7 MCU.
+
+ + STM32F4 series: 
https://www.st.com/en/microcontrollers-microprocessors/stm32f4-series.html
+ + STM32F7 series: 
https://www.st.com/en/microcontrollers-microprocessors/stm32f7-series.html
+ + STM32H7 series: 
https://www.st.com/en/microcontrollers-microprocessors/stm32h7-series.html
+

Please pull u-boot-net/next

2022-04-13 Thread Ramon Fried
Hi Tom,
Please pull the latest changes from u-boot-net/next branch which include:

* DM9000 DM support
* tftp server bug fix
* mdio ofnode support functions
* Various phy fixes and improvements.

The following changes since commit 8221c52d88fbe84ca9692dc23827e21403c952e8:

  Merge tag 'u-boot-at91-2022.07-a' of
https://source.denx.de/u-boot/custodians/u-boot-at91 into next
(2022-04-04 08:26:55 -0400)

are available in the Git repository at:

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

for you to fetch changes up to 0154e6de37e8bbaac837939391f6d4a8f0b3fd18:

  configs: net: dm9000: Move new Kconfig option to board configs
(2022-04-13 15:14:31 +0300)


Arjan Minzinga Zijlstra (1):
  net: tftp: fix tftp server initialization

Haolin Li (1):
  net: phy: dp83867: Fix a never true comparison

Marek Behún (17):
  net: mdio-uclass: fix type for phy_mode_str and phy_handle_str
  net: mdio-uclass: use ARRAY_SIZE()
  net: introduce helpers to get PHY ofnode from MAC
  net: mdio-uclass: add wrappers for read/write/reset operations
  treewide: use dm_mdio_read/write/reset() wrappers
  net: phy: fix parsing wrong property
  net: introduce helpers to get PHY interface mode from a device/ofnode
  treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX
  treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA
  phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition
  net: phy: xilinx: Check interface type in ->config(), not ->probe()
  net: phy: use ->is_c45 instead of is_10g_interface()
  bcmgenet, sun8i_emac: Don't connect PHY two times
  net: phy: don't require PHY interface mode during PHY creation
  driver: net: ti: keystone_net: Deduplicate code
  driver: net: ti: keystone_net: Convert to ofnode functions
  driver: net: ti: keystone_net: Change priv member type

Marek Vasut (17):
  net: dm9000: Make accessor names lowercase
  net: dm9000: Replace DM9000_DBG() with debug()
  net: dm9000: Make RxLen and RxStatus lowercase
  net: dm9000: Drop unused dump_regs()
  net: dm9000: Turn DM9000_DMP_PACKET() into a function
  net: dm9000: Drop volatiles
  net: dm9000: Checkpatch cleanup
  net: dm9000: Reorder and staticize
  net: dm9000: Rename board_info to dm9000_priv
  net: dm9000: Drop static device private data
  net: dm9000: Drop dm9000.h and staticize SROM access
  net: dm9000: Pass private data around for IO
  net: dm9000: Split non-DM specific bits from common code
  net: dm9000: Receive one packet per recv call
  net: dm9000: Add DM support
  net: dm9000: Add Kconfig entry
  configs: net: dm9000: Move new Kconfig option to board configs

Nate Drude (1):
  phy: adin: add driver for Analog Devices ADIN1300 PHY

Tim Harvey (2):
  net: fec: prevent undesired de-assertion of phy-reset on request
  net: eth-phy: prevent undesired de-assertion of phy-reset on request

Vladimir Oltean (2):
  net: phy: dp83867: avoid error in dp83867_of_init() when PHY has
no OF node
  net: phy: atheros: avoid error in ar803x_of_init() when PHY has no OF node

 arch/sandbox/dts/test.dts |  14 
 board/CZ.NIC/turris_mox/turris_mox.c  |   2 +-
 board/boundary/nitrogen6x/nitrogen6x.c|   2 +-
 board/freescale/corenet_ds/eth_hydra.c|   2 +-
 board/freescale/corenet_ds/eth_superhydra.c   |   4 +-
 board/freescale/t104xrdb/eth.c|   4 +-
 board/gdsys/a38x/controlcenterdc.c|   7 +-
 board/gdsys/a38x/ihs_phys.c   |   6 +-
 board/st/stm32f746-disco/stm32f746-disco.c|  13 ++-
 configs/M5253DEMO_defconfig   |   1 +
 configs/at91sam9261ek_dataflash_cs0_defconfig |   1 +
 configs/at91sam9261ek_dataflash_cs3_defconfig |   1 +
 configs/at91sam9261ek_nandflash_defconfig |   1 +
 configs/ci20_mmc_defconfig|   1 +
 configs/colibri_pxa270_defconfig  |   1 +
 configs/devkit8000_defconfig  |   1 +
 doc/device-tree-bindings/net/phy/adin.txt |  26 ++
 drivers/core/ofnode.c |  44 ++
 drivers/core/read.c   |  10 +++
 drivers/net/Kconfig   |   5 ++
 drivers/net/ag7xxx.c  |   9 +-
 drivers/net/altera_tse.c  |  17 ++--
 drivers/net/bcm6348-eth.c |   8 +-
 drivers/net/bcmgenet.c|  12 +--
 drivers/net/designware.c  |  10 +--
 drivers/net/dm9000x.c | 827
+--
 drivers/net/dwc_eth_qos.c |  40 ++---
 drivers/net/eth-phy-uclas

Re: [PATCH v2 16/18] pci: Add mask parameter to dm_pci_map_bar()

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Add a mask parameter to control the lookup of the PCI region from which
> the mapping can be made.
>
> Signed-off-by: Andrew Scull 
> ---
>  arch/x86/cpu/baytrail/cpu.c |  2 +-
>  drivers/ata/ahci.c  |  7 ---
>  drivers/gpio/octeon_gpio.c  |  2 +-
>  drivers/i2c/designware_i2c_pci.c|  3 ++-
>  drivers/i2c/intel_i2c.c |  2 +-
>  drivers/i2c/octeon_i2c.c|  2 +-
>  drivers/mmc/octeontx_hsmmc.c|  2 +-
>  drivers/mmc/pci_mmc.c   |  2 +-
>  drivers/mtd/nand/raw/octeontx_bch.c |  6 --
>  drivers/mtd/nand/raw/octeontx_nand.c|  2 +-
>  drivers/net/bnxt/bnxt.c |  9 ++---
>  drivers/net/fsl_enetc.c |  2 +-
>  drivers/net/fsl_enetc_mdio.c|  2 +-
>  drivers/net/mscc_eswitch/felix_switch.c |  4 ++--
>  drivers/net/octeontx/bgx.c  |  2 +-
>  drivers/net/octeontx/nic_main.c |  2 +-
>  drivers/net/octeontx/nicvf_main.c   |  2 +-
>  drivers/net/octeontx/smi.c  |  2 +-
>  drivers/net/octeontx2/cgx.c |  2 +-
>  drivers/net/octeontx2/rvu_af.c  |  2 +-
>  drivers/net/octeontx2/rvu_pf.c  |  3 ++-
>  drivers/net/pch_gbe.c   |  2 +-
>  drivers/nvme/nvme_pci.c |  2 +-
>  drivers/pci/pci-uclass.c|  6 +++---
>  drivers/spi/octeon_spi.c|  2 +-
>  drivers/usb/host/ohci-pci.c |  2 +-
>  drivers/virtio/virtio_pci_legacy.c  |  3 ++-
>  include/pci.h   |  3 ++-
>  test/dm/pci.c   | 12 ++--
>  29 files changed, 52 insertions(+), 42 deletions(-)
>

Again I believe this patch should be squashed into previous patches
for bisectability.

> diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c
> index 6f1b05175c..3eb10b53bb 100644
> --- a/arch/x86/cpu/baytrail/cpu.c
> +++ b/arch/x86/cpu/baytrail/cpu.c
> @@ -55,7 +55,7 @@ int arch_cpu_init_dm(void)
> for (i = 0; i < 2; i++) {
> ret = dm_pci_bus_find_bdf(PCI_BDF(0, 0x1e, 3 + i), &dev);
> if (!ret) {
> -   base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
> +   base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, 
> PCI_REGION_TYPE,
>   PCI_REGION_MEM);
> hsuart_clock_set(base);
> }
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 3925807d55..de6131f1d9 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -417,7 +417,7 @@ static int ahci_init_one(struct ahci_uc_priv *uc_priv, 
> struct udevice *dev)
>
>  #if !defined(CONFIG_DM_SCSI)
> uc_priv->mmio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_5, 0, 0,
> -   PCI_REGION_MEM);
> +   PCI_REGION_TYPE, PCI_REGION_MEM);
>
> /* Take from kernel:
>  * JMicron-specific fixup:
> @@ -1149,7 +1149,7 @@ int ahci_probe_scsi_pci(struct udevice *ahci_dev)
> u16 vendor, device;
>
> base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0,
> -PCI_REGION_MEM);
> +PCI_REGION_TYPE, PCI_REGION_MEM);
>
> /*
>  * Note:
> @@ -1163,7 +1163,8 @@ int ahci_probe_scsi_pci(struct udevice *ahci_dev)
>
> if (vendor == PCI_VENDOR_ID_CAVIUM &&
> device == PCI_DEVICE_ID_CAVIUM_SATA)
> -   base = (uintptr_t)dm_pci_map_bar(ahci_dev, 
> PCI_BASE_ADDRESS_0, 0, 0,
> +   base = (uintptr_t)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_0,
> +0, 0, PCI_REGION_TYPE,
>  PCI_REGION_MEM);
> return ahci_probe_scsi(ahci_dev, base);
>  }
> diff --git a/drivers/gpio/octeon_gpio.c b/drivers/gpio/octeon_gpio.c
> index e6a8e1a521..2b2465b1bc 100644
> --- a/drivers/gpio/octeon_gpio.c
> +++ b/drivers/gpio/octeon_gpio.c
> @@ -183,7 +183,7 @@ static int octeon_gpio_probe(struct udevice *dev)
> priv->data = (const struct octeon_gpio_data 
> *)dev_get_driver_data(dev);
>
> if (priv->data->probe == PROBE_PCI) {
> -   priv->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0,
> +   priv->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, 
> PCI_REGION_TYPE,
> PCI_REGION_MEM);
> uc_priv->gpio_count = readq(priv->base +
> priv->data->reg_offs + 
> GPIO_CONST) &
> diff --git a/drivers/i2c/designware_i2c_pci.c 
> b/drivers/i2c/designware_i2c_pci.c
> index 51f1357d10..1572c2c6bc 100644
> --- a/drivers/i2c/designware_i2c_pci.c
> +++ b/drivers/i2c/designware_i2c_pci.c
> @@ -59,7 +59,8 @@ stat

Re: [PATCH v2 17/18] virtio: pci: Check virtio configs are mapped

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> Prepare for calls to `virtio_pci_map_capability()` failing by returning
> NULL on error. If this happens, later accesses to the pointers would be
> unsafe so cause the probe to fail if such an error occurs.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/virtio/virtio_pci_modern.c | 20 +---
>  1 file changed, 17 insertions(+), 3 deletions(-)
>

Reviewed-by: Bin Meng 


Re: [PATCH v2 18/18] virtio: pci: Make use of dm_pci_map_bar()

2022-04-13 Thread Bin Meng
On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> The virtio PCI capabilities describe regions of memory that should be
> mapped. Map those with dm_pci_map_bar() which will ensure they are valid
> PCI regions.
>
> Signed-off-by: Andrew Scull 
> ---
>  drivers/virtio/virtio_pci_modern.c | 18 --
>  1 file changed, 8 insertions(+), 10 deletions(-)
>

Reviewed-by: Bin Meng 


Re: [PATCH v2 00/18] virtio: pci: Add and fix consistency checks

2022-04-13 Thread Bin Meng
Hi Andrew,

On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
>
> The virtio PCI drivers forgo a number of consistency checks,
> particularly around pointer validation and bounds checking. This series
> focuses on the modern driver to add those checks.
>
> The start of the series adds and fixes some basic bounds checks. Later
> patches ensure PCI addresses fall within the expected regions rather
> than any arbitrary address. This is acheived by introducing range
> parameters to a few of the dm_pci_* functions that allow the ranges to
> be checked.
>
> The series also adds a few new configs to allow parts of virtio and PCI
> to be disabled where the features may be unused and the current
> implementations don't have the needed consistencty checks.
>
> Changelog:
> v2:
>  - Refactor dm_pci_* functions, not adding new ones
>  - Reorder patches per request in v1
>

I believe some patches have bisectability issues. CI does not complain
such, but you can use buildman to catch those.

Regards,
Bin


[PATCH v2] imx8m{m,n}_venice: update env memory layout

2022-04-13 Thread Tim Harvey
Update distro config env memory layout:
 - loadaddr=0x4820 allows for 130MB area for uncompressing (ie FIT
   images, kernel_comp_addr_r)
 - fdt_addr_r = loadaddr + 128MB - allows for 128MB kernel
 - scriptaddr = fdt_addr_r + 512KB - allows for 512KB fdt
 - ramdisk_addr_r = scriptaddr + 512KB - allows for 512KB script

Signed-off-by: Tim Harvey 
Reviewed-by: Fabio Estevam 
---
v2:
 - rebase on imx/master
 - add Fabios rb tag
---
 configs/imx8mm_venice_defconfig | 2 +-
 configs/imx8mn_venice_defconfig | 2 +-
 include/configs/imx8mm_venice.h | 9 +
 include/configs/imx8mn_venice.h | 9 +
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index 7e6bb6808eb2..c68c1500faaf 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -16,7 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0xff8000
-CONFIG_SYS_LOAD_ADDR=0x4048
+CONFIG_SYS_LOAD_ADDR=0x4820
 CONFIG_SYS_MEMTEST_START=0x4000
 CONFIG_SYS_MEMTEST_END=0x8000
 CONFIG_LTO=y
diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
index 02d79fb47903..72e8f3e58593 100644
--- a/configs/imx8mn_venice_defconfig
+++ b/configs/imx8mn_venice_defconfig
@@ -16,7 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0xff8000
 CONFIG_SPL_IMX_ROMAPI_LOADADDR=0x4800
-CONFIG_SYS_LOAD_ADDR=0x4048
+CONFIG_SYS_LOAD_ADDR=0x4820
 CONFIG_SYS_MEMTEST_START=0x4000
 CONFIG_SYS_MEMTEST_END=0x8000
 CONFIG_LTO=y
diff --git a/include/configs/imx8mm_venice.h b/include/configs/imx8mm_venice.h
index eee59a4ca57f..4b7dcf3ed9f0 100644
--- a/include/configs/imx8mm_venice.h
+++ b/include/configs/imx8mm_venice.h
@@ -29,10 +29,11 @@
 #endif
 
 #define MEM_LAYOUT_ENV_SETTINGS \
-   "fdt_addr_r=0x4400\0" \
-   "kernel_addr_r=0x4200\0" \
-   "ramdisk_addr_r=0x4640\0" \
-   "scriptaddr=0x4600\0"
+   "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+   "fdt_addr_r=0x5020\0" \
+   "scriptaddr=0x5028\0" \
+   "ramdisk_addr_r=0x5030\0" \
+   "kernel_comp_addr_r=0x4020\0"
 
 /* Enable Distro Boot */
 #ifndef CONFIG_SPL_BUILD
diff --git a/include/configs/imx8mn_venice.h b/include/configs/imx8mn_venice.h
index d977d3265203..d59a73992730 100644
--- a/include/configs/imx8mn_venice.h
+++ b/include/configs/imx8mn_venice.h
@@ -26,10 +26,11 @@
 #endif
 
 #define MEM_LAYOUT_ENV_SETTINGS \
-   "fdt_addr_r=0x4400\0" \
-   "kernel_addr_r=0x4200\0" \
-   "ramdisk_addr_r=0x4640\0" \
-   "scriptaddr=0x4600\0"
+   "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+   "fdt_addr_r=0x5020\0" \
+   "scriptaddr=0x5028\0" \
+   "ramdisk_addr_r=0x5030\0" \
+   "kernel_comp_addr_r=0x4020\0"
 
 /* Enable Distro Boot */
 #ifndef CONFIG_SPL_BUILD
-- 
2.17.1



[PATCH v2] configs: imx8m{m,n}_venice_defconfig: add usb support

2022-04-13 Thread Tim Harvey
Enable USB support for host controller and various USB ethernet
devices.

Example usage of USB Mass Storage (UMS) support:
 u-boot=> mmc list
 FSL_SDHC: 0
 FSL_SDHC: 1
 FSL_SDHC: 2 (eMMC)
 u-boot=> ums 0 mmc 2
 UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0xe3

Signed-off-by: Tim Harvey 
---
v2: rebase on imx/master
---
 configs/imx8mm_venice_defconfig | 20 
 configs/imx8mn_venice_defconfig | 20 
 include/configs/imx8mm_venice.h |  2 ++
 include/configs/imx8mn_venice.h |  1 +
 4 files changed, 43 insertions(+)

diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index c68c1500faaf..dd61ec9b70fb 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -47,6 +47,8 @@ CONFIG_CMD_FUSE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_UUID=y
@@ -98,6 +100,8 @@ CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_IMX8M_POWER_DOMAIN=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_PMIC_BD71837=y
 CONFIG_SPL_DM_PMIC_BD71837=y
@@ -113,5 +117,21 @@ CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_TMU=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_LAN75XX=y
+CONFIG_USB_ETHER_LAN78XX=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Gateworks"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
 CONFIG_HEXDUMP=y
diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
index 72e8f3e58593..c3a96a378553 100644
--- a/configs/imx8mn_venice_defconfig
+++ b/configs/imx8mn_venice_defconfig
@@ -47,6 +47,8 @@ CONFIG_CMD_FUSE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_UUID=y
@@ -96,6 +98,8 @@ CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_IMX8M_POWER_DOMAIN=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_PMIC_BD71837=y
 CONFIG_SPL_DM_PMIC_BD71837=y
@@ -111,5 +115,21 @@ CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_TMU=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_LAN75XX=y
+CONFIG_USB_ETHER_LAN78XX=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Gateworks"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
 CONFIG_HEXDUMP=y
diff --git a/include/configs/imx8mm_venice.h b/include/configs/imx8mm_venice.h
index 4b7dcf3ed9f0..c8ac78801264 100644
--- a/include/configs/imx8mm_venice.h
+++ b/include/configs/imx8mm_venice.h
@@ -40,6 +40,8 @@
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 1) \
func(MMC, mmc, 2) \
+   func(USB, usb, 0) \
+   func(USB, usb, 1) \
func(DHCP, dhcp, na)
 #include 
 #else
diff --git a/include/configs/imx8mn_venice.h b/include/configs/imx8mn_venice.h
index d59a73992730..301dbb430c0e 100644
--- a/include/configs/imx8mn_venice.h
+++ b/include/configs/imx8mn_venice.h
@@ -37,6 +37,7 @@
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 1) \
func(MMC, mmc, 2) \
+   func(USB, usb, 0) \
func(DHCP, dhcp, na)
 #include 
 #else
-- 
2.17.1



[PATCH v2] board: gateworks: venice: enable DM_SERIAL

2022-04-13 Thread Tim Harvey
Enable DM_SERIAL.

Signed-off-by: Tim Harvey 
---
v2: rebase on imx/master
---
 configs/imx8mm_venice_defconfig | 2 ++
 configs/imx8mn_venice_defconfig | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index dd61ec9b70fb..09f7d8a58ca7 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -110,6 +110,8 @@ CONFIG_SPL_DM_PMIC_MP5416=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_SERIAL=y
+# CONFIG_SPL_DM_SERIAL is not set
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
index c3a96a378553..41898da4aecf 100644
--- a/configs/imx8mn_venice_defconfig
+++ b/configs/imx8mn_venice_defconfig
@@ -108,6 +108,8 @@ CONFIG_SPL_DM_PMIC_MP5416=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_SERIAL=y
+# CONFIG_SPL_DM_SERIAL is not set
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
-- 
2.17.1



Re: [PATCH v2] board: gateworks: venice: enable DM_SERIAL

2022-04-13 Thread Michael Nazzareno Trimarchi
Hi Tim

On Wed, Apr 13, 2022 at 5:47 PM Tim Harvey  wrote:
>
> Enable DM_SERIAL.
>
> Signed-off-by: Tim Harvey 
> ---
> v2: rebase on imx/master
> ---
>  configs/imx8mm_venice_defconfig | 2 ++
>  configs/imx8mn_venice_defconfig | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
> index dd61ec9b70fb..09f7d8a58ca7 100644
> --- a/configs/imx8mm_venice_defconfig
> +++ b/configs/imx8mm_venice_defconfig
> @@ -110,6 +110,8 @@ CONFIG_SPL_DM_PMIC_MP5416=y
>  CONFIG_DM_REGULATOR=y
>  CONFIG_DM_REGULATOR_FIXED=y
>  CONFIG_DM_REGULATOR_GPIO=y
> +CONFIG_DM_SERIAL=y
> +# CONFIG_SPL_DM_SERIAL is not set
>  CONFIG_MXC_UART=y
>  CONFIG_SYSRESET=y
>  CONFIG_SPL_SYSRESET=y
> diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
> index c3a96a378553..41898da4aecf 100644
> --- a/configs/imx8mn_venice_defconfig
> +++ b/configs/imx8mn_venice_defconfig
> @@ -108,6 +108,8 @@ CONFIG_SPL_DM_PMIC_MP5416=y
>  CONFIG_DM_REGULATOR=y
>  CONFIG_DM_REGULATOR_FIXED=y
>  CONFIG_DM_REGULATOR_GPIO=y
> +CONFIG_DM_SERIAL=y
> +# CONFIG_SPL_DM_SERIAL is not set
>  CONFIG_MXC_UART=y
>  CONFIG_SYSRESET=y
>  CONFIG_SPL_SYSRESET=y
> --
> 2.17.1
>

Should not select in your board kconfig?

Michael

-- 
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


[PATCH v2] board: gateworks: venice: use common GSC driver

2022-04-13 Thread Tim Harvey
Use the common GSC driver.

This allows us to do some additional cleanup:
 - rename gsc{.c,.h} to eeprom{.c.h} for clarity
 - collapse eeprom_get_dev
 - remove unnecessary header files and alphabatize includes

Signed-off-by: Tim Harvey 
---
v2: rebase on imx/master
---
 arch/arm/dts/imx8mm-venice-u-boot.dtsi |   4 +
 arch/arm/dts/imx8mm-venice.dts |   7 +
 arch/arm/dts/imx8mn-venice-u-boot.dtsi |   4 +
 arch/arm/dts/imx8mn-venice.dts |   7 +
 arch/arm/mach-imx/imx8m/Kconfig|   4 +
 board/gateworks/venice/Makefile|   2 +-
 board/gateworks/venice/eeprom.c| 353 +++
 board/gateworks/venice/{gsc.h => eeprom.h} |  26 +-
 board/gateworks/venice/gsc.c   | 700 -
 board/gateworks/venice/spl.c   |  53 +-
 board/gateworks/venice/venice.c|  27 +-
 configs/imx8mn_venice_defconfig|   1 +
 12 files changed, 425 insertions(+), 763 deletions(-)
 create mode 100644 board/gateworks/venice/eeprom.c
 rename board/gateworks/venice/{gsc.h => eeprom.h} (55%)
 delete mode 100644 board/gateworks/venice/gsc.c

diff --git a/arch/arm/dts/imx8mm-venice-u-boot.dtsi 
b/arch/arm/dts/imx8mm-venice-u-boot.dtsi
index 42b2903f0409..c61c6de935fb 100644
--- a/arch/arm/dts/imx8mm-venice-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-venice-u-boot.dtsi
@@ -57,6 +57,10 @@
u-boot,dm-spl;
 };
 
+&gsc {
+   u-boot,dm-spl;
+};
+
 &i2c2 {
u-boot,dm-spl;
 };
diff --git a/arch/arm/dts/imx8mm-venice.dts b/arch/arm/dts/imx8mm-venice.dts
index 54505a03c6fa..39b030691e53 100644
--- a/arch/arm/dts/imx8mm-venice.dts
+++ b/arch/arm/dts/imx8mm-venice.dts
@@ -27,6 +27,13 @@
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
 
+   gsc: gsc@20 {
+   compatible = "gw,gsc";
+   reg = <0x20>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+
eeprom@51 {
compatible = "atmel,24c02";
reg = <0x51>;
diff --git a/arch/arm/dts/imx8mn-venice-u-boot.dtsi 
b/arch/arm/dts/imx8mn-venice-u-boot.dtsi
index 055406e77b30..4f23da356763 100644
--- a/arch/arm/dts/imx8mn-venice-u-boot.dtsi
+++ b/arch/arm/dts/imx8mn-venice-u-boot.dtsi
@@ -94,6 +94,10 @@
u-boot,dm-spl;
 };
 
+&gsc {
+   u-boot,dm-spl;
+};
+
 &i2c2 {
u-boot,dm-spl;
 };
diff --git a/arch/arm/dts/imx8mn-venice.dts b/arch/arm/dts/imx8mn-venice.dts
index e906a560581d..eeae225632d7 100644
--- a/arch/arm/dts/imx8mn-venice.dts
+++ b/arch/arm/dts/imx8mn-venice.dts
@@ -27,6 +27,13 @@
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
 
+   gsc: gsc@20 {
+   compatible = "gw,gsc";
+   reg = <0x20>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+
eeprom@51 {
compatible = "atmel,24c02";
reg = <0x51>;
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index 55db25062a9b..1abf52611232 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -97,6 +97,8 @@ config TARGET_IMX8MM_VENICE
select IMX8MM
select SUPPORT_SPL
select IMX8M_LPDDR4
+   select GATEWORKS_SC
+   select MISC
 
 config TARGET_KONTRON_MX8MM
bool "Kontron Electronics N80xx"
@@ -143,6 +145,8 @@ config TARGET_IMX8MN_VENICE
select IMX8MN
select SUPPORT_SPL
select IMX8M_LPDDR4
+   select GATEWORKS_SC
+   select MISC
 
 config TARGET_IMX8MP_EVK
bool "imx8mp LPDDR4 EVK board"
diff --git a/board/gateworks/venice/Makefile b/board/gateworks/venice/Makefile
index b8b53fdc0e80..fbb716ee852d 100644
--- a/board/gateworks/venice/Makefile
+++ b/board/gateworks/venice/Makefile
@@ -4,7 +4,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y += venice.o gsc.o
+obj-y += venice.o eeprom.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
diff --git a/board/gateworks/venice/eeprom.c b/board/gateworks/venice/eeprom.c
new file mode 100644
index ..62b8125960c7
--- /dev/null
+++ b/board/gateworks/venice/eeprom.c
@@ -0,0 +1,353 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "eeprom.h"
+
+/* I2C */
+#define SOM_EEPROM_BUSNO   0
+#define SOM_EEPROM_ADDR0x51
+#define BASEBOARD_EEPROM_BUSNO 1
+#define BASEBOARD_EEPROM_ADDR  0x52
+
+struct venice_board_info som_info;
+struct venice_board_info base_info;
+char venice_model[32];
+u32 venice_serial;
+
+/* return a mac address from EEPROM info */
+int eeprom_getmac(int index, uint8_t *address)
+{
+   int i, j;
+   u32 maclow, machigh;
+   u64 mac;
+
+   j = 0;
+   if (som_info.macno) {
+   maclow = som_info.mac[5];
+   maclow |= som_info.mac[4] << 8;
+   maclow |= som_info.mac[3] << 16;
+   m

[PATCH v2] arm: dts: imx8m*-venice: add gpio hog support

2022-04-13 Thread Tim Harvey
Add gpio hog support for board-specific gpio lines:
- put hogs in u-boot.dtsi so as to keep the regular dts files
  in sync with the kernel. The hogs will not be put in the kernel
  as that makes them un-usable by userspace as well as
  re-initializes them to dt defaults overriding changes which may
  have been done by bootloader commands.
- specify gpio names and initial config
- enable GPIO_HOG

Signed-off-by: Tim Harvey 
Acked-by: Peng Fan 
---
v2:
 - rebase on imx/master
 - add Peng's ack tag
---
 .../dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi   |  46 ++
 .../dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi   |  81 ++
 .../dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi   |  81 ++
 arch/arm/dts/imx8mm-venice-gw7901-u-boot.dtsi | 118 ++
 arch/arm/dts/imx8mm-venice-gw7902-u-boot.dtsi | 150 ++
 arch/arm/dts/imx8mm-venice-gw7903-u-boot.dtsi |  83 ++
 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi | 108 +
 configs/imx8mm_venice_defconfig   |   1 +
 configs/imx8mn_venice_defconfig   |   1 +
 9 files changed, 669 insertions(+)

diff --git a/arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi 
b/arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi
index f5d52c2fe259..b3592331c72b 100644
--- a/arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi
@@ -3,3 +3,49 @@
  * Copyright 2021 Gateworks Corporation
  */
 #include "imx8mm-venice-gw700x-u-boot.dtsi"
+
+&gpio1 {
+   pci_usb_sel {
+   gpio-hog;
+   output-low;
+   gpios = <6 GPIO_ACTIVE_HIGH>;
+   line-name = "pci_usb_sel";
+   };
+
+   dio_0 {
+   gpio-hog;
+   input;
+   gpios = <7 GPIO_ACTIVE_HIGH>;
+   line-name = "dio0";
+   };
+
+   dio_1 {
+   gpio-hog;
+   input;
+   gpios = <9 GPIO_ACTIVE_HIGH>;
+   line-name = "dio1";
+   };
+};
+
+&gpio4 {
+   dio_2 {
+   gpio-hog;
+   input;
+   gpios = <3 GPIO_ACTIVE_HIGH>;
+   line-name = "dio2";
+   };
+
+   dio_3 {
+   gpio-hog;
+   input;
+   gpios = <4 GPIO_ACTIVE_HIGH>;
+   line-name = "dio3";
+   };
+
+   pci_wdis {
+   gpio-hog;
+   output-high;
+   gpios = <7 GPIO_ACTIVE_HIGH>;
+   line-name = "pci_wdis#";
+   };
+};
diff --git a/arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi 
b/arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi
index f5d52c2fe259..92e44d4ba96b 100644
--- a/arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi
@@ -3,3 +3,84 @@
  * Copyright 2021 Gateworks Corporation
  */
 #include "imx8mm-venice-gw700x-u-boot.dtsi"
+
+&gpio1 {
+   rs485_term {
+   gpio-hog;
+   output-low;
+   gpios = <0 GPIO_ACTIVE_HIGH>;
+   line-name = "rs485_term";
+   };
+
+   mipi_gpio4 {
+   gpio-hog;
+   input;
+   gpios = <1 GPIO_ACTIVE_HIGH>;
+   line-name = "mipi_gpio4";
+   };
+
+   pci_usb_sel {
+   gpio-hog;
+   output-low;
+   gpios = <6 GPIO_ACTIVE_HIGH>;
+   line-name = "pci_usb_sel";
+   };
+
+   dio_0 {
+   gpio-hog;
+   input;
+   gpios = <7 GPIO_ACTIVE_HIGH>;
+   line-name = "dio0";
+   };
+
+   dio_1 {
+   gpio-hog;
+   input;
+   gpios = <9 GPIO_ACTIVE_HIGH>;
+   line-name = "dio1";
+   };
+};
+
+&gpio4 {
+   rs485_en {
+   gpio-hog;
+   output-low;
+   gpios = <0 GPIO_ACTIVE_HIGH>;
+   line-name = "rs485_en";
+   };
+
+   mipi_gpio3 {
+   gpio-hog;
+   input;
+   gpios = <1 GPIO_ACTIVE_HIGH>;
+   line-name = "mipi_gpio3";
+   };
+
+   rs485_half {
+   gpio-hog;
+   output-low;
+   gpios = <2 GPIO_ACTIVE_HIGH>;
+   line-name = "rs485_hd";
+   };
+
+   mipi_gpio2 {
+   gpio-hog;
+   input;
+   gpios = <3 GPIO_ACTIVE_HIGH>;
+   line-name = "mipi_gpio2";
+   };
+
+   mipi_gpio1 {
+   gpio-hog;
+   input;
+   gpios = <4 GPIO_ACTIVE_HIGH>;
+   line-name = "mipi_gpio1";
+   };
+
+   pci_wdis {
+   gpio-hog;
+   output-high;
+   gpios = <7 GPIO_ACTIVE_HIGH>;
+   line-name = "pci_wdis#";
+   };
+};
diff --git a/arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi 
b/arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi
index f5d52c2fe259..92e44d4ba96b 100644
--- a/arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi
+++ b/ar

[PATCH v2] imx8m{m,n}_venice_defconfig: add DT overlay support

2022-04-13 Thread Tim Harvey
enable CONFIG_OF_LIBFDT_OVERLAY to support applying dt overlays in
U-Boot.

Signed-off-by: Tim Harvey 
---
v2: rebase on imx/master
---
 configs/imx8mm_venice_defconfig | 1 +
 configs/imx8mn_venice_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index b596f7eb669f..a9ff5654baa3 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -138,3 +138,4 @@ CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
 CONFIG_HEXDUMP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
index 2f5ea62f5427..7628667d50ae 100644
--- a/configs/imx8mn_venice_defconfig
+++ b/configs/imx8mn_venice_defconfig
@@ -137,3 +137,4 @@ CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
 CONFIG_HEXDUMP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



Re: [PATCH v2] board: gateworks: venice: enable DM_SERIAL

2022-04-13 Thread Tim Harvey
On Wed, Apr 13, 2022 at 8:56 AM Michael Nazzareno Trimarchi
 wrote:
>
> Hi Tim
>
> On Wed, Apr 13, 2022 at 5:47 PM Tim Harvey  wrote:
> >
> > Enable DM_SERIAL.
> >
> > Signed-off-by: Tim Harvey 
> > ---
> > v2: rebase on imx/master
> > ---
> >  configs/imx8mm_venice_defconfig | 2 ++
> >  configs/imx8mn_venice_defconfig | 2 ++
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/configs/imx8mm_venice_defconfig 
> > b/configs/imx8mm_venice_defconfig
> > index dd61ec9b70fb..09f7d8a58ca7 100644
> > --- a/configs/imx8mm_venice_defconfig
> > +++ b/configs/imx8mm_venice_defconfig
> > @@ -110,6 +110,8 @@ CONFIG_SPL_DM_PMIC_MP5416=y
> >  CONFIG_DM_REGULATOR=y
> >  CONFIG_DM_REGULATOR_FIXED=y
> >  CONFIG_DM_REGULATOR_GPIO=y
> > +CONFIG_DM_SERIAL=y
> > +# CONFIG_SPL_DM_SERIAL is not set
> >  CONFIG_MXC_UART=y
> >  CONFIG_SYSRESET=y
> >  CONFIG_SPL_SYSRESET=y
> > diff --git a/configs/imx8mn_venice_defconfig 
> > b/configs/imx8mn_venice_defconfig
> > index c3a96a378553..41898da4aecf 100644
> > --- a/configs/imx8mn_venice_defconfig
> > +++ b/configs/imx8mn_venice_defconfig
> > @@ -108,6 +108,8 @@ CONFIG_SPL_DM_PMIC_MP5416=y
> >  CONFIG_DM_REGULATOR=y
> >  CONFIG_DM_REGULATOR_FIXED=y
> >  CONFIG_DM_REGULATOR_GPIO=y
> > +CONFIG_DM_SERIAL=y
> > +# CONFIG_SPL_DM_SERIAL is not set
> >  CONFIG_MXC_UART=y
> >  CONFIG_SYSRESET=y
> >  CONFIG_SPL_SYSRESET=y
> > --
> > 2.17.1
> >
>
> Should not select in your board kconfig?
>

Michael,

I don't think it really matters. The other conversions to DM_SERIAL
are going in defconfigs as well.

Best Regards,

Tim


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

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

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

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



[PATCH] imx8m{m, n}_venice_defconfig: enable md5sum and crc32 commands

2022-04-13 Thread Tim Harvey
Enable the md5sum and crc32 commands.

Signed-off-by: Tim Harvey 
---
 configs/imx8mm_venice_defconfig | 4 +++-
 configs/imx8mn_venice_defconfig | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index a9ff5654baa3..c5cd0147f0f1 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -40,7 +40,9 @@ CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_PROMPT="u-boot=> "
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
-# CONFIG_CMD_CRC32 is not set
+CONFIG_CRC32_VERIFY=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_MD5SUM_VERIFY=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_CLK=y
 CONFIG_CMD_FUSE=y
diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
index 7628667d50ae..e998b90e2282 100644
--- a/configs/imx8mn_venice_defconfig
+++ b/configs/imx8mn_venice_defconfig
@@ -41,7 +41,9 @@ CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_PROMPT="u-boot=> "
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
-# CONFIG_CMD_CRC32 is not set
+CONFIG_CRC32_VERIFY=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_MD5SUM_VERIFY=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_CLK=y
 CONFIG_CMD_FUSE=y
-- 
2.17.1



Re: [PATCH v2 08/18] pci: Fix use of flags in dm_pci_map_bar()

2022-04-13 Thread Andrew Scull
> > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > index 33dda2..8bbeb62f2e 100644
> > --- a/drivers/pci/pci-uclass.c
> > +++ b/drivers/pci/pci-uclass.c
> > @@ -1533,8 +1533,8 @@ static phys_addr_t dm_pci_map_ea_virt(struct udevice 
> > *dev, int ea_off,
> > return addr;
> >  }
> >
> > -static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
> > -  int ea_off, struct pci_child_plat *pdata)
> > +static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int ea_off,
> > +  struct pci_child_plat *pdata)
> >  {
> > int ea_cnt, i, entry_size;
> > int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2;
> > @@ -1577,13 +1577,13 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, 
> > int bar, int flags,
> > addr += dm_pci_map_ea_virt(dev, ea_off, pdata);
> >
> > /* size ignored for now */
> > -   return map_physmem(addr, 0, flags);
> > +   return map_physmem(addr, 0, MAP_NOCACHE);
> > }
> >
> > return 0;
> >  }
> >
> > -void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
> > +void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags)
>
> Why is this change (int => unsigned long) necessary?

The flags are used with pci_region::flags which is an unsigned long
and it seemed sensible to use the same type, size and sign, to avoid
anything unexpected.


Re: Pull request: u-boot-imx u-boot-imx-20220412

2022-04-13 Thread Tom Rini
On Wed, Apr 13, 2022 at 11:41:45AM +0200, Stefano Babic wrote:

> Hi Tom,
> 
> please pull from u-boot-imx, thanks !
> 
> Note: I picked up Heinrich's patch for Renesas :
>   ARM: renesas: reduce rcar3_salvator-x image size
> 
> due to CI failure. Breakage is in master, too.

I don't see breakage in master for this platform, in CI, fwiw.  Other
toolchains may have problems as it is indeed close to the limit.

> 
> The following changes since commit 33ae8c5bebba0874fbc432914406e63fbc219080:
> 
>   Merge tag 'efi-2022-07-rc1' of
> https://source.denx.de/u-boot/custodians/u-boot-efi (2022-04-10 11:21:39
> -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
> tags/u-boot-imx-20220413
> 
> for you to fetch changes up to a1c711046b0d5478a702b27c6773ea6231eba057:
> 
>   board: gateworks: venice: add imx8mm-gw7903 support (2022-04-13 09:55:26
> +0200)
> 

So, I've applied this to master and pushed, and thanks for clearing out
much of the backlog.  Is there still things left that aren't recently
newly posted?  But also, the size problem on rcar3_salvator-x is because
every platform with DM_REGULATOR_FIXED grew because:
commit f3b5100aff3a7edd53fd5d15bd6db92d294865e2
Author: Philippe Schenker 
Date:   Fri Apr 8 10:07:10 2022 +0200

regulator: fixed: add possibility to enable by clock

adds 300-400 bytes on 64bit platforms.  I'm mainly just noting this as I
don't see a nice way to handle this that doesn't then make the CONFIG
side of things troublesome / annoying.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v2] board: gateworks: gw_ventana: use comomn GSC driver

2022-04-13 Thread Tim Harvey
Use the common GSC driver.

This allows us to do some additional cleanup:
 - use the GSC driver functions
 - move waiting for the EEPROM to the SPL int (it will always be ready
   after this)
 - move eeprom functions into eeprom file and elimate GSC_I2C_BUS
 - eliminate some redundant EEPROM reads (the EEPROM must be read in
   SPL before relocation, in SPL after relocation, and in U-Boot init.
   All subsequent uses can use the global structure)
 - remove unnecessary header files and alphabatize includes

Signed-off-by: Tim Harvey 
---
v2: rebase on imx/master
---
 arch/arm/mach-imx/mx6/Kconfig |   2 +
 board/gateworks/gw_ventana/Kconfig|   8 -
 board/gateworks/gw_ventana/Makefile   |   2 +-
 board/gateworks/gw_ventana/common.c   |  16 +-
 board/gateworks/gw_ventana/common.h   |   4 +-
 board/gateworks/gw_ventana/eeprom.c   | 233 +++---
 .../gw_ventana/{ventana_eeprom.h => eeprom.h} |  16 +-
 board/gateworks/gw_ventana/gsc.h  |  72 --
 board/gateworks/gw_ventana/gw_ventana.c   |  44 +---
 board/gateworks/gw_ventana/gw_ventana_spl.c   |  43 ++--
 configs/gwventana_emmc_defconfig  |   2 +-
 configs/gwventana_gw5904_defconfig|   2 +-
 configs/gwventana_nand_defconfig  |   2 +-
 include/configs/gw_ventana.h  |   3 -
 scripts/config_whitelist.txt  |   1 -
 15 files changed, 266 insertions(+), 184 deletions(-)
 rename board/gateworks/gw_ventana/{ventana_eeprom.h => eeprom.h} (82%)
 delete mode 100644 board/gateworks/gw_ventana/gsc.h

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 3d675fcd73ec..947b73fab29b 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -227,6 +227,8 @@ config TARGET_GW_VENTANA
bool "gw_ventana"
depends on MX6QDL
select SUPPORT_SPL
+   select GATEWORKS_SC
+   select MISC
imply CMD_SATA
imply CMD_SPL
 
diff --git a/board/gateworks/gw_ventana/Kconfig 
b/board/gateworks/gw_ventana/Kconfig
index fee910ca837d..c82e8aeb9d7a 100644
--- a/board/gateworks/gw_ventana/Kconfig
+++ b/board/gateworks/gw_ventana/Kconfig
@@ -17,12 +17,4 @@ config CMD_EECONFIG
help
  Provides access to EEPROM configuration on Gateworks Ventana
 
-config CMD_GSC
-   bool "Enable the 'gsc' command"
-   help
- Provides access to the GSC configuration:
-
-gsc sleep - sleeps for a period of seconds
-gsc wd - enables / disables the watchdog
-
 endif
diff --git a/board/gateworks/gw_ventana/Makefile 
b/board/gateworks/gw_ventana/Makefile
index 360d1d4c123f..c407f8e6c54c 100644
--- a/board/gateworks/gw_ventana/Makefile
+++ b/board/gateworks/gw_ventana/Makefile
@@ -6,5 +6,5 @@
 # SPDX-License-Identifier:  GPL-2.0+
 #
 
-obj-y  := gw_ventana.o gsc.o eeprom.o common.o
+obj-y  := gw_ventana.o eeprom.o common.o
 obj-$(CONFIG_SPL_BUILD) += gw_ventana_spl.o
diff --git a/board/gateworks/gw_ventana/common.c 
b/board/gateworks/gw_ventana/common.c
index 414406461e26..74328b2e1b31 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -6,15 +6,15 @@
  */
 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 
 #include "common.h"
@@ -1045,7 +1045,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
 #define SETUP_GPIO_INPUT(gpio, name) \
gpio_request(gpio, name); \
gpio_direction_input(gpio);
-void setup_iomux_gpio(int board, struct ventana_board_info *info)
+void setup_iomux_gpio(int board)
 {
if (board >= GW_UNKNOWN)
return;
@@ -1214,8 +1214,6 @@ static struct fsl_esdhc_cfg usdhc_cfg[2];
 
 int board_mmc_init(struct bd_info *bis)
 {
-   struct ventana_board_info ventana_info;
-   int board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
int ret;
 
switch (board_type) {
@@ -1279,13 +1277,11 @@ int board_mmc_init(struct bd_info *bis)
 
 int board_mmc_getcd(struct mmc *mmc)
 {
-   struct ventana_board_info ventana_info;
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-   int board = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
-   int gpio = gpio_cfg[board].mmc_cd;
+   int gpio = gpio_cfg[board_type].mmc_cd;
 
/* Card Detect */
-   switch (board) {
+   switch (board_type) {
case GW560x:
/* emmc is always present */
if (cfg->esdhc_base == USDHC2_BASE_ADDR)
diff --git a/board/gateworks/gw_ventana/common.h 
b/board/gateworks/gw_ventana/common.h
index 7a60db73853a..480c6675d7b0 100644
--- a/board/gateworks/gw_ventana/common.h
+++ b/board/gateworks/gw_ventana/common.h
@@ -8,7 +8,7 @@
 #ifndef _GWVENTANA_COMMON_H_
 #define _GWVENTANA_COMMON_H_
 
-#include "ventana_eeprom.h"
+#include "eeprom.h"
 
 /* GPIO's common to all baseboards */
 #defi

Re: Pull request: u-boot-imx u-boot-imx-20220412

2022-04-13 Thread Tim Harvey
On Wed, Apr 13, 2022 at 9:24 AM Tom Rini  wrote:
>
> On Wed, Apr 13, 2022 at 11:41:45AM +0200, Stefano Babic wrote:
>
> > Hi Tom,
> >
> > please pull from u-boot-imx, thanks !
> >
> > Note: I picked up Heinrich's patch for Renesas :
> >   ARM: renesas: reduce rcar3_salvator-x image size
> >
> > due to CI failure. Breakage is in master, too.
>
> I don't see breakage in master for this platform, in CI, fwiw.  Other
> toolchains may have problems as it is indeed close to the limit.
>
> >
> > The following changes since commit 33ae8c5bebba0874fbc432914406e63fbc219080:
> >
> >   Merge tag 'efi-2022-07-rc1' of
> > https://source.denx.de/u-boot/custodians/u-boot-efi (2022-04-10 11:21:39
> > -0400)
> >
> > are available in the Git repository at:
> >
> >   https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
> > tags/u-boot-imx-20220413
> >
> > for you to fetch changes up to a1c711046b0d5478a702b27c6773ea6231eba057:
> >
> >   board: gateworks: venice: add imx8mm-gw7903 support (2022-04-13 09:55:26
> > +0200)
> >
>
> So, I've applied this to master and pushed, and thanks for clearing out
> much of the backlog.  Is there still things left that aren't recently

Tom,

Yes, there are still patches posted some time ago that were not picked
up yet due to merge conflicts. I'm not sure how many but I know I had
about 9 that I just rebased and re-submitted for Stefano.

Best Regards,

Tim

> newly posted?  But also, the size problem on rcar3_salvator-x is because
> every platform with DM_REGULATOR_FIXED grew because:
> commit f3b5100aff3a7edd53fd5d15bd6db92d294865e2
> Author: Philippe Schenker 
> Date:   Fri Apr 8 10:07:10 2022 +0200
>
> regulator: fixed: add possibility to enable by clock
>
> adds 300-400 bytes on 64bit platforms.  I'm mainly just noting this as I
> don't see a nice way to handle this that doesn't then make the CONFIG
> side of things troublesome / annoying.
>
> --
> Tom


Re: [PATCH v2 12/18] test: pci: Test PCI address conversion functions

2022-04-13 Thread Andrew Scull
On Wed, 13 Apr 2022 at 15:03, Bin Meng  wrote:
>
> On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull  wrote:
> >
> > Add tests for the functions dm_pci_bus_to_phys() and
> > dm_pci_phys_to_bus() which convert between PCI bus addresses and
> > physical addresses based on the ranges declared for the PCI controller.
> >
> > The ranges of bus#1 are used for the tests, adding a translation to one
> > of the ranges to cover more cases.
> >
> > Signed-off-by: Andrew Scull 
> > ---
> >  arch/sandbox/dts/test.dts |   2 +-
> >  test/dm/pci.c | 102 ++
> >  2 files changed, 103 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > index 48ca3e1e47..76c75e08e7 100644
> > --- a/arch/sandbox/dts/test.dts
> > +++ b/arch/sandbox/dts/test.dts
> > @@ -979,7 +979,7 @@
> > #address-cells = <3>;
> > #size-cells = <2>;
> > ranges = <0x0200 0 0x3000 0x3000 0 0x2000 // 
> > MEM0
> > - 0x0200 0 0x3100 0x3100 0 0x2000 // 
> > MEM1
> > + 0x0200 0 0x3100 0x3e00 0 0x2000 // 
> > MEM1
> >   0x0100 0 0x4000 0x4000 0 0x2000>;
> > sandbox,dev-info = <0x08 0x00 0x1234 0x5678
> > 0x0c 0x00 0x1234 0x5678
> > diff --git a/test/dm/pci.c b/test/dm/pci.c
> > index 00e4440a9d..9789103c7d 100644
> > --- a/test/dm/pci.c
> > +++ b/test/dm/pci.c
> > @@ -376,3 +376,105 @@ static int dm_test_pci_region_multi(struct 
> > unit_test_state *uts)
> > return 0;
> >  }
> >  DM_TEST(dm_test_pci_region_multi, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> > +
> > +/*
> > + * Test the translation of PCI bus addresses to physical addresses using 
> > the
> > + * ranges from bus#1.
> > + */
> > +static int dm_test_pci_bus_to_phys(struct unit_test_state *uts)
> > +{
> > +   struct udevice *dev;
> > +   phys_addr_t phys_addr;
> > +
> > +   ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &dev));
> > +
> > +   /* Before any of the ranges. */
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x2000, 0x400, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0, phys_addr);
> > +
> > +   /* Identity range: whole, start, mid, end */
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x2fff, 0x2000, 
> > PCI_REGION_MEM);
>
> I guess you wanted to test 0x2000 with 0x2000 range, for checking
> the overlap of the start address?

I did indeed, great spot!

> > +   ut_asserteq(0, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3000, 0x2000, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3000, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3000, 0x1000, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3000, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3abc, 0x12, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3abc, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3800, 0x1800, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3800, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x30008000, 0x1801, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0, phys_addr);
> > +
> > +   /* Translated range: whole, start, mid, end */
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x30ff, 0x2000, 
> > PCI_REGION_MEM);
>
> 0x30fff000?

Yep, and I've done the same thing in dm_test_pci_bus_to_phys.

> > +   ut_asserteq(0, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3100, 0x2000, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3e00, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3100, 0x1000, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3e00, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x31000abc, 0x12, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3e000abc, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x31000800, 0x1800, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0x3e000800, phys_addr);
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x31008000, 0x1801, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0, phys_addr);
> > +
> > +   /* Beyond all of the ranges. */
> > +   phys_addr = dm_pci_bus_to_phys(dev, 0x3200, 0x400, 
> > PCI_REGION_MEM);
> > +   ut_asserteq(0, phys_addr);
> > +
> > +   return 0;
> > +}
> > +DM_TEST(dm_test_pci_bus_to_phys, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> > +
> > +/*
> > + * Test the translation of physical addresses to PCI bus addresses using 
> > the
> > + * ranges from bus#1.
> > + */
> > +static int dm_test_pci_phys_to_bus(struct unit_test_state *uts)
> > +{
> > +   struct udevice *dev;
> > +   phys_addr_t phys_addr;
>
> This should be pci_addr_t bus_addr

Will fix in the next version.

> > +
> > +   ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &dev));
> > +
> > +   /* Before any

Re: [PATCH 0/6] introduce Arm FF-A support

2022-04-13 Thread Tom Rini
On Wed, Apr 13, 2022 at 03:20:23PM +0100, Abdellatif El Khlifi wrote:
> On Tue, Apr 12, 2022 at 08:28:42AM -0500, Rob Herring wrote:
> > On Tue, Apr 12, 2022 at 7:01 AM Tom Rini  wrote:
> > >
> > > On Tue, Apr 12, 2022 at 12:43:15PM +0100, Abdellatif El Khlifi wrote:
> > > > On Thu, Apr 07, 2022 at 08:58:11AM -0400, Tom Rini wrote:
> > > > > On Thu, Apr 07, 2022 at 01:54:24PM +0100, Abdellatif El Khlifi wrote:
> > > > > > On Wed, Apr 06, 2022 at 03:47:11PM -0400, Tom Rini wrote:
> > > > > > > On Tue, Mar 29, 2022 at 04:16:53PM +0100, 
> > > > > > > abdellatif.elkhl...@arm.com wrote:
> > > > > > > > From: Abdellatif El Khlifi 
> > > > > > > >
> > > > > > > > This patchset adds support for Arm FF-A (Arm Firmware Framework 
> > > > > > > > for Armv8-A v1.0).
> > > > > > > >
> > > > > > > > FF-A support is generic by design and can be used by any Arm 
> > > > > > > > platform.
> > > > > > > >
> > > > > > > > The features added are as follows:
> > > > > > > >
> > > > > > > > 1/ FF-A device driver
> > > > > > > > 2/ armffa command
> > > > > > > > 3/ FF-A Sandbox driver
> > > > > > > > 4/ FF-A Sandbox test cases
> > > > > > > > 5/ FF-A MM communication
> > > > > > > >
> > > > > > > >
> > > > > > > > The suggested design sees FF-A as a data bus allowing data 
> > > > > > > > exchange with the firmware
> > > > > > > > running under TrustZone HW (such as Optee). The same approach 
> > > > > > > > was followed in the
> > > > > > > > FF-A driver in Linux kernel 
> > > > > > > > (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/arm_ffa/bus.c?h=v5.15#n211))
> > > > > > > >
> > > > > > > > u-boot boards using FF-A can provide a device tree node in a 
> > > > > > > > -u-boot.dtsi file.
> > > > > > > > Since the node can not be hosted in Linux device tree, we 
> > > > > > > > suggest using u-boot device tree.
> > > > > > >
> > > > > > > Why can't the node be in the upstream tree?  It should be, so 
> > > > > > > that it
> > > > > > > can be shared between all users.  Especially since there's 
> > > > > > > in-Linux
> > > > > > > users?
> > > > > > >
> > > > > > > --
> > > > > > > Tom
> > > > > >
> > > > > > Linux already has an FF-A bus driver and doesn't use a device tree 
> > > > > > node for FF-A.
> > > > > >
> > > > > > The Linux driver registers FF-A as a bus:
> > > > > >
> > > > > > int arm_ffa_bus_init(void)
> > > > > > {
> > > > > >   return bus_register(&ffa_bus_type);
> > > > > > }
> > > > > >
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/arm_ffa/bus.c?h=v5.15#n211
> > > > > >
> > > > > > So, there is no user for the node in Linux. That's why we suggest 
> > > > > > hosting the node in the u-boot device tree (a u-boot.dtsi file)
> > > > >
> > > > > OK, but you can still push it upstream as it's not required to have an
> > > > > in tree user.
> > > >
> > > > During the review of Corstone-1000 patchset, Rui Silva had a discussion 
> > > > with the Linux device tree maintainer
> > > > (Rob Herring). Rob is not in favour of an FFA node in the kernel device 
> > > > tree. This is why we are including the FFA node
> > > > in u-boot device tree (u-boot.dtsi files).
> > 
> > Sigh. There is not a 'kernel device tree' and a 'u-boot device tree'.
> > There is only 1. For SystemReadyIR compliance, that is a hard
> > requirement.
> > 
> > > I'm a bit confused now, can you please link to the kernel thread?  Or
> > > Rob, can you chime in here please?
> > 
> > The FFA DT binding was rejected in favor of making FFA discoverable.
> > The FFA spec was amended to address that. DT is only for what we
> > failed to make discoverable. For hardware, we're stuck with it. We
> > shouldn't repeat that for software interfaces.
> > 
> > Rob
> 
> Guys,
> 
> Since we can not add an FFA node in the device tree, we will make FFA a 
> discoverable bus.
> So, we will manually create the udevice, binding it to the driver and probing 
> it.
> Manually means directly calling device_bind and device_probe APIs.
> 
> Any thoughts about this approach ?

How is it both discoverable and doesn't have a device tree node, in the
kernel?

-- 
Tom


signature.asc
Description: PGP signature


  1   2   >