[U-Boot] [PATCH v4] board/BuR/brsmarc1: initial commit

2019-07-30 Thread Hannes Schmelzer
This commit adds support for the B brsmarc1 SoM.

The SoM is based on TI's AM335x SoC.
Mainly vxWorks 6.9.4.x is running on the board,
doing some PLC stuff on various carrier boards.

Signed-off-by: Hannes Schmelzer 

---

Changes in v4:
- rebase to current master

Changes in v3:
- rebase to current master
- dts: fixup dtc warnings
- dts: rename temperature sensor nodes
- dts: rename reset-controller node
- dts: add baseboard temp. sensor

Changes in v2:
- fix style issue in arch/arm/mach-omap2/am33xx/Kconfig
- fix SDPX tag in Make-files/rules

 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/am335x-brsmarc1.dts   | 416 +
 arch/arm/mach-omap2/Kconfig|   1 +
 arch/arm/mach-omap2/am33xx/Kconfig |   4 +
 board/BuR/brsmarc1/Kconfig |  15 ++
 board/BuR/brsmarc1/MAINTAINERS |   6 +
 board/BuR/brsmarc1/Makefile|  10 +
 board/BuR/brsmarc1/board.c | 168 +++
 board/BuR/brsmarc1/config.mk   |  33 +++
 board/BuR/brsmarc1/mux.c   | 266 
 configs/brsmarc1_defconfig | 107 ++
 include/configs/brsmarc1.h |  87 
 12 files changed, 1114 insertions(+)
 create mode 100644 arch/arm/dts/am335x-brsmarc1.dts
 create mode 100644 board/BuR/brsmarc1/Kconfig
 create mode 100644 board/BuR/brsmarc1/MAINTAINERS
 create mode 100644 board/BuR/brsmarc1/Makefile
 create mode 100644 board/BuR/brsmarc1/board.c
 create mode 100644 board/BuR/brsmarc1/config.mk
 create mode 100644 board/BuR/brsmarc1/mux.c
 create mode 100644 configs/brsmarc1_defconfig
 create mode 100644 include/configs/brsmarc1.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b437f75..13ae4a1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -276,6 +276,7 @@ dtb-$(CONFIG_AM33XX) += \
am335x-brppt1-nand.dtb \
am335x-brppt1-spi.dtb \
am335x-brxre1.dtb \
+   am335x-brsmarc1.dtb \
am335x-draco.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
diff --git a/arch/arm/dts/am335x-brsmarc1.dts b/arch/arm/dts/am335x-brsmarc1.dts
new file mode 100644
index 000..1a7f9a5
--- /dev/null
+++ b/arch/arm/dts/am335x-brsmarc1.dts
@@ -0,0 +1,416 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 B Industrial Automation GmbH
+ * http://www.br-automation.com
+ *
+ */
+/dts-v1/;
+
+#include "am33xx.dtsi"
+#include "dt-bindings/thermal/thermal.h"
+
+/ {
+   model = "BRSMARC1 SoM";
+   compatible = "ti,am33xx";
+
+   fset: factory-settings {
+   bl-version  = "";
+   order-no= "";
+   cpu-order-no= "";
+   hw-revision = "";
+   serial-no   = <0>;
+   device-id   = <0x0>;
+   parent-id   = <0x0>;
+   hw-variant  = <0x0>;
+   hw-platform = <0x7>;
+   fram-offset = <0x100>;
+   fram-size   = <0x1F00>;
+   cache-disable   = <0x0>;
+   cpu-clock   = <0x0>;
+   };
+
+   chosen {
+   bootargs = "console=ttyO0,115200 earlyprintk";
+   stdout-path = 
+   };
+
+   aliases {
+   fset = 
+   mmc = 
+   spi0 = 
+   spi1 = 
+   touch0 = 
+   screen0 = 
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x1000>; /* 256 MB */
+   };
+
+   vmmcsd_fixed: fixedregulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcsd_fixed";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   lcdscreen0: lcdscreen@0 {
+   /*backlight = <_bl>; */
+   compatible = "ti,tilcdc,panel";
+   status = "okay";
+
+   panel-info {
+   ac-bias = <255>;
+   ac-bias-intrpt  = <0>;
+   dma-burst-sz= <16>;
+   bpp = <32>;
+   fdd = <0x80>;
+   sync-edge   = <0>;
+   sync-ctrl   = <1>;
+   raster-order= <0>;
+   fifo-th = <0>;
+   rotation= <0>;
+   pupdelay= <0>;
+   pondelay= <0>;
+   pwrpin  = <0x00B1>;
+   brightdrv   = <0>;
+   brightfdim  = <100>;
+   brightdef   = <50>;
+   };
+
+   display-timings {
+   default {
+   

Re: [U-Boot] [PATCH 1/2] configs: am65x_evm_a53: Disable K3_SYSTEM_CONTROLLER

2019-07-30 Thread Lokesh Vutla


On 30/07/19 9:48 PM, Tom Rini wrote:
> On Tue, Jul 30, 2019 at 11:16:19AM -0500, Suman Anna wrote:
>> Hi Lokesh,
>>
>> On 7/29/19 11:08 PM, Lokesh Vutla wrote:
>>>
>>>
>>> On 29/07/19 10:18 PM, Suman Anna wrote:
 The K3 System Controller driver is used for loading and starting
 the System Firmware, and is used only on R5 SPL. It need not be
 enabled and built for the A53 U-Boot and SPL, so disable it from
 both the GP and HS AM65x A53 defconfigs.

 While at this, also remove the unneeded CONFIG_SPL_REMOTEPROC and
 CONFIG_CMD_REMOTEPROC as no remoteprocs are now loaded from A53 SPL.

 Signed-off-by: Suman Anna 
 ---
  configs/am65x_evm_a53_defconfig| 3 ---
  configs/am65x_hs_evm_a53_defconfig | 3 ---
  2 files changed, 6 deletions(-)

 diff --git a/configs/am65x_evm_a53_defconfig 
 b/configs/am65x_evm_a53_defconfig
 index 2cf3a693fc70..d43df6a18765 100644
 --- a/configs/am65x_evm_a53_defconfig
 +++ b/configs/am65x_evm_a53_defconfig
 @@ -28,14 +28,12 @@ CONFIG_SPL_I2C_SUPPORT=y
  CONFIG_SPL_DM_MAILBOX=y
  CONFIG_SPL_DM_RESET=y
  CONFIG_SPL_POWER_DOMAIN=y
 -CONFIG_SPL_REMOTEPROC=y
  CONFIG_SPL_YMODEM_SUPPORT=y
  CONFIG_CMD_ASKENV=y
  # CONFIG_CMD_FLASH is not set
  CONFIG_CMD_GPT=y
  CONFIG_CMD_I2C=y
  CONFIG_CMD_MMC=y
 -CONFIG_CMD_REMOTEPROC=y
>>>
>>> CMD_REMOTEPROC will definitely be used in very near future. Please retain 
>>> this.
>>> Rest looks good to me.
>>
>> This is a result of using savedefconfig, I prefer it this way since it
>> allows other developers adding options to do it cleanly. If and when a
>> REMOTEPROC is enabled, the savedefconfig with corresponding options
>> should automatically bring this back.
> 
> Indeed, if savedefconfig is taking it out, it's not being built today OR
> it's already default y and being built.
> 

ohh okay. I didn't know it was a result of savedefconfig as you mentioned it is
explicitly removed. Patch as such looks good to me.

Reviewed-by: Lokesh Vutla 

Thanks and regards,
Lokesh

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] riscv : serial: use rx watermark to indicate rx data is present

2019-07-30 Thread Rick Chen
Hi Anup

> Hi Rick,
>
> On Fri, Jul 26, 2019 at 12:32 PM Rick Chen  wrote:
> >
> > Hi Sagar
> >
> > > From: Sagar Kadam [mailto:sagar.ka...@sifive.com]
> > > Sent: Friday, July 19, 2019 7:37 PM
> > > To: Rick Jian-Zhi Chen(陳建志)
> > > Subject: Re: [U-Boot] [PATCH] riscv : serial: use rx watermark to 
> > > indicate rx data is present
> > >
> > > Hello Rick,
> > >
> > > I missed to CC you while submitting the patch[1] Can you please provide 
> > > your view's on the patch.
> >
> > Sorry for the late response.
> > I am OK with your patch.
> > I will pull it into riscv tree ASAP :)
>
> All SiFive driver update patches have been merged
> except one documentation update patch.
>
> "[U-Boot,v12,1/1] doc: sifive-fu540: Update README to explicitly load
> DTB for Linux"
> https://patchwork.ozlabs.org/patch/1137215/
>
> Can you take this patch via RISCV tree ?

OK
I will pull it later.

B.R
Rick

>
> Regards,
> Anup
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] x86 FSP 2

2019-07-30 Thread Bin Meng
Hi Simon,

On Wed, Jul 31, 2019 at 10:55 AM Simon Glass  wrote:
>
> Hi Bin,
>
> On Thu, 23 May 2019 at 08:04, Bin Meng  wrote:
> >
> > Hi Simon,
> >
> > On Thu, May 23, 2019 at 8:20 PM Simon Glass  wrote:
> > >
> > > Hi Bin,
> > >
> > > I'm looking at Apollo Lake and it seems to use a newer FSP version
> > > (2.0). The API differences seem to be fairly minor but the packaging
> > > seems a little more complicated.
> > >
> >
> > I have investigated FSP 2.0 architecture before, and IIRC your
> > understanding is correct. Unfortunately I did not get a chance to
> > support one of the Apollo Lake CRB.
> >
> > > I'm thinking of introducing a Kconfig for this and moving the existing
> > > fsp implementation into an arch/x86/lib/fsp1 directory and adding an
> > > fsp2 there also. What do you think? Have you done anything with this
> > > newer version?
> > >
> >
> > Sounds good to me. I have a Oxbow Hill CRB here. If it is the same
> > board you want to support, I can help testing.
>
> I'm going to support coral I think, a Chromebook.
>

That's good to know.

> You may have seen the binman support for IFWI, etc. I have some

Yes, I saw the binman patch series. Sorry I did not have enough time
to look at that series.

> patches to move the FSP code around (u-boot-dm/coral-working). So far
> it only boots into TPL. I'm aiming to have some patches for it to boot
> to a prompt sometime in late August.

Great!

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] x86 FSP 2

2019-07-30 Thread Simon Glass
Hi Bin,

On Thu, 23 May 2019 at 08:04, Bin Meng  wrote:
>
> Hi Simon,
>
> On Thu, May 23, 2019 at 8:20 PM Simon Glass  wrote:
> >
> > Hi Bin,
> >
> > I'm looking at Apollo Lake and it seems to use a newer FSP version
> > (2.0). The API differences seem to be fairly minor but the packaging
> > seems a little more complicated.
> >
>
> I have investigated FSP 2.0 architecture before, and IIRC your
> understanding is correct. Unfortunately I did not get a chance to
> support one of the Apollo Lake CRB.
>
> > I'm thinking of introducing a Kconfig for this and moving the existing
> > fsp implementation into an arch/x86/lib/fsp1 directory and adding an
> > fsp2 there also. What do you think? Have you done anything with this
> > newer version?
> >
>
> Sounds good to me. I have a Oxbow Hill CRB here. If it is the same
> board you want to support, I can help testing.

I'm going to support coral I think, a Chromebook.

You may have seen the binman support for IFWI, etc. I have some
patches to move the FSP code around (u-boot-dm/coral-working). So far
it only boots into TPL. I'm aiming to have some patches for it to boot
to a prompt sometime in late August.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/1] test: dm_mdio: avoid out of bounds access

2019-07-30 Thread Joe Hershberger
On Tue, Jul 30, 2019 at 4:49 PM Heinrich Schuchardt  wrote:
>
> SANDBOX_PHY_REG_CNT is not an allowable index for the array
> u16 reg[SANDBOX_PHY_REG_CNT].
>
> Identified by cppcheck.
>
> Fixes: b47edf8069cc ("test: dm_mdio: add a 2nd register to the emulated PHY")
> Signed-off-by: Heinrich Schuchardt 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] drivers: net: pfe_eth: undefined return value

2019-07-30 Thread Joe Hershberger
On Tue, Jul 30, 2019 at 5:01 PM Heinrich Schuchardt  wrote:
>
> Do not use random value from stack as return value of pfe_phy_write().
>
> Indicated by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] net: mvpp2: support setting hardware addresses from ethernet core

2019-07-30 Thread Joe Hershberger
On Tue, Jul 30, 2019 at 8:41 AM Matt Pelland  wrote:
>
> mvpp2 already has support for setting MAC addresses but this
> functionality was not exposed to the ethernet core. This commit exposes
> this functionality so that MAC address assignments stored in U-Boot's
> environment are correctly applied before Linux boots.
>
> Signed-off-by: Matt Pelland 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] drivers: net: pfe_eth: undefined return value

2019-07-30 Thread Heinrich Schuchardt
Do not use random value from stack as return value of pfe_phy_write().

Indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/net/pfe_eth/pfe_mdio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/pfe_eth/pfe_mdio.c b/drivers/net/pfe_eth/pfe_mdio.c
index 2dde9e7ac8..62309670fa 100644
--- a/drivers/net/pfe_eth/pfe_mdio.c
+++ b/drivers/net/pfe_eth/pfe_mdio.c
@@ -110,7 +110,6 @@ static int pfe_phy_write(struct mii_dev *bus, int phy_addr, 
int dev_addr,
u32 phy;
u32 reg_data;
int timeout = MDIO_TIMEOUT;
-   int val;

if (dev_addr == MDIO_DEVAD_NONE) {
reg = ((reg_addr & EMAC_MII_DATA_RA_MASK) <<
@@ -150,7 +149,7 @@ static int pfe_phy_write(struct mii_dev *bus, int phy_addr, 
int dev_addr,
debug("%s: phy: %02x reg:%02x val:%#x\n", __func__, phy_addr,
  reg_addr, data);

-   return val;
+   return 0;
 }

 static void pfe_configure_serdes(struct pfe_eth_dev *priv)
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/2] net: Fix Covarity Defect 244093

2019-07-30 Thread Joe Hershberger
Don't allow unterminated strings

Signed-off-by: Joe Hershberger 
---

 net/mdio-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index 36a404ff44..1c0d25272a 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -75,7 +75,7 @@ static int dm_mdio_post_probe(struct udevice *dev)
pdata->mii_bus->write = mdio_write;
pdata->mii_bus->reset = mdio_reset;
pdata->mii_bus->priv = dev;
-   strncpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN);
+   strncpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN - 1);
 
return mdio_register(pdata->mii_bus);
 }
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] net: mdio: Clarify code flow Covarity 244085 & 244090

2019-07-30 Thread Joe Hershberger
Document that the lack of breaks is intentional.

Signed-off-by: Joe Hershberger 
---

 cmd/mdio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/mdio.c b/cmd/mdio.c
index add6440813..22c8fbe856 100644
--- a/cmd/mdio.c
+++ b/cmd/mdio.c
@@ -253,12 +253,13 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
case 'w':
if (pos > 1)
data = simple_strtoul(argv[pos--], NULL, 16);
+   /* Intentional fall-through - Get reg for read and write */
case 'r':
if (pos > 1)
if (extract_reg_range(argv[pos--], , ,
  , ))
return CMD_RET_FAILURE;
-
+   /* Intentional fall-through - Get phy for all commands */
default:
if (pos > 1)
if (extract_phy_range([2], pos - 1, ,
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 32/39] env: Rename the redundancy flags

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:27 AM Simon Glass  wrote:
>
> Add an ENV prefix to these two flags so that it is clear what they relate
> to. Also move them to env.h since they are part of the public API. Use an
> enum rather than a #define to tie them together.
>
> Signed-off-by: Simon Glass 
> ---
>
>  cmd/nvedit.c  |  2 +-
>  env/eeprom.c  | 10 ++
>  env/flash.c   | 18 ++
>  env/sf.c  |  6 ++
>  include/env.h |  6 ++
>  include/environment.h |  5 +
>  tools/env/fw_env.c| 23 +--
>  7 files changed, 39 insertions(+), 31 deletions(-)
>
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index 7908d6cf0c..d6a86abb03 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -1014,7 +1014,7 @@ NXTARG:   ;
> envp->crc = crc32(0, envp->data,
> size ? size - offsetof(env_t, data) : 
> ENV_SIZE);
>  #ifdef CONFIG_ENV_ADDR_REDUND
> -   envp->flags = ACTIVE_FLAG;
> +   envp->flags = ENVF_REDUND_ACTIVE;
>  #endif
> }
> env_set_hex("filesize", len + offsetof(env_t, data));
> diff --git a/env/eeprom.c b/env/eeprom.c
> index 8d82cf892c..0c30ca459c 100644
> --- a/env/eeprom.c
> +++ b/env/eeprom.c
> @@ -132,9 +132,11 @@ static int env_eeprom_load(void)
> gd->env_valid = ENV_REDUND;
> } else {
> /* both ok - check serial */
> -   if (flags[0] == ACTIVE_FLAG && flags[1] == OBSOLETE_FLAG)
> +   if (flags[0] == ENVF_REDUND_ACTIVE &&
> +   flags[1] == ENVF_REDUND_OBSOLETE)
> gd->env_valid = ENV_VALID;
> -   else if (flags[0] == OBSOLETE_FLAG && flags[1] == ACTIVE_FLAG)
> +   else if (flags[0] == ENVF_REDUND_OBSOLETE &&
> +flags[1] == ENVF_REDUND_ACTIVE)
> gd->env_valid = ENV_REDUND;
> else if (flags[0] == 0xFF && flags[1] == 0)
> gd->env_valid = ENV_REDUND;
> @@ -194,7 +196,7 @@ static int env_eeprom_save(void)
> unsigned int off= CONFIG_ENV_OFFSET;
>  #ifdef CONFIG_ENV_OFFSET_REDUND
> unsigned int off_red= CONFIG_ENV_OFFSET_REDUND;
> -   char flag_obsolete  = OBSOLETE_FLAG;
> +   char flag_obsolete  = ENVF_REDUND_OBSOLETE;
>  #endif
>
> rc = env_export(_new);
> @@ -207,7 +209,7 @@ static int env_eeprom_save(void)
> off_red = CONFIG_ENV_OFFSET;
> }
>
> -   env_new.flags = ACTIVE_FLAG;
> +   env_new.flags = ENVF_REDUND_ACTIVE;
>  #endif
>
> rc = eeprom_bus_write(CONFIG_SYS_DEF_EEPROM_ADDR,
> diff --git a/env/flash.c b/env/flash.c
> index 7a73466cf2..9566dd7f05 100644
> --- a/env/flash.c
> +++ b/env/flash.c
> @@ -95,10 +95,12 @@ static int env_flash_init(void)
> } else if (!crc1_ok && !crc2_ok) {
> gd->env_addr= addr_default;
> gd->env_valid   = ENV_INVALID;
> -   } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
> +   } else if (flag1 == ENVF_REDUND_ACTIVE &&
> +  flag2 == ENVF_REDUND_OBSOLETE) {
> gd->env_addr= addr1;
> gd->env_valid   = ENV_VALID;
> -   } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
> +   } else if (flag1 == ENVF_REDUND_OBSOLETE &&
> +  flag2 == ENVF_REDUND_ACTIVE) {
> gd->env_addr= addr2;
> gd->env_valid   = ENV_VALID;
> } else if (flag1 == flag2) {
> @@ -121,7 +123,7 @@ static int env_flash_save(void)
>  {
> env_t   env_new;
> char*saved_data = NULL;
> -   charflag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
> +   charflag = ENVF_REDUND_OBSOLETE, new_flag = ENVF_REDUND_ACTIVE;
> int rc = 1;
>  #if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
> ulong   up_data = 0;
> @@ -322,9 +324,9 @@ static int env_flash_load(void)
> end_addr_new = ltmp;
> }
>
> -   if (flash_addr_new->flags != OBSOLETE_FLAG &&
> +   if (flash_addr_new->flags != ENVF_REDUND_OBSOLETE &&
> crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) {
> -   char flag = OBSOLETE_FLAG;
> +   char flag = ENVF_REDUND_OBSOLETE;
>
> gd->env_valid = ENV_REDUND;
> flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new);
> @@ -334,9 +336,9 @@ static int env_flash_load(void)
> flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new);
> }
>
> -   if (flash_addr->flags != ACTIVE_FLAG &&
> -   (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) {
> -   char flag = ACTIVE_FLAG;
> +   if (flash_addr->flags != ENVF_REDUND_ACTIVE &&
> +   (flash_addr->flags & ENVF_REDUND_ACTIVE) == ENVF_REDUND_ACTIVE) {
> +   char flag = ENVF_REDUND_ACTIVE;
>
>

[U-Boot] [PATCH v2 1/1] test: dm_mdio: avoid out of bounds access

2019-07-30 Thread Heinrich Schuchardt
SANDBOX_PHY_REG_CNT is not an allowable index for the array
u16 reg[SANDBOX_PHY_REG_CNT].

Identified by cppcheck.

Fixes: b47edf8069cc ("test: dm_mdio: add a 2nd register to the emulated PHY")
Signed-off-by: Heinrich Schuchardt 
---
v2
the same error occurs twice
---
 drivers/net/mdio_sandbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mdio_sandbox.c b/drivers/net/mdio_sandbox.c
index df053f5381..b731f60a98 100644
--- a/drivers/net/mdio_sandbox.c
+++ b/drivers/net/mdio_sandbox.c
@@ -27,7 +27,7 @@ static int mdio_sandbox_read(struct udevice *dev, int addr, 
int devad, int reg)
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
-   if (reg < 0 || reg > SANDBOX_PHY_REG_CNT)
+   if (reg < 0 || reg >= SANDBOX_PHY_REG_CNT)
return -ENODEV;

return priv->reg[reg];
@@ -45,7 +45,7 @@ static int mdio_sandbox_write(struct udevice *dev, int addr, 
int devad, int reg,
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
-   if (reg < 0 || reg > SANDBOX_PHY_REG_CNT)
+   if (reg < 0 || reg >= SANDBOX_PHY_REG_CNT)
return -ENODEV;

priv->reg[reg] = val;
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] test: dm_mdio: avoid out of bounds access

2019-07-30 Thread Heinrich Schuchardt
SANDBOX_PHY_REG_CNT is not an allowable index for the array
u16 reg[SANDBOX_PHY_REG_CNT].

Identified by cppcheck.

Fixes: b47edf8069cc ("test: dm_mdio: add a 2nd register to the emulated PHY")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/net/mdio_sandbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mdio_sandbox.c b/drivers/net/mdio_sandbox.c
index df053f5381..8b2a11036f 100644
--- a/drivers/net/mdio_sandbox.c
+++ b/drivers/net/mdio_sandbox.c
@@ -27,7 +27,7 @@ static int mdio_sandbox_read(struct udevice *dev, int addr, 
int devad, int reg)
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
-   if (reg < 0 || reg > SANDBOX_PHY_REG_CNT)
+   if (reg < 0 || reg >= SANDBOX_PHY_REG_CNT)
return -ENODEV;

return priv->reg[reg];
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 31/39] env: Drop _ENTRY

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:28 AM Simon Glass  wrote:
>
> This typedef does not need to be defined in the search.h header since it
> is only used in one file (hashtable.c). Remove it from the header and
> change it to a struct.
>
> Signed-off-by: Simon Glass 
> ---
>
>  include/search.h | 2 +-
>  lib/hashtable.c  | 7 ---
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/search.h b/include/search.h
> index efa8bcbef6..c99648f80b 100644
> --- a/include/search.h
> +++ b/include/search.h
> @@ -42,7 +42,7 @@ struct env_entry {
>
>  /* Data type for reentrant functions.  */
>  struct hsearch_data {
> -   struct _ENTRY *table;
> +   struct env_entry_node *table;

Don't you need an opaque definition of this?

Also, there is an opaque definition of _ENTRY in this file that needs
to go away.

> unsigned int size;
> unsigned int filled;
>  /*
> diff --git a/lib/hashtable.c b/lib/hashtable.c
> index c77b68f4e6..1093d8adaa 100644
> --- a/lib/hashtable.c
> +++ b/lib/hashtable.c
> @@ -59,10 +59,10 @@
>   * which describes the current status.
>   */
>
> -typedef struct _ENTRY {
> +struct env_entry_node {
> int used;
> struct env_entry entry;
> -} _ENTRY;
> +};
>
>
>  static void _hdelete(const char *key, struct hsearch_data *htab,
> @@ -120,7 +120,8 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)
> htab->filled = 0;
>
> /* allocate memory and zero out */
> -   htab->table = (_ENTRY *) calloc(htab->size + 1, sizeof(_ENTRY));
> +   htab->table = (struct env_entry_node *)calloc(htab->size + 1,
> +   sizeof(struct 
> env_entry_node));
> if (htab->table == NULL)
> return 0;
>
> --
> 2.22.0.709.g102302147b-goog
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 34/39] env: Drop the double underscores in search.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:29 AM Simon Glass  wrote:
>
> There doesn't seem to be any good reason for using __ in the arguments in
> this header file. A double underscore is usually reserved for compiler
> features.
>
> Drop these and remove the unnecessary 'extern' as well.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] nand: davinci: avoid out of bounds array access

2019-07-30 Thread Heinrich Schuchardt
The array bounds have to be checked before accessing the array element.

Identified by cppcheck.

Fixes: 67ac6ffaeefb ("mtd: nand: davinci: add opportunity to write keystone 
U-boot image")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/mtd/nand/raw/davinci_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index 33c2f16be8..724bbee752 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -739,8 +739,8 @@ static void davinci_nand_init(struct nand_chip *nand)

layout = _keystone_rbl_4bit_layout_oobfirst;
layout->oobavail = 0;
-   for (i = 0; layout->oobfree[i].length &&
-i < ARRAY_SIZE(layout->oobfree); i++)
+   for (i = 0; i < ARRAY_SIZE(layout->oobfree) &&
+layout->oobfree[i].length; i++)
layout->oobavail += layout->oobfree[i].length;

nand->write_page = nand_davinci_write_page;
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 29/39] env: Move callback definitions to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:28 AM Simon Glass  wrote:
>
> These definitions are effectively part of the 'public' API of the
> environment implementation since they do not require access to any
> internal variables. Move them to the env.h header.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 27/39] env: Rename environment to embedded_environment

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:29 AM Simon Glass  wrote:
>
> The name 'environment' is widely used in U-Boot so is not a very useful
> name of a variable. Rename it to better indicate its purpose.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 26/39] env: Move env_reloc() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:29 AM Simon Glass  wrote:
>
> Move env_reloc() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 23/39] env: Drop env_crc_update()

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:27 AM Simon Glass  wrote:
>
> This function is not defined or used in U-Boot. Drop it.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 25/39] env: Move env_get_char() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:26 AM Simon Glass  wrote:
>
> Move env_get_char() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 36/39] env: Drop environment.h header file where not needed

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:24 AM Simon Glass  wrote:
>
> This header file is now only used by files that access internal
> environment features. Drop it from various places where it is not needed.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 16/39] env: Move env_set() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:24 AM Simon Glass  wrote:
>
> Move env_set() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 30/39] env: Drop the ENTRY typdef

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:24 AM Simon Glass  wrote:
>
> U-Boot is not supposed to use typedef for structs anymore. Also this name
> is the same as the ENTRY() macro used in assembler files, and 'entry'
> itself is widely used in U-Boot (>8k matches).
>
> Drop the typedef and rename the struct to env_entry to reduce confusion.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 35/39] env: Move TOTAL_MALLOC_LEN to environment.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:24 AM Simon Glass  wrote:
>
> This declaration is only used in three files. Although it relates to
> malloc() it is actually only used during malloc() init. It uses CONFIG
> options including CONFIG_ENV_ADDR which are defined only in environment.h
> so this header must be included anyway, for TOTAL_MALLOC_LEN to be
> correct.
>
> Nove it to environment.h to simplify the common file.

Nove -> Move

>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 33/39] env: Drop the ACTION typedef

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:22 AM Simon Glass  wrote:
>
> Avoid using a typedef here which is unnecessary. Add an 'env_' prefix to
> both the enum and its members to make it clear that these are related to
> the environment.
>
> Add an ENV prefix to these two flags so that it is clear what they relate
> too. Also move them to env.h since they are part of the public API. Use an

too -> to

> enum rather than a #define to tie them together.
>
> Signed-off-by: Simon Glass 
> ---
>
>  api/api.c |  2 +-
>  cmd/nvedit.c  |  8 
>  drivers/tee/sandbox.c |  6 +++---
>  env/callback.c|  2 +-
>  env/flags.c   |  2 +-
>  include/search.h  | 16 
>  lib/hashtable.c   | 18 +-
>  test/env/hashtable.c  |  8 
>  8 files changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/api/api.c b/api/api.c
> index a0fc62ca9e..5e7c8149bf 100644
> --- a/api/api.c
> +++ b/api/api.c
> @@ -514,7 +514,7 @@ static int API_env_enum(va_list ap)
> if (s != NULL)
> *s = 0;
> search.key = var;
> -   i = hsearch_r(search, FIND, , _htab, 0);
> +   i = hsearch_r(search, ENVA_FIND, , _htab, 0);
> if (i == 0) {
> i = API_EINVAL;
> goto done;
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index d6a86abb03..3d244951b0 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -98,7 +98,7 @@ static int env_print(char *name, int flag)
>
> e.key = name;
> e.data = NULL;
> -   hsearch_r(e, FIND, , _htab, flag);
> +   hsearch_r(e, ENVA_FIND, , _htab, flag);
> if (ep == NULL)
> return 0;
> len = printf("%s=%s\n", ep->key, ep->data);
> @@ -288,7 +288,7 @@ static int _do_env_set(int flag, int argc, char * const 
> argv[], int env_flag)
>
> e.key   = name;
> e.data  = value;
> -   hsearch_r(e, ENTER, , _htab, env_flag);
> +   hsearch_r(e, ENVA_ENTER, , _htab, env_flag);
> free(value);
> if (!ep) {
> printf("## Error inserting \"%s\" variable, errno=%d\n",
> @@ -680,7 +680,7 @@ char *env_get(const char *name)
>
> e.key   = name;
> e.data  = NULL;
> -   hsearch_r(e, FIND, , _htab, 0);
> +   hsearch_r(e, ENVA_FIND, , _htab, 0);
>
> return ep ? ep->data : NULL;
> }
> @@ -1281,7 +1281,7 @@ static int do_env_exists(cmd_tbl_t *cmdtp, int flag, 
> int argc,
>
> e.key = argv[1];
> e.data = NULL;
> -   hsearch_r(e, FIND, , _htab, 0);
> +   hsearch_r(e, ENVA_FIND, , _htab, 0);
>
> return (ep == NULL) ? 1 : 0;
>  }
> diff --git a/drivers/tee/sandbox.c b/drivers/tee/sandbox.c
> index 4bbcf74967..0561957067 100644
> --- a/drivers/tee/sandbox.c
> +++ b/drivers/tee/sandbox.c
> @@ -174,7 +174,7 @@ static u32 ta_avb_invoke_func(struct udevice *dev, u32 
> func, uint num_params,
>
> e.key = name;
> e.data = NULL;
> -   hsearch_r(e, FIND, , >pstorage_htab, 0);
> +   hsearch_r(e, ENVA_FIND, , >pstorage_htab, 0);
> if (!ep)
> return TEE_ERROR_ITEM_NOT_FOUND;
>
> @@ -198,13 +198,13 @@ static u32 ta_avb_invoke_func(struct udevice *dev, u32 
> func, uint num_params,
>
> e.key = name;
> e.data = NULL;
> -   hsearch_r(e, FIND, , >pstorage_htab, 0);
> +   hsearch_r(e, ENVA_FIND, , >pstorage_htab, 0);
> if (ep)
> hdelete_r(e.key, >pstorage_htab, 0);
>
> e.key = name;
> e.data = value;
> -   hsearch_r(e, ENTER, , >pstorage_htab, 0);
> +   hsearch_r(e, ENVA_ENTER, , >pstorage_htab, 0);
> if (!ep)
> return TEE_ERROR_OUT_OF_MEMORY;
>
> diff --git a/env/callback.c b/env/callback.c
> index d539da93aa..9bfa744921 100644
> --- a/env/callback.c
> +++ b/env/callback.c
> @@ -98,7 +98,7 @@ static int set_callback(const char *name, const char 
> *value, void *priv)
> e.key   = name;
> e.data  = NULL;
> e.callback = NULL;
> -   hsearch_r(e, FIND, , _htab, 0);
> +   hsearch_r(e, ENVA_FIND, , _htab, 0);
>
> /* does the env variable actually exist? */
> if (ep != NULL) {
> diff --git a/env/flags.c b/env/flags.c
> index fdbad7bf33..388c2f184b 100644
> --- a/env/flags.c
> +++ b/env/flags.c
> @@ -458,7 +458,7 @@ static int set_flags(const char *name, const char *value, 
> void *priv)
> e.key   = name;
> e.data  = NULL;
> e.callback = NULL;
> -   hsearch_r(e, FIND, , _htab, 0);
> +   hsearch_r(e, ENVA_FIND, , _htab, 0);
>
> /* does the env variable actually exist? */
> if (ep != NULL) {
> diff --git a/include/search.h 

Re: [U-Boot] [PATCH 12/39] env: Move env_set_ulong() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:22 AM Simon Glass  wrote:
>
> Move env_set_ulong() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 17/39] env: Move env_get() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:22 AM Simon Glass  wrote:
>
> Move env_get() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] clk: meson: remove duplicate logic

2019-07-30 Thread Heinrich Schuchardt
First thing we check in meson_clk_set_rate_by_id() is current_rate == rate.
There is not need to check it again.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/clk/meson/gxbb.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
index 2cb53fb92d..abb5337e78 100644
--- a/drivers/clk/meson/gxbb.c
+++ b/drivers/clk/meson/gxbb.c
@@ -823,10 +823,7 @@ static ulong meson_clk_set_rate_by_id(struct clk *clk, 
unsigned long id,
case CLKID_MPLL1:
case CLKID_MPLL2:
case CLKID_CLK81:
-   if (current_rate != rate)
-   return -EINVAL;
-
-   return 0;
+   return -EINVAL;
case CLKID_VPU:
return meson_clk_set_rate_by_id(clk,
meson_mux_get_parent(clk, CLKID_VPU), rate,
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 37/39] env: Rename environment.h to env_internal.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:22 AM Simon Glass  wrote:
>
> This file contains lots of internal details about the environment. Most
> code can include env.h instead, calling the functions there as needed.
>
> Rename this file and add a comment at the top to indicate its internal
> nature.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 10/39] env: Move envmatch() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:15 AM Simon Glass  wrote:
>
> Move envmatch() over to the new header file. Also rename it to env_match()
> to better line up with other functions.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 19/39] env: Move uncommon functions to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:21 AM Simon Glass  wrote:
>
> Move eth_parse_enetaddr() and env_fix_drivers() over to the new header
> file.
>
> Signed-off-by: Simon Glass 
> ---
>
>  cmd/ethsw.c   |  1 +
>  include/env.h | 16 
>  include/environment.h |  7 ---
>  3 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/cmd/ethsw.c b/cmd/ethsw.c
> index 473324f878..0b57a69f2f 100644
> --- a/cmd/ethsw.c
> +++ b/cmd/ethsw.c
> @@ -7,6 +7,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/include/env.h b/include/env.h
> index 2e9a850284..924b327c44 100644
> --- a/include/env.h
> +++ b/include/env.h
> @@ -182,4 +182,20 @@ int eth_env_get_enetaddr(const char *name, uint8_t 
> *enetaddr);
>   */
>  int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr);
>
> +/**
> + * eth_parse_enetaddr() - Parse a MAC address
> + *
> + * Convert a string MAC address
> + *
> + * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 
> 2-digit
> + * hex value
> + * @enetaddr: Place to put MAC address (6 bytes)
> + */
> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);

It seems like this should move to include/net.h

> +
> +/**
> + * env_fix_drivers() - Updates envdriver as per relocation
> + */
> +void env_fix_drivers(void);
> +
>  #endif
> diff --git a/include/environment.h b/include/environment.h
> index 77915f459e..7be1ef98ad 100644
> --- a/include/environment.h
> +++ b/include/environment.h
> @@ -320,13 +320,6 @@ int env_save(void);
>   */
>  int env_erase(void);
>
> -/**
> - * env_fix_drivers() - Updates envdriver as per relocation
> - */
> -void env_fix_drivers(void);
> -
> -void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
> -
>  #endif /* DO_DEPS_ONLY */
>
>  #endif /* _ENVIRONMENT_H_ */
> --
> 2.22.0.709.g102302147b-goog
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 20/39] env: Move set_default_vars to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:21 AM Simon Glass  wrote:
>
> Move this function to the new header file and rename it so it has an env_
> prefix.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 22/39] env: Move env import/export functions to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:20 AM Simon Glass  wrote:
>
> Move these functions to the new header file.
>
> Signed-off-by: Simon Glass 

Nit below.

Acked-by: Joe Hershberger 

>
>  include/env.h | 38 ++
>  include/environment.h | 12 
>  2 files changed, 38 insertions(+), 12 deletions(-)
>
> diff --git a/include/env.h b/include/env.h
> index 2ba345fc4a..d6718fdf99 100644
> --- a/include/env.h
> +++ b/include/env.h
> @@ -12,6 +12,8 @@
>  #include 
>  #include 
>
> +struct environment_s;
> +
>  /**
>   * env_get_id() - Gets a sequence number for the environment
>   *
> @@ -230,4 +232,40 @@ int env_save(void);
>   */
>  int env_erase(void);
>
> +/**
> + * env_import() - Import from a binary representation into hash table
> + *
> + * This imports the environment from a buffer. THe format for each variable 
> is

The

> + * var=value\0 with a double \0 at the end of the buffer.
> + *
> + * @buf: Buffer containing the environment (struct environemnt_s *)
> + * @check: non-zero to check the CRC at the start of the environment, 0 to
> + * ignore it
> + * @return 0 if imported successfully, -ENOMSG if the CRC was bad, -EIO if
> + * something else went wrong
> + */
> +int env_import(const char *buf, int check);
> +
> +/**
> + * env_export() - Export the environment to a buffer
> + *
> + * Export from hash table into binary representation
> + *
> + * @env_out: Buffer to contain the environment (must be large enough!)
> + * @return 0 if OK, 1 on error
> + */
> +int env_export(struct environment_s *env_out);
> +
> +/**
> + * env_import_redund() - Select and import one of two redundant environments
> + *
> + * @buf1: First environment (struct environemnt_s *)
> + * @buf1_read_fail: 0 if buf1 is valid, non-zero if invalid
> + * @buf2: Second environment (struct environemnt_s *)
> + * @buf2_read_fail: 0 if buf2 is valid, non-zero if invalid
> + * @return 0 if OK, -EIO if no environment is valid, -ENOMSG if the CRC was 
> bad
> + */
> +int env_import_redund(const char *buf1, int buf1_read_fail,
> + const char *buf2, int buf2_read_fail);
> +
>  #endif
> diff --git a/include/environment.h b/include/environment.h
> index b921b8f28e..c740d5a216 100644
> --- a/include/environment.h
> +++ b/include/environment.h
> @@ -274,18 +274,6 @@ char *env_get_default(const char *name);
>  /* [re]set to the default environment */
>  void set_default_env(const char *s, int flags);
>
> -/* Import from binary representation into hash table */
> -int env_import(const char *buf, int check);
> -
> -/* Export from hash table into binary representation */
> -int env_export(env_t *env_out);
> -
> -#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
> -/* Select and import one of two redundant environments */
> -int env_import_redund(const char *buf1, int buf1_status,
> - const char *buf2, int buf2_status);
> -#endif
> -
>  /**
>   * env_get_char() - Get a character from the early environment
>   *
> --
> 2.22.0.709.g102302147b-goog
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 21/39] env: Move env_load/save functions to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:19 AM Simon Glass  wrote:
>
> Move these function to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 28/39] env: Move env_valid to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:19 AM Simon Glass  wrote:
>
> This enum is somewhat widely used to determine if the environment is valid
> or not. Move it to the common environment header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 18/39] env: Move eth_env_get/set_enetaddr() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:16 AM Simon Glass  wrote:
>
> Move these two functions over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 24/39] env: Move get/set_default_env() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:12 AM Simon Glass  wrote:
>
> Move these functions to the new header file and rename set_default_env()
> to env_set_default() so that it has a consistent env_ prefix.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 13/39] env: Move env_get_ulong() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:09 AM Simon Glass  wrote:
>
> Move env_get_ulong() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 08/39] env: Move env_init() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:16 AM Simon Glass  wrote:
>
> Move env_init() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 05/10] bios_emulator: Add some VESA interface debugging

2019-07-30 Thread Heinrich Schuchardt

On 12/30/14 3:32 AM, Simon Glass wrote:

Allow the supported modes to be listed when in debug mode.

Signed-off-by: Simon Glass 
---

  drivers/bios_emulator/atibios.c | 161 +++-
  include/vbe.h   |   9 ++-
  2 files changed, 148 insertions(+), 22 deletions(-)

diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index 93b815c..7ea5fa6 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -62,40 +62,158 @@ static u32 saveBaseAddress14;
  static u32 saveBaseAddress18;
  static u32 saveBaseAddress20;

-static void atibios_set_vesa_mode(RMREGS *regs, int vesa_mode,
- struct vbe_mode_info *mode_info)
+/* Addres im memory of VBE region */
+const int vbe_offset = 0x2000;
+
+static const void *bios_ptr(const void *buf, BE_VGAInfo *vga_info,
+   u32 x86_dword_ptr)
+{
+   u32 seg_ofs, flat;
+
+   seg_ofs = le32_to_cpu(x86_dword_ptr);
+   flat = ((seg_ofs & 0x) >> 12) | (seg_ofs & 0x);
+   if (flat >= 0xc)
+   return vga_info->BIOSImage + flat - 0xc;
+   else
+   return buf + (flat - vbe_offset);
+}
+
+static int atibios_debug_mode(BE_VGAInfo *vga_info, RMREGS *regs,
+ int vesa_mode, struct vbe_mode_info *mode_info)
+{
+   void *buffer = (void *)(M.mem_base + vbe_offset);
+   u16 buffer_seg = (((unsigned long)vbe_offset) >> 4) & 0xff00;
+   u16 buffer_adr = ((unsigned long)vbe_offset) & 0x;
+   struct vesa_mode_info *vm;
+   struct vbe_info *info;
+   const u16 *modes_bios, *ptr;
+   u16 *modes;
+   int size;
+
+   debug("VBE: Getting information\n");
+   regs->e.eax = VESA_GET_INFO;
+   regs->e.esi = buffer_seg;
+   regs->e.edi = buffer_adr;
+   info = buffer;
+   memset(info, '\0', sizeof(*info));
+   strcpy(info->signature, "VBE2");
+   BE_int86(0x10, regs, regs);
+   if (regs->e.eax != 0x4f) {
+   debug("VESA_GET_INFO: error %x\n", regs->e.eax);
+   return -ENOSYS;
+   }
+   debug("version %x\n", le16_to_cpu(info->version));
+   debug("oem '%s'\n", (char *)bios_ptr(buffer, vga_info,
+info->oem_string_ptr));
+   debug("vendor '%s'\n", (char *)bios_ptr(buffer, vga_info,
+   info->vendor_name_ptr));
+   debug("product '%s'\n", (char *)bios_ptr(buffer, vga_info,
+info->product_name_ptr));
+   debug("rev '%s'\n", (char *)bios_ptr(buffer, vga_info,
+info->product_rev_ptr));
+   modes_bios = bios_ptr(buffer, vga_info, info->modes_ptr);
+   debug("Modes: ");
+   for (ptr = modes_bios; *ptr != 0x; ptr++)
+   debug("%x ", le16_to_cpu(*ptr));
+   debug("\nmemory %dMB\n", le16_to_cpu(info->total_memory) >> 4);
+   size = (ptr - modes_bios) * sizeof(u16) + 2;
+   modes = malloc(size);
+   if (!modes)
+   return -ENOMEM;
+   memcpy(modes, modes_bios, size);
+
+   regs->e.eax = VESA_GET_CUR_MODE;
+   BE_int86(0x10, regs, regs);
+   if (regs->e.eax != 0x4f) {
+   debug("VESA_GET_CUR_MODE: error %x\n", regs->e.eax);
+   return -ENOSYS;
+   }
+   debug("Current mode %x\n", regs->e.ebx);
+
+   for (ptr = modes; *ptr != 0x; ptr++) {
+   int mode = le16_to_cpu(*ptr);
+   bool linear_ok;
+   int attr;
+
+   break;


There is a lot of dead code following. Has this break been left over
from debugging? Or should the whole loop be eliminated?

Best regards

Heinrich


+   debug("Mode %x: ", mode);
+   memset(buffer, '\0', sizeof(struct vbe_mode_info));
+   regs->e.eax = VESA_GET_MODE_INFO;
+   regs->e.ebx = 0;
+   regs->e.ecx = mode;
+   regs->e.edx = 0;
+   regs->e.esi = buffer_seg;
+   regs->e.edi = buffer_adr;
+   BE_int86(0x10, regs, regs);
+   if (regs->e.eax != 0x4f) {
+   debug("VESA_GET_MODE_INFO: error %x\n", regs->e.eax);
+   continue;
+   }
+   memcpy(mode_info->mode_info_block, buffer,
+  sizeof(struct vesa_mode_info));
+   mode_info->valid = true;
+   vm = _info->vesa;
+   attr = le16_to_cpu(vm->mode_attributes);
+   linear_ok = attr & 0x80;
+   debug("res %d x %d, %d bpp, mm %d, (Linear %s, attr %02x)\n",
+ le16_to_cpu(vm->x_resolution),
+ le16_to_cpu(vm->y_resolution),
+ vm->bits_per_pixel, vm->memory_model,
+ linear_ok ? "OK" : "not available",
+ attr);
+ 

Re: [U-Boot] [PATCH 05/39] env: Create a new file for environment functions

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:12 AM Simon Glass  wrote:
>
> At present we have environment.h but this file includes all the
> environment-related header files as well as internals such as
> default_environment.
>
> It seems desirable to have a new header to hold the commonly used
> environment functions, so that most files can avoid including all of this
> unnecessary stuff.
>
> Create a new env.h header and move one function over to it.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 06/39] env: Move get_env_id() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:11 AM Simon Glass  wrote:
>
> Move this function over to the new header file. Also rename it to have an
> env_ prefix like the other functions.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 07/39] env: Move env_get_f() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:11 AM Simon Glass  wrote:
>
> Move this function over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 11/39] env: Move env_set_hex() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:10 AM Simon Glass  wrote:
>
> Move env_set_hex() over to the new header file along with env_set_addr()
> which uses it.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 14/39] env: Move env_get_yesno() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:10 AM Simon Glass  wrote:
>
> Move env_get_yesno() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 15/39] env: Move env_get_hex() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:09 AM Simon Glass  wrote:
>
> Move env_get_hex() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 09/39] env: Move env_relocate() to env.h

2019-07-30 Thread Joe Hershberger
On Sun, Jul 28, 2019 at 9:09 AM Simon Glass  wrote:
>
> Move env_relocate() over to the new header file.
>
> Signed-off-by: Simon Glass 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] armv8: ls1028a: add icid setup for platform devices

2019-07-30 Thread Horia Geanta
On 7/30/2019 5:30 PM, laurentiu.tu...@nxp.com wrote:
> From: Laurentiu Tudor 
> 
> Add ICID setup for the platform devices contained on this chip: usb,
> sata, sdhc, edma, qdma, gpu, display and sec.
> 
> Signed-off-by: Laurentiu Tudor 
Reviewed-by: Horia Geantă 

Thanks,
Horia
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/5] armv8: ls1088a: add icid setup for platform devices

2019-07-30 Thread Horia Geanta
On 7/30/2019 5:30 PM, laurentiu.tu...@nxp.com wrote:
> From: Laurentiu Tudor 
> 
> Add ICID setup for the platform devices contained on this chip: usb,
> sata, sdhc, sec. The ICID macros for SEC needed to be adapted because
> the format of the registers is different.
> 
> Signed-off-by: Laurentiu Tudor 
Reviewed-by: Horia Geantă 

Thanks,
Horia
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/5] armv8: fsl-layerscape: make icid setup endianness aware

2019-07-30 Thread Horia Geanta
On 7/30/2019 5:30 PM, laurentiu.tu...@nxp.com wrote:
> From: Laurentiu Tudor 
> 
> The current implementation assumes that the registers holding the ICIDs
> are universally big endian. That's no longer the case on newer
> platforms so update the code to take into account the endianness of
> each register.
> 
> Signed-off-by: Laurentiu Tudor 
Reviewed-by: Horia Geantă 

Thanks,
Horia

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] armv8: fsl-layerscape: add missing sec jr base address defines

2019-07-30 Thread Horia Geanta
On 7/30/2019 5:30 PM, laurentiu.tu...@nxp.com wrote:
> From: Laurentiu Tudor 
> 
> Add defines for all the SEC job rings base addresses.
> 
> Signed-off-by: Laurentiu Tudor 
Reviewed-by: Horia Geantă 

Thanks,
Horia
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] efi_loader: definition of efi_virtual_address_map()

2019-07-30 Thread Heinrich Schuchardt
Use efi_uintn_t where the UEFI spec uses UINTN. Use efi_uintn_t also for
the result of the division of two efi_uintn_t.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 include/efi_api.h|  4 ++--
 lib/efi_loader/efi_runtime.c | 14 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index d4f32dbdc8..e5634dc6a0 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -238,8 +238,8 @@ struct efi_runtime_services {
efi_status_t (EFIAPI *set_wakeup_time)(char enabled,
struct efi_time *time);
efi_status_t (EFIAPI *set_virtual_address_map)(
-   unsigned long memory_map_size,
-   unsigned long descriptor_size,
+   efi_uintn_t memory_map_size,
+   efi_uintn_t descriptor_size,
uint32_t descriptor_version,
struct efi_mem_desc *virtmap);
efi_status_t (EFIAPI *convert_pointer)(
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 8b56ab0207..a8f0b5eae3 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -427,8 +427,8 @@ void efi_runtime_detach(void)
  * Return: status code EFI_UNSUPPORTED
  */
 static __efi_runtime efi_status_t EFIAPI efi_set_virtual_address_map_runtime(
-   unsigned long memory_map_size,
-   unsigned long descriptor_size,
+   efi_uintn_t memory_map_size,
+   efi_uintn_t descriptor_size,
uint32_t descriptor_version,
struct efi_mem_desc *virtmap)
 {
@@ -571,17 +571,17 @@ void efi_runtime_relocate(ulong offset, struct 
efi_mem_desc *map)
  * Return: status code
  */
 static efi_status_t EFIAPI efi_set_virtual_address_map(
-   unsigned long memory_map_size,
-   unsigned long descriptor_size,
+   efi_uintn_t memory_map_size,
+   efi_uintn_t descriptor_size,
uint32_t descriptor_version,
struct efi_mem_desc *virtmap)
 {
-   int n = memory_map_size / descriptor_size;
-   int i;
+   efi_uintn_t n = memory_map_size / descriptor_size;
+   efi_uintn_t i;
int rt_code_sections = 0;
struct efi_event *event;

-   EFI_ENTRY("%lx %lx %x %p", memory_map_size, descriptor_size,
+   EFI_ENTRY("%zx %zx %x %p", memory_map_size, descriptor_size,
  descriptor_version, virtmap);

/*
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 4/4] efi_selftest: sharpen ConvertPointer() test

2019-07-30 Thread Heinrich Schuchardt
Now that ConvertPointer() is implemented throw an error if the result is
incorrect.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 .../efi_selftest_set_virtual_address_map.c| 30 ++-
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_set_virtual_address_map.c 
b/lib/efi_selftest/efi_selftest_set_virtual_address_map.c
index 3ffb61b7e8..a4e5a50f63 100644
--- a/lib/efi_selftest/efi_selftest_set_virtual_address_map.c
+++ b/lib/efi_selftest/efi_selftest_set_virtual_address_map.c
@@ -20,6 +20,7 @@ static u32 desc_version;
 static u64 page1;
 static u64 page2;
 static u32 notify_call_count;
+static bool convert_pointer_failed;

 /**
  * notify () - notification function
@@ -39,17 +40,28 @@ static void EFIAPI notify(struct efi_event *event, void 
*context)

addr = (void *)(uintptr_t)page1;
ret = runtime->convert_pointer(0, );
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("ConvertPointer failed\n");
-   if ((uintptr_t)addr != page1 + EFI_PAGE_SIZE)
-   efi_st_todo("ConvertPointer wrong address\n");
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("ConvertPointer failed\n");
+   convert_pointer_failed = true;
+   return;
+   }
+   if ((uintptr_t)addr != page1 + EFI_PAGE_SIZE) {
+   efi_st_error("ConvertPointer wrong address\n");
+   convert_pointer_failed = true;
+   return;
+   }

addr = (void *)(uintptr_t)page2;
ret = runtime->convert_pointer(0, );
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("ConvertPointer failed\n");
-   if ((uintptr_t)addr != page2 + 2 * EFI_PAGE_SIZE)
-   efi_st_todo("ConvertPointer wrong address\n");
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("ConvertPointer failed\n");
+   convert_pointer_failed = true;
+   return;
+   }
+   if ((uintptr_t)addr != page2 + 2 * EFI_PAGE_SIZE) {
+   efi_st_error("ConvertPointer wrong address\n");
+   convert_pointer_failed = true;
+   }
 }

 /**
@@ -181,6 +193,8 @@ static int execute(void)
 notify_call_count);
return EFI_ST_FAILURE;
}
+   if (convert_pointer_failed)
+   return EFI_ST_FAILURE;

return EFI_ST_SUCCESS;
 }
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 3/4] efi_loader: implement ConvertPointer()

2019-07-30 Thread Heinrich Schuchardt
Implement the ConvertPointer() runtime service.

Suggested-by: AKASHI Takahiro 
Signed-off-by: Heinrich Schuchardt 
---
v2
replace || by | when setting RuntimeServicesSupported variable
---
 lib/efi_loader/efi_runtime.c | 75 ++--
 1 file changed, 71 insertions(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index a8f0b5eae3..2286e847a7 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -81,6 +81,10 @@ struct elf_rela {
long addend;
 };

+static __efi_runtime_data struct efi_mem_desc *efi_virtmap;
+static __efi_runtime_data efi_uintn_t efi_descriptor_count;
+static __efi_runtime_data efi_uintn_t efi_descriptor_size;
+
 /*
  * EFI runtime code lives in two stages. In the first stage, U-Boot and an EFI
  * payload are running concurrently at the same time. In this mode, we can
@@ -89,7 +93,9 @@ struct elf_rela {

 efi_status_t efi_init_runtime_supported(void)
 {
-   u16 efi_runtime_services_supported = 0;
+   u16 efi_runtime_services_supported =
+   EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP |
+   EFI_RT_SUPPORTED_CONVERT_POINTER;

/*
 * This value must be synced with efi_runtime_detach_list
@@ -98,8 +104,7 @@ efi_status_t efi_init_runtime_supported(void)
 #ifdef CONFIG_EFI_HAVE_RUNTIME_RESET
efi_runtime_services_supported |= EFI_RT_SUPPORTED_RESET_SYSTEM;
 #endif
-   efi_runtime_services_supported |=
-   EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP;
+
return EFI_CALL(efi_set_variable(L"RuntimeServicesSupported",
 _global_variable_guid,
 EFI_VARIABLE_BOOTSERVICE_ACCESS |
@@ -454,6 +459,58 @@ static __efi_runtime efi_status_t EFIAPI 
efi_convert_pointer_runtime(
return EFI_UNSUPPORTED;
 }

+/**
+ * efi_convert_pointer_runtime() - convert from physical to virtual pointer
+ *
+ * This function implements the ConvertPointer() runtime service until
+ * the first call to SetVirtualAddressMap().
+ *
+ * See the Unified Extensible Firmware Interface (UEFI) specification for
+ * details.
+ *
+ * @debug_disposition: indicates if pointer may be converted to NULL
+ * @address:   pointer to be converted
+ * Return: status code EFI_UNSUPPORTED
+ */
+static __efi_runtime efi_status_t EFIAPI efi_convert_pointer(
+   efi_uintn_t debug_disposition, void **address)
+{
+   efi_physical_addr_t addr = (uintptr_t)*address;
+   efi_uintn_t i;
+   efi_status_t ret = EFI_NOT_FOUND;
+
+   EFI_ENTRY("%zu %p", debug_disposition, address);
+
+   if (!efi_virtmap) {
+   ret = EFI_UNSUPPORTED;
+   goto out;
+   }
+
+   if (!address) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+
+   for (i = 0; i < efi_descriptor_count; i++) {
+   struct efi_mem_desc *map = (void *)efi_virtmap +
+  (efi_descriptor_size * i);
+
+   if (addr >= map->physical_start &&
+   (addr < map->physical_start
+   + (map->num_pages << EFI_PAGE_SHIFT))) {
+   *address = (void *)(uintptr_t)
+  (addr + map->virtual_start -
+   map->physical_start);
+
+   ret = EFI_SUCCESS;
+   break;
+   }
+   }
+
+out:
+   return EFI_EXIT(ret);
+}
+
 static __efi_runtime void efi_relocate_runtime_table(ulong offset)
 {
ulong patchoff;
@@ -480,6 +537,12 @@ static __efi_runtime void efi_relocate_runtime_table(ulong 
offset)
 */
efi_runtime_services.convert_pointer = _convert_pointer_runtime;

+   /*
+* TODO: Update UEFI variable RuntimeServicesSupported removing flags
+* EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP and
+* EFI_RT_SUPPORTED_CONVERT_POINTER as required by the UEFI spec 2.8.
+*/
+
/* Update CRC32 */
efi_update_table_header_crc32(_runtime_services.hdr);
 }
@@ -584,6 +647,10 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
EFI_ENTRY("%zx %zx %x %p", memory_map_size, descriptor_size,
  descriptor_version, virtmap);

+   efi_virtmap = virtmap;
+   efi_descriptor_size = descriptor_size;
+   efi_descriptor_count = n;
+
/*
 * TODO:
 * Further down we are cheating. While really we should implement
@@ -800,7 +867,7 @@ struct efi_runtime_services __efi_runtime_data 
efi_runtime_services = {
.get_wakeup_time = (void *)_unimplemented,
.set_wakeup_time = (void *)_unimplemented,
.set_virtual_address_map = _set_virtual_address_map,
-   .convert_pointer = (void *)_unimplemented,
+   .convert_pointer = efi_convert_pointer,
 

[U-Boot] [PATCH v2 0/4] efi_loader: implement ConvertPointer()

2019-07-30 Thread Heinrich Schuchardt
Correct the signature of efi_virtual_address_map().
Implement the ConvertPointer() runtime service.
Adjust the unit test for ConvertPointer().

v2
replace || by | when setting RuntimeServicesSupported variable

Heinrich Schuchardt (4):
  efi_selftest: fix SetVirtualAddressMap unit test
  efi_loader: definition of efi_virtual_address_map()
  efi_loader: implement ConvertPointer()
  efi_selftest: sharpen ConvertPointer() test

 include/efi_api.h |  4 +-
 lib/efi_loader/efi_runtime.c  | 89 ---
 .../efi_selftest_set_virtual_address_map.c| 31 +--
 3 files changed, 103 insertions(+), 21 deletions(-)

--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/4] efi_selftest: fix SetVirtualAddressMap unit test

2019-07-30 Thread Heinrich Schuchardt
We read the address map before assigning the memory for the pages that will
be mapped to virtual addresses. So these pages will overlap with the entry
for EFI_CONVENTIONAL_MEMORY. We have to ensure that every page is described
at most once in the map.

Remove EFI_CONVENTIONAL_MEMORY from the map that we pass to
SetVirtualAddressMap().

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 lib/efi_selftest/efi_selftest_set_virtual_address_map.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/efi_selftest/efi_selftest_set_virtual_address_map.c 
b/lib/efi_selftest/efi_selftest_set_virtual_address_map.c
index 6ee7bbeb01..3ffb61b7e8 100644
--- a/lib/efi_selftest/efi_selftest_set_virtual_address_map.c
+++ b/lib/efi_selftest/efi_selftest_set_virtual_address_map.c
@@ -123,6 +123,7 @@ static int setup(const efi_handle_t handle,
case EFI_LOADER_DATA:
case EFI_BOOT_SERVICES_CODE:
case EFI_BOOT_SERVICES_DATA:
+   case EFI_CONVENTIONAL_MEMORY:
continue;
}
memcpy(pos1, pos2, desc_size);
--
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Please pull u-boot-video

2019-07-30 Thread Anatolij Gustschin
Hi Tom,

here some more video patches I missed to include in the recent pull request.
Travis CI: https://travis-ci.org/vdsao/u-boot-video/builds/565440648

Thanks,
Anatolij

The following changes since commit 970baf16d1322d3930a57fc78ddfb15d594d690c:

  video: arm: rpi: Bail out early if querying video information fails 
(2019-07-29 10:14:04 +0200)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-video.git 
tags/video-for-2019.10-rc1

for you to fetch changes up to 42a7ce27d97022f4abbba142dfa00d1450512f0a:

  mxc_ipuv3_fb.c: enable a backlight on a panel (2019-07-30 12:58:33 +0200)


- fix EDID mode filtering
- extend mxc_ipuv3_fb to enable backlight/display
- include fb_base in global_data for DM_VIDEO
- show frame buffer address via board info
  as used to be with legacy VIDEO support


Heiko Schocher (5):
  global_data: enable fb_base for DM_VIDEO
  mxc_ipuv3_fb.c: set gd->fb_base
  bdinfo: show fb base with DM_VIDEO
  mxc_ipuv3_fb.c: call display_enable
  mxc_ipuv3_fb.c: enable a backlight on a panel

Neil Armstrong (1):
  edid: fix edid_get_timing_validate() mode_valid lookup

 cmd/bdinfo.c  |  2 +-
 common/edid.c |  4 +++-
 drivers/video/imx/mxc_ipuv3_fb.c  | 20 
 include/asm-generic/global_data.h |  2 +-
 4 files changed, 25 insertions(+), 3 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 40/48] stm32mp1: ram: cosmetic: remove unused prototype

2019-07-30 Thread Patrick Delaunay
Signed-off-by: Patrick Delaunay 
---

 drivers/ram/stm32mp1/stm32mp1_ddr.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr.h 
b/drivers/ram/stm32mp1/stm32mp1_ddr.h
index a8eed89..52b748f 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ddr.h
+++ b/drivers/ram/stm32mp1/stm32mp1_ddr.h
@@ -197,10 +197,6 @@ void stm32mp1_edit_param(const struct stm32mp1_ddr_config 
*config,
 char *name,
 char *string);
 
-void stm32mp1_dump_info(
-   const struct ddr_info *priv,
-   const struct stm32mp1_ddr_config *config);
-
 bool stm32mp1_ddr_interactive(
void *priv,
enum stm32mp1_ddr_interact_step step,
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] sifive: riscv: update Hifive Unleashed configuration infrastructure

2019-07-30 Thread Sagar Kadam
Hello Anup,

On Tue, Jul 30, 2019 at 9:12 AM Anup Patel  wrote:
>
> On Mon, Jul 29, 2019 at 6:13 PM Sagar Shrikant Kadam
>  wrote:
> >
> > This patch aligns the current implementation of HiFive Unleashed
> > board configuration framework with the one described in doc/README.kconfig.
> >
> > Signed-off-by: Sagar Shrikant Kadam 
> > ---
> >  arch/riscv/Kconfig   |   6 +-
> >  arch/riscv/cpu/generic/Kconfig   |  12 ---
> >  arch/riscv/cpu/generic/Makefile  |   6 --
> >  arch/riscv/cpu/generic/cpu.c |  35 ---
> >  arch/riscv/cpu/generic/dram.c|  37 ---
> >  arch/riscv/cpu/u54-mc/Kconfig|  12 +++
> >  arch/riscv/cpu/u54-mc/Makefile   |   6 ++
> >  arch/riscv/cpu/u54-mc/cpu.c  |  35 +++
> >  arch/riscv/cpu/u54-mc/dram.c |  37 +++
> >  arch/riscv/include/asm/arch-fu540-c000/clk.h |  14 +++
> >  arch/riscv/include/asm/arch-generic/clk.h|  14 ---
> >  board/sifive/fu540/Kconfig   |  49 --
> >  board/sifive/fu540/MAINTAINERS   |   9 --
> >  board/sifive/fu540/Makefile  |   5 -
> >  board/sifive/fu540/fu540.c   | 139 
> > ---
> >  board/sifive/hifive_unleashed/Kconfig|  52 ++
> >  board/sifive/hifive_unleashed/MAINTAINERS|   9 ++
> >  board/sifive/hifive_unleashed/Makefile   |   5 +
> >  board/sifive/hifive_unleashed/fu540.c| 139 
> > +++
> >  configs/hifive_unleashed_defconfig   |  11 +++
> >  configs/sifive_fu540_defconfig   |  11 ---
> >  include/configs/hifive_unleashed.h   |  47 +
> >  include/configs/sifive-fu540.h   |  47 -
> >  23 files changed, 370 insertions(+), 367 deletions(-)
> >  delete mode 100644 arch/riscv/cpu/generic/Kconfig
> >  delete mode 100644 arch/riscv/cpu/generic/Makefile
> >  delete mode 100644 arch/riscv/cpu/generic/cpu.c
> >  delete mode 100644 arch/riscv/cpu/generic/dram.c
> >  create mode 100644 arch/riscv/cpu/u54-mc/Kconfig
> >  create mode 100644 arch/riscv/cpu/u54-mc/Makefile
> >  create mode 100644 arch/riscv/cpu/u54-mc/cpu.c
> >  create mode 100644 arch/riscv/cpu/u54-mc/dram.c
> >  create mode 100644 arch/riscv/include/asm/arch-fu540-c000/clk.h
> >  delete mode 100644 arch/riscv/include/asm/arch-generic/clk.h
> >  delete mode 100644 board/sifive/fu540/Kconfig
> >  delete mode 100644 board/sifive/fu540/MAINTAINERS
> >  delete mode 100644 board/sifive/fu540/Makefile
> >  delete mode 100644 board/sifive/fu540/fu540.c
> >  create mode 100644 board/sifive/hifive_unleashed/Kconfig
> >  create mode 100644 board/sifive/hifive_unleashed/MAINTAINERS
> >  create mode 100644 board/sifive/hifive_unleashed/Makefile
> >  create mode 100644 board/sifive/hifive_unleashed/fu540.c
> >  create mode 100644 configs/hifive_unleashed_defconfig
> >  delete mode 100644 configs/sifive_fu540_defconfig
> >  create mode 100644 include/configs/hifive_unleashed.h
> >  delete mode 100644 include/configs/sifive-fu540.h
> >
>
> I agree with Bin's concerns.
>
> Please don't rename generic CPU support under arch/riscv
>
> We should think long-term here. If every SOC vendor starts adding
> their CPU support directory under arch/riscv then U-Boot RISC port
> will be eventually difficult to manage and we will also have duplicate
> code across various CPU support.
>
> IMHO, we should avoid adding new CPU support under arch/riscv
> as much as possible. We can call weak functions from generic CPU
> support and board support code can implement it. We should only
> add new CPU support under arch/riscv when we are not able to
> re-use generic CPU support.
>

Yes, your points are valid. I am Ok with it.
My intent here was that as the support for riscv in U-boot is in its
early stages
and doing it now would be better as minimum changes will be required and
going ahead as other CPU vendors introduce their CPU under arch/riscv/
we could isolate a generic CPU code as it grows.

>
> Other board support renaming is fine but there is lot of documentation
If board support renaming is fine. Shall I submit another patch
excluding the CPU
changes?

Thanks & BR,
Sagar Kadam
>
>
> in U-Boot, OpenSBI and other places which needs to be also updated.
>
> Regards,
> Anup
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 32/48] stm32mp1: board: protect the led function calls

2019-07-30 Thread Patrick Delaunay
Avoid compilation issue when CONFIG_LED is not activated

Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/stm32mp1.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 61a4253..181409c 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -615,7 +615,7 @@ int board_init(void)
 
sysconf_init();
 
-   if (IS_ENABLED(CONFIG_LED))
+   if (CONFIG_IS_ENABLED(CONFIG_LED))
led_default_state();
 
return 0;
@@ -664,7 +664,9 @@ int board_late_init(void)
 
 void board_quiesce_devices(void)
 {
+#ifdef CONFIG_LED
setup_led(LEDST_OFF);
+#endif
 }
 
 /* board interface eth init */
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 24/48] stm32mp1: configs: add CONFIG_CMD_BMP

2019-07-30 Thread Patrick Delaunay
Activate command BMP for splash screen support

Signed-off-by: Patrick Delaunay 
---

 configs/stm32mp15_basic_defconfig   | 1 +
 configs/stm32mp15_optee_defconfig   | 1 +
 configs/stm32mp15_trusted_defconfig | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index ca7e91c..740d482 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -37,6 +37,7 @@ CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_TIMER=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index f480c3d..e5b9be7 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_TIMER=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 585817e..2d9be04 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -26,6 +26,7 @@ CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_TIMER=y
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 23/48] stm32mp1: configs: add BACKLIGHT_GPIO support

2019-07-30 Thread Patrick Delaunay
Backlight of panel raydium RM68200 is controlled by a simple gpio,
thus we activate the support for the needed driver.

Signed-off-by: Patrick Delaunay 
---

 configs/stm32mp15_basic_defconfig   | 1 +
 configs/stm32mp15_optee_defconfig   | 1 +
 configs/stm32mp15_trusted_defconfig | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 7e5ae45..ca7e91c 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -120,4 +120,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0483
 CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 0860a26..f480c3d 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -106,4 +106,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0483
 CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 5855c36..585817e 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -105,4 +105,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0483
 CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 38/48] serial: stm32: add Framing error support

2019-07-30 Thread Patrick Delaunay
Add management of Bit 1 of USART_ISR = FE: Framing error
This bit is set by hardware when a de-synchronization, excessive noise
or a break character is detected. It is cleared by software, writing 1
to the FECF bit in the USART_ICR register (for stm32 after f4).

Signed-off-by: Patrick Delaunay 
---

 drivers/serial/serial_stm32.c | 5 +++--
 drivers/serial/serial_stm32.h | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 3ab536a..00a8e72 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -106,10 +106,11 @@ static int stm32_serial_getc(struct udevice *dev)
if ((isr & USART_ISR_RXNE) == 0)
return -EAGAIN;
 
-   if (isr & (USART_ISR_PE | USART_ISR_ORE)) {
+   if (isr & (USART_ISR_PE | USART_ISR_ORE | USART_ISR_FE)) {
if (!stm32f4)
setbits_le32(base + ICR_OFFSET,
-USART_ICR_PCECF | USART_ICR_ORECF);
+USART_ICR_PCECF | USART_ICR_ORECF |
+USART_ICR_FECF);
else
readl(base + RDR_OFFSET(stm32f4));
return -EIO;
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index 5549f8c..7b0c531 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -67,6 +67,7 @@ struct stm32x7_serial_platdata {
 #define USART_ISR_TXE  BIT(7)
 #define USART_ISR_RXNE BIT(5)
 #define USART_ISR_ORE  BIT(3)
+#define USART_ISR_FE   BIT(1)
 #define USART_ISR_PE   BIT(0)
 
 #define USART_BRR_F_MASK   GENMASK(7, 0)
@@ -74,6 +75,7 @@ struct stm32x7_serial_platdata {
 #define USART_BRR_M_MASK   GENMASK(15, 4)
 
 #define USART_ICR_ORECFBIT(3)
+#define USART_ICR_FECF BIT(1)
 #define USART_ICR_PCECFBIT(0)
 
 #endif
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 48/48] MAINTAINERS: update ARM STM STM32MP and STM32MP1 BOARD

2019-07-30 Thread Patrick Delaunay
Add the missing driver and files for mach-stm32mp / stm32mp1 product.

Signed-off-by: Patrick Delaunay 
---

 MAINTAINERS   | 19 +--
 board/st/stm32mp1/MAINTAINERS |  5 +++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index c28251e..8e2a999 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -298,14 +298,19 @@ ARM STM STM32MP
 M: Patrick Delaunay 
 M: Patrice Chotard 
 L: uboot-st...@st-md-mailman.stormreply.com (moderated for non-subscribers)
-T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm
+T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm.git
 S: Maintained
 F: arch/arm/mach-stm32mp/
+F: drivers/adc/stm32-adc*
 F: drivers/clk/clk_stm32mp1.c
+F: drivers/gpio/stm32_gpio.c
+F: drivers/hwspinlock/stm32_hwspinlock.c
 F: drivers/i2c/stm32f7_i2c.c
 F: drivers/mailbox/stm32-ipcc.c
 F: drivers/misc/stm32mp_fuse.c
+F: drivers/misc/stm32_rcc.c
 F: drivers/mmc/stm32_sdmmc2.c
+F: drivers/mtd/nand/raw/stm32_fmc2_nand.c
 F: drivers/phy/phy-stm32-usbphyc.c
 F: drivers/pinctrl/pinctrl_stm32.c
 F: drivers/power/pmic/stpmic1.c
@@ -313,11 +318,21 @@ F:drivers/power/regulator/stm32-vrefbuf.c
 F: drivers/power/regulator/stpmic1.c
 F: drivers/ram/stm32mp1/
 F: drivers/remoteproc/stm32_copro.c
-F: drivers/misc/stm32_rcc.c
 F: drivers/reset/stm32-reset.c
+F: drivers/rtc/stm32_rtc.c
+F: drivers/serial/serial_stm32.*
 F: drivers/spi/stm32_qspi.c
 F: drivers/spi/stm32_spi.c
+F: drivers/video/stm32/stm32_ltdc.c
 F: drivers/watchdog/stm32mp_wdt.c
+F: include/dt-bindings/clock/stm32fx-clock.h
+F: include/dt-bindings/clock/stm32mp1-clks.h
+F: include/dt-bindings/clock/stm32mp1-clksrc.h
+F: include/dt-bindings/pinctrl/stm32-pinfunc.h
+F: include/dt-bindings/reset/stm32mp1-resets.h
+F: include/stm32_rcc.h
+F: tools/stm32image.c
+
 
 ARM STM STV0991
 M: Vikas Manocha 
diff --git a/board/st/stm32mp1/MAINTAINERS b/board/st/stm32mp1/MAINTAINERS
index 3bf4c21..2930947 100644
--- a/board/st/stm32mp1/MAINTAINERS
+++ b/board/st/stm32mp1/MAINTAINERS
@@ -1,9 +1,10 @@
 STM32MP1 BOARD
 M: Patrick Delaunay 
 L: uboot-st...@st-md-mailman.stormreply.com (moderated for non-subscribers)
+T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm.git
 S: Maintained
-F: arch/arm/dts/stm32mp157*
-F: board/st/stm32mp1
+F: arch/arm/dts/stm32mp15*
+F: board/st/stm32mp1/
 F: configs/stm32mp15_basic_defconfig
 F: configs/stm32mp15_optee_defconfig
 F: configs/stm32mp15_trusted_defconfig
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 31/48] stm32mp1: board: support of error led on ed1/ev1 board

2019-07-30 Thread Patrick Delaunay
Create a function led_error_blink and add node in device
tree.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 21 --
 board/st/stm32mp1/stm32mp1.c | 48 ++--
 2 files changed, 39 insertions(+), 30 deletions(-)

diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
index 21c89c1..4953a0d 100644
--- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
@@ -15,31 +15,22 @@
};
 
config {
+   u-boot,boot-led = "heartbeat";
+   u-boot,error-led = "error";
st,fastboot-gpios = < 13 GPIO_ACTIVE_LOW>;
st,stm32prog-gpios = < 14 GPIO_ACTIVE_LOW>;
};
 
led {
-   compatible = "gpio-leds";
-
red {
-   label = "stm32mp:red:status";
+   label = "error";
gpios = < 13 GPIO_ACTIVE_LOW>;
default-state = "off";
+   status = "okay";
};
-   green {
-   label = "stm32mp:green:user";
-   gpios = < 14 GPIO_ACTIVE_LOW>;
-   default-state = "on";
-   };
-   orange {
-   label = "stm32mp:orange:status";
-   gpios = < 7 GPIO_ACTIVE_HIGH>;
-   default-state = "off";
-   };
+
blue {
-   label = "stm32mp:blue:user";
-   gpios = < 11 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
};
};
 };
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 2837e9a..61a4253 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -231,6 +232,7 @@ int g_dnl_board_usb_cable_connected(void)
 }
 #endif /* CONFIG_USB_GADGET */
 
+#ifdef CONFIG_LED
 static int get_led(struct udevice **dev, char *led_string)
 {
char *led_name;
@@ -263,12 +265,41 @@ static int setup_led(enum led_state_t cmd)
ret = led_set_state(dev, cmd);
return ret;
 }
+#endif
+
+static void __maybe_unused led_error_blink(u32 nb_blink)
+{
+#ifdef CONFIG_LED
+   int ret;
+   struct udevice *led;
+   u32 i;
+#endif
+
+   if (!nb_blink)
+   return;
+
+#ifdef CONFIG_LED
+   ret = get_led(, "u-boot,error-led");
+   if (!ret) {
+   /* make u-boot,error-led blinking */
+   /* if U32_MAX and 125ms interval, for 17.02 years */
+   for (i = 0; i < 2 * nb_blink; i++) {
+   led_set_state(led, LEDST_TOGGLE);
+   mdelay(125);
+   WATCHDOG_RESET();
+   }
+   }
+#endif
+
+   /* infinite: the boot process must be stopped */
+   if (nb_blink == U32_MAX)
+   hang();
+}
 
 static int board_check_usb_power(void)
 {
struct ofnode_phandle_args adc_args;
struct udevice *adc;
-   struct udevice *led;
ofnode node;
unsigned int raw;
int max_uV = 0;
@@ -394,20 +425,7 @@ static int board_check_usb_power(void)

pr_err("\n\n");
}
 
-   ret = get_led(, "u-boot,error-led");
-   if (ret) {
-   /* in unattached case, the boot process must be stopped */
-   if (nb_blink == U32_MAX)
-   hang();
-   return ret;
-   }
-
-   /* make u-boot,error-led blinking */
-   for (i = 0; i < nb_blink * 2; i++) {
-   led_set_state(led, LEDST_TOGGLE);
-   mdelay(125);
-   }
-   led_set_state(led, LEDST_ON);
+   led_error_blink(nb_blink);
 
return 0;
 }
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 39/48] serial: stm32: remove unused include

2019-07-30 Thread Patrick Delaunay
The "serial_stm32.h" is only used by drivers/serial/serial_stm32.c
and it is the file ./drivers/serial/serial_stm32.h

Signed-off-by: Patrick Delaunay 
---

 include/dm/platform_data/serial_stm32.h | 15 ---
 1 file changed, 15 deletions(-)
 delete mode 100644 include/dm/platform_data/serial_stm32.h

diff --git a/include/dm/platform_data/serial_stm32.h 
b/include/dm/platform_data/serial_stm32.h
deleted file mode 100644
index 85153df..000
--- a/include/dm/platform_data/serial_stm32.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2015
- * Kamil Lulko, 
- */
-
-#ifndef __SERIAL_STM32_H
-#define __SERIAL_STM32_H
-
-/* Information about a serial port */
-struct stm32_serial_platdata {
-   struct stm32_usart *base;  /* address of registers in physical memory */
-};
-
-#endif /* __SERIAL_STM32_H */
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 17/48] stm32mp1: configs: select CONFIG_STM32_SERIAL

2019-07-30 Thread Patrick Delaunay
Select the serial driver mandatory for the console.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig   | 1 +
 configs/stm32mp15_basic_defconfig   | 1 -
 configs/stm32mp15_optee_defconfig   | 1 -
 configs/stm32mp15_trusted_defconfig | 1 -
 4 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 7efe464..0de9b3e 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -42,6 +42,7 @@ config TARGET_STM32MP1
select PINCTRL_STM32
select STM32_RCC
select STM32_RESET
+   select STM32_SERIAL
select SYS_ARCH_TIMER
imply BOOTCOUNT_LIMIT
imply BOOTSTAGE
diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index a4c2027..1edea79 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -106,7 +106,6 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_STM32=y
 CONFIG_SERIAL_RX_BUFFER=y
-CONFIG_STM32_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 0565e5e..11f8359 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -92,7 +92,6 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_STM32=y
 CONFIG_SERIAL_RX_BUFFER=y
-CONFIG_STM32_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 844cbcd..bc76c08 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -91,7 +91,6 @@ CONFIG_REMOTEPROC_STM32_COPRO=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_STM32=y
 CONFIG_SERIAL_RX_BUFFER=y
-CONFIG_STM32_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 37/48] mmc: stm32_sdmmc2: reload watchdog

2019-07-30 Thread Patrick Delaunay
From: Christophe Kerello 

This patch solves a watchdog reset issue during mmc erase command.

Signed-off-by: Christophe Kerello 
Signed-off-by: Patrick Delaunay 
---

 drivers/mmc/stm32_sdmmc2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index 867ed56..e7058cb 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct stm32_sdmmc2_plat {
struct mmc_config cfg;
@@ -432,6 +433,8 @@ static int stm32_sdmmc2_send_cmd(struct udevice *dev, 
struct mmc_cmd *cmd,
u32 cmdat = data ? SDMMC_CMD_CMDTRANS : 0;
int ret, retry = 3;
 
+   WATCHDOG_RESET();
+
 retry_cmd:
ctx.data_length = 0;
ctx.dpsm_abort = false;
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 46/48] stm32mp1: clk: remove debug traces

2019-07-30 Thread Patrick Delaunay
Remove many debug trace.

Signed-off-by: Patrick Delaunay 
---

 drivers/clk/clk_stm32mp1.c | 21 -
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c
index 5806d48..359c2b9 100644
--- a/drivers/clk/clk_stm32mp1.c
+++ b/drivers/clk/clk_stm32mp1.c
@@ -759,9 +759,6 @@ static ulong stm32mp1_clk_get_fixed(struct 
stm32mp1_clk_priv *priv, int idx)
return 0;
}
 
-   debug("%s: clk id %d = %x : %ld kHz\n", __func__, idx,
- (u32)priv->osc[idx], priv->osc[idx] / 1000);
-
return priv->osc[idx];
 }
 
@@ -863,8 +860,6 @@ static ulong  pll_get_fref_ck(struct stm32mp1_clk_priv 
*priv,
src = selr & RCC_SELR_SRC_MASK;
 
refclk = stm32mp1_clk_get_fixed(priv, pll[pll_id].refclk[src]);
-   debug("PLL%d : selr=%x refclk = %d kHz\n",
- pll_id, selr, (u32)(refclk / 1000));
 
return refclk;
 }
@@ -889,9 +884,6 @@ static ulong pll_get_fvco(struct stm32mp1_clk_priv *priv,
divm = (cfgr1 & (RCC_PLLNCFGR1_DIVM_MASK)) >> RCC_PLLNCFGR1_DIVM_SHIFT;
divn = cfgr1 & RCC_PLLNCFGR1_DIVN_MASK;
 
-   debug("PLL%d : cfgr1=%x fracr=%x DIVN=%d DIVM=%d\n",
- pll_id, cfgr1, fracr, divn, divm);
-
refclk = pll_get_fref_ck(priv, pll_id);
 
/* with FRACV :
@@ -908,7 +900,6 @@ static ulong pll_get_fvco(struct stm32mp1_clk_priv *priv,
} else {
fvco = (ulong)(refclk * (divn + 1) / (divm + 1));
}
-   debug("PLL%d : %s = %ld\n", pll_id, __func__, fvco);
 
return fvco;
 }
@@ -921,17 +912,13 @@ static ulong stm32mp1_read_pll_freq(struct 
stm32mp1_clk_priv *priv,
ulong dfout;
u32 cfgr2;
 
-   debug("%s(%d, %d)\n", __func__, pll_id, div_id);
if (div_id >= _DIV_NB)
return 0;
 
cfgr2 = readl(priv->base + pll[pll_id].pllxcfgr2);
divy = (cfgr2 >> RCC_PLLNCFGR2_SHIFT(div_id)) & RCC_PLLNCFGR2_DIVX_MASK;
 
-   debug("PLL%d : cfgr2=%x DIVY=%d\n", pll_id, cfgr2, divy);
-
dfout = pll_get_fvco(priv, pll_id) / (divy + 1);
-   debug("=> dfout = %d kHz\n", (u32)(dfout / 1000));
 
return dfout;
 }
@@ -1574,9 +1561,6 @@ static void stgen_config(struct stm32mp1_clk_priv *priv)
 
/* need to update gd->arch.timer_rate_hz with new frequency */
timer_init();
-   pr_debug("gd->arch.timer_rate_hz = %x\n",
-(u32)gd->arch.timer_rate_hz);
-   pr_debug("Tick = %x\n", (u32)(get_ticks()));
}
 }
 
@@ -1882,7 +1866,6 @@ static int pll_set_output_rate(struct udevice *dev,
if (div > 128)
div = 128;
 
-   debug("fvco = %ld, clk_rate = %ld, div=%d\n", fvco, clk_rate, div);
/* stop the requested output */
clrbits_le32(pllxcr, 0x1 << div_id << RCC_PLLNCR_DIVEN_SHIFT);
/* change divider */
@@ -1915,6 +1898,9 @@ static ulong stm32mp1_clk_set_rate(struct clk *clk, 
unsigned long clk_rate)
}
 
p = stm32mp1_clk_get_parent(priv, clk->id);
+#ifdef DEBUG
+   debug("%s: parent = %d:%s\n", __func__, p, stm32mp1_clk_parent_name[p]);
+#endif
if (p < 0)
return -EINVAL;
 
@@ -1932,6 +1918,7 @@ static ulong stm32mp1_clk_set_rate(struct clk *clk, 
unsigned long clk_rate)
return result;
}
 #endif
+
case _PLL4_Q:
/* for LTDC_PX and DSI_PX case */
return pll_set_output_rate(clk->dev, _PLL4, _DIV_Q, clk_rate);
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 14/48] stm32mp1: configs: activate CONFIG_SILENT_CONSOLE

2019-07-30 Thread Patrick Delaunay
Allow to disable console with environment variable 'silent':
> env set silent 1; env save

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 9dc3c4d..e5f05af 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -47,6 +47,7 @@ config TARGET_STM32MP1
imply BOOTSTAGE
imply CMD_BOOTCOUNT
imply CMD_BOOTSTAGE
+   imply SILENT_CONSOLE
imply SYSRESET_PSCI if STM32MP1_TRUSTED
imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
help
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 18/48] stm32mp1: configs: Activate DISABLE_CONSOLE

2019-07-30 Thread Patrick Delaunay
Activate DISABLE_CONSOLE needed for stm32prog support on uart.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 0de9b3e..cee3ce1 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -48,6 +48,7 @@ config TARGET_STM32MP1
imply BOOTSTAGE
imply CMD_BOOTCOUNT
imply CMD_BOOTSTAGE
+   imply DISABLE_CONSOLE
imply PRE_CONSOLE_BUFFER
imply SILENT_CONSOLE
imply SYSRESET_PSCI if STM32MP1_TRUSTED
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 22/48] stm32mp1: configs: add CONFIG_DM_VIDEO

2019-07-30 Thread Patrick Delaunay
Activate command DM_VIDEO for LCD support

Signed-off-by: Patrick Delaunay 
---

 configs/stm32mp15_basic_defconfig   | 1 +
 configs/stm32mp15_optee_defconfig   | 1 +
 configs/stm32mp15_trusted_defconfig | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 5a372e1..7e5ae45 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -119,4 +119,5 @@ CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0483
 CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_DM_VIDEO=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index a6c010e..0860a26 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -105,4 +105,5 @@ CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0483
 CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_DM_VIDEO=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index de87834..5855c36 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -104,4 +104,5 @@ CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0483
 CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_DM_VIDEO=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 20/48] stm32mp1: configs: imply CONFIG_OF_LIBFDT_OVERLAY

2019-07-30 Thread Patrick Delaunay
Add imply for FDT overlay that can be usefuill for kernel device tree
management but it is not mandatory (can be removed to gain space)

Signed-off-by: Patrick Delaunay 
---

 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3f0e301..14108e6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1545,6 +1545,7 @@ config ARCH_STM32MP
imply SPL_SYSRESET
imply CMD_DM
imply CMD_POWEROFF
+   imply OF_LIBFDT_OVERLAY
imply ENV_VARS_UBOOT_RUNTIME_CONFIG
imply USE_PREBOOT
help
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 10/48] ARM: dts: stm32mp1: add pull-up on serial rx of console connected to STLINK

2019-07-30 Thread Patrick Delaunay
Avoid U-Boot auto-boot interruption for line break detection
on console when the RX line connected to STLINK is floating
(-IO error in getc cause by framing error and testc return 1)
Same workaround is applied on all the STMicroelectonics board.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 2 ++
 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
index 2a1cfd3..dcaab3e 100644
--- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
@@ -189,6 +189,8 @@
};
pins2 {
u-boot,dm-pre-reloc;
+   /* pull-up on rx to avoid floating level */
+   bias-pull-up;
};
 };
 
diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
index 200601e..21c89c1 100644
--- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
@@ -206,5 +206,7 @@
};
pins2 {
u-boot,dm-pre-reloc;
+   /* pull-up on rx to avoid floating level */
+   bias-pull-up;
};
 };
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 45/48] stm32mp1: Makefile cleanup

2019-07-30 Thread Patrick Delaunay
Don't compile psci for SPL build.

Signed-off-by: Patrick Delaunay 
---

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

diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile
index 7745060..299f9a7 100644
--- a/arch/arm/mach-stm32mp/Makefile
+++ b/arch/arm/mach-stm32mp/Makefile
@@ -15,7 +15,8 @@ obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o
 ifndef CONFIG_STM32MP1_TRUSTED
 obj-$(CONFIG_SYSRESET) += cmd_poweroff.o
 endif
-endif
 obj-$(CONFIG_ARMV7_PSCI) += psci.o
+endif
+
 obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
 obj-$(CONFIG_OF_SYSTEM_SETUP) += fdt.o
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 25/48] stm32mp1: configs: add condition to activate WATCHDOG in SPL

2019-07-30 Thread Patrick Delaunay
Only activate WATCHDOG in SPL when CONFIG_WATCHDOG is activated in U-Boot.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index cee3ce1..187be17 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -17,7 +17,7 @@ config SPL
select SPL_DM_RESET
select SPL_SERIAL_SUPPORT
select SPL_SYSCON
-   select SPL_WATCHDOG_SUPPORT
+   select SPL_WATCHDOG_SUPPORT if WATCHDOG
imply BOOTSTAGE_STASH if SPL_BOOTSTAGE
imply SPL_BOOTSTAGE if BOOTSTAGE
imply SPL_DISPLAY_PRINT
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 19/48] stm32mp1: configs: support MTDPARTS only if needed

2019-07-30 Thread Patrick Delaunay
MTD is only use if NAND or NOR driver is activated.

Signed-off-by: Patrick Delaunay 
---

 include/configs/stm32mp1.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
index 033291e..b2b8660 100644
--- a/include/configs/stm32mp1.h
+++ b/include/configs/stm32mp1.h
@@ -79,7 +79,9 @@
 #endif
 
 /* Dynamic MTD partition support */
+#if defined(CONFIG_STM32_QSPI) || defined(CONFIG_NAND_STM32_FMC2)
 #define CONFIG_SYS_MTDPARTS_RUNTIME
+#endif
 
 /*/
 #ifdef CONFIG_DISTRO_DEFAULTS
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 00/48] stm32mp1 patches for v2019.10

2019-07-30 Thread Patrick Delaunay

Second serie of patches for stm32mp1 support in U-Boot
- sync device tree with kernel v5.3-rc2
- update configs
- update board stm32mp1
- few ram and clk driver update


Christophe Kerello (1):
  mmc: stm32_sdmmc2: reload watchdog

Patrice Chotard (2):
  pinctrl: pinctrl_stm32: cosmetic: Reorder include files
  stm32mp1: configs: Set bootdelay to 1

Patrick Delaunay (45):
  stm32mp1: cosmetic: remove comment
  pinctrl: stmfx: update pinconf settings
  ARM: dts: stm32mp1: sync device tree with v5.3-rc2
  ARM: dts: stm32mp1: DDR config v1.45
  ARM: dts: stm32mp1: Add iwdg2 support for SPL
  ARM: dts: stm32mp1: Add PSCI node access before relocation
  ARM: dts: stm32mp1: add ldtc pre-reloc proper in SOC file
  ARM: dts: stm32mp1: add key support on DK1/DK2
  ARM: dts: stm32mp1: add pull-up on serial rx of console connected to
STLINK
  dt-bindings: clock: stm32mp1: support disabled fixed clock
  stpmic1: program pmic to keep only the debug unit on
  stm32mp1: configs: remove CONFIG_SYS_HZ
  stm32mp1: configs: activate CONFIG_SILENT_CONSOLE
  stm32mp1: configs: activate PRE_CONSOLE_BUFFER
  stm32mp1: configs: deactivate ARMV7_VIRT for basic boot
  stm32mp1: configs: select CONFIG_STM32_SERIAL
  stm32mp1: configs: Activate DISABLE_CONSOLE
  stm32mp1: configs: support MTDPARTS only if needed
  stm32mp1: configs: imply CONFIG_OF_LIBFDT_OVERLAY
  stm32mp1: configs: Deactivate SPI_FLASH_BAR
  stm32mp1: configs: add CONFIG_DM_VIDEO
  stm32mp1: configs: add BACKLIGHT_GPIO support
  stm32mp1: configs: add CONFIG_CMD_BMP
  stm32mp1: configs: add condition to activate WATCHDOG in SPL
  stm32mp1: configs: add altbootcmd
  stm32mp1: configs: add spi load support in spl
  stm32mp1: board: add environment variable for board id and board rev
  stm32mp1: board: enable v1v2_hdmi and v3v3_hdmi regulator on dk2 boot
  stm32mp1: board: support of error led on ed1/ev1 board
  stm32mp1: board: protect the led function calls
  stm32mp1: board: check the boot-source to disable bootdelay
  stm32mp1: board: Update the way vdd-supply is retrieved from DT
  stm32mp1: board: remove board_check_usb_power when ADC is not
activated
  stm32mp1: board: cosmetic: cleanup file
  serial: stm32: add Framing error support
  serial: stm32: remove unused include
  stm32mp1: ram: cosmetic: remove unused prototype
  stm32mp1: ram: fix address issue in 2 tests
  stm32mp1: ram: update loop management in infinite test
  stm32mp1: ram: reload watchdog during ddr test
  stm32mp1: ram: add pattern parameter in infinite write test
  stm32mp1: Makefile cleanup
  stm32mp1: clk: remove debug traces
  stm32mp1: clk: use gd to store frequency information
  MAINTAINERS: update ARM STM STM32MP and STM32MP1 BOARD

 MAINTAINERS  |  19 +-
 arch/arm/Kconfig |   1 +
 arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi |   4 +-
 arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binG.dtsi |   5 +-
 arch/arm/dts/stm32mp157-pinctrl.dtsi | 234 +++
 arch/arm/dts/stm32mp157-u-boot.dtsi  |  14 ++
 arch/arm/dts/stm32mp157a-avenger96.dts   |  44 +++--
 arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi |   4 +
 arch/arm/dts/stm32mp157a-dk1.dts |  73 ++-
 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi |   6 +
 arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi |  23 +--
 arch/arm/dts/stm32mp157c-ed1.dts |  23 ++-
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |   5 -
 arch/arm/dts/stm32mp157c-ev1.dts | 109 ++-
 arch/arm/dts/stm32mp157c.dtsi| 180 +
 arch/arm/dts/stm32mp157xaa-pinctrl.dtsi  |  90 +
 arch/arm/dts/stm32mp157xab-pinctrl.dtsi  |  62 ++
 arch/arm/dts/stm32mp157xac-pinctrl.dtsi  |  78 
 arch/arm/dts/stm32mp157xad-pinctrl.dtsi  |  62 ++
 arch/arm/mach-stm32mp/Kconfig|  14 +-
 arch/arm/mach-stm32mp/Makefile   |   3 +-
 arch/arm/mach-stm32mp/include/mach/stm32.h   |   1 +
 board/st/stm32mp1/Kconfig|   4 +
 board/st/stm32mp1/MAINTAINERS|   5 +-
 board/st/stm32mp1/spl.c  |  14 ++
 board/st/stm32mp1/stm32mp1.c | 162 ++--
 configs/stm32mp15_basic_defconfig|   6 +-
 configs/stm32mp15_optee_defconfig|   5 +-
 configs/stm32mp15_trusted_defconfig  |   5 +-
 doc/device-tree-bindings/clock/st,stm32mp1.txt   |   4 +-
 drivers/clk/clk_stm32mp1.c   |  37 ++--
 drivers/mmc/stm32_sdmmc2.c   |   3 +
 drivers/pinctrl/pinctrl-stmfx.c  |  20 +-
 drivers/pinctrl/pinctrl_stm32.c  |   4 +-
 drivers/ram/stm32mp1/stm32mp1_ddr.h  |   4 -
 drivers/ram/stm32mp1/stm32mp1_tests.c|  97 ++
 drivers/serial/serial_stm32.c|   5 +-
 

[U-Boot] [PATCH 43/48] stm32mp1: ram: reload watchdog during ddr test

2019-07-30 Thread Patrick Delaunay
Avoid watchdog during infinite DDR test.

Signed-off-by: Patrick Delaunay 
---

 drivers/ram/stm32mp1/stm32mp1_tests.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c 
b/drivers/ram/stm32mp1/stm32mp1_tests.c
index 7356802..f947b5d 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -4,6 +4,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "stm32mp1_tests.h"
@@ -154,6 +155,8 @@ static int test_loop_end(u32 *loop, u32 nb_loop, u32 
progress)
return 1;
}
printf("loop #%d\n", *loop);
+   WATCHDOG_RESET();
+
return 0;
 }
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 12/48] stpmic1: program pmic to keep only the debug unit on

2019-07-30 Thread Patrick Delaunay
Depending on backup register value, we maintain the debug unit
powered-on for debugging purpose.
Only BUCK1 is required for powering the debug unit, so revert
the setting for all the other power lanes, except BUCK3 that
has to be always on.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/include/mach/stm32.h |  1 +
 board/st/stm32mp1/spl.c| 14 ++
 include/power/stpmic1.h|  5 +++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h 
b/arch/arm/mach-stm32mp/include/mach/stm32.h
index 1d4b548..b3e9ccc 100644
--- a/arch/arm/mach-stm32mp/include/mach/stm32.h
+++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
@@ -94,6 +94,7 @@ enum boot_device {
 #define TAMP_BOOT_DEVICE_MASK  GENMASK(7, 4)
 #define TAMP_BOOT_INSTANCE_MASKGENMASK(3, 0)
 #define TAMP_BOOT_FORCED_MASK  GENMASK(7, 0)
+#define TAMP_BOOT_DEBUG_ON BIT(16)
 
 enum forced_boot_mode {
BOOT_NORMAL = 0x00,
diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c
index e19be0f..e65ff28 100644
--- a/board/st/stm32mp1/spl.c
+++ b/board/st/stm32mp1/spl.c
@@ -27,5 +27,19 @@ void spl_board_init(void)
STPMIC1_BUCKS_MRST_CR,
STPMIC1_MRST_BUCK(STPMIC1_BUCK3),
STPMIC1_MRST_BUCK(STPMIC1_BUCK3));
+
+   /* Check if debug is enabled to program PMIC according to the bit */
+   if ((readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_DEBUG_ON) && !ret) {
+   printf("Keep debug unit ON\n");
+
+   pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,
+   STPMIC1_MRST_BUCK_DEBUG,
+   STPMIC1_MRST_BUCK_DEBUG);
+
+   if (STPMIC1_MRST_LDO_DEBUG)
+   pmic_clrsetbits(dev, STPMIC1_LDOS_MRST_CR,
+   STPMIC1_MRST_LDO_DEBUG,
+   STPMIC1_MRST_LDO_DEBUG);
+   }
 #endif
 }
diff --git a/include/power/stpmic1.h b/include/power/stpmic1.h
index 0e6721d..d90a1a9 100644
--- a/include/power/stpmic1.h
+++ b/include/power/stpmic1.h
@@ -22,11 +22,12 @@
 
 /* BUCKS_MRST_CR */
 #define STPMIC1_MRST_BUCK(buck)BIT(buck)
-#define STPMIC1_MRST_BUCK_ALL  GENMASK(3, 0)
+#define STPMIC1_MRST_BUCK_DEBUG
(STPMIC1_MRST_BUCK(STPMIC1_BUCK1) | \
+STPMIC1_MRST_BUCK(STPMIC1_BUCK3))
 
 /* LDOS_MRST_CR */
 #define STPMIC1_MRST_LDO(ldo)  BIT(ldo)
-#define STPMIC1_MRST_LDO_ALL   GENMASK(6, 0)
+#define STPMIC1_MRST_LDO_DEBUG 0
 
 /* BUCKx_MAIN_CR (x=1...4) */
 #define STPMIC1_BUCK_ENA   BIT(0)
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 42/48] stm32mp1: ram: update loop management in infinite test

2019-07-30 Thread Patrick Delaunay
Reduce verbosity of the infinite tests to avoid CubeMX issue.
test and display loop by 1024*1024 accesses: read or write.

Signed-off-by: Patrick Delaunay 
---

 drivers/ram/stm32mp1/stm32mp1_tests.c | 38 +++
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c 
b/drivers/ram/stm32mp1/stm32mp1_tests.c
index 691c63c..7356802 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -1241,6 +1241,7 @@ static enum test_result test_read(struct stm32mp1_ddrctl 
*ctl,
u32 *addr;
u32 data;
u32 loop = 0;
+   int i, size = 1024 * 1024;
bool random = false;
 
if (get_addr(string, argc, argv, 0, (u32 *)))
@@ -1254,14 +1255,19 @@ static enum test_result test_read(struct 
stm32mp1_ddrctl *ctl,
printf("running at 0x%08x\n", (u32)addr);
 
while (1) {
-   if (random)
-   addr = (u32 *)(STM32_DDR_BASE +
-  (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
-   data = readl(addr);
-   if (test_loop_end(, 0, 1000))
+   for (i = 0; i < size; i++) {
+   if (random)
+   addr = (u32 *)(STM32_DDR_BASE +
+  (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
+   data = readl(addr);
+   }
+   if (test_loop_end(, 0, 1))
break;
}
-   sprintf(string, "0x%x: %x", (u32)addr, data);
+   if (random)
+   sprintf(string, "%d loops random", loop);
+   else
+   sprintf(string, "%d loops at 0x%x: %x", loop, (u32)addr, data);
 
return TEST_PASSED;
 }
@@ -1280,6 +1286,7 @@ static enum test_result test_write(struct stm32mp1_ddrctl 
*ctl,
u32 *addr;
u32 data = 0xA5A5AA55;
u32 loop = 0;
+   int i, size = 1024 * 1024;
bool random = false;
 
if (get_addr(string, argc, argv, 0, (u32 *)))
@@ -1293,16 +1300,21 @@ static enum test_result test_write(struct 
stm32mp1_ddrctl *ctl,
printf("running at 0x%08x\n", (u32)addr);
 
while (1) {
-   if (random) {
-   addr = (u32 *)(STM32_DDR_BASE +
-  (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
-   data = rand();
+   for (i = 0; i < size; i++) {
+   if (random) {
+   addr = (u32 *)(STM32_DDR_BASE +
+  (rand() & (STM32_DDR_SIZE - 1) & ~0x3));
+   data = rand();
+   }
+   writel(data, addr);
}
-   writel(data, addr);
-   if (test_loop_end(, 0, 1000))
+   if (test_loop_end(, 0, 1))
break;
}
-   sprintf(string, "0x%x: %x", (u32)addr, data);
+   if (random)
+   sprintf(string, "%d loops random", loop);
+   else
+   sprintf(string, "%d loops at 0x%x: %x", loop, (u32)addr, data);
 
return TEST_PASSED;
 }
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 47/48] stm32mp1: clk: use gd to store frequency information

2019-07-30 Thread Patrick Delaunay
Use existing gd structure to store frequency information
which can be used in drivers or arch without new request.

Signed-off-by: Patrick Delaunay 
---

 drivers/clk/clk_stm32mp1.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c
index 359c2b9..e87307f 100644
--- a/drivers/clk/clk_stm32mp1.c
+++ b/drivers/clk/clk_stm32mp1.c
@@ -15,6 +15,8 @@
 #include 
 #include 
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifndef CONFIG_STM32MP1_TRUSTED
 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
 /* activate clock tree initialization in the driver */
@@ -2042,22 +2044,22 @@ static int stm32mp1_clk_probe(struct udevice *dev)
stm32mp1_clk_dump(priv);
 #endif
 
+   gd->cpu_clk = stm32mp1_clk_get(priv, _CK_MPU);
+   gd->bus_clk = stm32mp1_clk_get(priv, _ACLK);
+   /* DDRPHYC father */
+   gd->mem_clk = stm32mp1_clk_get(priv, _PLL2_R);
 #if defined(CONFIG_DISPLAY_CPUINFO)
if (gd->flags & GD_FLG_RELOC) {
char buf[32];
 
printf("Clocks:\n");
-   printf("- MPU : %s MHz\n",
-  strmhz(buf, stm32mp1_clk_get(priv, _CK_MPU)));
+   printf("- MPU : %s MHz\n", strmhz(buf, gd->cpu_clk));
printf("- MCU : %s MHz\n",
   strmhz(buf, stm32mp1_clk_get(priv, _CK_MCU)));
-   printf("- AXI : %s MHz\n",
-  strmhz(buf, stm32mp1_clk_get(priv, _ACLK)));
+   printf("- AXI : %s MHz\n", strmhz(buf, gd->bus_clk));
printf("- PER : %s MHz\n",
   strmhz(buf, stm32mp1_clk_get(priv, _CK_PER)));
-   /* DDRPHYC father */
-   printf("- DDR : %s MHz\n",
-  strmhz(buf, stm32mp1_clk_get(priv, _PLL2_R)));
+   printf("- DDR : %s MHz\n", strmhz(buf, gd->mem_clk));
}
 #endif /* CONFIG_DISPLAY_CPUINFO */
 #endif
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 16/48] stm32mp1: configs: deactivate ARMV7_VIRT for basic boot

2019-07-30 Thread Patrick Delaunay
for the moment basic and trusted configuration must
start CPU in Supervisor mode and not in Hypervisor

Signed-off-by: Patrick Delaunay 
---

 configs/stm32mp15_basic_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 27b8525..a4c2027 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL=y
 CONFIG_TARGET_STM32MP1=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+# CONFIG_ARMV7_VIRT is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 44/48] stm32mp1: ram: add pattern parameter in infinite write test

2019-07-30 Thread Patrick Delaunay
Add pattern for infinite test_read and test_write, that
allow to change the pattern to test without recompilation;
default pattern is 0xA5A5AA55.

Signed-off-by: Patrick Delaunay 
---

 drivers/ram/stm32mp1/stm32mp1_tests.c | 31 ---
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c 
b/drivers/ram/stm32mp1/stm32mp1_tests.c
index f947b5d..581ee48 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -1250,13 +1250,18 @@ static enum test_result test_read(struct 
stm32mp1_ddrctl *ctl,
if (get_addr(string, argc, argv, 0, (u32 *)))
return TEST_ERROR;
 
+   if (get_pattern(string, argc, argv, 1, , 0xA5A5AA55))
+   return TEST_ERROR;
+
if ((u32)addr == ADDR_INVALID) {
-   printf("random ");
+   printf("running random\n");
random = true;
+   } else {
+   printf("running at 0x%08x with pattern=0x%08x\n",
+  (u32)addr, data);
+   writel(data, addr);
}
 
-   printf("running at 0x%08x\n", (u32)addr);
-
while (1) {
for (i = 0; i < size; i++) {
if (random)
@@ -1287,7 +1292,7 @@ static enum test_result test_write(struct stm32mp1_ddrctl 
*ctl,
   char *string, int argc, char *argv[])
 {
u32 *addr;
-   u32 data = 0xA5A5AA55;
+   u32 data;
u32 loop = 0;
int i, size = 1024 * 1024;
bool random = false;
@@ -1295,13 +1300,17 @@ static enum test_result test_write(struct 
stm32mp1_ddrctl *ctl,
if (get_addr(string, argc, argv, 0, (u32 *)))
return TEST_ERROR;
 
+   if (get_pattern(string, argc, argv, 1, , 0xA5A5AA55))
+   return TEST_ERROR;
+
if ((u32)addr == ADDR_INVALID) {
-   printf("random ");
+   printf("running random\n");
random = true;
+   } else {
+   printf("running at 0x%08x with pattern 0x%08x\n",
+  (u32)addr, data);
}
 
-   printf("running at 0x%08x\n", (u32)addr);
-
while (1) {
for (i = 0; i < size; i++) {
if (random) {
@@ -1435,10 +1444,10 @@ const struct test_desc test[] = {
 3
},
/* need to the the 2 last one (infinite) : skipped for test all */
-   {test_read, "infinite read", "[addr]",
-"basic test : infinite read access", 1},
-   {test_write, "infinite write", "[addr]",
-"basic test : infinite write access", 1},
+   {test_read, "infinite read", "[addr] [pattern]",
+"basic test : infinite read access (random: addr=0x)", 2},
+   {test_write, "infinite write", "[addr] [pattern]",
+"basic test : infinite write access (random: addr=0x)", 2},
 };
 
 const int test_nb = ARRAY_SIZE(test);
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 13/48] stm32mp1: configs: remove CONFIG_SYS_HZ

2019-07-30 Thread Patrick Delaunay
Use the default value from lib/Kconfig.


Signed-off-by: Patrick Delaunay 
---

 include/configs/stm32mp1.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
index 1bed570..033291e 100644
--- a/include/configs/stm32mp1.h
+++ b/include/configs/stm32mp1.h
@@ -10,11 +10,6 @@
 #include 
 #include 
 
-/*
- * Number of clock ticks in 1 sec
- */
-#define CONFIG_SYS_HZ  1000
-
 #ifndef CONFIG_STM32MP1_TRUSTED
 /* PSCI support */
 #define CONFIG_ARMV7_PSCI_1_0
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 36/48] stm32mp1: board: cosmetic: cleanup file

2019-07-30 Thread Patrick Delaunay
- reorder include files
- remove one comment

Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/stm32mp1.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index a67e33e..7085bd5 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -5,8 +5,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -682,7 +682,6 @@ void board_quiesce_devices(void)
 }
 
 /* board interface eth init */
-/* this is a weak define that we are overriding */
 int board_interface_eth_init(phy_interface_t interface_type,
 bool eth_clk_sel_reg, bool eth_ref_clk_sel_reg)
 {
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 33/48] stm32mp1: board: check the boot-source to disable bootdelay

2019-07-30 Thread Patrick Delaunay
Allows to avoid to wait 2 second in U-Boot before to
start STM32CubeProgrammer command.

Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/stm32mp1.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 181409c..c61a562 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -623,6 +623,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
+   char *boot_device;
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
const void *fdt_compat;
int fdt_compat_len;
@@ -659,6 +660,11 @@ int board_late_init(void)
/* for DK1/DK2 boards */
board_check_usb_power();
 
+   /* Check the boot-source to disable bootdelay */
+   boot_device = env_get("boot_device");
+   if (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb"))
+   env_set("bootdelay", "0");
+
return 0;
 }
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 06/48] ARM: dts: stm32mp1: Add iwdg2 support for SPL

2019-07-30 Thread Patrick Delaunay
This patch adds independent watchdog support for stm32mp157c
in SPL.

Signed-off-by: Patrice Chotard 
Signed-off-by: Patrick Delaunay 
---

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

diff --git a/arch/arm/dts/stm32mp157-u-boot.dtsi 
b/arch/arm/dts/stm32mp157-u-boot.dtsi
index 8102ce2..ba13ebb 100644
--- a/arch/arm/dts/stm32mp157-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157-u-boot.dtsi
@@ -106,6 +106,10 @@
u-boot,dm-pre-reloc;
 };
 
+ {
+   u-boot,dm-pre-reloc;
+};
+
  {
u-boot,dm-pre-reloc;
 };
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 21/48] stm32mp1: configs: Deactivate SPI_FLASH_BAR

2019-07-30 Thread Patrick Delaunay
Remove CONFIG_SPI_FLASH_BAR as the SPI NOR layer uses stateless
4 byte opcodes by default.

Signed-off-by: Patrick Delaunay 
---

 configs/stm32mp15_basic_defconfig   | 1 -
 configs/stm32mp15_optee_defconfig   | 1 -
 configs/stm32mp15_trusted_defconfig | 1 -
 3 files changed, 3 deletions(-)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 1edea79..5a372e1 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -81,7 +81,6 @@ CONFIG_NAND=y
 CONFIG_NAND_STM32_FMC2=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 11f8359..a6c010e 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -69,7 +69,6 @@ CONFIG_NAND=y
 CONFIG_NAND_STM32_FMC2=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index bc76c08..de87834 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -68,7 +68,6 @@ CONFIG_NAND=y
 CONFIG_NAND_STM32_FMC2=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 35/48] stm32mp1: board: remove board_check_usb_power when ADC is not activated

2019-07-30 Thread Patrick Delaunay
Avoid compilation issue when CONFIG_ADC is not activated

Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/stm32mp1.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index a96e675..a67e33e 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -296,6 +296,7 @@ static void __maybe_unused led_error_blink(u32 nb_blink)
hang();
 }
 
+#ifdef CONFIG_ADC
 static int board_check_usb_power(void)
 {
struct ofnode_phandle_args adc_args;
@@ -429,6 +430,7 @@ static int board_check_usb_power(void)
 
return 0;
 }
+#endif /* CONFIG_ADC */
 
 static void sysconf_init(void)
 {
@@ -659,8 +661,10 @@ int board_late_init(void)
}
 #endif
 
+#ifdef CONFIG_ADC
/* for DK1/DK2 boards */
board_check_usb_power();
+#endif /* CONFIG_ADC */
 
/* Check the boot-source to disable bootdelay */
boot_device = env_get("boot_device");
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 05/48] ARM: dts: stm32mp1: DDR config v1.45

2019-07-30 Thread Patrick Delaunay
Update DDR configuration with the latest update:
- Change DQSGE to 1 for DDR3, to cure missing DQS preamble.

Signed-off-by: Nicolas Le Bayon 
Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi | 4 ++--
 arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binG.dtsi | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi 
b/arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi
index dc30360..11e8f2b 100644
--- a/arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi
+++ b/arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi
@@ -16,7 +16,7 @@
  * address mapping : RBC
  * Tc > + 85C : N
  */
-#define DDR_MEM_NAME "DDR3-1066/888 bin G 1x4Gb 533MHz v1.44"
+#define DDR_MEM_NAME "DDR3-1066/888 bin G 1x4Gb 533MHz v1.45"
 #define DDR_MEM_SPEED 533000
 #define DDR_MEM_SIZE 0x2000
 
@@ -89,7 +89,7 @@
 #define DDR_PTR2 0x042DA068
 #define DDR_ACIOCR 0x10400812
 #define DDR_DXCCR 0x0C40
-#define DDR_DSGCR 0xF21F
+#define DDR_DSGCR 0xF200011F
 #define DDR_DCR 0x000B
 #define DDR_DTPR0 0x38D488D0
 #define DDR_DTPR1 0x098B00D8
diff --git a/arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binG.dtsi 
b/arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binG.dtsi
index 8158a56..4b70b60 100644
--- a/arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binG.dtsi
+++ b/arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binG.dtsi
@@ -16,8 +16,7 @@
  * address mapping : RBC
  * Tc > + 85C : N
  */
-
-#define DDR_MEM_NAME "DDR3-1066/888 bin G 2x4Gb 533MHz v1.44"
+#define DDR_MEM_NAME "DDR3-1066/888 bin G 2x4Gb 533MHz v1.45"
 #define DDR_MEM_SPEED 533000
 #define DDR_MEM_SIZE 0x4000
 
@@ -90,7 +89,7 @@
 #define DDR_PTR2 0x042DA068
 #define DDR_ACIOCR 0x10400812
 #define DDR_DXCCR 0x0C40
-#define DDR_DSGCR 0xF21F
+#define DDR_DSGCR 0xF200011F
 #define DDR_DCR 0x000B
 #define DDR_DTPR0 0x38D488D0
 #define DDR_DTPR1 0x098B00D8
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 30/48] stm32mp1: board: enable v1v2_hdmi and v3v3_hdmi regulator on dk2 boot

2019-07-30 Thread Patrick Delaunay
As for Audio codec IC, HDMI IC is not "IO safe".
HDMI regulators (v3v3 and v1v2) must be enabled to allow
I2C1 bus usage. HDMI IC must be under reset during power up
and keep HDMI and AUDIO devices in reset while they are not
used in U-Boot to keep them in low power mode
(each device can be kept in reset independently keeping their
power supplies ON until kernel).

Signed-off-by: Patrice Chotard 
Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi |  6 +++
 board/st/stm32mp1/Kconfig|  4 ++
 board/st/stm32mp1/stm32mp1.c | 70 
 3 files changed, 80 insertions(+)

diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
index 06ef3a4..18ac1e3 100644
--- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
@@ -4,3 +4,9 @@
  */
 
 #include "stm32mp157a-dk1-u-boot.dtsi"
+
+ {
+   hdmi-transmitter@39 {
+   reset-gpios = < 10 GPIO_ACTIVE_LOW>;
+   };
+};
diff --git a/board/st/stm32mp1/Kconfig b/board/st/stm32mp1/Kconfig
index 87216c0..4fa2360 100644
--- a/board/st/stm32mp1/Kconfig
+++ b/board/st/stm32mp1/Kconfig
@@ -22,4 +22,8 @@ config CMD_STBOARD
  This compile the stboard command to
  read and write the board in the OTP.
 
+config TARGET_STM32MP157C_DK2
+   bool "support of STMicroelectronics STM32MP157C-DK2 Discovery Board"
+   default y
+
 endif
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index ad3db31..2837e9a 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -504,6 +504,73 @@ static void sysconf_init(void)
 #endif
 }
 
+#ifdef CONFIG_DM_REGULATOR
+/* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
+static int dk2_i2c1_fix(void)
+{
+   ofnode node;
+   struct gpio_desc hdmi, audio;
+   int ret = 0;
+
+   node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
+   if (!ofnode_valid(node)) {
+   pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
+   return -ENOENT;
+   }
+
+   if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
+  , GPIOD_IS_OUT)) {
+   pr_debug("%s: could not find reset-gpios\n",
+__func__);
+   return -ENOENT;
+   }
+
+   node = ofnode_path("/soc/i2c@40012000/cs42l51@4a");
+   if (!ofnode_valid(node)) {
+   pr_debug("%s: no cs42l51@4a ?\n", __func__);
+   return -ENOENT;
+   }
+
+   if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
+  , GPIOD_IS_OUT)) {
+   pr_debug("%s: could not find reset-gpios\n",
+__func__);
+   return -ENOENT;
+   }
+
+   /* before power up, insure that HDMI and AUDIO IC is under reset */
+   ret = dm_gpio_set_value(, 1);
+   if (ret) {
+   pr_err("%s: can't set_value for hdmi_nrst gpio", __func__);
+   goto error;
+   }
+   ret = dm_gpio_set_value(, 1);
+   if (ret) {
+   pr_err("%s: can't set_value for audio_nrst gpio", __func__);
+   goto error;
+   }
+
+   /* power-up audio IC */
+   regulator_autoset_by_name("v1v8_audio", NULL);
+
+   /* power-up HDMI IC */
+   regulator_autoset_by_name("v1v2_hdmi", NULL);
+   regulator_autoset_by_name("v3v3_hdmi", NULL);
+
+error:
+   return ret;
+}
+
+static bool board_is_dk2(void)
+{
+   if (CONFIG_IS_ENABLED(TARGET_STM32MP157C_DK2) &&
+   of_machine_is_compatible("st,stm32mp157c-dk2"))
+   return true;
+
+   return false;
+}
+#endif
+
 /* board dependent setup after realloc */
 int board_init(void)
 {
@@ -522,6 +589,9 @@ int board_init(void)
board_key_check();
 
 #ifdef CONFIG_DM_REGULATOR
+   if (board_is_dk2())
+   dk2_i2c1_fix();
+
regulators_enable_boot_on(_DEBUG);
 #endif
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 09/48] ARM: dts: stm32mp1: add key support on DK1/DK2

2019-07-30 Thread Patrick Delaunay
Allow to use PA13 and PA14 to force fastboot mode or STM32CubeProgrammer
mode.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
index 36c852d..2a1cfd3 100644
--- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
@@ -17,6 +17,8 @@
u-boot,boot-led = "heartbeat";
u-boot,error-led = "error";
st,adc_usb_pd = < 18>, < 19>;
+   st,fastboot-gpios = < 13 GPIO_ACTIVE_LOW>;
+   st,stm32prog-gpios = < 14 GPIO_ACTIVE_LOW>;
};
led {
red {
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 34/48] stm32mp1: board: Update the way vdd-supply is retrieved from DT

2019-07-30 Thread Patrick Delaunay
Due to kernel DT alignment, pwr-supply is renamed to vdd-supply
and is a subnode of pwr-regulators.

Signed-off-by: Patrice Chotard 
Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157a-avenger96.dts | 5 -
 arch/arm/dts/stm32mp157a-dk1.dts   | 5 -
 arch/arm/dts/stm32mp157c-ed1.dts   | 5 -
 board/st/stm32mp1/stm32mp1.c   | 8 +---
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/arm/dts/stm32mp157a-avenger96.dts 
b/arch/arm/dts/stm32mp157a-avenger96.dts
index ba86cf5..5b15a4a 100644
--- a/arch/arm/dts/stm32mp157a-avenger96.dts
+++ b/arch/arm/dts/stm32mp157a-avenger96.dts
@@ -283,7 +283,10 @@
 };
 
  {
-   pwr-supply = <>;
+   pwr-regulators {
+   vdd-supply = <>;
+   vdd_3v3_usbfs-supply = <_usb>;
+   };
 };
 
  {
diff --git a/arch/arm/dts/stm32mp157a-dk1.dts b/arch/arm/dts/stm32mp157a-dk1.dts
index 1d5c1a6..ba612a5 100644
--- a/arch/arm/dts/stm32mp157a-dk1.dts
+++ b/arch/arm/dts/stm32mp157a-dk1.dts
@@ -308,7 +308,10 @@
 };
 
  {
-   pwr-supply = <>;
+   pwr-regulators {
+   vdd-supply = <>;
+   vdd_3v3_usbfs-supply = <_usb>;
+   };
 };
 
  {
diff --git a/arch/arm/dts/stm32mp157c-ed1.dts b/arch/arm/dts/stm32mp157c-ed1.dts
index 94ac025..3e8b7b5 100644
--- a/arch/arm/dts/stm32mp157c-ed1.dts
+++ b/arch/arm/dts/stm32mp157c-ed1.dts
@@ -218,7 +218,10 @@
 };
 
  {
-   pwr-supply = <>;
+   pwr-regulators {
+   vdd-supply = <>;
+   vdd_3v3_usbfs-supply = <_usb>;
+   };
 };
 
  {
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index c61a562..a96e675 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -471,7 +471,9 @@ static void sysconf_init(void)
 *   => U-Boot set the register only if VDD < 2.7V (in DT)
 *  but this value need to be consistent with board design
 */
-   ret = syscon_get_by_driver_data(STM32MP_SYSCON_PWR, _dev);
+   ret = uclass_get_device_by_driver(UCLASS_PMIC,
+ DM_GET_DRIVER(stm32mp_pwr_pmic),
+ _dev);
if (!ret) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
  DM_GET_DRIVER(stm32mp_bsec),
@@ -485,8 +487,8 @@ static void sysconf_init(void)
if (!ret)
otp = otp & BIT(13);
 
-   /* get VDD = pwr-supply */
-   ret = device_get_supply_regulator(pwr_dev, "pwr-supply",
+   /* get VDD = vdd-supply */
+   ret = device_get_supply_regulator(pwr_dev, "vdd-supply",
  _reg);
 
/* check if VDD is Low Voltage */
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 15/48] stm32mp1: configs: activate PRE_CONSOLE_BUFFER

2019-07-30 Thread Patrick Delaunay
Correctly handle silent=1 in the default environment.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index e5f05af..7efe464 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -47,6 +47,7 @@ config TARGET_STM32MP1
imply BOOTSTAGE
imply CMD_BOOTCOUNT
imply CMD_BOOTSTAGE
+   imply PRE_CONSOLE_BUFFER
imply SILENT_CONSOLE
imply SYSRESET_PSCI if STM32MP1_TRUSTED
imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
@@ -110,6 +111,13 @@ config CMD_STM32KEY
fuse public key hash in corresponding fuse used to authenticate
binary.
 
+
+config PRE_CON_BUF_ADDR
+   default 0xC02FF000
+
+config PRE_CON_BUF_SZ
+   default 4096
+
 config BOOTSTAGE_STASH_ADDR
default 0xC300
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 04/48] ARM: dts: stm32mp1: sync device tree with v5.3-rc2

2019-07-30 Thread Patrick Delaunay
Synchronize device tree with v5.3-rc2 label and
update the associated u-boot dtsi.

Signed-off-by: Patrick Delaunay 
---

 arch/arm/dts/stm32mp157-pinctrl.dtsi | 234 ++-
 arch/arm/dts/stm32mp157a-avenger96.dts   |  39 +++---
 arch/arm/dts/stm32mp157a-dk1.dts |  68 -
 arch/arm/dts/stm32mp157c-ed1.dts |  18 ++-
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |   5 -
 arch/arm/dts/stm32mp157c-ev1.dts | 109 +-
 arch/arm/dts/stm32mp157c.dtsi| 180 
 arch/arm/dts/stm32mp157xaa-pinctrl.dtsi  |  90 
 arch/arm/dts/stm32mp157xab-pinctrl.dtsi  |  62 
 arch/arm/dts/stm32mp157xac-pinctrl.dtsi  |  78 +++
 arch/arm/dts/stm32mp157xad-pinctrl.dtsi  |  62 
 11 files changed, 885 insertions(+), 60 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp157xaa-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32mp157xab-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32mp157xac-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32mp157xad-pinctrl.dtsi

diff --git a/arch/arm/dts/stm32mp157-pinctrl.dtsi 
b/arch/arm/dts/stm32mp157-pinctrl.dtsi
index 9bae850..4367e8d 100644
--- a/arch/arm/dts/stm32mp157-pinctrl.dtsi
+++ b/arch/arm/dts/stm32mp157-pinctrl.dtsi
@@ -25,8 +25,7 @@
reg = <0x0 0x400>;
clocks = < GPIOA>;
st,bank-name = "GPIOA";
-   ngpios = <16>;
-   gpio-ranges = < 0 0 16>;
+   status = "disabled";
};
 
gpiob: gpio@50003000 {
@@ -37,8 +36,7 @@
reg = <0x1000 0x400>;
clocks = < GPIOB>;
st,bank-name = "GPIOB";
-   ngpios = <16>;
-   gpio-ranges = < 0 16 16>;
+   status = "disabled";
};
 
gpioc: gpio@50004000 {
@@ -49,8 +47,7 @@
reg = <0x2000 0x400>;
clocks = < GPIOC>;
st,bank-name = "GPIOC";
-   ngpios = <16>;
-   gpio-ranges = < 0 32 16>;
+   status = "disabled";
};
 
gpiod: gpio@50005000 {
@@ -61,8 +58,7 @@
reg = <0x3000 0x400>;
clocks = < GPIOD>;
st,bank-name = "GPIOD";
-   ngpios = <16>;
-   gpio-ranges = < 0 48 16>;
+   status = "disabled";
};
 
gpioe: gpio@50006000 {
@@ -73,8 +69,7 @@
reg = <0x4000 0x400>;
clocks = < GPIOE>;
st,bank-name = "GPIOE";
-   ngpios = <16>;
-   gpio-ranges = < 0 64 16>;
+   status = "disabled";
};
 
gpiof: gpio@50007000 {
@@ -85,8 +80,7 @@
reg = <0x5000 0x400>;
clocks = < GPIOF>;
st,bank-name = "GPIOF";
-   ngpios = <16>;
-   gpio-ranges = < 0 80 16>;
+   status = "disabled";
};
 
gpiog: gpio@50008000 {
@@ -97,8 +91,7 @@
reg = <0x6000 0x400>;
clocks = < GPIOG>;
st,bank-name = "GPIOG";
-   ngpios = <16>;
-   gpio-ranges = < 0 96 16>;
+   status = "disabled";
};
 
gpioh: gpio@50009000 {
@@ -109,8 +102,7 @@
reg = <0x7000 0x400>;
clocks = < GPIOH>;
st,bank-name = "GPIOH";
-   ngpios = <16>;
-   gpio-ranges = < 0 112 16>;
+   status = "disabled";
};
 
gpioi: gpio@5000a000 {
@@ -121,8 +113,7 @@
reg = <0x8000 0x400>;
clocks = < GPIOI>;
st,bank-name = "GPIOI";
-   ngpios = <16>;
-   gpio-ranges = < 0 128 16>;
+   status = "disabled";
};
 
gpioj: 

[U-Boot] [PATCH 28/48] stm32mp1: configs: add spi load support in spl

2019-07-30 Thread Patrick Delaunay
Add the boot for NOR, SPL load U-Boot.img at offset
CONFIG_SYS_SPI_U_BOOT_OFFS = 0x8.
It is the start address of mtd partition ssbl in nor.

Signed-off-by: Christophe Kerello 
Signed-off-by: Patrick Delaunay 
---

 arch/arm/mach-stm32mp/Kconfig | 1 +
 include/configs/stm32mp1.h| 5 +
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 187be17..c9bc084 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -16,6 +16,7 @@ config SPL
select SPL_REGMAP
select SPL_DM_RESET
select SPL_SERIAL_SUPPORT
+   select SPL_SPI_LOAD
select SPL_SYSCON
select SPL_WATCHDOG_SUPPORT if WATCHDOG
imply BOOTSTAGE_STASH if SPL_BOOTSTAGE
diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
index 92660fe..88f8254 100644
--- a/include/configs/stm32mp1.h
+++ b/include/configs/stm32mp1.h
@@ -70,6 +70,11 @@
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 
+/* SPI FLASH support */
+#if defined(CONFIG_SPL_BUILD)
+#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8
+#endif
+
 /* Ethernet need */
 #ifdef CONFIG_DWC_ETH_QOS
 #define CONFIG_SYS_NONCACHED_MEMORY(1 * SZ_1M) /* 1M */
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 41/48] stm32mp1: ram: fix address issue in 2 tests

2019-07-30 Thread Patrick Delaunay
If user choose to test memory size is 1GByte (0x4000),
memory address would overflow in test "Random" and
test "FrequencySelectivePattern".
Thus the system would hangs up when running DDR test.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Bossen WU 
---

 drivers/ram/stm32mp1/stm32mp1_tests.c | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c 
b/drivers/ram/stm32mp1/stm32mp1_tests.c
index b6fb2a9..691c63c 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -578,27 +578,29 @@ static enum test_result test_random(struct 
stm32mp1_ddrctl *ctl,
u32 error = 0;
unsigned int seed;
 
-   if (get_bufsize(string, argc, argv, 0, , 4 * 1024))
+   if (get_bufsize(string, argc, argv, 0, , 8 * 1024))
return TEST_ERROR;
if (get_nb_loop(string, argc, argv, 1, _loop, 1))
return TEST_ERROR;
if (get_addr(string, argc, argv, 2, ))
return TEST_ERROR;
 
-   printf("running %d loops at 0x%x\n", nb_loop, addr);
+   bufsize /= 2;
+   printf("running %d loops copy from 0x%x to 0x%x (buffer size=0x%x)\n",
+  nb_loop, addr, addr + bufsize, bufsize);
while (!error) {
seed = rand();
-   for (offset = addr; offset < addr + bufsize; offset += 4)
-   writel(rand(), offset);
+   for (offset = 0; offset < bufsize; offset += 4)
+   writel(rand(), addr + offset);
 
memcpy((void *)addr + bufsize, (void *)addr, bufsize);
 
srand(seed);
-   for (offset = addr; offset < addr + 2 * bufsize; offset += 4) {
-   if (offset == (addr + bufsize))
+   for (offset = 0; offset < 2 * bufsize; offset += 4) {
+   if (offset == bufsize)
srand(seed);
value = rand();
-   error = check_addr(offset, value);
+   error = check_addr(addr + offset, value);
if (error)
break;
if (progress(offset))
@@ -607,6 +609,7 @@ static enum test_result test_random(struct stm32mp1_ddrctl 
*ctl,
if (test_loop_end(, nb_loop, 100))
break;
}
+   putc('\n');
 
if (error) {
sprintf(string,
@@ -791,9 +794,9 @@ static enum test_result test_loop(const u32 *pattern, u32 
*address,
int i;
int j;
enum test_result res = TEST_PASSED;
-   u32 *offset, testsize, remaining;
+   u32 offset, testsize, remaining;
 
-   offset = address;
+   offset = (u32)address;
remaining = bufsize;
while (remaining) {
testsize = bufsize > 0x100 ? 0x100 : bufsize;
@@ -809,7 +812,7 @@ static enum test_result test_loop(const u32 *pattern, u32 
*address,
__asm__("stmia r1!, {R3-R10}");
__asm__("stmia r1!, {R3-R10}");
__asm__("stmia r1!, {R3-R10}");
-   __asm__("subs r2, r2, #8");
+   __asm__("subs r2, r2, #128");
__asm__("bge loop2");
__asm__("pop {R0-R10}");
 
@@ -1388,7 +1391,7 @@ const struct test_desc test[] = {
 "Verifies r/w and memcopy(burst for pseudo random value.",
 3
},
-   {test_freq_pattern, "FrequencySelectivePattern ", "[size]",
+   {test_freq_pattern, "FrequencySelectivePattern", "[size]",
 "write & test patterns: Mostly Zero, Mostly One and F/n",
 1
},
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >