Re: [PATCH v2 2/2] net: eth-uclass: Fix data abort when tftp get nonexistent file via usb

2022-04-13 Thread Ramon Fried
On Sat, Apr 2, 2022 at 5:58 AM  wrote:
>
> From: qianfan Zhao 
>
> tftp_handler do eth_halt when TFTP_ERROR, but eth_halt will remove eth
> device if it is an usb network. usbeth's private data will be unaccessable
> when usb_eth_free_pkt, touch it will trigger data abort.
>
> Next is the console messages:
>
> => tftp xxx
> ...
> Loading: *
> TFTP error: 'open failed: No such file or directory' (1)
> Not retrying...
> data abort
> pc : [<9feb6ba2>]  lr : [<9feb6b9f>]
>
> Fix it.
>
> Signed-off-by: qianfan Zhao 
> ---
>  net/eth-uclass.c | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index 2b88b6c145..c9bba4f8de 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -407,6 +407,13 @@ int eth_rx(void)
> flags = 0;
> if (ret > 0)
> net_process_received_packet(packet, ret);
> +
> +   /* ethernet maybe halted when packet_handler, check again */
> +   if (!eth_is_active(current)) {
> +   ret = 0;
> +   break;
> +   }
> +
> if (ret >= 0 && eth_get_ops(current)->free_pkt)
> eth_get_ops(current)->free_pkt(current, packet, ret);
> if (ret <= 0)
> --
> 2.17.1
>
I wonder how I never experienced this behavior. I have used USB based
ethernet dongles.
And I used tftp and got errors but never an abort .Is it possible that
the problem is with the specific ethernet driver you are using ?
Can you specify which one you used ?


[PATCH] stm32mp: psci: Retain PLL3CR, PLL4CR, RCC_MSSCKSELR across suspend

2022-04-13 Thread Marek Vasut
The SoC seems to lose the values of PLL3CR, PLL4CR, RCC_MSSCKSELR
during suspend/resume cycle, cache them and reinstate their values
on resume.

Signed-off-by: Marek Vasut 
Cc: Patrick Delaunay 
Cc: Patrice Chotard 
---
 arch/arm/mach-stm32mp/psci.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-stm32mp/psci.c b/arch/arm/mach-stm32mp/psci.c
index 86c160987a9..b2988b3d993 100644
--- a/arch/arm/mach-stm32mp/psci.c
+++ b/arch/arm/mach-stm32mp/psci.c
@@ -26,6 +26,7 @@
 #define PWR_MPUCR_CSSF BIT(9)
 
 /* RCC */
+#define RCC_MSSCKSELR  0x48
 #define RCC_DDRITFCR   0xd8
 
 #define RCC_DDRITFCR_DDRC1EN   BIT(0)
@@ -49,6 +50,9 @@
 #define RCC_MP_CIFR0x418
 #define RCC_MP_CIFR_WKUPF  BIT(20)
 
+#define RCC_PLL3CR 0x880
+#define RCC_PLL4CR 0x894
+
 /* SYSCFG */
 #define SYSCFG_CMPCR   0x20
 #define SYSCFG_CMPCR_SW_CTRL   BIT(2)
@@ -690,6 +694,7 @@ static void __secure ddr_sw_self_refresh_exit(void)
 void __secure psci_system_suspend(u32 __always_unused function_id,
  u32 ep, u32 context_id)
 {
+   u32 saved_pll3cr, saved_pll4cr, saved_mssckselr;
u32 saved_pwrctl, reg;
 
/* Disable IO compensation */
@@ -708,6 +713,10 @@ void __secure psci_system_suspend(u32 __always_unused 
function_id,
setbits_le32(STM32_PWR_BASE + PWR_MPUCR,
 PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS | PWR_MPUCR_PDDS);
 
+   saved_pll3cr = readl(STM32_RCC_BASE + RCC_PLL3CR);
+   saved_pll4cr = readl(STM32_RCC_BASE + RCC_PLL4CR);
+   saved_mssckselr = readl(STM32_RCC_BASE + RCC_MSSCKSELR);
+
psci_v7_flush_dcache_all();
ddr_sr_mode_ssr(_pwrctl);
ddr_sw_self_refresh_in();
@@ -724,6 +733,10 @@ void __secure psci_system_suspend(u32 __always_unused 
function_id,
ddr_sw_self_refresh_exit();
ddr_sr_mode_restore(saved_pwrctl);
 
+   writel(saved_pll3cr, STM32_RCC_BASE + RCC_PLL3CR);
+   writel(saved_pll4cr, STM32_RCC_BASE + RCC_PLL4CR);
+   writel(saved_mssckselr, STM32_RCC_BASE + RCC_MSSCKSELR);
+
writel(SYSCFG_CMPENR_MPUEN, STM32_SYSCFG_BASE + SYSCFG_CMPENSETR);
clrbits_le32(STM32_SYSCFG_BASE + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
 }
-- 
2.35.1



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

2022-04-13 Thread Bin Meng
On Thu, Apr 14, 2022 at 12:30 AM Andrew Scull  wrote:
>
> > > 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?
>
> I wanted to have the option to disable the logic for handling EA at
> runtime. A glance at the code suggested there's a whole other rabbit
> hole of missing safety checks that I've opted to leave for another
> day.

We cannot have a single global option to work for one device using EA
but another device using BAR.

Regards,
Bin


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

2022-04-13 Thread Marek Vasut

On 4/13/22 22:21, Stefano Babic wrote:

Hi Tom,


Hi,

[...]


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?


There are still 3 big series that should flow in:

- Marek's series about Power Domain


These are the two series that are left from my side, already rebased:

https://patchwork.ozlabs.org/project/uboot/list/?series=294845

https://patchwork.ozlabs.org/project/uboot/list/?series=294849


Re: Please pull u-boot-net/next

2022-04-13 Thread Tom Rini
On Wed, Apr 13, 2022 at 06:10:40PM +0300, Ramon Fried wrote:

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

To follow-up to myself from
https://patchwork.ozlabs.org/project/uboot/patch/20220406223308.9833-4-ka...@kernel.org/
this doesn't pass CI currently, after I fixed the merge conflicts.  It's
possible I did that wrong, or something else is now being exposed in
sandbox.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] pci: imx: remove weak overrides no longer used

2022-04-13 Thread Tim Harvey
There are no users of the imx6_pcie_toggle_power and imx6_pcie_toggle_reset
weak overrides and as these functions are able to be handled now via dt
properties lets remove these.

Cc: Marek Vasut 
Signed-off-by: Tim Harvey 
---
 arch/arm/include/asm/arch-mx6/sys_proto.h |  3 ---
 drivers/pci/pcie_imx.c| 10 ++
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index c7542e4b04e1..7845fa8e5693 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -18,9 +18,6 @@
 #define is_usbotg_phy_active(void) (!(readl(USB_PHY0_BASE_ADDR + USBPHY_PWD) & 
\
   USBPHY_PWD_RXPWDRX))
 
-int imx6_pcie_toggle_power(struct udevice *vpcie);
-int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high);
-
 enum ldo_reg {
LDO_ARM,
LDO_SOC,
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index f8daedbce359..46ac01713ff7 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -532,7 +532,7 @@ static int imx6_pcie_init_phy(void)
return 0;
 }
 
-__weak int imx6_pcie_toggle_power(struct udevice *vpcie)
+int imx6_pcie_toggle_power(struct udevice *vpcie)
 {
 #ifdef CONFIG_PCIE_IMX_POWER_GPIO
gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power");
@@ -554,7 +554,7 @@ __weak int imx6_pcie_toggle_power(struct udevice *vpcie)
return 0;
 }
 
-__weak int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high)
+int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high)
 {
/*
 * See 'PCI EXPRESS BASE SPECIFICATION, REV 3.0, SECTION 6.6.1'
@@ -570,12 +570,6 @@ __weak int imx6_pcie_toggle_reset(struct gpio_desc *gpio, 
bool active_high)
 * configuration file and the condition below will handle the rest
 * of the reset toggling.
 *
-* In case your #PERST toggling logic is more complex, for example
-* connected via CPLD or somesuch, you can override this function
-* in your board file and implement reset logic as needed. You must
-* not forget to wait at least 20 ms after de-asserting #PERST in
-* this case either though.
-*
 * In case your #PERST line of the PCIe EP device is not connected
 * at all, your design is broken and you should fix your design,
 * otherwise you will observe problems like for example the link
-- 
2.17.1



[PATCH] pci: imx: use vpcie-supply if defined by device-tree

2022-04-13 Thread Tim Harvey
If vpcie-supply is defined by device-tree use that if
CONFIG_PCIE_IMX_POWER_GPIO is not defined.

Note that after this the following boards which define
CONFIG_PCIE_IMX_POWER_GPIO in their board header file as well as their
device-tree should be able to remove CONFIG_PCIE_IMX_PERST_GPIO without
consequence:
 - mx6sabresd
 - mx6sxsabresd
 - novena

Note that the ge_bx50v3 board uses CONFIG_PCIE_IMX_POWER_GPIO and does
not have vpcie-supply defined in it's pcie node in the dt thus removing
CONFIG_PCIE_IMX_POWER_GPIO globally can't be done until that board adds
vpcie-supply.

Cc: Ian Ray  (maintainer:GE BX50V3 BOARD)
Cc: Sebastian Reichel  (maintainer:GE BX50V3 
BOARD)
Cc: Fabio Estevam  (maintainer:MX6SABRESD BOARD)
Cc: Marek Vasut  (maintainer:NOVENA BOARD)
Signed-off-by: Tim Harvey 
---
 arch/arm/include/asm/arch-mx6/sys_proto.h |  2 +-
 drivers/pci/pcie_imx.c| 19 +--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index c49759af92d1..c7542e4b04e1 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -18,7 +18,7 @@
 #define is_usbotg_phy_active(void) (!(readl(USB_PHY0_BASE_ADDR + USBPHY_PWD) & 
\
   USBPHY_PWD_RXPWDRX))
 
-int imx6_pcie_toggle_power(void);
+int imx6_pcie_toggle_power(struct udevice *vpcie);
 int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high);
 
 enum ldo_reg {
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 2cec3900e9ad..f8daedbce359 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,6 +103,7 @@ struct imx_pcie_priv {
void __iomem*cfg_base;
struct gpio_descreset_gpio;
boolreset_active_high;
+   struct udevice  *vpcie;
 };
 
 /*
@@ -530,7 +532,7 @@ static int imx6_pcie_init_phy(void)
return 0;
 }
 
-__weak int imx6_pcie_toggle_power(void)
+__weak int imx6_pcie_toggle_power(struct udevice *vpcie)
 {
 #ifdef CONFIG_PCIE_IMX_POWER_GPIO
gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power");
@@ -540,6 +542,15 @@ __weak int imx6_pcie_toggle_power(void)
mdelay(20);
gpio_free(CONFIG_PCIE_IMX_POWER_GPIO);
 #endif
+
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
+   if (vpcie) {
+   regulator_set_enable(vpcie, false);
+   mdelay(20);
+   regulator_set_enable(vpcie, true);
+   mdelay(20);
+   }
+#endif
return 0;
 }
 
@@ -598,7 +609,7 @@ static int imx6_pcie_deassert_core_reset(struct 
imx_pcie_priv *priv)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
 
-   imx6_pcie_toggle_power();
+   imx6_pcie_toggle_power(priv->vpcie);
 
enable_pcie_clock();
 
@@ -717,6 +728,10 @@ static int imx_pcie_dm_probe(struct udevice *dev)
 {
struct imx_pcie_priv *priv = dev_get_priv(dev);
 
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
+   device_get_supply_regulator(dev, "vpcie-supply", >vpcie);
+#endif
+
/* if PERST# valid from dt then assert it */
gpio_request_by_name(dev, "reset-gpio", 0, >reset_gpio,
 GPIOD_IS_OUT);
-- 
2.17.1



Re: [PATCH u-boot-net v4 03/14] net: introduce helpers to get PHY ofnode from MAC

2022-04-13 Thread Tom Rini
On Thu, Apr 07, 2022 at 12:32:57AM +0200, Marek Behún wrote:

> From: Marek Behún 
> 
> Add helpers ofnode_get_phy_node() and dev_get_phy_node() and use it in
> net/mdio-uclass.c function dm_eth_connect_phy_handle(). Also add
> corresponding UT test.
> 
> This is useful because other part's of U-Boot may want to get PHY ofnode
> without connecting a PHY.
> 
> Signed-off-by: Marek Behún 
> Reviewed-by: Ramon Fried 
> Reviewed-by: Simon Glass 
> ---
>  arch/sandbox/dts/test.dts | 13 +
>  drivers/core/ofnode.c | 21 +
>  drivers/core/read.c   |  5 +
>  include/dm/ofnode.h   | 14 ++
>  include/dm/read.h | 19 +++
>  net/mdio-uclass.c | 24 ++--
>  test/dm/ofnode.c  | 18 ++
>  7 files changed, 96 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index 05c1cd5e1a..e536943503 100644
> --- a/arch/sandbox/dts/test.dts
> +++ b/arch/sandbox/dts/test.dts
> @@ -530,6 +530,13 @@
>   fake-host-hwaddr = [00 00 66 44 22 22];
>   };
>  
> + phy_eth0: phy-test-eth {
> + compatible = "sandbox,eth";
> + reg = <0x10007000 0x1000>;
> + fake-host-hwaddr = [00 00 66 44 22 77];
> + phy-handle = <>;
> + };
> +
>   dsa_eth0: dsa-test-eth {
>   compatible = "sandbox,eth";
>   reg = <0x10006000 0x1000>;
> @@ -1555,6 +1562,12 @@
>  
>   mdio: mdio-test {
>   compatible = "sandbox,mdio";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ethphy1: ethernet-phy@1 {
> + reg = <1>;
> + };
>   };
>  
>   pm-bus-test {
> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> index 8042847f3c..445b7ad5ad 100644
> --- a/drivers/core/ofnode.c
> +++ b/drivers/core/ofnode.c
> @@ -1198,3 +1198,24 @@ const char *ofnode_conf_read_str(const char *prop_name)
>  
>   return ofnode_read_string(node, prop_name);
>  }
> +
> +ofnode ofnode_get_phy_node(ofnode node)
> +{
> + /* DT node properties that reference a PHY node */
> + static const char * const phy_handle_str[] = {
> + "phy-handle", "phy", "phy-device",
> + };
> + struct ofnode_phandle_args args = {
> + .node = ofnode_null()
> + };
> + int i;
> +
> + assert(ofnode_valid(node));
> +
> + for (i = 0; i < ARRAY_SIZE(phy_handle_str); i++)
> + if (!ofnode_parse_phandle_with_args(node, phy_handle_str[i],
> + NULL, 0, 0, ))
> + break;
> +
> + return args.node;
> +}
> diff --git a/drivers/core/read.c b/drivers/core/read.c
> index 31f9e78a06..7ff100218d 100644
> --- a/drivers/core/read.c
> +++ b/drivers/core/read.c
> @@ -398,3 +398,8 @@ int dev_decode_display_timing(const struct udevice *dev, 
> int index,
>  {
>   return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
>  }
> +
> +ofnode dev_get_phy_node(const struct udevice *dev)
> +{
> + return ofnode_get_phy_node(dev_ofnode(dev));
> +}
> diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> index 744dffe0a2..429aee2812 100644
> --- a/include/dm/ofnode.h
> +++ b/include/dm/ofnode.h
> @@ -1217,4 +1217,18 @@ int ofnode_conf_read_int(const char *prop_name, int 
> default_val);
>   */
>  const char *ofnode_conf_read_str(const char *prop_name);
>  
> +/**
> + * ofnode_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
> + *
> + * This function parses PHY handle from the Ethernet controller's ofnode
> + * (trying all possible PHY handle property names), and returns the PHY 
> ofnode.
> + *
> + * Before this is used, ofnode_phy_is_fixed_link() should be checked first, 
> and
> + * if the result to that is true, this function should not be called.
> + *
> + * @eth_node:ofnode belonging to the Ethernet controller
> + * Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode
> + */
> +ofnode ofnode_get_phy_node(ofnode eth_node);
> +
>  #endif
> diff --git a/include/dm/read.h b/include/dm/read.h
> index 233af3c063..899eb813fd 100644
> --- a/include/dm/read.h
> +++ b/include/dm/read.h
> @@ -743,6 +743,20 @@ int dev_read_pci_bus_range(const struct udevice *dev, 
> struct resource *res);
>  int dev_decode_display_timing(const struct udevice *dev, int index,
> struct display_timing *config);
>  
> +/**
> + * dev_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
> + *
> + * This function parses PHY handle from the Ethernet controller's ofnode
> + * (trying all possible PHY handle property names), and returns the PHY 
> ofnode.
> + *
> + * Before this is used, ofnode_phy_is_fixed_link() should be checked first, 
> and
> + * if the result to that is true, this function should not be called.
> + *
> + * @dev: device representing the MAC
> + * Return: ofnode 

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

2022-04-13 Thread Stefano Babic

Hi Tom,

On 13.04.22 18:24, 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.


I get the error when I run buildman locally on my host, so I guess it 
was near to the limit if you have not seen.






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?


There are still 3 big series that should flow in:

- Marek's series about Power Domain
- Gateworks series (Tim)
- Toradex series

These series conflict with the rest, so they needed to be rebased.

  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.



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
=


[UNTESTED PATCH] Nokia RX-51: Convert to CONFIG_DM_SERIAL

2022-04-13 Thread Pali Rohár
For CONFIG_DM_SERIAL it is required to increase CONFIG_SYS_MALLOC_F_LEN as
default value is not enough for memory hungry CONFIG_DM_SERIAL code.

Signed-off-by: Pali Rohár 
---
Who has serial console on the real device, please test this patch if
serial console is still working. I do not have adapter for serial
console so I tested this patch only in qemu.
---
 board/nokia/rx51/rx51.c  | 12 
 configs/nokia_rx51_defconfig |  5 ++---
 include/configs/nokia_rx51.h |  1 -
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 621cff095619..460d248eaaeb 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -788,3 +789,14 @@ U_BOOT_DRVINFOS(rx51_video) = {
 U_BOOT_DRVINFOS(rx51_kp) = {
{ "rx51_kp" },
 };
+
+static const struct ns16550_plat rx51_serial = {
+   .base = CONFIG_SYS_NS16550_COM3,
+   .reg_shift = 2,
+   .clock = CONFIG_SYS_NS16550_CLK,
+   .fcr = UART_FCR_DEFVAL,
+};
+
+U_BOOT_DRVINFOS(rx51_uart) = {
+   { "omap_serial", _serial },
+};
diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig
index d5688c7a212b..68acf01e9aeb 100644
--- a/configs/nokia_rx51_defconfig
+++ b/configs/nokia_rx51_defconfig
@@ -11,12 +11,12 @@ CONFIG_STATIC_MACH_TYPE=y
 CONFIG_MACH_TYPE=1955
 CONFIG_SYS_TEXT_BASE=0x80008000
 CONFIG_SYS_MALLOC_LEN=0xc
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TARGET_NOKIA_RX51=y
 CONFIG_SYS_LOAD_ADDR=0x8000
 CONFIG_OPTIMIZE_INLINING=y
 CONFIG_LTO=y
-# CONFIG_SYS_MALLOC_F is not set
 # CONFIG_FIT is not set
 CONFIG_BOOTDELAY=30
 CONFIG_AUTOBOOT_KEYED=y
@@ -70,8 +70,7 @@ CONFIG_DM_KEYBOARD=y
 # CONFIG_MMC_VERBOSE is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
-CONFIG_CONS_INDEX=3
-CONFIG_SYS_NS16550=y
+CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_USB=y
 CONFIG_USB_MUSB_UDC=y
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index e837b12b568f..f273e243e55d 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -43,7 +43,6 @@
 #define V_NS16550_CLK  4800/* 48MHz (APLL96/2) */
 
 #define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE(-4)
 #define CONFIG_SYS_NS16550_CLK V_NS16550_CLK
 
 /*
-- 
2.20.1



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

2022-04-13 Thread Tim Harvey
On Wed, Apr 13, 2022 at 1:21 AM Stefano Babic  wrote:
>
> 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).
>

Stefano,

Thanks - I've rebased and re-submitted everything I have in my queue.

Best Regards,

Tim


[PATCH v2 2/2] board: gateworks: venice: add imx8mp-venice-gw740x support

2022-04-13 Thread Tim Harvey
The GW74xx is based on the i.MX 8M Plus SoC featuring:
 - LPDDR4 DRAM
 - eMMC FLASH
 - Gateworks System Controller
 - PCIe Gen 3.0 switch (build option)
 - USB 3.0 HUB
 - USB Type-C front panel connector
 - GPS
 - 3-axis accelerometer
 - CAN bus
 - 6x GbE RJ45 front-panel jacks
  - 1x IMX8M FEC RGMII GbE (with Passive PoE)
  - 5x IMX8M EQOS RGMII 6 port GbE Switch
(1x with 802.3af class 5 Active PoE)
 - RS232/RS485/RS422 serial transceiver
 - MIPI header (DSI/CSI/GPIO/PWM/I2S)
 - DigI/O header (UART/GPIO/I2C/ADC)
 - 802.11ac WiFi
 - Bluetooth BLE
 - 3x MiniPCIe sockets with PCI/USB
 - 1x M.2 Socket with USB2.0, PCIe, and dual-SIM
 - PMIC
 - Wide range DC input supply (8V to 60V DC)

Do the following to add support for this and future imx8mp-venice boards:
 - add dts
 - add DRAM config
 - add PMIC config
 - add IMX8MP support in spl.c and venice.c

Signed-off-by: Tim Harvey 
---
v2:
 - rebase on imx/master
---
 arch/arm/dts/Makefile |2 +
 arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi |  185 ++
 arch/arm/dts/imx8mp-venice-gw74xx.dts |  923 +
 arch/arm/dts/imx8mp-venice-u-boot.dtsi|   74 +
 arch/arm/dts/imx8mp-venice.dts|  159 ++
 arch/arm/mach-imx/imx8m/Kconfig   |9 +
 board/gateworks/venice/Kconfig|   15 +
 board/gateworks/venice/Makefile   |3 +
 board/gateworks/venice/eeprom.c   |4 +-
 .../gateworks/venice/imximage-8mp-lpddr4.cfg  |9 +
 board/gateworks/venice/lpddr4_timing.h|2 +
 board/gateworks/venice/lpddr4_timing_imx8mp.c | 1846 +
 board/gateworks/venice/spl.c  |   74 +-
 board/gateworks/venice/venice.c   |   25 +-
 configs/imx8mp_venice_defconfig   |  142 ++
 include/configs/imx8mp_venice.h   |  109 +
 16 files changed, 3571 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mp-venice-gw74xx.dts
 create mode 100644 arch/arm/dts/imx8mp-venice-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mp-venice.dts
 create mode 100644 board/gateworks/venice/imximage-8mp-lpddr4.cfg
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mp.c
 create mode 100644 configs/imx8mp_venice_defconfig
 create mode 100644 include/configs/imx8mp_venice.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index df7b4addf990..99243386ff4a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -931,6 +931,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
imx8mq-phanbell.dtb \
imx8mp-evk.dtb \
imx8mp-phyboard-pollux-rdk.dtb \
+   imx8mp-venice.dtb \
+   imx8mp-venice-gw74xx.dtb \
imx8mp-verdin.dtb \
imx8mq-pico-pi.dtb \
imx8mq-kontron-pitx-imx8m.dtb
diff --git a/arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi 
b/arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi
new file mode 100644
index ..920246d577ed
--- /dev/null
+++ b/arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2022 Gateworks Corporation
+ */
+
+#include "imx8mp-u-boot.dtsi"
+
+/ {
+   firmware {
+   optee {
+   compatible = "linaro,optee-tz";
+   method = "smc";
+   };
+   };
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   u-boot,dm-spl;
+   wdt = <>;
+   };
+};
+
+ {
+   /delete-property/ assigned-clocks;
+   /delete-property/ assigned-clock-parents;
+   /delete-property/ assigned-clock-rates;
+};
+
+ {
+   reset-gpios = < 30 GPIO_ACTIVE_LOW>;
+   reset-delay-us = <1000>;
+   reset-post-delay-us = <30>;
+};
+
+ {
+   phy-reset-gpios = < 29 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <15>;
+   phy-reset-post-delay = <100>;
+};
+
+ {
+   u-boot,dm-spl;
+
+   dio0_hog {
+   gpio-hog;
+   input;
+   gpios = <9 GPIO_ACTIVE_LOW>;
+   line-name = "dio0";
+   };
+
+   dio1_hog {
+   gpio-hog;
+   input;
+   gpios = <11 GPIO_ACTIVE_LOW>;
+   line-name = "dio1";
+   };
+};
+
+ {
+   u-boot,dm-spl;
+
+   pcie1_wdis_hog {
+   gpio-hog;
+   gpios = <17 GPIO_ACTIVE_HIGH>;
+   output-high;
+   line-name = "pcie1_wdis#";
+   };
+
+   pcie2_wdis_hog {
+   gpio-hog;
+   gpios = <18 GPIO_ACTIVE_HIGH>;
+   output-high;
+   line-name = "pcie2_wdis#";
+   };
+
+   pcie3_wdis_hog {
+   gpio-hog;
+   gpios = <14 GPIO_ACTIVE_HIGH>;
+   output-high;
+   line-name = "pcie3_wdis#";
+   };
+};
+
+ {
+   u-boot,dm-spl;
+
+   m2_dis2_hog {
+   gpio-hog;
+   gpios = <0 

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

2022-04-13 Thread Tim Harvey
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 
---
v2:
 - rebase on imx/master
---
 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;
}
}
 
-- 
2.17.1



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

2022-04-13 Thread Sudeep Holla
On Wed, Apr 13, 2022 at 12:46:07PM -0400, Tom Rini wrote:
> On Wed, Apr 13, 2022 at 03:20:23PM +0100, Abdellatif El Khlifi wrote:

[...]

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

I don't clearly understand your query here fully. Generally if some h/w
is discoverable, then we don't need to have device node in the DT as it
may result in conflicts.

In this we can query f/w to check if a particular feature is implemented
or not before we initialise the FF-A bus. One we discover the partitions
we add devices for each and the individual device and associated driver
gets probed based on UUID.

I have neither seen the u-boot implementation nor fully understand how
device/driver model differs from the kernel one to comment on details.
I am happy to provide any more details if required.

--
Regards,
Sudeep


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

2022-04-13 Thread Michael Nazzareno Trimarchi
Hi

On Wed, Apr 13, 2022 at 6:09 PM Tim Harvey  wrote:
>
> 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.

Do we know why without # CONFIG_SPL_DM_SERIAL is not set

board hang?

Michael

>
> Best Regards,
>
> Tim



-- 
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 0/4] mmc: add support for bcm63158

2022-04-13 Thread Philippe Reynes
This serie adds the support of mmc for bcm63158.
The first commit adds a driver that support sdhci
on bcm63158. The two next commits add support of
mmc in the device tree, and the last one enables
the support of mmc and gpt for the reference board
bcm963158.


Philippe Reynes (4):
  drivers: mmc: bcm63158_sdhci: initial support
  arch: arm: dts: bcm63158.dtsi: add mmc support
  arch: arm: dts: bcm963158.dts: enable sdhci support
  configs: bcm963158_ram_defconfig: enable mmc and gpt support

 arch/arm/dts/bcm63158.dtsi  |   9 ++
 arch/arm/dts/bcm963158.dts  |   4 +
 configs/bcm963158_ram_defconfig |   8 +-
 drivers/mmc/Kconfig |  12 +++
 drivers/mmc/Makefile|   1 +
 drivers/mmc/bcm63158_sdhci.c| 153 
 6 files changed, 184 insertions(+), 3 deletions(-)
 create mode 100644 drivers/mmc/bcm63158_sdhci.c

-- 
2.25.1



[PATCH 1/4] drivers: mmc: bcm63158_sdhci: initial support

2022-04-13 Thread Philippe Reynes
Adds a driver to support shdci on bcm63158.

Signed-off-by: Philippe Reynes 
---
 drivers/mmc/Kconfig  |  12 +++
 drivers/mmc/Makefile |   1 +
 drivers/mmc/bcm63158_sdhci.c | 153 +++
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/mmc/bcm63158_sdhci.c

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e19..a08e8245cf 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -520,6 +520,18 @@ config MMC_SDHCI_BCM2835
 
  If unsure, say N.
 
+config MMC_SDHCI_BCM63158
+   bool "SDHCI support for the BCM63158 SD/MMC Controller"
+   depends on ARCH_BCM63158
+   depends on MMC_SDHCI
+   help
+ This selects the BCM63158 SD/MMC controller.
+
+ If you have a BCM63158 platform with SD or MMC devices,
+ say Y here.
+
+ If unsure, say N.
+
 config MMC_SDHCI_BCMSTB
tristate "SDHCI support for the BCMSTB SD/MMC Controller"
depends on MMC_SDHCI
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 17ebc04203..5cebd55549 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_SDHCI)   += sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ASPEED) += aspeed_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ATMEL)  += atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)+= bcm2835_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_BCM63158)   += bcm63158_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCMSTB) += bcmstb_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)+= sdhci-cadence.o
 obj-$(CONFIG_MMC_SDHCI_AM654)  += am654_sdhci.o
diff --git a/drivers/mmc/bcm63158_sdhci.c b/drivers/mmc/bcm63158_sdhci.c
new file mode 100644
index 00..42295d113d
--- /dev/null
+++ b/drivers/mmc/bcm63158_sdhci.c
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Philippe Reynes 
+ *
+ * based on:
+ * drivers/mmc/bcmstb_sdhci.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* 400KHz is max freq for card ID etc. Use that as min */
+#define MIN_FREQ 40
+
+#define BCM63158_MMC_BOOT_MAIN_CTL_REG 0x0
+#define BCM63158_MMC_BOOT_STATUS_REG   0x4
+#define BCM63158_MMC_BOOT_MODE_MASK1
+
+struct sdhci_bcm63158_plat {
+   struct mmc_config cfg;
+   struct mmc mmc;
+};
+
+static int sdhci_bcm63158_bind(struct udevice *dev)
+{
+   struct sdhci_bcm63158_plat *plat = dev_get_plat(dev);
+
+   return sdhci_bind(dev, >mmc, >cfg);
+}
+
+static int sdhci_bcm63158_set_normal_mode(void *boot_regs)
+{
+   void *boot_main_ctl_reg = boot_regs + BCM63158_MMC_BOOT_MAIN_CTL_REG;
+   void *boot_status_reg = boot_regs + BCM63158_MMC_BOOT_STATUS_REG;
+   u32 status;
+   int i, max_retry = 10;
+   int ret = -1;
+
+   status = readl(boot_status_reg);
+   if ((status & BCM63158_MMC_BOOT_MODE_MASK) == 0) {
+   ret = 0;
+   goto out;
+   }
+
+   clrbits_32(boot_main_ctl_reg, BCM63158_MMC_BOOT_MODE_MASK);
+
+   for (i = 0; i < max_retry; i++) {
+   status = readl(boot_status_reg);
+   if ((status & BCM63158_MMC_BOOT_MODE_MASK) == 0) {
+   ret = 0;
+   goto out;
+   }
+
+   mdelay(10);
+   }
+
+   log_err("%s: can't set mode normal\n", __func__);
+
+ out:
+   return ret;
+}
+
+static int sdhci_bcm63158_probe(struct udevice *dev)
+{
+   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   struct sdhci_bcm63158_plat *plat = dev_get_plat(dev);
+   struct sdhci_host *host = dev_get_priv(dev);
+   struct resource res;
+   void *boot_regs;
+   int ret;
+
+   host->name = dev->name;
+
+   /* Get sdhci controller base address */
+   ret = dev_read_resource_byname(dev, "sdhci-base", );
+   if (ret) {
+   dev_err(dev, "can't get regs sdhci-base address(ret = %d)!\n", 
ret);
+   return ret;
+   }
+
+   host->quirks |= SDHCI_QUIRK_WAIT_SEND_CMD;
+   host->ioaddr = devm_ioremap(dev, res.start, resource_size());
+   if (IS_ERR(host->ioaddr))
+   return PTR_ERR(host->ioaddr);
+
+   /* Get sdhci boot controller base address */
+   ret = dev_read_resource_byname(dev, "sdhci-boot", );
+   if (ret) {
+   dev_err(dev, "can't get regs sdhci-boot address(ret = %d)!\n", 
ret);
+   return ret;
+   }
+
+   boot_regs = devm_ioremap(dev, res.start, resource_size());
+   if (IS_ERR(boot_regs))
+   return PTR_ERR(boot_regs);
+
+   /* Set normal mode instead of boot mode */
+   ret = sdhci_bcm63158_set_normal_mode(boot_regs);
+   if (ret)
+   return ret;
+
+   ret = mmc_of_parse(dev, >cfg);
+   if (ret)
+   return ret;
+
+   /*
+* see commit:
+* 425d83346d7 ("mmc: bcm: fix uninitialized 

[PATCH 2/4] arch: arm: dts: bcm63158.dtsi: add mmc support

2022-04-13 Thread Philippe Reynes
Adds the support of sdhci on bcm63158.

Signed-off-by: Philippe Reynes 
---
 arch/arm/dts/bcm63158.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/bcm63158.dtsi b/arch/arm/dts/bcm63158.dtsi
index 7dd2858438..4e0f5f2dbd 100644
--- a/arch/arm/dts/bcm63158.dtsi
+++ b/arch/arm/dts/bcm63158.dtsi
@@ -229,5 +229,14 @@
 
status = "disabled";
};
+
+   sdhci: sdhci {
+   compatible = "brcm,bcm63158-sdhci";
+   reg-names = "sdhci-base", "sdhci-boot";
+   reg = <0x 0xff81 0x 0x0100>,
+ <0x 0xff810200 0x 0x0040>;
+   bus-width = <0x0008>;
+   no-1-8-v;
+   };
};
 };
-- 
2.25.1



[PATCH 4/4] configs: bcm963158_ram_defconfig: enable mmc and gpt support

2022-04-13 Thread Philippe Reynes
Enable the support of emmc and gpt on bcm63158

Signed-off-by: Philippe Reynes 
---
 configs/bcm963158_ram_defconfig | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/configs/bcm963158_ram_defconfig b/configs/bcm963158_ram_defconfig
index 642faf511f..5fc89fc99d 100644
--- a/configs/bcm963158_ram_defconfig
+++ b/configs/bcm963158_ram_defconfig
@@ -24,21 +24,23 @@ CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_UNZIP is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_GPT_RENAME=y
+CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
 CONFIG_CMD_CACHE=y
 CONFIG_DOS_PARTITION=y
 CONFIG_ISO_PARTITION=y
-CONFIG_EFI_PARTITION=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 # CONFIG_NET is not set
-CONFIG_BLK=y
 CONFIG_CLK=y
 CONFIG_BCM6345_GPIO=y
 CONFIG_LED=y
 CONFIG_LED_BCM6858=y
 CONFIG_LED_BLINK=y
-# CONFIG_MMC is not set
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_BCM63158=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_RAW_NAND=y
-- 
2.25.1



[PATCH 3/4] arch: arm: dts: bcm963158.dts: enable sdhci support

2022-04-13 Thread Philippe Reynes
Enable the support of sdhci on bcm63158.

Signed-off-by: Philippe Reynes 
---
 arch/arm/dts/bcm963158.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/bcm963158.dts b/arch/arm/dts/bcm963158.dts
index c2bdd33274..c96fa60841 100644
--- a/arch/arm/dts/bcm963158.dts
+++ b/arch/arm/dts/bcm963158.dts
@@ -137,3 +137,7 @@
spi-max-frequency = <2500>;
};
 };
+
+ {
+   status = "okay";
+};
-- 
2.25.1



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

2022-04-13 Thread Andrew Scull
On Wed, 13 Apr 2022 at 15:05, Bin Meng  wrote:
>
> 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?

*migrate -- will fix

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


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), ));
> > +
> > +   /* 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), ));
> > +
> > +   /* Before any of the 

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


[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, _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, _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 */
 #define GP_RS232_EN  

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


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.


[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



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



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



[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"
+
+ {
+   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";
+   };
+};
+
+ {
+   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"
+
+ {
+   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";
+   };
+};
+
+ {
+   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
+++ 

[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;
 };
 
+ {
+   u-boot,dm-spl;
+};
+
  {
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 = <_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;
 };
 
+ {
+   u-boot,dm-spl;
+};
+
  {
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 = <_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;
+   maclow |= som_info.mac[2] << 24;
+ 

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



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



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


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 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 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), );
> 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 @@ static 

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

[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

[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 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 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 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, );
-- 
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 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 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 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 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 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 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 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



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


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 = >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,
> - _addr);
> -   if (!ret)
> -   return phys_addr;
> -   }
> -
> -   ret = _dm_pci_bus_to_phys(ctlr, bus_addr, len, flags, 0, _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++) {
>

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 

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 

[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, ));
+   ut_assertnonnull(bus);
+
+   /* check the child virtio-rng device is bound */
+   ut_assertok(device_find_first_child(bus, ));
+   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



[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, ))
;
 
+   if (rsize > sg.length)
+   return -EIO;
+
memcpy(ptr, buf, rsize);
len -= rsize;
ptr += rsize;
-- 
2.35.1.1178.g4f1659d476-goog



[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, ));
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, ));
+   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 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, ));
-   ut_assertnonnull(bus);
-
-   /* check the child virtio-blk device is bound */
-   ut_assertok(device_find_first_child(bus, ));
-   ut_assertnonnull(dev);
-   ut_assertok(strcmp(dev->name, "virtio-blk#0"));
-
-   /* check driver status */
-   ut_assertok(virtio_get_status(dev, ));
-   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, ));
-   ut_assertnonnull(bus);
-
-   /* check the child virtio-blk device is bound */
-   ut_assertok(device_find_first_child(bus, ));
-   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, ));
-   ut_assertok(virtio_set_status(dev, VIRTIO_CONFIG_S_DRIVER_OK));
-   ut_assertok(virtio_get_status(dev, ));
-   ut_asserteq(VIRTIO_CONFIG_S_DRIVER_OK, status);
-   ut_assertok(virtio_reset(dev));
-   ut_assertok(virtio_get_status(dev, ));
-   ut_asserteq(0, status);
-   ut_assertok(virtio_get_features(dev, ));
-   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, ));
-   ut_assertnonnull(bus);
-
-   /* check the child virtio-blk device is bound */
-   ut_assertok(device_find_first_child(bus, ));
-   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));
-
-   ut_asserteq(false, device_active(dev));
-
-   

[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, ));
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, ));
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, ));
-- 
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 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, ));
ut_asserteq(0, status);
ut_assertok(virtio_get_features(dev, ));
-   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 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, ));
+   ut_assertnonnull(bus);
+
+   /* check the child virtio-blk device is bound */
+   ut_assertok(device_find_first_child(bus, ));
+   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] = [0];
+   sgs[1] = [1];
+
+   /* read a buffer and report written size from device */
+   ut_assertok(virtio_find_vqs(dev, 1, ));
+   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, ));
+   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, ));
+   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, ));
+   ut_assertok(virtio_del_vqs(dev));
+
+   /* device changes to descriptor are ignored */
+   ut_assertok(virtio_find_vqs(dev, 1, ));
+   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, ));
+   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 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 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 = >vring_desc_shadow[i];
struct vring_desc *desc = >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(_used_event(>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 

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



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



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 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 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), ));
> +
> +   /* 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), ));
> +
> +   /* 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 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 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 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 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, _response);
> --

Regards,
Bin


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


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


[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

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

[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



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-usb: Add support for i.MX8

[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;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
-_lsio {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio0 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio1 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio2 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio3 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio4 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio5 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio6 {
-   u-boot,dm-pre-proper;
-};
-
-_lsio_gpio7 {
-   u-boot,dm-pre-proper;
-};
-
-_dma {
-   u-boot,dm-pre-proper;
-};
-
-_dma_lpuart0 {
-   u-boot,dm-pre-proper;
-};
-
-_dma_lpuart3 {
-   u-boot,dm-pre-proper;
-};
-
-_conn {
-   u-boot,dm-pre-proper;
-};
-
-_conn_sdch0 {
-   u-boot,dm-pre-proper;
-};
-
-_conn_sdch1 {
-   u-boot,dm-pre-proper;
-};
-
-_conn_sdch2 {
-   u-boot,dm-pre-proper;
-};
-
-_conn_enet0 {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-};
-
- {
-   u-boot,dm-pre-proper;
-   /delete-property/ assigned-clock-parents;
-};
-
- {
-   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 = 
-   };
-
-   regulators {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   reg_usb_otg1_vbus: regulator@0 {
-   compatible = "regulator-fixed";
-   reg = <0>;
-   regulator-name = "usb_otg1_vbus";
-   regulator-min-microvolt = 

[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 

[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) &
-   

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

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

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

[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] 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
=


  1   2   >