Re: [U-Boot] OMAP watchdog timer reset on BBB

2019-09-13 Thread Suniel Mahesh
On 13/09/19 23:28, Grygorii Strashko wrote:
> 
> 
> On 12/09/2019 19:33, Sam Protsenko wrote:
>> Hi Stefan,
>>
>> On Thu, Sep 12, 2019 at 5:38 PM Stefan Roese  wrote:
>>>
>>> Hi Sam,
>>>
>>> On 12.09.19 15:45, Sam Protsenko wrote:
 Hi Suniel,

 After transition to DM WDT, watchdog timer on BeagleBone Black resets
 the board after 1 minute or so. I'm using this defconfig: [1]. After
 disabling CONFIG_WDT and CONFIG_WATCHDOG options the board doesn't
 reset. I guess it might be happening on other boards using
 CONFIG_WDT_OMAP3 as well. The issue can be reproduced by stopping in
 U-Boot shell (=>) and waiting for 1 minute.

 Do you know by chance why it might be happening, or maybe some fix
 already exists?

 Thanks!

 [1] https://pastebin.ubuntu.com/p/Zz5bY6cYXS/
>>>
>>> So you have enabled the watchdog and should see something like this
>>> upon bootup:
>>>
>>> WDT:   Started without servicing (60s timeout)
>>>
>>> Is this correct? Then you need to enable the U-Boot internal WDT
>>> servicing by enabling CONFIG_WATCHDOG as well, as this will
>>> result in the internal U-Boot servicing of the watchdog. Then
>>> you should see this upon bootup and no reset will appear in
>>> U-Boot:
>>>
>>> WDT:   Started with servicing (60s timeout)
>>>
>>
>> I'm seeing this ("with servicing") line, and CONFIG_WATCHDOG is
>> already enabled in am335x_evm_defconfig. So I think it's an issue,
>> which *probably* appeared when watchdog drivers were converted to
>> Driver Model (this defconfig is using CONFIG_WDT + CONFIG_WDT_OMAP3
>> options). Any clues what can be wrong?
>>
>>> Does this help?
> It seems logic of hw_watchdog_reset() and omap3_wdt_reset() is different.
> Pay attention at wdt_trgr_pattern.

Didn't do anything different. It was just a replication of hw_watchdog_reset() 
logic into omap3_wdt_reset().

in hw_watchdog_reset: a global variable "wdt_trgr_pattern" is assigned a value 
and written into register
static unsigned int wdt_trgr_pattern = 0x1234;
wdt_trgr_pattern = ~wdt_trgr_pattern;
writel(wdt_trgr_pattern, >wdtwtgr);

in omap3_wdt_reset:  as per DM, all glob var's must be part of drivers private 
structure
so initialised priv->wdt_trgr_pattern = 0x1234; and then written into register
priv->wdt_trgr_pattern = ~(priv->wdt_trgr_pattern);
writel(priv->wdt_trgr_pattern, >regs->wdtwtgr);

> 
> It seems that
>  priv->wdt_trgr_pattern = 0x1234;
> need to be moved in omap3_wdt_probe()

As per my understanding the above change will not make any difference, because 
its just initialization of the variable.
should be ready before its use.
>  
Please go through this pastebin link, at my end, omap3_wdt_reset() happens at 
regular intervals, where ever
it is triggered. (print messages are inserted in omap3_wdt_reset)
https://pastebin.ubuntu.com/p/WvS9PZb45p/

The target doesn't restart.

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


[U-Boot] [PATCH] net: Improve documentation for string_to_ip()

2019-09-13 Thread Joe Hershberger
Signed-off-by: Joe Hershberger 

---

 include/net.h | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/net.h b/include/net.h
index d054c5f694..a4d0b41b20 100644
--- a/include/net.h
+++ b/include/net.h
@@ -841,7 +841,14 @@ void string_to_enetaddr(const char *addr, uint8_t 
*enetaddr);
 /* Convert an IP address to a string */
 void ip_to_string(struct in_addr x, char *s);
 
-/* Convert a string to ip address */
+/**
+ * string_to_ip() - Convert a string to ip address
+ *
+ * Implemented in lib/net_utils.c (built unconditionally)
+ *
+ * @s: Input string to parse
+ * @return: in_addr struct containing the parsed IP address
+ */
 struct in_addr string_to_ip(const char *s);
 
 /* Convert a VLAN id to a string */
-- 
2.11.0

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


[U-Boot] [PATCH] net: Always build the string_to_enetaddr() helper

2019-09-13 Thread Joe Hershberger
Part of the env cleanup moved this out of the environment code and into
the net code. However, this helper is sometimes needed even when the net
stack isn't included.

Move the helper to lib/net_utils.c like it's similarly-purposed
string_to_ip(). Also rename the moved function to similar naming.

Signed-off-by: Joe Hershberger 
Reported-by: Ondrej Jirman 

---

 arch/arm/mach-tegra/cboot.c |  2 +-
 board/renesas/sh7752evb/sh7752evb.c |  2 +-
 board/renesas/sh7753evb/sh7753evb.c |  2 +-
 board/renesas/sh7757lcr/sh7757lcr.c |  4 ++--
 cmd/ethsw.c |  2 +-
 cmd/nvedit.c|  2 +-
 doc/README.enetaddr |  4 ++--
 include/net.h   | 24 +---
 lib/net_utils.c | 15 +++
 net/eth-uclass.c|  2 +-
 net/eth_legacy.c|  2 +-
 net/net.c   | 12 
 12 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c
index 0433081c6c..0762144ecf 100644
--- a/arch/arm/mach-tegra/cboot.c
+++ b/arch/arm/mach-tegra/cboot.c
@@ -495,7 +495,7 @@ static int cboot_get_ethaddr_legacy(const void *fdt, 
uint8_t mac[ETH_ALEN])
return -ENOENT;
}
 
-   eth_parse_enetaddr(prop, mac);
+   string_to_enetaddr(prop, mac);
 
if (!is_valid_ethaddr(mac)) {
printf("Invalid MAC address: %s\n", prop);
diff --git a/board/renesas/sh7752evb/sh7752evb.c 
b/board/renesas/sh7752evb/sh7752evb.c
index d0b850f35d..b4292b22e7 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -93,7 +93,7 @@ static void set_mac_to_sh_giga_eth_register(int channel, char 
*mac_string)
unsigned char mac[6];
unsigned long val;
 
-   eth_parse_enetaddr(mac_string, mac);
+   string_to_enetaddr(mac_string, mac);
 
if (!channel)
ether = GETHER0_MAC_BASE;
diff --git a/board/renesas/sh7753evb/sh7753evb.c 
b/board/renesas/sh7753evb/sh7753evb.c
index e1bed7dcc3..5aebb041b0 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -100,7 +100,7 @@ static void set_mac_to_sh_giga_eth_register(int channel, 
char *mac_string)
unsigned char mac[6];
unsigned long val;
 
-   eth_parse_enetaddr(mac_string, mac);
+   string_to_enetaddr(mac_string, mac);
 
if (!channel)
ether = GETHER0_MAC_BASE;
diff --git a/board/renesas/sh7757lcr/sh7757lcr.c 
b/board/renesas/sh7757lcr/sh7757lcr.c
index d2671202e9..662c435f7a 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -140,7 +140,7 @@ static void set_mac_to_sh_eth_register(int channel, char 
*mac_string)
unsigned char mac[6];
unsigned long val;
 
-   eth_parse_enetaddr(mac_string, mac);
+   string_to_enetaddr(mac_string, mac);
 
if (!channel)
ether = ETHER0_MAC_BASE;
@@ -159,7 +159,7 @@ static void set_mac_to_sh_giga_eth_register(int channel, 
char *mac_string)
unsigned char mac[6];
unsigned long val;
 
-   eth_parse_enetaddr(mac_string, mac);
+   string_to_enetaddr(mac_string, mac);
 
if (!channel)
ether = GETHER0_MAC_BASE;
diff --git a/cmd/ethsw.c b/cmd/ethsw.c
index 8846805799..8d271ce1f3 100644
--- a/cmd/ethsw.c
+++ b/cmd/ethsw.c
@@ -864,7 +864,7 @@ static int keyword_match_mac_addr(enum ethsw_keyword_id 
key_id, int argc,
return 0;
}
 
-   eth_parse_enetaddr(argv[*argc_nr + 1], parsed_cmd->ethaddr);
+   string_to_enetaddr(argv[*argc_nr + 1], parsed_cmd->ethaddr);
 
if (is_broadcast_ethaddr(parsed_cmd->ethaddr)) {
memset(parsed_cmd->ethaddr, 0xFF, sizeof(parsed_cmd->ethaddr));
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 1cb0bc1460..1e4b225a94 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -360,7 +360,7 @@ ulong env_get_hex(const char *varname, ulong default_val)
 
 int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
 {
-   eth_parse_enetaddr(env_get(name), enetaddr);
+   string_to_enetaddr(env_get(name), enetaddr);
return is_valid_ethaddr(enetaddr);
 }
 
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index f926485986..5baa9f2179 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -76,12 +76,12 @@ To assist in the management of these layers, a few helper 
functions exist.  You
 should use these rather than attempt to do any kind of parsing/manipulation
 yourself as many common errors have arisen in the past.
 
-   * void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
+   * void string_to_enetaddr(const char *addr, uchar *enetaddr);
 
 Convert a string representation of a MAC address to the binary version.
 char *addr = "00:11:22:33:44:55";
 uchar enetaddr[6];
-eth_parse_enetaddr(addr, enetaddr);

[U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD

2019-09-13 Thread Schrempf Frieder
From: Frieder Schrempf 

Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
SPL. They often rely on hacks in the board header files to include
this option conditionally. To be able to fix this, we previously
introduced a separate option SPL_SPI_FLASH_MTD.

Therefore we can now adjust the Makefile and change the code in
sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).

We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
header files to the according defconfigs. The affected boards are
socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
and da850evm.

We do this all in one patch to guarantee bisectibility.

This change was tested with buildman to make sure it does not
introduce any regressions by comparing the resulting binary sizes.

Signed-off-by: Frieder Schrempf 
---
 configs/aristainetos2_defconfig|  1 +
 configs/aristainetos2b_defconfig   |  1 +
 configs/aristainetos_defconfig |  1 +
 configs/cm_fx6_defconfig   |  1 +
 configs/display5_defconfig |  1 +
 configs/display5_factory_defconfig |  1 +
 configs/socfpga_arria5_defconfig   |  1 +
 configs/socfpga_cyclone5_defconfig |  1 +
 configs/socfpga_dbm_soc1_defconfig |  1 +
 configs/socfpga_de0_nano_soc_defconfig |  1 +
 configs/socfpga_de10_nano_defconfig|  1 +
 configs/socfpga_is1_defconfig  |  1 +
 configs/socfpga_mcvevk_defconfig   |  1 +
 configs/socfpga_sockit_defconfig   |  1 +
 configs/socfpga_socrates_defconfig |  1 +
 configs/socfpga_sr1500_defconfig   |  1 +
 configs/socfpga_vining_fpga_defconfig  |  1 +
 drivers/mtd/spi/Makefile   |  2 +-
 drivers/mtd/spi/sf_internal.h  |  2 +-
 drivers/mtd/spi/sf_probe.c |  6 +++---
 include/configs/aristainetos-common.h  |  1 -
 include/configs/cm_fx6.h   |  7 ---
 include/configs/da850evm.h |  7 +--
 include/configs/dh_imx6.h  |  1 -
 include/configs/display5.h |  4 
 include/configs/gw_ventana.h   | 10 +-
 include/configs/rcar-gen2-common.h |  4 +---
 include/configs/socfpga_common.h   |  4 
 28 files changed, 25 insertions(+), 40 deletions(-)

diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
index 18ef5d2dce..0bfc117762 100644
--- a/configs/aristainetos2_defconfig
+++ b/configs/aristainetos2_defconfig
@@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=2000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
 CONFIG_PHYLIB=y
diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
index 1054c05d8c..e2da747a8f 100644
--- a/configs/aristainetos2b_defconfig
+++ b/configs/aristainetos2b_defconfig
@@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=2000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
 CONFIG_PHYLIB=y
diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
index 4080a7b310..5caf95c22f 100644
--- a/configs/aristainetos_defconfig
+++ b/configs/aristainetos_defconfig
@@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=2000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
 CONFIG_PHYLIB=y
diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
index fd0db4db5c..15be7db027 100644
--- a/configs/cm_fx6_defconfig
+++ b/configs/cm_fx6_defconfig
@@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
 CONFIG_DM_PMIC=y
diff --git a/configs/display5_defconfig b/configs/display5_defconfig
index 8609cd5a8c..5a4cc772be 100644
--- a/configs/display5_defconfig
+++ b/configs/display5_defconfig
@@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=5000
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_FEC_MXC=y
diff --git a/configs/display5_factory_defconfig 
b/configs/display5_factory_defconfig
index 70c64260d8..66c68e5ea9 100644
--- a/configs/display5_factory_defconfig
+++ b/configs/display5_factory_defconfig
@@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=5000
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
index 89e5ff8c71..30c2d19941 100644
--- a/configs/socfpga_arria5_defconfig
+++ b/configs/socfpga_arria5_defconfig
@@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # 

[U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD

2019-09-13 Thread Schrempf Frieder
From: Frieder Schrempf 

As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
now that a separate option for SPL was introduced.

Signed-off-by: Frieder Schrempf 
---
 configs/stm32mp15_basic_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 09785b5dc1..390319657f 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 # CONFIG_ARMV7_VIRT is not set
+CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
-CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_I2C_SUPPORT=y
@@ -90,6 +90,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPL_SPI_FLASH_MTD=y
 CONFIG_DM_ETH=y
 CONFIG_DWC_ETH_QOS=y
 CONFIG_PHY=y
-- 
2.17.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig

2019-09-13 Thread Schrempf Frieder
From: Frieder Schrempf 

To allow SPI_FLASH_MTD being enabled separately in SPL we add a new
option. The only user currently is the stm32mp15_basic board.

Signed-off-by: Frieder Schrempf 
---
 drivers/mtd/spi/Kconfig | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index d3b007a731..f5cb7f6577 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -196,4 +196,12 @@ config SPI_FLASH_MTD
 
  If unsure, say N
 
+config SPL_SPI_FLASH_MTD
+   bool "SPI flash MTD support for SPL"
+   depends on SPI_FLASH
+   help
+  Enable the MTD support for the SPI flash layer in SPL.
+
+ If unsure, say N
+
 endmenu # menu "SPI Flash Support"
-- 
2.17.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk3399: TPL: rockpro64: Wrong memory size detected

2019-09-13 Thread Kurt Miller
Re-testing with master as of Sep 12 and the wrong memory
size continues to be detected (2G detected while the
board has 4G).

The board has the following marking on it:

Rockpro64_V2.1 2018-07-02

RAM Chips:
PS052-053 BT
83RL

I'd be happy to test any proposed patches to correct
the memory size detection on this board.

On Wed, 2019-08-28 at 17:45 -0400, Kurt Miller wrote:
> The board has 4G memory but only 2G is detected by TPL. Please
> let me know if additional information is needed.
> 
> With u-boot master TPL output:
> 
> U-Boot TPL 2019.10-rc3-00020-ge4b8dd9b34-dirty (Aug 28 2019 - 17:26:44)
> LPDDR4, 50MHz
> BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
> LPDDR4, 50MHz
> BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
> 256B stride
> Trying to boot from BOOTROM
> Returning to boot ROM...
> 
> With rkbin rk3399_ddr_800MHz_v1.23.bin output:
> 
> DDR Version 1.23 20190709
> In   
> channel 0
> CS = 0   
> MR0=0xB8 
> MR4=0x2 
> MR5=0xFF
> MR8=0x10
> MR12=0x72   
> MR14=0x72   
> MR18=0x0
> MR19=0x0
> MR24=0x8
> MR25=0x0
> channel 1
> CS = 0
> MR0=0xB8
> MR4=0x2
> MR5=0xFF
> MR8=0x10
> MR12=0x72
> MR14=0x72
> MR18=0x0
> MR19=0x0
> MR24=0x8
> MR25=0x0
> channel 0 training pass!
> channel 1 training pass!
> change freq to 416MHz 0,1
> Channel 0: LPDDR4,416MHz
> Bus Width=32 Col=10 Bank=8 Row=16 CS=1 Die Bus-Width=16 Size=2048MB
> Channel 1: LPDDR4,416MHz
> Bus Width=32 Col=10 Bank=8 Row=16 CS=1 Die Bus-Width=16 Size=2048MB
> 256B stride
> channel 0
> CS = 0
> MR0=0xB8
> MR4=0x2
> MR5=0xFF
> MR8=0x10
> MR12=0x72
> MR14=0x72
> MR18=0x0
> MR19=0x0
> MR24=0x8
> MR25=0x0
> channel 1
> CS = 0
> MR0=0xB8
> MR4=0x2
> MR5=0xFF
> MR8=0x10
> MR12=0x72
> MR14=0x72
> MR18=0x0
> MR19=0x0
> MR24=0x8
> MR25=0x0
> channel 0 training pass!
> channel 1 training pass!
> channel 0, cs 0, advanced training done
> channel 1, cs 0, advanced training done
> change freq to 856MHz 1,0
> ch 0 ddrconfig = 0x101, ddrsize = 0x40
> ch 1 ddrconfig = 0x101, ddrsize = 0x40
> pmugrf_os_reg[2] = 0x32C1F2C1, stride = 0xD
> OUT

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


Re: [U-Boot] [EXT] Saving u-boot environment on LS1046ardb QSPI bricks flash memory

2019-09-13 Thread Matthew Ratson
Hi Ashish,

Thank you very much for your quick response and the information you
provided, greatly appreciated.

Do you possibly know what is the latest Denx u-boot release where this
issue does not exist, and QSPI builds are working?

Thanks,
Matthew

On Fri, Sep 13, 2019 at 5:22 AM Ashish Kumar  wrote:

>
>
> > -Original Message-
> > From: U-Boot  On Behalf Of Matthew
> > Ratson
> > Sent: Friday, September 13, 2019 12:55 AM
> > To: u-boot@lists.denx.de
> > Subject: [EXT] [U-Boot] Saving u-boot environment on LS1046ardb QSPI
> > bricks flash memory
> >
> > Caution: EXT Email
> >
> > Hi there,
> >
> > I am currently working with a LS1046ardb development board from
> > NXP/Layerscape. Using their provided firmware image from the primary QSPI
> > memory bank, I have tried to flash my own compiled u-boot (using the
> > ls1046ardb_qspi_defconfig file) onto the alternate memory bank. I have
> also
> > flashed a Reset Configuration Word (RCW) which was provided by NXP.
> >
> > This process is successful and the alternate bank boots into u-boot.
> > However, I discovered that after simply executing a "saveenv" command and
> > then rebooting again into the alternate bank, the alternate flash memory
> > seems to be "bricked". I can no longer boot into the alternate bank and
> > instead, the board will boot into the default bank.
> >
> > I am wondering if this issue and has been noticed already by someone or
> if
> > there is something I am not doing correctly.
> >
> > Is their a specific denx RCW that I should use instead, rather than the
> one
> > provided by NXP?
> >
> > Any help would be greatly appreciated!
> Hi Matthew,
>
> This driver is broken in upstream and it is work in progress to  fix  and
> update in upstream.
> You can still fetch this from github as few other people have also
> reported the same.
> On  github repo there are 2 version of driver.
>
> One with old xfer method and one with new spi-mem version.
> I am debugging the spi-mem version as this is the recommended version by
> maintainers .
> LS1046 is working via both methods. There are some debug prints in spi-mem
> version.
>
> https://github.com/erashish007/u-boot-spi-mem/
> br:  spi-mem-port
> https://github.com/erashish007/u-boot-spi-mem/
> br: xfer_wrking
>
> Regards
> Ashish
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> >
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d
> > enx.de%2Flistinfo%2Fu-
> > bootdata=02%7C01%7CAshish.Kumar%40nxp.com%7C8e1f67af6f3948
> > 9afc0e08d737bbfd91%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C
> > 637039152865550331sdata=C6DTwmG7cZXPey9J%2BTNUcqIr937vWhu
> > 1gE6Tq2tGr0g%3Dreserved=0
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] RSA verify code and required keys

2019-09-13 Thread Daniele Alessandrelli
Hi,

I was looking at the RSA image authentication code and I'm a bit
puzzled by the following line of codes in lib/rsa/rsa-verify.c
(https://gitlab.denx.de/u-boot/u-boot/blob/master/lib/rsa/rsa-verify.c#L440):

436 /* See if we must use a particular key */
437 if (info->required_keynode != -1) {
438 ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
439 info->required_keynode);
440 if (!ret)
441 return ret;
442 }
443
444 /* Look for a key that matches our hint */
445 snprintf(name, sizeof(name), "key-%s", info->keyname);
446 node = fdt_subnode_offset(blob, sig_node, name);
447 ret = rsa_verify_with_keynode(info, hash, sig, sig_len, node);
448 if (!ret)
449 return ret;

If I understand it correctly, at Line 440 we check if verification
with the required key succeeded and if so we return otherwise we
continue, trying other keys.

Is that the intended behavior? Shouldn't the code return in any case
(thus making the FIT verification process fail if the image couldn't
be verified with the required key)? Or am I missing something?

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


[U-Boot] [BUG] FreeBSD cannot boot with U-Boot patch efi_loader: parameter checks BLOCK_IO_PROTOCOL

2019-09-13 Thread Heinrich Schuchardt

Hello Emmanuel,

booting current FreeBSD fails since patch
f59f0825e8b9fdeb8abe43ffd10c5119ca1a032f
efi_loader: parameter checks BLOCK_IO_PROTOCOL

The reason is that the buffer used by FreeBSD to read is not block aligned.

The UEFI spec requires that EFI_BLOCK_IO_PROTOCOL.ReadBlocks() returns
EFI_INVALID_PARAMETER if the buffer is not properly aligned (i.e. is not
a multiple of EFI_BLOCK_IO_MEDIA.IoAlign)

FreeBSD does not guarantee this alignment, e.g. efi_disk_read_blocks()
is called with buffer 995b08d0 which is not aligned to a
multiple of 512.

FreeBSD function efipart_readwrite writes this error message:
efipart_readwrite: rw=1, blk=62333952 size=1 status=2

The problem can be traced back to the FreeBSD line:

stand/efi/libefi/efipart.c(1043) efipart_realstrategy():
blkbuf = malloc(blkio->Media->BlockSize);

U-Boot does not yet implement the EFI_DISK_IO_PROTOCOL which is a
wrapper for the EFI_BLOCK_IO_PROTOCOL allowing unaligned access.

malloc() could be replaced in FreeBSD by AllocatePages() which returns a
4096 byte aligned memory block.

Best regards

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


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Joe Hershberger
On Fri, Sep 13, 2019 at 9:31 AM Simon Glass  wrote:
>
> Hi Ondřej,
>
> On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
> >
> > On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > > This function fits better with the network subsystem, so move it.
> > > > > >
> > > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > > fixes the issue.
> > > > > >
> > > > > >   LD  u-boot
> > > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > > `eth_parse_enetaddr'
> > > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > > >
> > > > >
> > > > > Which board is this please?
> > > >
> > > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > > CONFIG_NET.
> > > >
> > > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > > disabled, this
> > > > function will not be available to nvedit.c.
> > > >
> > > > The board doesn't really matter.
> > >
> > > The offending call is in setup_environment() in board/sunxi/board.c so
> > > I think the board does matter. There might be something else I am
> > > missing but I cannot see it at present.
> > >
> > > Would you like to send a patch?
> >
> > I'd like to send a patch to revert this change and move eth_parse_enetaddr 
> > back.
> >
> > The call eth_env_set_enetaddr() is correct and should succeed even if net
> > is disabled in u-boot. It determines the stable MAC address to use for 
> > ethernet
> > interfaces described in DT for Linux to use.
> >
> > See fdt_fixup_ethernet() that does that.
> >
> > That feature is independent of the whole network stack and network drivers
> > in u-boot.
>
> So you are saying that you should be able to read the MAC address,
> etc. with CONFIG_NET disabled?
>
> I was certainly not aware of that.
>
> Joe do you have any thoughts here?

I think this case makes sense... It's essentially a valid type to want
to parse even if not using networking.

It seems it should be in lib/net_utils.c, which always builds.

Cheers,
-Joe

> Regards,
> SImon
> ___
> 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] rk3288: HDMI out causing boot hang

2019-09-13 Thread Jagan Teki
Hi Anatolij,

On Fri, Sep 13, 2019 at 7:31 PM Anatolij Gustschin  wrote:
>
> Hi Jagan,
>
> On Fri, 13 Sep 2019 08:19:47 +0530
> Jagan Teki ja...@amarulasolutions.com wrote:
> ...
> > Any inputs?
>
> Try to input "setenv stdout serial" command on the serial console.
> There might be a chance that stdout/stdin has switched to the
> video console and the output proceeds there. If the HDMI display
> shows nothing, it appears like a hang.

setting serial to stdout, would be a normal case, with this display
didn't probe atall.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] ubi: Add "skipcheck" command to set/clear this bit in the UBI volume hdr

2019-09-13 Thread Andreas Dannenberg
Hi Stefan,

On Thu, Sep 12, 2019 at 04:41:03PM +0200, Stefan Roese wrote:
> U-Boot now supports the "skip_check" flag to optionally skip the CRC
> check at open time. Currently its only possible to set this bit upon
> UBI volume creation. But it might be very useful to also set this bit
> on already installed systems (e.g. field upgrade) to make also use of
> the boot-time decrease on those systems.
> 
> This patch now adds a new "ubi" command "ubi skipcheck" to set or clear
> this bit in the UBI volume header:
> 
> => ubi skipcheck rootfs0 on
> Setting skip_check on volume rootfs0
> 
> BTW: This saves approx. 10 seconds Linux bootup time on a MT7688 based
> target with 128MiB of SPI NAND.

This is a useful series, thanks for preparing/submitting.

But how about adding the above info to the doc/README.ubi file
(updating the copy of the help text and the example so the new
flag is shown, and giving a quick summary of what this option does).


--
Andreas Dannenberg
Texas Instruments Inc



> 
> Signed-off-by: Stefan Roese 
> Cc: Quentin Schulz 
> Cc: Boris Brezillon 
> Cc: Heiko Schocher 
> ---
>  cmd/ubi.c | 34 ++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/cmd/ubi.c b/cmd/ubi.c
> index c857f07d93..42b5641b32 100644
> --- a/cmd/ubi.c
> +++ b/cmd/ubi.c
> @@ -419,6 +419,30 @@ static int ubi_dev_scan(struct mtd_info *info, const 
> char *vid_header_offset)
>   return 0;
>  }
>  
> +static int ubi_set_skip_check(char *volume, bool skip_check)
> +{
> + struct ubi_vtbl_record vtbl_rec;
> + struct ubi_volume *vol;
> +
> + vol = ubi_find_volume(volume);
> + if (vol == NULL)
> + return ENODEV;
> +
> + printf("%sing skip_check on volume %s\n",
> +skip_check ? "Sett" : "Clear", volume);
> +
> + vtbl_rec = ubi->vtbl[vol->vol_id];
> + if (skip_check) {
> + vtbl_rec.flags |= UBI_VTBL_SKIP_CRC_CHECK_FLG;
> + vol->skip_check = 1;
> + } else {
> + vtbl_rec.flags &= ~UBI_VTBL_SKIP_CRC_CHECK_FLG;
> + vol->skip_check = 0;
> + }
> +
> + return ubi_change_vtbl_record(ubi, vol->vol_id, _rec);
> +}
> +
>  static int ubi_detach(void)
>  {
>  #ifdef CONFIG_CMD_UBIFS
> @@ -578,6 +602,14 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>   return ubi_remove_vol(argv[2]);
>   }
>  
> + if (strncmp(argv[1], "skipcheck", 9) == 0) {
> + /* E.g., change skip_check flag */
> + if (argc == 4) {
> + skipcheck = strncmp(argv[3], "on", 2) == 0;
> + return ubi_set_skip_check(argv[2], skipcheck);
> + }
> + }
> +
>   if (strncmp(argv[1], "write", 5) == 0) {
>   int ret;
>  
> @@ -658,6 +690,8 @@ U_BOOT_CMD(
>   " - Read volume to address with size\n"
>   "ubi remove[vol] volume"
>   " - Remove volume\n"
> + "ubi skipcheck volume on/off"
> + " - Set or clear skip_check flag in volume header\n"
>   "[Legends]\n"
>   " volume: character name\n"
>   " size: specified in bytes\n"
> -- 
> 2.23.0
> 
> ___
> 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] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Ondřej Jirman
On Fri, Sep 13, 2019 at 08:00:50PM +, Joe Hershberger wrote:
> On Fri, Sep 13, 2019 at 2:53 PM Ondřej Jirman  wrote:
> > > It sounds like your board / build config is not in the mainline tree,
> > > so there is no way Simon could have known it would break you, and it
> > > didn't break the existing boards, hence his comment. I strongly
> > > encourage you to send a series adding your config so that it has an
> > > opportunity to be build tested.
> >
> > I'm using orangepi_pc_defconfig. It's mainline.
> >
> > I just disable a few things, like USB and NET. That's enough for it to
> > break the build.
> 
> Clearly the point is that the actual problematic config is not mainline.
> 
> > I don't think my minimalistic config would be proper as a defconfig for that
> > particular board.
> 
> I was not suggesting to replace it, simply to add a minimal one. There
> are plenty of examples of boards with several defconfigs.

Interesting, I may add one then. Not sure what sunxi maintainer will think of
that, but if it has value for testing, why not. Probably just one minimal
config would have caught this, so I guess it has some value.

Thanks for suggestion.

> > Anyway, the kernel has feature that generates random
> > configs for revealing these kinds of issues.
> 
> Are you suggesting that you can port this to U-Boot so we can test in
> a similar way?

It's a Kconfig feature, you can already use it. Try make randconfig inside
u-boot.

regards,
o.

> > regards,
> > o.
> >
> > > > I'm more used to the Linux kernel, where it's sort of expected that
> > > > random configurations at least build, if not boot.
> > >
> > > No, that is the expectation here too, and generally we accomplish that.
> > >
> > > > I don't mind having local patches for my specific configurations, if
> > > > expectations for straying from defconfig are different for u-boot.
> > > >
> > > > regards,
> > > > o.
> > > >
> > > > > Regards,
> > > > > Simon
> > > > ___
> > > > 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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: mdio/mii: add Kconfig help and allow break dependency

2019-09-13 Thread Joe Hershberger
On Fri, Sep 13, 2019 at 10:28 AM Ramon Fried  wrote:
>
> * Add Kconfig help describing the purpose of each command.
> * Add CONFIG_CMD_MDIO so it could be selected individually, as
>   it doesn't depend on the mii command.
> * Add Kconfig imply to mii to automatically select the mdio
>   command.
>
> Signed-off-by: Ramon Fried 

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


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Joe Hershberger
On Fri, Sep 13, 2019 at 2:53 PM Ondřej Jirman  wrote:
>
> Hi Joe,
>
> On Fri, Sep 13, 2019 at 07:38:20PM +, Joe Hershberger wrote:
> > Hi Ondřej,
> >
> > On Fri, Sep 13, 2019 at 2:12 PM Ondřej Jirman  wrote:
> > >
> > > On Fri, Sep 13, 2019 at 10:58:14AM -0600, Simon Glass wrote:
> > > > Hi,
> > > >
> > > > On Fri, 13 Sep 2019 at 08:07, Heinrich Schuchardt  
> > > > wrote:
> > > > >
> > > > > On 9/13/19 1:48 PM, Ondřej Jirman wrote:
> > > > > > On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
> > > > > >> On 9/13/19 1:48 AM, meg...@megous.com wrote:
> > > > > >>> From: Ondrej Jirman 
> > > > > >>>
> > > > > >>> The reverted patch causes linking error with disabled CONFIG_NET:
> > > > > >>>
> > > > > >>>cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > >>>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > >>> `eth_parse_enetaddr'
> > > > > >>>
> > > > > >>> Function setup_environment() in board/sunxi/board.c calls
> > > > > >>> eth_env_set_enetaddr() to setup stable mac address for ethernet 
> > > > > >>> interfaces.
> > > > > >>>
> > > > > >>> This needs to be implemented and succeed even if net is disabled 
> > > > > >>> in u-boot,
> > > > > >>> as it ensures Linux will not generate random MAC addresses, and 
> > > > > >>> picks the
> > > > > >>> ones provided by u-boot via DT. See fdt_fixup_ethernet().
> > > > > >>>
> > > > > >>> This feature is independent of the whole network stack and 
> > > > > >>> network drivers
> > > > > >>> in u-boot.
> > > > > >>>
> > > > > >>> This revert fixes the linking error.
> > > > > >>>
> > > > > >>> Signed-off-by: Ondrej Jirman 
> > > > > >>> ---
> > > > > >>>   cmd/nvedit.c   | 12 
> > > > > >>>   include/env_internal.h | 11 +++
> > > > > >>>   include/net.h  | 11 ---
> > > > > >>>   net/net.c  | 12 
> > > > > >>>   4 files changed, 23 insertions(+), 23 deletions(-)
> > > > > >>>
> > > > > >>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> > > > > >>> index 1cb0bc1460..399f6d6ce1 100644
> > > > > >>> --- a/cmd/nvedit.c
> > > > > >>> +++ b/cmd/nvedit.c
> > > > > >>> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> > > > > >>> default_val)
> > > > > >>> return value;
> > > > > >>>   }
> > > > > >>>
> > > > > >>> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> > > > > >>> +{
> > > > > >>> +   char *end;
> > > > > >>> +   int i;
> > > > > >>> +
> > > > > >>> +   for (i = 0; i < 6; ++i) {
> > > > > >>> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 
> > > > > >>> 0;
> > > > > >>> +   if (addr)
> > > > > >>> +   addr = (*end) ? end + 1 : end;
> > > > > >>> +   }
> > > > > >>> +}
> > > > > >>> +
> > > > > >>>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
> > > > > >>>   {
> > > > > >>> eth_parse_enetaddr(env_get(name), enetaddr);
> > > > > >>> diff --git a/include/env_internal.h b/include/env_internal.h
> > > > > >>> index b1ddcb5adf..27eb5bd1e7 100644
> > > > > >>> --- a/include/env_internal.h
> > > > > >>> +++ b/include/env_internal.h
> > > > > >>
> > > > > >> Please, don't move the definition to env_internal.h but to env.h as
> > > > > >> board/renesas/sh7753evb/sh7753evb.c and others are using
> > > > > >> eth_parse_enetaddr().
> > > > > >>
> > > > > >> env_internal.h explicitly states "It should not be included by 
> > > > > >> board files".
> > > > > >>
> > > > > >> Please, execute Travis CI tests to ensure you do not break any 
> > > > > >> other board.
> > > > > >
> > > > > > I haven't found any documentation in the tree or on the u-boot 
> > > > > > website on
> > > > > > how to do that.
> > > > > >
> > > > > > regards,
> > > > > >   o.
> > > > >
> > > > > Create a repository with U-Boot on Github (e.g. fork
> > > > > https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
> > > > > your Github account. Allow Travis to access the U-Boot repository. In
> > > > > settings select "Build pushed requests". Push your commit to Github. 
> > > > > Now
> > > > > Travis should start building (takes about 4 hours).
> > > > >
> > > > > The file telling Travis what to do is in .travis.yml in U-Boot.
> > > > >
> > > >
> > > > I think it would be better to do a patch to move this function into a
> > > > common/ file, and add a new config to test for this case.
> > > >
> > > > I understand the desire for a revert, but no build was broken due to
> > > > the original patch, and the expected behaviour was not obvious.
> > >
> > > My build was broken, where previously it worked with the same config
> > > on v2019.07. Otherwise I wouldn't complain. Or are u-boot builds
> > > not meant to be user configurable, at least at the high level, like
> > > disabling usb/net, or other big subystems that may be unnecessary and
> > > take a lot of space and boot time?
> >
> > It sounds like your board / build config is not in the mainline tree,
> > so there 

[U-Boot] [PATCH] Update MAINTAINERS to include environment files

2019-09-13 Thread Joe Hershberger
To be maintained by me (Joe) and Wolfgang Denx

Signed-off-by: Joe Hershberger 
---

 MAINTAINERS | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e752e4b3de..0ff78366ec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -540,6 +540,16 @@ F: cmd/efidebug.c
 F: cmd/nvedit_efi.c
 F: tools/file2include.c
 
+ENVIRONMENT
+M: Joe Hershberger 
+M: Wolfgang Denk 
+S: Maintained
+F: env/
+F: include/env*
+F: test/env/
+F: tools/env*
+F: tools/mkenvimage.c
+
 FPGA
 M: Michal Simek 
 S: Maintained
-- 
2.11.0

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


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Ondřej Jirman
Hi Joe,

On Fri, Sep 13, 2019 at 07:38:20PM +, Joe Hershberger wrote:
> Hi Ondřej,
> 
> On Fri, Sep 13, 2019 at 2:12 PM Ondřej Jirman  wrote:
> >
> > On Fri, Sep 13, 2019 at 10:58:14AM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Fri, 13 Sep 2019 at 08:07, Heinrich Schuchardt  
> > > wrote:
> > > >
> > > > On 9/13/19 1:48 PM, Ondřej Jirman wrote:
> > > > > On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
> > > > >> On 9/13/19 1:48 AM, meg...@megous.com wrote:
> > > > >>> From: Ondrej Jirman 
> > > > >>>
> > > > >>> The reverted patch causes linking error with disabled CONFIG_NET:
> > > > >>>
> > > > >>>cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > >>>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > >>> `eth_parse_enetaddr'
> > > > >>>
> > > > >>> Function setup_environment() in board/sunxi/board.c calls
> > > > >>> eth_env_set_enetaddr() to setup stable mac address for ethernet 
> > > > >>> interfaces.
> > > > >>>
> > > > >>> This needs to be implemented and succeed even if net is disabled in 
> > > > >>> u-boot,
> > > > >>> as it ensures Linux will not generate random MAC addresses, and 
> > > > >>> picks the
> > > > >>> ones provided by u-boot via DT. See fdt_fixup_ethernet().
> > > > >>>
> > > > >>> This feature is independent of the whole network stack and network 
> > > > >>> drivers
> > > > >>> in u-boot.
> > > > >>>
> > > > >>> This revert fixes the linking error.
> > > > >>>
> > > > >>> Signed-off-by: Ondrej Jirman 
> > > > >>> ---
> > > > >>>   cmd/nvedit.c   | 12 
> > > > >>>   include/env_internal.h | 11 +++
> > > > >>>   include/net.h  | 11 ---
> > > > >>>   net/net.c  | 12 
> > > > >>>   4 files changed, 23 insertions(+), 23 deletions(-)
> > > > >>>
> > > > >>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> > > > >>> index 1cb0bc1460..399f6d6ce1 100644
> > > > >>> --- a/cmd/nvedit.c
> > > > >>> +++ b/cmd/nvedit.c
> > > > >>> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> > > > >>> default_val)
> > > > >>> return value;
> > > > >>>   }
> > > > >>>
> > > > >>> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> > > > >>> +{
> > > > >>> +   char *end;
> > > > >>> +   int i;
> > > > >>> +
> > > > >>> +   for (i = 0; i < 6; ++i) {
> > > > >>> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> > > > >>> +   if (addr)
> > > > >>> +   addr = (*end) ? end + 1 : end;
> > > > >>> +   }
> > > > >>> +}
> > > > >>> +
> > > > >>>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
> > > > >>>   {
> > > > >>> eth_parse_enetaddr(env_get(name), enetaddr);
> > > > >>> diff --git a/include/env_internal.h b/include/env_internal.h
> > > > >>> index b1ddcb5adf..27eb5bd1e7 100644
> > > > >>> --- a/include/env_internal.h
> > > > >>> +++ b/include/env_internal.h
> > > > >>
> > > > >> Please, don't move the definition to env_internal.h but to env.h as
> > > > >> board/renesas/sh7753evb/sh7753evb.c and others are using
> > > > >> eth_parse_enetaddr().
> > > > >>
> > > > >> env_internal.h explicitly states "It should not be included by board 
> > > > >> files".
> > > > >>
> > > > >> Please, execute Travis CI tests to ensure you do not break any other 
> > > > >> board.
> > > > >
> > > > > I haven't found any documentation in the tree or on the u-boot 
> > > > > website on
> > > > > how to do that.
> > > > >
> > > > > regards,
> > > > >   o.
> > > >
> > > > Create a repository with U-Boot on Github (e.g. fork
> > > > https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
> > > > your Github account. Allow Travis to access the U-Boot repository. In
> > > > settings select "Build pushed requests". Push your commit to Github. Now
> > > > Travis should start building (takes about 4 hours).
> > > >
> > > > The file telling Travis what to do is in .travis.yml in U-Boot.
> > > >
> > >
> > > I think it would be better to do a patch to move this function into a
> > > common/ file, and add a new config to test for this case.
> > >
> > > I understand the desire for a revert, but no build was broken due to
> > > the original patch, and the expected behaviour was not obvious.
> >
> > My build was broken, where previously it worked with the same config
> > on v2019.07. Otherwise I wouldn't complain. Or are u-boot builds
> > not meant to be user configurable, at least at the high level, like
> > disabling usb/net, or other big subystems that may be unnecessary and
> > take a lot of space and boot time?
> 
> It sounds like your board / build config is not in the mainline tree,
> so there is no way Simon could have known it would break you, and it
> didn't break the existing boards, hence his comment. I strongly
> encourage you to send a series adding your config so that it has an
> opportunity to be build tested.

I'm using orangepi_pc_defconfig. It's mainline.

I just disable a few things, like 

Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Joe Hershberger
Hi Ondřej,

On Fri, Sep 13, 2019 at 2:12 PM Ondřej Jirman  wrote:
>
> On Fri, Sep 13, 2019 at 10:58:14AM -0600, Simon Glass wrote:
> > Hi,
> >
> > On Fri, 13 Sep 2019 at 08:07, Heinrich Schuchardt  
> > wrote:
> > >
> > > On 9/13/19 1:48 PM, Ondřej Jirman wrote:
> > > > On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
> > > >> On 9/13/19 1:48 AM, meg...@megous.com wrote:
> > > >>> From: Ondrej Jirman 
> > > >>>
> > > >>> The reverted patch causes linking error with disabled CONFIG_NET:
> > > >>>
> > > >>>cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > >>>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > >>> `eth_parse_enetaddr'
> > > >>>
> > > >>> Function setup_environment() in board/sunxi/board.c calls
> > > >>> eth_env_set_enetaddr() to setup stable mac address for ethernet 
> > > >>> interfaces.
> > > >>>
> > > >>> This needs to be implemented and succeed even if net is disabled in 
> > > >>> u-boot,
> > > >>> as it ensures Linux will not generate random MAC addresses, and picks 
> > > >>> the
> > > >>> ones provided by u-boot via DT. See fdt_fixup_ethernet().
> > > >>>
> > > >>> This feature is independent of the whole network stack and network 
> > > >>> drivers
> > > >>> in u-boot.
> > > >>>
> > > >>> This revert fixes the linking error.
> > > >>>
> > > >>> Signed-off-by: Ondrej Jirman 
> > > >>> ---
> > > >>>   cmd/nvedit.c   | 12 
> > > >>>   include/env_internal.h | 11 +++
> > > >>>   include/net.h  | 11 ---
> > > >>>   net/net.c  | 12 
> > > >>>   4 files changed, 23 insertions(+), 23 deletions(-)
> > > >>>
> > > >>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> > > >>> index 1cb0bc1460..399f6d6ce1 100644
> > > >>> --- a/cmd/nvedit.c
> > > >>> +++ b/cmd/nvedit.c
> > > >>> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> > > >>> default_val)
> > > >>> return value;
> > > >>>   }
> > > >>>
> > > >>> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> > > >>> +{
> > > >>> +   char *end;
> > > >>> +   int i;
> > > >>> +
> > > >>> +   for (i = 0; i < 6; ++i) {
> > > >>> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> > > >>> +   if (addr)
> > > >>> +   addr = (*end) ? end + 1 : end;
> > > >>> +   }
> > > >>> +}
> > > >>> +
> > > >>>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
> > > >>>   {
> > > >>> eth_parse_enetaddr(env_get(name), enetaddr);
> > > >>> diff --git a/include/env_internal.h b/include/env_internal.h
> > > >>> index b1ddcb5adf..27eb5bd1e7 100644
> > > >>> --- a/include/env_internal.h
> > > >>> +++ b/include/env_internal.h
> > > >>
> > > >> Please, don't move the definition to env_internal.h but to env.h as
> > > >> board/renesas/sh7753evb/sh7753evb.c and others are using
> > > >> eth_parse_enetaddr().
> > > >>
> > > >> env_internal.h explicitly states "It should not be included by board 
> > > >> files".
> > > >>
> > > >> Please, execute Travis CI tests to ensure you do not break any other 
> > > >> board.
> > > >
> > > > I haven't found any documentation in the tree or on the u-boot website 
> > > > on
> > > > how to do that.
> > > >
> > > > regards,
> > > >   o.
> > >
> > > Create a repository with U-Boot on Github (e.g. fork
> > > https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
> > > your Github account. Allow Travis to access the U-Boot repository. In
> > > settings select "Build pushed requests". Push your commit to Github. Now
> > > Travis should start building (takes about 4 hours).
> > >
> > > The file telling Travis what to do is in .travis.yml in U-Boot.
> > >
> >
> > I think it would be better to do a patch to move this function into a
> > common/ file, and add a new config to test for this case.
> >
> > I understand the desire for a revert, but no build was broken due to
> > the original patch, and the expected behaviour was not obvious.
>
> My build was broken, where previously it worked with the same config
> on v2019.07. Otherwise I wouldn't complain. Or are u-boot builds
> not meant to be user configurable, at least at the high level, like
> disabling usb/net, or other big subystems that may be unnecessary and
> take a lot of space and boot time?

It sounds like your board / build config is not in the mainline tree,
so there is no way Simon could have known it would break you, and it
didn't break the existing boards, hence his comment. I strongly
encourage you to send a series adding your config so that it has an
opportunity to be build tested.

> I'm more used to the Linux kernel, where it's sort of expected that
> random configurations at least build, if not boot.

No, that is the expectation here too, and generally we accomplish that.

> I don't mind having local patches for my specific configurations, if
> expectations for straying from defconfig are different for u-boot.
>
> regards,
> o.
>
> > Regards,
> > Simon
> 

Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Ondřej Jirman
On Fri, Sep 13, 2019 at 10:58:14AM -0600, Simon Glass wrote:
> Hi,
> 
> On Fri, 13 Sep 2019 at 08:07, Heinrich Schuchardt  wrote:
> >
> > On 9/13/19 1:48 PM, Ondřej Jirman wrote:
> > > On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
> > >> On 9/13/19 1:48 AM, meg...@megous.com wrote:
> > >>> From: Ondrej Jirman 
> > >>>
> > >>> The reverted patch causes linking error with disabled CONFIG_NET:
> > >>>
> > >>>cmd/built-in.o: In function `eth_env_get_enetaddr':
> > >>>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > >>> `eth_parse_enetaddr'
> > >>>
> > >>> Function setup_environment() in board/sunxi/board.c calls
> > >>> eth_env_set_enetaddr() to setup stable mac address for ethernet 
> > >>> interfaces.
> > >>>
> > >>> This needs to be implemented and succeed even if net is disabled in 
> > >>> u-boot,
> > >>> as it ensures Linux will not generate random MAC addresses, and picks 
> > >>> the
> > >>> ones provided by u-boot via DT. See fdt_fixup_ethernet().
> > >>>
> > >>> This feature is independent of the whole network stack and network 
> > >>> drivers
> > >>> in u-boot.
> > >>>
> > >>> This revert fixes the linking error.
> > >>>
> > >>> Signed-off-by: Ondrej Jirman 
> > >>> ---
> > >>>   cmd/nvedit.c   | 12 
> > >>>   include/env_internal.h | 11 +++
> > >>>   include/net.h  | 11 ---
> > >>>   net/net.c  | 12 
> > >>>   4 files changed, 23 insertions(+), 23 deletions(-)
> > >>>
> > >>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> > >>> index 1cb0bc1460..399f6d6ce1 100644
> > >>> --- a/cmd/nvedit.c
> > >>> +++ b/cmd/nvedit.c
> > >>> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> > >>> default_val)
> > >>> return value;
> > >>>   }
> > >>>
> > >>> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> > >>> +{
> > >>> +   char *end;
> > >>> +   int i;
> > >>> +
> > >>> +   for (i = 0; i < 6; ++i) {
> > >>> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> > >>> +   if (addr)
> > >>> +   addr = (*end) ? end + 1 : end;
> > >>> +   }
> > >>> +}
> > >>> +
> > >>>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
> > >>>   {
> > >>> eth_parse_enetaddr(env_get(name), enetaddr);
> > >>> diff --git a/include/env_internal.h b/include/env_internal.h
> > >>> index b1ddcb5adf..27eb5bd1e7 100644
> > >>> --- a/include/env_internal.h
> > >>> +++ b/include/env_internal.h
> > >>
> > >> Please, don't move the definition to env_internal.h but to env.h as
> > >> board/renesas/sh7753evb/sh7753evb.c and others are using
> > >> eth_parse_enetaddr().
> > >>
> > >> env_internal.h explicitly states "It should not be included by board 
> > >> files".
> > >>
> > >> Please, execute Travis CI tests to ensure you do not break any other 
> > >> board.
> > >
> > > I haven't found any documentation in the tree or on the u-boot website on
> > > how to do that.
> > >
> > > regards,
> > >   o.
> >
> > Create a repository with U-Boot on Github (e.g. fork
> > https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
> > your Github account. Allow Travis to access the U-Boot repository. In
> > settings select "Build pushed requests". Push your commit to Github. Now
> > Travis should start building (takes about 4 hours).
> >
> > The file telling Travis what to do is in .travis.yml in U-Boot.
> >
> 
> I think it would be better to do a patch to move this function into a
> common/ file, and add a new config to test for this case.
>
> I understand the desire for a revert, but no build was broken due to
> the original patch, and the expected behaviour was not obvious.

My build was broken, where previously it worked with the same config
on v2019.07. Otherwise I wouldn't complain. Or are u-boot builds
not meant to be user configurable, at least at the high level, like
disabling usb/net, or other big subystems that may be unnecessary and
take a lot of space and boot time?

I'm more used to the Linux kernel, where it's sort of expected that
random configurations at least build, if not boot.

I don't mind having local patches for my specific configurations, if
expectations for straying from defconfig are different for u-boot.

regards,
o.

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


Re: [U-Boot] Tinker-rk3288 SPL broken with MMC timeout

2019-09-13 Thread Michael Nazzareno Trimarchi
Hi Tom

On Fri, Sep 13, 2019 at 5:47 PM Tom Rini  wrote:
>
> On Fri, Sep 13, 2019 at 08:11:17AM +0530, Jagan Teki wrote:
> > On Thu, Sep 12, 2019 at 8:25 PM Tom Rini  wrote:
> > >
> > > On Thu, Sep 12, 2019 at 08:55:24AM +0530, Jagan Teki wrote:
> > >
> > > > I have seen this even on v2019.07 release, and the only release that
> > > > it got working with on v2019.01 (SPL, BROM_RETURN)
> > > >
> > > > Any idea? here is the log dump.
> > > >
> > > > U-Boot TPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36)
> > > > Trying to boot from BOOTROM
> > > > Returning to boot ROM...
> > > >
> > > > U-Boot SPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36 +0530)
> > > > Trying to boot from MMC1
> > > > spl: mmc init failed with error: -110
> > > > SPL: failed to boot from all boot devices
> > > > ### ERROR ### Please RESET the board ###
> > >
> > > Time to run 'git bisect' since you know when it worked last at least?
> >
> > Look hard to bisect, few of commits in between seems SPL size
> > blow-out, doesn't boot etc. May be verify with respect boards might
> > help.
>
> It certainly sounds like a challenging bisect, yes.  I've 'bisect
> skip'ed and then 'git stash save' / 'git stash apply' a handful of
> work-arounds to narrow down hard cases like this before.  It's also
> worth keeping in mind that you can insert steps manually into a bisect.
> For something like this where v2019.01 works and HEAD doesn't, I'd do:
> $ git bisect start
> $ git bisect good v2019.01
> $ git bisect bad v2019.10-rc3
> $ git checkout v2019.04
> and see what happens.
U-Boot TPL 2019.10-rc3-00307-g87d5b22558-dirty (Sep 13 2019 - 20:06:40)
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2019.10-rc3-00307-g87d5b22558-dirty (Sep 13 2019 - 20:06:40 +0200)
Trying to boot from MMC1
Buswidth = 0, clock: 0
Buswidth = 1, clock: 0
Buswidth = 1, clock: 40
Sending CMD0
Sending CMD8
Sending CMD55
Sending CMD41
Sending CMD55
Sending CMD41
Sending CMD2
Sending CMD3
Sending CMD9
Sending CMD7
Sending CMD55
Sending CMD51
dwmci_data_transfer: Timeout waiting for data!
wait_for_bit_le32: Timeout (reg= mask=2 wait_set=)
dwmci_send_cmd: DWMCI_IDINTEN mask 0x2 timeout.
Sending CMD51
dwmci_send_cmd: Response Timeout.
Sending CMD51
dwmci_send_cmd: Response Timeout.
Sending CMD51
dwmci_send_cmd: Response Timeout.
spl: mmc init failed with error: -110
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

It's broken since a lot most of the version does not boot because SPL
is too big. This the problem I have in debug
CMD51 is get_capabilitis

Michael

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



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] OMAP watchdog timer reset on BBB

2019-09-13 Thread Grygorii Strashko



On 12/09/2019 19:33, Sam Protsenko wrote:

Hi Stefan,

On Thu, Sep 12, 2019 at 5:38 PM Stefan Roese  wrote:


Hi Sam,

On 12.09.19 15:45, Sam Protsenko wrote:

Hi Suniel,

After transition to DM WDT, watchdog timer on BeagleBone Black resets
the board after 1 minute or so. I'm using this defconfig: [1]. After
disabling CONFIG_WDT and CONFIG_WATCHDOG options the board doesn't
reset. I guess it might be happening on other boards using
CONFIG_WDT_OMAP3 as well. The issue can be reproduced by stopping in
U-Boot shell (=>) and waiting for 1 minute.

Do you know by chance why it might be happening, or maybe some fix
already exists?

Thanks!

[1] https://pastebin.ubuntu.com/p/Zz5bY6cYXS/


So you have enabled the watchdog and should see something like this
upon bootup:

WDT:   Started without servicing (60s timeout)

Is this correct? Then you need to enable the U-Boot internal WDT
servicing by enabling CONFIG_WATCHDOG as well, as this will
result in the internal U-Boot servicing of the watchdog. Then
you should see this upon bootup and no reset will appear in
U-Boot:

WDT:   Started with servicing (60s timeout)



I'm seeing this ("with servicing") line, and CONFIG_WATCHDOG is
already enabled in am335x_evm_defconfig. So I think it's an issue,
which *probably* appeared when watchdog drivers were converted to
Driver Model (this defconfig is using CONFIG_WDT + CONFIG_WDT_OMAP3
options). Any clues what can be wrong?


Does this help?

It seems logic of hw_watchdog_reset() and omap3_wdt_reset() is different.
Pay attention at wdt_trgr_pattern.

It seems that
priv->wdt_trgr_pattern = 0x1234;
need to be moved in omap3_wdt_probe()
 


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


[U-Boot] [PATCH 1/1] efi_loader: incorrect return value form DisconnectController

2019-09-13 Thread Heinrich Schuchardt
DisconnectController() should never return EFI_NOT_FOUND.
If EFI_DRIVER_BINDING_PROTOCOL.Stop() fails, return EFI_DEVICE_ERROR.

If the driver handle does not expose the EFI_DRIVER_BINDING_PROTOCOL
return EFI_INVALID_PARAMETER.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index b9bff894cb..493d906c64 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -3499,7 +3499,6 @@ static efi_status_t EFIAPI efi_disconnect_controller(
efi_handle_t *child_handle_buffer = NULL;
size_t number_of_children = 0;
efi_status_t r;
-   size_t stop_count = 0;
struct efi_object *efiobj;

EFI_ENTRY("%p, %p, %p", controller_handle, driver_image_handle,
@@ -3539,32 +3538,35 @@ static efi_status_t EFIAPI efi_disconnect_controller(
   (void **)_protocol,
   driver_image_handle, NULL,
   EFI_OPEN_PROTOCOL_GET_PROTOCOL));
-   if (r != EFI_SUCCESS)
+   if (r != EFI_SUCCESS) {
+   r = EFI_INVALID_PARAMETER;
goto out;
+   }
/* Remove the children */
if (number_of_children) {
r = EFI_CALL(binding_protocol->stop(binding_protocol,
controller_handle,
number_of_children,
child_handle_buffer));
-   if (r == EFI_SUCCESS)
-   ++stop_count;
+   if (r != EFI_SUCCESS) {
+   r = EFI_DEVICE_ERROR;
+   goto out;
+   }
}
/* Remove the driver */
-   if (!child_handle)
+   if (!child_handle) {
r = EFI_CALL(binding_protocol->stop(binding_protocol,
controller_handle,
0, NULL));
-   if (r == EFI_SUCCESS)
-   ++stop_count;
+   if (r != EFI_SUCCESS) {
+   r = EFI_DEVICE_ERROR;
+   goto out;
+   }
+   }
EFI_CALL(efi_close_protocol(driver_image_handle,
_guid_driver_binding_protocol,
driver_image_handle, NULL));
-
-   if (stop_count)
-   r = EFI_SUCCESS;
-   else
-   r = EFI_NOT_FOUND;
+   r = EFI_SUCCESS;
 out:
if (!child_handle)
free(child_handle_buffer);
--
2.20.1

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


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Heinrich Schuchardt
On 9/13/19 6:58 PM, Simon Glass wrote:
> Hi,
>
> On Fri, 13 Sep 2019 at 08:07, Heinrich Schuchardt  wrote:
>>
>> On 9/13/19 1:48 PM, Ondřej Jirman wrote:
>>> On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
 On 9/13/19 1:48 AM, meg...@megous.com wrote:
> From: Ondrej Jirman 
>
> The reverted patch causes linking error with disabled CONFIG_NET:
>
>cmd/built-in.o: In function `eth_env_get_enetaddr':
>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> `eth_parse_enetaddr'
>
> Function setup_environment() in board/sunxi/board.c calls
> eth_env_set_enetaddr() to setup stable mac address for ethernet 
> interfaces.
>
> This needs to be implemented and succeed even if net is disabled in 
> u-boot,
> as it ensures Linux will not generate random MAC addresses, and picks the
> ones provided by u-boot via DT. See fdt_fixup_ethernet().
>
> This feature is independent of the whole network stack and network drivers
> in u-boot.
>
> This revert fixes the linking error.
>
> Signed-off-by: Ondrej Jirman 
> ---
>   cmd/nvedit.c   | 12 
>   include/env_internal.h | 11 +++
>   include/net.h  | 11 ---
>   net/net.c  | 12 
>   4 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index 1cb0bc1460..399f6d6ce1 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> default_val)
> return value;
>   }
>
> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> +{
> +   char *end;
> +   int i;
> +
> +   for (i = 0; i < 6; ++i) {
> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> +   if (addr)
> +   addr = (*end) ? end + 1 : end;
> +   }
> +}
> +
>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
>   {
> eth_parse_enetaddr(env_get(name), enetaddr);
> diff --git a/include/env_internal.h b/include/env_internal.h
> index b1ddcb5adf..27eb5bd1e7 100644
> --- a/include/env_internal.h
> +++ b/include/env_internal.h

 Please, don't move the definition to env_internal.h but to env.h as
 board/renesas/sh7753evb/sh7753evb.c and others are using
 eth_parse_enetaddr().

 env_internal.h explicitly states "It should not be included by board 
 files".

 Please, execute Travis CI tests to ensure you do not break any other board.
>>>
>>> I haven't found any documentation in the tree or on the u-boot website on
>>> how to do that.
>>>
>>> regards,
>>>   o.
>>
>> Create a repository with U-Boot on Github (e.g. fork
>> https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
>> your Github account. Allow Travis to access the U-Boot repository. In
>> settings select "Build pushed requests". Push your commit to Github. Now
>> Travis should start building (takes about 4 hours).
>>
>> The file telling Travis what to do is in .travis.yml in U-Boot.
>>
>
> I think it would be better to do a patch to move this function into a
> common/ file, and add a new config to test for this case.

Do we really need a CONFIG? Doesn't the linker take care of eliminating
unused global functions?

Regards

Heinrich

>
> I understand the desire for a revert, but no build was broken due to
> the original patch, and the expected behaviour was not obvious.
>
> Regards,
> Simon
>

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


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Simon Glass
Hi,

On Fri, 13 Sep 2019 at 08:07, Heinrich Schuchardt  wrote:
>
> On 9/13/19 1:48 PM, Ondřej Jirman wrote:
> > On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
> >> On 9/13/19 1:48 AM, meg...@megous.com wrote:
> >>> From: Ondrej Jirman 
> >>>
> >>> The reverted patch causes linking error with disabled CONFIG_NET:
> >>>
> >>>cmd/built-in.o: In function `eth_env_get_enetaddr':
> >>>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> >>> `eth_parse_enetaddr'
> >>>
> >>> Function setup_environment() in board/sunxi/board.c calls
> >>> eth_env_set_enetaddr() to setup stable mac address for ethernet 
> >>> interfaces.
> >>>
> >>> This needs to be implemented and succeed even if net is disabled in 
> >>> u-boot,
> >>> as it ensures Linux will not generate random MAC addresses, and picks the
> >>> ones provided by u-boot via DT. See fdt_fixup_ethernet().
> >>>
> >>> This feature is independent of the whole network stack and network drivers
> >>> in u-boot.
> >>>
> >>> This revert fixes the linking error.
> >>>
> >>> Signed-off-by: Ondrej Jirman 
> >>> ---
> >>>   cmd/nvedit.c   | 12 
> >>>   include/env_internal.h | 11 +++
> >>>   include/net.h  | 11 ---
> >>>   net/net.c  | 12 
> >>>   4 files changed, 23 insertions(+), 23 deletions(-)
> >>>
> >>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> >>> index 1cb0bc1460..399f6d6ce1 100644
> >>> --- a/cmd/nvedit.c
> >>> +++ b/cmd/nvedit.c
> >>> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> >>> default_val)
> >>> return value;
> >>>   }
> >>>
> >>> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> >>> +{
> >>> +   char *end;
> >>> +   int i;
> >>> +
> >>> +   for (i = 0; i < 6; ++i) {
> >>> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> >>> +   if (addr)
> >>> +   addr = (*end) ? end + 1 : end;
> >>> +   }
> >>> +}
> >>> +
> >>>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
> >>>   {
> >>> eth_parse_enetaddr(env_get(name), enetaddr);
> >>> diff --git a/include/env_internal.h b/include/env_internal.h
> >>> index b1ddcb5adf..27eb5bd1e7 100644
> >>> --- a/include/env_internal.h
> >>> +++ b/include/env_internal.h
> >>
> >> Please, don't move the definition to env_internal.h but to env.h as
> >> board/renesas/sh7753evb/sh7753evb.c and others are using
> >> eth_parse_enetaddr().
> >>
> >> env_internal.h explicitly states "It should not be included by board 
> >> files".
> >>
> >> Please, execute Travis CI tests to ensure you do not break any other board.
> >
> > I haven't found any documentation in the tree or on the u-boot website on
> > how to do that.
> >
> > regards,
> >   o.
>
> Create a repository with U-Boot on Github (e.g. fork
> https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
> your Github account. Allow Travis to access the U-Boot repository. In
> settings select "Build pushed requests". Push your commit to Github. Now
> Travis should start building (takes about 4 hours).
>
> The file telling Travis what to do is in .travis.yml in U-Boot.
>

I think it would be better to do a patch to move this function into a
common/ file, and add a new config to test for this case.

I understand the desire for a revert, but no build was broken due to
the original patch, and the expected behaviour was not obvious.

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


Re: [U-Boot] RSA verify code and required keys

2019-09-13 Thread Simon Glass
Hi Daniele,

On Fri, 13 Sep 2019 at 09:50, Daniele Alessandrelli
 wrote:
>
> Hi,
>
> I was looking at the RSA image authentication code and I'm a bit
> puzzled by the following line of codes in lib/rsa/rsa-verify.c
> (https://gitlab.denx.de/u-boot/u-boot/blob/master/lib/rsa/rsa-verify.c#L440):
>
> 436 /* See if we must use a particular key */
> 437 if (info->required_keynode != -1) {
> 438 ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
> 439 info->required_keynode);
> 440 if (!ret)
> 441 return ret;
> 442 }
> 443
> 444 /* Look for a key that matches our hint */
> 445 snprintf(name, sizeof(name), "key-%s", info->keyname);
> 446 node = fdt_subnode_offset(blob, sig_node, name);
> 447 ret = rsa_verify_with_keynode(info, hash, sig, sig_len, node);
> 448 if (!ret)
> 449 return ret;
>
> If I understand it correctly, at Line 440 we check if verification
> with the required key succeeded and if so we return otherwise we
> continue, trying other keys.

Yes that's my understanding too.

>
> Is that the intended behavior? Shouldn't the code return in any case
> (thus making the FIT verification process fail if the image couldn't
> be verified with the required key)? Or am I missing something?

Yes I think you are right. The documentation says:

- required: If present this indicates that the key must be verified for the
image / configuration to be considered valid. Only required keys are
normally verified by the FIT image booting algorithm. Valid values are
"image" to force verification of all images, and "conf" to force verification
of the selected configuration (which then relies on hashes in the images to
verify those).

The test coverage does not handle that case at present, but it should.

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


[U-Boot] [PATCHv2] scrapyard: Delete this file and script

2019-09-13 Thread Tom Rini
The README.scrapyard file has been inconsistently updated.  While well
intentioned, bad data is worse than no data, and in this case a pointer
to use the history that git provides.  Remove the current content and
the script that would update it from time to time as well.

Signed-off-by: Tom Rini 
---
Changes in v2:
- Add an example of using git log to see what happened and when with a
  removed board.
---
 doc/README.scrapyard  | 357 +-
 scripts/fill_scrapyard.py | 165 -
 2 files changed, 5 insertions(+), 517 deletions(-)
 delete mode 100755 scripts/fill_scrapyard.py

diff --git a/doc/README.scrapyard b/doc/README.scrapyard
index fc0873431aa4..24a6c1be12e9 100644
--- a/doc/README.scrapyard
+++ b/doc/README.scrapyard
@@ -4,355 +4,8 @@ negligence in combination with ordinary bitrot.  Sometimes 
this goes
 by unnoticed, but often build errors will result.  If nobody cares any
 more to resolve such problems, then the code is really dead and will
 be removed from the U-Boot source tree.  The remainders rest in peace
-in the imperishable depths of the git history.  This document tries to
-maintain a list of such former fellows, so archaeologists can check
-easily if there is something they might want to dig for...
-The list should be sorted in reverse chronological order.
-
-
-BoardArchCPUCommit  Removed Last known 
maintainer/contact
-=
-ocotea   powerpc ppc4xx 29155e732015-10-27  Stefan 
Roese 
-taishan  powerpc ppc4xx bb5553c62015-10-27  Stefan 
Roese 
-ebonypowerpc ppc4xx 9d9e2f5d2015-10-27  Stefan 
Roese 
-taihupowerpc ppc4xx 123b6cd72015-10-27  John Otken 

-lcd4_lwmon5  powerpc ppc4xx b6b5e3942015-10-02  Stefan 
Roese 
-da830evm arm arm926ejs  d7e8b2b92015-09-12  Nick 
Thompson 
-wireless_space   arm arm926ejs  b352182a2015-09-12  Albert 
ARIBAUD 
-stxgp3   powerpc mpc85xx2ec69b882015-09-02  Dan Malek 

-stxssa   powerpc mpc85xx2ec69b882015-09-02  Dan Malek 

-cmi_mpc5xx   powerpc mpc5xx 972f53202015-09-02
-zeus powerpc ppc4xx eb5d1dc72015-09-02  Stefan 
Roese 
-sbc405   powerpc ppc4xx 0e0305932015-09-02
-pcs440ep powerpc ppc4xx 242836a82015-09-02  Stefan 
Roese 
-p3p440   powerpc ppc4xx c6999e5f2015-09-02  Stefan 
Roese 
-csb272/csb472powerpc ppc4xx 54a3f2602015-09-02  Tolunay 
Orkun 
-alpr powerpc ppc4xx 0d2fc8112015-09-02  Stefan 
Roese 
-balloon3 arm pxa679d44562015-08-30  Marek 
Vasut 
-cpu9260_128M arm arm926ejs  af7f884b2015-08-30  Eric 
Benard 
-cpu9260  arm arm926ejs  af7f884b2015-08-30  Eric 
Benard 
-cpu9260_nand_128M armarm926ejs  af7f884b2015-08-30  Eric 
Benard 
-cpu9260_nand arm arm926ejs  af7f884b2015-08-30  Eric 
Benard 
-cpu9G20_128M arm arm926ejs  af7f884b2015-08-30  Eric 
Benard 
-cpu9G20  arm arm926ejs  af7f884b2015-08-30  Eric 
Benard 
-cpuat91  arm arm920taf7f884b2015-08-30  Eric 
Benard 
-cpuat91_ram  arm arm920taf7f884b2015-08-30  Eric 
Benard 
-davinci_dm355evm arm arm926ejs  6761946f2015-08-30
-davinci_dm355leopard arm arm926ejs  6761946f2015-08-30
-davinci_dm365evm arm arm926ejs  6761946f2015-08-30
-davinci_dm6467evm armarm926ejs  6761946f2015-08-30
-davinci_dm6467Tevm arm   arm926ejs  6761946f2015-08-30
-davinci_dvevmarm arm926ejs  6761946f2015-08-30
-davinci_schmoogie armarm926ejs  6761946f2015-08-30
-davinci_sffsdr   arm arm926ejs  6761946f2015-08-30
-davinci_sonata   arm arm926ejs  6761946f2015-08-30
-dig297   arm armv7  5ff33d042015-08-30  Luca 
Ceresoli 
-ea20 arm arm926ejs  6761946f2015-08-30
-eb_cpux9k2   arm arm920t5522f12b2015-08-30  Jens 
Scharsig 
-eb_cpux9k2_ram   arm arm920t5522f12b2015-08-30  Jens 
Scharsig 
-enbw_cmc arm arm926ejs  a6f7f7872015-08-30  Heiko 
Schocher 
-ima3-mx53arm armv7  3eb8f58d2015-08-30
-imx27litearm arm926ejs  bc0840bc2015-08-30  Wolfgang 
Denk 
-imx31_litekitarm arm113636d141782015-08-30
-jornada  arm sa1100 df0b116d2015-08-30  Kristoffer 
Ericson 
-lp8x4x   arm pxa9f840b8d 

Re: [U-Boot] Tinker-rk3288 SPL broken with MMC timeout

2019-09-13 Thread Tom Rini
On Fri, Sep 13, 2019 at 08:11:17AM +0530, Jagan Teki wrote:
> On Thu, Sep 12, 2019 at 8:25 PM Tom Rini  wrote:
> >
> > On Thu, Sep 12, 2019 at 08:55:24AM +0530, Jagan Teki wrote:
> >
> > > I have seen this even on v2019.07 release, and the only release that
> > > it got working with on v2019.01 (SPL, BROM_RETURN)
> > >
> > > Any idea? here is the log dump.
> > >
> > > U-Boot TPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36)
> > > Trying to boot from BOOTROM
> > > Returning to boot ROM...
> > >
> > > U-Boot SPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36 +0530)
> > > Trying to boot from MMC1
> > > spl: mmc init failed with error: -110
> > > SPL: failed to boot from all boot devices
> > > ### ERROR ### Please RESET the board ###
> >
> > Time to run 'git bisect' since you know when it worked last at least?
> 
> Look hard to bisect, few of commits in between seems SPL size
> blow-out, doesn't boot etc. May be verify with respect boards might
> help.

It certainly sounds like a challenging bisect, yes.  I've 'bisect
skip'ed and then 'git stash save' / 'git stash apply' a handful of
work-arounds to narrow down hard cases like this before.  It's also
worth keeping in mind that you can insert steps manually into a bisect.
For something like this where v2019.01 works and HEAD doesn't, I'd do:
$ git bisect start
$ git bisect good v2019.01
$ git bisect bad v2019.10-rc3
$ git checkout v2019.04
and see what happens.

-- 
Tom


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


[U-Boot] [PATCH v1] x86: zImage: Propagate acpi_rsdp_addr to kernel via boot parameters

2019-09-13 Thread Andy Shevchenko
This is reincarnation of the U-Boot

commit 3469bf4274540d1491d58e878a9edc0bdcba17ac
Author: Andy Shevchenko 
Date:   Wed Jan 10 19:40:15 2018 +0200

x86: zImage: Propagate acpi_rsdp_addr to kernel via boot parameters

after upstream got eventually the Linux kernel

commit e6e094e053af75cbc164e950814d3d084fb1e698
Author: Juergen Gross 
Date:   Tue Nov 20 08:25:29 2018 +0100

x86/acpi, x86/boot: Take RSDP address from boot params if available

Signed-off-by: Andy Shevchenko 
---
 arch/x86/include/asm/bootparam.h | 3 ++-
 arch/x86/lib/zimage.c| 4 
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index dfbd4b4bba..d961dddc9e 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -94,7 +94,8 @@ struct boot_params {
__u8  _pad2[4]; /* 0x054 */
__u64  tboot_addr;  /* 0x058 */
struct ist_info ist_info;   /* 0x060 */
-   __u8  _pad3[16];/* 0x070 */
+   __u64 acpi_rsdp_addr;   /* 0x070 */
+   __u8  _pad3[8]; /* 0x078 */
__u8  hd0_info[16]; /* obsolete! */ /* 0x080 */
__u8  hd1_info[16]; /* obsolete! */ /* 0x090 */
struct sys_desc_table sys_desc_table;   /* 0x0a0 */
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 6a6258a505..d07041fd4c 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -288,6 +288,10 @@ int setup_zimage(struct boot_params *setup_base, char 
*cmd_line, int auto_boot,
hdr->hardware_subarch = X86_SUBARCH_INTEL_MID;
 #endif
 
+#ifdef CONFIG_GENERATE_ACPI_TABLE
+   setup_base->acpi_rsdp_addr = acpi_get_rsdp_addr();
+#endif
+
setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0));
setup_video(_base->screen_info);
 
-- 
2.23.0

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


[U-Boot] [PATCH] cmd: mdio/mii: add Kconfig help and allow break dependency

2019-09-13 Thread Ramon Fried
* Add Kconfig help describing the purpose of each command.
* Add CONFIG_CMD_MDIO so it could be selected individually, as
  it doesn't depend on the mii command.
* Add Kconfig imply to mii to automatically select the mdio
  command.

Signed-off-by: Ramon Fried 
---
 cmd/Kconfig  | 18 --
 cmd/Makefile |  4 +---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 98647f58b7..cfb3b58119 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1410,8 +1410,22 @@ config CMD_NFS
 
 config CMD_MII
bool "mii"
-   help
- Enable MII utility commands.
+   imply CMD_MDIO
+   help
+ If set, allows 802.3(clause 22) MII Management functions interface 
access
+ The management interface specified in Clause 22 provides
+ a simple, two signal, serial interface to connect a
+ Station Management entity and a managed PHY for providing access
+ to management parameters and services.
+ The interface is referred to as the MII management interface.
+
+config CMD_MDIO
+   bool "mdio"
+   depends on PHYLIB
+   help
+ If set, allows Enable 802.3(clause 45) MDIO interface registers access
+ The MDIO interface is orthogonal to the MII interface and extends
+ it by adding access to more registers through indirect addressing.
 
 config CMD_PING
bool "ping"
diff --git a/cmd/Makefile b/cmd/Makefile
index ac843b4b16..384ddb8eaf 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -89,9 +89,7 @@ obj-$(CONFIG_CMD_MEMORY) += mem.o
 obj-$(CONFIG_CMD_IO) += io.o
 obj-$(CONFIG_CMD_MFSL) += mfsl.o
 obj-$(CONFIG_CMD_MII) += mii.o
-ifdef CONFIG_PHYLIB
-obj-$(CONFIG_CMD_MII) += mdio.o
-endif
+obj-$(CONFIG_CMD_MDIO) += mdio.o
 obj-$(CONFIG_CMD_MISC) += misc.o
 obj-$(CONFIG_CMD_MMC) += mmc.o
 obj-$(CONFIG_MP) += mp.o
-- 
2.23.0

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


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Tom Rini
On Fri, Sep 13, 2019 at 04:34:45PM +0200, Ondřej Jirman wrote:
> On Fri, Sep 13, 2019 at 08:25:09AM -0600, Simon Glass wrote:
> > Hi Ondřej,
> > 
> > On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
> > >
> > > On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > > > Hi,
> > > >
> > > > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  
> > > > > > wrote:
> > > > > > >
> > > > > > > Hello,
> > > > > > >
> > > > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > > > This function fits better with the network subsystem, so move 
> > > > > > > > it.
> > > > > > >
> > > > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > > > fixes the issue.
> > > > > > >
> > > > > > >   LD  u-boot
> > > > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > > > `eth_parse_enetaddr'
> > > > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > > > >
> > > > > >
> > > > > > Which board is this please?
> > > > >
> > > > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > > > CONFIG_NET.
> > > > >
> > > > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > > > disabled, this
> > > > > function will not be available to nvedit.c.
> > > > >
> > > > > The board doesn't really matter.
> > > >
> > > > The offending call is in setup_environment() in board/sunxi/board.c so
> > > > I think the board does matter. There might be something else I am
> > > > missing but I cannot see it at present.
> > > >
> > > > Would you like to send a patch?
> > >
> > > I'd like to send a patch to revert this change and move 
> > > eth_parse_enetaddr back.
> > >
> > > The call eth_env_set_enetaddr() is correct and should succeed even if net
> > > is disabled in u-boot. It determines the stable MAC address to use for 
> > > ethernet
> > > interfaces described in DT for Linux to use.
> > >
> > > See fdt_fixup_ethernet() that does that.
> > >
> > > That feature is independent of the whole network stack and network drivers
> > > in u-boot.
> > 
> > So you are saying that you should be able to read the MAC address,
> > etc. with CONFIG_NET disabled?
> 
> MAC address is not read from network device, it's generated from
> serial ID of the SoC and then patched into DTB for later use by Linux.
> 
> The process doesn't involve anything related to the net subsystem
> of u-boot.

Agreed, it sounds like this is more of a generic use function than a
network function as there's a lot of platforms where the MAC is
generated in a similar fashion.

-- 
Tom


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


Re: [U-Boot] [PATCH] cmd: avoid decimal conversion

2019-09-13 Thread Michael Nazzareno Trimarchi
On Fri, Sep 13, 2019 at 5:10 PM Tom Rini  wrote:
>
> On Wed, Sep 11, 2019 at 03:39:53PM +0200, Michal Simek wrote:
>
> > From: T Karthik Reddy 
> >
> > This patch uses auto instead of decimal in simple_strtoul().
> >
> > Signed-off-by: T Karthik Reddy 
> > Signed-off-by: Michal Simek 
> > ---
> >
> >  cmd/test.c | 24 
> >  1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/cmd/test.c b/cmd/test.c
> > index fa0c349f0827..258bfd880653 100644
> > --- a/cmd/test.c
> > +++ b/cmd/test.c
> > @@ -113,28 +113,28 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int 
> > argc, char * const argv[])
> >   expr = strcmp(ap[0], ap[2]) > 0;
> >   break;
> >   case OP_INT_EQ:
> > - expr = simple_strtol(ap[0], NULL, 10) ==
> > - simple_strtol(ap[2], NULL, 10);
> > + expr = simple_strtol(ap[0], NULL, 0) ==
> > + simple_strtol(ap[2], NULL, 0);
> >   break;
> >   case OP_INT_NEQ:
> > - expr = simple_strtol(ap[0], NULL, 10) !=
> > - simple_strtol(ap[2], NULL, 10);
> > + expr = simple_strtol(ap[0], NULL, 0) !=
> > + simple_strtol(ap[2], NULL, 0);
> >   break;
> >   case OP_INT_LT:
> > - expr = simple_strtol(ap[0], NULL, 10) <
> > - simple_strtol(ap[2], NULL, 10);
> > + expr = simple_strtol(ap[0], NULL, 0) <
> > + simple_strtol(ap[2], NULL, 0);
> >   break;
> >   case OP_INT_LE:
> > - expr = simple_strtol(ap[0], NULL, 10) <=
> > - simple_strtol(ap[2], NULL, 10);
> > + expr = simple_strtol(ap[0], NULL, 0) <=
> > + simple_strtol(ap[2], NULL, 0);
> >   break;
> >   case OP_INT_GT:
> > - expr = simple_strtol(ap[0], NULL, 10) >
> > - simple_strtol(ap[2], NULL, 10);
> > + expr = simple_strtol(ap[0], NULL, 0) >
> > + simple_strtol(ap[2], NULL, 0);
> >   break;
> >   case OP_INT_GE:
> > - expr = simple_strtol(ap[0], NULL, 10) >=
> > - simple_strtol(ap[2], NULL, 10);
> > + expr = simple_strtol(ap[0], NULL, 0) >=
> > + simple_strtol(ap[2], NULL, 0);
> >   break;
> >   case OP_FILE_EXISTS:
> >   expr = file_exists(ap[1], ap[2], ap[3], FS_TYPE_ANY);
>
> I'm going to NAK this, but could be argued around to changing my mind.
> While it's true that in general command inputs are hex and not decimal,
> this has been decimal since introduction in 2009.  So changing it now is
> breaking ABI and other peoples test scripts, so I don't think we can do
> this, sorry.

Well, I think that this is automatic. There should be a back compatibility
with the ABI if base is 10

Michael

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



--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: avoid decimal conversion

2019-09-13 Thread Tom Rini
On Wed, Sep 11, 2019 at 03:39:53PM +0200, Michal Simek wrote:

> From: T Karthik Reddy 
> 
> This patch uses auto instead of decimal in simple_strtoul().
> 
> Signed-off-by: T Karthik Reddy 
> Signed-off-by: Michal Simek 
> ---
> 
>  cmd/test.c | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/cmd/test.c b/cmd/test.c
> index fa0c349f0827..258bfd880653 100644
> --- a/cmd/test.c
> +++ b/cmd/test.c
> @@ -113,28 +113,28 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[])
>   expr = strcmp(ap[0], ap[2]) > 0;
>   break;
>   case OP_INT_EQ:
> - expr = simple_strtol(ap[0], NULL, 10) ==
> - simple_strtol(ap[2], NULL, 10);
> + expr = simple_strtol(ap[0], NULL, 0) ==
> + simple_strtol(ap[2], NULL, 0);
>   break;
>   case OP_INT_NEQ:
> - expr = simple_strtol(ap[0], NULL, 10) !=
> - simple_strtol(ap[2], NULL, 10);
> + expr = simple_strtol(ap[0], NULL, 0) !=
> + simple_strtol(ap[2], NULL, 0);
>   break;
>   case OP_INT_LT:
> - expr = simple_strtol(ap[0], NULL, 10) <
> - simple_strtol(ap[2], NULL, 10);
> + expr = simple_strtol(ap[0], NULL, 0) <
> + simple_strtol(ap[2], NULL, 0);
>   break;
>   case OP_INT_LE:
> - expr = simple_strtol(ap[0], NULL, 10) <=
> - simple_strtol(ap[2], NULL, 10);
> + expr = simple_strtol(ap[0], NULL, 0) <=
> + simple_strtol(ap[2], NULL, 0);
>   break;
>   case OP_INT_GT:
> - expr = simple_strtol(ap[0], NULL, 10) >
> - simple_strtol(ap[2], NULL, 10);
> + expr = simple_strtol(ap[0], NULL, 0) >
> + simple_strtol(ap[2], NULL, 0);
>   break;
>   case OP_INT_GE:
> - expr = simple_strtol(ap[0], NULL, 10) >=
> - simple_strtol(ap[2], NULL, 10);
> + expr = simple_strtol(ap[0], NULL, 0) >=
> + simple_strtol(ap[2], NULL, 0);
>   break;
>   case OP_FILE_EXISTS:
>   expr = file_exists(ap[1], ap[2], ap[3], FS_TYPE_ANY);

I'm going to NAK this, but could be argued around to changing my mind.
While it's true that in general command inputs are hex and not decimal,
this has been decimal since introduction in 2009.  So changing it now is
breaking ABI and other peoples test scripts, so I don't think we can do
this, sorry.

-- 
Tom


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


Re: [U-Boot] rk3288: HDMI out causing boot hang

2019-09-13 Thread Michael Nazzareno Trimarchi
Hi

On Fri, Sep 13, 2019 at 5:02 PM Michael Nazzareno Trimarchi
 wrote:
>
> Hi
>
> On Fri, Sep 13, 2019 at 4:02 PM Michael Nazzareno Trimarchi
>  wrote:
> >
> > Hi Anatolij
> >
> > On Fri, Sep 13, 2019 at 4:01 PM Anatolij Gustschin  wrote:
> > >
> > > Hi Jagan,
> > >
> > > On Fri, 13 Sep 2019 08:19:47 +0530
> > > Jagan Teki ja...@amarulasolutions.com wrote:
> > > ...
> > > > Any inputs?
> > >
> > > Try to input "setenv stdout serial" command on the serial console.
> > > There might be a chance that stdout/stdin has switched to the
> > > video console and the output proceeds there. If the HDMI display
> > > shows nothing, it appears like a hang.
> >
> > It's not an hang. It's the output is not shown. I'm trying to
> > understand the reason

It was a bug of the old uboot

commit 79cdcaced710d955f68066d02327b86be573339c
Author: Niklas Schulze 
Date:   Sun Jul 14 10:40:13 2019 +

rockchip: video: rk3288_hdmi: Add missing call to dw_hdmi_enable()

The RK3288 HDMI driver's rk3288_hdmi_enable() currently lacks a call to
dw_hdmi_enable(). Thus, the HDMI output never gets enabled.

Signed-off-by: Niklas Schulze 
Cc: Philipp Tomsich 
Reviewed-by: Kever Yang 
Reviewed-by: Philipp Tomsich 

diff --git a/drivers/video/rockchip/rk3288_hdmi.c
b/drivers/video/rockchip/rk3288_hdmi.c
index 315d3adf27..3d25ce924c 100644
--- a/drivers/video/rockchip/rk3288_hdmi.c
+++ b/drivers/video/rockchip/rk3288_hdmi.c
@@ -33,7 +33,7 @@ static int rk3288_hdmi_enable(struct udevice *dev,
int panel_bpp,
/* hdmi data from vop id */
rk_clrsetreg(>soc_con6, 1 << 4, (vop_id == 1) ? (1 << 4) : 0);

-   return 0;
+   return dw_hdmi_enable(>hdmi, edid);
 }

Now I need to test the mainline one

Michael

> >
>
> I have fixed, still not so good ;)
>
> Michael
>
> > Michael
> > >
> > > --
> > > Anatolij
> > >
> > > ___
> > > Linux-rockchip mailing list
> > > linux-rockc...@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-rockchip
> >
> >
> >
> > --
> > | Michael Nazzareno Trimarchi Amarula Solutions BV |
> > | COO  -  Founder  Cruquiuskade 47 |
> > | +31(0)851119172 Amsterdam 1018 AM NL |
> > |  [`as] http://www.amarulasolutions.com   |
>
>
>
> --
> | Michael Nazzareno Trimarchi Amarula Solutions BV |
> | COO  -  Founder  Cruquiuskade 47 |
> | +31(0)851119172 Amsterdam 1018 AM NL |
> |  [`as] http://www.amarulasolutions.com   |



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rk3288: HDMI out causing boot hang

2019-09-13 Thread Michael Nazzareno Trimarchi
Hi

On Fri, Sep 13, 2019 at 4:02 PM Michael Nazzareno Trimarchi
 wrote:
>
> Hi Anatolij
>
> On Fri, Sep 13, 2019 at 4:01 PM Anatolij Gustschin  wrote:
> >
> > Hi Jagan,
> >
> > On Fri, 13 Sep 2019 08:19:47 +0530
> > Jagan Teki ja...@amarulasolutions.com wrote:
> > ...
> > > Any inputs?
> >
> > Try to input "setenv stdout serial" command on the serial console.
> > There might be a chance that stdout/stdin has switched to the
> > video console and the output proceeds there. If the HDMI display
> > shows nothing, it appears like a hang.
>
> It's not an hang. It's the output is not shown. I'm trying to
> understand the reason
>

I have fixed, still not so good ;)

Michael

> Michael
> >
> > --
> > Anatolij
> >
> > ___
> > Linux-rockchip mailing list
> > linux-rockc...@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
>
>
> --
> | Michael Nazzareno Trimarchi Amarula Solutions BV |
> | COO  -  Founder  Cruquiuskade 47 |
> | +31(0)851119172 Amsterdam 1018 AM NL |
> |  [`as] http://www.amarulasolutions.com   |



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] cmd: env: extend "env [set|print] -e" to manage UEFI variables

2019-09-13 Thread Tom Rini
On Fri, Sep 06, 2019 at 03:10:44PM +0900, AKASHI Takahiro wrote:
> With this patch, when setting UEFI variable with "env set -e" command,
> we will be able to
> - specify vendor guid with "-guid guid",
> - specify variable attributes,  BOOTSERVICE_ACCESS, RUNTIME_ACCESS,
>   respectively with "-bs" and "-rt",
> - append a value instead of overwriting with "-a",
> - use memory as variable's value instead of explicit values given
>   at the command line with "-i address,size"
> 
> If guid is not explicitly given, default value will be used.
> 
> When "-at" is given, a variable should be authenticated with
> appropriate signature database before setting or modifying its value.
> (Authentication is not supported yet though.)
> 
> Meanwhile, "env print -e," will be modified so that it will dump
> a variable's value only if '-v' (verbose) is specified.
> 
> Signed-off-by: AKASHI Takahiro 
> ---
> Changes in v2 (Sept 6, 2019)
> * remove "-at" option
> 
> ---
>  cmd/nvedit.c |  19 +++--
>  cmd/nvedit_efi.c | 189 ++-
>  2 files changed, 168 insertions(+), 40 deletions(-)
> 
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index 1cb0bc1460b9..1e542972db30 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -1387,7 +1387,7 @@ static char env_help_text[] =
>  #endif
>   "env print [-a | name ...] - print environment\n"
>  #if defined(CONFIG_CMD_NVEDIT_EFI)
> - "env print -e [name ...] - print UEFI environment\n"
> + "env print -e [-v] [name ...] - print UEFI environment\n"
>  #endif
>  #if defined(CONFIG_CMD_RUN)
>   "env run var [...] - run commands in an environment variable\n"
> @@ -1399,7 +1399,8 @@ static char env_help_text[] =
>  #endif
>  #endif
>  #if defined(CONFIG_CMD_NVEDIT_EFI)
> - "env set -e name [arg ...] - set UEFI variable; unset if 'arg' not 
> specified\n"
> + "env set -e [-nv][-bs][-rt][-a][-i addr,size][-v] name [arg ...]\n"
> + "- set UEFI variable; unset if '-i' or 'arg' not specified\n"
>  #endif
>   "env set [-f] name [arg ...]\n";
>  #endif
> @@ -1428,8 +1429,9 @@ U_BOOT_CMD_COMPLETE(
>   "print environment variables",
>   "[-a]\n- print [all] values of all environment variables\n"
>  #if defined(CONFIG_CMD_NVEDIT_EFI)
> - "printenv -e [name ...]\n"
> + "printenv -e [-v] [name ...]\n"
>   "- print UEFI variable 'name' or all the variables\n"
> + "  \"-v\": verbose for signature database\n"
>  #endif
>   "printenv name ...\n"
>   "- print value of environment variable 'name'",
> @@ -1459,9 +1461,16 @@ U_BOOT_CMD_COMPLETE(
>   setenv, CONFIG_SYS_MAXARGS, 0,  do_env_set,
>   "set environment variables",
>  #if defined(CONFIG_CMD_NVEDIT_EFI)
> - "-e [-nv] name [value ...]\n"
> + "-e [-guid guid][-nv][-bs][-rt][-a][-v]\n"
> + "[-i addr,size name], or [name [value ...]]\n"
>   "- set UEFI variable 'name' to 'value' ...'\n"
> - "  'nv' option makes the variable non-volatile\n"
> + "  \"-guid\": set vendor guid\n"
> + "  \"-nv\": set non-volatile attribute\n"
> + "  \"-bs\": set boot-service attribute\n"
> + "  \"-rt\": set runtime attribute\n"
> + "  \"-a\": append-write\n"
> + "  \"-i addr,size\": use  as variable's value\n"
> + "  \"-v\": verbose print\n"
>   "- delete UEFI variable 'name' if 'value' not specified\n"
>  #endif
>   "setenv [-f] name value ...\n"
> diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
> index ed6d09a53046..67e732e8d520 100644
> --- a/cmd/nvedit_efi.c
> +++ b/cmd/nvedit_efi.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  /*
> @@ -34,15 +35,48 @@ static const struct {
>   {EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, "AT"},
>  };
>  
> +static const struct {
> + efi_guid_t guid;
> + char *text;
> +} efi_guid_text[] = {
> + /* signature database */
> + {EFI_GLOBAL_VARIABLE_GUID, "EFI_GLOBAL_VARIABLE_GUID"},
> +};
> +
> +/* "----" */
> +static char unknown_guid[37];
> +
> +/**
> + * efi_guid_to_str() - convert guid to readable name
> + *
> + * @guid:GUID
> + * Return:   string for GUID
> + *
> + * convert guid to readable name
> + */
> +static const char *efi_guid_to_str(efi_guid_t *guid)
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(efi_guid_text); i++)
> + if (!guidcmp(guid, _guid_text[i].guid))
> + return efi_guid_text[i].text;
> +
> + uuid_bin_to_str(guid->b, unknown_guid, UUID_STR_FORMAT_GUID);
> +
> + return unknown_guid;
> +}
> +
>  /**
>   * efi_dump_single_var() - show information about a UEFI variable
>   *
>   * @name:Name of the variable
>   * @guid:Vendor GUID
> + * @verbose: if true, dump data
>   *
>   * Show information encoded in one UEFI variable
>   */
> -static void efi_dump_single_var(u16 *name, efi_guid_t *guid)
> +static void 

Re: [U-Boot] Please pull pico-imx7d-2019.10-1 from https://github.com/OSSystems/u-boot

2019-09-13 Thread Otavio Salvador
On Thu, Sep 12, 2019 at 6:27 PM Joris Offouga  wrote:
> Just put CONFIG_DM_VIDEO in the defconfig

Please adjust your PR and let me know; so I test it here.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854  Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Ondřej Jirman
On Fri, Sep 13, 2019 at 08:25:09AM -0600, Simon Glass wrote:
> Hi Ondřej,
> 
> On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
> >
> > On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > > This function fits better with the network subsystem, so move it.
> > > > > >
> > > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > > fixes the issue.
> > > > > >
> > > > > >   LD  u-boot
> > > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > > `eth_parse_enetaddr'
> > > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > > >
> > > > >
> > > > > Which board is this please?
> > > >
> > > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > > CONFIG_NET.
> > > >
> > > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > > disabled, this
> > > > function will not be available to nvedit.c.
> > > >
> > > > The board doesn't really matter.
> > >
> > > The offending call is in setup_environment() in board/sunxi/board.c so
> > > I think the board does matter. There might be something else I am
> > > missing but I cannot see it at present.
> > >
> > > Would you like to send a patch?
> >
> > I'd like to send a patch to revert this change and move eth_parse_enetaddr 
> > back.
> >
> > The call eth_env_set_enetaddr() is correct and should succeed even if net
> > is disabled in u-boot. It determines the stable MAC address to use for 
> > ethernet
> > interfaces described in DT for Linux to use.
> >
> > See fdt_fixup_ethernet() that does that.
> >
> > That feature is independent of the whole network stack and network drivers
> > in u-boot.
> 
> So you are saying that you should be able to read the MAC address,
> etc. with CONFIG_NET disabled?

MAC address is not read from network device, it's generated from
serial ID of the SoC and then patched into DTB for later use by Linux.

The process doesn't involve anything related to the net subsystem
of u-boot.

regards,
o.

> 
> I was certainly not aware of that.
> 
> Joe do you have any thoughts here?

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


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Simon Glass
Hi Ondřej,

On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
>
> On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > Hi,
> >
> > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > >
> > > Hi,
> > >
> > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > Hi,
> > > >
> > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > This function fits better with the network subsystem, so move it.
> > > > >
> > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > fixes the issue.
> > > > >
> > > > >   LD  u-boot
> > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > `eth_parse_enetaddr'
> > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > >
> > > >
> > > > Which board is this please?
> > >
> > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > CONFIG_NET.
> > >
> > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > disabled, this
> > > function will not be available to nvedit.c.
> > >
> > > The board doesn't really matter.
> >
> > The offending call is in setup_environment() in board/sunxi/board.c so
> > I think the board does matter. There might be something else I am
> > missing but I cannot see it at present.
> >
> > Would you like to send a patch?
>
> I'd like to send a patch to revert this change and move eth_parse_enetaddr 
> back.
>
> The call eth_env_set_enetaddr() is correct and should succeed even if net
> is disabled in u-boot. It determines the stable MAC address to use for 
> ethernet
> interfaces described in DT for Linux to use.
>
> See fdt_fixup_ethernet() that does that.
>
> That feature is independent of the whole network stack and network drivers
> in u-boot.

So you are saying that you should be able to read the MAC address,
etc. with CONFIG_NET disabled?

I was certainly not aware of that.

Joe do you have any thoughts here?

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


[U-Boot] [PATCH 05/14] dfu: allow read with 0 data for EOF indication

2019-09-13 Thread Patrick Delaunay
This patch allows into the DFU backend to indicate that there is no
remaining data (for EOF for example). That allows users to read a
buffer greater than the device size; the dfu stack stops the read
request when the backend return a length=0 without error.

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/dfu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 8bd5216017..50919fcae9 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -396,6 +396,8 @@ static int dfu_read_buffer_fill(struct dfu_entity *dfu, 
void *buf, int size)
debug("%s: Read error!\n", __func__);
return ret;
}
+   if (dfu->b_left == 0)
+   break;
dfu->offset += dfu->b_left;
dfu->r_left -= dfu->b_left;
 
-- 
2.17.1

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


[U-Boot] [PATCH 12/14] stp32mp1: configs: activate CONFIG_MTD_SPI_NAND

2019-09-13 Thread Patrick Delaunay
Activate the support of SPI NAND in stm32mp1 U-Boot.

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 bc9018684d..8e90505070 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -86,6 +86,7 @@ CONFIG_STM32_SDMMC2=y
 CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_STM32_FMC2=y
+CONFIG_MTD_SPI_NAND=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 8d3d2e8508..387de0ad35 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -73,6 +73,7 @@ CONFIG_STM32_SDMMC2=y
 CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_STM32_FMC2=y
+CONFIG_MTD_SPI_NAND=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 8da8c4e22a..29c23c634d 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -72,6 +72,7 @@ CONFIG_STM32_SDMMC2=y
 CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_STM32_FMC2=y
+CONFIG_MTD_SPI_NAND=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
-- 
2.17.1

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


[U-Boot] [PATCH 13/14] stm32mp1: board: add spi nand support

2019-09-13 Thread Patrick Delaunay
This patch adds the support of the spi nand device in mtdparts command
and in dfu_alt_info.

Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/stm32mp1.c | 32 +---
 include/configs/stm32mp1.h   | 10 --
 2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 62855988e9..e4bdf05cd7 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -862,8 +862,9 @@ static void board_get_mtdparts(const char *dev,
 
 void board_mtdparts_default(const char **mtdids, const char **mtdparts)
 {
+   struct mtd_info *mtd;
struct udevice *dev;
-   static char parts[2 * MTDPARTS_LEN + 1];
+   static char parts[3 * MTDPARTS_LEN + 1];
static char ids[MTDIDS_LEN + 1];
static bool mtd_initialized;
 
@@ -876,8 +877,24 @@ void board_mtdparts_default(const char **mtdids, const 
char **mtdparts)
memset(parts, 0, sizeof(parts));
memset(ids, 0, sizeof(ids));
 
-   if (!uclass_get_device(UCLASS_MTD, 0, ))
+   /* probe all MTD devices */
+   for (uclass_first_device(UCLASS_MTD, );
+dev;
+uclass_next_device()) {
+   pr_debug("mtd device = %s\n", dev->name);
+   }
+
+   mtd = get_mtd_device_nm("nand0");
+   if (!IS_ERR_OR_NULL(mtd)) {
board_get_mtdparts("nand0", ids, parts);
+   put_mtd_device(mtd);
+   }
+
+   mtd = get_mtd_device_nm("spi-nand0");
+   if (!IS_ERR_OR_NULL(mtd)) {
+   board_get_mtdparts("spi-nand0", ids, parts);
+   put_mtd_device(mtd);
+   }
 
if (!uclass_get_device(UCLASS_SPI_FLASH, 0, ))
board_get_mtdparts("nor0", ids, parts);
@@ -927,6 +944,7 @@ static void board_get_alt_info(const char *dev, char *buff)
 void set_dfu_alt_info(char *interface, char *devstr)
 {
struct udevice *dev;
+   struct mtd_info *mtd;
 
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
 
@@ -935,6 +953,9 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
memset(buf, 0, sizeof(buf));
 
+   /* probe all MTD devices */
+   mtd_probe_devices();
+
board_get_alt_info("ram", buf);
 
if (!uclass_get_device(UCLASS_MMC, 0, ))
@@ -946,9 +967,14 @@ void set_dfu_alt_info(char *interface, char *devstr)
if (!uclass_get_device(UCLASS_SPI_FLASH, 0, ))
board_get_alt_info("nor0", buf);
 
-   if (!uclass_get_device(UCLASS_MTD, 0, ))
+   mtd = get_mtd_device_nm("nand0");
+   if (!IS_ERR_OR_NULL(mtd))
board_get_alt_info("nand0", buf);
 
+   mtd = get_mtd_device_nm("spi-nand0");
+   if (!IS_ERR_OR_NULL(mtd))
+   board_get_alt_info("spi-nand0", buf);
+
env_set("dfu_alt_info", buf);
puts("DFU alt info setting: done\n");
 }
diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
index 4f9024229e..145a644efa 100644
--- a/include/configs/stm32mp1.h
+++ b/include/configs/stm32mp1.h
@@ -124,12 +124,15 @@
 /* with OPTEE: define specific MTD partitions = teeh, teed, teex */
 #define STM32MP_MTDPARTS \

"mtdparts_nor0=256k(fsbl1),256k(fsbl2),2m(ssbl),256k(u-boot-env),256k(teeh),256k(teed),256k(teex),-(nor_user)\0"
 \
-   
"mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),512k(teeh),512k(teed),512k(teex),-(UBI)\0"
+   
"mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),512k(teeh),512k(teed),512k(teex),-(UBI)\0"
 \
+   "mtdparts_spi-nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),"\
+   "512k(teeh),512k(teed),512k(teex),-(UBI)\0"
 
 #else /* CONFIG_STM32MP1_OPTEE */
 #define STM32MP_MTDPARTS \

"mtdparts_nor0=256k(fsbl1),256k(fsbl2),2m(ssbl),256k(u-boot-env),-(nor_user)\0" 
\
-   "mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)\0"
+   "mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)\0" \
+   "mtdparts_spi-nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)\0"
 
 #endif /* CONFIG_STM32MP1_OPTEE */
 
@@ -152,6 +155,9 @@
"dfu_alt_info_nand0=mtd nand0="\
"nand_fsbl part 1;nand_ssbl1 part 2;" \
"nand_ssbl2 part 3;nand_UBI partubi 4\0" \
+   "dfu_alt_info_spi-nand0=mtd spi-nand0="\
+   "spi-nand_fsbl part 1;spi-nand_ssbl1 part 2;" \
+   "spi-nand_ssbl2 part 3;spi-nand_UBI partubi 4\0" \
"dfu_alt_info_mmc0=mmc 0=" \
"sdcard_fsbl1 part 0 1;sdcard_fsbl2 part 0 2;" \
"sdcard_ssbl part 0 3;sdcard_bootfs part 0 4;" \
-- 
2.17.1

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


[U-Boot] [PATCH 07/14] dfu: add partition support for MTD backend

2019-09-13 Thread Patrick Delaunay
Add the support of MTD partition for the MTD backend.

The expected dfu_alt_info for one alternate on the mtd device :
 part 
 partubi 

"partubi" also erase up to the end of the partition after write operation.

For example: dfu_alt_info = "spl part 1;u-boot part 2; UBI partubi 3"

U-Boot> dfu 0 mtd nand0

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/dfu_mtd.c | 78 ++-
 include/dfu.h |  2 ++
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c
index 1168a6e278..223b0fe977 100644
--- a/drivers/dfu/dfu_mtd.c
+++ b/drivers/dfu/dfu_mtd.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size)
 {
@@ -181,11 +182,49 @@ static int dfu_write_medium_mtd(struct dfu_entity *dfu,
 
 static int dfu_flush_medium_mtd(struct dfu_entity *dfu)
 {
+   struct mtd_info *mtd = dfu->data.mtd.info;
+   int ret;
+
+   /* in case of ubi partition, erase rest of the partition */
+   if (dfu->data.nand.ubi) {
+   struct erase_info erase_op = {};
+
+   erase_op.mtd = dfu->data.mtd.info;
+   erase_op.addr = round_up(dfu->data.mtd.start + dfu->offset +
+dfu->bad_skip, mtd->erasesize);
+   erase_op.len = dfu->data.mtd.start + dfu->data.mtd.size -
+  erase_op.addr;
+   erase_op.scrub = 0;
+
+   while (erase_op.len) {
+   ret = mtd_erase(mtd, _op);
+   /* Abort if its not a bad block error */
+   if (ret != -EIO)
+   break;
+
+   printf("Skipping bad block at 0x%08llx\n",
+  erase_op.fail_addr);
+
+   /* Skip bad block and continue behind it */
+   erase_op.addr = erase_op.fail_addr + mtd->erasesize;
+   erase_op.len = dfu->data.mtd.start +
+  dfu->data.mtd.size -
+  erase_op.addr;
+   }
+   }
return 0;
 }
 
 static unsigned int dfu_polltimeout_mtd(struct dfu_entity *dfu)
 {
+   /*
+* Currently, Poll Timeout != 0 is only needed on nand
+* ubi partition, as sectors which are not used need
+* to be erased
+*/
+   if (dfu->data.nand.ubi)
+   return DFU_MANIFEST_POLL_TIMEOUT;
+
return DFU_DEFAULT_POLL_TIMEOUT;
 }
 
@@ -194,6 +233,7 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char 
*devstr, char *s)
char *st;
struct mtd_info *mtd;
bool has_pages;
+   int ret, part;
 
mtd = get_mtd_device_nm(devstr);
if (IS_ERR_OR_NULL(mtd))
@@ -212,11 +252,47 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char 
*devstr, char *s)
dfu->data.mtd.start = simple_strtoul(s, , 16);
s++;
dfu->data.mtd.size = simple_strtoul(s, , 16);
+   } else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
+   char mtd_id[32];
+   struct mtd_device *mtd_dev;
+   u8 part_num;
+   struct part_info *pi;
+
+   dfu->layout = DFU_RAW_ADDR;
+
+   part = simple_strtoul(s, , 10);
+
+   sprintf(mtd_id, "%s,%d", devstr, part - 1);
+   printf("using id '%s'\n", mtd_id);
+
+   mtdparts_init();
+
+   ret = find_dev_and_part(mtd_id, _dev, _num, );
+   if (ret != 0) {
+   printf("Could not locate '%s'\n", mtd_id);
+   return -1;
+   }
+
+   dfu->data.mtd.start = pi->offset;
+   dfu->data.mtd.size = pi->size;
+   if (!strcmp(st, "partubi"))
+   dfu->data.mtd.ubi = 1;
} else {
-   printf("%s: (%s) not supported!\n", __func__, st);
+   printf("%s: Memory layout (%s) not supported!\n", __func__, st);
return -1;
}
 
+   if (!mtd_is_aligned_with_block_size(mtd, dfu->data.mtd.start)) {
+   printf("Offset not aligned with a block (0x%x)\n",
+  mtd->erasesize);
+   return -EINVAL;
+   }
+   if (!mtd_is_aligned_with_block_size(mtd, dfu->data.mtd.size)) {
+   printf("Size not aligned with a block (0x%x)\n",
+  mtd->erasesize);
+   return -EINVAL;
+   }
+
dfu->get_medium_size = dfu_get_medium_size_mtd;
dfu->read_medium = dfu_read_medium_mtd;
dfu->write_medium = dfu_write_medium_mtd;
diff --git a/include/dfu.h b/include/dfu.h
index 924952f805..a90732cc43 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -62,6 +62,8 @@ struct mtd_internal_data {
/* RAW programming */
   

[U-Boot] [PATCH 14/14] stm32mp1: add support for virtual partition read

2019-09-13 Thread Patrick Delaunay
Add read for OTP and PMIC NVM with alternates
on virtual DFU device.

Serie-cc: Boris Brezillon 
Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/stm32mp1.c| 83 +
 configs/stm32mp15_basic_defconfig   |  1 +
 configs/stm32mp15_optee_defconfig   |  1 +
 configs/stm32mp15_trusted_defconfig |  1 +
 4 files changed, 86 insertions(+)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index e4bdf05cd7..6045850c05 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -975,9 +975,92 @@ void set_dfu_alt_info(char *interface, char *devstr)
if (!IS_ERR_OR_NULL(mtd))
board_get_alt_info("spi-nand0", buf);
 
+#ifdef CONFIG_DFU_VIRT
+   strncat(buf, " 0=OTP", DFU_ALT_BUF_LEN);
+
+   if (IS_ENABLED(CONFIG_PMIC_STPMIC1))
+   strncat(buf, " 1=PMIC", DFU_ALT_BUF_LEN);
+#endif
+
env_set("dfu_alt_info", buf);
puts("DFU alt info setting: done\n");
 }
+
+#if CONFIG_IS_ENABLED(DFU_VIRT)
+#include 
+#include 
+
+int dfu_otp_read(u64 offset, u8 *buffer, long *size)
+{
+   struct udevice *dev;
+   int ret;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ );
+   if (ret)
+   return ret;
+
+   ret = misc_read(dev, offset + STM32_BSEC_OTP_OFFSET, buffer, *size);
+   if (ret >= 0) {
+   *size = ret;
+   ret = 0;
+   }
+
+   return 0;
+}
+
+int dfu_pmic_read(u64 offset, u8 *buffer, long *size)
+{
+   int ret;
+#ifdef CONFIG_PMIC_STPMIC1
+   struct udevice *dev;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stpmic1_nvm),
+ );
+   if (ret)
+   return ret;
+
+   ret = misc_read(dev, 0xF8 + offset, buffer, *size);
+   if (ret >= 0) {
+   *size = ret;
+   ret = 0;
+   }
+   if (ret == -EACCES) {
+   *size = 0;
+   ret = 0;
+   }
+#else
+   pr_err("PMIC update not supported");
+   ret = -EOPNOTSUPP;
+#endif
+
+   return ret;
+}
+
+int dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset,
+void *buf, long *len)
+{
+   switch (dfu->data.virt.dev_num) {
+   case 0x0:
+   return dfu_otp_read(offset, buf, len);
+   case 0x1:
+   return dfu_pmic_read(offset, buf, len);
+   }
+   *len = 0;
+   return 0;
+}
+
+int __weak dfu_get_medium_size_virt(struct dfu_entity *dfu, u64 *size)
+{
+   *size = SZ_1K;
+
+   return 0;
+}
+
+#endif
+
 #endif
 
 static void board_copro_image_process(ulong fw_image, size_t fw_size)
diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 8e90505070..a15e3c32b1 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -66,6 +66,7 @@ CONFIG_STM32_ADC=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_MTD=y
+CONFIG_DFU_VIRT=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0xC000
 CONFIG_FASTBOOT_BUF_SIZE=0x0200
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 387de0ad35..3b8a90de2d 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -53,6 +53,7 @@ CONFIG_STM32_ADC=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_MTD=y
+CONFIG_DFU_VIRT=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0xC000
 CONFIG_FASTBOOT_BUF_SIZE=0x0200
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 29c23c634d..bcbd8a5c4e 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -52,6 +52,7 @@ CONFIG_STM32_ADC=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_MTD=y
+CONFIG_DFU_VIRT=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0xC000
 CONFIG_FASTBOOT_BUF_SIZE=0x0200
-- 
2.17.1

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


[U-Boot] [PATCH 08/14] dfu: add DFU virtual backend

2019-09-13 Thread Patrick Delaunay
Add a virtual DFU backend to allow board specific read and write
(for OTP update for example).

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/Kconfig|  7 ++
 drivers/dfu/Makefile   |  1 +
 drivers/dfu/dfu.c  |  5 -
 drivers/dfu/dfu_virt.c | 49 ++
 include/dfu.h  | 22 +++
 5 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dfu/dfu_virt.c

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index ee664a331b..c0e6e5d8f0 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -52,5 +52,12 @@ config DFU_MTD
help
  This option enables using DFU to read and write to on any MTD device.
 
+config DFU_VIRT
+   bool "VIRTUAL flash back end for DFU"
+   help
+ This option enables using DFU to read and write to VIRTUAL device
+ used at board level to manage specific behavior
+ (OTP update for example).
+
 endif
 endmenu
diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile
index ebb119f398..0d7925c083 100644
--- a/drivers/dfu/Makefile
+++ b/drivers/dfu/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_$(SPL_)DFU_NAND) += dfu_nand.o
 obj-$(CONFIG_$(SPL_)DFU_RAM) += dfu_ram.o
 obj-$(CONFIG_$(SPL_)DFU_SF) += dfu_sf.o
 obj-$(CONFIG_$(SPL_)DFU_TFTP) += dfu_tftp.o
+obj-$(CONFIG_$(SPL_)DFU_VIRT) += dfu_virt.o
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 4f4a07b790..2697235c24 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -474,6 +474,9 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, 
int alt,
} else if (strcmp(interface, "sf") == 0) {
if (dfu_fill_entity_sf(dfu, devstr, s))
return -1;
+   } else if (strcmp(interface, "virt") == 0) {
+   if (dfu_fill_entity_virt(dfu, devstr, s))
+   return -1;
} else {
printf("%s: Device %s not (yet) supported!\n",
   __func__,  interface);
@@ -569,7 +572,7 @@ int dfu_config_entities(char *env, char *interface, char 
*devstr)
 const char *dfu_get_dev_type(enum dfu_device_type t)
 {
const char *const dev_t[] = {NULL, "eMMC", "OneNAND", "NAND", "RAM",
-"SF", "MTD"};
+"SF", "MTD", "VIRT"};
return dev_t[t];
 }
 
diff --git a/drivers/dfu/dfu_virt.c b/drivers/dfu/dfu_virt.c
new file mode 100644
index 00..ea8c71f100
--- /dev/null
+++ b/drivers/dfu/dfu_virt.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
+ */
+#include 
+#include 
+#include 
+#include 
+
+int __weak dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
+void *buf, long *len)
+{
+   debug("%s: off=0x%llx, len=0x%x\n", __func__, offset, (u32)*len);
+
+   return 0;
+}
+
+int __weak dfu_get_medium_size_virt(struct dfu_entity *dfu, u64 *size)
+{
+   *size = 0;
+
+   return 0;
+}
+
+int __weak dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset,
+   void *buf, long *len)
+{
+   debug("%s: off=0x%llx, len=0x%x\n", __func__, offset, (u32)*len);
+   *len = 0;
+
+   return 0;
+}
+
+int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, char *s)
+{
+   debug("%s: devstr = %s\n", __func__, devstr);
+
+   dfu->dev_type = DFU_DEV_VIRT;
+   dfu->layout = DFU_RAW_ADDR;
+   dfu->data.virt.dev_num = simple_strtoul(devstr, NULL, 10);
+
+   dfu->write_medium = dfu_write_medium_virt;
+   dfu->get_medium_size = dfu_get_medium_size_virt;
+   dfu->read_medium = dfu_read_medium_virt;
+
+   dfu->inited = 0;
+
+   return 0;
+}
diff --git a/include/dfu.h b/include/dfu.h
index a90732cc43..4de7d35914 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -23,6 +23,7 @@ enum dfu_device_type {
DFU_DEV_RAM,
DFU_DEV_SF,
DFU_DEV_MTD,
+   DFU_DEV_VIRT,
 };
 
 enum dfu_layout {
@@ -92,6 +93,10 @@ struct sf_internal_data {
unsigned int ubi;
 };
 
+struct virt_internal_data {
+   int dev_num;
+};
+
 #define DFU_NAME_SIZE  32
 #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE   (1024*1024*8)   /* 8 MiB */
@@ -120,6 +125,7 @@ struct dfu_entity {
struct nand_internal_data nand;
struct ram_internal_data ram;
struct sf_internal_data sf;
+   struct virt_internal_data virt;
} data;
 
int (*get_medium_size)(struct dfu_entity *dfu, u64 *size);
@@ -272,6 +278,22 @@ static inline int dfu_fill_entity_mtd(struct dfu_entity 
*dfu, char *devstr,
 }
 #endif
 
+#ifdef CONFIG_DFU_VIRT
+int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, char *s);
+int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
+ void *buf, long *len);
+int 

[U-Boot] [PATCH 09/14] dfu: add callback for flush and initiated operation

2019-09-13 Thread Patrick Delaunay
Add weak callback to allow board specific behavior
- flush
- initiated

This patch prepare usage of DFU back end for communication with
STM32CubeProgrammer on stm32mp1 platform with stm32prog command.

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/dfu.c | 19 +++
 include/dfu.h |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 2697235c24..f12c5afc66 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -22,6 +22,22 @@ static int dfu_alt_num;
 static int alt_num_cnt;
 static struct hash_algo *dfu_hash_algo;
 
+/*
+ * The purpose of the dfu_flush_callback() function is to
+ * provide callback for dfu user
+ */
+__weak void dfu_flush_callback(struct dfu_entity *dfu)
+{
+}
+
+/*
+ * The purpose of the dfu_flush_callback() function is to
+ * provide callback for dfu user
+ */
+__weak void dfu_initiated_callback(struct dfu_entity *dfu)
+{
+}
+
 /*
  * The purpose of the dfu_usb_get_reset() function is to
  * provide information if after USB_DETACH request
@@ -263,6 +279,7 @@ int dfu_transaction_initiate(struct dfu_entity *dfu, bool 
read)
}
 
dfu->inited = 1;
+   dfu_initiated_callback(dfu);
 
return 0;
 }
@@ -282,6 +299,8 @@ int dfu_flush(struct dfu_entity *dfu, void *buf, int size, 
int blk_seq_num)
printf("\nDFU complete %s: 0x%08x\n", dfu_hash_algo->name,
   dfu->crc);
 
+   dfu_flush_callback(dfu);
+
dfu_transaction_cleanup(dfu);
 
return ret;
diff --git a/include/dfu.h b/include/dfu.h
index 4de7d35914..5d85cc35ef 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -182,6 +182,8 @@ bool dfu_usb_get_reset(void);
 int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 int dfu_flush(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
+void dfu_flush_callback(struct dfu_entity *dfu);
+void dfu_initiated_callback(struct dfu_entity *dfu);
 
 /*
  * dfu_defer_flush - pointer to store dfu_entity for deferred flashing.
-- 
2.17.1

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


[U-Boot] [PATCH 10/14] stm32mp1: activate DFU support and command MTD

2019-09-13 Thread Patrick Delaunay
Add support of DFU for MMC, MTD, RAM and MTD command.

Signed-off-by: Patrick Delaunay 
---

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

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 09785b5dc1..bc9018684d 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
@@ -62,6 +63,9 @@ CONFIG_ENV_UBI_PART="UBI"
 CONFIG_ENV_UBI_VOLUME="uboot_config"
 CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
 CONFIG_STM32_ADC=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_MTD=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0xC000
 CONFIG_FASTBOOT_BUF_SIZE=0x0200
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 177cbc7d5f..8d3d2e8508 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
@@ -49,6 +50,9 @@ CONFIG_ENV_UBI_PART="UBI"
 CONFIG_ENV_UBI_VOLUME="uboot_config"
 CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
 CONFIG_STM32_ADC=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_MTD=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0xC000
 CONFIG_FASTBOOT_BUF_SIZE=0x0200
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 71ad1157ec..8da8c4e22a 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -22,6 +22,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
@@ -48,6 +49,9 @@ CONFIG_ENV_UBI_PART="UBI"
 CONFIG_ENV_UBI_VOLUME="uboot_config"
 CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
 CONFIG_STM32_ADC=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_MTD=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0xC000
 CONFIG_FASTBOOT_BUF_SIZE=0x0200
-- 
2.17.1

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


[U-Boot] [PATCH 11/14] stm32mp1: activate SET_DFU_ALT_INFO

2019-09-13 Thread Patrick Delaunay
Generate automatically dfu_alt_info for the supported device.
The simple command "dfu 0" allows to start the dfu stack on usb 0
for the supported devices:
- dfu mtd for nand0
- dfu mtd for nor0
- dfu mmc for SDCard
- dfu mmc for eMMC
- dfu ram for images in DDR

The DUF alternate use the "part", "partubi" and "mmcpart" options
to select the correct MTD or GPT partition or the eMMC hw boot partition.

Signed-off-by: Patrick Delaunay 
---

 board/st/stm32mp1/README | 111 +++
 board/st/stm32mp1/stm32mp1.c |  51 
 include/configs/stm32mp1.h   |  32 ++
 3 files changed, 194 insertions(+)

diff --git a/board/st/stm32mp1/README b/board/st/stm32mp1/README
index c807e0842e..f2069bcefa 100644
--- a/board/st/stm32mp1/README
+++ b/board/st/stm32mp1/README
@@ -390,3 +390,114 @@ B/ Automatically by using FIT feature and generic DISTRO 
bootcmd
 the correct configuration
=> stm32mp157c-ev1-m4
=> stm32mp157c-dk2-m4
+
+11. DFU support
+===
+
+The DFU is supported on ST board.
+The env variable dfu_alt_info is automatically build, and all
+the memory present on the ST boards are exported.
+
+The mode is started by
+
+STM32MP> dfu 0
+
+On EV1 board:
+
+STM32MP> dfu 0 list
+
+DFU alt settings list:
+dev: RAM alt: 0 name: uImage layout: RAM_ADDR
+dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR
+dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR
+dev: eMMC alt: 3 name: sdcard_fsbl1 layout: RAW_ADDR
+dev: eMMC alt: 4 name: sdcard_fsbl2 layout: RAW_ADDR
+dev: eMMC alt: 5 name: sdcard_ssbl layout: RAW_ADDR
+dev: eMMC alt: 6 name: sdcard_bootfs layout: RAW_ADDR
+dev: eMMC alt: 7 name: sdcard_vendorfs layout: RAW_ADDR
+dev: eMMC alt: 8 name: sdcard_rootfs layout: RAW_ADDR
+dev: eMMC alt: 9 name: sdcard_userfs layout: RAW_ADDR
+dev: eMMC alt: 10 name: emmc_fsbl1 layout: RAW_ADDR
+dev: eMMC alt: 11 name: emmc_fsbl2 layout: RAW_ADDR
+dev: eMMC alt: 12 name: emmc_ssbl layout: RAW_ADDR
+dev: eMMC alt: 13 name: emmc_bootfs layout: RAW_ADDR
+dev: eMMC alt: 14 name: emmc_vendorfs layout: RAW_ADDR
+dev: eMMC alt: 15 name: emmc_rootfs layout: RAW_ADDR
+dev: eMMC alt: 16 name: emmc_userfs layout: RAW_ADDR
+dev: MTD alt: 17 name: nor_fsbl1 layout: RAW_ADDR
+dev: MTD alt: 18 name: nor_fsbl2 layout: RAW_ADDR
+dev: MTD alt: 19 name: nor_ssbl layout: RAW_ADDR
+dev: MTD alt: 20 name: nor_env layout: RAW_ADDR
+dev: MTD alt: 21 name: nand_fsbl layout: RAW_ADDR
+dev: MTD alt: 22 name: nand_ssbl1 layout: RAW_ADDR
+dev: MTD alt: 23 name: nand_ssbl2 layout: RAW_ADDR
+dev: MTD alt: 24 name: nand_UBI layout: RAW_ADDR
+dev: VIRT alt: 25 name: OTP layout: RAW_ADDR
+dev: VIRT alt: 26 name: PMIC layout: RAW_ADDR
+
+All the supported device are exported for dfu-util tool:
+
+$> dfu-util -l
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=26, 
name="PMIC", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=25, name="OTP", 
serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=24, 
name="nand_UBI", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=23, 
name="nand_ssbl2", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=22, 
name="nand_ssbl1", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=21, 
name="nand_fsbl", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=20, 
name="nor_env", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=19, 
name="nor_ssbl", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=18, 
name="nor_fsbl2", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=17, 
name="nor_fsbl1", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=16, 
name="emmc_userfs", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=15, 
name="emmc_rootfs", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=14, 
name="emmc_vendorfs", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=13, 
name="emmc_bootfs", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=12, 
name="emmc_ssbl", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=11, 
name="emmc_fsbl2", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=10, 
name="emmc_fsbl1", serial="00270038511934383330"
+Found DFU: [0483:5720] ver=, devnum=99, cfg=1, intf=0, alt=9, 
name="sdcard_userfs", serial="00270038511934383330"
+Found DFU: [0483:5720] 

[U-Boot] [PATCH 02/14] dfu: sf: add partition support for nor backend

2019-09-13 Thread Patrick Delaunay
Copy the partition support from NAND backend to SF,
support part and partubi option.
In case of ubi partition, erase the rest of the
partition as it is mandatory for UBI.

for example:

U-Boot> env set dfu_alt_info "spl part 0 1;\
u-boot part 0 2;u-boot-env part 0 3;UBI partubi 0 4"
U-Boot> dfu 0 sf 0:0:1000:0

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/dfu_sf.c | 51 
 include/dfu.h|  2 ++
 2 files changed, 53 insertions(+)

diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index b78fcfd3a1..d401b76c2e 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 static int dfu_get_medium_size_sf(struct dfu_entity *dfu, u64 *size)
 {
@@ -52,11 +54,33 @@ static int dfu_write_medium_sf(struct dfu_entity *dfu,
 
 static int dfu_flush_medium_sf(struct dfu_entity *dfu)
 {
+   u64 off, length;
+
+   if (!dfu->data.sf.ubi)
+   return 0;
+
+   /* in case of ubi partition, erase rest of the partition */
+   off = find_sector(dfu, dfu->data.sf.start, dfu->offset);
+   /* last write ended with unaligned length jump to next */
+   if (off != dfu->data.sf.start + dfu->offset)
+   off += dfu->data.sf.dev->sector_size;
+   length = dfu->data.sf.start + dfu->data.sf.size - off;
+   if (length)
+   return spi_flash_erase(dfu->data.sf.dev, off, length);
+
return 0;
 }
 
 static unsigned int dfu_polltimeout_sf(struct dfu_entity *dfu)
 {
+   /*
+* Currently, Poll Timeout != 0 is only needed on nand
+* ubi partition, as sectors which are not used need
+* to be erased
+*/
+   if (dfu->data.sf.ubi)
+   return DFU_MANIFEST_POLL_TIMEOUT;
+
return DFU_DEFAULT_POLL_TIMEOUT;
 }
 
@@ -133,6 +157,33 @@ int dfu_fill_entity_sf(struct dfu_entity *dfu, char 
*devstr, char *s)
dfu->data.sf.start = simple_strtoul(s, , 16);
s++;
dfu->data.sf.size = simple_strtoul(s, , 16);
+   } else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
+   char mtd_id[32];
+   struct mtd_device *mtd_dev;
+   u8 part_num;
+   struct part_info *pi;
+   int ret, dev, part;
+
+   dfu->layout = DFU_RAW_ADDR;
+
+   dev = simple_strtoul(s, , 10);
+   s++;
+   part = simple_strtoul(s, , 10);
+
+   sprintf(mtd_id, "%s%d,%d", "nor", dev, part - 1);
+   printf("using id '%s'\n", mtd_id);
+
+   mtdparts_init();
+
+   ret = find_dev_and_part(mtd_id, _dev, _num, );
+   if (ret != 0) {
+   printf("Could not locate '%s'\n", mtd_id);
+   return -1;
+   }
+   dfu->data.sf.start = pi->offset;
+   dfu->data.sf.size = pi->size;
+   if (!strcmp(st, "partubi"))
+   dfu->data.sf.ubi = 1;
} else {
printf("%s: Memory layout (%s) not supported!\n", __func__, st);
spi_flash_free(dfu->data.sf.dev);
diff --git a/include/dfu.h b/include/dfu.h
index 145a1576a3..bf51ab74a5 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -77,6 +77,8 @@ struct sf_internal_data {
/* RAW programming */
u64 start;
u64 size;
+   /* for sf/ubi use */
+   unsigned int ubi;
 };
 
 #define DFU_NAME_SIZE  32
-- 
2.17.1

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


[U-Boot] [PATCH 06/14] dfu: add backend for MTD device

2019-09-13 Thread Patrick Delaunay
Add DFU backend for MTD device: allow to read
and write on any MTD device (RAW or SPI)

For example :
> set dfu_alt_info "nand_raw raw 0x0 0x10"
> dfu 0 mtd nand0

This MTD backend provides the same level than dfu nand
backend for NAND in RAW mode and sf backend for NOR;
So it can replace booth of them but it can also
add support of spi-nand.

> set dfu_alt_info "nand_raw raw 0x0 0x10"
> dfu 0 mtd spi-nand0

The backend code is based on the MTD command
introduced by commit 5db66b3aee6f ("cmd: mtd:
add 'mtd' command")

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/Kconfig   |   6 ++
 drivers/dfu/Makefile  |   1 +
 drivers/dfu/dfu.c |   5 +-
 drivers/dfu/dfu_mtd.c | 230 ++
 include/dfu.h |  21 
 5 files changed, 262 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dfu/dfu_mtd.c

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 4692736c9d..ee664a331b 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -46,5 +46,11 @@ config DFU_SF
  This option enables using DFU to read and write to SPI flash based
  storage.
 
+config DFU_MTD
+   bool "MTD back end for DFU"
+   depends on MTD
+   help
+ This option enables using DFU to read and write to on any MTD device.
+
 endif
 endmenu
diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile
index 4164f342ac..ebb119f398 100644
--- a/drivers/dfu/Makefile
+++ b/drivers/dfu/Makefile
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_$(SPL_)DFU) += dfu.o
 obj-$(CONFIG_$(SPL_)DFU_MMC) += dfu_mmc.o
+obj-$(CONFIG_$(SPL_)DFU_MTD) += dfu_mtd.o
 obj-$(CONFIG_$(SPL_)DFU_NAND) += dfu_nand.o
 obj-$(CONFIG_$(SPL_)DFU_RAM) += dfu_ram.o
 obj-$(CONFIG_$(SPL_)DFU_SF) += dfu_sf.o
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 50919fcae9..4f4a07b790 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -462,6 +462,9 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, 
int alt,
if (strcmp(interface, "mmc") == 0) {
if (dfu_fill_entity_mmc(dfu, devstr, s))
return -1;
+   } else if (strcmp(interface, "mtd") == 0) {
+   if (dfu_fill_entity_mtd(dfu, devstr, s))
+   return -1;
} else if (strcmp(interface, "nand") == 0) {
if (dfu_fill_entity_nand(dfu, devstr, s))
return -1;
@@ -566,7 +569,7 @@ int dfu_config_entities(char *env, char *interface, char 
*devstr)
 const char *dfu_get_dev_type(enum dfu_device_type t)
 {
const char *const dev_t[] = {NULL, "eMMC", "OneNAND", "NAND", "RAM",
-"SF"};
+"SF", "MTD"};
return dev_t[t];
 }
 
diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c
new file mode 100644
index 00..1168a6e278
--- /dev/null
+++ b/drivers/dfu/dfu_mtd.c
@@ -0,0 +1,230 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * dfu_mtd.c -- DFU for MTD device.
+ *
+ * Copyright (C) 2019,STMicroelectronics - All Rights Reserved
+ *
+ * Based on dfu_nand.c
+ */
+
+#include 
+#include 
+#include 
+
+static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size)
+{
+   return !do_div(size, mtd->erasesize);
+}
+
+static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu,
+   u64 offset, void *buf, long *len)
+{
+   u64 off, lim, remaining;
+   struct mtd_info *mtd = dfu->data.mtd.info;
+   struct mtd_oob_ops io_op = {};
+   int ret = 0;
+   bool has_pages = mtd->type == MTD_NANDFLASH ||
+mtd->type == MTD_MLCNANDFLASH;
+
+   /* if buf == NULL return total size of the area */
+   if (!buf) {
+   *len = dfu->data.mtd.size;
+   return 0;
+   }
+
+   off = dfu->data.mtd.start + offset + dfu->bad_skip;
+   lim = dfu->data.mtd.start + dfu->data.mtd.size;
+
+   if (off >= lim) {
+   printf("Limit reached 0x%llx\n", lim);
+   *len = 0;
+   return op == DFU_OP_READ ? 0 : -EIO;
+   }
+   /* limit request with the available size */
+   if (off + *len >= lim)
+   *len = lim - off;
+
+   if (!mtd_is_aligned_with_block_size(mtd, off)) {
+   printf("Offset not aligned with a block (0x%x)\n",
+  mtd->erasesize);
+   return 0;
+   }
+
+   /* first erase */
+   if (op == DFU_OP_WRITE) {
+   struct erase_info erase_op = {};
+
+   erase_op.mtd = mtd;
+   erase_op.addr = off;
+   erase_op.len = round_up(*len, mtd->erasesize);
+   erase_op.scrub = 0;
+
+   while (erase_op.len) {
+   if (erase_op.addr + erase_op.len > lim) {
+   printf("Limit reached 0x%llx while erasing at 
offset 0x%llx\n",
+  lim, off);
+   return -EIO;
+  

[U-Boot] [PATCH 03/14] dfu: prepare the support of multiple interface

2019-09-13 Thread Patrick Delaunay
Split the function dfu_config_entities with 2 new functions
- dfu_alt_init
- dfu_alt_add

Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/dfu.c | 51 ---
 include/dfu.h |  2 ++
 2 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index e9db7f8d66..900a844d15 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -439,13 +439,12 @@ void dfu_free_entities(void)
alt_num_cnt = 0;
 }
 
-int dfu_config_entities(char *env, char *interface, char *devstr)
+int dfu_alt_init(int num, struct dfu_entity **dfu)
 {
-   struct dfu_entity *dfu;
-   int i, ret;
char *s;
+   int ret;
 
-   dfu_alt_num = dfu_find_alt_num(env);
+   dfu_alt_num = num;
debug("%s: dfu_alt_num=%d\n", __func__, dfu_alt_num);
 
dfu_hash_algo = NULL;
@@ -456,21 +455,49 @@ int dfu_config_entities(char *env, char *interface, char 
*devstr)
pr_err("Hash algorithm %s not supported\n", s);
}
 
-   dfu = calloc(sizeof(*dfu), dfu_alt_num);
-   if (!dfu)
+   *dfu = calloc(sizeof(struct dfu_entity), dfu_alt_num);
+   if (!*dfu)
+   return -1;
+
+   return 0;
+}
+
+int dfu_alt_add(struct dfu_entity *dfu, char *interface, char *devstr, char *s)
+{
+   struct dfu_entity *p_dfu;
+   int ret;
+
+   if (alt_num_cnt >= dfu_alt_num)
+   return -1;
+
+   p_dfu = [alt_num_cnt];
+   ret = dfu_fill_entity(p_dfu, s, alt_num_cnt, interface, devstr);
+   if (ret)
return -1;
-   for (i = 0; i < dfu_alt_num; i++) {
 
+   list_add_tail(_dfu->list, _list);
+   alt_num_cnt++;
+
+   return 0;
+}
+
+int dfu_config_entities(char *env, char *interface, char *devstr)
+{
+   struct dfu_entity *dfu;
+   int i, ret;
+   char *s;
+
+   ret = dfu_alt_init(dfu_find_alt_num(env), );
+   if (ret)
+   return -1;
+
+   for (i = 0; i < dfu_alt_num; i++) {
s = strsep(, ";");
-   ret = dfu_fill_entity([i], s, alt_num_cnt, interface,
- devstr);
+   ret = dfu_alt_add(dfu, interface, devstr, s);
if (ret) {
/* We will free "dfu" in dfu_free_entities() */
return -1;
}
-
-   list_add_tail([i].list, _list);
-   alt_num_cnt++;
}
 
return 0;
diff --git a/include/dfu.h b/include/dfu.h
index bf51ab74a5..7d60ffc228 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -143,6 +143,8 @@ struct dfu_entity {
 #ifdef CONFIG_SET_DFU_ALT_INFO
 void set_dfu_alt_info(char *interface, char *devstr);
 #endif
+int dfu_alt_init(int num, struct dfu_entity **dfu);
+int dfu_alt_add(struct dfu_entity *dfu, char *interface, char *devstr, char 
*s);
 int dfu_config_entities(char *s, char *interface, char *devstr);
 void dfu_free_entities(void);
 void dfu_show_entities(void);
-- 
2.17.1

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


[U-Boot] [PATCH 04/14] dfu: allow to manage DFU on several devices

2019-09-13 Thread Patrick Delaunay
Add support of DFU for several interface/device
with one command.

The format for "dfu_alt_info" in this case is :
  interface with devstring'='alternate list (';' separated)
  and each interface is separated by '&'

The previous behavior is always supported.

One example for NOR (bootloaders) + NAND (rootfs in UBI):

U-Boot> env set dfu_alt_info \
"sf 0:0:1000:0=spl part 0 1;u-boot part 0 2; \
u-boot-env part 0 3 0=UBI partubi 0,3"

U-Boot> dfu 0 list

DFU alt settings list:
dev: SF alt: 0 name: spl layout: RAW_ADDR
dev: SF alt: 1 name: ssbl layout: RAW_ADDR
dev: SF alt: 2 name: u-boot-env layout: RAW_ADDR
dev: NAND alt: 3 name: UBI layout: RAW_ADDR

U-Boot> dfu 0

$> dfu-util -l

Found DFU: [0483:5720] ver=, devnum=96, cfg=1,\
 intf=0, alt=3, name="UBI", serial="00270038511934383330"
Found DFU: [0483:5720] ver=, devnum=96, cfg=1,\
 intf=0, alt=2, name="u-boot-env", serial="00270038511934383330"
Found DFU: [0483:5720] ver=, devnum=96, cfg=1,\
 intf=0, alt=1, name="u-boot", serial="00270038511934383330"
Found DFU: [0483:5720] ver=, devnum=96, cfg=1,\
 intf=0, alt=0, name="spl", serial="00270038511934383330"

Signed-off-by: Patrick Delaunay 
---

 cmd/dfu.c | 21 ++---
 drivers/dfu/dfu.c | 60 ++-
 2 files changed, 72 insertions(+), 9 deletions(-)

diff --git a/cmd/dfu.c b/cmd/dfu.c
index 91a750a4fc..33491d0bc9 100644
--- a/cmd/dfu.c
+++ b/cmd/dfu.c
@@ -21,23 +21,28 @@
 static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 
-   if (argc < 4)
+   if (argc < 2)
return CMD_RET_USAGE;
 
 #ifdef CONFIG_DFU_OVER_USB
char *usb_controller = argv[1];
 #endif
 #if defined(CONFIG_DFU_OVER_USB) || defined(CONFIG_DFU_OVER_TFTP)
-   char *interface = argv[2];
-   char *devstring = argv[3];
+   char *interface = NULL;
+   char *devstring = NULL;
+
+   if (argc >= 4) {
+   interface = argv[2];
+   devstring = argv[3];
+   }
 #endif
 
int ret = 0;
 #ifdef CONFIG_DFU_OVER_TFTP
unsigned long addr = 0;
if (!strcmp(argv[1], "tftp")) {
-   if (argc == 5)
-   addr = simple_strtoul(argv[4], NULL, 0);
+   if (argc == 5 || argc == 3)
+   addr = simple_strtoul(argv[argc - 1], NULL, 0);
 
return update_tftp(addr, interface, devstring);
}
@@ -48,7 +53,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
goto done;
 
ret = CMD_RET_SUCCESS;
-   if (argc > 4 && strcmp(argv[4], "list") == 0) {
+   if (strcmp(argv[argc - 1], "list") == 0) {
dfu_show_entities();
goto done;
}
@@ -67,7 +72,7 @@ U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
"Device Firmware Upgrade",
""
 #ifdef CONFIG_DFU_OVER_USB
-   "   [list]\n"
+   " [ ] [list]\n"
"  - device firmware upgrade via \n"
"on device , attached to interface\n"
"\n"
@@ -77,7 +82,7 @@ U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
 #ifdef CONFIG_DFU_OVER_USB
"dfu "
 #endif
-   "tftp   []\n"
+   "tftp [ ] []\n"
"  - device firmware upgrade via TFTP\n"
"on device , attached to interface\n"
"\n"
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 900a844d15..8bd5216017 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -53,6 +53,54 @@ static int dfu_find_alt_num(const char *s)
return ++i;
 }
 
+/*
+ * treat dfu_alt_info with several interface information
+ * to allow DFU on several device with one command,
+ * the string format is
+ * interface devstring'='alternate list (';' separated)
+ * and each interface separated by '&'
+ */
+int dfu_config_interfaces(char *env)
+{
+   struct dfu_entity *dfu;
+   char *s, *i, *d, *a, *part;
+   int ret = -EINVAL;
+   int n = 1;
+
+   s = env;
+   for (; *s; s++) {
+   if (*s == ';')
+   n++;
+   if (*s == '&')
+   n++;
+   }
+   ret = dfu_alt_init(n, );
+   if (ret)
+   return ret;
+
+   s = env;
+   while (s) {
+   ret = -EINVAL;
+   i = strsep(, " ");
+   if (!i)
+   break;
+   d = strsep(, "=");
+   if (!d)
+   break;
+   a = strsep(, "&");
+   if (!a)
+   a = s;
+   do {
+   part = strsep(, ";");
+   ret = dfu_alt_add(dfu, i, d, part);
+   if (ret)
+   return ret;
+   } while (a);
+   }
+
+   return ret;
+}
+
 int dfu_init_env_entities(char *interface, char *devstr)
 {
const char *str_env;
@@ -69,7 +117,11 @@ int dfu_init_env_entities(char 

[U-Boot] [PATCH 01/14] dfu: cosmetic: cleanup sf to avoid checkpatch error

2019-09-13 Thread Patrick Delaunay
Signed-off-by: Patrick Delaunay 
---

 drivers/dfu/dfu.c| 7 ---
 drivers/dfu/dfu_sf.c | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index d2b67b18cf..e9db7f8d66 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -478,14 +478,15 @@ int dfu_config_entities(char *env, char *interface, char 
*devstr)
 
 const char *dfu_get_dev_type(enum dfu_device_type t)
 {
-   const char *dev_t[] = {NULL, "eMMC", "OneNAND", "NAND", "RAM", "SF" };
+   const char *const dev_t[] = {NULL, "eMMC", "OneNAND", "NAND", "RAM",
+"SF"};
return dev_t[t];
 }
 
 const char *dfu_get_layout(enum dfu_layout l)
 {
-   const char *dfu_layout[] = {NULL, "RAW_ADDR", "FAT", "EXT2",
-  "EXT3", "EXT4", "RAM_ADDR" };
+   const char *const dfu_layout[] = {NULL, "RAW_ADDR", "FAT", "EXT2",
+ "EXT3", "EXT4", "RAM_ADDR" };
return dfu_layout[l];
 }
 
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 066e7670d1..b78fcfd3a1 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -19,7 +19,7 @@ static int dfu_get_medium_size_sf(struct dfu_entity *dfu, u64 
*size)
 }
 
 static int dfu_read_medium_sf(struct dfu_entity *dfu, u64 offset, void *buf,
-   long *len)
+ long *len)
 {
return spi_flash_read(dfu->data.sf.dev, dfu->data.sf.start + offset,
*len, buf);
@@ -32,7 +32,7 @@ static u64 find_sector(struct dfu_entity *dfu, u64 start, u64 
offset)
 }
 
 static int dfu_write_medium_sf(struct dfu_entity *dfu,
-   u64 offset, void *buf, long *len)
+  u64 offset, void *buf, long *len)
 {
int ret;
 
-- 
2.17.1

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


[U-Boot] [PATCH 00/14] dfu: update dfu stack and add MTD backend

2019-09-13 Thread Patrick Delaunay

This serie based on v2019.10-rc3 propose updates on the DFU stack:
- add capability to have several DFU backend running in parallel
- add MTD backend for update of NAND, NOR or SPI-NAND
- add VIRTUAL backend for board/command specific behavior
- add some weak callback

It is the same content that the previous RFC:
http://patchwork.ozlabs.org/project/uboot/list/?series=120375
"dfu: update dfu stack and use them for stm32mp1"

To test the new features and as example, I update the stm32mp1 board
to use the new features; I test them with the command "dfu 0"
(for test I have dependency with patch
 http://patchwork.ozlabs.org/patch/1162076/)

The expected target of the dfu part for this serie is v2020.01.
I will merge the stm32mp1 part when they will be accepted by dfu
maintainers.

This serie prepares the DFU backend for the coming 'stm32prog' command
and for STM32CubeProgrammer on stm32mp1 platform.
This STMicroelectronics tool is based on DFU protocol and allows to
update all the boot devices and the OTPs on the ST boards
(so several DFU target in parallel, including spi nand).



Patrick Delaunay (14):
  dfu: cosmetic: cleanup sf to avoid checkpatch error
  dfu: sf: add partition support for nor backend
  dfu: prepare the support of multiple interface
  dfu: allow to manage DFU on several devices
  dfu: allow read with 0 data for EOF indication
  dfu: add backend for MTD device
  dfu: add partition support for MTD backend
  dfu: add DFU virtual backend
  dfu: add callback for flush and initiated operation
  stm32mp1: activate DFU support and command MTD
  stm32mp1: activate SET_DFU_ALT_INFO
  stp32mp1: configs: activate CONFIG_MTD_SPI_NAND
  stm32mp1: board: add spi nand support
  stm32mp1: add support for virtual partition read

 board/st/stm32mp1/README| 111 ++
 board/st/stm32mp1/stm32mp1.c| 164 ++-
 cmd/dfu.c   |  21 +-
 configs/stm32mp15_basic_defconfig   |   6 +
 configs/stm32mp15_optee_defconfig   |   6 +
 configs/stm32mp15_trusted_defconfig |   6 +
 drivers/dfu/Kconfig |  13 ++
 drivers/dfu/Makefile|   2 +
 drivers/dfu/dfu.c   | 145 +++--
 drivers/dfu/dfu_mtd.c   | 306 
 drivers/dfu/dfu_sf.c|  55 -
 drivers/dfu/dfu_virt.c  |  49 +
 include/configs/stm32mp1.h  |  42 +++-
 include/dfu.h   |  51 +
 14 files changed, 947 insertions(+), 30 deletions(-)
 create mode 100644 drivers/dfu/dfu_mtd.c
 create mode 100644 drivers/dfu/dfu_virt.c

-- 
2.17.1

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


Re: [U-Boot] [PATCH] MAINTAINERS: Change fsl-qoriq, mpc86xx, mpc85xx maintainers

2019-09-13 Thread Tom Rini
On Mon, Sep 09, 2019 at 04:55:08PM +0530, Prabhakar Kushwaha wrote:

> From: Priyanka Jain 
> 
> Change maintainers to Priyanka Jain for fsl-qoriq, mpc85xx
> 
> Signed-off-by: Priyanka Jain 
> Acked-by: Prabhakar Kushwaha 

Prabhakar, thanks again for your contributions.

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Pull request for UEFI sub-system for v2019.10-rc4 (4)

2019-09-13 Thread Tom Rini
On Thu, Sep 12, 2019 at 11:57:45AM +0200, Heinrich Schuchardt wrote:

> The following changes since commit 2f760735c170c854ffca76be5607cec5c56fdc4f:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-sh (2019-09-07
> 13:49:39 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-efi.git
> tags/efi-2019-10-rc4-4
> 
> for you to fetch changes up to 8262578535f18cdab95318828e6fd6464721ac54:
> 
>   efi_loader: parameter checks EFI_FILE_PROTOCOL.SetInfo() (2019-09-11
> 21:51:38 +0200)
> 
> No errors are reported in Gitlab CI nor in Travis CI:
> https://gitlab.denx.de/u-boot/custodians/u-boot-efi/pipelines/661
> https://travis-ci.org/xypron2/u-boot/builds/583835035
> 
> Primary key fingerprint:
> 6DC4 F9C7 1F29 A6FA 06B7  6D33 C481 DBBC 2C05 1AC4
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Why do we need both MDIO and MII commands

2019-09-13 Thread Tom Rini
On Fri, Sep 13, 2019 at 03:52:58PM +0300, Ramon Fried wrote:
> On Thu, Sep 12, 2019 at 5:55 PM Tom Rini  wrote:
> >
> > On Wed, Sep 11, 2019 at 10:58:22PM +0300, Ramon Fried wrote:
> >
> > > Hi.
> > > Marek raised this issue in IRC several weeks ago and I was wondering
> > > the same. why do we support this two commands which accomplish
> > > basically the same ?
> > >
> > > Can we ditch the mii comand and move the missing functionality to the
> > > mdio command ?
> >
> > Patch that also include a compatibility option would be a good thing to
> > see, yes.
> I learned the history of both of the commands and and also read some
> of the IEEE standard
> regarding the mii command (clause 22) and mdio command (clause 45).
> Basically, clause 45 is en extension which is not supported by old devices.
> Addressing method is different, and I think it will be cumbersome to
> create a single command
> that handles both.
> When I rethink it, I think we should keep both the commands.
> Any thoughts ?

Thanks for reading into it more.  This sounds like things that would be
good to have in the help text of both Kconfig entries so it's clear for
the next person to ask why what the answer is.

-- 
Tom


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


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Heinrich Schuchardt
On 9/13/19 1:48 PM, Ondřej Jirman wrote:
> On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
>> On 9/13/19 1:48 AM, meg...@megous.com wrote:
>>> From: Ondrej Jirman 
>>>
>>> The reverted patch causes linking error with disabled CONFIG_NET:
>>>
>>>cmd/built-in.o: In function `eth_env_get_enetaddr':
>>>u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
>>> `eth_parse_enetaddr'
>>>
>>> Function setup_environment() in board/sunxi/board.c calls
>>> eth_env_set_enetaddr() to setup stable mac address for ethernet interfaces.
>>>
>>> This needs to be implemented and succeed even if net is disabled in u-boot,
>>> as it ensures Linux will not generate random MAC addresses, and picks the
>>> ones provided by u-boot via DT. See fdt_fixup_ethernet().
>>>
>>> This feature is independent of the whole network stack and network drivers
>>> in u-boot.
>>>
>>> This revert fixes the linking error.
>>>
>>> Signed-off-by: Ondrej Jirman 
>>> ---
>>>   cmd/nvedit.c   | 12 
>>>   include/env_internal.h | 11 +++
>>>   include/net.h  | 11 ---
>>>   net/net.c  | 12 
>>>   4 files changed, 23 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
>>> index 1cb0bc1460..399f6d6ce1 100644
>>> --- a/cmd/nvedit.c
>>> +++ b/cmd/nvedit.c
>>> @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
>>> default_val)
>>> return value;
>>>   }
>>>
>>> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
>>> +{
>>> +   char *end;
>>> +   int i;
>>> +
>>> +   for (i = 0; i < 6; ++i) {
>>> +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
>>> +   if (addr)
>>> +   addr = (*end) ? end + 1 : end;
>>> +   }
>>> +}
>>> +
>>>   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
>>>   {
>>> eth_parse_enetaddr(env_get(name), enetaddr);
>>> diff --git a/include/env_internal.h b/include/env_internal.h
>>> index b1ddcb5adf..27eb5bd1e7 100644
>>> --- a/include/env_internal.h
>>> +++ b/include/env_internal.h
>>
>> Please, don't move the definition to env_internal.h but to env.h as
>> board/renesas/sh7753evb/sh7753evb.c and others are using
>> eth_parse_enetaddr().
>>
>> env_internal.h explicitly states "It should not be included by board files".
>>
>> Please, execute Travis CI tests to ensure you do not break any other board.
>
> I haven't found any documentation in the tree or on the u-boot website on
> how to do that.
>
> regards,
>   o.

Create a repository with U-Boot on Github (e.g. fork
https://github.com/trini/u-boot). Logon in https://travis-ci.org/ with
your Github account. Allow Travis to access the U-Boot repository. In
settings select "Build pushed requests". Push your commit to Github. Now
Travis should start building (takes about 4 hours).

The file telling Travis what to do is in .travis.yml in U-Boot.

Best regards

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


Re: [U-Boot] [PATCH 1/1] Dockerfile: build GRUB UEFI target for RISC-V 64bit

2019-09-13 Thread Tom Rini
On Sun, Aug 04, 2019 at 02:10:36PM +0200, Heinrich Schuchardt wrote:

> Build GRUB UEFI target grubriscv64.efi. It is needed for running
> test_efi_grub_net().
> 
> Signed-off-by: Heinrich Schuchardt 
> Reviewed-by: Bin Meng 

Applied to u-boot-gitlab-ci-runner/master.  Pushed and
trini/u-boot-gitlab-ci-runner:xenial-20190720-13Sep2019 built, tagged
and uploaded to docker.  Thanks!

-- 
Tom


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


Re: [U-Boot] rk3288: HDMI out causing boot hang

2019-09-13 Thread Michael Nazzareno Trimarchi
Hi Anatolij

On Fri, Sep 13, 2019 at 4:01 PM Anatolij Gustschin  wrote:
>
> Hi Jagan,
>
> On Fri, 13 Sep 2019 08:19:47 +0530
> Jagan Teki ja...@amarulasolutions.com wrote:
> ...
> > Any inputs?
>
> Try to input "setenv stdout serial" command on the serial console.
> There might be a chance that stdout/stdin has switched to the
> video console and the output proceeds there. If the HDMI display
> shows nothing, it appears like a hang.

It's not an hang. It's the output is not shown. I'm trying to
understand the reason

Michael
>
> --
> Anatolij
>
> ___
> Linux-rockchip mailing list
> linux-rockc...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rk3288: HDMI out causing boot hang

2019-09-13 Thread Anatolij Gustschin
Hi Jagan,

On Fri, 13 Sep 2019 08:19:47 +0530
Jagan Teki ja...@amarulasolutions.com wrote:
...
> Any inputs?

Try to input "setenv stdout serial" command on the serial console.
There might be a chance that stdout/stdin has switched to the
video console and the output proceeds there. If the HDMI display
shows nothing, it appears like a hang.
 
--
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] board: stm32mp1: fixup the usb product id for USB download gadget

2019-09-13 Thread Patrick Delaunay
Select the correct USB product id used by the download gadget
for ST stm32mp1 boards.

The board stm32mp1 select the correct product id, as defined in
http://www.linux-usb.org/usb.ids for the STMicroelectronics
vendor id = 0x0483 (CONFIG_USB_GADGET_VENDOR_NUM):
- dfu = 0xdf11 : STM Device in DFU mode
  it is the value used by ROM code and reused for stm32prog
  command
- fasboot = 0x0afb : Android Fastboot device
- others = 0x5720 (CONFIG_USB_GADGET_PRODUCT_NUM)
  Mass Storage Device
  it is used for UMS command / usb_dnl_ums

This patch avoid conflict when the same USB VID/PID is used for
ums, fastboot or dfu command (two different protocols associated
to the same PID).

Signed-off-by: Patrick Delaunay 
---

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

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 18f9b84876..126af30173 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -233,6 +233,23 @@ int g_dnl_board_usb_cable_connected(void)
 
return dwc2_udc_B_session_valid(dwc2_udc_otg);
 }
+
+#define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
+#define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+   if (!strcmp(name, "usb_dnl_dfu"))
+   put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, >idProduct);
+   else if (!strcmp(name, "usb_dnl_fastboot"))
+   put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,
+ >idProduct);
+   else
+   put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, >idProduct);
+
+   return 0;
+}
+
 #endif /* CONFIG_USB_GADGET */
 
 #ifdef CONFIG_LED
-- 
2.17.1

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


Re: [U-Boot] [PATCH] arm: at91: gardena-smart-gateway-at91sam: Enable CONFIG_SYS_NAND_USE_FLASH_BBT

2019-09-13 Thread Stefan Roese

Hi Alex,

On 13.09.19 15:09, Alexander Dahl wrote:

Am Dienstag, 27. August 2019, 08:14:50 CEST schrieb Stefan Roese:

This patch enables the BBT in NAND on the AT91SAM based GARDENA smart
Gateway. This is especially important, since the Linux driver also
enables this option and uses the BBT table pages. Without setting this
option, U-Boot will try to re-use these pages again (e.g. UBI).


Does the Linux kernel driver use those unconditionally or is that a kernel
config option? Which one? (Search in 5.2 kernel config for BBT is
inconclusive.)


Linux uses the DT property "nand-on-flash-bbt" for this decision.
But please be aware - this is only for raw NAND and not SPI NAND
(IIRC).

And yes, we should definitely move to this DT property instead of
the Kconfig symbol in U-Boot as well. To automatically match the
configuration of such boards in U-Boot and Linux. But such a change
it too intrusive at this time of release cycle.

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


Re: [U-Boot] [EXT] Re: [PATCH 1/6] spi: fsl_qspi: Fix DDR mode setting for latest iMX platforms

2019-09-13 Thread Stefan Roese

Hi Ashish,

On 12.09.19 14:36, Stefan Roese wrote:




The spi-mem version is still under debug, I could make it working
for ls1088rdb, ls1046rdb, but it is failing for
ls1012ardb and ls2088ardb and untested for i.mx and other Layerscape
silicon/boards . It is derived from work done by Frieder earlier.
This version can be found here:
https://github.com/erashish007/u-boot-spi-mem/tree/spi-mem-port


Many thanks. I did some tests with this version and it seems to work
fine in general on the i.MX6ULL EVK. My first tests show that reading
and writing has no issues. So this is very promising. The only thing
I noticed is, that when using SPI for environment via
CONFIG_ENV_IS_IN_SPI_FLASH, the board hangs upon bootup while trying
to read the env. Since you already added some debug print's to the
env code, I suspect that you also did run into this problem.

I'll try to help with this driver version. At least I can debug this
env issue and can always do some test on my mx6ull platform for you
once you have any updates here. Just let me know.


Okay, this one with the env in SPI NOR is fixed. Its a problem with
your PR debug printf macro. Please change it this way:

-#define PR(fmt, ...) \
-fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt" \n", \
+#define PR(fmt, ...)\
+printf("DEBUG: %s:%d:%s(): " fmt" \n", \

With this change, I can successfully boot with SPI NOR environment
on my board. I will do some further tests with your driver next
week and will get back to you with the results. Please keep me in
the loop, if you have updates on the driver.

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


Re: [U-Boot] [PATCH] arm: at91: gardena-smart-gateway-at91sam: Enable CONFIG_SYS_NAND_USE_FLASH_BBT

2019-09-13 Thread Alexander Dahl
Hei hei,

Am Dienstag, 27. August 2019, 08:14:50 CEST schrieb Stefan Roese:
> This patch enables the BBT in NAND on the AT91SAM based GARDENA smart
> Gateway. This is especially important, since the Linux driver also
> enables this option and uses the BBT table pages. Without setting this
> option, U-Boot will try to re-use these pages again (e.g. UBI).

Does the Linux kernel driver use those unconditionally or is that a kernel 
config option? Which one? (Search in 5.2 kernel config for BBT is 
inconclusive.)

Greets
Alex

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


Re: [U-Boot] Why do we need both MDIO and MII commands

2019-09-13 Thread Ramon Fried
On Thu, Sep 12, 2019 at 5:55 PM Tom Rini  wrote:
>
> On Wed, Sep 11, 2019 at 10:58:22PM +0300, Ramon Fried wrote:
>
> > Hi.
> > Marek raised this issue in IRC several weeks ago and I was wondering
> > the same. why do we support this two commands which accomplish
> > basically the same ?
> >
> > Can we ditch the mii comand and move the missing functionality to the
> > mdio command ?
>
> Patch that also include a compatibility option would be a good thing to
> see, yes.
I learned the history of both of the commands and and also read some
of the IEEE standard
regarding the mii command (clause 22) and mdio command (clause 45).
Basically, clause 45 is en extension which is not supported by old devices.
Addressing method is different, and I think it will be cumbersome to
create a single command
that handles both.
When I rethink it, I think we should keep both the commands.
Any thoughts ?
Thanks,
Ramon.
>
> --
> Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Ondřej Jirman
On Fri, Sep 13, 2019 at 01:19:18PM +0200, Heinrich Schuchardt wrote:
> On 9/13/19 1:48 AM, meg...@megous.com wrote:
> > From: Ondrej Jirman 
> > 
> > The reverted patch causes linking error with disabled CONFIG_NET:
> > 
> >cmd/built-in.o: In function `eth_env_get_enetaddr':
> >u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > `eth_parse_enetaddr'
> > 
> > Function setup_environment() in board/sunxi/board.c calls
> > eth_env_set_enetaddr() to setup stable mac address for ethernet interfaces.
> > 
> > This needs to be implemented and succeed even if net is disabled in u-boot,
> > as it ensures Linux will not generate random MAC addresses, and picks the
> > ones provided by u-boot via DT. See fdt_fixup_ethernet().
> > 
> > This feature is independent of the whole network stack and network drivers
> > in u-boot.
> > 
> > This revert fixes the linking error.
> > 
> > Signed-off-by: Ondrej Jirman 
> > ---
> >   cmd/nvedit.c   | 12 
> >   include/env_internal.h | 11 +++
> >   include/net.h  | 11 ---
> >   net/net.c  | 12 
> >   4 files changed, 23 insertions(+), 23 deletions(-)
> > 
> > diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> > index 1cb0bc1460..399f6d6ce1 100644
> > --- a/cmd/nvedit.c
> > +++ b/cmd/nvedit.c
> > @@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong 
> > default_val)
> > return value;
> >   }
> > 
> > +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> > +{
> > +   char *end;
> > +   int i;
> > +
> > +   for (i = 0; i < 6; ++i) {
> > +   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> > +   if (addr)
> > +   addr = (*end) ? end + 1 : end;
> > +   }
> > +}
> > +
> >   int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
> >   {
> > eth_parse_enetaddr(env_get(name), enetaddr);
> > diff --git a/include/env_internal.h b/include/env_internal.h
> > index b1ddcb5adf..27eb5bd1e7 100644
> > --- a/include/env_internal.h
> > +++ b/include/env_internal.h
> 
> Please, don't move the definition to env_internal.h but to env.h as
> board/renesas/sh7753evb/sh7753evb.c and others are using
> eth_parse_enetaddr().
> 
> env_internal.h explicitly states "It should not be included by board files".
> 
> Please, execute Travis CI tests to ensure you do not break any other board.

I haven't found any documentation in the tree or on the u-boot website on
how to do that.

regards,
o.

> Best regards
> 
> Heinrich
> 
> > @@ -273,6 +273,17 @@ struct env_driver {
> > 
> >   extern struct hsearch_data env_htab;
> > 
> > +/**
> > + * 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);
> > +
> >   #endif /* DO_DEPS_ONLY */
> > 
> >   #endif /* _ENV_INTERNAL_H_ */
> > diff --git a/include/net.h b/include/net.h
> > index 75a16e4c8f..e208cc43a0 100644
> > --- a/include/net.h
> > +++ b/include/net.h
> > @@ -875,15 +875,4 @@ int update_tftp(ulong addr, char *interface, char 
> > *devstring);
> > 
> >   /**/
> > 
> > -/**
> > - * 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);
> > -
> >   #endif /* __NET_H__ */
> > diff --git a/net/net.c b/net/net.c
> > index ded86e7456..4d2b7ead3b 100644
> > --- a/net/net.c
> > +++ b/net/net.c
> > @@ -1628,15 +1628,3 @@ ushort env_get_vlan(char *var)
> >   {
> > return string_to_vlan(env_get(var));
> >   }
> > -
> > -void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
> > -{
> > -   char *end;
> > -   int i;
> > -
> > -   for (i = 0; i < 6; ++i) {
> > -   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
> > -   if (addr)
> > -   addr = (*end) ? end + 1 : end;
> > -   }
> > -}
> > 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [EXT] Re: [PATCH 1/6] spi: fsl_qspi: Fix DDR mode setting for latest iMX platforms

2019-09-13 Thread Ashish Kumar


> -Original Message-
> From: Stefan Roese 
> Sent: Thursday, September 12, 2019 6:06 PM
> To: Ashish Kumar ; Schrempf Frieder
> ; Ye Li ;
> ja...@amarulasolutions.com
> Cc: Fabio Estevam ; u-boot@lists.denx.de; dl-
> uboot-imx 
> Subject: Re: [U-Boot] [EXT] Re: [PATCH 1/6] spi: fsl_qspi: Fix DDR mode
> setting for latest iMX platforms
> 
> Caution: EXT Email
> 
> Hi Ashish,
> 
> On 12.09.19 07:03, Ashish Kumar wrote:
> 
> 
> 
> >>> Please suggest way forward. How to correct this issue?
> >
> > The first thigh would be to make sure the Linux driver works for
> > all platforms and then do the porting to U-Boot. I will be out of
> > office for
> > 10 days. After that I can try to work on this, but I need support
> > and testing for other platforms. I only have i.MX6UL/ULL.
> 
>  Hi Frieder,
> 
>  I have found some break though after porting to 2019.10 and few
> >> modification in driver code, I will update in a weeks' time. Please
> >> do not invest time on this.
>  If I need some help I will update.
> >>>
> >>> Thanks for your work. Do you already have some news? Can you share
> >>> your results?
> >>
> >> I'm most likely currently running in similar issues on tests with the
> >> i.MX6ULL EVK. QSPI does not work reliably. So before digging deeper
> >> into the QSPI driver, I wanted to check on the status of any updates
> >> in the driver. Is there anything available that I could use for testing
> already?
> > Hi Stefan,  Frieder,
> >
> > The spi-mem version is still under debug, I could make it working for
> > ls1088rdb, ls1046rdb, but it is failing for ls1012ardb and ls2088ardb
> > and untested for i.mx and other Layerscape silicon/boards . It is
> > derived from work done by Frieder earlier.
> > This version can be found here:
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > ub.com%2Ferashish007%2Fu-boot-spi-mem%2Ftree%2Fspi-mem-
> portdata=0
> >
> 2%7C01%7Cashish.kumar%40nxp.com%7C2697e09d52b94dc737ce08d737cd3
> 34c%7C6
> >
> 86ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637039226779815773
> ;sdata
> >
> =NqcR9VBELvvXhcCay850Fj%2BEZuOjkJzf15IXdBR4l2A%3Dreserved=0
> 
> Many thanks. I did some tests with this version and it seems to work fine in
> general on the i.MX6ULL EVK. My first tests show that reading and writing
> has no issues. So this is very promising. The only thing I noticed is, that 
> when
> using SPI for environment via CONFIG_ENV_IS_IN_SPI_FLASH, the board
> hangs upon bootup while trying to read the env. Since you already added
> some debug print's to the env code, I suspect that you also did run into this
> problem.
> 
> I'll try to help with this driver version. At least I can debug this env 
> issue and
> can always do some test on my mx6ull platform for you once you have any
> updates here. Just let me know.
Hi Stefan, 

Yes, I was also debugging the same, what confuses me is that it works on
Ls1046, ls1088, but fails  on ls2088, ls1012.

Regards
Ashish 

> 
> > There is completely working version of fsl_qspi.c based on old xfer
> > method, which was not accepted  in upstream, considering it is
> > recommended to migrate to spi-mem frame. This version is located here:
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > ub.com%2Ferashish007%2Fu-boot-spi-
> mem%2Ftree%2Fxfer_wrkingdata=02
> >
> %7C01%7Cashish.kumar%40nxp.com%7C2697e09d52b94dc737ce08d737cd33
> 4c%7C68
> >
> 6ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637039226779815773
> sdata=
> > qpksEv36Zjb6jXKsnWN5iVtAoG9UEQFMIi4uu1OgiJ8%3Dreserved=0
> 
> This one does not work for me on the i.MX6ULL EVK. "sf read" command
> returns almost immediately and the data is not read as it seems. I did not dig
> into this deeper though.
> 
> Thanks,
> Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] Dockerfile: build GRUB UEFI target for RISC-V 64bit

2019-09-13 Thread Heinrich Schuchardt

On 9/12/19 11:17 PM, Tom Rini wrote:

On Thu, Sep 12, 2019 at 10:31:39PM +0200, Heinrich Schuchardt wrote:

On 8/4/19 3:31 PM, Bin Meng wrote:

On Sun, Aug 4, 2019 at 8:10 PM Heinrich Schuchardt  wrote:


Build GRUB UEFI target grubriscv64.efi. It is needed for running
test_efi_grub_net().

Signed-off-by: Heinrich Schuchardt 
---
This patch applies to
https://gitlab.denx.de/u-boot/gitlab-ci-runner
---
  Dockerfile | 14 ++
  1 file changed, 14 insertions(+)



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


Hello Tom,

the patch did not yet make it into

https://gitlab.denx.de/u-boot/gitlab-ci-runner.git

Anything I should do?


Sorry, I assume this is blocking being able to then enable tests on the
platform?  If so, I'll go spin things around shortly and in the future
feel free to poke me if I don't turn them around in a day or two.



Once we build grubriscv64.efi we can use it in the UEFI unit test
test_efi_grub_net().

It is not high priority as Linux is still missing an EFI stub for RISC.
I just wanted to avoid the patch sinking into oblivion.

Best regards

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


Re: [U-Boot] [PATCH] Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

2019-09-13 Thread Heinrich Schuchardt

On 9/13/19 1:48 AM, meg...@megous.com wrote:

From: Ondrej Jirman 

The reverted patch causes linking error with disabled CONFIG_NET:

   cmd/built-in.o: In function `eth_env_get_enetaddr':
   u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to `eth_parse_enetaddr'

Function setup_environment() in board/sunxi/board.c calls
eth_env_set_enetaddr() to setup stable mac address for ethernet interfaces.

This needs to be implemented and succeed even if net is disabled in u-boot,
as it ensures Linux will not generate random MAC addresses, and picks the
ones provided by u-boot via DT. See fdt_fixup_ethernet().

This feature is independent of the whole network stack and network drivers
in u-boot.

This revert fixes the linking error.

Signed-off-by: Ondrej Jirman 
---
  cmd/nvedit.c   | 12 
  include/env_internal.h | 11 +++
  include/net.h  | 11 ---
  net/net.c  | 12 
  4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 1cb0bc1460..399f6d6ce1 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong default_val)
return value;
  }

+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
+{
+   char *end;
+   int i;
+
+   for (i = 0; i < 6; ++i) {
+   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
+   if (addr)
+   addr = (*end) ? end + 1 : end;
+   }
+}
+
  int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
  {
eth_parse_enetaddr(env_get(name), enetaddr);
diff --git a/include/env_internal.h b/include/env_internal.h
index b1ddcb5adf..27eb5bd1e7 100644
--- a/include/env_internal.h
+++ b/include/env_internal.h


Please, don't move the definition to env_internal.h but to env.h as
board/renesas/sh7753evb/sh7753evb.c and others are using
eth_parse_enetaddr().

env_internal.h explicitly states "It should not be included by board files".

Please, execute Travis CI tests to ensure you do not break any other board.

Best regards

Heinrich


@@ -273,6 +273,17 @@ struct env_driver {

  extern struct hsearch_data env_htab;

+/**
+ * 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);
+
  #endif /* DO_DEPS_ONLY */

  #endif /* _ENV_INTERNAL_H_ */
diff --git a/include/net.h b/include/net.h
index 75a16e4c8f..e208cc43a0 100644
--- a/include/net.h
+++ b/include/net.h
@@ -875,15 +875,4 @@ int update_tftp(ulong addr, char *interface, char 
*devstring);

  /**/

-/**
- * 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);
-
  #endif /* __NET_H__ */
diff --git a/net/net.c b/net/net.c
index ded86e7456..4d2b7ead3b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1628,15 +1628,3 @@ ushort env_get_vlan(char *var)
  {
return string_to_vlan(env_get(var));
  }
-
-void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
-{
-   char *end;
-   int i;
-
-   for (i = 0; i < 6; ++i) {
-   enetaddr[i] = addr ? simple_strtoul(addr, , 16) : 0;
-   if (addr)
-   addr = (*end) ? end + 1 : end;
-   }
-}



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


Re: [U-Boot] OMAP watchdog timer reset on BBB

2019-09-13 Thread Stefan Roese

Hi Sam,

On 12.09.19 18:33, Sam Protsenko wrote:

Hi Stefan,

On Thu, Sep 12, 2019 at 5:38 PM Stefan Roese  wrote:


Hi Sam,

On 12.09.19 15:45, Sam Protsenko wrote:

Hi Suniel,

After transition to DM WDT, watchdog timer on BeagleBone Black resets
the board after 1 minute or so. I'm using this defconfig: [1]. After
disabling CONFIG_WDT and CONFIG_WATCHDOG options the board doesn't
reset. I guess it might be happening on other boards using
CONFIG_WDT_OMAP3 as well. The issue can be reproduced by stopping in
U-Boot shell (=>) and waiting for 1 minute.

Do you know by chance why it might be happening, or maybe some fix
already exists?

Thanks!

[1] https://pastebin.ubuntu.com/p/Zz5bY6cYXS/


So you have enabled the watchdog and should see something like this
upon bootup:

WDT:   Started without servicing (60s timeout)

Is this correct? Then you need to enable the U-Boot internal WDT
servicing by enabling CONFIG_WATCHDOG as well, as this will
result in the internal U-Boot servicing of the watchdog. Then
you should see this upon bootup and no reset will appear in
U-Boot:

WDT:   Started with servicing (60s timeout)



I'm seeing this ("with servicing") line, and CONFIG_WATCHDOG is
already enabled in am335x_evm_defconfig. So I think it's an issue,
which *probably* appeared when watchdog drivers were converted to
Driver Model (this defconfig is using CONFIG_WDT + CONFIG_WDT_OMAP3
options). Any clues what can be wrong?


If the board has CONFIG_WATCHDOG enabled, then it should call the
reset function periodically (omap3_wdt_reset). Please check if
this function get called - I assume pretty often.

If it gets called and a WDT reset still does occur after the
timeout, then the reset function is incorrect and does not reset
the watchdog timer correctly.

HTH.

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


[U-Boot] [PATCH] mkimage: Set correct FDT type and ramdisk architecture in FIT auto mode

2019-09-13 Thread Michal Sojka
From: Michal Sojka 

When running the following command

mkimage -f auto -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 \
-d zImage -b zynq-microzed.dtb -i initramfs.cpio image.ub

the type of fdt subimage is the same as of the main kernel image and
the architecture of the initramfs image is not set. Such an image is
refused by U-Boot when booting. This commits sets the mentioned
attributes, allowing to use the "-f auto" mode in this case instead of
writing full .its file.

Following is the diff of mkimage output without and with this commit:

 FIT description: Kernel Image image with one or more FDT blobs
 Created: Thu Sep 12 23:23:16 2019
  Image 0 (kernel-1)
   Description:
   Created:  Thu Sep 12 23:23:16 2019
   Type: Kernel Image
   Compression:  uncompressed
   Data Size:4192744 Bytes = 4094.48 KiB = 4.00 MiB
   Architecture: ARM
   OS:   Linux
   Load Address: 0x8000
   Entry Point:  0x8000
  Image 1 (fdt-1)
   Description:  zynq-microzed
   Created:  Thu Sep 12 23:23:16 2019
-  Type: Kernel Image
+  Type: Flat Device Tree
   Compression:  uncompressed
   Data Size:9398 Bytes = 9.18 KiB = 0.01 MiB
   Architecture: ARM
-  OS:   Unknown OS
-  Load Address: unavailable
-  Entry Point:  unavailable
  Image 2 (ramdisk-1)
   Description:  unavailable
   Created:  Thu Sep 12 23:23:16 2019
   Type: RAMDisk Image
   Compression:  Unknown Compression
   Data Size:760672 Bytes = 742.84 KiB = 0.73 MiB
-  Architecture: Unknown Architecture
+  Architecture: ARM
   OS:   Linux
   Load Address: unavailable
   Entry Point:  unavailable
  Default Configuration: 'conf-1'
  Configuration 0 (conf-1)
   Description:  zynq-microzed
   Kernel:   kernel-1
   Init Ramdisk: ramdisk-1
   FDT:  fdt-1
   Loadables:kernel-1

Signed-off-by: Michal Sojka 
---
 tools/fit_image.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 5aca634b5e..0201cc44d8 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -229,6 +229,7 @@ static int fit_write_images(struct image_tool_params 
*params, char *fdt)
for (cont = params->content_head; cont; cont = cont->next) {
if (cont->type != IH_TYPE_FLATDT)
continue;
+   typename = genimg_get_type_short_name(cont->type);
snprintf(str, sizeof(str), "%s-%d", FIT_FDT_PROP, ++upto);
fdt_begin_node(fdt, str);
 
@@ -253,6 +254,8 @@ static int fit_write_images(struct image_tool_params 
*params, char *fdt)
fdt_property_string(fdt, FIT_TYPE_PROP, FIT_RAMDISK_PROP);
fdt_property_string(fdt, FIT_OS_PROP,
genimg_get_os_short_name(params->os));
+   fdt_property_string(fdt, FIT_ARCH_PROP,
+   genimg_get_arch_short_name(params->arch));
 
ret = fdt_property_file(params, fdt, FIT_DATA_PROP,
params->fit_ramdisk);
-- 
2.23.0

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


Re: [U-Boot] rk3288: HDMI out causing boot hang

2019-09-13 Thread Tony McKahan
Hello Jagan,

On Thu, Sep 12, 2019 at 10:50 PM Jagan Teki  wrote:
>
> Hi All,
>
> Did anyone tried HDMI out on rk3288? Enabling HDMI out causing boot
> hang, during stdout initialization from console.c
>
> Enabled below configs and stdin/out/err environment to probe the
> DM_VIDEO, seems like the console initialization hangs during stdout
> initialization.
>
> Log:
> Model: Tinker-RK3288
> DRAM:  2 GiB
> MMC:   dwmmc@ff0c: 1
> Loading Environment from MMC... OK
> 1. console_init_r
> 2. console_init_r
> 2.1 console_init_r
> rk3288_vop_probe
> vop@ff93: probing regulator 'vcc18_lcd'
> vop@ff93: probing regulator 'VCC18_LCD'
> vop@ff93: probing regulator 'vdd10_lcd_pwren_h'
> vop@ff93: probing regulator 'vdd10_lcd'
> vop@ff93: probing regulator 'VDD10_LCD'
> vop@ff93: probing regulator 'vcc33_lcd'
> rk_display_init(vop@ff93, 2139095040, endpoint@0)
> vop_id=0
> remote vop_id=0
> rk_display_init(vop@ff93): no UCLASS_DISPLAY for remote-endpoint
> Device failed: ret=-22
> rk_display_init(vop@ff93, 2139095040, endpoint@1)
> vop_id=1
> remote vop_id=0
> Found device 'hdmi@ff98', disp_uc_priv=7cf71710
> rk3288_hdmi_probe
> hdmi@ff98: probing regulator 'vcc50_hdmi'
> rk_hdmi_probe: 1
> rk_hdmi_probe: 2
> rk_hdmi_probe: done!
> fb=7f80, size=2560 1440
> rk3288_vop_probe done!
>
> Changes:
> +CONFIG_DM_VIDEO=y
> +CONFIG_DISPLAY=y
> +CONFIG_VIDEO_ROCKCHIP=y
> +CONFIG_DISPLAY_ROCKCHIP_HDMI=y
> +CONFIG_CONSOLE_SCROLL_LINES=10
>
> +#define ROCKCHIP_DEVICE_SETTINGS \
> +   "stdout=serial,vidconsole\0" \
> +   "stderr=serial,vidconsole\0"
>
> Any inputs?

I saw this some time ago with Armbian with ASUS Tinker Board, but
thought I had somehow misconfigured it, and simply disabled it.  I can
confirm it hangs for me though.

>
> Jagan.
>
> ___
> Linux-rockchip mailing list
> linux-rockc...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 10/15] board: Add STM32F769 SoC, discovery board support

2019-09-13 Thread Yannick Fertré
Signed-off-by: Yannick Fertré 
---
 configs/stm32f769-disco_defconfig | 63 +++
 1 file changed, 63 insertions(+)
 create mode 100644 configs/stm32f769-disco_defconfig

diff --git a/configs/stm32f769-disco_defconfig 
b/configs/stm32f769-disco_defconfig
new file mode 100644
index 000..887e2d5
--- /dev/null
+++ b/configs/stm32f769-disco_defconfig
@@ -0,0 +1,63 @@
+CONFIG_ARM=y
+CONFIG_STM32=y
+CONFIG_SYS_TEXT_BASE=0x08008000
+CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_STM32F7=y
+CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 
ignore_loglevel"
+# CONFIG_USE_BOOTCOMMAND is not set
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_SPL_TEXT_BASE=0x800
+CONFIG_SYS_PROMPT="U-Boot > "
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="stm32f769-disco"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_DM_MMC=y
+# CONFIG_SPL_DM_MMC is not set
+CONFIG_ARM_PL180_MMCI=y
+CONFIG_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_STM32_QSPI=y
+CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=480
+CONFIG_VIDEO_STM32_MAX_YRES=800
+CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_EFI_LOADER is not set
-- 
2.7.4

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


[U-Boot] [PATCH v4 14/15] stm32mp1: configs: update video

2019-09-13 Thread Yannick Fertré
Update video configs to support bitmap 16bpp, 24bpp,
32bpp & RLE8.

Signed-off-by: Yannick Fertré 
---
 include/configs/stm32mp1.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
index 92660fe..988992b 100644
--- a/include/configs/stm32mp1.h
+++ b/include/configs/stm32mp1.h
@@ -83,6 +83,13 @@
 #define CONFIG_SYS_MTDPARTS_RUNTIME
 #endif
 
+#ifdef CONFIG_DM_VIDEO
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_BMP_16BPP
+#define CONFIG_BMP_24BPP
+#define CONFIG_BMP_32BPP
+#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 v4 12/15] ARM: dts: stm32mp1: add dsi host for stm32mp157c-ev1 board

2019-09-13 Thread Yannick Fertré
The new class dsi host allows the management of the bridge DPI to DSI.
This bridge is embedded in the chipset mp1 (come from synopsys company).

Signed-off-by: Yannick Fertré 
---
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
index ec60486..af5945d 100644
--- a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
@@ -14,6 +14,11 @@
spi0 = 
usb0 = _hs;
};
+
+   dsi_host: dsi_host {
+   compatible = "synopsys,dw-mipi-dsi";
+   status = "okay";
+   };
 };
 
  {
-- 
2.7.4

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


[U-Boot] [PATCH v4 08/15] video: add support of panel OTM8009A

2019-09-13 Thread Yannick Fertré
Support for Orise Tech otm8009a 480p dsi 2dl video mode panel.

Signed-off-by: Yannick Fertré 
---
 drivers/video/Kconfig  |   9 +
 drivers/video/Makefile |   1 +
 drivers/video/orisetech_otm8009a.c | 379 +
 3 files changed, 389 insertions(+)
 create mode 100644 drivers/video/orisetech_otm8009a.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index a55cdc6..0bcadd9 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -328,6 +328,15 @@ config VIDEO_LCD_ANX9804
from a parallel LCD interface and translate it on the fy into a DP
interface for driving eDP TFT displays. It uses I2C for configuration.
 
+config VIDEO_LCD_ORISETECH_OTM8009A
+   bool "OTM8009A DSI LCD panel support"
+   depends on DM_VIDEO
+   select VIDEO_MIPI_DSI
+   default n
+   help
+   Say Y here if you want to enable support for Orise Technology
+   otm8009a 480x800 dsi 2dl panel.
+
 config VIDEO_LCD_SSD2828
bool "SSD2828 bridge chip"
default n
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 58210ec..f8785cb 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_IPUV3) += imx/
 obj-$(CONFIG_VIDEO_IVYBRIDGE_IGD) += ivybridge_igd.o
 obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
+obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-${CONFIG_VIDEO_MESON} += meson/
diff --git a/drivers/video/orisetech_otm8009a.c 
b/drivers/video/orisetech_otm8009a.c
new file mode 100644
index 000..89d9cfd
--- /dev/null
+++ b/drivers/video/orisetech_otm8009a.c
@@ -0,0 +1,379 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre  for STMicroelectronics.
+ *Philippe Cornu  for STMicroelectronics.
+ *
+ * This otm8009a panel driver is inspired from the Linux Kernel driver
+ * drivers/gpu/drm/panel/panel-orisetech-otm8009a.c.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define OTM8009A_BACKLIGHT_DEFAULT 240
+#define OTM8009A_BACKLIGHT_MAX 255
+
+/* Manufacturer Command Set */
+#define MCS_ADRSFT 0x  /* Address Shift Function */
+#define MCS_PANSET 0xB3A6  /* Panel Type Setting */
+#define MCS_SD_CTRL0xC0A2  /* Source Driver Timing Setting */
+#define MCS_P_DRV_M0xC0B4  /* Panel Driving Mode */
+#define MCS_OSC_ADJ0xC181  /* Oscillator Adjustment for Idle/Normal mode */
+#define MCS_RGB_VID_SET0xC1A1  /* RGB Video Mode Setting */
+#define MCS_SD_PCH_CTRL0xC480  /* Source Driver Precharge Control */
+#define MCS_NO_DOC10xC48A  /* Command not documented */
+#define MCS_PWR_CTRL1  0xC580  /* Power Control Setting 1 */
+#define MCS_PWR_CTRL2  0xC590  /* Power Control Setting 2 for Normal Mode */
+#define MCS_PWR_CTRL4  0xC5B0  /* Power Control Setting 4 for DC Voltage */
+#define MCS_PANCTRLSET10xCB80  /* Panel Control Setting 1 */
+#define MCS_PANCTRLSET20xCB90  /* Panel Control Setting 2 */
+#define MCS_PANCTRLSET30xCBA0  /* Panel Control Setting 3 */
+#define MCS_PANCTRLSET40xCBB0  /* Panel Control Setting 4 */
+#define MCS_PANCTRLSET50xCBC0  /* Panel Control Setting 5 */
+#define MCS_PANCTRLSET60xCBD0  /* Panel Control Setting 6 */
+#define MCS_PANCTRLSET70xCBE0  /* Panel Control Setting 7 */
+#define MCS_PANCTRLSET80xCBF0  /* Panel Control Setting 8 */
+#define MCS_PANU2D10xCC80  /* Panel U2D Setting 1 */
+#define MCS_PANU2D20xCC90  /* Panel U2D Setting 2 */
+#define MCS_PANU2D30xCCA0  /* Panel U2D Setting 3 */
+#define MCS_PAND2U10xCCB0  /* Panel D2U Setting 1 */
+#define MCS_PAND2U20xCCC0  /* Panel D2U Setting 2 */
+#define MCS_PAND2U30xCCD0  /* Panel D2U Setting 3 */
+#define MCS_GOAVST 0xCE80  /* GOA VST Setting */
+#define MCS_GOACLKA1   0xCEA0  /* GOA CLKA1 Setting */
+#define MCS_GOACLKA3   0xCEB0  /* GOA CLKA3 Setting */
+#define MCS_GOAECLK0xCFC0  /* GOA ECLK Setting */
+#define MCS_NO_DOC20xCFD0  /* Command not documented */
+#define MCS_GVDDSET0xD800  /* GVDD/NGVDD */
+#define MCS_VCOMDC 0xD900  /* VCOM Voltage Setting */
+#define MCS_GMCT2_2P   0xE100  /* Gamma Correction 2.2+ Setting */
+#define MCS_GMCT2_2N   0xE200  /* Gamma Correction 2.2- Setting */
+#define MCS_NO_DOC30xF5B6  /* Command not documented */
+#define MCS_CMD2_ENA1  0xFF00  /* Enable Access Command2 "CMD2" */
+#define MCS_CMD2_ENA2  0xFF80  /* Enable Access Orise Command2 */
+
+struct otm8009a_panel_priv {
+   struct udevice *reg;
+   struct gpio_desc reset;
+   unsigned int lanes;
+   enum mipi_dsi_pixel_format format;
+   unsigned long mode_flags;
+};
+
+static const 

[U-Boot] [PATCH v4 11/15] ARM: dts: stm32f769: add display for STM32F769 disco board

2019-09-13 Thread Yannick Fertré
Enable the display controller, mipi dsi bridge & panel.
Set panel display timings.

Signed-off-by: Yannick Fertré 
---
 arch/arm/dts/stm32f769-disco-u-boot.dtsi | 62 
 1 file changed, 62 insertions(+)

diff --git a/arch/arm/dts/stm32f769-disco-u-boot.dtsi 
b/arch/arm/dts/stm32f769-disco-u-boot.dtsi
index 209a82c..c1d7d6b 100644
--- a/arch/arm/dts/stm32f769-disco-u-boot.dtsi
+++ b/arch/arm/dts/stm32f769-disco-u-boot.dtsi
@@ -28,10 +28,72 @@
button-gpio = < 0 0>;
};
 
+   dsi_host: dsi_host {
+   compatible = "synopsys,dw-mipi-dsi";
+   status = "okay";
+   };
+
led1 {
compatible = "st,led1";
led-gpio = < 5 0>;
};
+
+   panel: panel {
+   compatible = "orisetech,otm8009a";
+   reset-gpios = < 15 1>;
+   status = "okay";
+
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+
+   soc {
+   dsi: dsi@40016c00 {
+   compatible = "st,stm32-dsi";
+   reg = <0x40016C00 0x800>;
+   resets = < STM32F7_APB2_RESET(DSI)>;
+   clocks =  < 0 STM32F7_APB2_CLOCK(DSI)>,
+ < 0 STM32F7_APB2_CLOCK(LTDC)>,
+ <_hse>;
+   clock-names = "pclk", "px_clk", "ref";
+   u-boot,dm-pre-reloc;
+   status = "okay";
+
+   ports {
+   port@0 {
+   dsi_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   port@1 {
+   dsi_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+   };
+
+   ltdc: display-controller@40016800 {
+   compatible = "st,stm32-ltdc";
+   reg = <0x40016800 0x200>;
+   resets = < STM32F7_APB2_RESET(LTDC)>;
+   clocks = < 0 STM32F7_APB2_CLOCK(LTDC)>;
+
+   status = "okay";
+   u-boot,dm-pre-reloc;
+
+   ports {
+   port@0 {
+   dp_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
+   };
 };
 
  {
-- 
2.7.4

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


[U-Boot] [PATCH v4 15/15] stm32mp1: configs: add display devices

2019-09-13 Thread Yannick Fertré
Add support of panels otm8009A, RM68200 & DSI controller.
Limit resolution to 1280x800.

Signed-off-by: Yannick Fertré 
---
 configs/stm32mp15_basic_defconfig   | 6 ++
 configs/stm32mp15_optee_defconfig   | 6 ++
 configs/stm32mp15_trusted_defconfig | 6 ++
 3 files changed, 18 insertions(+)

diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index 09785b5..6d1e208 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -124,4 +124,10 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=800
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/stm32mp15_optee_defconfig 
b/configs/stm32mp15_optee_defconfig
index 177cbc7..491174f 100644
--- a/configs/stm32mp15_optee_defconfig
+++ b/configs/stm32mp15_optee_defconfig
@@ -109,4 +109,10 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=800
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/stm32mp15_trusted_defconfig 
b/configs/stm32mp15_trusted_defconfig
index 71ad115..a8a7eec 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -108,4 +108,10 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=800
 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 v4 13/15] ARM: dts: stm32mp1: add dsi host for stm32mp157c-dk2 board

2019-09-13 Thread Yannick Fertré
The new class dsi host allows the management of the bridge DPI to DSI.
This bridge is embedded in the chipset mp1 (come from synopsys company).

Signed-off-by: Yannick Fertré 
---
 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
index 18ac1e3..cd9947f 100644
--- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
@@ -5,6 +5,13 @@
 
 #include "stm32mp157a-dk1-u-boot.dtsi"
 
+/ {
+   dsi_host: dsi_host {
+   compatible = "synopsys,dw-mipi-dsi";
+   status = "okay";
+   };
+};
+
  {
hdmi-transmitter@39 {
reset-gpios = < 10 GPIO_ACTIVE_LOW>;
-- 
2.7.4

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


[U-Boot] [PATCH v4 02/15] video: stm32: stm32_ltdc: add bridge to display controller

2019-09-13 Thread Yannick Fertré
Manage a bridge insert between the display controller & a panel.

Signed-off-by: Yannick Fertré 
---
 drivers/video/stm32/stm32_ltdc.c | 143 +++
 1 file changed, 83 insertions(+), 60 deletions(-)

diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c
index dc6c889..59ff692 100644
--- a/drivers/video/stm32/stm32_ltdc.c
+++ b/drivers/video/stm32/stm32_ltdc.c
@@ -7,19 +7,18 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct stm32_ltdc_priv {
void __iomem *regs;
-   struct display_timing timing;
enum video_log2_bpp l2bpp;
u32 bg_col_argb;
u32 crop_x, crop_y, crop_w, crop_h;
@@ -174,8 +173,8 @@ static u32 stm32_ltdc_get_pixel_format(enum video_log2_bpp 
l2bpp)
case VIDEO_BPP2:
case VIDEO_BPP4:
default:
-   debug("%s: warning %dbpp not supported yet, %dbpp instead\n",
- __func__, VNBITS(l2bpp), VNBITS(VIDEO_BPP16));
+   pr_warn("%s: warning %dbpp not supported yet, %dbpp instead\n",
+   __func__, VNBITS(l2bpp), VNBITS(VIDEO_BPP16));
pf = PF_RGB565;
break;
}
@@ -209,23 +208,23 @@ static void stm32_ltdc_enable(struct stm32_ltdc_priv 
*priv)
setbits_le32(priv->regs + LTDC_GCR, GCR_LTDCEN);
 }
 
-static void stm32_ltdc_set_mode(struct stm32_ltdc_priv *priv)
+static void stm32_ltdc_set_mode(struct stm32_ltdc_priv *priv,
+   struct display_timing *timings)
 {
void __iomem *regs = priv->regs;
-   struct display_timing *timing = >timing;
u32 hsync, vsync, acc_hbp, acc_vbp, acc_act_w, acc_act_h;
u32 total_w, total_h;
u32 val;
 
/* Convert video timings to ltdc timings */
-   hsync = timing->hsync_len.typ - 1;
-   vsync = timing->vsync_len.typ - 1;
-   acc_hbp = hsync + timing->hback_porch.typ;
-   acc_vbp = vsync + timing->vback_porch.typ;
-   acc_act_w = acc_hbp + timing->hactive.typ;
-   acc_act_h = acc_vbp + timing->vactive.typ;
-   total_w = acc_act_w + timing->hfront_porch.typ;
-   total_h = acc_act_h + timing->vfront_porch.typ;
+   hsync = timings->hsync_len.typ - 1;
+   vsync = timings->vsync_len.typ - 1;
+   acc_hbp = hsync + timings->hback_porch.typ;
+   acc_vbp = vsync + timings->vback_porch.typ;
+   acc_act_w = acc_hbp + timings->hactive.typ;
+   acc_act_h = acc_vbp + timings->vactive.typ;
+   total_w = acc_act_w + timings->hfront_porch.typ;
+   total_h = acc_act_h + timings->vfront_porch.typ;
 
/* Synchronization sizes */
val = (hsync << 16) | vsync;
@@ -247,14 +246,14 @@ static void stm32_ltdc_set_mode(struct stm32_ltdc_priv 
*priv)
 
/* Signal polarities */
val = 0;
-   debug("%s: timing->flags 0x%08x\n", __func__, timing->flags);
-   if (timing->flags & DISPLAY_FLAGS_HSYNC_HIGH)
+   debug("%s: timing->flags 0x%08x\n", __func__, timings->flags);
+   if (timings->flags & DISPLAY_FLAGS_HSYNC_HIGH)
val |= GCR_HSPOL;
-   if (timing->flags & DISPLAY_FLAGS_VSYNC_HIGH)
+   if (timings->flags & DISPLAY_FLAGS_VSYNC_HIGH)
val |= GCR_VSPOL;
-   if (timing->flags & DISPLAY_FLAGS_DE_HIGH)
+   if (timings->flags & DISPLAY_FLAGS_DE_HIGH)
val |= GCR_DEPOL;
-   if (timing->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+   if (timings->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
val |= GCR_PCPOL;
clrsetbits_le32(regs + LTDC_GCR,
GCR_HSPOL | GCR_VSPOL | GCR_DEPOL | GCR_PCPOL, val);
@@ -330,96 +329,120 @@ static int stm32_ltdc_probe(struct udevice *dev)
struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
struct stm32_ltdc_priv *priv = dev_get_priv(dev);
-   struct udevice *panel;
+   struct udevice *bridge = NULL;
+   struct udevice *panel = NULL;
+   struct display_timing timings;
struct clk pclk;
struct reset_ctl rst;
-   int rate, ret;
+   int ret;
 
priv->regs = (void *)dev_read_addr(dev);
if ((fdt_addr_t)priv->regs == FDT_ADDR_T_NONE) {
-   debug("%s: ltdc dt register address error\n", __func__);
+   dev_err(dev, "ltdc dt register address error\n");
return -EINVAL;
}
 
ret = clk_get_by_index(dev, 0, );
if (ret) {
-   debug("%s: peripheral clock get error %d\n", __func__, ret);
+   dev_err(dev, "peripheral clock get error %d\n", ret);
return ret;
}
 
ret = clk_enable();
if (ret) {
-   debug("%s: peripheral clock enable error %d\n",
- __func__, ret);
+   dev_err(dev, "peripheral 

[U-Boot] [PATCH v4 09/15] video: add support of panel RM68200

2019-09-13 Thread Yannick Fertré
Support for Raydium RM68200 720p dsi 2dl video mode panel.
This rm68200 panel driver is based on the Linux Kernel driver from
drivers/gpu/drm/panel/panel-raydium-rm68200.c.

Signed-off-by: Yannick Fertré 
---
 drivers/video/Kconfig   |   9 ++
 drivers/video/Makefile  |   1 +
 drivers/video/raydium-rm68200.c | 351 
 3 files changed, 361 insertions(+)
 create mode 100644 drivers/video/raydium-rm68200.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0bcadd9..aafb3b4 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -337,6 +337,15 @@ config VIDEO_LCD_ORISETECH_OTM8009A
Say Y here if you want to enable support for Orise Technology
otm8009a 480x800 dsi 2dl panel.
 
+config VIDEO_LCD_RAYDIUM_RM68200
+   bool "RM68200 DSI LCD panel support"
+   depends on DM_VIDEO
+   select VIDEO_MIPI_DSI
+   default n
+   help
+   Say Y here if you want to enable support for Raydium RM68200
+   720x1280 DSI video mode panel.
+
 config VIDEO_LCD_SSD2828
bool "SSD2828 bridge chip"
default n
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index f8785cb..eea59e4 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_VIDEO_IVYBRIDGE_IGD) += ivybridge_igd.o
 obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
 obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
+obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-${CONFIG_VIDEO_MESON} += meson/
diff --git a/drivers/video/raydium-rm68200.c b/drivers/video/raydium-rm68200.c
new file mode 100644
index 000..91555e2
--- /dev/null
+++ b/drivers/video/raydium-rm68200.c
@@ -0,0 +1,351 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre  for STMicroelectronics.
+ *Philippe Cornu  for STMicroelectronics.
+ *
+ * This rm68200 panel driver is inspired from the Linux Kernel driver
+ * drivers/gpu/drm/panel/panel-raydium-rm68200.c.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*** Manufacturer Command Set ***/
+#define MCS_CMD_MODE_SW0xFE /* CMD Mode Switch */
+#define MCS_CMD1_UCS   0x00 /* User Command Set (UCS = CMD1) */
+#define MCS_CMD2_P00x01 /* Manufacture Command Set Page0 (CMD2 P0) */
+#define MCS_CMD2_P10x02 /* Manufacture Command Set Page1 (CMD2 P1) */
+#define MCS_CMD2_P20x03 /* Manufacture Command Set Page2 (CMD2 P2) */
+#define MCS_CMD2_P30x04 /* Manufacture Command Set Page3 (CMD2 P3) */
+
+/* CMD2 P0 commands (Display Options and Power) */
+#define MCS_STBCTR 0x12 /* TE1 Output Setting Zig-Zag Connection */
+#define MCS_SGOPCTR0x16 /* Source Bias Current */
+#define MCS_SDCTR  0x1A /* Source Output Delay Time */
+#define MCS_INVCTR 0x1B /* Inversion Type */
+#define MCS_EXT_PWR_IC 0x24 /* External PWR IC Control */
+#define MCS_SETAVDD0x27 /* PFM Control for AVDD Output */
+#define MCS_SETAVEE0x29 /* PFM Control for AVEE Output */
+#define MCS_BT2CTR 0x2B /* DDVDL Charge Pump Control */
+#define MCS_BT3CTR 0x2F /* VGH Charge Pump Control */
+#define MCS_BT4CTR 0x34 /* VGL Charge Pump Control */
+#define MCS_VCMCTR 0x46 /* VCOM Output Level Control */
+#define MCS_SETVGN 0x52 /* VG M/S N Control */
+#define MCS_SETVGP 0x54 /* VG M/S P Control */
+#define MCS_SW_CTRL0x5F /* Interface Control for PFM and MIPI */
+
+/* CMD2 P2 commands (GOA Timing Control) - no description in datasheet */
+#define GOA_VSTV1  0x00
+#define GOA_VSTV2  0x07
+#define GOA_VCLK1  0x0E
+#define GOA_VCLK2  0x17
+#define GOA_VCLK_OPT1  0x20
+#define GOA_BICLK1 0x2A
+#define GOA_BICLK2 0x37
+#define GOA_BICLK3 0x44
+#define GOA_BICLK4 0x4F
+#define GOA_BICLK_OPT1 0x5B
+#define GOA_BICLK_OPT2 0x60
+#define MCS_GOA_GPO1   0x6D
+#define MCS_GOA_GPO2   0x71
+#define MCS_GOA_EQ 0x74
+#define MCS_GOA_CLK_GALLON 0x7C
+#define MCS_GOA_FS_SEL00x7E
+#define MCS_GOA_FS_SEL10x87
+#define MCS_GOA_FS_SEL20x91
+#define MCS_GOA_FS_SEL30x9B
+#define MCS_GOA_BS_SEL00xAC
+#define MCS_GOA_BS_SEL10xB5
+#define MCS_GOA_BS_SEL20xBF
+#define MCS_GOA_BS_SEL30xC9
+#define MCS_GOA_BS_SEL40xD3
+
+/* CMD2 P3 commands (Gamma) */
+#define MCS_GAMMA_VP   0x60 /* Gamma VP1~VP16 */
+#define MCS_GAMMA_VN   0x70 /* Gamma VN1~VN16 */
+
+struct rm68200_panel_priv {
+   struct udevice *reg;
+   struct udevice *backlight;
+   

[U-Boot] [PATCH v4 04/15] video: add support of MIPI DSI interface

2019-09-13 Thread Yannick Fertré
Mipi_display.c contains a set of dsi helpers.
This file is a copy of file drm_mipi_dsi.c (linux kernel).

Signed-off-by: Yannick Fertré 
---
 drivers/video/Kconfig|   8 +
 drivers/video/Makefile   |   1 +
 drivers/video/mipi_dsi.c | 828 +++
 include/mipi_dsi.h   | 466 ++
 4 files changed, 1303 insertions(+)
 create mode 100644 drivers/video/mipi_dsi.c
 create mode 100644 include/mipi_dsi.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 261fa98..36f666e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -73,6 +73,14 @@ config VIDEO_ANSI
  Enable ANSI escape sequence decoding for a more fully functional
  console.
 
+config VIDEO_MIPI_DSI
+   bool "Support MIPI DSI interface"
+   depends on DM_VIDEO
+   help
+ Support MIPI DSI interface for driving a MIPI compatible device.
+ The MIPI Display Serial Interface (MIPI DSI) defines a high-speed
+ serial interface between a host processor and a display module.
+
 config CONSOLE_NORMAL
bool "Support a simple text console"
depends on DM_VIDEO
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 349a207..7df9b0b 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += 
hitachi_tx18d42vm_lcd.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-${CONFIG_VIDEO_MESON} += meson/
+obj-${CONFIG_VIDEO_MIPI_DSI} += mipi_dsi.o
 obj-$(CONFIG_VIDEO_MVEBU) += mvebu_lcd.o
 obj-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
diff --git a/drivers/video/mipi_dsi.c b/drivers/video/mipi_dsi.c
new file mode 100644
index 000..cdc3ef5
--- /dev/null
+++ b/drivers/video/mipi_dsi.c
@@ -0,0 +1,828 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * MIPI DSI Bus
+ *
+ * Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Andrzej Hajda 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Mipi_dsi.c contains a set of dsi helpers.
+ * This file is inspired from the drm helper file 
drivers/gpu/drm/drm_mipi_dsi.c
+ * (kernel linux).
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * DOC: dsi helpers
+ *
+ * These functions contain some common logic and helpers to deal with MIPI DSI
+ * peripherals.
+ *
+ * Helpers are provided for a number of standard MIPI DSI command as well as a
+ * subset of the MIPI DCS command set.
+ */
+
+/**
+ * mipi_dsi_attach - attach a DSI device to its DSI host
+ * @dsi: DSI peripheral
+ */
+int mipi_dsi_attach(struct mipi_dsi_device *dsi)
+{
+   const struct mipi_dsi_host_ops *ops = dsi->host->ops;
+
+   if (!ops || !ops->attach)
+   return -ENOSYS;
+
+   return ops->attach(dsi->host, dsi);
+}
+EXPORT_SYMBOL(mipi_dsi_attach);
+
+/**
+ * mipi_dsi_detach - detach a DSI device from its DSI host
+ * @dsi: DSI peripheral
+ */
+int mipi_dsi_detach(struct mipi_dsi_device *dsi)
+{
+   const struct mipi_dsi_host_ops *ops = dsi->host->ops;
+
+   if (!ops || !ops->detach)
+   return -ENOSYS;
+
+   return ops->detach(dsi->host, dsi);
+}
+EXPORT_SYMBOL(mipi_dsi_detach);
+
+/**
+ * mipi_dsi_device_transfer - transfer message to a DSI device
+ * @dsi: DSI peripheral
+ * @msg: message
+ */
+static ssize_t mipi_dsi_device_transfer(struct mipi_dsi_device *dsi,
+   struct mipi_dsi_msg *msg)
+{
+   const struct mipi_dsi_host_ops *ops = dsi->host->ops;
+
+   if (!ops || !ops->transfer)
+   return -ENOSYS;
+
+   if (dsi->mode_flags & MIPI_DSI_MODE_LPM)
+   msg->flags |= MIPI_DSI_MSG_USE_LPM;
+
+   return 

[U-Boot] [PATCH v4 05/15] dm: Add a dsi host uclass

2019-09-13 Thread Yannick Fertré
DSI host can usefully be modelled as their own uclass.

Signed-off-by: Yannick Fertré 
---
 arch/sandbox/dts/sandbox.dts |  6 ++-
 configs/sandbox_defconfig|  1 +
 drivers/video/Kconfig|  7 
 drivers/video/Makefile   |  2 +
 drivers/video/dsi-host-uclass.c  | 39 +++
 drivers/video/sandbox_dsi_host.c | 83 
 include/dm/uclass-id.h   |  1 +
 include/dsi_host.h   | 57 +++
 test/dm/Makefile |  1 +
 test/dm/dsi_host.c   | 58 
 10 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/dsi-host-uclass.c
 create mode 100644 drivers/video/sandbox_dsi_host.c
 create mode 100644 include/dsi_host.h
 create mode 100644 test/dm/dsi_host.c

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 16a33db..f1637c8 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -25,6 +25,11 @@
compatible = "google,cros-ec-sandbox";
};
 
+   dsi_host: dsi_host {
+   compatible = "sandbox,dsi-host";
+   status = "okay";
+   };
+
ethrawbus {
compatible = "sandbox,eth-raw-bus";
skip-localhost = <0>;
@@ -63,7 +68,6 @@
compatible = "sandbox,spi";
cs-gpios = <0>, <_a 0>;
};
-
 };
 
 #include "sandbox.dtsi"
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 7355e3a..90f3e26 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -205,6 +205,7 @@ CONFIG_CONSOLE_ROTATION=y
 CONFIG_CONSOLE_TRUETYPE=y
 CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
 CONFIG_VIDEO_SANDBOX_SDL=y
+CONFIG_VIDEO_DSI_HOST_SANDBOX=y
 CONFIG_OSD=y
 CONFIG_SANDBOX_OSD=y
 CONFIG_W1=y
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 36f666e..554b7db 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -686,6 +686,13 @@ config VIDEO_DW_HDMI
  rather requires a SoC-specific glue driver to call it), it
  can not be enabled from the configuration menu.
 
+config VIDEO_DSI_HOST_SANDBOX
+   bool "Enable sandbox for dsi host"
+   depends on SANDBOX
+   help
+ Enable support for sandbox dsi host device used for testing
+ purposes.
+
 config VIDEO_SIMPLE
bool "Simple display driver for preconfigured display"
help
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 7df9b0b..5ed3590 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_CONSOLE_ROTATION) += console_rotate.o
 obj-$(CONFIG_CONSOLE_TRUETYPE) += console_truetype.o fonts/
 obj-$(CONFIG_DISPLAY) += display-uclass.o
 obj-$(CONFIG_DM_VIDEO) += backlight-uclass.o
+obj-$(CONFIG_DM_VIDEO) += dsi-host-uclass.o
 obj-$(CONFIG_DM_VIDEO) += panel-uclass.o simple_panel.o
 obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video_bmp.o
@@ -58,6 +59,7 @@ obj-$(CONFIG_VIDEO_MVEBU) += mvebu_lcd.o
 obj-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
 obj-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
+obj-$(CONFIG_VIDEO_DSI_HOST_SANDBOX) += sandbox_dsi_host.o
 obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
 obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
 obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o
diff --git a/drivers/video/dsi-host-uclass.c b/drivers/video/dsi-host-uclass.c
new file mode 100644
index 000..1db1f88
--- /dev/null
+++ b/drivers/video/dsi-host-uclass.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre  for STMicroelectronics.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+int dsi_host_init(struct udevice *dev,
+ struct mipi_dsi_device *device,
+ struct display_timing *timings,
+ unsigned int max_data_lanes,
+ const struct mipi_dsi_phy_ops *phy_ops)
+{
+   struct dsi_host_ops *ops = dsi_host_get_ops(dev);
+
+   if (!ops->init)
+   return -ENOSYS;
+
+   return ops->init(dev, device, timings, max_data_lanes, phy_ops);
+}
+
+int dsi_host_enable(struct udevice *dev)
+{
+   struct dsi_host_ops *ops = dsi_host_get_ops(dev);
+
+   if (!ops->enable)
+   return -ENOSYS;
+
+   return ops->enable(dev);
+}
+
+UCLASS_DRIVER(dsi_host) = {
+   .id = UCLASS_DSI_HOST,
+   .name   = "dsi_host",
+};
diff --git a/drivers/video/sandbox_dsi_host.c b/drivers/video/sandbox_dsi_host.c
new file mode 100644
index 000..ee01ed1
--- /dev/null
+++ b/drivers/video/sandbox_dsi_host.c
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+struct 

[U-Boot] [PATCH v4 07/15] video: add support of STM32 MIPI DSI controller driver

2019-09-13 Thread Yannick Fertré
Add the STM32 DSI controller driver that uses the Synopsys DesignWare
MIPI DSI host controller bridge.

Signed-off-by: Yannick Fertré 
---
 drivers/video/stm32/Kconfig |   9 +
 drivers/video/stm32/Makefile|   1 +
 drivers/video/stm32/stm32_dsi.c | 490 
 3 files changed, 500 insertions(+)
 create mode 100644 drivers/video/stm32/stm32_dsi.c

diff --git a/drivers/video/stm32/Kconfig b/drivers/video/stm32/Kconfig
index 78b1fac..95d51bb 100644
--- a/drivers/video/stm32/Kconfig
+++ b/drivers/video/stm32/Kconfig
@@ -13,6 +13,15 @@ menuconfig VIDEO_STM32
  DSI. This option enables these supports which can be used on
  devices which have RGB TFT or DSI display connected.
 
+config VIDEO_STM32_DSI
+   bool "Enable STM32 DSI video support"
+   depends on VIDEO_STM32
+   select VIDEO_BRIDGE
+   select VIDEO_DW_MIPI_DSI
+   help
+ This option enables support DSI internal bridge which can be used on
+ devices which have DSI devices connected.
+
 config VIDEO_STM32_MAX_XRES
int "Maximum horizontal resolution (for memory allocation purposes)"
depends on VIDEO_STM32
diff --git a/drivers/video/stm32/Makefile b/drivers/video/stm32/Makefile
index 7297e5f..f8b42d1 100644
--- a/drivers/video/stm32/Makefile
+++ b/drivers/video/stm32/Makefile
@@ -6,3 +6,4 @@
 #  Yannick Fertre 
 
 obj-${CONFIG_VIDEO_STM32} = stm32_ltdc.o
+obj-${CONFIG_VIDEO_STM32_DSI} += stm32_dsi.o
diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c
new file mode 100644
index 000..cb89576
--- /dev/null
+++ b/drivers/video/stm32/stm32_dsi.c
@@ -0,0 +1,490 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Philippe Cornu  for STMicroelectronics.
+ *   Yannick Fertre  for STMicroelectronics.
+ *
+ * This MIPI DSI controller driver is based on the Linux Kernel driver from
+ * drivers/gpu/drm/stm/dw_mipi_dsi-stm.c.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define HWVER_130  0x31333000  /* IP version 1.30 */
+#define HWVER_131  0x31333100  /* IP version 1.31 */
+
+/* DSI digital registers & bit definitions */
+#define DSI_VERSION0x00
+#define VERSIONGENMASK(31, 8)
+
+/*
+ * DSI wrapper registers & bit definitions
+ * Note: registers are named as in the Reference Manual
+ */
+#define DSI_WCFGR  0x0400  /* Wrapper ConFiGuration Reg */
+#define WCFGR_DSIM BIT(0)  /* DSI Mode */
+#define WCFGR_COLMUX   GENMASK(3, 1)   /* COLor MUltipleXing */
+
+#define DSI_WCR0x0404  /* Wrapper Control Reg */
+#define WCR_DSIEN  BIT(3)  /* DSI ENable */
+
+#define DSI_WISR   0x040C  /* Wrapper Interrupt and Status Reg */
+#define WISR_PLLLS BIT(8)  /* PLL Lock Status */
+#define WISR_RRS   BIT(12) /* Regulator Ready Status */
+
+#define DSI_WPCR0  0x0418  /* Wrapper Phy Conf Reg 0 */
+#define WPCR0_UIX4 GENMASK(5, 0)   /* Unit Interval X 4 */
+#define WPCR0_TDDL BIT(16) /* Turn Disable Data Lanes */
+
+#define DSI_WRPCR  0x0430  /* Wrapper Regulator & Pll Ctrl Reg */
+#define WRPCR_PLLENBIT(0)  /* PLL ENable */
+#define WRPCR_NDIV GENMASK(8, 2)   /* pll loop DIVision Factor */
+#define WRPCR_IDF  GENMASK(14, 11) /* pll Input Division Factor */
+#define WRPCR_ODF  GENMASK(17, 16) /* pll Output Division Factor */
+#define WRPCR_REGENBIT(24) /* REGulator ENable */
+#define WRPCR_BGRENBIT(28) /* BandGap Reference ENable */
+#define IDF_MIN1
+#define IDF_MAX7
+#define NDIV_MIN   10
+#define NDIV_MAX   125
+#define ODF_MIN1
+#define ODF_MAX8
+
+/* dsi color format coding according to the datasheet */
+enum dsi_color {
+   DSI_RGB565_CONF1,
+   DSI_RGB565_CONF2,
+   DSI_RGB565_CONF3,
+   DSI_RGB666_CONF1,
+   DSI_RGB666_CONF2,
+   DSI_RGB888,
+};
+
+#define LANE_MIN_KBPS  31250
+#define LANE_MAX_KBPS  50
+
+/* Timeout for regulator on/off, pll lock/unlock & fifo empty */
+#define TIMEOUT_US 20
+
+struct stm32_dsi_priv {
+   struct mipi_dsi_device device;
+   void __iomem *base;
+   struct udevice *panel;
+   u32 pllref_clk;
+   u32 hw_version;
+   int lane_min_kbps;
+   int lane_max_kbps;
+   struct udevice *vdd_reg;
+   struct udevice *dsi_host;
+};
+
+static inline void dsi_write(struct stm32_dsi_priv *dsi, u32 reg, u32 val)
+{
+   writel(val, dsi->base + reg);
+}
+
+static inline u32 dsi_read(struct stm32_dsi_priv *dsi, u32 reg)
+{
+   return readl(dsi->base + reg);
+}
+
+static inline void dsi_set(struct 

[U-Boot] [PATCH v4 06/15] video: add MIPI DSI host controller bridge

2019-09-13 Thread Yannick Fertré
Add a Synopsys Designware MIPI DSI host bridge driver, based on the
Rockchip version from rockchip/dw-mipi-dsi.c with phy & bridge APIs.

Signed-off-by: Yannick Fertré 
---
 drivers/video/Kconfig   |  10 +
 drivers/video/Makefile  |   1 +
 drivers/video/dw_mipi_dsi.c | 838 
 3 files changed, 849 insertions(+)
 create mode 100644 drivers/video/dw_mipi_dsi.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 554b7db..a55cdc6 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -693,6 +693,16 @@ config VIDEO_DSI_HOST_SANDBOX
  Enable support for sandbox dsi host device used for testing
  purposes.
 
+config VIDEO_DW_MIPI_DSI
+   bool
+   select VIDEO_MIPI_DSI
+   help
+ Enables the common driver code for the Synopsis Designware
+ MIPI DSI block found in SoCs from various vendors.
+ As this does not provide any functionality by itself (but
+ rather requires a SoC-specific glue driver to call it), it
+ can not be enabled from the configuration menu.
+
 config VIDEO_SIMPLE
bool "Simple display driver for preconfigured display"
help
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 5ed3590..58210ec 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_VIDEO_BROADWELL_IGD) += broadwell_igd.o
 obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o
 obj-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o
 obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
+obj-$(CONFIG_VIDEO_DW_MIPI_DSI) += dw_mipi_dsi.o
 obj-$(CONFIG_VIDEO_EFI) += efi.o
 obj-$(CONFIG_VIDEO_FSL_DCU_FB) += fsl_dcu_fb.o videomodes.o
 obj-$(CONFIG_VIDEO_IPUV3) += imx/
diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c
new file mode 100644
index 000..04b07e3
--- /dev/null
+++ b/drivers/video/dw_mipi_dsi.c
@@ -0,0 +1,838 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016, Fuzhou Rockchip Electronics Co., Ltd
+ * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
+ * Author(s): Philippe Cornu  for STMicroelectronics.
+ *Yannick Fertre  for STMicroelectronics.
+ *
+ * This generic Synopsys DesignWare MIPI DSI host driver is inspired from
+ * the Linux Kernel driver drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define HWVER_131  0x31333100  /* IP version 1.31 */
+
+#define DSI_VERSION0x00
+#define VERSIONGENMASK(31, 8)
+
+#define DSI_PWR_UP 0x04
+#define RESET  0
+#define POWERUPBIT(0)
+
+#define DSI_CLKMGR_CFG 0x08
+#define TO_CLK_DIVISION(div)   (((div) & 0xff) << 8)
+#define TX_ESC_CLK_DIVISION(div)   ((div) & 0xff)
+
+#define DSI_DPI_VCID   0x0c
+#define DPI_VCID(vcid) ((vcid) & 0x3)
+
+#define DSI_DPI_COLOR_CODING   0x10
+#define LOOSELY18_EN   BIT(8)
+#define DPI_COLOR_CODING_16BIT_1   0x0
+#define DPI_COLOR_CODING_16BIT_2   0x1
+#define DPI_COLOR_CODING_16BIT_3   0x2
+#define DPI_COLOR_CODING_18BIT_1   0x3
+#define DPI_COLOR_CODING_18BIT_2   0x4
+#define DPI_COLOR_CODING_24BIT 0x5
+
+#define DSI_DPI_CFG_POL0x14
+#define COLORM_ACTIVE_LOW  BIT(4)
+#define SHUTD_ACTIVE_LOW   BIT(3)
+#define HSYNC_ACTIVE_LOW   BIT(2)
+#define VSYNC_ACTIVE_LOW   BIT(1)
+#define DATAEN_ACTIVE_LOW  BIT(0)
+
+#define DSI_DPI_LP_CMD_TIM 0x18
+#define OUTVACT_LPCMD_TIME(p)  (((p) & 0xff) << 16)
+#define INVACT_LPCMD_TIME(p)   ((p) & 0xff)
+
+#define DSI_DBI_VCID   0x1c
+#define DSI_DBI_CFG0x20
+#define DSI_DBI_PARTITIONING_EN0x24
+#define DSI_DBI_CMDSIZE0x28
+
+#define DSI_PCKHDL_CFG 0x2c
+#define CRC_RX_EN  BIT(4)
+#define ECC_RX_EN  BIT(3)
+#define BTA_EN BIT(2)
+#define EOTP_RX_EN BIT(1)
+#define EOTP_TX_EN BIT(0)
+
+#define DSI_GEN_VCID   0x30
+
+#define DSI_MODE_CFG   0x34
+#define ENABLE_VIDEO_MODE  0
+#define ENABLE_CMD_MODEBIT(0)
+
+#define DSI_VID_MODE_CFG   0x38
+#define ENABLE_LOW_POWER   (0x3f << 8)
+#define ENABLE_LOW_POWER_MASK  (0x3f << 8)
+#define VID_MODE_TYPE_NON_BURST_SYNC_PULSES0x0
+#define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS0x1
+#define VID_MODE_TYPE_BURST0x2
+#define VID_MODE_TYPE_MASK 0x3
+
+#define DSI_VID_PKT_SIZE   0x3c
+#define 

[U-Boot] [PATCH v4 03/15] include: Add new DCS commands in the enum list

2019-09-13 Thread Yannick Fertré
Adding new DCS commands which are specified in the
DCS 1.3 spec related to CABC.

Signed-off-by: Yannick Fertré 
---
 include/mipi_display.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/mipi_display.h b/include/mipi_display.h
index ddcc8ca..19aa65a 100644
--- a/include/mipi_display.h
+++ b/include/mipi_display.h
@@ -115,6 +115,14 @@ enum {
MIPI_DCS_READ_MEMORY_CONTINUE   = 0x3E,
MIPI_DCS_SET_TEAR_SCANLINE  = 0x44,
MIPI_DCS_GET_SCANLINE   = 0x45,
+   MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 0x51, /* MIPI DCS 1.3 */
+   MIPI_DCS_GET_DISPLAY_BRIGHTNESS = 0x52, /* MIPI DCS 1.3 */
+   MIPI_DCS_WRITE_CONTROL_DISPLAY  = 0x53, /* MIPI DCS 1.3 */
+   MIPI_DCS_GET_CONTROL_DISPLAY= 0x54, /* MIPI DCS 1.3 */
+   MIPI_DCS_WRITE_POWER_SAVE   = 0x55, /* MIPI DCS 1.3 */
+   MIPI_DCS_GET_POWER_SAVE = 0x56, /* MIPI DCS 1.3 */
+   MIPI_DCS_SET_CABC_MIN_BRIGHTNESS = 0x5E,/* MIPI DCS 1.3 */
+   MIPI_DCS_GET_CABC_MIN_BRIGHTNESS = 0x5F,/* MIPI DCS 1.3 */
MIPI_DCS_READ_DDB_START = 0xA1,
MIPI_DCS_READ_DDB_CONTINUE  = 0xA8,
 };
-- 
2.7.4

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


[U-Boot] [PATCH v4 01/15] video: bmp: check resolutions of panel/bitmap

2019-09-13 Thread Yannick Fertré
If the size of the bitmap is bigger than the size of
the panel then errors appear when calculating axis alignment
and the copy of bitmap is done outside of framebuffer.

Signed-off-by: Yannick Fertré 
---
 drivers/video/video_bmp.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 193f37d..544bd5f 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -54,6 +54,13 @@ static void video_display_rle8_bitmap(struct udevice *dev,
height = get_unaligned_le32(>header.height);
bmap = (uchar *)bmp + get_unaligned_le32(>header.data_offset);
 
+   /* check if picture size exceed panel size */
+   if (priv->xsize < width)
+   width = priv->xsize;
+
+   if (priv->ysize < height)
+   height = priv->ysize;
+
x = 0;
y = height - 1;
 
@@ -249,6 +256,13 @@ int video_bmp_display(struct udevice *dev, ulong 
bmp_image, int x, int y,
 
padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
 
+   /* check if picture size exceed panel size */
+   if (pwidth < width)
+   width = pwidth;
+
+   if (priv->ysize < height)
+   height = priv->ysize;
+
if (align) {
video_splash_align_axis(, priv->xsize, width);
video_splash_align_axis(, priv->ysize, height);
-- 
2.7.4

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


[U-Boot] [PATCH v4 00/15] splash screen on the stm32f769 & stm32mp1 boards

2019-09-13 Thread Yannick Fertré
Version 1:
- Initial commit.

Version 2:
- swap patches to avoid compilation issue.
- remove panel timings from device tree.

Version 3:
- Share same include file mipi_display.h with kernel linux.
- Rework ltdc driver with last comments of Anatolij Gustshin.
- Check ordering (file dw_mipi_dsi.c).
- Rename mipi_display.c to mipi_dsi.c.

Version 4:
- Add physical set mode operation
- Improve debug trace (display controller ltdc)
- Refresh timings of panels
- Add regulator (dsi controller)
- Add new class DSI_HOST
- Support of panels OTM800A & RM68200

This serie contains all patchsets needed for displaying a splash screen
on the stm32f769 & stm32mp1 boards.
A new config has been created configs/stm32f769-disco_defconfig.
This is necessary due to the difference of panels between stm32f769-disco,
stm32f746-disco boards & stm32mp1 boards.
A new class DSI_HOST have been created to manage a dsi host between the
dsi controller & display controller.

Yannick Fertré (15):
  video: bmp: check resolutions of panel/bitmap
  video: stm32: stm32_ltdc: add bridge to display controller
  include: Add new DCS commands in the enum list
  video: add support of MIPI DSI interface
  dm: Add a dsi host uclass
  video: add MIPI DSI host controller bridge
  video: add support of STM32 MIPI DSI controller driver
  video: add support of panel OTM8009A
  video: add support of panel RM68200
  board: Add STM32F769 SoC, discovery board support
  ARM: dts: stm32f769: add display for STM32F769 disco board
  ARM: dts: stm32mp1: add dsi host for stm32mp157c-ev1 board
  ARM: dts: stm32mp1: add dsi host for stm32mp157c-dk2 board
  stm32mp1: configs: update video
  stm32mp1: configs: add display devices

 arch/arm/dts/stm32f769-disco-u-boot.dtsi |  62 +++
 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi |   7 +
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |   5 +
 arch/sandbox/dts/sandbox.dts |   6 +-
 configs/sandbox_defconfig|   1 +
 configs/stm32f769-disco_defconfig|  63 +++
 configs/stm32mp15_basic_defconfig|   6 +
 configs/stm32mp15_optee_defconfig|   6 +
 configs/stm32mp15_trusted_defconfig  |   6 +
 drivers/video/Kconfig|  43 ++
 drivers/video/Makefile   |   6 +
 drivers/video/dsi-host-uclass.c  |  39 ++
 drivers/video/dw_mipi_dsi.c  | 838 +++
 drivers/video/mipi_dsi.c | 828 ++
 drivers/video/orisetech_otm8009a.c   | 379 ++
 drivers/video/raydium-rm68200.c  | 351 +
 drivers/video/sandbox_dsi_host.c |  83 +++
 drivers/video/stm32/Kconfig  |   9 +
 drivers/video/stm32/Makefile |   1 +
 drivers/video/stm32/stm32_dsi.c  | 490 ++
 drivers/video/stm32/stm32_ltdc.c | 143 +++---
 drivers/video/video_bmp.c|  14 +
 include/configs/stm32mp1.h   |   7 +
 include/dm/uclass-id.h   |   1 +
 include/dsi_host.h   |  57 +++
 include/mipi_display.h   |   8 +
 include/mipi_dsi.h   | 466 +
 test/dm/Makefile |   1 +
 test/dm/dsi_host.c   |  58 +++
 29 files changed, 3923 insertions(+), 61 deletions(-)
 create mode 100644 configs/stm32f769-disco_defconfig
 create mode 100644 drivers/video/dsi-host-uclass.c
 create mode 100644 drivers/video/dw_mipi_dsi.c
 create mode 100644 drivers/video/mipi_dsi.c
 create mode 100644 drivers/video/orisetech_otm8009a.c
 create mode 100644 drivers/video/raydium-rm68200.c
 create mode 100644 drivers/video/sandbox_dsi_host.c
 create mode 100644 drivers/video/stm32/stm32_dsi.c
 create mode 100644 include/dsi_host.h
 create mode 100644 include/mipi_dsi.h
 create mode 100644 test/dm/dsi_host.c

-- 
2.7.4

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


Re: [U-Boot] [EXT] Saving u-boot environment on LS1046ardb QSPI bricks flash memory

2019-09-13 Thread Ashish Kumar


> -Original Message-
> From: U-Boot  On Behalf Of Matthew
> Ratson
> Sent: Friday, September 13, 2019 12:55 AM
> To: u-boot@lists.denx.de
> Subject: [EXT] [U-Boot] Saving u-boot environment on LS1046ardb QSPI
> bricks flash memory
> 
> Caution: EXT Email
> 
> Hi there,
> 
> I am currently working with a LS1046ardb development board from
> NXP/Layerscape. Using their provided firmware image from the primary QSPI
> memory bank, I have tried to flash my own compiled u-boot (using the
> ls1046ardb_qspi_defconfig file) onto the alternate memory bank. I have also
> flashed a Reset Configuration Word (RCW) which was provided by NXP.
> 
> This process is successful and the alternate bank boots into u-boot.
> However, I discovered that after simply executing a "saveenv" command and
> then rebooting again into the alternate bank, the alternate flash memory
> seems to be "bricked". I can no longer boot into the alternate bank and
> instead, the board will boot into the default bank.
> 
> I am wondering if this issue and has been noticed already by someone or if
> there is something I am not doing correctly.
> 
> Is their a specific denx RCW that I should use instead, rather than the one
> provided by NXP?
> 
> Any help would be greatly appreciated!
Hi Matthew,

This driver is broken in upstream and it is work in progress to  fix  and 
update in upstream.
You can still fetch this from github as few other people have also reported the 
same.
On  github repo there are 2 version of driver. 

One with old xfer method and one with new spi-mem version. 
I am debugging the spi-mem version as this is the recommended version by 
maintainers .
LS1046 is working via both methods. There are some debug prints in spi-mem 
version.

https://github.com/erashish007/u-boot-spi-mem/
br:  spi-mem-port
https://github.com/erashish007/u-boot-spi-mem/
br: xfer_wrking

Regards
Ashish 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d
> enx.de%2Flistinfo%2Fu-
> bootdata=02%7C01%7CAshish.Kumar%40nxp.com%7C8e1f67af6f3948
> 9afc0e08d737bbfd91%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C
> 637039152865550331sdata=C6DTwmG7cZXPey9J%2BTNUcqIr937vWhu
> 1gE6Tq2tGr0g%3Dreserved=0
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] u-boot working version for Rasberry Pi 4

2019-09-13 Thread Matthias Brugger


On 09/09/2019 11:35, Sachin Mehrotra wrote:
> Dear Concern,
> 
> I am working for u-boot for rpi4, may I know do we have updated working 
> version for Raspberry Pi 4.
> I was testing the version https://gitlab.denx.de/u-boot/u-boot with 
> rpi4 but getting error in 
> file arch/arm/cpu/armv8/cpu.c:13 if I run for raspberry pi 4.
> 
> Please guide or send me the link for the working version of u-boot for 
> rasbessry pi 4
> 

Basic U-Boot support for RPi4 is merged in v2019.10-rc4
Beware that we use the device tree blob provided by the RPi FW, so you will need
a kernel that can handle that.

Regards,
Matthias

> Thanks in advance.
> 
> Best Regards / Mit freundlichen Grüßen,
> Sachin Mehrotra
> Application Engineer
> Security Solution Center
> Phone: +49  89 12 22 32 533
> 
> Swissbit AG
> BU Security
> Leuchtenbergring 3
> D-81677 Munich
> Germany
> 
> 
> Email:  
> sachin.mehro...@swissbit.com
> Website: www.swissbit.com
> 
> [swissbit]
> 
> 
> 
> ___
> 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 v6 1/4] dm: spi: Convert Freescale ESPI driver to driver model

2019-09-13 Thread Prabhakar Kushwaha

> -Original Message-
> From: Jagan Teki 
> Sent: Friday, September 13, 2019 7:58 AM
> To: Prabhakar Kushwaha 
> Cc: Xiaowei Bao ; Priyanka Jain
> ; w...@denx.de; Shengzhou Liu
> ; Ruchika Gupta ;
> s...@chromium.org; Chuanhua Han ; Jagdish
> Gediya ; bmeng...@gmail.com; u-
> b...@lists.denx.de; York Sun ; Jiafei Pan
> 
> Subject: Re: [PATCH v6 1/4] dm: spi: Convert Freescale ESPI driver to driver
> model
> 
> On Mon, Sep 9, 2019 at 1:13 PM Prabhakar Kushwaha
>  wrote:
> >
> >
> > > -Original Message-
> > > From: Jagan Teki 
> > > Sent: Monday, September 9, 2019 11:37 AM
> > > To: Xiaowei Bao 
> > > Cc: Prabhakar Kushwaha ;
> w...@denx.de;
> > > Shengzhou Liu ; Ruchika Gupta
> > > ; s...@chromium.org; Chuanhua Han
> > > ; Jagdish Gediya ;
> > > bmeng...@gmail.com; u-boot@lists.denx.de; York Sun
> > > ; Jiafei Pan 
> > > Subject: Re: [PATCH v6 1/4] dm: spi: Convert Freescale ESPI driver
> > > to driver model
> > >
> > > On Mon, Sep 9, 2019 at 9:27 AM Xiaowei Bao 
> wrote:
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Prabhakar Kushwaha
> > > > > Sent: 2019年8月26日 23:12
> > > > > To: Xiaowei Bao ; w...@denx.de; Shengzhou
> Liu
> > > > > ; Ruchika Gupta
> ;
> > > > > ja...@amarulasolutions.com; s...@chromium.org; Chuanhua Han
> > > > > ; Jagdish Gediya
> ;
> > > > > bmeng...@gmail.com; u-boot@lists.denx.de
> > > > > Cc: York Sun ; Xiaowei Bao
> > > > > 
> > > > > Subject: RE: [PATCH v6 1/4] dm: spi: Convert Freescale ESPI
> > > > > driver to driver model
> > > > >
> > > > > Dear Jagan,
> > > > >
> > > > > > -Original Message-
> > > > > > From: Xiaowei Bao 
> > > > > > Sent: Monday, August 26, 2019 2:55 PM
> > > > > > To: w...@denx.de; Shengzhou Liu ;
> Ruchika
> > > > > > Gupta ; ja...@amarulasolutions.com;
> > > > > s...@chromium.org;
> > > > > > Prabhakar Kushwaha ;
> Chuanhua Han
> > > > > > ; Jagdish Gediya
> > > > > > ; bmeng...@gmail.com;
> > > > > > u-boot@lists.denx.de
> > > > > > Cc: York Sun ; Xiaowei Bao
> > > > > > 
> > > > > > Subject: [PATCH v6 1/4] dm: spi: Convert Freescale ESPI driver
> > > > > > to driver model
> > > > > >
> > > > > > From: Chuanhua Han 
> > > > > >
> > > > > > Modify the Freescale ESPI driver to support the driver model.
> > > > > > Also resolved the following problems:
> > > > > >
> > > > > > = WARNING
> == This
> > > > > board does
> > > > > > not use CONFIG_DM_SPI. Please update the board before
> v2019.04
> > > > > > for no dm conversion and v2019.07 for partially dm converted
> drivers.
> > > > > > Failure to update can lead to driver/board removal See
> > > > > > doc/driver- model/MIGRATION.txt for more info.
> > > > > >
> 
> > > > > > = WARNING
> == This
> > > > > board does
> > > > > > not use CONFIG_DM_SPI_FLASH. Please update the board to use
> > > > > > CONFIG_SPI_FLASH before the v2019.07 release.
> > > > > > Failure to update by the deadline may result in board removal.
> > > > > > See doc/driver-model/MIGRATION.txt for more info.
> > > > > >
> 
> > > > > >
> > > > > > Signed-off-by: Chuanhua Han 
> > > > > > Signed-off-by: Xiaowei Bao 
> > > > > > ---
> > > > > > depends on:
> > > > > > https://patc
> > > > > > hwo
> > > > > >
> > > > >
> > >
> rk.ozlabs.org%2Fcover%2F1146494%2Fdata=02%7C01%7Cprabhaka
> r.k
> > > > > us
> > > > > >
> > > > >
> hwaha%40nxp.com%7Ccc2424972d4e4d6835f908d72a08b877%7C686ea1
> d3
> > > > > bc2
> > > > > >
> > > > >
> b4c6fa92cd99c5c301635%7C0%7C0%7C637024089250212151sdat
> a=
> > > > > 3Ki9
> > > > > >
> mrnn9YXWMR0vjoDmeE2eKBIn1RKlgnRC81SZQbU%3Dreserved=0
> > > > > > Changes in v6:
> > > > > > - Change #ifndef CONFIG_DM_SPI to #if
> !CONFIG_IS_ENABLED(DM_SPI).
> > > > > > Changes in v5:
> > > > > > - Modify the function spi_cs_activate to fsl_spi_cs_activate.
> > > > > > - Move cs to the parameter of the fsl_spi_cs_activate function.
> > > > > > Changes in v4:
> > > > > > - Update copyright information.
> > > > > > - Move the fsl_espi_platdata data structure to the
> > > > > > include/dm/platform_data/.
> > > > > > - Merge the contents of the fsl_espi_priv structure into
> > > > > > the fsl_spi_slave structure.
> > > > > > - Implement the fsl_espi_set_speed function.
> > > > > > - Implement the fsl_espi_set_mode function.
> > > > > > - Implement the espi_release_bus function.
> > > > > > - Remove unwanted fsl_espi_bind functions.
> > > > > > - Implement the fsl_espi_child_pre_probe function as needed.
> > > > > > - Use #if CONFIG_IS_ENABLED(OF_CONTROL) &&
> > > > > > !CONFIG_IS_ENABLED(OF_PLATDATA).
> > > > > > Changes in v3:
> > > > > > - Add a cover-letter for this patch set.
> > > > > > Changes in v2:
> > > > > > - The fsl_espi driver support both OF_CONTROL and PLATDATA.
> > > > > >
> > > > > >  drivers/spi/fsl_espi.c  | 445
> 

Re: [U-Boot] OMAP watchdog timer reset on BBB

2019-09-13 Thread Suniel Mahesh
Hi Sam,

On 12/09/19 22:03, Sam Protsenko wrote:
> Hi Stefan,
> 
> On Thu, Sep 12, 2019 at 5:38 PM Stefan Roese  wrote:
>>
>> Hi Sam,
>>
>> On 12.09.19 15:45, Sam Protsenko wrote:
>>> Hi Suniel,
>>>
>>> After transition to DM WDT, watchdog timer on BeagleBone Black resets
>>> the board after 1 minute or so. I'm using this defconfig: [1]. After
>>> disabling CONFIG_WDT and CONFIG_WATCHDOG options the board doesn't
>>> reset. I guess it might be happening on other boards using
>>> CONFIG_WDT_OMAP3 as well. The issue can be reproduced by stopping in
>>> U-Boot shell (=>) and waiting for 1 minute.
>>>
>>> Do you know by chance why it might be happening, or maybe some fix
>>> already exists?
>>>
>>> Thanks!
>>>
>>> [1] https://pastebin.ubuntu.com/p/Zz5bY6cYXS/
>>
>> So you have enabled the watchdog and should see something like this
>> upon bootup:
>>
>> WDT:   Started without servicing (60s timeout)
>>
>> Is this correct? Then you need to enable the U-Boot internal WDT
>> servicing by enabling CONFIG_WATCHDOG as well, as this will
>> result in the internal U-Boot servicing of the watchdog. Then
>> you should see this upon bootup and no reset will appear in
>> U-Boot:
>>
>> WDT:   Started with servicing (60s timeout)
>>
> 
> I'm seeing this ("with servicing") line, and CONFIG_WATCHDOG is
> already enabled in am335x_evm_defconfig. So I think it's an issue,
> which *probably* appeared when watchdog drivers were converted to
> Driver Model (this defconfig is using CONFIG_WDT + CONFIG_WDT_OMAP3
> options).

No, I didn't see any target reset issues because of DM WDT.
It was well tested when it was converted to DM(both on hardware and travis). 
Yes the config uses both CONFIG_WDT + CONFIG_WDT_OMAP3.

Any clues what can be wrong?

compiled and ran latest u-boot (am335x_evm_defconfig) as it is on the 
target(BBB). 
Checked three boot modes MMC, SD and serial, didn't see any issues.
https://paste.ubuntu.com/p/tjcPhv4FMQ/ (sd card boot)
https://pastebin.ubuntu.com/p/X4tkp4ngMK/ (serial boot)

I am suspecting something else might be causing the issue.
Hope this helps

Thanks
Suniel
> 
>> Does this help?
>>
>> Thanks,
>> Stefan

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