[PATCH V2] imx: imx93_11x11_evk: using binman to pack images

2022-06-12 Thread Peng Fan (OSS)
From: Peng Fan 

Use BINMAN to generate flash.bin

Signed-off-by: Peng Fan 
---

Based on
https://patchwork.ozlabs.org/project/uboot/cover/20220611132035.32698-1-peng@oss.nxp.com/

 V2:
  Typo correct

 arch/arm/dts/imx93-11x11-evk-u-boot.dtsi |  2 +
 arch/arm/dts/imx93-u-boot.dtsi   | 84 
 arch/arm/mach-imx/Makefile   | 24 +++
 arch/arm/mach-imx/imx9/Kconfig   |  1 +
 arch/arm/mach-imx/imx9/container.cfg | 11 
 arch/arm/mach-imx/imx9/imximage.cfg  | 15 +
 board/freescale/imx93_evk/Kconfig|  6 ++
 7 files changed, 143 insertions(+)
 create mode 100644 arch/arm/dts/imx93-u-boot.dtsi
 create mode 100644 arch/arm/mach-imx/imx9/container.cfg
 create mode 100644 arch/arm/mach-imx/imx9/imximage.cfg

diff --git a/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi 
b/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi
index 6f02b389893..e5912a85ca2 100644
--- a/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright 2022 NXP
  */
 
+#include "imx93-u-boot.dtsi"
+
 / {
wdt-reboot {
compatible = "wdt-reboot";
diff --git a/arch/arm/dts/imx93-u-boot.dtsi b/arch/arm/dts/imx93-u-boot.dtsi
new file mode 100644
index 000..2b6bfd0cb44
--- /dev/null
+++ b/arch/arm/dts/imx93-u-boot.dtsi
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2022 NXP
+ * Peng Fan 
+ */
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+ {
+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_imem_1d_v202201.bin";
+   size = <0x8000>;
+   };
+
+   blob_2: blob-ext@2 {
+   filename = "lpddr4_dmem_1d_v202201.bin";
+   size = <0x4000>;
+   };
+
+   blob_3: blob-ext@3 {
+   filename = "lpddr4_imem_2d_v202201.bin";
+   size = <0x8000>;
+   };
+
+   blob_4: blob-ext@4 {
+   filename = "lpddr4_dmem_2d_v202201.bin";
+   size = <0x4000>;
+   };
+   };
+
+   spl {
+   filename = "spl.bin";
+
+   mkimage {
+   args = "-n spl/u-boot-spl.cfgout -T imx8image -e 
0x2049a000";
+
+   blob {
+   filename = "u-boot-spl-ddr.bin";
+   };
+   };
+   };
+
+   u-boot-container {
+   filename = "u-boot-container.bin";
+
+   mkimage {
+   args = "-n u-boot-container.cfgout -T imx8image -e 0x0";
+
+   blob {
+   filename = "u-boot.bin";
+   };
+   };
+   };
+
+   imx-boot {
+   filename = "flash.bin";
+   pad-byte = <0x00>;
+
+   spl: blob-ext@1 {
+   filename = "spl.bin";
+   offset = <0x0>;
+   align-size = <0x400>;
+   align = <0x400>;
+   };
+
+   uboot: blob-ext@2 {
+   filename = "u-boot-container.bin";
+   };
+   };
+};
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 71ac8e6ffde..2f51226e0d9 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -120,6 +120,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o 
u-boot-dtb.cfgout $(srctre
 else ifeq ($(CONFIG_ARCH_IMX8M), y)
 IMAGE_TYPE := imx8mimage
 DEPFILE_EXISTS := 0
+else ifeq ($(CONFIG_ARCH_IMX9), y)
+IMAGE_TYPE := imx8image
+DEPFILE_EXISTS := 0
 else
 IMAGE_TYPE := imximage
 DEPFILE_EXISTS := 0
@@ -171,6 +174,27 @@ flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE
$(call if_changed,mkimage)
 endif
 
+ifeq ($(CONFIG_ARCH_IMX9), y)
+
+SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE
+
+MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 
$(CONFIG_SPL_TEXT_BASE)
+flash.bin: MKIMAGEOUTPUT = flash.log
+
+spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cpp_cfg)
+
+spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
+
+u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cpp_cfg)
+
+flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE
+   $(call if_changed,mkimage)
+endif
+
 ifeq ($(CONFIG_ARCH_IMX8), y)
 SPL:
 
diff --git a/arch/arm/mach-imx/imx9/Kconfig b/arch/arm/mach-imx/imx9/Kconfig
index 

Re: [PATCH 5/8] mx6memcal: Remove SPL_USB_HOST

2022-06-12 Thread Eric Nelson

Thanks Tom.

On 6/12/22 17:02, Tom Rini wrote:

As this particular platform is intended to be loaded and run a specific
set of routines in SPL, we do not need the ability to further use the
USB as a host device in SPL.  Disable this support.

Cc: Eric Nelson 
Signed-off-by: Tom Rini 
---
Please correct me if I'm wrong here and I'll update the subsequent patch
that lead me to discover this.
---
  configs/mx6memcal_defconfig | 1 -
  1 file changed, 1 deletion(-)

diff --git a/configs/mx6memcal_defconfig b/configs/mx6memcal_defconfig
index a1bc95bb4a1c..021e8a6151ee 100644
--- a/configs/mx6memcal_defconfig
+++ b/configs/mx6memcal_defconfig
@@ -16,7 +16,6 @@ CONFIG_SYS_MEMTEST_START=0x1000
  CONFIG_SYS_MEMTEST_END=0x2000
  CONFIG_SUPPORT_RAW_INITRD=y
  CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_USB_HOST=y
  CONFIG_SPL_WATCHDOG=y
  CONFIG_HUSH_PARSER=y
  CONFIG_SYS_MAXARGS=32


Acked-by: Eric Nelson 


[PATCH] imx: imx93_11x11_evk: using binman to pack images

2022-06-12 Thread Peng Fan (OSS)
From: Peng Fan 

Use BINMAN to generate flash.bin

Signed-off-by: Peng Fan 
---

Based on
https://patchwork.ozlabs.org/project/uboot/cover/20220611132035.32698-1-peng@oss.nxp.com/

 arch/arm/dts/imx93-11x11-evk-u-boot.dtsi |  2 +
 arch/arm/dts/imx93-u-boot.dtsi   | 84 
 arch/arm/mach-imx/Makefile   | 24 +++
 arch/arm/mach-imx/imx9/Kconfig   |  1 +
 arch/arm/mach-imx/imx9/container.cfg | 11 
 arch/arm/mach-imx/imx9/imximage.cfg  | 15 +
 board/freescale/imx93_evk/Kconfig|  6 ++
 7 files changed, 143 insertions(+)
 create mode 100644 arch/arm/dts/imx93-u-boot.dtsi
 create mode 100644 arch/arm/mach-imx/imx9/container.cfg
 create mode 100644 arch/arm/mach-imx/imx9/imximage.cfg

diff --git a/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi 
b/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi
index 6f02b389893..e5912a85ca2 100644
--- a/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright 2022 NXP
  */
 
+#include "imx8mp-u-boot.dtsi"
+
 / {
wdt-reboot {
compatible = "wdt-reboot";
diff --git a/arch/arm/dts/imx93-u-boot.dtsi b/arch/arm/dts/imx93-u-boot.dtsi
new file mode 100644
index 000..2b6bfd0cb44
--- /dev/null
+++ b/arch/arm/dts/imx93-u-boot.dtsi
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2022 NXP
+ * Peng Fan 
+ */
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+ {
+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_imem_1d_v202201.bin";
+   size = <0x8000>;
+   };
+
+   blob_2: blob-ext@2 {
+   filename = "lpddr4_dmem_1d_v202201.bin";
+   size = <0x4000>;
+   };
+
+   blob_3: blob-ext@3 {
+   filename = "lpddr4_imem_2d_v202201.bin";
+   size = <0x8000>;
+   };
+
+   blob_4: blob-ext@4 {
+   filename = "lpddr4_dmem_2d_v202201.bin";
+   size = <0x4000>;
+   };
+   };
+
+   spl {
+   filename = "spl.bin";
+
+   mkimage {
+   args = "-n spl/u-boot-spl.cfgout -T imx8image -e 
0x2049a000";
+
+   blob {
+   filename = "u-boot-spl-ddr.bin";
+   };
+   };
+   };
+
+   u-boot-container {
+   filename = "u-boot-container.bin";
+
+   mkimage {
+   args = "-n u-boot-container.cfgout -T imx8image -e 0x0";
+
+   blob {
+   filename = "u-boot.bin";
+   };
+   };
+   };
+
+   imx-boot {
+   filename = "flash.bin";
+   pad-byte = <0x00>;
+
+   spl: blob-ext@1 {
+   filename = "spl.bin";
+   offset = <0x0>;
+   align-size = <0x400>;
+   align = <0x400>;
+   };
+
+   uboot: blob-ext@2 {
+   filename = "u-boot-container.bin";
+   };
+   };
+};
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 71ac8e6ffde..2f51226e0d9 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -120,6 +120,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o 
u-boot-dtb.cfgout $(srctre
 else ifeq ($(CONFIG_ARCH_IMX8M), y)
 IMAGE_TYPE := imx8mimage
 DEPFILE_EXISTS := 0
+else ifeq ($(CONFIG_ARCH_IMX9), y)
+IMAGE_TYPE := imx8image
+DEPFILE_EXISTS := 0
 else
 IMAGE_TYPE := imximage
 DEPFILE_EXISTS := 0
@@ -171,6 +174,27 @@ flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE
$(call if_changed,mkimage)
 endif
 
+ifeq ($(CONFIG_ARCH_IMX9), y)
+
+SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE
+
+MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 
$(CONFIG_SPL_TEXT_BASE)
+flash.bin: MKIMAGEOUTPUT = flash.log
+
+spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cpp_cfg)
+
+spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
+
+u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cpp_cfg)
+
+flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE
+   $(call if_changed,mkimage)
+endif
+
 ifeq ($(CONFIG_ARCH_IMX8), y)
 SPL:
 
diff --git a/arch/arm/mach-imx/imx9/Kconfig b/arch/arm/mach-imx/imx9/Kconfig
index c06102bae07..0b965376987 100644
--- 

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

2022-06-12 Thread Peng Fan (OSS)




在 2022/6/11 20:44, Alper Nebi Yasak 写道:

On 11/06/2022 13:32, Peng Fan (OSS) wrote:

在 2022/6/11 0:47, Alper Nebi Yasak 写道:

I have sent a patch [1] that fixes the build error mentioned here, which
should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8

This not work, BINMAN has been enabled for packing images, but we have
not generated some i.MX binman symbols
for getting exact blob size. So I use binman symbols to get exact blob
size in this patchset.

CONFIG_IS_ENABLED(BINMAN) doesn't work, but IS_ENABLED(CONFIG_BINMAN)
worked for me. I see all 8 symbols in spl/u-boot-spl.sym. I can send you
a git branch if you want?


But now with your suggestion, that means all i.MX8M boards should use 
the i.MX binman symbols, that is not
expected. The i.MX driver code is expected to support w/o i.MX binman 
symbols.


Thanks,
Peng




Thanks,
Peng.


- Drop this patch 7/8




Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

2022-06-12 Thread Peng Fan (OSS)




在 2022/6/11 18:32, Peng Fan (OSS) 写道:


在 2022/6/11 0:47, Alper Nebi Yasak 写道:

On 04/06/2022 14:50, Alper Nebi Yasak wrote:

On 03/06/2022 10:17, Peng Fan (OSS) wrote:

From: Peng Fan 

There is case that CONFIG_BINMAN is defined, but
CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be
build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and
define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

Tested-by: Tim Harvey  #imx8m[m,n,p]-venice
Signed-off-by: Peng Fan 
---
   include/binman_sym.h| 2 +-
   tools/binman/test/Makefile  | 2 +-
   tools/binman/test/generated/autoconf.h  | 3 +++
   tools/binman/test/u_boot_binman_syms.c  | 2 +-
   tools/binman/test/u_boot_binman_syms_size.c | 2 +-
   5 files changed, 7 insertions(+), 4 deletions(-)
   create mode 100644 tools/binman/test/generated/autoconf.h

Reviewed-by: Alper Nebi Yasak 

Looks like I have misunderstood things here a bit. CONFIG_BINMAN enables
you to declare and use symbols. CONFIG_SPL/TPL_BINMAN_SYMBOLS declares
certain symbols ('u_boot_any'). The name is a bit misleading, as if it
enables support for using symbols, and that confused me.

I am not sure, but I think CONFIG_SPL/TPL_BINMAN_SYMBOLS are only for
certain symbols saying u_boot_any.


I mean I not think BINMAN_SYMBOLS are only for certtain symbols.



Maybe Simon could comment?


I have sent a patch [1] that fixes the build error mentioned here, which
should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8

This not work, BINMAN has been enabled for packing images, but we have
not generated some i.MX binman symbols
for getting exact blob size. So I use binman symbols to get exact blob
size in this patchset.

Thanks,
Peng.


- Drop this patch 7/8

Sorry for the confusion.

[1] spl: binman: Fix use of undeclared u_boot_any symbols
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F20220610105806.27177-2-alpernebiyasak%40gmail.com%2Fdata=05%7C01%7Cpeng.fan%40nxp.com%7C4e7220d3cf724ca71a8e08da4b00e7fa%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637904764505471459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=L9jmVdbr1RUL8gKZa8QWwxFnPhmxjW5bYZKwq8eDsH4%3Dreserved=0




RE: [PATCH] intel: n5x: ddr: update license

2022-06-12 Thread Chee, Tien Fong


> -Original Message-
> From: Marek Vasut 
> Sent: Saturday, 11 June, 2022 6:08 PM
> To: Chee, Tien Fong ; u-boot@lists.denx.de
> Cc: Simon Goldschmidt ; Chaplin, Kris
> ; Hea, Kok Kiang ; Kho, Sin
> Hui ; Lokanathan, Raaj ;
> Maniyam, Dinesh 
> Subject: Re: [PATCH] intel: n5x: ddr: update license
> 
> On 6/10/22 13:23, tien.fong.c...@intel.com wrote:
> > From: Tien Fong Chee 
> >
> > All the source code of sdram_n5x.c are from Intel, update the license
> > to use both GPL2.0 and BSD-3 Clause because this copy of code may used
> > for open source and internal project.
> >
> > Signed-off-by: Tien Fong Chee 
> 
> That's still fine, since nobody did any other changes to this driver yet.
> 
> Do you plan to collect those socfpga patches yourself and send a PR for next ?

Yes, that's my next plan after submitting this patch for review.



[PATCH 7/8] Convert CONFIG_USB_MAX_CONTROLLER_COUNT to Kconfig

2022-06-12 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_USB_MAX_CONTROLLER_COUNT

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-ls102xa/config.h   |  1 -
 arch/powerpc/cpu/mpc8xxx/fdt.c   |  4 
 arch/powerpc/include/asm/config_mpc85xx.h| 24 
 common/usb.c |  4 
 configs/P1020RDB-PC_36BIT_NAND_defconfig |  1 +
 configs/P1020RDB-PC_36BIT_SDCARD_defconfig   |  1 +
 configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig |  1 +
 configs/P1020RDB-PC_36BIT_defconfig  |  1 +
 configs/P1020RDB-PC_NAND_defconfig   |  1 +
 configs/P1020RDB-PC_SDCARD_defconfig |  1 +
 configs/P1020RDB-PC_SPIFLASH_defconfig   |  1 +
 configs/P1020RDB-PC_defconfig|  1 +
 configs/P2041RDB_NAND_defconfig  |  1 +
 configs/P2041RDB_SDCARD_defconfig|  1 +
 configs/P2041RDB_SPIFLASH_defconfig  |  1 +
 configs/P2041RDB_defconfig   |  1 +
 configs/P3041DS_NAND_defconfig   |  1 +
 configs/P3041DS_SDCARD_defconfig |  1 +
 configs/P3041DS_SPIFLASH_defconfig   |  1 +
 configs/P3041DS_defconfig|  1 +
 configs/P4080DS_SDCARD_defconfig |  1 +
 configs/P4080DS_SPIFLASH_defconfig   |  1 +
 configs/P4080DS_defconfig|  1 +
 configs/P5040DS_NAND_defconfig   |  1 +
 configs/P5040DS_SDCARD_defconfig |  1 +
 configs/P5040DS_SPIFLASH_defconfig   |  1 +
 configs/P5040DS_defconfig|  1 +
 configs/T1024RDB_NAND_defconfig  |  1 +
 configs/T1024RDB_SDCARD_defconfig|  1 +
 configs/T1024RDB_SPIFLASH_defconfig  |  1 +
 configs/T1024RDB_defconfig   |  1 +
 configs/T1042D4RDB_NAND_defconfig|  1 +
 configs/T1042D4RDB_SDCARD_defconfig  |  1 +
 configs/T1042D4RDB_SPIFLASH_defconfig|  1 +
 configs/T1042D4RDB_defconfig |  1 +
 configs/T2080QDS_NAND_defconfig  |  1 +
 configs/T2080QDS_SDCARD_defconfig|  1 +
 configs/T2080QDS_SECURE_BOOT_defconfig   |  1 +
 configs/T2080QDS_SPIFLASH_defconfig  |  1 +
 configs/T2080QDS_SRIO_PCIE_BOOT_defconfig|  1 +
 configs/T2080QDS_defconfig   |  1 +
 configs/T2080RDB_NAND_defconfig  |  1 +
 configs/T2080RDB_SDCARD_defconfig|  1 +
 configs/T2080RDB_SPIFLASH_defconfig  |  1 +
 configs/T2080RDB_defconfig   |  1 +
 configs/T2080RDB_revD_NAND_defconfig |  1 +
 configs/T2080RDB_revD_SDCARD_defconfig   |  1 +
 configs/T2080RDB_revD_SPIFLASH_defconfig |  1 +
 configs/T2080RDB_revD_defconfig  |  1 +
 configs/T4240RDB_SDCARD_defconfig|  1 +
 configs/T4240RDB_defconfig   |  1 +
 configs/apalis_imx6_defconfig|  1 +
 configs/colibri_imx6_defconfig   |  1 +
 configs/ge_b1x5v2_defconfig  |  1 +
 configs/imx6dl_mamoj_defconfig   |  1 +
 configs/kontron-sl-mx6ul_defconfig   |  1 +
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |  1 +
 configs/lx2160aqds_tfa_defconfig |  1 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig |  1 +
 configs/lx2160ardb_tfa_defconfig |  1 +
 configs/lx2160ardb_tfa_stmm_defconfig|  1 +
 configs/mx6sabreauto_defconfig   |  1 +
 configs/mx6ul_14x14_evk_defconfig|  1 +
 configs/pico-dwarf-imx6ul_defconfig  |  1 +
 configs/pico-dwarf-imx7d_defconfig   |  1 +
 configs/pico-hobbit-imx6ul_defconfig |  1 +
 configs/pico-hobbit-imx7d_defconfig  |  1 +
 configs/pico-imx6ul_defconfig|  1 +
 configs/pico-imx7d_bl33_defconfig|  1 +
 configs/pico-imx7d_defconfig |  1 +
 configs/pico-nymph-imx7d_defconfig   |  1 +
 configs/pico-pi-imx6ul_defconfig |  1 +
 configs/pico-pi-imx7d_defconfig  |  1 +
 configs/variscite_dart6ul_defconfig  |  1 +
 configs/vining_2000_defconfig|  1 +
 drivers/usb/common/fsl-dt-fixup.c|  4 
 drivers/usb/host/Kconfig |  6 +
 drivers/usb/host/ehci-hcd.c  |  4 
 include/configs/apalis_imx6.h|  1 -
 include/configs/cl-som-imx7.h|  1 -
 include/configs/cm_fx6.h |  1 -
 include/configs/colibri-imx6ull.h|  1 -
 include/configs/colibri_imx6.h   |  1 -
 include/configs/colibri_imx7.h   |  1 -
 include/configs/colibri_vf.h |  1 -
 include/configs/dart_6ul.h   |  1 -
 include/configs/db-88f6720.h |  1 -
 include/configs/db-mv784mp-gp.h  |  1 -
 include/configs/dh_imx6.h|  1 -
 include/configs/ge_b1x5v2.h  |  1 -
 include/configs/imx6_logic.h |  1 -
 include/configs/imx6dl-mamoj.h 

[PATCH 8/8] Convert CONFIG_SYS_USB_FAT_BOOT_PARTITION to Kconfig

2022-06-12 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_SYS_USB_FAT_BOOT_PARTITION

Signed-off-by: Tom Rini 
---
 common/spl/Kconfig   | 7 +++
 include/configs/am43xx_evm.h | 6 --
 include/configs/am64x_evm.h  | 2 --
 include/configs/am65x_evm.h  | 2 --
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 42f2c95228a6..3fd564480061 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1317,6 +1317,13 @@ config SPL_USB_STORAGE
  config options. This enables loading from USB using a configured
  device.
 
+config SYS_USB_FAT_BOOT_PARTITION
+   int "Partition on USB to use to load U-Boot from"
+   depends on SPL_USB_STORAGE
+   default 1
+   help
+ Partition on the USB storage device to load U-Boot from
+
 config SPL_USB_GADGET
bool "Suppport USB Gadget drivers"
help
diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index e0138fe1db83..e3a01adae971 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -48,12 +48,6 @@
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550_COM10x44e09000  /* Base EVM has 
UART0 */
 
-/* SPL USB Support */
-
-#if defined(CONFIG_SPL_USB_HOST) || !defined(CONFIG_SPL_BUILD)
-#define CONFIG_SYS_USB_FAT_BOOT_PARTITION  1
-#endif
-
 #ifndef CONFIG_SPL_BUILD
 /* USB Device Firmware Update support */
 #define DFUARGS \
diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
index 6da11b86c4b1..140940730d0e 100644
--- a/include/configs/am64x_evm.h
+++ b/include/configs/am64x_evm.h
@@ -106,6 +106,4 @@
 /* Now for the remaining common defines */
 #include 
 
-#define CONFIG_SYS_USB_FAT_BOOT_PARTITION 1
-
 #endif /* __CONFIG_AM642_EVM_H */
diff --git a/include/configs/am65x_evm.h b/include/configs/am65x_evm.h
index db35af98d9aa..65b0a576a6f4 100644
--- a/include/configs/am65x_evm.h
+++ b/include/configs/am65x_evm.h
@@ -110,8 +110,6 @@
EXTRA_ENV_DFUARGS   \
BOOTENV
 
-#define CONFIG_SYS_USB_FAT_BOOT_PARTITION 1
-
 /* Now for the remaining common defines */
 #include 
 
-- 
2.25.1



[PATCH 3/8] Convert CONFIG_FPGA_STRATIX_V to Kconfig

2022-06-12 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_FPGA_STRATIX_V

Signed-off-by: Tom Rini 
---
 configs/theadorable_debug_defconfig | 1 +
 drivers/fpga/Kconfig| 6 ++
 include/configs/theadorable.h   | 3 ---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/configs/theadorable_debug_defconfig 
b/configs/theadorable_debug_defconfig
index 25eb2e88ec17..d47413c0a911 100644
--- a/configs/theadorable_debug_defconfig
+++ b/configs/theadorable_debug_defconfig
@@ -71,6 +71,7 @@ CONFIG_LBA48=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
 CONFIG_FPGA_ALTERA=y
+CONFIG_FPGA_STRATIX_V=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MVTWSI=y
 # CONFIG_MMC is not set
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index dc0b3dd31b7d..76719517f541 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -21,6 +21,12 @@ config FPGA_SOCFPGA
 
  This provides common functionality for Gen5 and Arria10 devices.
 
+config FPGA_STRATIX_V
+   bool "Enable Stratix V FPGA drivers"
+   depends on FPGA_ALTERA
+   help
+ Say Y here to enable the Altera Stratix V FPGA specific driver.
+
 config FPGA_CYCLON2
bool "Enable Altera FPGA driver for Cyclone II"
depends on FPGA_ALTERA
diff --git a/include/configs/theadorable.h b/include/configs/theadorable.h
index 4f7c9647e292..94e1acd98ba7 100644
--- a/include/configs/theadorable.h
+++ b/include/configs/theadorable.h
@@ -40,9 +40,6 @@
"fdt_high=0x1000\0" \
"initrd_high=0x1000\0"
 
-/* FPGA programming support */
-#define CONFIG_FPGA_STRATIX_V
-
 /*
  * Bootcounter
  */
-- 
2.25.1



[PATCH 2/8] fpga: Remove CONFIG_FPGA_COUNT

2022-06-12 Thread Tom Rini
This define is only currently used in a single board, and always set to
one.  Define this within the board code and remove other references.

Signed-off-by: Tom Rini 
---
 README   | 4 
 board/astro/mcf5373l/fpga.c  | 9 +
 include/configs/astro_mcf5373l.h | 1 -
 include/configs/mx53cx9020.h | 2 --
 include/configs/socfpga_common.h | 7 ---
 5 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/README b/README
index 7649dae36338..6a4db9dc5617 100644
--- a/README
+++ b/README
@@ -1350,10 +1350,6 @@ The following options need to be configured:
Enables support for FPGA family.
(SPARTAN2, SPARTAN3, VIRTEX2, CYCLONE2, ACEX1K, ACEX)
 
-   CONFIG_FPGA_COUNT
-
-   Specify the number of FPGA devices to support.
-
CONFIG_SYS_FPGA_PROG_FEEDBACK
 
Enable printing of hash marks during FPGA configuration.
diff --git a/board/astro/mcf5373l/fpga.c b/board/astro/mcf5373l/fpga.c
index ef82f0660703..50a3830b8573 100644
--- a/board/astro/mcf5373l/fpga.c
+++ b/board/astro/mcf5373l/fpga.c
@@ -168,7 +168,8 @@ Altera_CYC2_Passive_Serial_fns altera_fns = {
altera_post_fn
 };
 
-Altera_desc altera_fpga[CONFIG_FPGA_COUNT] = {
+#define FPGA_COUNT 1
+Altera_desc altera_fpga[FPGA_COUNT] = {
{Altera_CYC2,
 passive_serial,
 85903,
@@ -182,7 +183,7 @@ int astro5373l_altera_load(void)
 {
int i;
 
-   for (i = 0; i < CONFIG_FPGA_COUNT; i++) {
+   for (i = 0; i < FPGA_COUNT; i++) {
/*
 * I did not yet manage to get relocation work properly,
 * so set stuff here instead of static initialisation:
@@ -372,7 +373,7 @@ xilinx_spartan3_slave_serial_fns xilinx_fns = {
xilinx_fastwr_config_fn
 };
 
-xilinx_desc xilinx_fpga[CONFIG_FPGA_COUNT] = {
+xilinx_desc xilinx_fpga[FPGA_COUNT] = {
{xilinx_spartan3,
 slave_serial,
 XILINX_XC3S4000_SIZE,
@@ -388,7 +389,7 @@ int astro5373l_xilinx_load(void)
 
fpga_init();
 
-   for (i = 0; i < CONFIG_FPGA_COUNT; i++) {
+   for (i = 0; i < FPGA_COUNT; i++) {
/*
 * I did not yet manage to get relocation work properly,
 * so set stuff here instead of static initialisation:
diff --git a/include/configs/astro_mcf5373l.h b/include/configs/astro_mcf5373l.h
index 9bf6968e8ad9..18e06076a4ab 100644
--- a/include/configs/astro_mcf5373l.h
+++ b/include/configs/astro_mcf5373l.h
@@ -133,7 +133,6 @@
  * it needs non-blocking CFI routines.
  */
 
-#define CONFIG_FPGA_COUNT  1
 #define CONFIG_SYS_FPGA_PROG_FEEDBACK
 #define CONFIG_SYS_FPGA_WAIT   1000
 
diff --git a/include/configs/mx53cx9020.h b/include/configs/mx53cx9020.h
index 1e5df3f7d7ad..f1d751f15a24 100644
--- a/include/configs/mx53cx9020.h
+++ b/include/configs/mx53cx9020.h
@@ -16,8 +16,6 @@
 
 #define CONFIG_MXC_UART_BASE UART2_BASE
 
-#define CONFIG_FPGA_COUNT 1
-
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR  0
 #define CONFIG_SYS_FSL_ESDHC_NUM   2
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 6453ab79527d..10ba2d22ffa7 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -58,13 +58,6 @@
 #define CONFIG_DW_ALTDESCRIPTOR
 #endif
 
-/*
- * FPGA Driver
- */
-#ifdef CONFIG_CMD_FPGA
-#define CONFIG_FPGA_COUNT  1
-#endif
-
 /*
  * L4 OSC1 Timer 0
  */
-- 
2.25.1



[PATCH 5/8] mx6memcal: Remove SPL_USB_HOST

2022-06-12 Thread Tom Rini
As this particular platform is intended to be loaded and run a specific
set of routines in SPL, we do not need the ability to further use the
USB as a host device in SPL.  Disable this support.

Cc: Eric Nelson 
Signed-off-by: Tom Rini 
---
Please correct me if I'm wrong here and I'll update the subsequent patch
that lead me to discover this.
---
 configs/mx6memcal_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/mx6memcal_defconfig b/configs/mx6memcal_defconfig
index a1bc95bb4a1c..021e8a6151ee 100644
--- a/configs/mx6memcal_defconfig
+++ b/configs/mx6memcal_defconfig
@@ -16,7 +16,6 @@ CONFIG_SYS_MEMTEST_START=0x1000
 CONFIG_SYS_MEMTEST_END=0x2000
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
-- 
2.25.1



[PATCH 6/8] common: usb: Update logic for usb.o, usb_hub.o and usb_storage.o

2022-06-12 Thread Tom Rini
Now that we have consistently named symbols to enable USB host or gadget
controller support in SPL or full U-Boot, we do not need to
unconditionally build USB files nor depend on non-SPL symbols to know
when to build these common files.

Signed-off-by: Tom Rini 
---
 common/Makefile | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index 75c24e324927..2ed8672c3ac1 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -23,10 +23,9 @@ obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
 obj-$(CONFIG_PHYLIB) += miiphyutil.o
 
-ifdef CONFIG_USB
-obj-y += usb.o usb_hub.o
+obj-$(CONFIG_USB_HOST) += usb.o usb_hub.o
+obj-$(CONFIG_USB_GADGET) += usb.o usb_hub.o
 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
-endif
 
 # others
 obj-$(CONFIG_CONSOLE_MUX) += iomux.o
@@ -57,13 +56,9 @@ endif
 obj-$(CONFIG_SPL_NET) += miiphyutil.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
 
-ifdef CONFIG_SPL_USB_HOST
-obj-y += usb.o
-obj-y += usb_hub.o
+obj-$(CONFIG_SPL_USB_HOST) += usb.o usb_hub.o
 obj-$(CONFIG_SPL_USB_STORAGE) += usb_storage.o
-else
-obj-$(CONFIG_USB_MUSB_HOST) += usb.o
-endif
+obj-$(CONFIG_SPL_MUSB_NEW) += usb.o
 endif # CONFIG_SPL_BUILD
 
 #others
-- 
2.25.1



[PATCH 1/8] Convert CONFIG_ENV_MIN_ENTRIES et al to Kconfig

2022-06-12 Thread Tom Rini
This converts the following to Kconfig:
   CONFIG_ENV_MIN_ENTRIES
   CONFIG_ENV_MAX_ENTRIES

Cc: Michal Simek 
Signed-off-by: Tom Rini 
---
I'm not 100% sure that what was being done in xilinx_zynqmp.h was
working before this change.  If we _need_ to tweak this value down in
SPL we need to introduce CONFIG_SPL_ENV_{MIN,MAX}_ENTRIES and use
CONFIG_VAL() in the code.
---
 README  |  8 
 configs/clearfog_defconfig  |  1 +
 configs/helios4_defconfig   |  1 +
 env/Kconfig | 16 
 include/configs/clearfog.h  |  2 --
 include/configs/helios4.h   |  2 --
 include/configs/xilinx_zynqmp.h |  5 -
 lib/hashtable.c |  7 ---
 8 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/README b/README
index 841f8ce082c0..7649dae36338 100644
--- a/README
+++ b/README
@@ -1877,14 +1877,6 @@ Configuration Settings:
while unprotecting/erasing/programming. Please only enable
this option if you really know what you are doing.
 
-- CONFIG_ENV_MAX_ENTRIES
-
-   Maximum number of entries in the hash table that is used
-   internally to store the environment settings. The default
-   setting is supposed to be generous and should work in most
-   cases. This setting can be used to tune behaviour; see
-   lib/hashtable.c for details.
-
 - CONFIG_ENV_FLAGS_LIST_DEFAULT
 - CONFIG_ENV_FLAGS_LIST_STATIC
Enable validation of the values given to environment variables when
diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig
index bec36beb8554..1ee0c6637573 100644
--- a/configs/clearfog_defconfig
+++ b/configs/clearfog_defconfig
@@ -50,6 +50,7 @@ CONFIG_CMD_TIME=y
 CONFIG_CMD_MVEBU_BUBT=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_MIN_ENTRIES=128
 CONFIG_ARP_TIMEOUT=200
 CONFIG_NET_RETRY_COUNT=50
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig
index 2a1db65d1bfd..4642eb1ccb25 100644
--- a/configs/helios4_defconfig
+++ b/configs/helios4_defconfig
@@ -51,6 +51,7 @@ CONFIG_CMD_TIME=y
 CONFIG_CMD_MVEBU_BUBT=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_MIN_ENTRIES=128
 CONFIG_ARP_TIMEOUT=200
 CONFIG_NET_RETRY_COUNT=50
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/env/Kconfig b/env/Kconfig
index 2f625b22575a..0aed7aea46bc 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -30,6 +30,22 @@ config ENV_OVERWRITE
  Use this to permit overriding of certain environmental variables
  like Ethernet and Serial
 
+config ENV_MIN_ENTRIES
+   int "Minimum number of entries in the environment hashtable"
+   default 64
+   help
+ Minimum number of entries in the hash table that is used internally
+ to store the environment settings.
+
+config ENV_MAX_ENTRIES
+   int "Maximumm number of entries in the environment hashtable"
+   default 512
+   help
+ Maximum number of entries in the hash table that is used internally
+ to store the environment settings. The default setting is supposed to
+ be generous and should work in most cases. This setting can be used
+ to tune behaviour; see lib/hashtable.c for details.
+
 config ENV_IS_NOWHERE
bool "Environment is not stored"
default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index af04352eda3b..9969269bf2ac 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -18,8 +18,6 @@
  * U-Boot into it.
  */
 
-#define CONFIG_ENV_MIN_ENTRIES 128
-
 /* Environment in MMC */
 /*
  * For SD - reserve 1 LBA for MBR + 1M for u-boot image. The MMC/eMMC
diff --git a/include/configs/helios4.h b/include/configs/helios4.h
index cae20073584c..ff2c50644326 100644
--- a/include/configs/helios4.h
+++ b/include/configs/helios4.h
@@ -18,8 +18,6 @@
  * U-Boot into it.
  */
 
-#define CONFIG_ENV_MIN_ENTRIES 128
-
 /* Environment in MMC */
 /*
  * For SD - reserve 1 LBA for MBR + 1M for u-boot image. The MMC/eMMC
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index 20515b4e26ac..4e71a42cd346 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -207,11 +207,6 @@
 
 /* ATF is my kernel image */
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU)
-# define CONFIG_SPL_HASH
-# define CONFIG_ENV_MAX_ENTRIES10
-#endif
-
 #ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
 # error "Disable CONFIG_SPL_SYS_MALLOC_SIMPLE. Full malloc needs to be used"
 #endif
diff --git a/lib/hashtable.c b/lib/hashtable.c
index ff5ff7263949..90c8465611e9 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -35,13 +35,6 @@
 # include 
 #endif
 
-#ifndefCONFIG_ENV_MIN_ENTRIES  /* minimum number of entries */
-#defineCONFIG_ENV_MIN_ENTRIES 64
-#endif
-#ifndefCONFIG_ENV_MAX_ENTRIES  /* 

[PATCH 4/8] usb: Remove non-DM code in ehci-fsl and xhci

2022-06-12 Thread Tom Rini
The DM_USB migration deadline has passed and this is not used in SPL.
Remove this now unused code.

Signed-off-by: Tom Rini 
---
 drivers/usb/host/ehci-fsl.c |   4 --
 drivers/usb/host/xhci.c | 110 
 2 files changed, 114 deletions(-)

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 82da339fd505..0569dd54fff9 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -25,10 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-#endif
-
 struct ehci_fsl_priv {
struct ehci_ctrl ehci;
fdt_addr_t hcd_base;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ad73ba12e2be..dbeb88afe370 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -37,10 +37,6 @@
 #include 
 #include 
 
-#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-#endif
-
 static struct descriptor {
struct usb_hub_descriptor hub;
struct usb_device_descriptor device;
@@ -115,13 +111,8 @@ static struct descriptor {
},
 };
 
-#if !CONFIG_IS_ENABLED(DM_USB)
-static struct xhci_ctrl xhcic[CONFIG_USB_MAX_CONTROLLER_COUNT];
-#endif
-
 struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev)
 {
-#if CONFIG_IS_ENABLED(DM_USB)
struct udevice *dev;
 
/* Find the USB controller */
@@ -130,9 +121,6 @@ struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev)
 dev = dev->parent)
;
return dev_get_priv(dev);
-#else
-   return udev->controller;
-#endif
 }
 
 /**
@@ -752,13 +740,6 @@ static int _xhci_alloc_device(struct usb_device *udev)
return 0;
 }
 
-#if !CONFIG_IS_ENABLED(DM_USB)
-int usb_alloc_device(struct usb_device *udev)
-{
-   return _xhci_alloc_device(udev);
-}
-#endif
-
 /*
  * Full speed devices may have a max packet size greater than 8 bytes, but the
  * USB core doesn't know that until it reads the first 8 bytes of the
@@ -1267,95 +1248,6 @@ static int xhci_lowlevel_stop(struct xhci_ctrl *ctrl)
return 0;
 }
 
-#if !CONFIG_IS_ENABLED(DM_USB)
-int submit_control_msg(struct usb_device *udev, unsigned long pipe,
-  void *buffer, int length, struct devrequest *setup)
-{
-   struct usb_device *hop = udev;
-
-   if (hop->parent)
-   while (hop->parent->parent)
-   hop = hop->parent;
-
-   return _xhci_submit_control_msg(udev, pipe, buffer, length, setup,
-   hop->portnr);
-}
-
-int submit_bulk_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
-   int length)
-{
-   return _xhci_submit_bulk_msg(udev, pipe, buffer, length);
-}
-
-int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
-  int length, int interval, bool nonblock)
-{
-   return _xhci_submit_int_msg(udev, pipe, buffer, length, interval,
-   nonblock);
-}
-
-/**
- * Intialises the XHCI host controller
- * and allocates the necessary data structures
- *
- * @param indexindex to the host controller data structure
- * Return: pointer to the intialised controller
- */
-int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
-{
-   struct xhci_hccr *hccr;
-   struct xhci_hcor *hcor;
-   struct xhci_ctrl *ctrl;
-   int ret;
-
-   *controller = NULL;
-
-   if (xhci_hcd_init(index, , (struct xhci_hcor **)) != 0)
-   return -ENODEV;
-
-   if (xhci_reset(hcor) != 0)
-   return -ENODEV;
-
-   ctrl = [index];
-
-   ctrl->hccr = hccr;
-   ctrl->hcor = hcor;
-
-   ret = xhci_lowlevel_init(ctrl);
-
-   if (ret) {
-   ctrl->hccr = NULL;
-   ctrl->hcor = NULL;
-   } else {
-   *controller = [index];
-   }
-
-   return ret;
-}
-
-/**
- * Stops the XHCI host controller
- * and cleans up all the related data structures
- *
- * @param indexindex to the host controller data structure
- * Return: none
- */
-int usb_lowlevel_stop(int index)
-{
-   struct xhci_ctrl *ctrl = (xhcic + index);
-
-   if (ctrl->hcor) {
-   xhci_lowlevel_stop(ctrl);
-   xhci_hcd_stop(index);
-   xhci_cleanup(ctrl);
-   }
-
-   return 0;
-}
-#endif /* CONFIG_IS_ENABLED(DM_USB) */
-
-#if CONFIG_IS_ENABLED(DM_USB)
-
 static int xhci_submit_control_msg(struct udevice *dev, struct usb_device 
*udev,
   unsigned long pipe, void *buffer, int length,
   struct devrequest *setup)
@@ -1546,5 +1438,3 @@ struct dm_usb_ops xhci_usb_ops = {
.update_hub_device = xhci_update_hub_device,
.get_max_xfer_size  = xhci_get_max_xfer_size,
 };
-
-#endif
-- 
2.25.1



[PATCH v2 14/14] doc: Add man page for dumpimage

2022-06-12 Thread Sean Anderson
This tool seems a bit underloved. Unfortunately, it seems to be missing
support for FIT images. Alas...

Add a man page documenting it. The example is taken from commit a804b5ce2d
("Add dumpimage, a tool to extract data from U-Boot images").

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Ensure comments are requests

 doc/dumpimage.1 | 103 
 1 file changed, 103 insertions(+)
 create mode 100644 doc/dumpimage.1

diff --git a/doc/dumpimage.1 b/doc/dumpimage.1
new file mode 100644
index 00..52a45a3404
--- /dev/null
+++ b/doc/dumpimage.1
@@ -0,0 +1,103 @@
+.\" SPDX-License-Identifier: GPL-2.0
+.\" Copyright (C) 2022 Sean Anderson 
+.TH DUMPIMAGE 1 2022-06-11 U-Boot
+.SH NAME
+dumpimage \- extract data from U-Boot images
+.
+.SH SYNOPSIS
+.SY dumpimage
+.OP \-T type
+.BI \-l\~ image
+.YS
+.SY dumpimage
+.OP \-T type
+.OP \-p position
+.BI \-o\~ outfile
+.I image
+.YS
+.SY dumpimage
+.B \-h
+.YS
+.SY dumpimage
+.B \-V
+.YS
+.
+.SH DESCRIPTION
+.B dumpimage
+lists and extracts data from U-Boot images. If
+.B \-l
+is specified,
+.B dumpimage
+lists the components in
+.IR image .
+Otherwise,
+.B dumpimage
+extracts the component at
+.IR position " to " outfile .
+.
+.SH OPTIONS
+.TP
+.B \-h
+Print usage information and exit.
+.
+.TP
+.B \-l
+Print the header information for
+.IR image ,
+including a list of components.
+.
+.TP
+.BI \-o " outfile"
+The file to write the dumped component to.
+.TP
+.BI \-p " position"
+Specify the
+.I position
+of the component to dump. This should be a numeric index, starting at 0. If not
+specified, the default
+.I position
+is 0.
+.
+.TP
+.BI \-T " type"
+Specify the
+.I type
+of the image. If not specified, the image type will be automatically detected. 
A
+list of supported image types may be printed by running
+.BR "mkimage\~\-T\~list" .
+.
+.TP
+.B \-V
+Print version information and exit.
+.
+.SH BUGS
+Please report bugs to the
+.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
+U-Boot bug tracker
+.UE .
+.SH EXAMPLES
+Create a multi-file image and then extract part of that image
+.PP
+.EX
+.in +4
+$ \c
+.B mkimage \-A x86 \-O linux \-T multi \-n x86 \&
+.in +4
+.B \-d vmlinuz:initrd.img:System.map multi.img
+.in
+Image Name:   x86
+Created:  Thu Jul 25 10:29:13 2013
+Image Type:   Intel x86 Linux Multi-File Image (gzip compressed)
+Data Size:13722956 Bytes = 13401.32 kB = 13.09 MB
+Load Address: 
+Entry Point:  
+Contents:
+   Image 0: 4040128 Bytes = 3945.44 kB = 3.85 MB
+   Image 1: 7991719 Bytes = 7804.41 kB = 7.62 MB
+   Image 2: 1691092 Bytes = 1651.46 kB = 1.61 MB
+$ \c
+.B dumpimage -p 2 -o System.map multi.img
+.EE
+.in
+.SH SEE ALSO
+.BR mkimage (1)
-- 
2.35.1



[PATCH v2 13/14] doc: mkimage: Further document -o and -R

2022-06-12 Thread Sean Anderson
Despite the original description of these options, they are not always
image names, or even files. Some image types use these options to convey
configuration directly. Re-document these options as configuration options.

Additionally, add a new section documenting the format of the configuration
for each image type which uses it. In general, if configuration is used
directly (without a separate file) I have added documentation for it. If
the configuration points to a separate file, I have referenced that file's
documentation. Where there is no such documentation, I have added it.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- New

 doc/mkimage.1 | 270 +++---
 1 file changed, 236 insertions(+), 34 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index d48de7e777..4c6b714ec2 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -162,44 +162,22 @@ command will jump to this address after loading the image.
 will be interpreted as a hexadecimal number.
 .
 .TP
-.BI \-n " image-name"
+.BI \-n " primary-configuration"
 .TQ
-.BI \-\-primary\-image " image-name"
-Set the image name to
-.IR image-name .
+.BI \-\-config " primary-configuration"
+Images may require additional configuration not specified with other options,
+often in a image-type-specific format. The image types which support this
+option and the format of their configuration are listed in
+.BR CONFIGURATION .
 .
 .TP
-.BI \-R " secondary-image-name"
+.BI \-R " secondary-configuration"
 .TQ
-.BI \-\-secondary\-image " image-name"
-Some image types support a second image for additional data. For these types,
-use
-.B \-R
-to specify this second image.
-.TS
-allbox;
-lb lbx
-l l.
-Image Type Secondary Image Description
-pblimage   Additional RCW-style header, typically used for PBI commands.
-zynqimage, zynqmpimage T{
-Initialization parameters, one per line. Each parameter has the form
-.sp
-.ti 4
-.I address data
-.sp
-where
-.I address
-and
-.I data
-are hexadecimal integers. The boot ROM will write each
-.I data
-to
-.I address
-when loading the image. At most 256 parameters may be specified in this
-manner.
-T}
-.TE
+.BI \-\-secondary\-config " secondary-configuration"
+Some image types support a second set of configuration data. The image types
+which support secondary configuration and the formap of their configuration are
+listed in
+.BR CONFIGURATION .
 .
 .TP
 .BI \-d " image-data-file"
@@ -428,6 +406,230 @@ using
 But if the original input to mkimage is a binary file (already compiled), then
 the timestamp is assumed to have been set previously.
 .
+.SH CONFIGURATION
+This section documents the formats of the primary and secondary configuration
+options for each image type which supports them.
+.
+.SS aisimage
+The primary configuration is a file containing a series of
+.I AIS
+(Application Image Script) commands, one per line. Each command has the form
+.RS
+.P
+.IR "command argument " .\|.\|.
+.RE
+.P
+See
+.UR https://\:www\:.ti\:.com/\:lit/\:pdf/\:spraag0
+TI application report SPRAAG0E
+.UE
+for details.
+.
+.SS atmelimage
+The primary configuration is a comma-separated list of NAND Flash parameters of
+the form
+.RS
+.P
+\fIparameter\fB=\fIvalue\fR[\fB,\fIparameter\fB=\fIvalue\fR.\|.\|.\&]
+.RE
+.P
+Valid
+.IR parameter s
+are
+.RS
+.P
+.TS
+lb.
+usePmecc
+nbSectorPerPage
+spareSize
+eccBitReq
+sectorSize
+eccOffset
+.TE
+.RE
+.P
+and valid
+.IR value s
+are decimal numbers. See section 11.4.4.1 of the SAMA5D3 Series Data Sheet for
+valid values for each parameter.
+.
+.SS imximage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:imximage.txt of the U-Boot source.
+.
+.SS imx8image and imx8mimage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:imx8image.txt of the U-Boot source.
+.
+.SS kwbimage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:kwbimage.txt of the U-Boot source.
+.
+.SS mtk_image
+The primary configuration is a semicolon-separated list of header options of 
the
+form
+.RS
+.P
+\fIkey\fB=\fIvalue\fR[\fB;\fIkey\fB=\fIvalue\fR.\|.\|.\&]
+.RE
+.P
+where the valid keys are:
+.RS
+.P
+.TS
+lb lbx
+lb l.
+KeyDescription
+_
+lk T{
+If \fB1\fP, then an \fILK\fP (legacy) image header is used. Otherwise, a
+\fIBootROM\fP image header is used.
+T}
+lkname T{
+The name of the LK image header. The maximum length is 32 ASCII characters. If
+not specified, the default value is \fBU-Boot\fP.
+T}
+media  The boot device. See below for valid values.
+nandinfo   The desired NAND device type. See below for valid values.
+arm64  If \fB1\fP, then this denotes an AArch64 image.
+hdroffset  Increase the reported size of the BRLYT header by this amount.
+.TE
+.RE
+.P
+Valid values for
+.B media
+are:
+.RS
+.P
+.TS
+lb lb
+lb l.
+Value  Description
+_
+nand   Parallel NAND flash

[PATCH v2 12/14] mkimage: Add long options

2022-06-12 Thread Sean Anderson
The mkimage command has had many options added over the years.
Unfortunately, we are starting to run out of short options. Recent options
don't have any obvious relation to their meaning (e.g. -o/-g). Fortunately,
long options exist. Add long options for each current short option.

For the curious, the remaining short options are HIkLmMPQSuUwWXyYzZ.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- New

 doc/mkimage.1   | 66 +
 tools/mkimage.c | 45 +++--
 2 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index f2ccb9d464..d48de7e777 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -57,20 +57,28 @@ checksums. It also supports verified boot.
 .
 .TP
 .B \-h
+.TQ
+.B \-\-help
 Print a help message and exit.
 .
 .TP
 .B \-l
+.TQ
+.B \-\-list
 .B mkimage
 lists the information contained in the header of an existing U-Boot image.
 .
 .TP
 .B \-s
+.TQ
+.B \-\-no\-copy
 Don't copy in the image data. Depending on the image type, this may create
 just the header, everything but the image data, or nothing at all.
 .
 .TP
 .BI \-T " image-type"
+.TQ
+.BI \-\-type " image-type"
 Parse image file as
 .IR image-type .
 Pass
@@ -82,26 +90,36 @@ autodetected.
 .
 .TP
 .B \-q
+.TQ
+.B \-\-quiet
 Quiet. Don't print the image header.
 .
 .TP
 .B \-v
+.TQ
+.B \-\-verbose
 Verbose. Print file names as they are added to the image.
 .
 .TP
 .B \-V
+.TQ
+.B \-\-version
 Print version information and exit.
 .
 .SS Options for creating legacy or \(lqauto\(rq images
 .
 .TP
 .BI \-A " architecture"
+.TQ
+.BI \-\-architecture " architecture"
 Set the architecture. Pass
 .B \-h
 as the architecture to see the list of supported architectures.
 .
 .TP
 .BI \-O " os"
+.TQ
+.BI \-\-os " os"
 Set the operating system. The U-Boot
 .I bootm
 command changes boot method based on the OS type.
@@ -113,6 +131,8 @@ to see the list of supported OSs.
 .
 .TP
 .BI \-C " compression-type"
+.TQ
+.BI \-\-compression " compression-type"
 Set the compression type. The image data should have already been compressed
 using this compression type.
 .B mkimage
@@ -125,12 +145,16 @@ to see the list of supported compression types.
 .
 .TP
 .BI \-a " load-address"
+.TQ
+.BI \-\-load\-address " load-address"
 Set the absolute address to load the image data to.
 .I load-address
 will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-e " entry-point"
+.TQ
+.BI \-\-entry\-point " entry-point"
 Set the absolute address of the image entry point. The U-Boot
 .I bootm
 command will jump to this address after loading the image.
@@ -139,11 +163,15 @@ will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-n " image-name"
+.TQ
+.BI \-\-primary\-image " image-name"
 Set the image name to
 .IR image-name .
 .
 .TP
 .BI \-R " secondary-image-name"
+.TQ
+.BI \-\-secondary\-image " image-name"
 Some image types support a second image for additional data. For these types,
 use
 .B \-R
@@ -175,6 +203,8 @@ T}
 .
 .TP
 .BI \-d " image-data-file"
+.TQ
+.BI \-\-image " image-data-file"
 Use image data from
 .IR image-data-file .
 If the
@@ -189,6 +219,8 @@ then multiple images may be specified, separated by colons:
 .
 .TP
 .B \-x
+.TQ
+.B \-\-xip
 Set the
 .I XIP
 (execute in place) flag. The U-Boot
@@ -200,15 +232,21 @@ accessible at the load address (such as via memory-mapped 
flash).
 .
 .TP
 .BI \-b " device-tree-file"
+.TQ
+.BI \-\-device\-tree " device-tree-file"
 Appends the device tree binary file (.dtb) to the FIT.
 .
 .TP
 .BI \-c " comment"
+.TQ
+.BI \-\-comment " comment"
 Specifies a comment to be added when signing. This is typically a message which
 describes how the image was signed or some other useful information.
 .
 .TP
 .BI \-D " dtc-options"
+.TQ
+.BI \-\-dtcopts " dtc-options"
 Provide additional options to the device tree compiler when creating the image.
 See
 .BR dtc (1)
@@ -216,6 +254,8 @@ for documentation of possible options.
 .
 .TP
 .BI \-E
+.TQ
+.BI \-\-external
 After processing, move the image data outside the FIT and store a data offset
 in the FIT. Images will be placed one after the other immediately after the 
FIT,
 with each one aligned to a 4-byte boundary. The existing \(oqdata\(cq property
@@ -225,11 +265,15 @@ properties.  A \(oqdata-offset\(cq of 0 indicates that it 
starts in the first
 .
 .TP
 .BI \-B " alignment"
+.TQ
+.BI \-\-alignment " alignment"
 The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
 .
 .TP
 .BI \-p " external-position"
+.TQ
+.BI \-\-position " external-position"
 Place external data at a static external position. Instead of writing a
 \(oqdata-offset\(cq property defining the offset from the end of the FIT,
 .B \-p
@@ -240,6 +284,8 @@ for details on using external data.
 .
 .TP
 \fB\-f \fIimage-tree-source-file\fR | \fBauto
+.TQ
+\fB\-\-fit \fIimage-tree-source-file\fR | \fBauto
 Image tree source file that 

[PATCH v2 11/14] doc: mkimage: Remove AUTHORS section

2022-06-12 Thread Sean Anderson
Per man-pages(7), "use of an AUTHORS section is strongly discouraged."
Remove it, and instead add some copyright notices and an SPDX. The default
license for U-Boot is GPL2, so that's what I put. The copyright dates are
based on the commit dates.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Ensure comments are requests

 doc/mkimage.1 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 1da2acbaec..f2ccb9d464 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -1,4 +1,9 @@
-.TH MKIMAGE 1 "2022-02-07"
+.\" SPDX-License-Identifier: GPL-2.0
+.\" Copyright (C) 2022 Sean Anderson 
+.\" Copyright (C) 2013-20 Simon Glass 
+.\" Copyright (C) 2010 Nobuhiro Iwamatsu 
+.\" Copyright (C) 2010 Wolfgang Denk 
+.TH MKIMAGE 1 2022-06-11 U-Boot
 .
 .SH NAME
 mkimage \- generate images for U-Boot
@@ -454,11 +459,6 @@ file is required.
 .EE
 .RE
 .
-.PP
-.SH AUTHOR
-This manual page was written by Nobuhiro Iwamatsu 
-and Wolfgang Denk . It was updated for image signing by
-Simon Glass .
 .SH SEE ALSO
 .BR dtc (1),
 .BR dumpimage (1),
-- 
2.35.1



[PATCH v2 08/14] doc: mkimage: Edit options for style and consistency

2022-06-12 Thread Sean Anderson
This makes a variety of changes for the options to make them
typographically consistent, clarify their meaning, and fix grammatical (or
other) errors. Many of the changes here are stylistic, though there are a
few fixes. The main changes I made across the board were:

- All options are bolded and parameters italicised
- All single quotes are properly matched (instead of using apostrophes)
- Minor background info has been added to clarify many underdocument
  options

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Better document multi images
- Fix -B not being bolded in the description for -R
- Italicize parameter for -d
- Make lists of valid algos bold
- Remove spaces around pipes
- Use escape-sequences for options width all three of B/I/R. This renders
  better with mandoc.

 doc/mkimage.1 | 230 +++---
 1 file changed, 163 insertions(+), 67 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 5267e7d22e..f74790c701 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -28,26 +28,23 @@ mkimage \- generate images for U-Boot
 .SH DESCRIPTION
 The
 .B mkimage
-command is used to create images for use with the U-Boot boot loader.
-These images can contain the linux kernel, device tree blob, root file
-system image, firmware images etc., either separate or combined.
+command is used to create images for use with the U-Boot boot loader.  These
+images can contain the Linux kernel, device tree blob, root file system image,
+firmware images etc., either separate or combined.
 .P
 .B mkimage
 supports two different formats:
 .P
-The old
-.I legacy image
-format concatenates the individual parts (for example, kernel image,
-device tree blob and ramdisk image) and adds a 64 bytes header
-containing information about target architecture, operating system,
-image type, compression method, entry points, time stamp, checksums,
-etc.
+The legacy image format concatenates the individual parts (for example, kernel
+image, device tree blob and ramdisk image) and adds a 64 byte header containing
+information about the target architecture, operating system, image type,
+compression method, entry points, time stamp, checksums, etc.
 .P
 The new
-.I FIT (Flattened Image Tree) format
-allows for more flexibility in handling images of various types and also
-enhances integrity protection of images with stronger checksums. It also
-supports verified boot.
+.I FIT
+(Flattened Image Tree) format allows for more flexibility in handling images of
+various types and also enhances integrity protection of images with stronger
+checksums. It also supports verified boot.
 .
 .SH OPTIONS
 .
@@ -59,8 +56,8 @@ Print a help message and exit.
 .
 .TP
 .B \-l
-mkimage lists the information contained in the header of an existing U-Boot
-image.
+.B mkimage
+lists the information contained in the header of an existing U-Boot image.
 .
 .TP
 .B \-s
@@ -69,9 +66,14 @@ just the header, everything but the image data, or nothing 
at all.
 .
 .TP
 .BI \-T " image-type"
-Parse image file as type.
-Pass \-h as the image to see the list of supported image type.
-Without this option image type is autodetected.
+Parse image file as
+.IR image-type .
+Pass
+.B \-h
+as
+.I image-type
+to see the list of supported image types. Without this option, the image type 
is
+autodetected.
 .
 .TP
 .B \-q
@@ -89,35 +91,58 @@ Print version information and exit.
 .
 .TP
 .BI \-A " architecture"
-Set architecture. Pass \-h as the architecture to see the list of supported
-architectures.
+Set the architecture. Pass
+.B \-h
+as the architecture to see the list of supported architectures.
 .
 .TP
 .BI \-O " os"
-Set operating system. bootm command of u-boot changes boot method by os type.
-Pass \-h as the OS to see the list of supported OS.
+Set the operating system. The U-Boot
+.I bootm
+command changes boot method based on the OS type.
+Pass
+.B \-h
+as the
+.I os
+to see the list of supported OSs.
 .
 .TP
 .BI \-C " compression-type"
-Set compression type.
-Pass \-h as the compression to see the list of supported compression type.
+Set the compression type. The image data should have already been compressed
+using this compression type.
+.B mkimage
+will not automatically compress image data.
+Pass
+.B \-h
+as the
+.I compression-type
+to see the list of supported compression types.
 .
 .TP
 .BI \-a " load-address"
-Set load address with a hex number.
+Set the absolute address to load the image data to.
+.I load-address
+will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-e " entry-point"
-Set entry point with a hex number.
+Set the absolute address of the image entry point. The U-Boot
+.I bootm
+command will jump to this address after loading the image.
+.I entry-point
+will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-n " image-name"
-Set image name to 'image name'.
+Set the image name to
+.IR image-name .
 .
 .TP
 .BI \-R " secondary-image-name"
 Some image types support a second image for 

[PATCH v2 10/14] doc: mkimage: Add SEE ALSO section

2022-06-12 Thread Sean Anderson
This adds a SEE ALSO section to link to similar man pages, as well as to
the U-Boot documentation.

Signed-off-by: Sean Anderson 
---

(no changes since v1)

 doc/mkimage.1 | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index e2b0d83d94..1da2acbaec 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -459,3 +459,11 @@ file is required.
 This manual page was written by Nobuhiro Iwamatsu 
 and Wolfgang Denk . It was updated for image signing by
 Simon Glass .
+.SH SEE ALSO
+.BR dtc (1),
+.BR dumpimage (1),
+.BR openssl (1),
+the\~
+.UR https://\:u-boot\:.readthedocs\:.io/\:en/\:latest/\:index.html
+U-Boot documentation
+.UE
-- 
2.35.1



[PATCH v2 09/14] doc: mkimage: Add BUGS section

2022-06-12 Thread Sean Anderson
In leiu of a non-standard HOMEPAGE section, add a BUGS section with a link
to the issue tracker.

Signed-off-by: Sean Anderson 
---

(no changes since v1)

 doc/mkimage.1 | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index f74790c701..e2b0d83d94 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -357,6 +357,11 @@ using
 But if the original input to mkimage is a binary file (already compiled), then
 the timestamp is assumed to have been set previously.
 .
+.SH BUGS
+Please report bugs to the
+.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
+U-Boot bug tracker
+.UE .
 .SH EXAMPLES
 .\" Reduce the width of the tab stops to something reasonable
 .ta T 1i
@@ -449,8 +454,6 @@ file is required.
 .EE
 .RE
 .
-.SH HOMEPAGE
-http://www.denx.de/wiki/U-Boot/WebHome
 .PP
 .SH AUTHOR
 This manual page was written by Nobuhiro Iwamatsu 
-- 
2.35.1



[PATCH v2 07/14] doc: mkimage: Use correct capitalization for NAME

2022-06-12 Thread Sean Anderson
The description in NAME should not be capitalized. Fix a grammatical error
as well.

Signed-off-by: Sean Anderson 
---

(no changes since v1)

 doc/mkimage.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 6c649f6cbf..5267e7d22e 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -1,7 +1,7 @@
 .TH MKIMAGE 1 "2022-02-07"
 .
 .SH NAME
-mkimage \- Generate image for U-Boot
+mkimage \- generate images for U-Boot
 .SH SYNOPSIS
 .SY mkimage
 .OP \-T type
-- 
2.35.1



[PATCH v2 06/14] doc: mkimage: Rearrange/remove some options

2022-06-12 Thread Sean Anderson
This moves some options which work in any mode to the general options
section. -p is moved to after -E/-B since those options are related. This
also adds documentation for -h and -V.

The -F, -l, and -G options are documented twice. Remove the second
documentation in each case. The synopsis for -l also suggests an implied
second uimage-file-name parameter. E.g.

mkimage [-l uimage-file-name] uimage-file-name

This is misleading, so remove it. Wrap a few lines to 80 characters as
well.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Document -h and -V
- Rearrange more options

 doc/mkimage.1 | 62 ---
 1 file changed, 29 insertions(+), 33 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 8b96011f90..6c649f6cbf 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -54,8 +54,18 @@ supports verified boot.
 .SS General options
 .
 .TP
-.BI \-l " uimage-file-name"
-mkimage lists the information contained in the header of an existing U-Boot 
image.
+.B \-h
+Print a help message and exit.
+.
+.TP
+.B \-l
+mkimage lists the information contained in the header of an existing U-Boot
+image.
+.
+.TP
+.B \-s
+Don't copy in the image data. Depending on the image type, this may create
+just the header, everything but the image data, or nothing at all.
 .
 .TP
 .BI \-T " image-type"
@@ -65,13 +75,22 @@ Without this option image type is autodetected.
 .
 .TP
 .B \-q
-Quiet. Don't print the image header on successful verification.
+Quiet. Don't print the image header.
+.
+.TP
+.B \-v
+Verbose. Print file names as they are added to the image.
+.
+.TP
+.B \-V
+Print version information and exit.
 .
 .SS Options for creating legacy or \(lqauto\(rq images
 .
 .TP
 .BI \-A " architecture"
-Set architecture. Pass \-h as the architecture to see the list of supported 
architectures.
+Set architecture. Pass \-h as the architecture to see the list of supported
+architectures.
 .
 .TP
 .BI \-O " os"
@@ -79,11 +98,6 @@ Set operating system. bootm command of u-boot changes boot 
method by os type.
 Pass \-h as the OS to see the list of supported OS.
 .
 .TP
-.BI \-T " image-type"
-Set image type.
-Pass \-h as the image to see the list of supported image type.
-.
-.TP
 .BI \-C " compression-type"
 Set compression type.
 Pass \-h as the compression to see the list of supported compression type.
@@ -97,10 +111,6 @@ Set load address with a hex number.
 Set entry point with a hex number.
 .
 .TP
-.B \-l
-List the contents of an image.
-.
-.TP
 .BI \-n " image-name"
 Set image name to 'image name'.
 .
@@ -141,15 +151,6 @@ Use image data from 'image data file'.
 .B \-x
 Set XIP (execute in place) flag.
 .
-.TP
-.B \-s
-Don't copy in the image data. Depending on the image type, this may create
-just the header, everything but the image data, or nothing at all.
-.
-.TP
-.B \-v
-Verbose. Print file names as they are added to the image.
-.
 .SS Options for creating FIT images
 .
 .TP
@@ -182,6 +183,12 @@ The alignment, in hexadecimal, that external data will be 
aligned to. This
 option only has an effect when \-E is specified.
 .
 .TP
+.BI \-p " external-position"
+Place external data at a static external position. See \-E. Instead of writing
+a 'data-offset' property defining the offset from the end of the FIT, \-p will
+use 'data-position' as the absolute position from the base of the FIT.
+.
+.TP
 .BI \-f " image-tree-source-file"
 Image tree source file that describes the structure and contents of the
 FIT image.
@@ -222,11 +229,6 @@ verification. Typically the file here is the device tree 
binary used by
 CONFIG_OF_CONTROL in U-Boot.
 .
 .TP
-.BI \-G " key-file"
-Specifies the private key file to use when signing. This option may be used
-instead of \-k.
-.
-.TP
 .BI \-g " key-name-hint"
 Sets the key-name-hint property when used with \-f auto. This is the 
 part of the key. The directory part is set by \-k. This option also indicates
@@ -239,12 +241,6 @@ Specifies the algorithm to be used for signing a FIT 
image. The default is
 taken from the signature node's 'algo' property.
 .
 .TP
-.BI \-p " external-position"
-Place external data at a static external position. See \-E. Instead of writing
-a 'data-offset' property defining the offset from the end of the FIT, \-p will
-use 'data-position' as the absolute position from the base of the FIT.
-.
-.TP
 .B \-r
 Specifies that keys used to sign the FIT are required. This means that they
 must be verified for the image to boot. Without this option, the verification
-- 
2.35.1



[PATCH v2 05/14] doc: mkimage: Use subsection macro

2022-06-12 Thread Sean Anderson
The options are divided up into several subsections. Use the appropriate
macro. While we're at it, rename the headings to better reflect the
contents of their sections.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Rename first subsection to "General options"
- Use paired quotation marks

 doc/mkimage.1 | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 4074715fe5..8b96011f90 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -51,7 +51,7 @@ supports verified boot.
 .
 .SH OPTIONS
 .
-.B List image information:
+.SS General options
 .
 .TP
 .BI \-l " uimage-file-name"
@@ -67,8 +67,7 @@ Without this option image type is autodetected.
 .B \-q
 Quiet. Don't print the image header on successful verification.
 .
-.P
-.B Create old legacy image:
+.SS Options for creating legacy or \(lqauto\(rq images
 .
 .TP
 .BI \-A " architecture"
@@ -151,8 +150,7 @@ just the header, everything but the image data, or nothing 
at all.
 .B \-v
 Verbose. Print file names as they are added to the image.
 .
-.P
-.B Create FIT image:
+.SS Options for creating FIT images
 .
 .TP
 .BI \-b " device-tree-file"
-- 
2.35.1



[PATCH v2 04/14] doc: mkimage: Regularize option documentation

2022-06-12 Thread Sean Anderson
Square brackets are commonly used to denote optional parts of a command.
However, all option arguments are mandatory. Remove these brackets. This
also removes some unnecessary quotation marks, and uses hyphens to connect
words in option arguments.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Fix extra quote in -E synopsis

 doc/mkimage.1 | 72 +--
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 1015e21576..4074715fe5 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -25,7 +25,7 @@ mkimage \- Generate image for U-Boot
 (legacy mode)
 .YS
 .
-.SH "DESCRIPTION"
+.SH DESCRIPTION
 The
 .B mkimage
 command is used to create images for use with the U-Boot boot loader.
@@ -49,64 +49,64 @@ allows for more flexibility in handling images of various 
types and also
 enhances integrity protection of images with stronger checksums. It also
 supports verified boot.
 .
-.SH "OPTIONS"
+.SH OPTIONS
 .
 .B List image information:
 .
 .TP
-.BI "\-l [" "uimage file name" "]"
+.BI \-l " uimage-file-name"
 mkimage lists the information contained in the header of an existing U-Boot 
image.
 .
 .TP
-.BI "\-T [" "image type" "]"
+.BI \-T " image-type"
 Parse image file as type.
 Pass \-h as the image to see the list of supported image type.
 Without this option image type is autodetected.
 .
 .TP
-.BI "\-q"
+.B \-q
 Quiet. Don't print the image header on successful verification.
 .
 .P
 .B Create old legacy image:
 .
 .TP
-.BI "\-A [" "architecture" "]"
+.BI \-A " architecture"
 Set architecture. Pass \-h as the architecture to see the list of supported 
architectures.
 .
 .TP
-.BI "\-O [" "os" "]"
+.BI \-O " os"
 Set operating system. bootm command of u-boot changes boot method by os type.
 Pass \-h as the OS to see the list of supported OS.
 .
 .TP
-.BI "\-T [" "image type" "]"
+.BI \-T " image-type"
 Set image type.
 Pass \-h as the image to see the list of supported image type.
 .
 .TP
-.BI "\-C [" "compression type" "]"
+.BI \-C " compression-type"
 Set compression type.
 Pass \-h as the compression to see the list of supported compression type.
 .
 .TP
-.BI "\-a [" "load address" "]"
+.BI \-a " load-address"
 Set load address with a hex number.
 .
 .TP
-.BI "\-e [" "entry point" "]"
+.BI \-e " entry-point"
 Set entry point with a hex number.
 .
 .TP
-.BI "\-l"
+.B \-l
 List the contents of an image.
 .
 .TP
-.BI "\-n [" "image name" "]"
+.BI \-n " image-name"
 Set image name to 'image name'.
 .
 .TP
-.BI "\-R [" "secondary image name" "]"
+.BI \-R " secondary-image-name"
 Some image types support a second image for additional data. For these types,
 use \-R to specify this second image.
 .TS
@@ -135,42 +135,42 @@ T}
 .TE
 .
 .TP
-.BI "\-d [" "image data file" "]"
+.BI \-d " image-data-file"
 Use image data from 'image data file'.
 .
 .TP
-.BI "\-x"
+.B \-x
 Set XIP (execute in place) flag.
 .
 .TP
-.BI "\-s"
+.B \-s
 Don't copy in the image data. Depending on the image type, this may create
 just the header, everything but the image data, or nothing at all.
 .
 .TP
-.BI "\-v"
+.B \-v
 Verbose. Print file names as they are added to the image.
 .
 .P
 .B Create FIT image:
 .
 .TP
-.BI "\-b [" "device tree file" "]
+.BI \-b " device-tree-file"
 Appends the device tree binary file (.dtb) to the FIT.
 .
 .TP
-.BI "\-c [" "comment" "]"
+.BI \-c " comment"
 Specifies a comment to be added when signing. This is typically a useful
 message which describes how the image was signed or some other useful
 information.
 .
 .TP
-.BI "\-D [" "dtc options" "]"
+.BI \-D " dtc-options"
 Provide special options to the device tree compiler that is used to
 create the image.
 .
 .TP
-.BI "\-E
+.BI \-E
 After processing, move the image data outside the FIT and store a data offset
 in the FIT. Images will be placed one after the other immediately after the
 FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
@@ -179,12 +179,12 @@ A 'data-offset' of 0 indicates that it starts in the 
first (4-byte aligned)
 byte after the FIT.
 .
 .TP
-.BI "\-B [" "alignment" "]"
+.BI \-B " alignment"
 The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
 .
 .TP
-.BI "\-f [" "image tree source file" " | " "auto" "]"
+.BI \-f " image-tree-source-file"
 Image tree source file that describes the structure and contents of the
 FIT image.
 .IP
@@ -194,29 +194,29 @@ and -e are used to specify the image to include in the 
FIT and its attributes.
 No .its file is required.
 .
 .TP
-.BI "\-F"
+.B \-F
 Indicates that an existing FIT image should be modified. No dtc
 compilation is performed and the \-f flag should not be given.
 This can be used to sign images with additional keys after initial image
 creation.
 .
 .TP
-.BI "\-i [" "ramdisk_file" "]"
+.BI \-i " ramdisk-file"
 Appends the ramdisk file to the FIT.
 .
 .TP
-.BI "\-k [" "key_directory" "]"
+.BI \-k " 

[PATCH v2 03/14] doc: mkimage: Reformat examples

2022-06-12 Thread Sean Anderson
This puts each example in a new paragraph and uses a hanging indent for
continued lines to increase clarity. We use tabs instead of .in or .RS for
the indent because it renders properly in both man and mandoc (which is
what many common HTML man pages use). The only nit is that the tab stops in
man default to something like 2", so reduce that to 1". We also escape
every "minus" as recommended by man-pages(7).

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Escape minus signs in examples
- Indent things more robustly

 doc/mkimage.1 | 116 +-
 1 file changed, 67 insertions(+), 49 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index be12843928..1015e21576 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -268,78 +268,96 @@ using the -f flag. But if the original input to mkimage 
is a binary file
 (already compiled) then the timestamp is assumed to have been set previously.
 .
 .SH EXAMPLES
-.
+.\" Reduce the width of the tab stops to something reasonable
+.ta T 1i
 List image information:
-.nf
-.B mkimage -l uImage
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-l uImage
+.EE
+.RE
 .P
 Create legacy image with compressed PowerPC Linux kernel:
-.nf
-.B mkimage -A powerpc -O linux -T kernel -C gzip 
-.br
-.B -a 0 -e 0 -n Linux -d vmlinux.gz uImage
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-A powerpc \-O linux \-T kernel \-C gzip \\
+   \-a 0 \-e 0 \-n Linux \-d vmlinux.gz uImage
+.EE
+.RE
 .P
 Create FIT image with compressed PowerPC Linux kernel:
-.nf
-.B mkimage -f kernel.its kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f kernel.its kernel.itb
+.EE
+.RE
 .P
 Create FIT image with compressed kernel and sign it with keys in the
-/public/signing-keys directory. Add corresponding public keys into u-boot.dtb,
+/public/signing\-keys directory. Add corresponding public keys into 
u\-boot.dtb,
 skipping those for which keys cannot be found. Also add a comment.
-.nf
-.B mkimage -f kernel.its -k /public/signing-keys -K u-boot.dtb 
-.br
-.B -c """Kernel 3.8 image for production devices""" kernel.itb
-.fi
-.
+.RS
 .P
-Add public keys to u-boot.dtb without needing a FIT to sign. This will also
+.EX
+\fBmkimage \-f kernel.its \-k /public/signing\-keys \-K u\-boot.dtb \\
+   \-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
+.EE
+.RE
+.P
+Add public keys to u\-boot.dtb without needing a FIT to sign. This will also
 create a FIT containing an images node with no data named unused.itb.
-.nf
-.B mkimage -f auto -d /dev/null -k /public/signing-keys -g dev 
-.br
-.B -o sha256,rsa2048 -K u-boot.dtb unused.itb
-.fi
-.
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-d /dev/null \-k /public/signing\-keys \-g dev \\
+   \-o sha256,rsa2048 \-K u\-boot.dtb unused.itb
+.EE
+.RE
 .P
 Update an existing FIT image, signing it with additional keys.
-Add corresponding public keys into u-boot.dtb. This will resign all images
+Add corresponding public keys into u\-boot.dtb. This will resign all images
 with keys that are available in the new directory. Images that request signing
 with unavailable keys are skipped.
-.nf
-.B mkimage -F -k /secret/signing-keys -K u-boot.dtb 
-.br
-.B -c """Kernel 3.8 image for production devices""" kernel.itb
-.fi
-.
+.RS
+.P
+.EX
+\fBmkimage \-F \-k /secret/signing\-keys \-K u\-boot.dtb \\
+   \-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
+.EE
+.RE
 .P
 Create a FIT image containing a kernel, using automatic mode. No .its file
 is required.
-.nf
-.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e0 -e 0 
-.br
-.B -c """Kernel 4.4 image for production devices""" -d vmlinuz kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e0 \-e 0 \\
+   \-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz 
kernel.itb
+.EE
+.RE
 .P
 Create a FIT image containing a kernel and some device tree files, using
 automatic mode. No .its file is required.
-.nf
-.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e0 -e 0 
-.br
-.B -c """Kernel 4.4 image for production devices""" -d vmlinuz 
-.B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e0 \-e 0 \\
+   \-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz \\
+   \-b /path/to/rk3288\-firefly.dtb \-b /path/to/rk3288\-jerry.dtb 
kernel.itb
+.EE
+.RE
 .P
 Create a FIT image containing a signed kernel, using automatic mode. No .its
 file is required.
-.nf
-.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e0 -e 0 
-.br
-.B -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e0 \-e 0 \\
+   \-d vmlinuz \-k /secret/signing\-keys \-g dev \-o sha256,rsa2048 
kernel.itb
+.EE
+.RE
 .
 .SH HOMEPAGE
 http://www.denx.de/wiki/U-Boot/WebHome
-- 
2.35.1



[PATCH v2 02/14] doc: mkimage: Use empty request instead of blank lines

2022-06-12 Thread Sean Anderson
Blank lines do not have well-defined semantics in fill mode (the default).
Instead, use empty requests (.) where vertical space is necessary for
readability. There are a few places where we use a paragraph instead.

Signed-off-by: Sean Anderson 
---

(no changes since v1)

 doc/mkimage.1 | 110 +-
 1 file changed, 55 insertions(+), 55 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index dc597272d4..be12843928 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -1,5 +1,5 @@
 .TH MKIMAGE 1 "2022-02-07"
-
+.
 .SH NAME
 mkimage \- Generate image for U-Boot
 .SH SYNOPSIS
@@ -7,34 +7,34 @@ mkimage \- Generate image for U-Boot
 .OP \-T type
 .BI \-l\~ image-file-name
 .YS
-
+.
 .SY mkimage
 .RI [ option\~ .\|.\|.\&]
 .BI \-f\~ image-tree-source-file\c
 .RB | auto
 .I image-file-name
 .YS
-
+.
 .SY mkimage
 .RI [ option\~ .\|.\|.\&]
 .BI \-F\~ image-file-name
 .YS
-
+.
 .SY mkimage
 .RI [ option\~ .\|.\|.\&]
-.R (legacy mode)
+(legacy mode)
 .YS
-
+.
 .SH "DESCRIPTION"
 The
 .B mkimage
 command is used to create images for use with the U-Boot boot loader.
 These images can contain the linux kernel, device tree blob, root file
 system image, firmware images etc., either separate or combined.
-
+.P
 .B mkimage
 supports two different formats:
-
+.P
 The old
 .I legacy image
 format concatenates the individual parts (for example, kernel image,
@@ -42,69 +42,69 @@ device tree blob and ramdisk image) and adds a 64 bytes 
header
 containing information about target architecture, operating system,
 image type, compression method, entry points, time stamp, checksums,
 etc.
-
+.P
 The new
 .I FIT (Flattened Image Tree) format
 allows for more flexibility in handling images of various types and also
 enhances integrity protection of images with stronger checksums. It also
 supports verified boot.
-
+.
 .SH "OPTIONS"
-
+.
 .B List image information:
-
+.
 .TP
 .BI "\-l [" "uimage file name" "]"
 mkimage lists the information contained in the header of an existing U-Boot 
image.
-
+.
 .TP
 .BI "\-T [" "image type" "]"
 Parse image file as type.
 Pass \-h as the image to see the list of supported image type.
 Without this option image type is autodetected.
-
+.
 .TP
 .BI "\-q"
 Quiet. Don't print the image header on successful verification.
-
+.
 .P
 .B Create old legacy image:
-
+.
 .TP
 .BI "\-A [" "architecture" "]"
 Set architecture. Pass \-h as the architecture to see the list of supported 
architectures.
-
+.
 .TP
 .BI "\-O [" "os" "]"
 Set operating system. bootm command of u-boot changes boot method by os type.
 Pass \-h as the OS to see the list of supported OS.
-
+.
 .TP
 .BI "\-T [" "image type" "]"
 Set image type.
 Pass \-h as the image to see the list of supported image type.
-
+.
 .TP
 .BI "\-C [" "compression type" "]"
 Set compression type.
 Pass \-h as the compression to see the list of supported compression type.
-
+.
 .TP
 .BI "\-a [" "load address" "]"
 Set load address with a hex number.
-
+.
 .TP
 .BI "\-e [" "entry point" "]"
 Set entry point with a hex number.
-
+.
 .TP
 .BI "\-l"
 List the contents of an image.
-
+.
 .TP
 .BI "\-n [" "image name" "]"
 Set image name to 'image name'.
-
+.
 .TP
 .BI "\-R [" "secondary image name" "]"
 Some image types support a second image for additional data. For these types,
@@ -133,42 +133,42 @@ when loading the image. At most 256 parameters may be 
specified in this
 manner.
 T}
 .TE
-
+.
 .TP
 .BI "\-d [" "image data file" "]"
 Use image data from 'image data file'.
-
+.
 .TP
 .BI "\-x"
 Set XIP (execute in place) flag.
-
+.
 .TP
 .BI "\-s"
 Don't copy in the image data. Depending on the image type, this may create
 just the header, everything but the image data, or nothing at all.
-
+.
 .TP
 .BI "\-v"
 Verbose. Print file names as they are added to the image.
-
+.
 .P
 .B Create FIT image:
-
+.
 .TP
 .BI "\-b [" "device tree file" "]
 Appends the device tree binary file (.dtb) to the FIT.
-
+.
 .TP
 .BI "\-c [" "comment" "]"
 Specifies a comment to be added when signing. This is typically a useful
 message which describes how the image was signed or some other useful
 information.
-
+.
 .TP
 .BI "\-D [" "dtc options" "]"
 Provide special options to the device tree compiler that is used to
 create the image.
-
+.
 .TP
 .BI "\-E
 After processing, move the image data outside the FIT and store a data offset
@@ -177,44 +177,44 @@ FIT, with each one aligned to a 4-byte boundary. The 
existing 'data' property
 in each image will be replaced with 'data-offset' and 'data-size' properties.
 A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
 byte after the FIT.
-
+.
 .TP
 .BI "\-B [" "alignment" "]"
 The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
-
+.
 .TP
 .BI "\-f [" "image tree source file" " | " "auto" "]"
 Image tree source file that describes the structure and contents of the
 FIT image.
-
+.IP
 This can be 

[PATCH v2 01/14] doc: mkimage: Use standard style for synopsis

2022-06-12 Thread Sean Anderson
The synopsis section is a bit messy. As an example, "uimage file name" is
printed in italics, bold, and roman (depending on the line). This cleans
things up and converts the synopsis section to use standard style. The
.SY/.YS macros set up appropriate fomatting for command synopsis sections
(such as disabling hyphenation and setting a hanging indent). All parts of
the synopsis now use the following style:

- Bold for parts of the command which should be typed in by the user (such
  as the program name and flags)
- Italic for parts which should be replaced (such as uimage-file-name)
- Roman for parts which should not be typed at all (such as brackets)

Multi-word variables now use hyphens to connect their words instead of
spaces. This makes it clearer that all the words are part of the same
variable. Additionally, "option ..." is used to denote where other options
may be specified, as this appears to be standard style.

Signed-off-by: Sean Anderson 
---

Changes in v2:
- Fix spacing for -F

 doc/mkimage.1 | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 759dc2d12f..dc597272d4 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -3,17 +3,27 @@
 .SH NAME
 mkimage \- Generate image for U-Boot
 .SH SYNOPSIS
-.B mkimage
-.RB [ \-T " \fItype\fP] " \-l " [\fIuimage file name\fP]"
+.SY mkimage
+.OP \-T type
+.BI \-l\~ image-file-name
+.YS
 
-.B mkimage
-.RB [\fIoptions\fP] " \-f [" "image tree source file" "]" " [" "uimage file 
name" "]"
+.SY mkimage
+.RI [ option\~ .\|.\|.\&]
+.BI \-f\~ image-tree-source-file\c
+.RB | auto
+.I image-file-name
+.YS
 
-.B mkimage
-.RB [\fIoptions\fP] " \-F [" "uimage file name" "]"
+.SY mkimage
+.RI [ option\~ .\|.\|.\&]
+.BI \-F\~ image-file-name
+.YS
 
-.B mkimage
-.RB [\fIoptions\fP] " (legacy mode)"
+.SY mkimage
+.RI [ option\~ .\|.\|.\&]
+.R (legacy mode)
+.YS
 
 .SH "DESCRIPTION"
 The
-- 
2.35.1



[PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options

2022-06-12 Thread Sean Anderson
This gives a facelift for the mkimage man page, bringing it in line with the
style perscribed by man-pages(7) and groff_man_style(7). I have tried to remove
typographical and grammatical errors and inconsistencies wherever possible. The
man page now both looks and feels closer to other Linux man pages. As a bonus, I
also added a man page for dumpimage in the same style.

To address the impending exhaustion of short options, this also adds long
options for each short option.

Changes in v2:
- Add long options
- Better document multi images
- Document -h and -V
- Ensure comments are requests
- Escape minus signs in examples
- Fix -B not being bolded in the description for -R
- Fix extra quote in -E synopsis
- Fix spacing for -F
- Further document -o and -R
- Indent things more robustly
- Italicize parameter for -d
- Make lists of valid algos bold
- Rearrange more options
- Remove spaces around pipes
- Rename first subsection to "General options"
- Use escape-sequences for options width all three of B/I/R. This renders
  better with mandoc.
- Use paired quotation marks

Sean Anderson (14):
  doc: mkimage: Use standard style for synopsis
  doc: mkimage: Use empty request instead of blank lines
  doc: mkimage: Reformat examples
  doc: mkimage: Regularize option documentation
  doc: mkimage: Use subsection macro
  doc: mkimage: Rearrange/remove some options
  doc: mkimage: Use correct capitalization for NAME
  doc: mkimage: Edit options for style and consistency
  doc: mkimage: Add BUGS section
  doc: mkimage: Add SEE ALSO section
  doc: mkimage: Remove AUTHORS section
  mkimage: Add long options
  doc: mkimage: Further document -o and -R
  doc: Add man page for dumpimage

 doc/dumpimage.1 | 103 ++
 doc/mkimage.1   | 933 ++--
 tools/mkimage.c |  45 ++-
 3 files changed, 811 insertions(+), 270 deletions(-)
 create mode 100644 doc/dumpimage.1

-- 
2.35.1



Re: [PATCH v16 2/2] net: Add wget application

2022-06-12 Thread Ramon Fried
On Fri, Jun 10, 2022 at 9:10 PM Ying-Chun Liu (PaulLiu)
 wrote:
>
> From: "Ying-Chun Liu (PaulLiu)" 
>
> This commit adds a simple wget command that can download files
> from http server.
>
> The command syntax is
> wget ${loadaddr} 
>
> Signed-off-by: Duncan Hare 
> Signed-off-by: Ying-Chun Liu (PaulLiu) 
> Cc: Christian Gmeiner 
> Cc: Joe Hershberger 
> Cc: Michal Simek 
> Cc: Ramon Fried 
> ---
> v1-v12: Made by Duncan, didn't tracked.
> v13: Fix some issues which is reviewed by Christian
> v14: Add options to enable/disable SACK.
> v15: Fix various syntax errors reviewed by Michal.
>  Remove magic numbers. Use kernel-doc format.
> v16: Add more kernel-doc. Fix more double spaces.
> ---
>  cmd/Kconfig|   7 +
>  cmd/net.c  |  13 ++
>  include/net.h  |   2 +-
>  include/net/wget.h |  22 +++
>  net/Makefile   |   1 +
>  net/net.c  |   6 +
>  net/wget.c | 426 +
>  7 files changed, 476 insertions(+), 1 deletion(-)
>  create mode 100644 include/net/wget.h
>  create mode 100644 net/wget.c
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 09193b61b9..5a5f2f1df8 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1715,6 +1715,13 @@ config NFS_TIMEOUT
>   "ERROR: Cannot umount" in nfs command, try longer timeout such as
>   1.
>
> +config CMD_WGET
> +   bool "wget"
> +   select TCP
> +   help
> + wget is a simple command to download kernel, or other files,
> + from a http server over TCP.
> +
>  config CMD_MII
> bool "mii"
> imply CMD_MDIO
> diff --git a/cmd/net.c b/cmd/net.c
> index 3619c843d8..60fd785061 100644
> --- a/cmd/net.c
> +++ b/cmd/net.c
> @@ -124,6 +124,19 @@ U_BOOT_CMD(
>  );
>  #endif
>
> +#if defined(CONFIG_CMD_WGET)
> +static int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const 
> argv[])
> +{
> +   return netboot_common(WGET, cmdtp, argc, argv);
> +}
> +
> +U_BOOT_CMD(
> +   wget,   3,  1,  do_wget,
> +   "boot image via network using HTTP protocol",
> +   "[loadAddress] [[hostIPaddr:]path and image name]"
> +);
> +#endif
> +
>  static void netboot_update_env(void)
>  {
> char tmp[22];
> diff --git a/include/net.h b/include/net.h
> index b7bac86cf1..fb80a8981d 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -559,7 +559,7 @@ extern int  net_restart_wrap;   /* Tried all 
> network devices */
>
>  enum proto_t {
> BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
> -   TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP
> +   TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, WGET
>  };
>
>  extern charnet_boot_file_name[1024];/* Boot File name */
> diff --git a/include/net/wget.h b/include/net/wget.h
> new file mode 100644
> index 00..da0920de11
> --- /dev/null
> +++ b/include/net/wget.h
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Duncan Hare Copyright 2017
> + */
> +
> +/**
> + * wget_start() - begin wget
> + */
> +void wget_start(void);
> +
> +enum wget_state {
> +   WGET_CLOSED,
> +   WGET_CONNECTING,
> +   WGET_CONNECTED,
> +   WGET_TRANSFERRING,
> +   WGET_TRANSFERRED
> +};
> +
> +#define DEBUG_WGET 0   /* Set to 1 for debug messages */
> +#define SERVER_PORT80
> +#define WGET_RETRY_COUNT   30
> +#define WGET_TIMEOUT   2000UL
> diff --git a/net/Makefile b/net/Makefile
> index d131d1cb1a..4f757a224c 100644
> --- a/net/Makefile
> +++ b/net/Makefile
> @@ -31,6 +31,7 @@ obj-$(CONFIG_UDP_FUNCTION_FASTBOOT)  += fastboot.o
>  obj-$(CONFIG_CMD_WOL)  += wol.o
>  obj-$(CONFIG_PROT_UDP) += udp.o
>  obj-$(CONFIG_PROT_TCP) += tcp.o
> +obj-$(CONFIG_CMD_WGET) += wget.o
>
>  # Disable this warning as it is triggered by:
>  # sprintf(buf, index ? "foo%d" : "foo", index)
> diff --git a/net/net.c b/net/net.c
> index 751d0251be..cee2ff8100 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -117,6 +117,7 @@
>  #include "wol.h"
>  #endif
>  #include 
> +#include 
>
>  /** BOOTP EXTENTIONS **/
>
> @@ -505,6 +506,11 @@ restart:
> nfs_start();
> break;
>  #endif
> +#if defined(CONFIG_CMD_WGET)
> +   case WGET:
> +   wget_start();
> +   break;
> +#endif
>  #if defined(CONFIG_CMD_CDP)
> case CDP:
> cdp_start();
> diff --git a/net/wget.c b/net/wget.c
> new file mode 100644
> index 00..6a2e92f17b
> --- /dev/null
> +++ b/net/wget.c
> @@ -0,0 +1,426 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * WGET/HTTP support driver based on U-BOOT's nfs.c
> + * Copyright Duncan Hare  2017
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static const char bootfile1[] = "GET ";
> +static const char bootfile3[] = " HTTP/1.0\r\n\r\n";
> +static const char http_eom[] = 

Re: [PATCH 3/3] arm: apple: Increase RTKit timeouts

2022-06-12 Thread Mark Kettenis
> From: Janne Grunau 
> Date: Sun, 12 Jun 2022 18:00:29 +0200
> 
> Timeouts are not expected to happen and are handled as fatal errors.
> Increase all timeouts to 1 second as defensive measure to avoid relying
> on the timing behaviour of certain firmware versions or configurations.
> 
> Signed-off-by: Janne Grunau 

Reviewed-by: Mark Kettenis 
Tested-by: Mark Kettenis 

> ---
>  arch/arm/mach-apple/rtkit.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c
> index da7771844230..a550b553b663 100644
> --- a/arch/arm/mach-apple/rtkit.c
> +++ b/arch/arm/mach-apple/rtkit.c
> @@ -52,6 +52,8 @@
>  #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
>  #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0)
>  
> +#define TIMEOUT_1SEC_US 100
> +
>  struct apple_rtkit {
>   struct mbox_chan *chan;
>   void *cookie;
> @@ -168,7 +170,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk)
>   return ret;
>  
>   /* Wait for protocol version negotiation message. */
> - ret = mbox_recv(rtk->chan, , 1);
> + ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
>   if (ret < 0)
>   return ret;
>  
> @@ -210,7 +212,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk)
>  
>  wait_epmap:
>   /* Wait for endpoint map message. */
> - ret = mbox_recv(rtk->chan, , 1);
> + ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
>   if (ret < 0)
>   return ret;
>  
> @@ -275,7 +277,7 @@ wait_epmap:
>  
>   pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP;
>   while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) {
> - ret = mbox_recv(rtk->chan, , 10);
> + ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
>   if (ret < 0)
>   return ret;
>  
> @@ -330,7 +332,7 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk, int 
> pwrstate)
>   if (ret < 0)
>   return ret;
>  
> - ret = mbox_recv(rtk->chan, , 10);
> + ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
>   if (ret < 0)
>   return ret;
>  
> -- 
> 2.35.1
> 
> 


Re: [PATCH 2/3] MAINTAINERS: Add nvme_apple to Apple SoC section

2022-06-12 Thread Mark Kettenis
> From: Janne Grunau 
> Date: Sun, 12 Jun 2022 18:00:28 +0200
> 
> Signed-off-by: Janne Grunau 

Reviewed-by: Mark Kettenis 

> ---
> 
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 28e4d3823861..a15ba7abdcd6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -121,6 +121,7 @@ F:arch/arm/include/asm/arch-m1/
>  F:   arch/arm/mach-apple/
>  F:   configs/apple_m1_defconfig
>  F:   drivers/iommu/apple_dart.c
> +F:   drivers/nvme/nvme_apple.c
>  F:   drivers/pinctrl/pinctrl-apple.c
>  F:   drivers/watchdog/apple_wdt.c
>  F:   include/configs/apple.h
> -- 
> 2.35.1
> 
> 


Re: [PATCH 1/3] arm: apple: nvme: Add SART support and RTKit buffer management

2022-06-12 Thread Mark Kettenis
> From: Janne Grunau 
> Date: Sun, 12 Jun 2022 18:00:27 +0200
> 
> The NVMe firmware in the macOS 13 beta blocks or crashes with u-boot's
> current minimal RTKit implementation. It does not provide buffers for
> the firmware's buffer requests. The ANS2 firmware included in macOS 11
> and 12 tolerates this. The firmware included in the first macOS 13 beta
> requires buffers for the crashlog and ioreport endpoints to function.
> 
> In the case of the NVMe the buffers are physical memory. Access to
> physical memory is guarded by what Apple calls SART.
> Import m1n1's SART driver (exclusively used for the NVMe controller).
> Implement buffer management helpers for RTKit. These are generic since
> other devices (none in u-boot so far) require different handling.
> 
> Signed-off-by: Janne Grunau 

Thanks for taking care of this.

Reviewed-by: Mark Kettenis 
Tested-by: Mark Kettenis 

> ---
> 
>  arch/arm/include/asm/arch-apple/rtkit.h |  22 ++-
>  arch/arm/include/asm/arch-apple/sart.h  |  22 +++
>  arch/arm/mach-apple/Makefile|   1 +
>  arch/arm/mach-apple/rtkit.c | 159 +---
>  arch/arm/mach-apple/sart.c  | 230 
>  drivers/nvme/nvme_apple.c   |  72 +++-
>  6 files changed, 474 insertions(+), 32 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-apple/sart.h
>  create mode 100644 arch/arm/mach-apple/sart.c
> 
> diff --git a/arch/arm/include/asm/arch-apple/rtkit.h 
> b/arch/arm/include/asm/arch-apple/rtkit.h
> index 51f77f298c09..eff18ddb9d21 100644
> --- a/arch/arm/include/asm/arch-apple/rtkit.h
> +++ b/arch/arm/include/asm/arch-apple/rtkit.h
> @@ -7,5 +7,23 @@
>  #define APPLE_RTKIT_PWR_STATE_QUIESCED   0x10
>  #define APPLE_RTKIT_PWR_STATE_ON 0x20
>  
> -int apple_rtkit_init(struct mbox_chan *);
> -int apple_rtkit_shutdown(struct mbox_chan *, int);
> +struct apple_rtkit_buffer {
> + void *buffer;
> + u64 dva;
> + size_t size;
> + bool is_mapped;
> +};
> +
> +typedef int (*apple_rtkit_shmem_setup)(void *cookie,
> +struct apple_rtkit_buffer *buf);
> +typedef void (*apple_rtkit_shmem_destroy)(void *cookie,
> +   struct apple_rtkit_buffer *buf);
> +
> +struct apple_rtkit;
> +
> +struct apple_rtkit *apple_rtkit_init(struct mbox_chan *chan, void *cookie,
> +  apple_rtkit_shmem_setup shmem_setup,
> +  apple_rtkit_shmem_destroy shmem_destroy);
> +void apple_rtkit_free(struct apple_rtkit *rtk);
> +int apple_rtkit_boot(struct apple_rtkit *rtk);
> +int apple_rtkit_shutdown(struct apple_rtkit *rtk, int pwrstate);
> diff --git a/arch/arm/include/asm/arch-apple/sart.h 
> b/arch/arm/include/asm/arch-apple/sart.h
> new file mode 100644
> index ..b99bdeafc0b3
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-apple/sart.h
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: MIT
> + *
> + * The sart code is copied from m1n1 (https://github.com/AsahiLinux/m1n1) and
> + * licensed as MIT.
> + *
> + * (C) Copyright 2022 The Asahi Linux Contributors
> + */
> +
> +#ifndef SART_H
> +#define SART_H
> +
> +#include 
> +
> +struct apple_sart;
> +
> +struct apple_sart *sart_init(ofnode node);
> +void sart_free(struct apple_sart *sart);
> +
> +bool sart_add_allowed_region(struct apple_sart *sart, void *paddr, size_t 
> sz);
> +bool sart_remove_allowed_region(struct apple_sart *sart, void *paddr, size_t 
> sz);
> +
> +#endif
> diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile
> index 52f30a777b2c..50b465b9473f 100644
> --- a/arch/arm/mach-apple/Makefile
> +++ b/arch/arm/mach-apple/Makefile
> @@ -3,3 +3,4 @@
>  obj-y += board.o
>  obj-y += lowlevel_init.o
>  obj-y += rtkit.o
> +obj-$(CONFIG_NVME_APPLE) += sart.o
> diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c
> index 2dcb8bdd3e44..da7771844230 100644
> --- a/arch/arm/mach-apple/rtkit.c
> +++ b/arch/arm/mach-apple/rtkit.c
> @@ -17,6 +17,7 @@
>  #define APPLE_RTKIT_EP_SYSLOG 2
>  #define APPLE_RTKIT_EP_DEBUG 3
>  #define APPLE_RTKIT_EP_IOREPORT 4
> +#define APPLE_RTKIT_EP_TRACEKIT 10
>  
>  /* Messages for management endpoint. */
>  #define APPLE_RTKIT_MGMT_TYPE GENMASK(59, 52)
> @@ -51,7 +52,102 @@
>  #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
>  #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0)
>  
> -int apple_rtkit_init(struct mbox_chan *chan)
> +struct apple_rtkit {
> + struct mbox_chan *chan;
> + void *cookie;
> + apple_rtkit_shmem_setup shmem_setup;
> + apple_rtkit_shmem_destroy shmem_destroy;
> +
> + struct apple_rtkit_buffer syslog_buffer;
> + struct apple_rtkit_buffer crashlog_buffer;
> + struct apple_rtkit_buffer ioreport_buffer;
> +};
> +
> +struct apple_rtkit *apple_rtkit_init(struct mbox_chan *chan, void *cookie,
> +  apple_rtkit_shmem_setup shmem_setup,
> +  

[PATCH 3/3] arm: apple: Increase RTKit timeouts

2022-06-12 Thread Janne Grunau
Timeouts are not expected to happen and are handled as fatal errors.
Increase all timeouts to 1 second as defensive measure to avoid relying
on the timing behaviour of certain firmware versions or configurations.

Signed-off-by: Janne Grunau 
---

 arch/arm/mach-apple/rtkit.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c
index da7771844230..a550b553b663 100644
--- a/arch/arm/mach-apple/rtkit.c
+++ b/arch/arm/mach-apple/rtkit.c
@@ -52,6 +52,8 @@
 #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
 #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0)
 
+#define TIMEOUT_1SEC_US 100
+
 struct apple_rtkit {
struct mbox_chan *chan;
void *cookie;
@@ -168,7 +170,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk)
return ret;
 
/* Wait for protocol version negotiation message. */
-   ret = mbox_recv(rtk->chan, , 1);
+   ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
if (ret < 0)
return ret;
 
@@ -210,7 +212,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk)
 
 wait_epmap:
/* Wait for endpoint map message. */
-   ret = mbox_recv(rtk->chan, , 1);
+   ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
if (ret < 0)
return ret;
 
@@ -275,7 +277,7 @@ wait_epmap:
 
pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP;
while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) {
-   ret = mbox_recv(rtk->chan, , 10);
+   ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
if (ret < 0)
return ret;
 
@@ -330,7 +332,7 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk, int 
pwrstate)
if (ret < 0)
return ret;
 
-   ret = mbox_recv(rtk->chan, , 10);
+   ret = mbox_recv(rtk->chan, , TIMEOUT_1SEC_US);
if (ret < 0)
return ret;
 
-- 
2.35.1



[PATCH 2/3] MAINTAINERS: Add nvme_apple to Apple SoC section

2022-06-12 Thread Janne Grunau
Signed-off-by: Janne Grunau 

---

 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 28e4d3823861..a15ba7abdcd6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -121,6 +121,7 @@ F:  arch/arm/include/asm/arch-m1/
 F: arch/arm/mach-apple/
 F: configs/apple_m1_defconfig
 F: drivers/iommu/apple_dart.c
+F: drivers/nvme/nvme_apple.c
 F: drivers/pinctrl/pinctrl-apple.c
 F: drivers/watchdog/apple_wdt.c
 F: include/configs/apple.h
-- 
2.35.1



[PATCH 1/3] arm: apple: nvme: Add SART support and RTKit buffer management

2022-06-12 Thread Janne Grunau
The NVMe firmware in the macOS 13 beta blocks or crashes with u-boot's
current minimal RTKit implementation. It does not provide buffers for
the firmware's buffer requests. The ANS2 firmware included in macOS 11
and 12 tolerates this. The firmware included in the first macOS 13 beta
requires buffers for the crashlog and ioreport endpoints to function.

In the case of the NVMe the buffers are physical memory. Access to
physical memory is guarded by what Apple calls SART.
Import m1n1's SART driver (exclusively used for the NVMe controller).
Implement buffer management helpers for RTKit. These are generic since
other devices (none in u-boot so far) require different handling.

Signed-off-by: Janne Grunau 

---

 arch/arm/include/asm/arch-apple/rtkit.h |  22 ++-
 arch/arm/include/asm/arch-apple/sart.h  |  22 +++
 arch/arm/mach-apple/Makefile|   1 +
 arch/arm/mach-apple/rtkit.c | 159 +---
 arch/arm/mach-apple/sart.c  | 230 
 drivers/nvme/nvme_apple.c   |  72 +++-
 6 files changed, 474 insertions(+), 32 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-apple/sart.h
 create mode 100644 arch/arm/mach-apple/sart.c

diff --git a/arch/arm/include/asm/arch-apple/rtkit.h 
b/arch/arm/include/asm/arch-apple/rtkit.h
index 51f77f298c09..eff18ddb9d21 100644
--- a/arch/arm/include/asm/arch-apple/rtkit.h
+++ b/arch/arm/include/asm/arch-apple/rtkit.h
@@ -7,5 +7,23 @@
 #define APPLE_RTKIT_PWR_STATE_QUIESCED 0x10
 #define APPLE_RTKIT_PWR_STATE_ON   0x20
 
-int apple_rtkit_init(struct mbox_chan *);
-int apple_rtkit_shutdown(struct mbox_chan *, int);
+struct apple_rtkit_buffer {
+   void *buffer;
+   u64 dva;
+   size_t size;
+   bool is_mapped;
+};
+
+typedef int (*apple_rtkit_shmem_setup)(void *cookie,
+  struct apple_rtkit_buffer *buf);
+typedef void (*apple_rtkit_shmem_destroy)(void *cookie,
+ struct apple_rtkit_buffer *buf);
+
+struct apple_rtkit;
+
+struct apple_rtkit *apple_rtkit_init(struct mbox_chan *chan, void *cookie,
+apple_rtkit_shmem_setup shmem_setup,
+apple_rtkit_shmem_destroy shmem_destroy);
+void apple_rtkit_free(struct apple_rtkit *rtk);
+int apple_rtkit_boot(struct apple_rtkit *rtk);
+int apple_rtkit_shutdown(struct apple_rtkit *rtk, int pwrstate);
diff --git a/arch/arm/include/asm/arch-apple/sart.h 
b/arch/arm/include/asm/arch-apple/sart.h
new file mode 100644
index ..b99bdeafc0b3
--- /dev/null
+++ b/arch/arm/include/asm/arch-apple/sart.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * The sart code is copied from m1n1 (https://github.com/AsahiLinux/m1n1) and
+ * licensed as MIT.
+ *
+ * (C) Copyright 2022 The Asahi Linux Contributors
+ */
+
+#ifndef SART_H
+#define SART_H
+
+#include 
+
+struct apple_sart;
+
+struct apple_sart *sart_init(ofnode node);
+void sart_free(struct apple_sart *sart);
+
+bool sart_add_allowed_region(struct apple_sart *sart, void *paddr, size_t sz);
+bool sart_remove_allowed_region(struct apple_sart *sart, void *paddr, size_t 
sz);
+
+#endif
diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile
index 52f30a777b2c..50b465b9473f 100644
--- a/arch/arm/mach-apple/Makefile
+++ b/arch/arm/mach-apple/Makefile
@@ -3,3 +3,4 @@
 obj-y += board.o
 obj-y += lowlevel_init.o
 obj-y += rtkit.o
+obj-$(CONFIG_NVME_APPLE) += sart.o
diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c
index 2dcb8bdd3e44..da7771844230 100644
--- a/arch/arm/mach-apple/rtkit.c
+++ b/arch/arm/mach-apple/rtkit.c
@@ -17,6 +17,7 @@
 #define APPLE_RTKIT_EP_SYSLOG 2
 #define APPLE_RTKIT_EP_DEBUG 3
 #define APPLE_RTKIT_EP_IOREPORT 4
+#define APPLE_RTKIT_EP_TRACEKIT 10
 
 /* Messages for management endpoint. */
 #define APPLE_RTKIT_MGMT_TYPE GENMASK(59, 52)
@@ -51,7 +52,102 @@
 #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
 #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0)
 
-int apple_rtkit_init(struct mbox_chan *chan)
+struct apple_rtkit {
+   struct mbox_chan *chan;
+   void *cookie;
+   apple_rtkit_shmem_setup shmem_setup;
+   apple_rtkit_shmem_destroy shmem_destroy;
+
+   struct apple_rtkit_buffer syslog_buffer;
+   struct apple_rtkit_buffer crashlog_buffer;
+   struct apple_rtkit_buffer ioreport_buffer;
+};
+
+struct apple_rtkit *apple_rtkit_init(struct mbox_chan *chan, void *cookie,
+apple_rtkit_shmem_setup shmem_setup,
+apple_rtkit_shmem_destroy shmem_destroy)
+{
+   struct apple_rtkit *rtk;
+
+   rtk = calloc(sizeof(*rtk), 1);
+   if (!rtk)
+   return NULL;
+
+   rtk->chan = chan;
+   rtk->cookie = cookie;
+   rtk->shmem_setup = shmem_setup;
+   rtk->shmem_destroy = shmem_destroy;
+
+   return rtk;
+}
+
+void apple_rtkit_free(struct apple_rtkit 

[PATCH 0/3] Improve robustness of NVMe suuport for Apple silicon devices

2022-06-12 Thread Janne Grunau
Hej,

this series has assorted fixes to improve the robustness of the NVMe
support on Apple silicon devices. The main change which prompted this
series is "rm: apple: nvme: Add SART support and RTKit buffer
management". It fixes the RTKit driver required for the NVMe with the
system-wide firmware included in the first macOS 13 beta release.

The increased timeouts in RTKit are a defensive change against future
changes. None of the mailbox receive calls is expected to timeout so
waiting up to 1 second for a fatal error seems acceptable.

cheers Janne


Janne Grunau (3):
  arm: apple: nvme: Add SART support and RTKit buffer management
  MAINTAINERS: Add nvme_apple to Apple SoC section
  arm: apple: Increase RTKit timeouts

 MAINTAINERS |   1 +
 arch/arm/include/asm/arch-apple/rtkit.h |  22 ++-
 arch/arm/include/asm/arch-apple/sart.h  |  22 +++
 arch/arm/mach-apple/Makefile|   1 +
 arch/arm/mach-apple/rtkit.c | 161 ++---
 arch/arm/mach-apple/sart.c  | 230 
 drivers/nvme/nvme_apple.c   |  72 +++-
 7 files changed, 477 insertions(+), 32 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-apple/sart.h
 create mode 100644 arch/arm/mach-apple/sart.c

-- 
2.35.1



[PATCH] rockchip: pinebook-pro: sync PBP dtb to 5.18

2022-06-12 Thread Peter Robinson
Sync the pinebook pro to upstream 5.18, in particular this brings
brings in a fix so the DP is disabled so Linux will actually boot.

Signed-off-by: Peter Robinson 
---
 arch/arm/dts/rk3399-pinebook-pro.dts | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts 
b/arch/arm/dts/rk3399-pinebook-pro.dts
index 2b5f001ff4a..d6b68d77d63 100644
--- a/arch/arm/dts/rk3399-pinebook-pro.dts
+++ b/arch/arm/dts/rk3399-pinebook-pro.dts
@@ -17,6 +17,7 @@
 / {
model = "Pine64 Pinebook Pro";
compatible = "pine64,pinebook-pro", "rockchip,rk3399";
+   chassis-type = "laptop";
 
aliases {
mmc0 = 
@@ -242,12 +243,12 @@
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = < 0 25000 1>;
+   pwm-supply = <_sysin>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <80>;
regulator-max-microvolt = <140>;
-   vin-supply = <_sysin>;
 
regulator-state-mem {
regulator-on-in-suspend;
@@ -385,10 +386,6 @@
};
 };
 
-_dp {
-   status = "okay";
-};
-
 _b0 {
cpu-supply = <_cpu_b>;
 };
@@ -475,8 +472,6 @@
vcc10-supply = <_sysin>;
vcc11-supply = <_sysin>;
vcc12-supply = <_sys>;
-   vcc13-supply = <_sysin>;
-   vcc14-supply = <_sysin>;
 
regulators {
/* rk3399 center logic supply */
@@ -711,7 +706,7 @@
 
connector {
compatible = "usb-c-connector";
-   data-role = "host";
+   data-role = "dual";
label = "USB-C";
op-sink-microwatt = <100>;
power-role = "dual";
-- 
2.36.1



[PATCH] rockchip: rockpro64: enable leds

2022-06-12 Thread Peter Robinson
The Rockpro64 has some GPIO leds so let's enable them so the
user gets some output in early boot.

Signed-off-by: Peter Robinson 
---
 configs/rockpro64-rk3399_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/rockpro64-rk3399_defconfig 
b/configs/rockpro64-rk3399_defconfig
index e6f7a8469a3..b0c3527fab0 100644
--- a/configs/rockpro64-rk3399_defconfig
+++ b/configs/rockpro64-rk3399_defconfig
@@ -42,6 +42,8 @@ CONFIG_AHCI_PCI=y
 CONFIG_SATA_SIL=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
 CONFIG_MISC=y
 CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_MMC_DW=y
-- 
2.36.1



[PATCH] rockchip: pinebook-pro: minor SPI flash fixes

2022-06-12 Thread Peter Robinson
Set a default offset for environment so it doesn't write it to
unexpected locations, drop unneeded mtd config option.

Signed-off-by: Peter Robinson 
---
 configs/pinebook-pro-rk3399_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/pinebook-pro-rk3399_defconfig 
b/configs/pinebook-pro-rk3399_defconfig
index 8ca1d0708f9..aaa52c6ea70 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -5,6 +5,7 @@ CONFIG_ARCH_ROCKCHIP=y
 CONFIG_SYS_TEXT_BASE=0x0020
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x8000
+CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinebook-pro"
 CONFIG_ROCKCHIP_RK3399=y
 CONFIG_TARGET_PINEBOOK_PRO_RK3399=y
@@ -22,7 +23,6 @@ CONFIG_MISC_INIT_R=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x1
-CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_TPL=y
 CONFIG_CMD_BOOTZ=y
-- 
2.36.1



[PATCH 1/1] sound: enable building DA7219 driver with ACPIGEN=n

2022-06-12 Thread Heinrich Schuchardt
sandbox_defconfig builds the DA7219 driver. It should be possible to
build the sandbox without ACPI support.

ACPI support in the DA7219 driver is only needed when creating an ACPI
table. Fix building with ACPIGEN=n.

Fixes: 0324b7123e22 ("sound: Add an ACPI driver for Dialog Semicondutor da7219")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/sound/da7219.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/sound/da7219.c b/drivers/sound/da7219.c
index 8d674bcb4f..c1edef4436 100644
--- a/drivers/sound/da7219.c
+++ b/drivers/sound/da7219.c
@@ -23,6 +23,7 @@

 #define DA7219_ACPI_HID"DLGS7219"

+__maybe_unused
 static int da7219_acpi_fill_ssdt(const struct udevice *dev,
 struct acpi_ctx *ctx)
 {
@@ -171,10 +172,12 @@ static int da7219_acpi_setup_nhlt(const struct udevice 
*dev,
 #endif

 struct acpi_ops da7219_acpi_ops = {
+#ifdef CONFIG_ACPIGEN
.fill_ssdt  = da7219_acpi_fill_ssdt,
 #ifdef CONFIG_X86
.setup_nhlt = da7219_acpi_setup_nhlt,
 #endif
+#endif
 };

 static const struct udevice_id da7219_ids[] = {
--
2.36.1



[PATCH 1/1] snd: enable building max98357a driver with ACPIGEN=n

2022-06-12 Thread Heinrich Schuchardt
sandbox_defconfig builds the max98357a driver. It should be possible to
build the sandbox without ACPI support.

ACPI support in the max98357a driver is only needed when creating an ACPI
table. Fix building with ACPIGEN=n.

Fixes: 54bcca29737f ("sound: Add an ACPI driver for Maxim MAX98357ac")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/sound/max98357a.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/sound/max98357a.c b/drivers/sound/max98357a.c
index a2088f0301..bdf6dc236e 100644
--- a/drivers/sound/max98357a.c
+++ b/drivers/sound/max98357a.c
@@ -38,6 +38,7 @@ static int max98357a_of_to_plat(struct udevice *dev)
return 0;
 }

+__maybe_unused
 static int max98357a_acpi_fill_ssdt(const struct udevice *dev,
struct acpi_ctx *ctx)
 {
@@ -137,10 +138,12 @@ static int max98357a_acpi_setup_nhlt(const struct udevice 
*dev,
 #endif

 struct acpi_ops max98357a_acpi_ops = {
+#ifdef CONFIG_ACPIGEN
.fill_ssdt  = max98357a_acpi_fill_ssdt,
 #ifdef CONFIG_X86
.setup_nhlt = max98357a_acpi_setup_nhlt,
 #endif
+#endif
 };

 static const struct audio_codec_ops max98357a_ops = {
--
2.36.1



sandbox: building fails with GENERATE_ACPI_TABLE=y, ACPIGEN=n

2022-06-12 Thread Heinrich Schuchardt

Hello Simon,

sandbox_defconfig with ACPIGEN=n fails to build.

We should not have two customizable symbols if the one cannot be set to
no without the other.

* GENERATE_ACPI_TABLE
* ACPIGEN

It should be possible to build the sandbox without ACPI tables to test
UEFI binaries using device-trees. This requires to get test/dm/Makefile
right.

Best regards

Heinrich


[PATCH 1/1] mmc: pci_mmc.c should build with ACPIGEN=n

2022-06-12 Thread Heinrich Schuchardt
sandbox_defconfig builds the PCI MMC driver. It should be possible to
build the sandbox without ACPI support.

ACPI support in the PCI MMC driver is only needed when creating an ACPI
table. Fix building with ACPIGEN=n.

Fixes: dba7ee419d9d ("acpi: mmc: Generate ACPI info for the PCI SD Card")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/mmc/pci_mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
index cba2ea8cf3..9fb7044029 100644
--- a/drivers/mmc/pci_mmc.c
+++ b/drivers/mmc/pci_mmc.c
@@ -86,6 +86,7 @@ static int pci_mmc_bind(struct udevice *dev)
return sdhci_bind(dev, >mmc, >cfg);
 }

+__maybe_unused
 static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev,
  struct acpi_ctx *ctx)
 {
@@ -138,7 +139,9 @@ static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev,
 }

 struct acpi_ops pci_mmc_acpi_ops = {
+#ifdef CONFIG_ACPIGEN
.fill_ssdt  = pci_mmc_acpi_fill_ssdt,
+#endif
 };

 static const struct udevice_id pci_mmc_match[] = {
--
2.36.1



[PATCH 1/1] test: fix CONFIG_ACPIGEN dependencies

2022-06-12 Thread Heinrich Schuchardt
Some tests cannot be built with CONFIG_ACPIGEN=n. Consider this in the
Makefile.

Signed-off-by: Heinrich Schuchardt 
---
 test/dm/Makefile | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/test/dm/Makefile b/test/dm/Makefile
index f0a7c97e3d..c53e2dea91 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -18,9 +18,13 @@ obj-$(CONFIG_UT_DM) += core.o
 obj-$(CONFIG_UT_DM) += read.o
 obj-$(CONFIG_UT_DM) += phys2bus.o
 ifneq ($(CONFIG_SANDBOX),)
-obj-$(CONFIG_ACPIGEN) += acpi.o
-obj-$(CONFIG_ACPIGEN) += acpigen.o
-obj-$(CONFIG_ACPIGEN) += acpi_dp.o
+ifeq ($(CONFIG_ACPIGEN),y)
+obj-y += acpi.o
+obj-y += acpigen.o
+obj-y += acpi_dp.o
+obj-(CONFIG_DM_GPIO) += gpio.o
+obj-y += irq.o
+endif
 obj-$(CONFIG_ADC) += adc.o
 obj-$(CONFIG_SOUND) += audio.o
 obj-$(CONFIG_AXI) += axi.o
@@ -43,11 +47,9 @@ ifneq ($(CONFIG_EFI_PARTITION),)
 obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
 endif
 obj-$(CONFIG_FIRMWARE) += firmware.o
-obj-$(CONFIG_DM_GPIO) += gpio.o
 obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o
 obj-$(CONFIG_DM_I2C) += i2c.o
 obj-$(CONFIG_SOUND) += i2s.o
-obj-y += irq.o
 obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
 obj-$(CONFIG_IOMMU) += iommu.o
 obj-$(CONFIG_LED) += led.o
--
2.36.1



Re: [PATCH 1/1] sandbox: cast to pointer from integer of different size

2022-06-12 Thread Bin Meng
On Sun, Jun 12, 2022 at 7:25 PM Heinrich Schuchardt  wrote:
>
> Building sandbox_defconfig on ARMv7 with HOST_32BIT=y results in:
>
> drivers/misc/qfw_sandbox.c:51:25: warning:
> cast to pointer from integer of different size [-Wint-to-pointer-cast]
>51 | void *address = (void *)be64_to_cpu(dma->address);
>
> Add the missing type conversion.
>
> Fixes: 69512551aa84 ("test: qemu: add qfw sandbox driver, dm tests, qemu 
> tests")
> Signed-off-by: Heinrich Schuchardt 
> ---
>  drivers/misc/qfw_sandbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng 


[PATCH 1/1] sandbox: cast to pointer from integer of different size

2022-06-12 Thread Heinrich Schuchardt
Building sandbox_defconfig on ARMv7 with HOST_32BIT=y results in:

drivers/misc/qfw_sandbox.c:51:25: warning:
cast to pointer from integer of different size [-Wint-to-pointer-cast]
   51 | void *address = (void *)be64_to_cpu(dma->address);

Add the missing type conversion.

Fixes: 69512551aa84 ("test: qemu: add qfw sandbox driver, dm tests, qemu tests")
Signed-off-by: Heinrich Schuchardt 
---
 drivers/misc/qfw_sandbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/qfw_sandbox.c b/drivers/misc/qfw_sandbox.c
index b09974d33b..1002df7533 100644
--- a/drivers/misc/qfw_sandbox.c
+++ b/drivers/misc/qfw_sandbox.c
@@ -48,7 +48,7 @@ static void qfw_sandbox_read_entry_dma(struct udevice *dev, 
struct qfw_dma *dma)
 {
u16 entry;
u32 control = be32_to_cpu(dma->control);
-   void *address = (void *)be64_to_cpu(dma->address);
+   void *address = (void *)(uintptr_t)be64_to_cpu(dma->address);
u32 length = be32_to_cpu(dma->length);
struct qfw_sandbox_plat *plat = dev_get_plat(dev);
struct fw_cfg_file *file;
--
2.36.1



Re: [PATCH] mmc: fsl_esdhc: Fix 'Internal clock never stabilised.' error

2022-06-12 Thread Pali Rohár
PING?

On Friday 29 April 2022 20:27:34 Pali Rohár wrote:
> Only newer eSDHC controllers set PRSSTAT_SDSTB flag. So do not wait until
> flag PRSSTAT_SDSTB is set on old pre-2.2 controllers. Instead sleep for
> fixed amount of time like it was before commit 6f883e501b65 ("mmc:
> fsl_esdhc: Add emmc hs200 support").
> 
> This change fixes error 'Internal clock never stabilised.' which is printed
> on P2020 board at every access to SD card.
> 
> Fixes: 6f883e501b65 ("mmc: fsl_esdhc: Add emmc hs200 support")
> Signed-off-by: Pali Rohár 
> ---
>  drivers/mmc/fsl_esdhc.c | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index fdf2cc290e06..3b3587bd8d72 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -503,6 +503,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, 
> struct mmc *mmc, uint clock)
>   u32 time_out;
>   u32 value;
>   uint clk;
> + u32 hostver;
>  
>   if (clock < mmc->cfg->f_min)
>   clock = mmc->cfg->f_min;
> @@ -543,6 +544,14 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, 
> struct mmc *mmc, uint clock)
>  
>   esdhc_clrsetbits32(>sysctl, SYSCTL_CLOCK_MASK, clk);
>  
> + /* Only newer eSDHC controllers set PRSSTAT_SDSTB flag */
> + hostver = esdhc_read32(>esdhc_regs->hostver);
> + if (HOSTVER_VENDOR(hostver) <= VENDOR_V_22) {
> + udelay(1);
> + esdhc_setbits32(>sysctl, SYSCTL_PEREN | SYSCTL_CKEN);
> + return;
> + }
> +
>   time_out = 20;
>   value = PRSSTAT_SDSTB;
>   while (!(esdhc_read32(>prsstat) & value)) {
> @@ -562,6 +571,7 @@ static void esdhc_clock_control(struct fsl_esdhc_priv 
> *priv, bool enable)
>   struct fsl_esdhc *regs = priv->esdhc_regs;
>   u32 value;
>   u32 time_out;
> + u32 hostver;
>  
>   value = esdhc_read32(>sysctl);
>  
> @@ -572,6 +582,13 @@ static void esdhc_clock_control(struct fsl_esdhc_priv 
> *priv, bool enable)
>  
>   esdhc_write32(>sysctl, value);
>  
> + /* Only newer eSDHC controllers set PRSSTAT_SDSTB flag */
> + hostver = esdhc_read32(>esdhc_regs->hostver);
> + if (HOSTVER_VENDOR(hostver) <= VENDOR_V_22) {
> + udelay(1);
> + return;
> + }
> +
>   time_out = 20;
>   value = PRSSTAT_SDSTB;
>   while (!(esdhc_read32(>prsstat) & value)) {
> -- 
> 2.20.1
> 


[PATCH v2 2/2] efi_loader: create boot options without file path

2022-06-12 Thread Heinrich Schuchardt
Allow the efidebug command to create boot options without file path, e.g.

efidebug boot add -b 0001 'short dev only' host 0:1 ''
efidebug boot add -B 0002 'long dev only' host 0:1 ''

Signed-off-by: Heinrich Schuchardt 
---
v2:
update the function description of efi_dp_from_file()
---
 lib/efi_loader/efi_device_path.c | 33 +++-
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 50a988c561..171661b897 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -973,9 +973,22 @@ static void path_to_uefi(void *uefi, const char *src)
*pos = 0;
 }

-/*
- * If desc is NULL, this creates a path with only the file component,
- * otherwise it creates a full path with both device and file components
+/**
+ * efi_dp_from_file() - create device path for file
+ *
+ * The function creates a device path from the block descriptor @desc and the
+ * partition number @part and appends a device path node created describing the
+ * file path @path.
+ *
+ * If @desc is NULL, the device path will not contain nodes describing the
+ * partition.
+ * If @path is an empty string "", the device path will not contain a node
+ * for the file path.
+ *
+ * @desc:  block device descriptor or NULL
+ * @part:  partition number
+ * @path:  file path on partition or ""
+ * Return: device path or NULL in case of an error
  */
 struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
const char *path)
@@ -1002,12 +1015,14 @@ struct efi_device_path *efi_dp_from_file(struct 
blk_desc *desc, int part,
buf = dp_part_fill(buf, desc, part);

/* add file-path: */
-   fp = buf;
-   fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
-   fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
-   fp->dp.length = (u16)fpsize;
-   path_to_uefi(fp->str, path);
-   buf += fpsize;
+   if (*path) {
+   fp = buf;
+   fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
+   fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
+   fp->dp.length = (u16)fpsize;
+   path_to_uefi(fp->str, path);
+   buf += fpsize;
+   }

*((struct efi_device_path *)buf) = END;

--
2.36.1



[PATCH v2 1/2] efi_loader: allow booting from short dev only DP

2022-06-12 Thread Heinrich Schuchardt
Allow booting from a short form device-path without file path, e.g.

/HD(1,GPT,5ef79931-a1aa-4c70-9d67-611e8f69eafd,0x800,0x1000)

Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 lib/efi_loader/efi_bootmgr.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 93f6590530..9b65f34035 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -44,7 +44,7 @@ static const struct efi_runtime_services *rs;
 static
 struct efi_device_path *expand_media_path(struct efi_device_path *device_path)
 {
-   struct efi_device_path *dp, *full_path;
+   struct efi_device_path *dp, *rem, *full_path;
efi_handle_t handle;
efi_status_t ret;

@@ -57,11 +57,10 @@ struct efi_device_path *expand_media_path(struct 
efi_device_path *device_path)
 * booting from removable media.
 */
dp = device_path;
-   ret = EFI_CALL(efi_locate_device_path(
-   _simple_file_system_protocol_guid,
-   , ));
+   handle = efi_dp_find_obj(dp, _simple_file_system_protocol_guid,
+);
if (ret == EFI_SUCCESS) {
-   if (dp->type == DEVICE_PATH_TYPE_END) {
+   if (rem->type == DEVICE_PATH_TYPE_END) {
dp = efi_dp_from_file(NULL, 0,
  "/EFI/BOOT/" BOOTEFI_NAME);
full_path = efi_dp_append(device_path, dp);
--
2.36.1



[PATCH v2 0/2] efi_loader: allow booting from short dev only DP

2022-06-12 Thread Heinrich Schuchardt
Allow creating boot options without file path, e.g.

efidebug boot add -b 0001 'short dev only' host 0:1 ''
efidebug boot add -B 0001 'long dev only' host 0:1 ''

Allow booting from a short form device-path without file path, e.g.

/HD(1,GPT,5ef79931-a1aa-4c70-9d67-611e8f69eafd,0x800,0x1000)

v2:
update the function description of efi_dp_from_file()

Heinrich Schuchardt (2):
  efi_loader: allow booting from short dev only DP
  efi_loader: create boot options without file path

 lib/efi_loader/efi_bootmgr.c |  9 -
 lib/efi_loader/efi_device_path.c | 33 +++-
 2 files changed, 28 insertions(+), 14 deletions(-)

--
2.36.1