Re: [PATCH] usb: gadget: dwc2_udc_otg: set ep's desc during enable/disable

2022-01-08 Thread Tom Rini
On Thu, Jan 06, 2022 at 04:02:08PM +0100, Gary Bisson wrote:

> Fastboot support has been broken on platforms using dwc2 controller
> since the gadget gets its max packet size from it.
> This patch is the equivalent of 723fd5668ff which fixed the same issue
> but for the chipidea controller.
> 
> Fixes: 27c9141b111 ("usb: gadget: fastboot: use correct max packet size")
> 
> Signed-off-by: Gary Bisson 
> Reviewed-by: Neil Armstrong 
> Tested-by: Mattijs Korpershoek 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] nitrogen6x: add missing pinctrl to fix mmc

2022-01-08 Thread Tom Rini
On Wed, Jan 05, 2022 at 02:17:53PM +0100, Gary Bisson wrote:

> Since commit f7ac30b042d, the pin muxing for mmc was removed from the
> board file to be managed by DM_MMC which requires PINCTRL to work. It
> made the change for sabrelite but nitrogen configs were forgotten.
> 
> Signed-off-by: Gary Bisson 
> Reviewed-by: Fabio Estevam 
> Acked-by: Troy Kisky 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 6/6] udoo: Select CMD_DM

2022-01-08 Thread Tom Rini
On Sat, Dec 18, 2021 at 06:10:25PM -0300, Fabio Estevam wrote:

> CMD_DM is useful for showing the whole DM tree.
> 
> Enable it via "imply CMD_DM".
> 
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Peter Robinson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 5/6] udoo: Increase CONFIG_ENV_OFFSET

2022-01-08 Thread Tom Rini
On Sat, Dec 18, 2021 at 06:10:24PM -0300, Fabio Estevam wrote:

> Increase CONFIG_ENV_OFFSET to avoid the environment region to
> overlap with U-Boot proper. 
> 
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Peter Robinson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 4/6] udoo: Adjust the SD card device numbering

2022-01-08 Thread Tom Rini
On Sat, Dec 18, 2021 at 06:10:23PM -0300, Fabio Estevam wrote:

> After the conversion to DM the SD card shows up as 'mmc 2'
> device.
> 
> Adjust the 'mmcdev' and the distro command 'func' accordingly.
> 
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Peter Robinson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 3/6] udoo: Call gpio_request()

2022-01-08 Thread Tom Rini
On Sat, Dec 18, 2021 at 06:10:22PM -0300, Fabio Estevam wrote:

> Calling gpio_request() prior to its usage is now mandatory.
> 
> This fixes the following GPIO errors:
> 
> U-Boot SPL 2022.01-rc3-00067-g7a5be871c0ec (Dec 18 2021 - 17:45:07 -0300) 
>   
> Trying to boot from MMC1  
>   
>   
>   
>   
>   
> U-Boot 2022.01-rc3-00067-g7a5be871c0ec (Dec 18 2021 - 17:45:07 -0300) 
>   
>   
>   
> CPU:   Freescale i.MX6Q rev1.2 at 792 MHz 
>   
> Reset cause: WDOG 
>   
> Model: Udoo i.MX6 Quad Board  
>   
> Board: Udoo Quad  
>   
> DRAM:  1 GiB  
>   
> MMC:   FSL_SDHC: 2
>   
> Loading Environment from MMC... OK
>   
> In:serial 
>   
> Out:   serial 
>   
> Err:   serial 
>   
> gpio@20a: set_dir_flags: error: gpio GPIO2_31 not reserved
>   
> gpio@20a4000: set_dir_flags: error: gpio GPIO3_23 not reserved
>   
> gpio@20b: set_dir_flags: error: gpio GPIO6_24 not reserved
>   
> gpio@20b: set_dir_flags: error: gpio GPIO6_25 not reserved
>   
> gpio@20b: set_dir_flags: error: gpio GPIO6_27 not reserved
>   
> gpio@20b: set_dir_flags: error: gpio GPIO6_28 not reserved
>   
> gpio@20b: set_dir_flags: error: gpio GPIO6_29 not reserved
>   
> gpio@20a4000: set_value: error: gpio GPIO3_23 not reserved
>   
> Net:   Could not get PHY for FEC0: addr -2
>   
> No ethernet found.  
> 
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Peter Robinson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 2/6] ARM: dts: imx6qdl-udoo: Properly describe the SD card detect

2022-01-08 Thread Tom Rini
On Sat, Dec 18, 2021 at 06:10:21PM -0300, Fabio Estevam wrote:

> GPIO7_IO00 is used as SD card detect.
> 
> Properly describe this in the devicetree.
> 
> Signed-off-by: Fabio Estevam 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/6] udoo_spl: Initialize the eSDHC controller in SPL

2022-01-08 Thread Tom Rini
On Sat, Dec 18, 2021 at 06:10:20PM -0300, Fabio Estevam wrote:

> Currently, imx6q udoo board fails to boot like this:
> 
> U-Boot SPL 2022.01-rc3-00061-g95ca715adad3 (Dec 18 2021 - 18:04:40 -0300)
> Trying to boot from MMC1
> 
> The reason is that the eSDHC controller is not initialized in SPL.
> 
> Initialize the eSDHC controller in SPL via C code as DM is not
> used in SPL.
> 
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Peter Robinson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Un-clean scripts/dtc causing buildman failure

2022-01-08 Thread Marcel Ziswiler
Hi Simon

On Sat, 2022-01-08 at 07:54 -0700, Simon Glass wrote:
> Hi Marcel,
> 
> On Sat, 8 Jan 2022 at 07:22, Marcel Ziswiler  wrote:
> > 
> > Hi Simon et al.
> > 
> > Somehow doing an mrproper does not seem to clean intermediate file in 
> > scripts/dtc:
> > 
> > ⬢[zim@toolbox u-boot.git]$ make mrproper
> > ⬢[zim@toolbox u-boot.git]$ git status --ignored scripts/dtc
> > On branch master
> > Your branch is up to date with 'origin/master'.
> > 
> > Ignored files:
> >   (use "git add -f ..." to include in what will be committed)
> >     scripts/dtc/dtc
> >     scripts/dtc/pylibfdt/libfdt.i
> >     scripts/dtc/pylibfdt/libfdt.py
> >     scripts/dtc/pylibfdt/libfdt_wrap.c
> > 
> > nothing to commit, working tree clean
> > 
> > Unfortunately later running buildman off such a tree than fails:
> > 
> > ⬢[zim@toolbox u-boot.git]$ tools/buildman/buildman verdin-imx8mm
> > Building current source for 1 boards (1 thread, 16 jobs per thread)
> >    aarch64:  +   verdin-imx8mm
> > +/usr/bin/which: no dtc in (./scripts/dtc)
> > +Unable to find file 'scripts/dtc/pylibfdt/libfdt.i'.
> > +error: command '/usr/bin/swig' failed with exit code 1
> > +make[3]: *** [scripts/dtc/pylibfdt/Makefile:30: rebuild] Error 1
> > +make[2]: *** [scripts/Makefile.build:394: scripts/dtc/pylibfdt] Error 2
> > +make[1]: *** [Makefile:1970: scripts_dtc] Error 2
> > +make: *** [Makefile:177: sub-make] Error 2
> >     0    0    1 /1  verdin-imx8mm
> > Completed: 1 total built, duration 0:00:05, rate 0.20
> > 
> > Is this a known issue? Shouldn't a mrproper also clean such intermediate 
> > files?
> 
> Yes, that seems like a bug.

I had a look at it but, unfortunately, I am not too proficient with U-Boot's 
Makefile stuff. What I found out
is that scripts/dtc/pylibfdt/Makefile actually ads them all to clean-files. 
However, I guess that is never
actually used anywhere at least in U-Boot and upstream libfdt seems to have 
changed considerably in that area.

Anyway, the root Makefile has a whole section about cleaning plus there is also 
a scripts/Makefile.clean.
However, I can't quite figure out how this all works together.

> > BTW: Any news on getting that libfdt stuff updated to work with latest 
> > tooling (e.g. as used in Fedora 35)?
> 
> Can you give me more detail on this?

Sorry, I thought I inquired about this once before. This is what I am talking 
about:

⬢[zim@toolbox u-boot.git]$ cat /etc/fedora-release 
Fedora release 35 (Thirty Five)
⬢[zim@toolbox u-boot.git]$ tools/buildman/buildman verdin-imx8mm
Building current source for 1 boards (1 thread, 16 jobs per thread)
   aarch64:  w+   verdin-imx8mm 
+/usr/bin/which: no dtc in (./scripts/dtc)
+scripts/dtc/pylibfdt/setup.py:21: DeprecationWarning: The distutils package is 
deprecated and slated for
removal in Python 3.12. Use setuptools or check PEP 632 for potential 
alternatives
+  from distutils.core import setup, Extension
+tools/binman/binman:12: DeprecationWarning: The distutils package is 
deprecated and slated for removal in
Python 3.12. Use setuptools or check PEP 632 for potential alternatives
+  from distutils.sysconfig import get_python_lib
+tools/binman/binman:12: DeprecationWarning: The distutils.sysconfig module is 
deprecated, use sysconfig
instead
010 /1  verdin-imx8mm
Completed: 1 total built, duration 0:00:16, rate 0.06

> Regards,
> Simon

Cheers

Marcel


Re: [PATCH] mtd: spi-nor-ids: Add support for W25Q512JV

2022-01-08 Thread Dhananjay Phadke

On 1/8/2022 1:39 PM, Dhananjay Phadke wrote:

Add support for Winbond W25Q512JV 64MB SPI NOR flash.

https://www.digikey.com/en/product-highlight/w/winbond/w25q512jv-512-mb-serial-flash-memory

Signed-off-by: Dhananjay Phadke 
---
  drivers/mtd/spi/spi-nor-ids.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index b551ebd75e..017b165141 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -355,6 +355,11 @@ const struct flash_info spi_nor_ids[] = {
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
+   {
+   INFO("w25q512jv", 0xef7020, 0, 64 * 1024, 1024,
+   SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+   SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+   },
{
INFO("w25q01jv", 0xef4021, 0, 64 * 1024, 2048,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |


Will send v2 to use "w25q512jvm" name to be consistent with other DTR parts.

Regards,
Dhananjay


[PATCH] Enable RaspberryPi arm64 to netboot a compressed kernel image

2022-01-08 Thread Georg Gast

This changes add
 - kernel_comp_addr_r=0x080
 - kernel_comp_size=0x080
to the default environment of the raspberry pi. With these two options
u-boot can uncompress a received compressed kernel and boot it.

I could just test these changes on raspberry pi 4B with 8GB of ram.

See the attached logs.

U-Boot 2021.10-dirty (Jan 08 2022 - 05:57:42 +0100)

DRAM:  7.9 GiB
RPI 4 Model B (0xd03114)
MMC:   mmc@7e30: 0, mmc@7e34: 1
Loading Environment from FAT... Card did not respond to voltage select! 
: -110

In:serial
Out:   vidconsole
Err:   vidconsole
Net:   eth0: ethernet@7d58
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus usb@7e98: USB DWC2
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus usb@7e98 for devices... 1 USB Device(s) found
scanning bus xhci_pci for devices... Failed to get keyboard state from 
device 1997:2433

2 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
U-Boot> setenv boot_targets "dhcp pxe"
U-Boot> boot

georg@rpi64-test:~$ dmesg
[0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
[0.00] Linux version 5.15.10-rt24-v8 (georg@hammerhead) 
(aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU 
Binutils for Debian) 2.35.2) #1 SMP PREEMPT_RT Wed Jan 5 21:06:46 CET 2022

[0.00] Machine model: Raspberry Pi 4 Model B Rev 1.4
[0.00] efi: UEFI not found.
[0.00] Reserved memory: created CMA memory pool at 
0x3740, size 64 MiB
[0.00] OF: reserved mem: initialized node linux,cma, compatible 
id shared-dma-pool

[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x3fff]
[0.00]   DMA32[mem 0x4000-0x]
[0.00]   Normal   [mem 0x0001-0x0001]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x3b3f]
[0.00]   node   0: [mem 0x4000-0xfbff]
[0.00]   node   0: [mem 0x0001-0x0001]
[0.00] Initmem setup node 0 [mem 
0x-0x0001]

[0.00] percpu: Embedded 27 pages/cpu s73392 r8192 d29008 u110592
[0.00] pcpu-alloc: s73392 r8192 d29008 u110592 alloc=27*4096
[0.00] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[0.00] Detected PIPT I-cache on CPU0
[0.00] CPU features: detected: Spectre-v2
[0.00] CPU features: detected: Spectre-v4
[0.00] CPU features: detected: ARM errata 1165522, 1319367, or 
1530923
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 
2028848
[0.00] Kernel command line: rw console=ttyAMA0,115200u8 
console=tty1 earlyprintk root=/dev/nfs 
nfsroot=192.168.160.19:/srv/netboot/rpi64/rootfs 
ip=192.168.160.42:192.168.160.19:192.168.160.1::rpi64-test.schorsch-tech.de 
nfsrootdebug
[0.00] Unknown kernel command line parameters "earlyprintk 
nfsrootdebug", will be passed to user space.From 41099ae6902a3f48f66cd36b009a2847ec61a5ae Mon Sep 17 00:00:00 2001
From: Georg Gast 
Date: Sat, 8 Jan 2022 06:01:19 +0100
Subject: [PATCH] Enable RaspberryPi arm64 to netboot a compressed kernel
 image.

This changes add
 - kernel_comp_addr_r=0x080
 - kernel_comp_size=0x080
to the default environment of the raspberry pi. With these two options
u-boot can uncompress a received compressed kernel and boot it.

I could just test these changes on raspberry pi 4B with 8GB of ram.

See the attached logs.

U-Boot 2021.10-dirty (Jan 08 2022 - 05:57:42 +0100)

DRAM:  7.9 GiB
RPI 4 Model B (0xd03114)
MMC:   mmc@7e30: 0, mmc@7e34: 1
Loading Environment from FAT... Card did not respond to voltage select! : -110
In:serial
Out:   vidconsole
Err:   vidconsole
Net:   eth0: ethernet@7d58
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus usb@7e98: USB DWC2
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus usb@7e98 for devices... 1 USB Device(s) found
scanning bus xhci_pci for devices... Failed to get keyboard state from device 1997:2433
2 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
U-Boot> setenv boot_targets "dhcp pxe"
U-Boot> boot

georg@rpi64-test:~$ dmesg
[0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
[0.00] Linux version 5.15.10-rt24-v8 (georg@hammerhead) (aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PREEMPT_RT Wed Jan 5 21:06:46 CET 2022
[0.00] Machine model: Raspberry Pi 4 Model B Rev 1.4
[0.00] efi: UEFI not found.
[0.00] Reserved memory: created CMA memory pool at 0x3740, size 64 MiB
[0.00] OF: reserved mem: initialized n

[PATCH] patman: Support absolute and ~user-relative alias files

2022-01-08 Thread Brian Norris
Python doesn't naturally support tilde (~) as a user-home marker in
paths, but git-config does. So we need to resolve it before continuing.

We also shouldn't blindly join the top-level tree with the aliasesfile
path, because it might be an absolute path.

This resolves warnings like the following:

  Warning: Cannot find alias file '/path/to/source/tree/~/.git-email'

Seen when git-config is like:

  $ git config sendemail.aliasesfile
  ~/.git-email

Signed-off-by: Brian Norris 
---

 tools/patman/gitutil.py | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 5e4c1128dcb5..e1ef96df22ec 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -616,9 +616,14 @@ def GetAliasFile():
 """
 fname = command.OutputOneLine('git', 'config', 'sendemail.aliasesfile',
 raise_on_error=False)
-if fname:
-fname = os.path.join(GetTopLevel(), fname.strip())
-return fname
+if not fname:
+return None
+
+fname = os.path.expanduser(fname.strip())
+if os.path.isabs(fname):
+return fname
+
+return os.path.join(GetTopLevel(), fname)
 
 def GetDefaultUserName():
 """Gets the user.name from .gitconfig file.
-- 
2.34.1.575.g55b058a8bb-goog



Code in arch/arm/lib/image.c doing alignment incorrectly?

2022-01-08 Thread Glotzer, John
This is regarding the uboot code in:   
 
cmd/booti.c : booti_start()(caller) 
 
arch/arm/lib/image.c : booti_setup()   (callee)   

The concern is that the alignment calculation is not achieving the intended 
result.

To be brief I will just post small sections from each file/function.

cmd/boot.c : function booti_start()


  ...

  ret = booti_setup(ld, &relocated_addr, &image_size, false);
  if (ret != 0)
return 1;

  /* Handle BOOTM_STATE_LOADOS */
  if (relocated_addr != ld) {
printf("Moving Image from 0x%lx to 0x%lx, end=%lx\n", ld,
   relocated_addr, relocated_addr + image_size);
memmove((void *)relocated_addr, (void *)ld, image_size);
  }

   ...




arch/arm/lib/image.c : function booti_setup() 

 

...

  if (!force_reloc && (le64_to_cpu(ih->flags) & BIT(3)))
dst = image - text_offset;
  else
dst = gd->bd->bi_dram[0].start;

  *relocated_addr = ALIGN(dst, SZ_2M) + text_offset; 

... 




The intent seems to be to put the start of the linux text segment
on a 2MB aligned address. But this code doesn't do this.

Taking a use case from a recent project - consider a case where the initial
address, ld, is 0x8028_ and text offset is 0x8_. Also assuming for this 
discussion
the "if" branch of the logic rather than the "else" branch although a similar 
argument
would apply for that case as well.

This means that when initially loaded the linux text segment would start at
0x8030_  (the start address plus the text offset) which is not 2MB aligned.
But this logic as currently coded will:


1. Subtract 0x8_ from 0x8028_ to get 0x8020_.   

2. Determine that 0x8020_ is 2MB aligned.   
  
3. Not relocate the code.   

4. The result is a text segment that starts at 0x8030_ (not aligned).   


   
Or consider loading at 0x8018_ with text offset 0x8_.   

Here the text segment does start on a 2MB boundary (0x8020_) but this code  
 
would conclude that it does not - it would  
   

   
1. Subtract 0x8_ from 0x8018_ to get 0x8010_.   
   
2. Determine that 0x8010_ is not 2MB aligned.   
  
3. Relocate the code. (in this case to 0x8028_).
4. The result is a text segment that (again) starts at 0x8030_ (not 
aligned).


Should not the order of operations here be reversed? That is to say instead of  
  
Subtract, Align, Add the code should be doing Add, Align, Subtract?

Thanks,

John Glotzer
glot...@amazon.com


Re: [PATCH v2] imx8mq_evk: switch board to use binman for images

2022-01-08 Thread Tom Rini
On Sat, Jan 08, 2022 at 08:18:15PM +, ZHIZHIKIN Andrey wrote:
> Hello Tom,
> 
> > -Original Message-
> > From: U-Boot  On Behalf Of Andrey Zhizhikin
> > Sent: Friday, December 3, 2021 5:18 PM
> > To: u-boot@lists.denx.de
> > Cc: sba...@denx.de; feste...@gmail.com; uboot-...@nxp.com; peng@nxp.com;
> > h...@denx.de; t.rem...@phytec.de; ja...@amarulasolutions.com;
> > marcel.ziswi...@toradex.com; il...@ronetix.at; xypron.g...@gmx.de; Andrey
> > Zhizhikin 
> > Subject: [PATCH v2] imx8mq_evk: switch board to use binman for images
> > 
> > Currently i.MX8MQ EVK board still targeting the old image generation
> > approach for image generation, which relies on the FIT generator that
> > has been dropped from the tree.
> > 
> > Switch the board to use binman instead, which is a standard image
> > generator now.
> > 
> > Update board documentation to correct build command, and advise latest
> > firmware and TF-A versions to use.
> > 
> > NOTE: New image produced by binman does not have Signed HDMI FW support,
> > this has been left on the side and does not interfere with the general
> > boot flow.
> > 
> > Tested on: [i.MX8MQ rev2.0]
> > 
> > Signed-off-by: Andrey Zhizhikin 
> > ---
> > 
> > Changes in V2:
> > - Modify binman and documentation to use single flash.bin file instead
> >   of flash.bin+u-boot.itb combination, suggested by Fabio Estevam.
> 
> Since you've applied similar patch from Peng, this one is not needed
> anymore and can be dropped.
> 
> There are however few pieces that are present in this patch not picked
> up in any other patch like doc update, single flash.bin, etc.
> 
> I saw that Patrick Wildt had "single flash.bin" part submitted in [1],
> which would also be beneficial to have in 2022.01 for consistency, and
> would allow me to update imx8mq_evk machine in meta-freescale Yocto
> layer so it can be finally built with upstream BSP and 2022.01. If you
> can pick it up saw well - that would be ideal!

OK, yes, that's in my testing right now queue.

> The rest I will extract and send as separate patches after 2022.01. 

Thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] mtd: spi-nor-ids: Add support for W25Q512JV

2022-01-08 Thread Dhananjay Phadke
Add support for Winbond W25Q512JV 64MB SPI NOR flash.

https://www.digikey.com/en/product-highlight/w/winbond/w25q512jv-512-mb-serial-flash-memory

Signed-off-by: Dhananjay Phadke 
---
 drivers/mtd/spi/spi-nor-ids.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index b551ebd75e..017b165141 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -355,6 +355,11 @@ const struct flash_info spi_nor_ids[] = {
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
+   {
+   INFO("w25q512jv", 0xef7020, 0, 64 * 1024, 1024,
+   SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+   SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+   },
{
INFO("w25q01jv", 0xef4021, 0, 64 * 1024, 2048,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
-- 
2.25.1



RE: [PATCH v2] imx8mq_evk: switch board to use binman for images

2022-01-08 Thread ZHIZHIKIN Andrey
Hello Tom,

> -Original Message-
> From: U-Boot  On Behalf Of Andrey Zhizhikin
> Sent: Friday, December 3, 2021 5:18 PM
> To: u-boot@lists.denx.de
> Cc: sba...@denx.de; feste...@gmail.com; uboot-...@nxp.com; peng@nxp.com;
> h...@denx.de; t.rem...@phytec.de; ja...@amarulasolutions.com;
> marcel.ziswi...@toradex.com; il...@ronetix.at; xypron.g...@gmx.de; Andrey
> Zhizhikin 
> Subject: [PATCH v2] imx8mq_evk: switch board to use binman for images
> 
> Currently i.MX8MQ EVK board still targeting the old image generation
> approach for image generation, which relies on the FIT generator that
> has been dropped from the tree.
> 
> Switch the board to use binman instead, which is a standard image
> generator now.
> 
> Update board documentation to correct build command, and advise latest
> firmware and TF-A versions to use.
> 
> NOTE: New image produced by binman does not have Signed HDMI FW support,
> this has been left on the side and does not interfere with the general
> boot flow.
> 
> Tested on: [i.MX8MQ rev2.0]
> 
> Signed-off-by: Andrey Zhizhikin 
> ---
> 
> Changes in V2:
> - Modify binman and documentation to use single flash.bin file instead
>   of flash.bin+u-boot.itb combination, suggested by Fabio Estevam.

Since you've applied similar patch from Peng, this one is not needed
anymore and can be dropped.

There are however few pieces that are present in this patch not picked
up in any other patch like doc update, single flash.bin, etc.

I saw that Patrick Wildt had "single flash.bin" part submitted in [1],
which would also be beneficial to have in 2022.01 for consistency, and
would allow me to update imx8mq_evk machine in meta-freescale Yocto
layer so it can be finally built with upstream BSP and 2022.01. If you
can pick it up saw well - that would be ideal!

The rest I will extract and send as separate patches after 2022.01. 

> 
>  arch/arm/dts/imx8mq-evk-u-boot.dtsi   | 124 ++
>  arch/arm/mach-imx/imx8m/Kconfig   |   1 +
>  board/freescale/imx8mq_evk/Kconfig|   2 +-
>  .../imx8mq_evk/imximage-8mq-lpddr4.cfg|   9 ++
>  configs/imx8mq_evk_defconfig  |   2 +-
>  doc/board/nxp/imx8mq_evk.rst  |  21 +--
>  6 files changed, 148 insertions(+), 11 deletions(-)
>  create mode 100644 board/freescale/imx8mq_evk/imximage-8mq-lpddr4.cfg
> 
> diff --git a/arch/arm/dts/imx8mq-evk-u-boot.dtsi b/arch/arm/dts/imx8mq-evk-u-
> boot.dtsi
> index 2cfc12b7e0..e3f780ca75 100644
> --- a/arch/arm/dts/imx8mq-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imx8mq-evk-u-boot.dtsi
> @@ -1,5 +1,129 @@
>  // SPDX-License-Identifier: (GPL-2.0 OR MIT)
> 
> +/ {
> + binman: binman {
> + multiple-images;
> + };
> +};
> +
> +&binman {
> + u-boot-spl-ddr {
> + filename = "u-boot-spl-ddr.bin";
> + pad-byte = <0xff>;
> + align-size = <4>;
> + align = <4>;
> +
> + u-boot-spl {
> + align-end = <4>;
> + };
> +
> + blob_1: blob-ext@1 {
> + filename = "lpddr4_pmu_train_1d_imem.bin";
> + size = <0x8000>;
> + };
> +
> + blob_2: blob-ext@2 {
> + filename = "lpddr4_pmu_train_1d_dmem.bin";
> + size = <0x4000>;
> + };
> +
> + blob_3: blob-ext@3 {
> + filename = "lpddr4_pmu_train_2d_imem.bin";
> + size = <0x8000>;
> + };
> +
> + blob_4: blob-ext@4 {
> + filename = "lpddr4_pmu_train_2d_dmem.bin";
> + size = <0x4000>;
> + };
> + };
> +
> + spl {
> + filename = "spl.bin";
> +
> + mkimage {
> + args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
> 0x7e1000";
> +
> + blob {
> + filename = "u-boot-spl-ddr.bin";
> + };
> + };
> + };
> +
> + itb {
> + filename = "u-boot.itb";
> +
> + fit {
> + description = "Configuration to load ATF before U-Boot";
> + #address-cells = <1>;
> + fit,external-offset = ;
> +
> + images {
> + uboot {
> + description = "U-Boot (64-bit)";
> + type = "standalone";
> + arch = "arm64";
> + compression = "none";
> + load = ;
> +
> + uboot_blob: blob-ext {
> + filename = "u-boot-nodtb.bin";
> + };
> + };
> +
> + atf {
> + description = "

Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp

2022-01-08 Thread Tommaso Merciai
On Tue, Jan 04, 2022 at 11:04:10AM +, Teresa Remmet wrote:
> Hello Tommaso,
> 
> Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
> > This function defined for two architecture is not really generic
> > and can generate problem when people add a new board.
> > 
> > Signed-off-by: Tommaso Merciai 
> > ---
> >  arch/arm/mach-imx/imx8m/soc.c | 39 ---
> > 
> >  1 file changed, 39 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-
> > imx/imx8m/soc.c
> > index 863508776d..f0030a557a 100644
> > --- a/arch/arm/mach-imx/imx8m/soc.c
> > +++ b/arch/arm/mach-imx/imx8m/soc.c
> > @@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs,
> > unsigned int esr)
> >  #endif
> >  
> >  #if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP)
> > -enum env_location env_get_location(enum env_operation op, int prio)
> > -{
> > -   enum boot_device dev = get_boot_device();
> > -   enum env_location env_loc = ENVL_UNKNOWN;
> > -
> > -   if (prio)
> > -   return env_loc;
> > -
> > -   switch (dev) {
> > -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
> > -   case QSPI_BOOT:
> > -   env_loc = ENVL_SPI_FLASH;
> > -   break;
> > -#endif
> > -#ifdef CONFIG_ENV_IS_IN_NAND
> > -   case NAND_BOOT:
> > -   env_loc = ENVL_NAND;
> > -   break;
> > -#endif
> > -#ifdef CONFIG_ENV_IS_IN_MMC
> > -   case SD1_BOOT:
> > -   case SD2_BOOT:
> > -   case SD3_BOOT:
> > -   case MMC1_BOOT:
> > -   case MMC2_BOOT:
> > -   case MMC3_BOOT:
> > -   env_loc =  ENVL_MMC;
> > -   break;
> > -#endif
> > -   default:
> > -#if defined(CONFIG_ENV_IS_NOWHERE)
> > -   env_loc = ENVL_NOWHERE;
> > -#endif
> > -   break;
> > -   }
> > -
> > -   return env_loc;
> > -}
> > -
> >  #ifndef ENV_IS_EMBEDDED
> >  long long env_get_offset(long long defautl_offset)
> 
> would it not make sense to move also env_get_offset() to board level?

Hi Teresa,
I think is better to put this function at board level. In this way
others boards that use i.MX8MN/i.MX8MM SOC can customize env_get_location
function. For example: maybe one user want store U-Boot env on a device
other than the boot device.

Tommaso
> 
> Regards,
> Teresa
> 
> 
> >  {
> -- 
> PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany
> 
> Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber |
> Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE
> 149059855


Re: [PATCH 2/2] udoo: neo: Do not print the Model information

2022-01-08 Thread Tommaso Merciai
On Wed, Jan 05, 2022 at 10:10:03PM +0100, Tommaso Merciai wrote:
> On Wed, Jan 05, 2022 at 05:52:23PM -0300, Fabio Estevam wrote:
> > Hi Tommaso,
> > 
> > On Wed, Jan 5, 2022 at 5:47 PM Tommaso Merciai  
> > wrote:
> > 
> > > Hi Fabio,
> > > Thanks, I test your patch on basic and extended model. Below some logs
> > > seems all work properly. I hope I helped the cause :)
> > 
> > Yes, thanks a lot!

It's a pleasure, nice team work :)
Tommaso

> > 
> > >  - BASIC log:
> > > -
> > > U-Boot 2022.01-rc4-00034-g19f31e718f-dirty (Jan 05 2022 - 21:38:32 +0100)
> > >
> > > CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
> > > CPU:   Extended Commercial temperature grade (-20C to 105C) at 32C
> > > Reset cause: POR
> > > Model: UDOO Neo Basic
> > 
> > I assume you have only applied 1/2 and not 2/2.
> > 
> > With 2/2 applied the Model line should not be printed.
> > 
> > Thanks
> 
> Yes, Fabio. Sorry, I forgot. Below test with 2/2.
> 
> U-Boot 2022.01-rc4-00034-g19f31e718f-dirty (Jan 05 2022 - 22:07:22 +0100)
> 
> CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
> CPU:   Extended Commercial temperature grade (-20C to 105C) at 45C
> Reset cause: POR
> Board: UDOO Neo BASIC
> I2C:   ready
> DRAM:  512 MiB
> PMIC:  PFUZE3000 DEV_ID=0x30 REV_ID=0x11
> MMC:   FSL_SDHC: 1, FSL_SDHC: 2
> Loading Environment from MMC... OK
> In:serial
> Out:   serial
> Err:   serial
> Net:   eth0: ethernet@2188000
> Hit any key to stop autoboot:  0
> 
> 
> U-Boot 2022.01-rc4-00034-g19f31e718f-dirty (Jan 05 2022 - 22:07:22 +0100)
> 
> CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
> CPU:   Extended Commercial temperature grade (-20C to 105C) at 35C
> Reset cause: POR
> Board: UDOO Neo EXTENDED
> I2C:   ready
> DRAM:  1 GiB
> PMIC:  PFUZE3000 DEV_ID=0x30 REV_ID=0x11
> MMC:   FSL_SDHC: 1, FSL_SDHC: 2
> Loading Environment from MMC... OK
> In:serial
> Out:   serial
> Err:   serial
> Net:
> Error: ethernet@2188000 address not set.
> No ethernet found.
> 
> Hit any key to stop autoboot:  0
> 
> Thanks,
> Tommaso


Re: [PATCH v2] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Fabio Estevam

On 08/01/2022 12:34, Patrick Wildt wrote:

All i.MX8MQ boards have been converted to binman, which makes it
necessary to flash both flash.bin and u-boot.itb to get a bootable
system. Prior to the conversion, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the
final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable
binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more
descriptive name for its purpose, and can still be used standalone (for
example, for secure boot purposes).

Also update imx8mq_evk.rst to remove the u-boot.itb copy step.

This is a cherry-pick of 028abfd9b157 ("imx8mm-evk: Generate a single
bootable flash.bin again") adjusted to apply to i.MX8MQ.

Signed-off-by: Patrick Wildt 


Thanks for the updated commit log:

Reviewed-by: Fabio Estevam 

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


Re: [PATCH] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Patrick Wildt
On Sat, Jan 08, 2022 at 12:24:29PM -0300, Fabio Estevam wrote:
> On 08/01/2022 12:16, Patrick Wildt wrote:
> 
> > but it's not only imx8mq_evk.  Tom has merged the patchset that switches
> > *all* i.MX8MQ boards to Binman, which means that this change touches not
> > only imx8mq_evk but all i.MX8MQ boards.  The only thing that is specific
> > to imx8mq_evk is the documentation change.
> 
> Ah, OK. It was not clear when I read the commit log, but I agree now after
> reading your reply.
> 
> > Should I still change it?
> 
> Maybe put in the commit log that all i.MX8MQ boards have been
> converted to binman would avoid some confusion.
> 
> Thanks,
> 
> Fabio Estevam

Ok, I agree that the previous wording as bad. I have sent a v2 *without*
your Reviewed-By tag.  Please have a look and check if you like that
wording better.

Thanks,
Patrick


[PATCH v2] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Patrick Wildt
All i.MX8MQ boards have been converted to binman, which makes it
necessary to flash both flash.bin and u-boot.itb to get a bootable
system. Prior to the conversion, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the
final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable
binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more
descriptive name for its purpose, and can still be used standalone (for
example, for secure boot purposes).

Also update imx8mq_evk.rst to remove the u-boot.itb copy step.

This is a cherry-pick of 028abfd9b157 ("imx8mm-evk: Generate a single
bootable flash.bin again") adjusted to apply to i.MX8MQ.

Signed-off-by: Patrick Wildt 
---
 arch/arm/dts/imx8mq-u-boot.dtsi  | 19 ++-
 arch/arm/mach-imx/imx8m/imximage.cfg |  2 +-
 doc/board/nxp/imx8mq_evk.rst |  1 -
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi
index 2c10e9b645..8a6075c77b 100644
--- a/arch/arm/dts/imx8mq-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-u-boot.dtsi
@@ -50,7 +50,9 @@
};
};
 
-   flash {
+   spl {
+   filename = "spl.bin";
+
mkimage {
args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
 
@@ -119,4 +121,19 @@
};
};
};
+
+   imx-boot {
+   filename = "flash.bin";
+   pad-byte = <0x00>;
+
+   spl: blob-ext@1 {
+   offset = <0x0>;
+   filename = "spl.bin";
+   };
+
+   uboot: blob-ext@2 {
+   offset = <0x57c00>;
+   filename = "u-boot.itb";
+   };
+   };
 };
diff --git a/arch/arm/mach-imx/imx8m/imximage.cfg 
b/arch/arm/mach-imx/imx8m/imximage.cfg
index 9c6eaf0a6d..2a3f959183 100644
--- a/arch/arm/mach-imx/imx8m/imximage.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage.cfg
@@ -8,4 +8,4 @@
 FIT
 BOOT_FROM  sd
 SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
+LOADER u-boot-spl-ddr.bin  0x7e1000
diff --git a/doc/board/nxp/imx8mq_evk.rst b/doc/board/nxp/imx8mq_evk.rst
index 92eeda79aa..aa1ecfb47a 100644
--- a/doc/board/nxp/imx8mq_evk.rst
+++ b/doc/board/nxp/imx8mq_evk.rst
@@ -50,7 +50,6 @@ Burn the flash.bin to MicroSD card offset 33KB:
 .. code-block:: bash
 
$sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc
-   $sudo dd if=u-boot.itb of=/dev/sd[x] bs=1024 seek=384 conv=notrunc
 
 Boot
 
-- 
2.34.1



Re: [PATCH] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Fabio Estevam

On 08/01/2022 12:16, Patrick Wildt wrote:

but it's not only imx8mq_evk.  Tom has merged the patchset that 
switches
*all* i.MX8MQ boards to Binman, which means that this change touches 
not
only imx8mq_evk but all i.MX8MQ boards.  The only thing that is 
specific

to imx8mq_evk is the documentation change.


Ah, OK. It was not clear when I read the commit log, but I agree now 
after

reading your reply.


Should I still change it?


Maybe put in the commit log that all i.MX8MQ boards have been
converted to binman would avoid some confusion.

Thanks,

Fabio Estevam
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-60 Fax: (+49)-8142-66989-80 Email: 
feste...@denx.de


Re: [PATCH] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Patrick Wildt
On Sat, Jan 08, 2022 at 12:10:49PM -0300, Fabio Estevam wrote:
> On 08/01/2022 11:58, Patrick Wildt wrote:
> > After the conversion to binman in commit c1ecd03d90c7 ("imx: imx8mq_evk:
> > switch to binman"), it is necessary to flash both flash.bin and
> > u-boot.itb to get a bootable system. Prior to this commit, only
> > flash.bin was needed.
> > 
> > Such new requirement breaks existing distro mechanisms to generate the
> > final binary because the extra u-boot.itb is now required.
> > 
> > Generate a final flash.bin that can be used again as a single bootable
> > binary to keep the original behavior.
> > 
> > After this change the SPL binary is called spl.bin, which is a more
> > descriptive name for its purpose, and can still be used standalone (for
> > example, for secure boot purposes).
> > 
> > Also update imx8mq_evk.rst to remove the u-boot.itb copy step.
> > 
> > This is a cherry-pick of 028abfd9b157 ("imx8mm-evk: Generate a single
> > bootable flash.bin again") adjusted to apply to i.MX8MQ.
> 
> "apply to imx8mq_evk."
> 
> Also, the subject should be imx8mq_evk: Generate...
> 
> Feel free to resubmit with these two minor changes and keep my Reviewed-by
> tag.
> 
> Thanks,
> 
> Fabio Estevam

Hi,

but it's not only imx8mq_evk.  Tom has merged the patchset that switches
*all* i.MX8MQ boards to Binman, which means that this change touches not
only imx8mq_evk but all i.MX8MQ boards.  The only thing that is specific
to imx8mq_evk is the documentation change.

Should I still change it?

Thanks,
Patrick


Re: [PATCH] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Fabio Estevam

On 08/01/2022 11:58, Patrick Wildt wrote:
After the conversion to binman in commit c1ecd03d90c7 ("imx: 
imx8mq_evk:

switch to binman"), it is necessary to flash both flash.bin and
u-boot.itb to get a bootable system. Prior to this commit, only
flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the
final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable
binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more
descriptive name for its purpose, and can still be used standalone (for
example, for secure boot purposes).

Also update imx8mq_evk.rst to remove the u-boot.itb copy step.

This is a cherry-pick of 028abfd9b157 ("imx8mm-evk: Generate a single
bootable flash.bin again") adjusted to apply to i.MX8MQ.


"apply to imx8mq_evk."

Also, the subject should be imx8mq_evk: Generate...

Feel free to resubmit with these two minor changes and keep my 
Reviewed-by tag.


Thanks,

Fabio Estevam

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


[PATCH v4 2/2] board: mntre: imx8mq: Add MNT Reform 2 board support

2022-01-08 Thread Patrick Wildt
The MNT Reform 2 is a modular DIY laptop.  In its initial version it
is based on the BoundaryDevices i.MX8MQ SoM.  Some parts have been
lifted from BoundaryDevices official U-Boot downstream project.

Signed-off-by: Patrick Wildt 
---
 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi   |   13 +
 arch/arm/mach-imx/imx8m/Kconfig   |7 +
 board/mntre/imx8mq_reform2/Kconfig|   15 +
 board/mntre/imx8mq_reform2/MAINTAINERS|7 +
 board/mntre/imx8mq_reform2/Makefile   |   12 +
 board/mntre/imx8mq_reform2/imx8mq_reform2.c   |  213 
 board/mntre/imx8mq_reform2/lpddr4_timing.c| 1014 +
 .../mntre/imx8mq_reform2/lpddr4_timing_ch2.h  |   95 ++
 board/mntre/imx8mq_reform2/spl.c  |  260 +
 configs/imx8mq_reform2_defconfig  |   85 ++
 include/configs/imx8mq_reform2.h  |  108 ++
 11 files changed, 1829 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
 create mode 100644 board/mntre/imx8mq_reform2/Kconfig
 create mode 100644 board/mntre/imx8mq_reform2/MAINTAINERS
 create mode 100644 board/mntre/imx8mq_reform2/Makefile
 create mode 100644 board/mntre/imx8mq_reform2/imx8mq_reform2.c
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing.c
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing_ch2.h
 create mode 100644 board/mntre/imx8mq_reform2/spl.c
 create mode 100644 configs/imx8mq_reform2_defconfig
 create mode 100644 include/configs/imx8mq_reform2.h

diff --git a/arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi 
b/arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
new file mode 100644
index 00..c38c698794
--- /dev/null
+++ b/arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#include "imx8mq-u-boot.dtsi"
+
+&usdhc1 {
+   mmc-hs400-1_8v;
+};
+
+&usdhc2 {
+   cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
+   sd-uhs-sdr104;
+   sd-uhs-ddr50;
+};
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index d6a869068a..a14c05cdc6 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -46,6 +46,12 @@ config TARGET_IMX8MQ_PHANBELL
select IMX8MQ
select IMX8M_LPDDR4
 
+config TARGET_IMX8MQ_REFORM2
+   bool "imx8mq_reform2"
+   select BINMAN
+   select IMX8MQ
+   select IMX8M_LPDDR4
+
 config TARGET_IMX8MM_EVK
bool "imx8mm LPDDR4 EVK board"
select BINMAN
@@ -173,6 +179,7 @@ source "board/freescale/imx8mp_evk/Kconfig"
 source "board/gateworks/venice/Kconfig"
 source "board/google/imx8mq_phanbell/Kconfig"
 source "board/kontron/sl-mx8mm/Kconfig"
+source "board/mntre/imx8mq_reform2/Kconfig"
 source "board/phytec/phycore_imx8mm/Kconfig"
 source "board/phytec/phycore_imx8mp/Kconfig"
 source "board/ronetix/imx8mq-cm/Kconfig"
diff --git a/board/mntre/imx8mq_reform2/Kconfig 
b/board/mntre/imx8mq_reform2/Kconfig
new file mode 100644
index 00..f9260cb7f5
--- /dev/null
+++ b/board/mntre/imx8mq_reform2/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_IMX8MQ_REFORM2
+
+config SYS_BOARD
+   default "imx8mq_reform2"
+
+config SYS_VENDOR
+   default "mntre"
+
+config SYS_CONFIG_NAME
+   default "imx8mq_reform2"
+
+config IMX_CONFIG
+   default "arch/arm/mach-imx/imx8m/imximage.cfg"
+
+endif
diff --git a/board/mntre/imx8mq_reform2/MAINTAINERS 
b/board/mntre/imx8mq_reform2/MAINTAINERS
new file mode 100644
index 00..946f287ecf
--- /dev/null
+++ b/board/mntre/imx8mq_reform2/MAINTAINERS
@@ -0,0 +1,7 @@
+REFORM2 IMX8MQ BOARD
+M: Lukas F. Hartmann 
+M: Patrick Wildt 
+S: Maintained
+F: board/mntre/imx8mq_reform2/
+F: include/configs/imx8mq_reform2.h
+F: configs/imx8mq_reform2_defconfig
diff --git a/board/mntre/imx8mq_reform2/Makefile 
b/board/mntre/imx8mq_reform2/Makefile
new file mode 100644
index 00..2efd56bb4a
--- /dev/null
+++ b/board/mntre/imx8mq_reform2/Makefile
@@ -0,0 +1,12 @@
+#
+# Copyright 2017 NXP
+#
+# SPDX-License-Identifier:  GPL-2.0+
+#
+
+obj-y += imx8mq_reform2.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
diff --git a/board/mntre/imx8mq_reform2/imx8mq_reform2.c 
b/board/mntre/imx8mq_reform2/imx8mq_reform2.c
new file mode 100644
index 00..f7cb32dd98
--- /dev/null
+++ b/board/mntre/imx8mq_reform2/imx8mq_reform2.c
@@ -0,0 +1,213 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 NXP
+ * Copyright (C) 2018, Boundary Devices 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL  (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
+
+#define WDOG_PAD_CTRL  (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE)
+
+static iomux_v3_cfg_t const wdog_pads[] = {
+   IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDO

[PATCH v4 1/2] arm: dts: imx8mq: add MNT Reform 2

2022-01-08 Thread Patrick Wildt
Device tree taken from Linux v5.16-rc5.

Signed-off-by: Patrick Wildt 
---
 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/imx8mq-mnt-reform2.dts   | 214 
 arch/arm/dts/imx8mq-nitrogen-som.dtsi | 275 ++
 3 files changed, 490 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2.dts
 create mode 100644 arch/arm/dts/imx8mq-nitrogen-som.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b3e2a9c9d7..17d3c8fb43 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -906,6 +906,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
imx8mq-evk.dtb \
imx8mm-beacon-kit.dtb \
imx8mn-beacon-kit.dtb \
+   imx8mq-mnt-reform2.dtb \
imx8mq-phanbell.dtb \
imx8mp-evk.dtb \
imx8mp-phyboard-pollux-rdk.dtb \
diff --git a/arch/arm/dts/imx8mq-mnt-reform2.dts 
b/arch/arm/dts/imx8mq-mnt-reform2.dts
new file mode 100644
index 00..4f2db6197b
--- /dev/null
+++ b/arch/arm/dts/imx8mq-mnt-reform2.dts
@@ -0,0 +1,214 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/*
+ * Copyright 2019-2021 MNT Research GmbH
+ * Copyright 2021 Lucas Stach 
+ */
+
+/dts-v1/;
+
+#include "imx8mq-nitrogen-som.dtsi"
+
+/ {
+   model = "MNT Reform 2";
+   compatible = "mntre,reform2", "boundary,imx8mq-nitrogen8m-som", 
"fsl,imx8mq";
+
+   pcie1_refclk: clock-pcie1-refclk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <1>;
+   };
+
+   reg_main_5v: regulator-main-5v {
+   compatible = "regulator-fixed";
+   regulator-name = "5V";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   reg_main_3v3: regulator-main-3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   reg_main_usb: regulator-main-usb {
+   compatible = "regulator-fixed";
+   regulator-name = "USB_PWR";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   vin-supply = <®_main_5v>;
+   };
+
+   sound {
+   compatible = "fsl,imx-audio-wm8960";
+   audio-cpu = <&sai2>;
+   audio-codec = <&wm8960>;
+   audio-routing =
+   "Headphone Jack", "HP_L",
+   "Headphone Jack", "HP_R",
+   "Ext Spk", "SPK_LP",
+   "Ext Spk", "SPK_LN",
+   "Ext Spk", "SPK_RP",
+   "Ext Spk", "SPK_RN",
+   "LINPUT1", "Mic Jack",
+   "Mic Jack", "MICB",
+   "LINPUT2", "Line In Jack",
+   "RINPUT2", "Line In Jack";
+   model = "wm8960-audio";
+   };
+};
+
+&fec1 {
+   status = "okay";
+};
+
+&i2c3 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_i2c3>;
+   status = "okay";
+
+   wm8960: codec@1a {
+   compatible = "wlf,wm8960";
+   reg = <0x1a>;
+   clocks = <&clk IMX8MQ_CLK_SAI2_ROOT>;
+   clock-names = "mclk";
+   #sound-dai-cells = <0>;
+   };
+
+   rtc@68 {
+   compatible = "nxp,pcf8523";
+   reg = <0x68>;
+   };
+};
+
+&pcie1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_pcie1>;
+   reset-gpio = <&gpio3 23 GPIO_ACTIVE_LOW>;
+   clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>,
+<&clk IMX8MQ_CLK_PCIE2_AUX>,
+<&clk IMX8MQ_CLK_PCIE2_PHY>,
+<&pcie1_refclk>;
+   clock-names = "pcie", "pcie_aux", "pcie_phy", "pcie_bus";
+   status = "okay";
+};
+
+®_1p8v {
+   vin-supply = <®_main_5v>;
+};
+
+®_snvs {
+   vin-supply = <®_main_5v>;
+};
+
+®_arm_dram {
+   vin-supply = <®_main_5v>;
+};
+
+®_dram_1p1v {
+   vin-supply = <®_main_5v>;
+};
+
+®_soc_gpu_vpu {
+   vin-supply = <®_main_5v>;
+};
+
+&sai2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_sai2>;
+   assigned-clocks = <&clk IMX8MQ_CLK_SAI2>;
+   assigned-clock-parents = <&clk IMX8MQ_CLK_25M>;
+   assigned-clock-rates = <2500>;
+   fsl,sai-mclk-direction-output;
+   fsl,sai-asynchronous;
+   status = "okay";
+};
+
+&snvs_rtc {
+   status = "disabled";
+};
+
+&uart2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_uart2>;
+   status = "okay";
+};
+
+&usb3_phy0 {
+   vbus-supply = <®_main_usb>;
+   status = "okay";
+};
+
+&usb3_phy1 {
+   vbus-supply = <®_main_usb>;
+   status = "okay";
+};
+
+&usb_dwc3_0 {
+   dr_mode = "host";
+   status = "okay";
+};
+
+&usb_dwc3_1 {
+   dr_mode = "host";
+   status = "okay"

[PATCH v4 0/2] Add MNT Reform 2 board support

2022-01-08 Thread Patrick Wildt
The MNT Reform 2 is a modular DIY laptop.  In its initial version it
is based on the BoundaryDevices i.MX8MQ SoM.  Some parts have been
lifted from BoundaryDevices official U-Boot downstream project.

This U-Boot patchset supports the serial console, the SD card and
eMMC, Gigabit Ethernet and USB.

Changes since v3:
- Adjusted to Binman changes in main branch.
- Cleaned up environment variables akin to i.MX8MM.
- Added vendor-prefix to device tree filename.
- Provided ramdisk_addr_r.
Changes since v2:
- Switched to Binman.
Changes since v1:
- Synced DTS with files in Linux git repo.
- Added support for USB host ports.

Patrick Wildt (2):
  arm: dts: imx8mq: add MNT Reform 2
  board: mntre: imx8mq: Add MNT Reform 2 board support

 arch/arm/dts/Makefile |1 +
 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi   |   13 +
 arch/arm/dts/imx8mq-mnt-reform2.dts   |  214 
 arch/arm/dts/imx8mq-nitrogen-som.dtsi |  275 +
 arch/arm/mach-imx/imx8m/Kconfig   |7 +
 board/mntre/imx8mq_reform2/Kconfig|   15 +
 board/mntre/imx8mq_reform2/MAINTAINERS|7 +
 board/mntre/imx8mq_reform2/Makefile   |   12 +
 board/mntre/imx8mq_reform2/imx8mq_reform2.c   |  213 
 board/mntre/imx8mq_reform2/lpddr4_timing.c| 1014 +
 .../mntre/imx8mq_reform2/lpddr4_timing_ch2.h  |   95 ++
 board/mntre/imx8mq_reform2/spl.c  |  260 +
 configs/imx8mq_reform2_defconfig  |   85 ++
 include/configs/imx8mq_reform2.h  |  108 ++
 14 files changed, 2319 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2.dts
 create mode 100644 arch/arm/dts/imx8mq-nitrogen-som.dtsi
 create mode 100644 board/mntre/imx8mq_reform2/Kconfig
 create mode 100644 board/mntre/imx8mq_reform2/MAINTAINERS
 create mode 100644 board/mntre/imx8mq_reform2/Makefile
 create mode 100644 board/mntre/imx8mq_reform2/imx8mq_reform2.c
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing.c
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing_ch2.h
 create mode 100644 board/mntre/imx8mq_reform2/spl.c
 create mode 100644 configs/imx8mq_reform2_defconfig
 create mode 100644 include/configs/imx8mq_reform2.h

-- 
2.34.1



Re: [PATCH] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Fabio Estevam

Hi Patrick,

On 08/01/2022 11:58, Patrick Wildt wrote:
After the conversion to binman in commit c1ecd03d90c7 ("imx: 
imx8mq_evk:

switch to binman"), it is necessary to flash both flash.bin and
u-boot.itb to get a bootable system. Prior to this commit, only
flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the
final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable
binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more
descriptive name for its purpose, and can still be used standalone (for
example, for secure boot purposes).

Also update imx8mq_evk.rst to remove the u-boot.itb copy step.

This is a cherry-pick of 028abfd9b157 ("imx8mm-evk: Generate a single
bootable flash.bin again") adjusted to apply to i.MX8MQ.

Signed-off-by: Patrick Wildt 


Thanks for the patch:

Reviewed-by: Fabio Estevam 

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


[PATCH] imx8mq: Generate a single bootable flash.bin again

2022-01-08 Thread Patrick Wildt
After the conversion to binman in commit c1ecd03d90c7 ("imx: imx8mq_evk:
switch to binman"), it is necessary to flash both flash.bin and
u-boot.itb to get a bootable system. Prior to this commit, only
flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the
final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable
binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more
descriptive name for its purpose, and can still be used standalone (for
example, for secure boot purposes).

Also update imx8mq_evk.rst to remove the u-boot.itb copy step.

This is a cherry-pick of 028abfd9b157 ("imx8mm-evk: Generate a single
bootable flash.bin again") adjusted to apply to i.MX8MQ.

Signed-off-by: Patrick Wildt 
---
 arch/arm/dts/imx8mq-u-boot.dtsi  | 19 ++-
 arch/arm/mach-imx/imx8m/imximage.cfg |  2 +-
 doc/board/nxp/imx8mq_evk.rst |  1 -
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi
index 2c10e9b645..8a6075c77b 100644
--- a/arch/arm/dts/imx8mq-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-u-boot.dtsi
@@ -50,7 +50,9 @@
};
};
 
-   flash {
+   spl {
+   filename = "spl.bin";
+
mkimage {
args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
 
@@ -119,4 +121,19 @@
};
};
};
+
+   imx-boot {
+   filename = "flash.bin";
+   pad-byte = <0x00>;
+
+   spl: blob-ext@1 {
+   offset = <0x0>;
+   filename = "spl.bin";
+   };
+
+   uboot: blob-ext@2 {
+   offset = <0x57c00>;
+   filename = "u-boot.itb";
+   };
+   };
 };
diff --git a/arch/arm/mach-imx/imx8m/imximage.cfg 
b/arch/arm/mach-imx/imx8m/imximage.cfg
index 9c6eaf0a6d..2a3f959183 100644
--- a/arch/arm/mach-imx/imx8m/imximage.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage.cfg
@@ -8,4 +8,4 @@
 FIT
 BOOT_FROM  sd
 SIGNED_HDMIsigned_hdmi.bin
-LOADER mkimage.flash.mkimage   0x7e1000
+LOADER u-boot-spl-ddr.bin  0x7e1000
diff --git a/doc/board/nxp/imx8mq_evk.rst b/doc/board/nxp/imx8mq_evk.rst
index 92eeda79aa..aa1ecfb47a 100644
--- a/doc/board/nxp/imx8mq_evk.rst
+++ b/doc/board/nxp/imx8mq_evk.rst
@@ -50,7 +50,6 @@ Burn the flash.bin to MicroSD card offset 33KB:
 .. code-block:: bash
 
$sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc
-   $sudo dd if=u-boot.itb of=/dev/sd[x] bs=1024 seek=384 conv=notrunc
 
 Boot
 
-- 
2.34.1



Re: Un-clean scripts/dtc causing buildman failure

2022-01-08 Thread Simon Glass
Hi Marcel,

On Sat, 8 Jan 2022 at 07:22, Marcel Ziswiler  wrote:
>
> Hi Simon et al.
>
> Somehow doing an mrproper does not seem to clean intermediate file in 
> scripts/dtc:
>
> ⬢[zim@toolbox u-boot.git]$ make mrproper
> ⬢[zim@toolbox u-boot.git]$ git status --ignored scripts/dtc
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Ignored files:
>   (use "git add -f ..." to include in what will be committed)
> scripts/dtc/dtc
> scripts/dtc/pylibfdt/libfdt.i
> scripts/dtc/pylibfdt/libfdt.py
> scripts/dtc/pylibfdt/libfdt_wrap.c
>
> nothing to commit, working tree clean
>
> Unfortunately later running buildman off such a tree than fails:
>
> ⬢[zim@toolbox u-boot.git]$ tools/buildman/buildman verdin-imx8mm
> Building current source for 1 boards (1 thread, 16 jobs per thread)
>aarch64:  +   verdin-imx8mm
> +/usr/bin/which: no dtc in (./scripts/dtc)
> +Unable to find file 'scripts/dtc/pylibfdt/libfdt.i'.
> +error: command '/usr/bin/swig' failed with exit code 1
> +make[3]: *** [scripts/dtc/pylibfdt/Makefile:30: rebuild] Error 1
> +make[2]: *** [scripts/Makefile.build:394: scripts/dtc/pylibfdt] Error 2
> +make[1]: *** [Makefile:1970: scripts_dtc] Error 2
> +make: *** [Makefile:177: sub-make] Error 2
> 001 /1  verdin-imx8mm
> Completed: 1 total built, duration 0:00:05, rate 0.20
>
> Is this a known issue? Shouldn't a mrproper also clean such intermediate 
> files?

Yes, that seems like a bug.

>
> BTW: Any news on getting that libfdt stuff updated to work with latest 
> tooling (e.g. as used in Fedora 35)?

Can you give me more detail on this?

Regards,
Simon


Re: [RFC PATCH v1 05/21] test: hush: Test hush commands list.

2022-01-08 Thread Simon Glass
Hi Francis,

On Fri, 31 Dec 2021 at 09:14, Francis Laniel
 wrote:
>
> This commit ensures behavior of commands separated by ';', '&&' and '||'.

s/ensures/checks/

or maybe verifies?


>
> Signed-off-by: Francis Laniel 
> ---
>  test/hush/Makefile |  1 +
>  test/hush/list.c   | 79 ++
>  2 files changed, 80 insertions(+)
>  create mode 100644 test/hush/list.c

Reviewed-by: Simon Glass 


Re: [RFC PATCH v1 04/21] test: hush: Test hush variable expansion.

2022-01-08 Thread Simon Glass
Hi Francis,

On Fri, 31 Dec 2021 at 09:14, Francis Laniel
 wrote:
>
> This commit ensures shell variables are replaced by their values.
>
> Signed-off-by: Francis Laniel 
> ---
>  test/hush/Makefile |   1 +
>  test/hush/dollar.c | 191 +
>  2 files changed, 192 insertions(+)
>  create mode 100644 test/hush/dollar.c
>
> diff --git a/test/hush/Makefile b/test/hush/Makefile
> index a3c9ae5106..feb4f71956 100644
> --- a/test/hush/Makefile
> +++ b/test/hush/Makefile
> @@ -5,3 +5,4 @@
>
>  obj-y += cmd_ut_hush.o
>  obj-y += if.o
> +obj-y += dollar.o
> diff --git a/test/hush/dollar.c b/test/hush/dollar.c
> new file mode 100644
> index 00..9313d145d6
> --- /dev/null
> +++ b/test/hush/dollar.c
> @@ -0,0 +1,191 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * (C) Copyright 2021
> + * Francis Laniel, Amarula Solutions, francis.lan...@amarulasolutions.com
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static int hush_test_simple_dollar(struct unit_test_state *uts)
> +{
> +   console_record_reset_enable();
> +   ut_assertok(run_command("echo $dollar_foo", 0));
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wformat-zero-length"
> +   /*
> +* Next line is empty as $dollar_foo was not set before, but compiler
> +* complains about the format being empty, so we disable this warning
> +* only for this line.
> +*/
> +   ut_assert_nextline("");
> +#pragma GCC diagnostic pop

You might be able to dp:

ut_assert_nextline("%s", "");

> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command("echo ${dollar_foo}", 0));
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wformat-zero-length"
> +   /*
> +* Next line is empty as $dollar_foo was not set before, but compiler
> +* complains about the format being empty, so we disable this warning
> +* only for this line.
> +*/
> +   ut_assert_nextline("");
> +#pragma GCC diagnostic pop
> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command("dollar_foo=bar", 0));
> +
> +   ut_assertok(run_command("echo $dollar_foo", 0));
> +   ut_assert_nextline("bar");
> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command("echo ${dollar_foo}", 0));
> +   ut_assert_nextline("bar");
> +   ut_assert_console_end();
> +
> +   /*
> +* R is way of giving raw string literals in C++.
> +* It means a "\n" is a R string literal will not be interpreted as 
> line
> +* feed but printed as "\n".
> +* GCC provides it for C as an extension.
> +*/
> +   ut_assertok(run_command(R"(dollar_foo=\$bar)", 0));
> +
> +   ut_assertok(run_command("echo $dollar_foo", 0));
> +   ut_assert_nextline("$bar");
> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command("dollar_foo='$bar'", 0));
> +
> +   ut_assertok(run_command("echo $dollar_foo", 0));
> +   ut_assert_nextline("$bar");
> +   ut_assert_console_end();
> +
> +   ut_asserteq(1, run_command("dollar_foo=bar quux", 0));
> +   /* Next line contains error message. */
> +   ut_assert_skipline();
> +   ut_assert_console_end();
> +
> +   ut_asserteq(1, run_command("dollar_foo='bar quux", 0));
> +   /* Next line contains error message. */
> +   ut_assert_skipline();
> +   ut_assert_console_end();
> +
> +   ut_asserteq(1, run_command(R"(dollar_foo=bar quux")", 0));
> +   /* Two next lines contain error message. */
> +   ut_assert_skipline();
> +   ut_assert_skipline();
> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command(R"(dollar_foo='bar "quux')", 0));
> +
> +   ut_assertok(run_command("echo $dollar_foo", 0));
> +   /*
> +* This one is buggy.
> +* ut_assert_nextline(R"(bar "quux)");
> +* ut_assert_console_end();
> +*
> +* So, let's reset output:
> +*/
> +   console_record_reset_enable();
> +
> +   ut_asserteq(1, run_command(R"(dollar_foo="bar 'quux")", 0));
> +   /* Next line contains error message. */
> +   ut_assert_skipline();
> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command("dollar_foo='bar quux'", 0));
> +   ut_assertok(run_command("echo $dollar_foo", 0));
> +   ut_assert_nextline("bar quux");
> +   ut_assert_console_end();
> +
> +   puts("Beware: this test set local variable dollar_foo and it cannot 
> be unset!");
> +
> +   return 0;
> +}
> +HUSH_TEST(hush_test_simple_dollar, 0);
> +
> +static int hush_test_env_dollar(struct unit_test_state *uts)
> +{
> +   env_set("env_foo", "bar");
> +   console_record_reset_enable();
> +
> +   ut_assertok(run_command("echo $env_foo", 0));
> +   ut_assert_nextline("bar");
> +   ut_assert_console_end();
> +
> +   ut_assertok(run_command("echo ${env_foo}", 0));
> +   ut_asser

Re: [RFC PATCH v1 03/21] test/py: hush_if_test: Remove the test file.

2022-01-08 Thread Simon Glass
On Fri, 31 Dec 2021 at 09:14, Francis Laniel
 wrote:
>
> Commit 9087ab2cc4 ("test/py: hush_if_test: Remove the test file.") translated
> this test to a C test, so this python file is no more needed.
>
> Signed-off-by: Francis Laniel 
> ---
>  test/py/tests/test_hush_if_test.py | 184 -
>  1 file changed, 184 deletions(-)
>  delete mode 100644 test/py/tests/test_hush_if_test.py

Reviewed-by: Simon Glass 


Re: [RFC PATCH v1 02/21] test: hush: Test hush if/else.

2022-01-08 Thread Simon Glass
On Fri, 31 Dec 2021 at 09:14, Francis Laniel
 wrote:
>
> As asked in commit 9c6bf1715f6a ("test/py: hush_if_test: Add tests to cover
> octal/hex values"), this commit translates test_hush_if_test.py to a C test.
>
> Signed-off-by: Francis Laniel 
> ---
>  test/hush/Makefile |   1 +
>  test/hush/if.c | 308 +
>  2 files changed, 309 insertions(+)
>  create mode 100644 test/hush/if.c

Reviewed-by: Simon Glass 


Re: [RFC PATCH v1 01/21] test: Add framework to test hush behavior.

2022-01-08 Thread Simon Glass
Hi Francis,

On Fri, 31 Dec 2021 at 09:14, Francis Laniel
 wrote:
>
> This commit introduces a new subcommand to ut: ut hush.

Introduce a new subcommand...

(we know it is a commit :-)

Please fix for all of your patches.

Also please drop the periods in your commit subjects.

Reviewed-by: Simon Glass 

Regards,
Simon


Re: efi bootmenu

2022-01-08 Thread Simon Glass
Hi Ilias,

On Fri, 7 Jan 2022 at 02:20, Ilias Apalodimas
 wrote:
>
> Hi Mark,
>
> [...]
> >
> > > > Also, keep in mind that BootOrder and Boot only really work if
> > > > there is runtime EFI variable support.  So the boot menu should
> > > > include options to select a device to boot from and use the default
> > > > (removable media) bootloader from the ESP on that device.  And a way
> > > > to make this selection stick!  Pretty much all x86 EFI implementations
> > > > provide functionality like that.  I suppose this could be done by
> > > > populating the EFI variable store with appropriate Boot variables
> > > > and manipulating BootOrder.  But that would make it hard to generalize
> > > > the boot menu to non-EFI boot flows.
> > >
> > > We are talking here about an EFI boot menu. Why do you mention non-EFI?
> >
> > Because Simon did, and I agree with him that U-Boot would be better of
> > with a way to select a boot device that is independent of the boot
> > mechanism.  Suppose that as a user I want to install a Linux distro on
> > my machine.  I copy the installer for that distro to a USB key and I
> > want to boot it.  But my system is set up to boot from eMMC.  U-Boot
> > should make it easy to do a one-off boot from USB without burdening
> > the user with making a choice between EFI and non-EFI boot methods and
> > just pick the boot method that makes the machine boot from the USB
> > key.
>
> The concept here is fine,  but I think we should agree on how we
> implement that.  IMHO Simon's boot series patches is a huge step
> forward compared to the distro_bootcmd.  However EFI has it's own boot
> manager and logic.  So I see two ways forward:
> 1.  Simon's bootmethod has an abstract entry called 'EFI' or something
> similar.  In that case we just invoke the efi bootmgr.
> 2.  We merge the efibootmgr code into Simon's patches.
>
> But isn't that orthogonal to the current discussion?  We can just go
> implement it for EFI now and then wire it up to whatever Simon does.

Just one tweak here...I think the concept of a boot device (bootdev)
could be useful as a way for EFI to find boot devices, so that U-Boot
and EFI can share this logic / configuration.

Regards,
Simon


Re: [EXT] Re: [PATCH v7 01/15] crypto/fsl: Add support for CAAM Job ring driver model

2022-01-08 Thread Simon Glass
Hi Gaurav,

On Thu, 6 Jan 2022 at 22:54, Gaurav Jain  wrote:
>
> Hi
>
> > -Original Message-
> > From: Simon Glass 
> > Sent: Tuesday, December 28, 2021 2:02 PM
> > To: Gaurav Jain 
> > Cc: U-Boot Mailing List ; Stefano Babic
> > ; Fabio Estevam ; Peng Fan
> > ; Priyanka Jain ; Ye Li
> > ; Horia Geanta ; Ji Luo
> > ; Franck Lenormand ; Silvano Di
> > Ninno ; Sahil Malhotra ;
> > Pankaj Gupta ; Varun Sethi ; dl-
> > uboot-imx ; Shengzhou Liu ;
> > Mingkai Hu ; Rajesh Bhagat ;
> > Meenakshi Aggarwal ; Wasim Khan
> > ; Alison Wang ; Pramod
> > Kumar ; Andy Tang ;
> > Adrian Alonso ; Vladimir Oltean 
> > Subject: [EXT] Re: [PATCH v7 01/15] crypto/fsl: Add support for CAAM Job 
> > ring
> > driver model
> >
> > Caution: EXT Email
> >
> > Hi Gaurav,
> >
> > On Tue, 7 Dec 2021 at 00:42, Gaurav Jain  wrote:
> > >
> > > added device tree support for job ring driver.
> > > sec is initialized based on job ring information processed from device
> > > tree.
> > >
> > > Signed-off-by: Gaurav Jain 
> > > Reviewed-by: Ye Li 
> > > ---
> > >  drivers/crypto/fsl/jr.c | 323
> > > ++--
> > >  drivers/crypto/fsl/jr.h |  19 +++
> > >  2 files changed, 231 insertions(+), 111 deletions(-)
> > >
> > > diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c index
> > > 22b649219e..441550f348 100644
> > > --- a/drivers/crypto/fsl/jr.c
> > > +++ b/drivers/crypto/fsl/jr.c
> > > @@ -1,7 +1,7 @@
> > >  // SPDX-License-Identifier: GPL-2.0+
> > >  /*
> > >   * Copyright 2008-2014 Freescale Semiconductor, Inc.
> > > - * Copyright 2018 NXP
> > > + * Copyright 2018, 2021 NXP
> > >   *
> > >   * Based on CAAM driver in drivers/crypto/caam in Linux
> > >   */
> > > @@ -11,7 +11,6 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > -#include "fsl_sec.h"
> > >  #include "jr.h"
> > >  #include "jobdesc.h"
> > >  #include "desc_constr.h"
> > > @@ -21,8 +20,11 @@
> > >  #include 
> > >  #include 
> > >  #endif
> > > +#include 
> > >  #include 
> > >  #include 
> > > +#include 
> > > +#include 
> >
> > These should go up one line.
> >
> Ok. Will do in next version.
>
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.de
> > nx.de%2Fwiki%2FU-
> > Boot%2FCodingStyle&data=04%7C01%7Cgaurav.jain%40nxp.com%7C021c
> > 004f07e44d796a7408d9c9dc9e41%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> > C0%7C0%7C637762771646492648%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC
> > 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a
> > mp;sdata=HOzWAz8vqKuavYOZopqZf3iLD5dbenfY2UEF%2BO0h1W4%3D&r
> > eserved=0
> >
> > Re the uclass, this is using MISC. What operations are actually supported? 
> > I am
> > still not sure why this doesn't deserve its own uclass.
> >
> Ioctl operation(caam_jr_ioctl) provided by MISC Uclass is sufficient for this 
> driver.
> I do not see a need for introducing a new Uclass to support this driver.

OK, well we can go with that for now.

>
> >
> > [..]
> >
> > > diff --git a/drivers/crypto/fsl/jr.h b/drivers/crypto/fsl/jr.h index
> > > 1047aa772c..c5e5ed5c26 100644
> > > --- a/drivers/crypto/fsl/jr.h
> > > +++ b/drivers/crypto/fsl/jr.h
> > > @@ -1,6 +1,7 @@
> > >  /* SPDX-License-Identifier: GPL-2.0+ */
> > >  /*
> > >   * Copyright 2008-2014 Freescale Semiconductor, Inc.
> > > + * Copyright 2021 NXP
> > >   *
> > >   */
> > >
> > > @@ -8,7 +9,9 @@
> > >  #define __JR_H
> > >
> > >  #include 
> > > +#include "fsl_sec.h"
> > >  #include "type.h"
> > > +#include 
> > >
> > >  #define JR_SIZE 4
> > >  /* Timeout currently defined as 10 sec */ @@ -35,12 +38,21 @@
> > >  #define JRSLIODN_SHIFT 0
> > >  #define JRSLIODN_MASK  0x0fff
> > >
> > > +#define JRDID_MS_PRIM_DID  BIT(0)
> > > +#define JRDID_MS_PRIM_TZ   BIT(4)
> > > +#define JRDID_MS_TZ_OWNBIT(15)
> > > +
> > >  #define JQ_DEQ_ERR -1
> > >  #define JQ_DEQ_TO_ERR  -2
> > >  #define JQ_ENQ_ERR -3
> >
> > Good idea to put brackets around #defines that are a -ve number.
> Will do in next version.
> >
> > >
> > >  #define RNG4_MAX_HANDLES   2
> > >
> > > +enum {
> > > +   /* Run caam jobring descriptor(in buf) */
> > > +   CAAM_JR_RUN_DESC,
> > > +};
> > > +
> > >  struct op_ring {
> > > caam_dma_addr_t desc;
> > > uint32_t status;
> > > @@ -102,6 +114,13 @@ struct result {
> > > uint32_t status;
> > >  };
> > >
> > > +struct caam_regs {
> > > +   ccsr_sec_t *sec;
> > > +   struct jr_regs *regs;
> > > +   u8 jrid;
> > > +   struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC];
> > > +};
> >
> > Don't forget to comment the structs.
> Will add in next version.
>
> > > +
> > >  void caam_jr_strstatus(u32 status);
> > >  int run_descriptor_jr(uint32_t *desc);
> >
> > and exported functions (normally drivers shouldn't have these).
> Yes I agree. Since run_descriptor_jr() is already in use.
> I am planning a separate patch to move other user of run_descriptor_jr() to 
> caam_jr_ioctl().

OK. But that

Re: [PATCH v3 7/7] arm64: dts: imx8mm-u-boot.dtsi: improve odd blob-ext naming

2022-01-08 Thread Marcel Ziswiler
On Fri, 2022-01-07 at 21:07 -0500, Tom Rini wrote:
> On Sat, Oct 23, 2021 at 01:15:16AM +0200, Marcel Ziswiler wrote:
> 
> > From: Marcel Ziswiler 
> > 
> > Rather than using odd implicit blob-ext naming, explicitly specify the
> > type to be of blob-ext and therefore also simplify the node naming.
> > 
> > Signed-off-by: Marcel Ziswiler 
> > Reviewed-by: Peng Fan 
> 
> This required a bit of hand-applying so please re-check my work, but
> applied to u-boot/master, thanks!

I could actually not spot any difference in this one. So all looks good. Thanks!


Re: [PATCH v3 4/7] arm64: dts: imx8mm: use common binman configuration

2022-01-08 Thread Marcel Ziswiler
On Fri, 2022-01-07 at 21:07 -0500, Tom Rini wrote:
> On Sat, Oct 23, 2021 at 01:15:13AM +0200, Marcel Ziswiler wrote:
> 
> > From: Marcel Ziswiler 
> > 
> > With the move to using binman to generate SPL aka u-boot-spl-ddr.bin and
> > U-Boot proper aka u-boot.itb every board now covers such configuration
> > in its own U-Boot specific device tree include. Move the comon part of
> > that configuration to the common imx8mm-u-boot.dtsi include file.
> > 
> > Signed-off-by: Marcel Ziswiler 
> > Reviewed-by: Peng Fan 
> 
> This required a bit of hand-applying so please re-check my work, but
> applied to u-boot/master, thanks!

Yep, all looks good. This was just caused by Tim's venice stuff now having been 
applied after this series so
for my series to remove his private binman stuff was not required as not yet 
there. And Tim's later patch
already uses the common binman configuration. So finally all is good. Thanks!


Un-clean scripts/dtc causing buildman failure

2022-01-08 Thread Marcel Ziswiler
Hi Simon et al.

Somehow doing an mrproper does not seem to clean intermediate file in 
scripts/dtc:

⬢[zim@toolbox u-boot.git]$ make mrproper
⬢[zim@toolbox u-boot.git]$ git status --ignored scripts/dtc
On branch master
Your branch is up to date with 'origin/master'.

Ignored files:
  (use "git add -f ..." to include in what will be committed)
scripts/dtc/dtc
scripts/dtc/pylibfdt/libfdt.i
scripts/dtc/pylibfdt/libfdt.py
scripts/dtc/pylibfdt/libfdt_wrap.c

nothing to commit, working tree clean

Unfortunately later running buildman off such a tree than fails:

⬢[zim@toolbox u-boot.git]$ tools/buildman/buildman verdin-imx8mm
Building current source for 1 boards (1 thread, 16 jobs per thread)
   aarch64:  +   verdin-imx8mm  
+/usr/bin/which: no dtc in (./scripts/dtc)
+Unable to find file 'scripts/dtc/pylibfdt/libfdt.i'.
+error: command '/usr/bin/swig' failed with exit code 1
+make[3]: *** [scripts/dtc/pylibfdt/Makefile:30: rebuild] Error 1
+make[2]: *** [scripts/Makefile.build:394: scripts/dtc/pylibfdt] Error 2
+make[1]: *** [Makefile:1970: scripts_dtc] Error 2
+make: *** [Makefile:177: sub-make] Error 2
001 /1  verdin-imx8mm
Completed: 1 total built, duration 0:00:05, rate 0.20

Is this a known issue? Shouldn't a mrproper also clean such intermediate files?

BTW: Any news on getting that libfdt stuff updated to work with latest tooling 
(e.g. as used in Fedora 35)?

Cheers

Marcel


Re: [PATCH v2] console: usb: kbd: Limit poll frequency to improve performance

2022-01-08 Thread Peter Robinson
On Wed, Dec 22, 2021 at 11:16 PM Thomas Watson  wrote:
>
> Using the XHCI driver, the function `usb_kbd_poll_for_event` takes
> 30-40ms to run. The exact time is dependent on the polling interval the
> keyboard requests in its descriptor, and likely cannot be significantly
> reduced without major rework to the XHCI driver.
>
> The U-Boot EFI console service sets a timer to poll the keyboard every 5
> microseconds, and this timer is checked every time a block is read off
> disk. The net effect is that, on my system, loading a ~40MiB kernel and
> initrd takes about 62 seconds with a slower keyboard and 53 seconds
> with a faster one, with the vast majority of the time spent polling the
> keyboard.
>
> To solve this problem, this patch adds a 20ms delay between consecutive
> calls to `usb_kbd_poll_for_event`. This is sufficient to reduce the
> total loading time to under half a second for both keyboards, and does
> not impact the perceived keystroke latency.
>
> Signed-off-by: Thomas Watson 
Tested-by: Peter Robinson 

Tested across a handful of devices booting Fedora via UEFI and LGTM.
> ---
> This revision wraps the comment at 80 characters and also should not
> have been corrupted by my e-mail client.
>
>  common/usb_kbd.c | 20 +++-
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
> index afad260d3d..5408c821b4 100644
> --- a/common/usb_kbd.c
> +++ b/common/usb_kbd.c
> @@ -118,7 +118,7 @@ struct usb_kbd_pdata {
>  extern int __maybe_unused net_busy_flag;
>
>  /* The period of time between two calls of usb_kbd_testc(). */
> -static unsigned long __maybe_unused kbd_testc_tms;
> +static unsigned long kbd_testc_tms;
>
>  /* Puts character in the queue and sets up the in and out pointer. */
>  static void usb_kbd_put_queue(struct usb_kbd_pdata *data, u8 c)
> @@ -394,21 +394,31 @@ static int usb_kbd_testc(struct stdio_dev *sdev)
> struct usb_device *usb_kbd_dev;
> struct usb_kbd_pdata *data;
>
> +   /*
> +* Polling the keyboard for an event can take dozens of milliseconds.
> +* Add a delay between polls to avoid blocking activity which polls
> +* rapidly, like the UEFI console timer.
> +*/
> +   unsigned long poll_delay = CONFIG_SYS_HZ / 50;
> +
>  #ifdef CONFIG_CMD_NET
> /*
>  * If net_busy_flag is 1, NET transfer is running,
>  * then we check key-pressed every second (first check may be
>  * less than 1 second) to improve TFTP booting performance.
>  */
> -   if (net_busy_flag && (get_timer(kbd_testc_tms) < CONFIG_SYS_HZ))
> -   return 0;
> -   kbd_testc_tms = get_timer(0);
> +   if (net_busy_flag)
> +   poll_delay = CONFIG_SYS_HZ;
>  #endif
> +
> dev = stdio_get_by_name(sdev->name);
> usb_kbd_dev = (struct usb_device *)dev->priv;
> data = usb_kbd_dev->privptr;
>
> -   usb_kbd_poll_for_event(usb_kbd_dev);
> +   if (get_timer(kbd_testc_tms) >= poll_delay) {
> +   usb_kbd_poll_for_event(usb_kbd_dev);
> +   kbd_testc_tms = get_timer(0);
> +   }
>
> return !(data->usb_in_pointer == data->usb_out_pointer);
>  }
> --
> 2.31.1
>