RE: [PATCH] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration

2023-11-02 Thread Jaehoon Chung
Hi,

> -Original Message-
> From: U-Boot  On Behalf Of Jaehoon Chung
> Sent: Friday, November 3, 2023 10:07 AM
> To: 'Mattijs Korpershoek' 
> Cc: lu...@denx.de; u-boot@lists.denx.de
> Subject: RE: [PATCH] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration
> 
> Hi Mathtjjs,
> 
> > -Original Message-
> > From: Mattijs Korpershoek 
> > Sent: Thursday, November 2, 2023 6:15 PM
> > To: Jaehoon Chung 
> > Cc: lu...@denx.de; u-boot@lists.denx.de
> > Subject: Re: [PATCH] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration
> >
> > Hi Jaehoon,
> >
> > On mar., oct. 31, 2023 at 15:50, Mattijs Korpershoek 
> >  wrote:
> >
> > > Hi,
> > >
> > > On Mon, 20 Jun 2022 20:13:54 +0900, Jaehoon Chung wrote:
> > >> Add CONFIG_DFU_NAME_MAX_SIZE to change the proper size.
> > >> If name is longer than default size, it can do wrong behavior during 
> > >> updating
> > >> image. So it need to change the proper maximum size.
> > >>
> > >> This patch is proviced the solution to change value with configuration.
> > >>
> > >>
> > >> [...]
> > >
> > > Thanks, Applied to 
> > > https://protect2.fireeye.com/v1/url?k=195a8ba3-78d19e99-195b00ec-74fe4860008a-
> > e609da47a4bcadff=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> > boot%2Fcustodians%2Fu-boot-dfu (u-boot-dfu-next)
> > >
> > > [1/1] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration
> > >   
> > > https://protect2.fireeye.com/v1/url?k=b04b2ae8-d1c03fd2-b04aa1a7-74fe4860008a-
> > d8ec8502221dcca0=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> > boot%2Fcustodians%2Fu-boot-dfu%2F-%2Fcommit%2Fde9b2e10f10996050a10998a0836abe2f9e425e3
> >
> >
> > This patch breaks CI for both arm32 and arm64 platforms:
> >
> > * 
> > https://protect2.fireeye.com/v1/url?k=3179f7cc-50f2e2f6-31787c83-74fe4860008a-
> > a4f5d2c73833c4d5=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> > boot%2Fcustodians%2Fu-boot-dfu%2F-%2Fjobs%2F725163
> > * 
> > https://protect2.fireeye.com/v1/url?k=22773f8e-43fc2ab4-2276b4c1-74fe4860008a-
> > f6dc3d75fe9b283a=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> > boot%2Fcustodians%2Fu-boot-dfu%2F-%2Fjobs%2F725164
> 
> I couldn't access the above CI URL.
> 
> >
> > It breaks because multiple boards which include dfu.h without having
> > CONFIG_DFU being set.
> >
> > Tom attempted to fix this with:
> > https://protect2.fireeye.com/v1/url?k=452a9007-24a1853d-452b1b48-74fe4860008a-
> > a88f870953497071=1=b6fd9ce6-85b6-46a3-81aa-
> > 8aa89d16a9ed=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D369275
> >
> > But that had some different issues, see:
> > https://protect2.fireeye.com/v1/url?k=f1c007bd-904b1287-f1c18cf2-74fe4860008a-
> > a305de1bab5bdff1=1=b6fd9ce6-85b6-46a3-81aa-
> > 8aa89d16a9ed=https%3A%2F%2Flibera.irclog.whitequark.org%2Fu-boot%2F2023-10-31%2335154532;
> >
> > I've fixed it up with the following diff:
> >
> > diff --git a/include/dfu.h b/include/dfu.h
> > index 4573f753c565..2c3ffa3f9297 100644
> > --- a/include/dfu.h
> > +++ b/include/dfu.h
> > @@ -99,7 +99,12 @@ struct virt_internal_data {
> > int dev_num;
> >  };
> >
> > +
> > +#if defined(CONFIG_DFU_NAME_MAX_SIZE)
> >  #define DFU_NAME_SIZE  CONFIG_DFU_NAME_MAX_SIZE
> > +#else
> > +#define DFU_NAME_SIZE  32
> > +#endif
> >  #ifndef DFU_DEFAULT_POLL_TIMEOUT
> >  #define DFU_DEFAULT_POLL_TIMEOUT 0
> >  #endif
> >
> > If you have a better idea to fix this, can you please let me know?
> 
> After checking this, let you inform.

It seems that it is depended on USB_GADGET and SPL_USB_GADGET. How about this?
About  is included in some board files, It needs to check more.

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 6502aba96f54..9922da56e704 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -13,6 +13,14 @@ config DFU_OVER_TFTP
bool
depends on NET

+config DFU_NAME_MAX_SIZE
+   int "Size of the name to be added in dfu entity"
+   default 32
+   depends on DFU || USB_GADGET_DOWNLOAD || SPL_USB_GADGET
+   help
+ This value is used to maximum size. If name is longer than default 
size,
+ we need to change the proper maximum size.
+
 if DFU
 config DFU_WRITE_ALT
bool
@@ -112,13 +120,5 @@ config SYS_DFU_MAX_FILE_SIZE
  this to the maximum filesize (in bytes) for the buffer.
  If undefined it defaults to the CONFIG_SYS_DFU_DATA_BUF_SIZE.

-config DFU_NAME_MAX_SIZE
-   int "Size of the name to be added in dfu entity"
-   default 32
-   depends on DFU
-   help
- This value is used to maximum size. If name is longer than default 
size,
- we need to change the proper maximum size.

I'm running CI with some patch. After checked, I will inform.

Best Regards,
Jaehoon Chung

> 
> > Otherwise, I will squash this to keep CI green.
> >
> > Thank you
> >
> > >
> > > --
> > > Mattijs




[PATCH V2 0/2] doc: board: ti: Cleanup ::prompt usage

2023-11-02 Thread Nishanth Menon
Due to the sequence of merges, it looks like many of k3 documentation
used code-blocks while the rest of the docs migrated to ::prompt.

Sync all to a common style.

based off:
master 07fe79c93c5c Merge tag 'i2cfixes-for-v2024-01-rc2' of 
https://source.denx.de/u-boot/custodians/u-boot-i2c

Changes since V1:
* squashed up the gdb patch to patch#1
* fixedup patch #2 for whitespace indentation miss

v1: https://lore.kernel.org/r/20231103000915.2413501-1...@ti.com

Nishanth Menon (2):
  doc: board: ti: Use prompt prompt_style to simplify documentation
  doc: board: ti: k3 docs: Use ::prompt

 doc/board/ti/am335x_evm.rst   |  39 ---
 doc/board/ti/am62x_beagleplay.rst |  46 ++---
 doc/board/ti/am62x_sk.rst |  18 +++---
 doc/board/ti/am64x_evm.rst|  20 +++---
 doc/board/ti/am65x_evm.rst| 104 +++---
 doc/board/ti/dra7xx_evm.rst   |   3 +-
 doc/board/ti/j7200_evm.rst|  20 +++---
 doc/board/ti/j721e_evm.rst|  40 ++--
 doc/board/ti/j721s2_evm.rst   |  18 +++---
 doc/board/ti/k3.rst   |  44 ++---
 doc/board/ti/ks2_evm.rst  |  15 ++---
 11 files changed, 174 insertions(+), 193 deletions(-)

-- 
2.37.2



[PATCH V2 2/2] doc: board: ti: k3 docs: Use ::prompt

2023-11-02 Thread Nishanth Menon
Use prompt instead of code-block to have copy-paste friendly command
documentation.

Signed-off-by: Nishanth Menon 
---
Changes since v1:
minor fixup for whitespace indentation.

V1: https://lore.kernel.org/r/20231103000915.2413501-4...@ti.com
 doc/board/ti/am62x_beagleplay.rst |  46 ++---
 doc/board/ti/am62x_sk.rst |  18 +++---
 doc/board/ti/am64x_evm.rst|  20 +++---
 doc/board/ti/am65x_evm.rst| 104 +++---
 doc/board/ti/j7200_evm.rst|  20 +++---
 doc/board/ti/j721e_evm.rst|  40 ++--
 doc/board/ti/j721s2_evm.rst   |  18 +++---
 7 files changed, 133 insertions(+), 133 deletions(-)

diff --git a/doc/board/ti/am62x_beagleplay.rst 
b/doc/board/ti/am62x_beagleplay.rst
index 39913b29ab2c..97ab0a4350ed 100644
--- a/doc/board/ti/am62x_beagleplay.rst
+++ b/doc/board/ti/am62x_beagleplay.rst
@@ -55,15 +55,15 @@ Set the variables corresponding to this platform:
 .. include::  k3.rst
 :start-after: .. k3_rst_include_start_common_env_vars_defn
 :end-before: .. k3_rst_include_end_common_env_vars_defn
-.. code-block:: bash
+.. prompt:: bash $
 
- $ export UBOOT_CFG_CORTEXR="am62x_evm_r5_defconfig beagleplay_r5.config"
- $ export UBOOT_CFG_CORTEXA="am62x_evm_a53_defconfig beagleplay_a53.config"
- $ export TFA_BOARD=lite
- $ # we dont use any extra TFA parameters
- $ unset TFA_EXTRA_ARGS
- $ export OPTEE_PLATFORM=k3-am62x
- $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+  export UBOOT_CFG_CORTEXR="am62x_evm_r5_defconfig beagleplay_r5.config"
+  export UBOOT_CFG_CORTEXA="am62x_evm_a53_defconfig beagleplay_a53.config"
+  export TFA_BOARD=lite
+  # we dont use any extra TFA parameters
+  unset TFA_EXTRA_ARGS
+  export OPTEE_PLATFORM=k3-am62x
+  export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
 
 .. include::  am62x_sk.rst
 :start-after: .. am62x_evm_rst_include_start_build_steps
@@ -174,24 +174,24 @@ boot1 partition depends on A/B update requirements.
 
 The following are the steps from Linux shell to program eMMC:
 
-.. code-block:: bash
+.. prompt:: bash #
 
-  # # Enable Boot0 boot
-  # mmc bootpart enable 1 2 /dev/mmcblk0
-  # mmc bootbus set single_backward x1 x8 /dev/mmcblk0
-  # mmc hwreset enable /dev/mmcblk0
+  # Enable Boot0 boot
+  mmc bootpart enable 1 2 /dev/mmcblk0
+  mmc bootbus set single_backward x1 x8 /dev/mmcblk0
+  mmc hwreset enable /dev/mmcblk0
 
-  # # Clear eMMC boot0
-  # echo '0' >> /sys/class/block/mmcblk0boot0/force_ro
-  # dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k
-  # # Write tiboot3.bin
-  # dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=128k
+  # Clear eMMC boot0
+  echo '0' >> /sys/class/block/mmcblk0boot0/force_ro
+  dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k
+  # Write tiboot3.bin
+  dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=128k
 
-  # # Copy the rest of the boot binaries
-  # mount /dev/mmcblk0p1 /boot/firmware
-  # cp tispl.bin /boot/firmware
-  # cp u-boot.img /boot/firmware
-  # sync
+  # Copy the rest of the boot binaries
+  mount /dev/mmcblk0p1 /boot/firmware
+  cp tispl.bin /boot/firmware
+  cp u-boot.img /boot/firmware
+  sync
 
 .. warning ::
 
diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index d7437c6d22f7..25e25fb56ac4 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -76,15 +76,15 @@ Set the variables corresponding to this platform:
 .. include::  ../ti/k3.rst
 :start-after: .. k3_rst_include_start_common_env_vars_defn
 :end-before: .. k3_rst_include_end_common_env_vars_defn
-.. code-block:: bash
+.. prompt:: bash $
 
- $ export UBOOT_CFG_CORTEXR=am62x_evm_r5_defconfig
- $ export UBOOT_CFG_CORTEXA=am62x_evm_a53_defconfig
- $ export TFA_BOARD=lite
- $ # we dont use any extra TFA parameters
- $ unset TFA_EXTRA_ARGS
- $ export OPTEE_PLATFORM=k3-am62x
- $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+  export UBOOT_CFG_CORTEXR=am62x_evm_r5_defconfig
+  export UBOOT_CFG_CORTEXA=am62x_evm_a53_defconfig
+  export TFA_BOARD=lite
+  # we dont use any extra TFA parameters
+  unset TFA_EXTRA_ARGS
+  export OPTEE_PLATFORM=k3-am62x
+  export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
 
 .. am62x_evm_rst_include_start_build_steps
 
@@ -270,6 +270,6 @@ detailed setup information.
 
 To start OpenOCD and connect to the board
 
-.. code-block:: bash
+.. prompt:: bash $
 
   openocd -f board/ti_am625evm.cfg
diff --git a/doc/board/ti/am64x_evm.rst b/doc/board/ti/am64x_evm.rst
index db27461cb14d..fe661b1f49c8 100644
--- a/doc/board/ti/am64x_evm.rst
+++ b/doc/board/ti/am64x_evm.rst
@@ -65,16 +65,16 @@ Set the variables corresponding to this platform:
 .. include::  k3.rst
 :start-after: .. k3_rst_include_start_common_env_vars_defn
 :end-before: .. k3_rst_include_end_common_env_vars_defn
-.. code-block:: bash
-
- $ export UBOOT_CFG_CORTEXR=am64x_evm_r5_defconfig
- $ export UBOOT_CFG_CORTEXA=am64x_evm_a53_defconfig
- $ export TFA_BOARD=lite
- $ # we dont use any extra TFA parameters
- $ unset TFA_EXTRA_ARGS
- $ 

[PATCH V2 1/2] doc: board: ti: Use prompt prompt_style to simplify documentation

2023-11-02 Thread Nishanth Menon
The sphinx-prompt documentation[0] provides examples on how we can use
prompt as a parameter to simplify the description. Use the same.

While at it, ensure to make all relevant prompts clarified such as gdb
prompts.

[0] http://sbrunner.github.io/sphinx-prompt/

Signed-off-by: Nishanth Menon 
---
Changes since V1:
Squashed up gdb prompt as well to this patch.

V1: https://lore.kernel.org/r/20231103000915.2413501-2...@ti.com
 doc/board/ti/am335x_evm.rst | 39 +++-
 doc/board/ti/dra7xx_evm.rst |  3 +--
 doc/board/ti/k3.rst | 44 ++---
 doc/board/ti/ks2_evm.rst| 15 +
 4 files changed, 41 insertions(+), 60 deletions(-)

diff --git a/doc/board/ti/am335x_evm.rst b/doc/board/ti/am335x_evm.rst
index 2ba651eb6df9..769362816b78 100644
--- a/doc/board/ti/am335x_evm.rst
+++ b/doc/board/ti/am335x_evm.rst
@@ -84,8 +84,7 @@ bootable image was not created.
 
 Within the SECDEV package exists an image creation script:
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
${TI_SECURE_DEV_PKG}/scripts/create-boot-image.sh
 
@@ -97,8 +96,7 @@ possible.
 The script is basically the only required interface to the TI SECDEV
 package for creating a bootable SPL image for secure TI devices.
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
create-boot-image.sh \
   
@@ -184,8 +182,7 @@ The exact details of the how the images are secured is 
handled by the
 SECDEV package. Within the SECDEV package exists a script to process
 an input binary image:
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
${TI_SECURE_DEV_PKG}/scripts/secure-binary-image.sh
 
@@ -206,8 +203,7 @@ only accessible when the ARM core is operating in the 
secure mode).
 Invoking the secure-binary-image script for Secure Devices
 ^^
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
secure-binary-image.sh  
 
@@ -247,8 +243,7 @@ into memory, then written to NAND.
 
 2. Flashing NAND via MMC/SD
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
# select BOOTSEL to MMC/SD boot and boot from MMC/SD card
mmc rescan
@@ -334,8 +329,7 @@ had a FAT partition (such as on a Beaglebone Black) it is 
not enough to
 write garbage into the area, you must delete it from the partition table
 first.
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
# Ensure we are able to talk with this mmc device
mmc rescan
@@ -366,8 +360,7 @@ the FAT filesystem (only the uImage MUST be for this to 
function
 afterwards) along with a Falcon Mode aware MLO and the FAT partition has
 already been created and marked bootable:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
mmc rescan
# Load kernel and device tree into memory, perform export
@@ -386,8 +379,7 @@ This will print a number of lines and then end with 
something like:
 
 So then you:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
fatwrite mmc 0:1 0x80f8 args 8928
 
@@ -400,8 +392,7 @@ already located on the NAND somewhere (such as filesystem 
or mtd partition)
 along with a Falcon Mode aware MLO written to the correct locations for
 booting and mtdparts have been configured correctly for the board:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
nand read ${loadaddr} kernel
load nand rootfs ${fdtaddr} /boot/am335x-evm.dtb
@@ -425,8 +416,7 @@ The output of the 'dm tree' command shows which driver is 
bound to which
 device, so the user can easily configure their platform differently from
 the command line:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
dm tree
 
@@ -444,8 +434,7 @@ the command line:
 Typically here any network command performed using the usb_ether
 interface would work, while using other gadgets would fail:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
fastboot usb 0
 
@@ -462,8 +451,7 @@ least from a bootloader point of view). The solution here 
would be to
 use the unbind command specifying the class and index parameters (as
 shown above in the 'dm tree' output) to target the driver to unbind:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
unbind ethernet 1
 
@@ -471,8 +459,7 @@ The output of the 'dm tree' command now shows the 
availability of the
 first USB device controller, the fastboot gadget will now be able to
 bind with it:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
dm tree
 
diff --git a/doc/board/ti/dra7xx_evm.rst b/doc/board/ti/dra7xx_evm.rst
index 4503b5e92229..8e5d95535fa0 100644
--- a/doc/board/ti/dra7xx_evm.rst
+++ b/doc/board/ti/dra7xx_evm.rst
@@ -71,8 +71,7 @@ example we load MLO and u-boot.img from the build into DDR 
and then use
 'mmc bootbus' to set the required rate (see TRM) and 'mmc partconfig' to
 set boot0 as the boot device.
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
setenv autoload no
usb start
diff --git 

RE: uboot reports adding disk failed(EFI_NOT_FOUND) and first disk is gone in next scsi scan

2023-11-02 Thread Hongxing Zhu
Hi Simon:
I found that the EFI complained that the disk install path is not updated for 
the second disk.
The install path is “EFI: installed device path 
'/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0)'”
when first disk is added.

But the path is same when the second or later disks are added, and EFI repors 
that the path had been installed already.
EFI: Path /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0) already 
installed

That’s why the below error when run efi_disk_create_raw() function.
Adding disk for ahci_scsi.id0lun0 failed 
(err=-9223372036854775788/0x8014)

Do you have any clues about this?
Thanks in advanced.

Best Regards
Richard Zhu

From: Hongxing Zhu
Sent: 2023年11月1日 10:57
To: s...@chromium.org
Cc: u-boot@lists.denx.de
Subject: uboot reports adding disk failed(EFI_NOT_FOUND) and first disk is gone 
in next scsi scan

Hi Simon:
Nice to meet you.
The u-boot I used is based on v2023.04 tagged version.
Layerscape LX2160A RDB board has four SATA controllers.
Based on LX2160A RDB board and two or more SATA disks connected.
I encounter one “scsi scan” problem.

After the first SATA disk is detected and probed properly in the first “scsi 
scan”.
The other disks would complain that “EFI_NOT_FOUND” error listed below,
when run the first “scsi scan” command in uboot environment.
Does this error matter?
BTW, “scsi info” says that all disk info can be dumped, and all disks are works 
well,
after the first “scsi scan”

In the consecutive rescan operations issued by “scsi reset” or “scsi scan” 
commends,
the disks would report “unable to unbind devices (-1E)” error.
The first disk is disappeared at all after the next “scsi scan” operations is 
finished.

Did you used to encounter such kind of issue?

Any suggestions and guidance are very appreciated.
Logs:
=> scsi scan
scanning bus for devices...
Target spinup took 0 ms.
AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
  Device 0: (0:0) Vendor: ATA Prod.: ST1000DM010-2EP1 Rev: CC43
Type: Hard Disk
Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
Target spinup took 0 ms.
AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
Adding disk for ahci_scsi.id0lun0 failed 
(err=-9223372036854775788/0x8014)
SATA link 0 timeout.
AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
SATA link 0 timeout.
AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
=> scsi info
Device 0: (0:0) Vendor: ATA Prod.: ST1000DM010-2EP1 Rev: CC43
Type: Hard Disk
Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
Device 1: (0:0) Vendor: ATA Prod.: ST500DM002-1BD14 Rev: KC45
Type: Hard Disk
Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)
=> ls scsi 0:1
   4096 .
   4096 ..
  16384 lost+found

   4096 var
 12 linuxrc
=> ls scsi 1:1
   4096 .
   4096 ..
  16384 lost+found

   4096 usr
   4096 var

=> scsi reset

Reset SCSI
scanning bus for devices...
unable to unbind devices (-1E)
=> ls scsi 0:1
** Bad device specification scsi 0 **
Couldn't find partition scsi 0:1
=> ls scsi 1:1
   4096 .
   4096 ..
  16384 lost+found

   4096 var

=> scsi info
Device 1: (0:0) Vendor: ATA Prod.: ST500DM002-1BD14 Rev: KC45
Type: Hard Disk
Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)

Best Regards
Richard Zhu



Re: [PATCH 0/3] doc: board: ti: Cleanup ::prompt usage

2023-11-02 Thread Nishanth Menon
On 19:09-20231102, Nishanth Menon wrote:
> Due to the sequence of merges, it looks like many of k3 documentation
> used code-blocks while the rest of the docs migrated to ::prompt.
> 
> Sync all to a common style.
> 
> based off:
> master 07fe79c93c5c Merge tag 'i2cfixes-for-v2024-01-rc2' of 
> https://source.denx.de/u-boot/custodians/u-boot-i2c
> 
> Nishanth Menon (3):
>   doc: board: ti: Use prompt prompt_style to simplify documentation
>   doc: board: ti: k3: Use ::prompt for gdb commands
>   doc: board: ti: k3 docs: Use ::prompt
> 

I apologize for the noise. I just realized I have the formatting
off by one leading space and introduced a pervasive bug in this
series. please ignore this series, I will post a follow on v2.

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


RE: [PATCH] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration

2023-11-02 Thread Jaehoon Chung
Hi Mathtjjs,

> -Original Message-
> From: Mattijs Korpershoek 
> Sent: Thursday, November 2, 2023 6:15 PM
> To: Jaehoon Chung 
> Cc: lu...@denx.de; u-boot@lists.denx.de
> Subject: Re: [PATCH] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration
> 
> Hi Jaehoon,
> 
> On mar., oct. 31, 2023 at 15:50, Mattijs Korpershoek 
>  wrote:
> 
> > Hi,
> >
> > On Mon, 20 Jun 2022 20:13:54 +0900, Jaehoon Chung wrote:
> >> Add CONFIG_DFU_NAME_MAX_SIZE to change the proper size.
> >> If name is longer than default size, it can do wrong behavior during 
> >> updating
> >> image. So it need to change the proper maximum size.
> >>
> >> This patch is proviced the solution to change value with configuration.
> >>
> >>
> >> [...]
> >
> > Thanks, Applied to 
> > https://protect2.fireeye.com/v1/url?k=195a8ba3-78d19e99-195b00ec-74fe4860008a-
> e609da47a4bcadff=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> boot%2Fcustodians%2Fu-boot-dfu (u-boot-dfu-next)
> >
> > [1/1] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration
> >   
> > https://protect2.fireeye.com/v1/url?k=b04b2ae8-d1c03fd2-b04aa1a7-74fe4860008a-
> d8ec8502221dcca0=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> boot%2Fcustodians%2Fu-boot-dfu%2F-%2Fcommit%2Fde9b2e10f10996050a10998a0836abe2f9e425e3
> 
> 
> This patch breaks CI for both arm32 and arm64 platforms:
> 
> * 
> https://protect2.fireeye.com/v1/url?k=3179f7cc-50f2e2f6-31787c83-74fe4860008a-
> a4f5d2c73833c4d5=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> boot%2Fcustodians%2Fu-boot-dfu%2F-%2Fjobs%2F725163
> * 
> https://protect2.fireeye.com/v1/url?k=22773f8e-43fc2ab4-2276b4c1-74fe4860008a-
> f6dc3d75fe9b283a=1=b6fd9ce6-85b6-46a3-81aa-8aa89d16a9ed=https%3A%2F%2Fsource.denx.de%2Fu-
> boot%2Fcustodians%2Fu-boot-dfu%2F-%2Fjobs%2F725164

I couldn't access the above CI URL.

> 
> It breaks because multiple boards which include dfu.h without having
> CONFIG_DFU being set.
> 
> Tom attempted to fix this with:
> https://protect2.fireeye.com/v1/url?k=452a9007-24a1853d-452b1b48-74fe4860008a-
> a88f870953497071=1=b6fd9ce6-85b6-46a3-81aa-
> 8aa89d16a9ed=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D369275
> 
> But that had some different issues, see:
> https://protect2.fireeye.com/v1/url?k=f1c007bd-904b1287-f1c18cf2-74fe4860008a-
> a305de1bab5bdff1=1=b6fd9ce6-85b6-46a3-81aa-
> 8aa89d16a9ed=https%3A%2F%2Flibera.irclog.whitequark.org%2Fu-boot%2F2023-10-31%2335154532;
> 
> I've fixed it up with the following diff:
> 
> diff --git a/include/dfu.h b/include/dfu.h
> index 4573f753c565..2c3ffa3f9297 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -99,7 +99,12 @@ struct virt_internal_data {
> int dev_num;
>  };
> 
> +
> +#if defined(CONFIG_DFU_NAME_MAX_SIZE)
>  #define DFU_NAME_SIZE  CONFIG_DFU_NAME_MAX_SIZE
> +#else
> +#define DFU_NAME_SIZE  32
> +#endif
>  #ifndef DFU_DEFAULT_POLL_TIMEOUT
>  #define DFU_DEFAULT_POLL_TIMEOUT 0
>  #endif
> 
> If you have a better idea to fix this, can you please let me know?

After checking this, let you inform.

> Otherwise, I will squash this to keep CI green.
> 
> Thank you
> 
> >
> > --
> > Mattijs



[PATCH 13/15] arm: dts: Add k3-j721e-beagleboneai64

2023-11-02 Thread Nishanth Menon
From: Robert Nelson 

BeagleBoard.org BeagleBone AI-64 is an open source hardware single
board computer based on the Texas Instruments TDA4VM SoC featuring
dual-core 2.0GHz Arm Cortex-A72 processor, C7x+MMA and 2 C66x
floating-point VLIW DSPs, 3x dual ARM Cortex-R5 co-processors,
2x 6-core Programmable Real-Time Unit and Industrial Communication
SubSystem, PowerVR Rogue 8XE GE8430 3D GPU. The board features 4GB
DDR4, USB3.0 Type-C, 2x USB SS Type-A, miniDisplayPort, 2x 4-lane
CSI, DSI, 16GB eMMC flash, 1G Ethernet, M.2 E-key for WiFi/BT, and
BeagleBone expansion headers.

This board family can be indentified by the BBONEAI-64-B0 in the
at24 eeprom:

[aa 55 33 ee 01 37 00 10  2e 00 42 42 4f 4e 45 41 |.U3..7BBONEA|]
[49 2d 36 34 2d 42 30 2d  00 00 42 30 30 30 37 38 |I-64-B0-..B00078|]

Baseline of the devicetree is from v6.6-rc1

https://beagleboard.org/ai-64
https://git.beagleboard.org/beagleboard/beaglebone-ai-64

Signed-off-by: Robert Nelson 
Signed-off-by: Nishanth Menon 
---
 arch/arm/dts/Makefile |5 +-
 .../dts/k3-j721e-beagleboneai64-u-boot.dtsi   |  206 ++
 arch/arm/dts/k3-j721e-beagleboneai64.dts  |  993 
 .../k3-j721e-ddr-beagleboneai64-lp4-3200.dtsi | 2200 +
 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts   |   96 +
 board/ti/j721e/MAINTAINERS|7 +
 6 files changed, 3506 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
 create mode 100644 arch/arm/dts/k3-j721e-beagleboneai64.dts
 create mode 100644 arch/arm/dts/k3-j721e-ddr-beagleboneai64-lp4-3200.dtsi
 create mode 100644 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 55aceb51cdb0..2a76acd312d8 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1368,7 +1368,10 @@ dtb-$(CONFIG_SOC_K3_J721E) += 
k3-j721e-common-proc-board.dtb \
  k3-j7200-common-proc-board.dtb \
  k3-j7200-r5-common-proc-board.dtb \
  k3-j721e-sk.dtb \
- k3-j721e-r5-sk.dtb
+ k3-j721e-r5-sk.dtb \
+ k3-j721e-beagleboneai64.dtb \
+ k3-j721e-r5-beagleboneai64.dtb
+
 dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-base-board.dtb\
   k3-am68-sk-r5-base-board.dtb\
   k3-j721s2-common-proc-board.dtb\
diff --git a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi 
b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
new file mode 100644
index ..7080906ef8de
--- /dev/null
+++ b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
@@ -0,0 +1,206 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * https://beagleboard.org/ai-64
+ *
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2022 Jason Kridner, BeagleBoard.org Foundation
+ * Copyright (C) 2022-2023 Robert Nelson, BeagleBoard.org Foundation
+ */
+
+/ {
+   memory@8000 {
+   bootph-all;
+   };
+
+   /* Keep the LEDs on by default to indicate life */
+   leds {
+   bootph-all;
+   led-0 {
+   default-state = "on";
+   bootph-all;
+   };
+
+   led-1 {
+   default-state = "on";
+   bootph-all;
+   };
+
+   led-2 {
+   default-state = "on";
+   bootph-all;
+   };
+
+   led-3 {
+   default-state = "on";
+   bootph-all;
+   };
+
+   led-4 {
+   default-state = "on";
+   bootph-all;
+   };
+   };
+};
+
+_main {
+   bootph-all;
+};
+
+_navss {
+   bootph-all;
+};
+
+_mcu_wakeup {
+   bootph-all;
+
+   chipid@4314 {
+   bootph-all;
+   };
+};
+
+_navss {
+   bootph-all;
+};
+
+_ringacc {
+   reg = <0x0 0x2b80 0x0 0x40>,
+   <0x0 0x2b00 0x0 0x40>,
+   <0x0 0x2859 0x0 0x100>,
+   <0x0 0x2a50 0x0 0x4>,
+   <0x0 0x2844 0x0 0x4>;
+   reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
+   bootph-all;
+};
+
+_udmap {
+   reg = <0x0 0x285c 0x0 0x100>,
+   <0x0 0x284c 0x0 0x4000>,
+   <0x0 0x2a80 0x0 0x4>,
+   <0x0 0x284a 0x0 0x4000>,
+   <0x0 0x2aa0 0x0 0x4>,
+   <0x0 0x2840 0x0 0x2000>;
+   reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+   "tchanrt", "rflow";
+   bootph-all;
+};
+
+_proxy_main {
+   bootph-all;
+};
+
+ {
+   bootph-all;
+   k3_sysreset: sysreset-controller {
+   compatible = "ti,sci-sysreset";
+

[PATCH 1/1] [u-boot][master][PATCH v6] pico-imx7d: add baseboard SD card boot detect

2023-11-02 Thread egyszeregy
From: Benjamin Szőke 

Technexion PICO-IMX7 SoM is supporting USDHC3 (eMMC or micro SD on SoM)
and USDHC1 (SD on carrier board) to use on any carrier board like
PICO-NYMPH. Based on the U-Boot version from Technexion it adds
baseboard SD card boot detect to able to boot from selected USDHC1
or USDHC3 boot devices.

Signed-off-by: Benjamin Szőke 
---
 arch/arm/dts/imx7d-pico-pi-u-boot.dtsi   | 11 +--
 board/technexion/pico-imx7d/Makefile |  2 +-
 board/technexion/pico-imx7d/pico-imx7d.c | 53 +-
 board/technexion/pico-imx7d/spl.c| 91 ++--
 include/configs/pico-imx7d.h |  4 +-
 5 files changed, 146 insertions(+), 15 deletions(-)

diff --git a/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi 
b/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi
index 843b4583e5..3dd01e36a4 100644
--- a/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi
+++ b/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi
@@ -1,11 +1,12 @@
 #include "imx7s-u-boot.dtsi"
 
 /{
-aliases {
-mmc0 = 
-usb0 = 
-display0 = 
-};
+   aliases {
+   mmc0 = 
+   mmc1 = 
+   usb0 = 
+   display0 = 
+   };
 };
 
  {
diff --git a/board/technexion/pico-imx7d/Makefile 
b/board/technexion/pico-imx7d/Makefile
index 4ae3d606b5..61b55fcc55 100644
--- a/board/technexion/pico-imx7d/Makefile
+++ b/board/technexion/pico-imx7d/Makefile
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0+
 # (C) Copyright 2017 NXP Semiconductors
 
-obj-y  := pico-imx7d.o spl.o
+obj-y  := pico-imx7d.o spl.o ../../freescale/common/mmc.o
diff --git a/board/technexion/pico-imx7d/pico-imx7d.c 
b/board/technexion/pico-imx7d/pico-imx7d.c
index 6e98b85b28..157aea6189 100644
--- a/board/technexion/pico-imx7d/pico-imx7d.c
+++ b/board/technexion/pico-imx7d/pico-imx7d.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -25,6 +26,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define UART_PAD_CTRL  (PAD_CTL_DSE_3P3V_49OHM | \
PAD_CTL_PUS_PU100KOHM | PAD_CTL_HYS)
 
+#define PICO_MMC0 0
+#define PICO_MMC0_BLK 2
+#define PICO_MMC1 1
+#define PICO_MMC1_BLK 0
+
 int dram_init(void)
 {
gd->ram_size = imx_ddr_size();
@@ -106,7 +112,7 @@ int board_phy_config(struct phy_device *phydev)
 {
unsigned short val;
 
-   /* To enable AR8035 ouput a 125MHz clk from CLK_25M */
+   /* To enable AR8035 output a 125MHz clk from CLK_25M */
phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);
phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);
phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);
@@ -176,6 +182,12 @@ int board_late_init(void)
 
set_wdog_reset(wdog);
 
+#if CONFIG_IS_ENABLED(FSL_ESDHC_IMX)
+#if defined(CONFIG_ENV_IS_IN_MMC) || defined(CONFIG_ENV_IS_NOWHERE)
+   board_late_mmc_env_init();
+#endif /* CONFIG_ENV_IS_IN_MMC or CONFIG_ENV_IS_NOWHERE */
+#endif
+
/*
 * Do not assert internal WDOG_RESET_B_DEB(controlled by bit 4),
 * since we use PMIC_PWRON to reset the board.
@@ -210,3 +222,42 @@ int board_ehci_hcd_init(int port)
}
return 0;
 }
+
+int mmc_get_env_dev(void)
+{
+   int dev_no = 0;
+
+   switch (get_boot_device()) {
+   case SD3_BOOT:
+   case MMC3_BOOT:
+   env_set("bootdev", "MMC3");
+   dev_no = PICO_MMC0;
+   break;
+   case SD1_BOOT:
+   env_set("bootdev", "SD1");
+   dev_no = PICO_MMC1;
+   break;
+   default:
+   printf("Wrong boot device!");
+   }
+
+   return dev_no;
+}
+
+int mmc_map_to_kernel_blk(int dev_no)
+{
+   int blk_no = 0;
+
+   switch (dev_no) {
+   case PICO_MMC0:
+   blk_no = PICO_MMC0_BLK;
+   break;
+   case PICO_MMC1:
+   blk_no = PICO_MMC1_BLK;
+   break;
+   default:
+   printf("Invalid MMC device!");
+   }
+
+   return blk_no;
+}
diff --git a/board/technexion/pico-imx7d/spl.c 
b/board/technexion/pico-imx7d/spl.c
index c6b21aaa42..0192eafbaa 100644
--- a/board/technexion/pico-imx7d/spl.c
+++ b/board/technexion/pico-imx7d/spl.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -159,7 +160,20 @@ void reset_cpu(void)
 #define USDHC_PAD_CTRL (PAD_CTL_DSE_3P3V_32OHM | PAD_CTL_SRE_SLOW | \
PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PUS_PU47KOHM)
 
-static iomux_v3_cfg_t const usdhc3_pads[] = {
+#define USDHC1_CD_GPIO IMX_GPIO_NR(5, 0)
+/* EMMC/SD */
+static const iomux_v3_cfg_t usdhc1_pads[] = {
+   MX7D_PAD_SD1_CLK__SD1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX7D_PAD_SD1_CMD__SD1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX7D_PAD_SD1_DATA0__SD1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX7D_PAD_SD1_DATA1__SD1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX7D_PAD_SD1_DATA2__SD1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX7D_PAD_SD1_DATA3__SD1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   

[PATCH 04/15] board: ti: j721e: evm: Drop unused headers

2023-11-02 Thread Nishanth Menon
Drop headers that are no longer necessary for build

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/evm.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 75d51a0552c4..8f0996c32ee6 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -8,21 +8,13 @@
  */
 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 
 #include "../common/board_detect.h"
 
-- 
2.40.0



[PATCH 12/15] arm: dts: k3-j721e-binman: Use macros that can be overridden for dtbs

2023-11-02 Thread Nishanth Menon
Allow the reuse of k3-j721e-binman for other platforms such as
BeagleBone-AI64. Provide a couple of macros to indicate the correct
dtb to be able to re-use soc binman dtsi file

Signed-off-by: Nishanth Menon 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
index d9c4fbf593af..6166c931dea6 100644
--- a/arch/arm/dts/k3-j721e-binman.dtsi
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -295,16 +295,28 @@
 #ifdef CONFIG_TARGET_J721E_A72_EVM
 
 #define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#ifndef SPL_J721E_EVM_DTB
 #define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
+#endif
 
 #define UBOOT_NODTB "u-boot-nodtb.bin"
+
+#ifndef J721E_EVM_DTB
 #define J721E_EVM_DTB "u-boot.dtb"
+#endif
 
 #ifdef DUAL_DTB_BINMAN
+
+#ifndef SPL_J721E_SK_DTB
 #define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
+#endif
+
+#ifndef J721E_SK_DTB
 #define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
 #endif
 
+#endif
+
  {
ti-dm {
filename = "ti-dm.bin";
-- 
2.40.0



[PATCH 05/15] board: ti: j721e: evm: Switch to using IS_ENABLED

2023-11-02 Thread Nishanth Menon
Switch to using IS_ENABLED() for inline function usage.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/evm.c | 83 ++--
 1 file changed, 42 insertions(+), 41 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 8f0996c32ee6..17640ae79665 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -300,53 +300,54 @@ static int probe_daughtercards(void)
printf("Detected: %s rev %s\n", ep.name, ep.version);
daughter_card_detect_flags[i] = true;
 
-#ifndef CONFIG_SPL_BUILD
-   int j;
-   /*
-* Populate any MAC addresses from daughtercard into the U-Boot
-* environment, starting with a card-specific offset so we can
-* have multiple ext_cards contribute to the MAC pool in a well-
-* defined manner.
-*/
-   for (j = 0; j < mac_addr_cnt; j++) {
-   if (!is_valid_ethaddr((u8 *)mac_addr[j]))
-   continue;
-
-   eth_env_set_enetaddr_by_index("eth",
- ext_cards[i].eth_offset + 
j,
- (uchar *)mac_addr[j]);
+   if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
+   int j;
+   /*
+* Populate any MAC addresses from daughtercard into 
the U-Boot
+* environment, starting with a card-specific offset so 
we can
+* have multiple ext_cards contribute to the MAC pool 
in a well-
+* defined manner.
+*/
+   for (j = 0; j < mac_addr_cnt; j++) {
+   if (!is_valid_ethaddr((u8 *)mac_addr[j]))
+   continue;
+
+   eth_env_set_enetaddr_by_index("eth",
+ 
ext_cards[i].eth_offset + j,
+ (uchar 
*)mac_addr[j]);
+   }
}
-#endif
}
-#ifndef CONFIG_SPL_BUILD
-   char name_overlays[1024] = { 0 };
 
-   for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
-   if (!daughter_card_detect_flags[i])
-   continue;
+   if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
+   char name_overlays[1024] = { 0 };
 
-   /* Skip if no overlays are to be added */
-   if (!strlen(ext_cards[i].dtbo_name))
-   continue;
+   for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
+   if (!daughter_card_detect_flags[i])
+   continue;
 
-   /*
-* Make sure we are not running out of buffer space by checking
-* if we can fit the new overlay, a trailing space to be used
-* as a separator, plus the terminating zero.
-*/
-   if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
-   sizeof(name_overlays))
-   return -ENOMEM;
-
-   /* Append to our list of overlays */
-   strcat(name_overlays, ext_cards[i].dtbo_name);
-   strcat(name_overlays, " ");
-   }
+   /* Skip if no overlays are to be added */
+   if (!strlen(ext_cards[i].dtbo_name))
+   continue;
 
-   /* Apply device tree overlay(s) to the U-Boot environment, if any */
-   if (strlen(name_overlays))
-   return env_set("name_overlays", name_overlays);
-#endif
+   /*
+* Make sure we are not running out of buffer space by 
checking
+* if we can fit the new overlay, a trailing space to 
be used
+* as a separator, plus the terminating zero.
+*/
+   if (strlen(name_overlays) + 
strlen(ext_cards[i].dtbo_name) + 2 >
+   sizeof(name_overlays))
+   return -ENOMEM;
+
+   /* Append to our list of overlays */
+   strcat(name_overlays, ext_cards[i].dtbo_name);
+   strcat(name_overlays, " ");
+   }
+
+   /* Apply device tree overlay(s) to the U-Boot environment, if 
any */
+   if (strlen(name_overlays))
+   return env_set("name_overlays", name_overlays);
+   }
 
return 0;
 }
-- 
2.40.0



[PATCH 11/15] arm: dts: k3-j721e-binman: Allow a single board configuration

2023-11-02 Thread Nishanth Menon
Allow the reuse of k3-j721e-binman for other platforms such as
BeagleBone-AI64. We don't need to build SK device tree blobs in-order
to be able to build dtbs for single configuration platforms.

Signed-off-by: Nishanth Menon 
---
 arch/arm/dts/k3-j721e-binman.dtsi | 21 ++-
 .../k3-j721e-common-proc-board-u-boot.dtsi|  2 ++
 arch/arm/dts/k3-j721e-sk-u-boot.dtsi  |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-j721e-binman.dtsi 
b/arch/arm/dts/k3-j721e-binman.dtsi
index 4f566c21a9af..d9c4fbf593af 100644
--- a/arch/arm/dts/k3-j721e-binman.dtsi
+++ b/arch/arm/dts/k3-j721e-binman.dtsi
@@ -296,11 +296,14 @@
 
 #define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
-#define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
 
 #define UBOOT_NODTB "u-boot-nodtb.bin"
 #define J721E_EVM_DTB "u-boot.dtb"
+
+#ifdef DUAL_DTB_BINMAN
+#define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
 #define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
+#endif
 
  {
ti-dm {
@@ -400,6 +403,7 @@
};
};
 
+#ifdef DUAL_DTB_BINMAN
fdt-1 {
description = "k3-j721e-sk";
type = "flat_dt";
@@ -414,6 +418,7 @@
filename = SPL_J721E_SK_DTB;
};
};
+#endif
};
 
configurations {
@@ -426,12 +431,14 @@
fdt = "fdt-0";
};
 
+#ifdef DUAL_DTB_BINMAN
conf-1 {
description = "k3-j721e-sk";
firmware = "atf";
loadables = "tee", "dm", "spl";
fdt = "fdt-1";
};
+#endif
};
};
};
@@ -482,6 +489,7 @@
};
};
 
+#ifdef DUAL_DTB_BINMAN
fdt-1 {
description = "k3-j721e-sk";
type = "flat_dt";
@@ -499,6 +507,7 @@
algo = "crc32";
};
};
+#endif
};
 
configurations {
@@ -511,12 +520,14 @@
fdt = "fdt-0";
};
 
+#ifdef DUAL_DTB_BINMAN
conf-1 {
description = "k3-j721e-sk";
firmware = "uboot";
loadables = "uboot";
fdt = "fdt-1";
};
+#endif
};
};
};
@@ -595,6 +606,7 @@
};
};
 
+#ifdef DUAL_DTB_BINMAN
fdt-1 {
description = "k3-j721e-sk";
type = "flat_dt";
@@ -604,6 +616,7 @@
filename = SPL_J721E_SK_DTB;
};
};
+#endif
};
 
configurations {
@@ -616,12 +629,14 @@
fdt = "fdt-0";
};
 
+#ifdef DUAL_DTB_BINMAN
conf-1 {
description = "k3-j721e-sk";
firmware = "atf";
loadables = "tee", "dm", "spl";
fdt = "fdt-1";
};
+#endif
};
};
};
@@ -664,6 +679,7 @@
};
};
 
+#ifdef DUAL_DTB_BINMAN
fdt-1 {
description = "k3-j721e-sk";
type = "flat_dt";
@@ -676,6 +692,7 @@
algo = "crc32";
};
};
+#endif
};
 
configurations {
@@ -688,12 +705,14 @@
fdt = "fdt-0";
};
 
+#ifdef DUAL_DTB_BINMAN
 

[PATCH 08/15] board: ti: j721e: evm: Split code to isolate eeprom detected logic

2023-11-02 Thread Nishanth Menon
Move code out of evm.c that is based on evm specific checks for board
variants and initialization sequences there of.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/Makefile|   1 +
 board/ti/j721e/{evm.c => board-variants.c} | 172 +
 board/ti/j721e/evm.c   | 409 +
 board/ti/j721e/evm.h   |  24 ++
 4 files changed, 53 insertions(+), 553 deletions(-)
 copy board/ti/j721e/{evm.c => board-variants.c} (75%)
 create mode 100644 board/ti/j721e/evm.h

diff --git a/board/ti/j721e/Makefile b/board/ti/j721e/Makefile
index 97535f5d86d1..f42fcf5c463b 100644
--- a/board/ti/j721e/Makefile
+++ b/board/ti/j721e/Makefile
@@ -6,3 +6,4 @@
 #
 
 obj-y  += evm.o
+obj-${CONFIG_TI_I2C_BOARD_DETECT} += board-variants.o
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/board-variants.c
similarity index 75%
copy from board/ti/j721e/evm.c
copy to board/ti/j721e/board-variants.c
index 0fc141776818..ada0a9238981 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/board-variants.c
@@ -1,22 +1,21 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Board specific initialization for J721E EVM
+ * Board variation detection and management based on EEPROM detect logic
  *
- * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
- * Lokesh Vutla 
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
  *
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
-#include 
 
 #include "../common/board_detect.h"
+#include "evm.h"
 
 #define board_is_j721e_som()   (board_ti_k3_is("J721EX-PM1-SOM") || \
 board_ti_k3_is("J721EX-PM2-SOM"))
@@ -30,49 +29,6 @@
 /* Max number of MAC addresses that are parsed/processed per daughter card */
 #define DAUGHTER_CARD_NO_OF_MAC_ADDR   8
 
-DECLARE_GLOBAL_DATA_PTR;
-
-int board_init(void)
-{
-   return 0;
-}
-
-int dram_init(void)
-{
-   if (IS_ENABLED(CONFIG_PHYS_64BIT))
-   gd->ram_size = 0x1;
-   else
-   gd->ram_size = 0x8000;
-
-   return 0;
-}
-
-phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
-{
-   /* Limit RAM used by U-Boot to the DDR low region */
-   if (IS_ENABLED(CONFIG_PHYS_64BIT) && gd->ram_top > 0x1)
-   return 0x1;
-
-   return gd->ram_top;
-}
-
-int dram_init_banksize(void)
-{
-   /* Bank 0 declares the memory available in the DDR low region */
-   gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
-   gd->bd->bi_dram[0].size = 0x8000;
-   gd->ram_size = 0x8000;
-
-   if (IS_ENABLED(CONFIG_PHYS_64BIT)) {
-   /* Bank 1 declares the memory available in the DDR high region 
*/
-   gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
-   gd->bd->bi_dram[1].size = 0x8000;
-   gd->ram_size = 0x1;
-   }
-
-   return 0;
-}
-
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
@@ -138,7 +94,6 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 }
 #endif
 
-#ifdef CONFIG_TI_I2C_BOARD_DETECT
 int do_board_detect(void)
 {
int ret;
@@ -348,74 +303,7 @@ static int probe_daughtercards(void)
 
return 0;
 }
-#endif
-
-void configure_serdes_torrent(void)
-{
-   struct udevice *dev;
-   struct phy serdes;
-   int ret;
-
-   ret = uclass_get_device_by_driver(UCLASS_PHY,
- DM_DRIVER_GET(torrent_phy_provider),
- );
-   if (ret) {
-   printf("Torrent init failed:%d\n", ret);
-   return;
-   }
-
-   serdes.dev = dev;
-   serdes.id = 0;
-
-   ret = generic_phy_init();
-   if (ret) {
-   printf("phy_init failed!!: %d\n", ret);
-   return;
-   }
 
-   ret = generic_phy_power_on();
-   if (ret) {
-   printf("phy_power_on failed!!: %d\n", ret);
-   return;
-   }
-}
-
-void configure_serdes_sierra(void)
-{
-   struct udevice *dev, *link_dev;
-   struct phy link;
-   int ret, count, i;
-   int link_count = 0;
-
-   ret = uclass_get_device_by_driver(UCLASS_MISC,
- DM_DRIVER_GET(sierra_phy_provider),
- );
-   if (ret) {
-   printf("Sierra init failed:%d\n", ret);
-   return;
-   }
-
-   count = device_get_child_count(dev);
-   for (i = 0; i < count; i++) {
-   ret = device_get_child(dev, i, _dev);
-   if (ret) {
-   printf("probe of sierra child node %d failed: %d\n", i, 
ret);
-   return;
-   }
-   if (link_dev->driver->id == UCLASS_PHY) {
-   link.dev = link_dev;
-   link.id = link_count++;
-
-   

[PATCH 03/15] board: ti: j721e: evm: Drop board check for ESM

2023-11-02 Thread Nishanth Menon
When config is enabled, the esm dt probe makes sense. Simplify by
dropping board specific checks.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/evm.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index d4f7c1d9f938..75d51a0552c4 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -531,10 +531,8 @@ err_free_gpio:
 
 void spl_board_init(void)
 {
-#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
struct udevice *dev;
int ret;
-#endif
 
if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) ||
 IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) &&
@@ -543,24 +541,20 @@ void spl_board_init(void)
probe_daughtercards();
}
 
-#ifdef CONFIG_ESM_K3
-   if (board_ti_k3_is("J721EX-PM2-SOM")) {
+   if (IS_ENABLED(CONFIG_ESM_K3)) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
  DM_DRIVER_GET(k3_esm), );
if (ret)
printf("ESM init failed: %d\n", ret);
}
-#endif
 
-#ifdef CONFIG_ESM_PMIC
-   if (board_ti_k3_is("J721EX-PM2-SOM")) {
+   if (IS_ENABLED(CONFIG_ESM_PMIC)) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
  DM_DRIVER_GET(pmic_esm),
  );
if (ret)
printf("ESM PMIC init failed: %d\n", ret);
}
-#endif
if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || 
IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) &&
IS_ENABLED(CONFIG_HBMC_AM654)) {
struct udevice *dev;
-- 
2.40.0



[PATCH 01/15] arm: mach-k3: j721e: Improve support for UDA FS

2023-11-02 Thread Nishanth Menon
Commit 5019170970ad ("arch: arm: mach-k3: j721e: add support for UDA
FS") introduced basic UDA FS support, however, we can Take approach
similar to commit 0f1c1e8b368b ("arm: mach-k3: am625: Add support for
UDA FS"). While boot partition support with EMMC boot is useful, it is
constrained by the size of boot hardware partition itself.

In the case of K3 devices, tispl images can contain OP-TEE images that
can substantially vary in size and the u-boot image itself can vary over
time as we enable various features.

So use the CSD information in the case of EMMC_BOOT configuration being
enabled to pick boot partition or UDA FS mode operation to pick.

If EMMC_BOOT is disabled, then depend on filesystem configuration to
pick data from UDA.

Signed-off-by: Nishanth Menon 
---
 arch/arm/mach-k3/j721e_init.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index b1f7e25ed092..bcdfbfc79c4a 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -294,7 +294,14 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 
boot_device)
 {
switch (boot_device) {
case BOOT_DEVICE_MMC1:
-   return (spl_mmc_emmc_boot_partition(mmc) ? MMCSD_MODE_EMMCBOOT 
: MMCSD_MODE_FS);
+   if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT)) {
+   if (spl_mmc_emmc_boot_partition(mmc))
+   return MMCSD_MODE_EMMCBOOT;
+   return MMCSD_MODE_FS;
+   }
+   if (IS_ENABLED(CONFIG_SPL_FS_FAT) || 
IS_ENABLED(CONFIG_SPL_FS_EXT4))
+   return MMCSD_MODE_FS;
+   return MMCSD_MODE_EMMCBOOT;
case BOOT_DEVICE_MMC2:
return MMCSD_MODE_FS;
default:
-- 
2.40.0



[PATCH 15/15] doc: board: ti: Add BeagleBone AI-64 documentation

2023-11-02 Thread Nishanth Menon
Add base documentation for BeagleBone AI-64.

Signed-off-by: Nishanth Menon 
---
 doc/board/ti/j721e_beagleboneai64.rst | 327 ++
 doc/board/ti/k3.rst   |   1 +
 2 files changed, 328 insertions(+)
 create mode 100644 doc/board/ti/j721e_beagleboneai64.rst

diff --git a/doc/board/ti/j721e_beagleboneai64.rst 
b/doc/board/ti/j721e_beagleboneai64.rst
new file mode 100644
index ..18e154bd417a
--- /dev/null
+++ b/doc/board/ti/j721e_beagleboneai64.rst
@@ -0,0 +1,327 @@
+.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+.. sectionauthor:: Nishanth Menon 
+
+J721E/TDA4VM Beagleboard.org BeagleBone AI-64
+=
+
+Introduction:
+-
+
+BeagleBoard.org BeagleBone AI-64 is an open source hardware single
+board computer based on the Texas Instruments TDA4VM SoC featuring
+dual-core 2.0GHz Arm Cortex-A72 processor, C7x+MMA and 2 C66x
+floating-point VLIW DSPs, 3x dual ARM Cortex-R5 co-processors,
+2x 6-core Programmable Real-Time Unit and Industrial Communication
+SubSystem, PowerVR Rogue 8XE GE8430 3D GPU. The board features 4GB
+DDR4, USB3.0 Type-C, 2x USB SS Type-A, miniDisplayPort, 2x 4-lane
+CSI, DSI, 16GB eMMC flash, 1G Ethernet, M.2 E-key for WiFi/BT, and
+BeagleBone expansion headers.
+
+Further information can be found at:
+
+* Product Page: https://beagleboard.org/ai-64
+* Hardware documentation: 
https://git.beagleboard.org/beagleboard/beaglebone-ai-64
+
+Boot Flow:
+--
+Below is the pictorial representation of boot flow:
+
+.. image:: img/boot_diagram_j721e.svg
+  :alt: Boot flow diagram
+
+- On this platform, DMSC runs 'TI Foundational Security' (TIFS) which
+  functions as the security enclave master. The 'Device Manager' (DM),
+  also known as the 'TISCI server' in "TI terminology", running on boot
+  R5F, offers all the essential services required for device management.
+  The A72, C7x, C6x or R5F (Aux cores) sends requests to TIFS/DM to
+  accomplish the needed services, as illustrated in the diagram above.
+
+Sources:
+
+.. include::  k3.rst
+:start-after: .. k3_rst_include_start_boot_sources
+:end-before: .. k3_rst_include_end_boot_sources
+
+Build procedure:
+
+0. Setup the environment variables:
+
+.. include::  k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_desc
+:end-before: .. k3_rst_include_end_common_env_vars_desc
+
+.. include::  k3.rst
+:start-after: .. k3_rst_include_start_board_env_vars_desc
+:end-before: .. k3_rst_include_end_board_env_vars_desc
+
+Set the variables corresponding to this platform:
+
+.. include::  k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_defn
+:end-before: .. k3_rst_include_end_common_env_vars_defn
+.. prompt:: bash $
+
+  export UBOOT_CFG_CORTEXR="j721e_evm_r5_defconfig beagleboneai64_r5.config"
+  export UBOOT_CFG_CORTEXA="j721e_evm_a72_defconfig beagleboneai64_a72.config"
+  export TFA_BOARD=generic
+  # we dont use any extra TFA parameters
+  unset TFA_EXTRA_ARGS
+  export OPTEE_PLATFORM=k3-j721e
+  # we dont use any extra OP-TEE parameters
+  unset OPTEE_EXTRA_ARGS
+
+.. include::  j721e_evm.rst
+:start-after: .. j721e_evm_rst_include_start_build_steps
+:end-before: .. j721e_evm_rst_include_end_build_steps
+
+Target Images
+--
+Copy the below images to an SD card and boot:
+
+* tiboot3-j721e-gp-evm.bin from R5 build as tiboot3.bin
+* tispl.bin_unsigned from Cortex-A build as tispl.bin
+* u-boot.img_unsigned from Cortex-A build as u-boot.img
+
+Image formats
+-
+
+- tiboot3.bin
+
+.. image:: img/no_multi_cert_tiboot3.bin.svg
+  :alt: tiboot3.bin image format
+
+- tispl.bin
+
+.. image:: img/dm_tispl.bin.svg
+  :alt: tispl.bin image format
+
+- sysfw.itb
+
+.. image:: img/sysfw.itb.svg
+  :alt: sysfw.itb image format
+
+Additional hardware for U-Boot development
+--
+
+* Serial Console is critical for U-Boot development on BeagleBone AI-64. See
+  `BeagleBone AI-64 connector documentation
+  `_.
+* uSD is preferred option over eMMC, and a SD/MMC reader will be needed.
+* (optionally) JTAG is useful when working with very early stages of boot.
+
+Default storage options
+---
+
+There are multiple storage media options on BeagleBone AI-64, but primarily:
+
+* Onboard eMMC (default) - reliable, fast and meant for deployment use.
+* SD/MMC card interface (hold 'BOOT' switch and power on) - Entirely
+  depends on the SD card quality.
+
+Flash to uSD card or how to deal with "bricked" Board
+
+
+When deploying or working on Linux, it's common to use the onboard
+eMMC. However, avoiding the eMMC and using the uSD card is safer when
+working with U-Boot.
+
+If you choose to  hand format your own bootable uSD card, be
+aware that it can be difficult. The 

[PATCH 02/15] configs: j7200: Remove HBMC_AM654 config

2023-11-02 Thread Nishanth Menon
Kernel commit 1b77265626a4 ("arm64: dts: ti: k3-j7200-mcu-wakeup: Add
HyperBus node") was merged to kernel without its dependent patch [1].
Similar fix is needed in U-Boot, and hbmc currently breaks boot. Till
this gets fixed in U-Boot, disable the config by default so that the
hbmc probe that happens in board/ti/j721e/evm.c will not take place
and lead to boot failure.

This is similar to the approach in commit 5b2671594b80 ("configs:
j721e: Remove HBMC_AM654 config"), introduced to j7200 evm platform.

[1] https://lore.kernel.org/all/20230424184810.29453-1-...@ti.com/

Signed-off-by: Nishanth Menon 
---
 configs/j7200_evm_a72_defconfig | 1 -
 configs/j7200_evm_r5_defconfig  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig
index cb4a141675da..889358afc316 100644
--- a/configs/j7200_evm_a72_defconfig
+++ b/configs/j7200_evm_a72_defconfig
@@ -138,7 +138,6 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
-CONFIG_HBMC_AM654=y
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig
index d25dd8134b63..6452c60345fd 100644
--- a/configs/j7200_evm_r5_defconfig
+++ b/configs/j7200_evm_r5_defconfig
@@ -114,7 +114,6 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
-CONFIG_HBMC_AM654=y
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SFDP_SUPPORT=y
-- 
2.40.0



[PATCH 00/15] board: ti: Add support for BeagleBone AI-64

2023-11-02 Thread Nishanth Menon
Cleanups for J721e/J7200 and add support for BeagleBone AI-64

Based off:
master 07fe79c93c5c Merge tag 'i2cfixes-for-v2024-01-rc2' of 
https://source.denx.de/u-boot/custodians/u-boot-i2c

Boot Logs:
J721e-SK: https://gist.github.com/nmenon/c144e64f1da9fd49997ef5794b056bb0
J721e-EVM: https://gist.github.com/nmenon/e79bed6807da05c723e71687fb3c0b90
J7200-HSEVM: https://gist.github.com/nmenon/5658dd6fa2f67bce915c77b25c02f897

BeagleBone AI-64:
SD/MMC boot: https://gist.github.com/nmenon/1e07858fb8ca39ca87e40d3894e4d9b7
eMMC boot: https://gist.github.com/nmenon/9b0602df1f1be2c6b512d135b0afae60
eMMC boot with SDcard detected: 
https://gist.github.com/nmenon/82058014f4b2f6b9ed21431bc675e12a

U-Boot CI: https://github.com/u-boot/u-boot/pull/444

BeagleBone AI-64 is introduced without EEPROM detection and cleanups
to j721e evm configuration is done to facilitate that. based on when
and timing of [1] is merged in, we can introduce an equivalent patch or
squash similar patch in for beagleboneai64.

Boot uses stdboot as default - so we also transition j721e over to
sdboot along with it.

Fixes a breakage with HBMC that was getting in my way of testing, but I
have'nt focussed on converting j7200 to stdboot - but probably a minor
patch similar to that in this series for j721e.

What works:
* emmc, sd, dhcp, basic i2c gpio etc..
* DDR looks stable as well.

TODO:
* PMIC support will need to be added for AVS to be active - something to
  do once upstream kernel gets that support
* USB boot is broken (or was just noticed) - some sort of regression with
  serdes is my best guess.
* We could potentially enable something like nvme boot as well if we can
  make PCIe work

Nishanth Menon (14):
  arm: mach-k3: j721e: Improve support for UDA FS
  configs: j7200: Remove HBMC_AM654 config
  board: ti: j721e: evm: Drop board check for ESM
  board: ti: j721e: evm: Drop unused headers
  board: ti: j721e: evm: Switch to using IS_ENABLED
  board: ti: j721e: evm: Drop board based serdes initialization
  board: ti: j721e: evm: Use IS_ENABLED with CONFIG_PHYS_64BIT
  board: ti: j721e: evm: Split code to isolate eeprom detected logic
  board: ti: j721e: j721e.env: Add explicit boot_targets
  configs: j721e_evm_a72_defconfig: Switch to bootstd
  arm: dts: k3-j721e-binman: Allow a single board configuration
  arm: dts: k3-j721e-binman: Use macros that can be overridden for dtbs
  board: ti: Add j721e_beagleboneai64_* config fragments and env file
  doc: board: ti: Add BeagleBone AI-64 documentation

Robert Nelson (1):
  arm: dts: Add k3-j721e-beagleboneai64

 arch/arm/dts/Makefile |5 +-
 .../dts/k3-j721e-beagleboneai64-u-boot.dtsi   |  206 ++
 arch/arm/dts/k3-j721e-beagleboneai64.dts  |  993 
 arch/arm/dts/k3-j721e-binman.dtsi |   33 +-
 .../k3-j721e-common-proc-board-u-boot.dtsi|2 +
 .../k3-j721e-ddr-beagleboneai64-lp4-3200.dtsi | 2200 +
 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts   |   96 +
 arch/arm/dts/k3-j721e-sk-u-boot.dtsi  |2 +
 arch/arm/mach-k3/j721e_init.c |9 +-
 board/ti/j721e/MAINTAINERS|7 +
 board/ti/j721e/Makefile   |1 +
 board/ti/j721e/beagleboneai64.env |   19 +
 board/ti/j721e/beagleboneai64_a72.config  |   55 +
 board/ti/j721e/beagleboneai64_r5.config   |   19 +
 board/ti/j721e/{evm.c => board-variants.c}|  276 +--
 board/ti/j721e/evm.c  |  459 +---
 board/ti/j721e/evm.h  |   24 +
 board/ti/j721e/j721e.env  |1 +
 configs/j7200_evm_a72_defconfig   |1 -
 configs/j7200_evm_r5_defconfig|1 -
 configs/j721e_evm_a72_defconfig   |5 +-
 doc/board/ti/j721e_beagleboneai64.rst |  327 +++
 doc/board/ti/k3.rst   |1 +
 23 files changed, 4083 insertions(+), 659 deletions(-)
 create mode 100644 arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi
 create mode 100644 arch/arm/dts/k3-j721e-beagleboneai64.dts
 create mode 100644 arch/arm/dts/k3-j721e-ddr-beagleboneai64-lp4-3200.dtsi
 create mode 100644 arch/arm/dts/k3-j721e-r5-beagleboneai64.dts
 create mode 100644 board/ti/j721e/beagleboneai64.env
 create mode 100644 board/ti/j721e/beagleboneai64_a72.config
 create mode 100644 board/ti/j721e/beagleboneai64_r5.config
 copy board/ti/j721e/{evm.c => board-variants.c} (63%)
 create mode 100644 board/ti/j721e/evm.h
 create mode 100644 doc/board/ti/j721e_beagleboneai64.rst

[1] https://lore.kernel.org/all/20231101170519.39627-1-...@ti.com/
-- 
2.40.0



[PATCH 06/15] board: ti: j721e: evm: Drop board based serdes initialization

2023-11-02 Thread Nishanth Menon
Serdes initialization should be compile flag based instead of being
eeprom based.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/evm.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 17640ae79665..d49993fffe39 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -359,9 +359,6 @@ void configure_serdes_torrent(void)
struct phy serdes;
int ret;
 
-   if (!IS_ENABLED(CONFIG_PHY_CADENCE_TORRENT))
-   return;
-
ret = uclass_get_device_by_driver(UCLASS_PHY,
  DM_DRIVER_GET(torrent_phy_provider),
  );
@@ -393,9 +390,6 @@ void configure_serdes_sierra(void)
int ret, count, i;
int link_count = 0;
 
-   if (!IS_ENABLED(CONFIG_PHY_CADENCE_SIERRA))
-   return;
-
ret = uclass_get_device_by_driver(UCLASS_MISC,
  DM_DRIVER_GET(sierra_phy_provider),
  );
@@ -477,10 +471,10 @@ int board_late_init(void)
probe_daughtercards();
}
 
-   if (board_is_j7200_som())
+   if (IS_ENABLED(CONFIG_PHY_CADENCE_TORRENT))
configure_serdes_torrent();
 
-   if (board_is_j721e_som())
+   if (IS_ENABLED(CONFIG_PHY_CADENCE_SIERRA))
configure_serdes_sierra();
 
return 0;
-- 
2.40.0



[PATCH 14/15] board: ti: Add j721e_beagleboneai64_* config fragments and env file

2023-11-02 Thread Nishanth Menon
Add defconfig fragments for J721E based BeagleBone AI-64 and
corresponding customized environment.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/beagleboneai64.env| 19 
 board/ti/j721e/beagleboneai64_a72.config | 55 
 board/ti/j721e/beagleboneai64_r5.config  | 19 
 3 files changed, 93 insertions(+)
 create mode 100644 board/ti/j721e/beagleboneai64.env
 create mode 100644 board/ti/j721e/beagleboneai64_a72.config
 create mode 100644 board/ti/j721e/beagleboneai64_r5.config

diff --git a/board/ti/j721e/beagleboneai64.env 
b/board/ti/j721e/beagleboneai64.env
new file mode 100644
index ..4f0a94a8113e
--- /dev/null
+++ b/board/ti/j721e/beagleboneai64.env
@@ -0,0 +1,19 @@
+#include 
+#include 
+#include 
+
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x0280
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+set_led_state_fail_load= led led-0 off; led led-1 on;
+   led led-2 off; led led-3 on; led led-4 off
+set_led_state_start_load=led led-0 on; led led-1 off;
+   led led-2 on; led led-3 off; led led-4 on
+boot=mmc
+mmcdev=1
+bootpart=1:1
+bootdir=/boot
+boot_targets=mmc1 mmc0 usb pxe
+bootmeths=script extlinux efi pxe
+rd_spec=-
diff --git a/board/ti/j721e/beagleboneai64_a72.config 
b/board/ti/j721e/beagleboneai64_a72.config
new file mode 100644
index ..926f725508e5
--- /dev/null
+++ b/board/ti/j721e/beagleboneai64_a72.config
@@ -0,0 +1,55 @@
+# Defconfig fragment to apply on top of j721e_evm_a72_defconfig
+
+CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-beagleboneai64"
+CONFIG_SPL_OF_LIST="k3-j721e-beagleboneai64"
+CONFIG_OF_LIST="k3-j721e-beagleboneai64"
+CONFIG_BOOTCOMMAND="run set_led_state_start_load;run findfdt; run envboot; 
bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_EXT4_WRITE=y
+CONFIG_LZO=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
+CONFIG_AUTOBOOT_DELAY_STR="d"
+CONFIG_AUTOBOOT_STOP_STR=" "
+
+# No Flash
+CONFIG_HBMC_AM654=n
+CONFIG_UFS=n
+
+# Sierra disabled for now till stability
+CONFIG_PHY_CADENCE_SIERRA=n
+CONFIG_PHY_J721E_WIZ=n
+# Torrent only for DP. no DP splash screen
+CONFIG_PHY_CADENCE_TORRENT=n
+
+# Use the Beaglebone-AI64 env file
+CONFIG_ENV_SOURCE_FILE="beagleboneai64"
+# No dependency on EEPROM detection
+CONFIG_TI_I2C_BOARD_DETECT=n
+# No board fixup to do
+CONFIG_OF_BOARD_SETUP=n
+
+# Do not use emmc boot - use FS only
+CONFIG_SUPPORT_EMMC_BOOT=n
+CONFIG_MMC_IO_VOLTAGE=y
+# CONFIG_SPL_MMC_IO_VOLTAGE is not set
+CONFIG_MMC_UHS_SUPPORT=y
+# CONFIG_SPL_MMC_UHS_SUPPORT is not set
+CONFIG_MMC_HS200_SUPPORT=y
+# CONFIG_SPL_MMC_HS200_SUPPORT is not set
+
+# Enable GPIO control
+CONFIG_DM_GPIO=y
+CONFIG_SPL_GPIO=y
+CONFIG_DA8XX_GPIO=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPIO_READ=y
+# Enable LEDs
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_SPL_LED=y
+CONFIG_SPL_LED_GPIO=y
+# Enable I2C bus
+CONFIG_SPL_I2C=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_OMAP24XX=y
+CONFIG_CMD_I2C=y
diff --git a/board/ti/j721e/beagleboneai64_r5.config 
b/board/ti/j721e/beagleboneai64_r5.config
new file mode 100644
index ..cf124fb70cf1
--- /dev/null
+++ b/board/ti/j721e/beagleboneai64_r5.config
@@ -0,0 +1,19 @@
+# Defconfig fragment to apply on top of:
+# j721e_evm_r5_defconfig
+
+CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-r5-beagleboneai64"
+CONFIG_SPL_OF_LIST="k3-j721e-r5-beagleboneai64"
+
+# No ESM, PMIC or AVS adjustment till PMIC is enabled
+CONFIG_ESM_K3=n
+CONFIG_K3_AVS0=n
+CONFIG_ESM_PMIC=n
+
+# Do not use emmc boot - we will use FS only
+CONFIG_SUPPORT_EMMC_BOOT=n
+
+CONFIG_HBMC_AM654=n
+# No dependency on EEPROM detection
+CONFIG_TI_I2C_BOARD_DETECT=n
+# No board fixup to do
+CONFIG_OF_BOARD_SETUP=n
-- 
2.40.0



[PATCH 09/15] board: ti: j721e: j721e.env: Add explicit boot_targets

2023-11-02 Thread Nishanth Menon
Add explicit boot_targets to indicate the specific boot sequence to
follow.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/j721e.env | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env
index 8cc8232fc131..cb27bf5e2b24 100644
--- a/board/ti/j721e/j721e.env
+++ b/board/ti/j721e/j721e.env
@@ -31,6 +31,7 @@ addr_mcur5f0_0load=0x8900
 name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw
 #endif
 
+boot_targets=mmc1 mmc0 usb pxe dhcp
 boot=mmc
 mmcdev=1
 bootpart=1:2
-- 
2.40.0



[PATCH 10/15] configs: j721e_evm_a72_defconfig: Switch to bootstd

2023-11-02 Thread Nishanth Menon
Switch to using bootstd. Note with this change, we will stop using
distro_bootcmd and instead depend entirely on bootflow method of
starting the system up.

Signed-off-by: Nishanth Menon 
---
 configs/j721e_evm_a72_defconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 99e0e168ebf7..98ac7ca59789 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
+CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
 CONFIG_LOGLEVEL=7
 CONFIG_SPL_MAX_SIZE=0xc
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-- 
2.40.0



[PATCH 07/15] board: ti: j721e: evm: Use IS_ENABLED with CONFIG_PHYS_64BIT

2023-11-02 Thread Nishanth Menon
Use IS_ENABLED to replace the #ifdeffery.

Signed-off-by: Nishanth Menon 
---
 board/ti/j721e/evm.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index d49993fffe39..0fc141776818 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -39,22 +39,19 @@ int board_init(void)
 
 int dram_init(void)
 {
-#ifdef CONFIG_PHYS_64BIT
-   gd->ram_size = 0x1;
-#else
-   gd->ram_size = 0x8000;
-#endif
+   if (IS_ENABLED(CONFIG_PHYS_64BIT))
+   gd->ram_size = 0x1;
+   else
+   gd->ram_size = 0x8000;
 
return 0;
 }
 
 phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
 {
-#ifdef CONFIG_PHYS_64BIT
/* Limit RAM used by U-Boot to the DDR low region */
-   if (gd->ram_top > 0x1)
+   if (IS_ENABLED(CONFIG_PHYS_64BIT) && gd->ram_top > 0x1)
return 0x1;
-#endif
 
return gd->ram_top;
 }
@@ -66,12 +63,12 @@ int dram_init_banksize(void)
gd->bd->bi_dram[0].size = 0x8000;
gd->ram_size = 0x8000;
 
-#ifdef CONFIG_PHYS_64BIT
-   /* Bank 1 declares the memory available in the DDR high region */
-   gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
-   gd->bd->bi_dram[1].size = 0x8000;
-   gd->ram_size = 0x1;
-#endif
+   if (IS_ENABLED(CONFIG_PHYS_64BIT)) {
+   /* Bank 1 declares the memory available in the DDR high region 
*/
+   gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
+   gd->bd->bi_dram[1].size = 0x8000;
+   gd->ram_size = 0x1;
+   }
 
return 0;
 }
-- 
2.40.0



Re: [PATCH v2] patman: Add a 'keep_change_id' setting

2023-11-02 Thread Maxim Cournoyer
Hi Simon,

Simon Glass  writes:

> On Thu, 12 Oct 2023 at 20:06, Maxim Cournoyer  
> wrote:
>>
>> A Change-Id can be useful for traceability purposes, and some projects
>> may wish to have them preserved.  This change makes it configurable
>> via a new 'keep_change_id' setting.
>>
>> Signed-off-by: Maxim Cournoyer 
>> ---
>>
>> Changes in v2:
>> - Add missing argument to send parser
>> - Correctly propagate args.keep_change_id
>>
>>  tools/patman/__main__.py|  2 ++
>>  tools/patman/control.py | 12 +---
>>  tools/patman/patchstream.py | 17 -
>>  tools/patman/patman.rst | 11 ++-
>>  tools/patman/test_checkpatch.py | 16 
>>  5 files changed, 45 insertions(+), 13 deletions(-)
>
> Reviewed-by: Simon Glass 
>
> Applied to u-boot-dm, thanks!

And thanks for the timely review! :-)

-- 
Maxim


Re: [PULL] u-boot-sh/master_common_h_cleanup

2023-11-02 Thread Tom Rini
On Thu, Nov 02, 2023 at 11:02:51PM +0100, Marek Vasut wrote:

> The following changes since commit a803f87202aa48974bdff4d8100464a8288931e4:
> 
>   Merge https://source.denx.de/u-boot/custodians/u-boot-mmc (2023-11-01 
> 09:44:33 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-sh.git 
> master_common_h_cleanup
> 
> for you to fetch changes up to 7d824618d7eb5340e63892c919abc62d831e7482:
> 
>   board: rzg2l: Drop  (2023-11-02 11:30:19 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH 2/3] doc: board: ti: k3: Use ::prompt for gdb commands

2023-11-02 Thread Nishanth Menon
Provide more friendlier documentation with prompt (gdb) option

Signed-off-by: Nishanth Menon 
---
 doc/board/ti/k3.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst
index e9bbe7c09794..c20e33d00412 100644
--- a/doc/board/ti/k3.rst
+++ b/doc/board/ti/k3.rst
@@ -926,7 +926,7 @@ command.
 
 To connect to your desired core, run the following command within GDB:
 
-.. code-block:: bash
+.. prompt:: bash (gdb)
 
   target extended-remote localhost:{port for desired core}
 
@@ -943,13 +943,13 @@ To load symbols:
 
 * Prior to relocation:
 
-.. code-block:: bash
+.. prompt:: bash (gdb)
 
   symbol-file {path to elf file}
 
 * After relocation:
 
-.. code-block:: bash
+.. prompt:: bash (gdb)
 
   # Drop old symbol file
   symbol-file
@@ -960,7 +960,7 @@ To load symbols:
 
 In the above example of AM625,
 
-.. code-block:: bash
+.. prompt:: bash (gdb)
 
   target extended-remote localhost:3338 <- R5F (Wakeup Domain)
   target extended-remote localhost:3334 <- A53 (Main Domain)
@@ -980,7 +980,7 @@ breakpoints. To exit the debug loop added above, add any 
breakpoints
 needed and run the following GDB commands to step out of the debug
 loop set in the ``board_init_f`` function.
 
-.. code-block:: bash
+.. prompt:: bash (gdb)
 
   set x = 0
   continue
-- 
2.40.0



[PATCH 0/3] doc: board: ti: Cleanup ::prompt usage

2023-11-02 Thread Nishanth Menon
Due to the sequence of merges, it looks like many of k3 documentation
used code-blocks while the rest of the docs migrated to ::prompt.

Sync all to a common style.

based off:
master 07fe79c93c5c Merge tag 'i2cfixes-for-v2024-01-rc2' of 
https://source.denx.de/u-boot/custodians/u-boot-i2c

Nishanth Menon (3):
  doc: board: ti: Use prompt prompt_style to simplify documentation
  doc: board: ti: k3: Use ::prompt for gdb commands
  doc: board: ti: k3 docs: Use ::prompt

 doc/board/ti/am335x_evm.rst   | 39 +-
 doc/board/ti/am62x_beagleplay.rst | 46 -
 doc/board/ti/am62x_sk.rst | 18 +++
 doc/board/ti/am64x_evm.rst| 20 +++
 doc/board/ti/am65x_evm.rst| 86 +++
 doc/board/ti/dra7xx_evm.rst   |  3 +-
 doc/board/ti/j7200_evm.rst| 20 +++
 doc/board/ti/j721e_evm.rst| 40 +++---
 doc/board/ti/j721s2_evm.rst   | 18 +++
 doc/board/ti/k3.rst   | 16 +++---
 doc/board/ti/ks2_evm.rst  |  9 ++--
 11 files changed, 148 insertions(+), 167 deletions(-)

-- 
2.40.0



[PATCH 1/3] doc: board: ti: Use prompt prompt_style to simplify documentation

2023-11-02 Thread Nishanth Menon
The sphinx-prompt documentation[0] provides examples on how we can use
prompt as a parameter to simplify the description. Use the same.

[0] http://sbrunner.github.io/sphinx-prompt/

Signed-off-by: Nishanth Menon 
---
 doc/board/ti/am335x_evm.rst | 39 +
 doc/board/ti/dra7xx_evm.rst |  3 +--
 doc/board/ti/k3.rst |  6 ++
 doc/board/ti/ks2_evm.rst|  9 +++--
 4 files changed, 19 insertions(+), 38 deletions(-)

diff --git a/doc/board/ti/am335x_evm.rst b/doc/board/ti/am335x_evm.rst
index 2ba651eb6df9..769362816b78 100644
--- a/doc/board/ti/am335x_evm.rst
+++ b/doc/board/ti/am335x_evm.rst
@@ -84,8 +84,7 @@ bootable image was not created.
 
 Within the SECDEV package exists an image creation script:
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
${TI_SECURE_DEV_PKG}/scripts/create-boot-image.sh
 
@@ -97,8 +96,7 @@ possible.
 The script is basically the only required interface to the TI SECDEV
 package for creating a bootable SPL image for secure TI devices.
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
create-boot-image.sh \
   
@@ -184,8 +182,7 @@ The exact details of the how the images are secured is 
handled by the
 SECDEV package. Within the SECDEV package exists a script to process
 an input binary image:
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
${TI_SECURE_DEV_PKG}/scripts/secure-binary-image.sh
 
@@ -206,8 +203,7 @@ only accessible when the ARM core is operating in the 
secure mode).
 Invoking the secure-binary-image script for Secure Devices
 ^^
 
-.. prompt:: bash
-   :prompts: $
+.. prompt:: bash $
 
secure-binary-image.sh  
 
@@ -247,8 +243,7 @@ into memory, then written to NAND.
 
 2. Flashing NAND via MMC/SD
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
# select BOOTSEL to MMC/SD boot and boot from MMC/SD card
mmc rescan
@@ -334,8 +329,7 @@ had a FAT partition (such as on a Beaglebone Black) it is 
not enough to
 write garbage into the area, you must delete it from the partition table
 first.
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
# Ensure we are able to talk with this mmc device
mmc rescan
@@ -366,8 +360,7 @@ the FAT filesystem (only the uImage MUST be for this to 
function
 afterwards) along with a Falcon Mode aware MLO and the FAT partition has
 already been created and marked bootable:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
mmc rescan
# Load kernel and device tree into memory, perform export
@@ -386,8 +379,7 @@ This will print a number of lines and then end with 
something like:
 
 So then you:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
fatwrite mmc 0:1 0x80f8 args 8928
 
@@ -400,8 +392,7 @@ already located on the NAND somewhere (such as filesystem 
or mtd partition)
 along with a Falcon Mode aware MLO written to the correct locations for
 booting and mtdparts have been configured correctly for the board:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
nand read ${loadaddr} kernel
load nand rootfs ${fdtaddr} /boot/am335x-evm.dtb
@@ -425,8 +416,7 @@ The output of the 'dm tree' command shows which driver is 
bound to which
 device, so the user can easily configure their platform differently from
 the command line:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
dm tree
 
@@ -444,8 +434,7 @@ the command line:
 Typically here any network command performed using the usb_ether
 interface would work, while using other gadgets would fail:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
fastboot usb 0
 
@@ -462,8 +451,7 @@ least from a bootloader point of view). The solution here 
would be to
 use the unbind command specifying the class and index parameters (as
 shown above in the 'dm tree' output) to target the driver to unbind:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
unbind ethernet 1
 
@@ -471,8 +459,7 @@ The output of the 'dm tree' command now shows the 
availability of the
 first USB device controller, the fastboot gadget will now be able to
 bind with it:
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
dm tree
 
diff --git a/doc/board/ti/dra7xx_evm.rst b/doc/board/ti/dra7xx_evm.rst
index 4503b5e92229..8e5d95535fa0 100644
--- a/doc/board/ti/dra7xx_evm.rst
+++ b/doc/board/ti/dra7xx_evm.rst
@@ -71,8 +71,7 @@ example we load MLO and u-boot.img from the build into DDR 
and then use
 'mmc bootbus' to set the required rate (see TRM) and 'mmc partconfig' to
 set boot0 as the boot device.
 
-.. prompt:: bash
-   :prompts: =>
+.. prompt:: bash =>
 
setenv autoload no
usb start
diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst
index 89d70db88647..e9bbe7c09794 100644
--- a/doc/board/ti/k3.rst
+++ b/doc/board/ti/k3.rst
@@ -476,8 +476,7 @@ then the saveenv command and can be used across various 
bootmodes too.
 
 **Writing to 

[PATCH 3/3] doc: board: ti: k3 docs: Use ::prompt

2023-11-02 Thread Nishanth Menon
Use prompt instead of code-block to have copy-paste friendly command
documentation.

Signed-off-by: Nishanth Menon 
---
 doc/board/ti/am62x_beagleplay.rst | 46 -
 doc/board/ti/am62x_sk.rst | 18 +++
 doc/board/ti/am64x_evm.rst| 20 +++
 doc/board/ti/am65x_evm.rst| 86 +++
 doc/board/ti/j7200_evm.rst| 20 +++
 doc/board/ti/j721e_evm.rst| 40 +++---
 doc/board/ti/j721s2_evm.rst   | 18 +++
 7 files changed, 124 insertions(+), 124 deletions(-)

diff --git a/doc/board/ti/am62x_beagleplay.rst 
b/doc/board/ti/am62x_beagleplay.rst
index 39913b29ab2c..6518cb7e1dcc 100644
--- a/doc/board/ti/am62x_beagleplay.rst
+++ b/doc/board/ti/am62x_beagleplay.rst
@@ -55,15 +55,15 @@ Set the variables corresponding to this platform:
 .. include::  k3.rst
 :start-after: .. k3_rst_include_start_common_env_vars_defn
 :end-before: .. k3_rst_include_end_common_env_vars_defn
-.. code-block:: bash
+.. prompt:: bash $
 
- $ export UBOOT_CFG_CORTEXR="am62x_evm_r5_defconfig beagleplay_r5.config"
- $ export UBOOT_CFG_CORTEXA="am62x_evm_a53_defconfig beagleplay_a53.config"
- $ export TFA_BOARD=lite
- $ # we dont use any extra TFA parameters
- $ unset TFA_EXTRA_ARGS
- $ export OPTEE_PLATFORM=k3-am62x
- $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+ export UBOOT_CFG_CORTEXR="am62x_evm_r5_defconfig beagleplay_r5.config"
+ export UBOOT_CFG_CORTEXA="am62x_evm_a53_defconfig beagleplay_a53.config"
+ export TFA_BOARD=lite
+ # we dont use any extra TFA parameters
+ unset TFA_EXTRA_ARGS
+ export OPTEE_PLATFORM=k3-am62x
+ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
 
 .. include::  am62x_sk.rst
 :start-after: .. am62x_evm_rst_include_start_build_steps
@@ -174,24 +174,24 @@ boot1 partition depends on A/B update requirements.
 
 The following are the steps from Linux shell to program eMMC:
 
-.. code-block:: bash
+.. prompt:: bash #
 
-  # # Enable Boot0 boot
-  # mmc bootpart enable 1 2 /dev/mmcblk0
-  # mmc bootbus set single_backward x1 x8 /dev/mmcblk0
-  # mmc hwreset enable /dev/mmcblk0
+  # Enable Boot0 boot
+  mmc bootpart enable 1 2 /dev/mmcblk0
+  mmc bootbus set single_backward x1 x8 /dev/mmcblk0
+  mmc hwreset enable /dev/mmcblk0
 
-  # # Clear eMMC boot0
-  # echo '0' >> /sys/class/block/mmcblk0boot0/force_ro
-  # dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k
-  # # Write tiboot3.bin
-  # dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=128k
+  # Clear eMMC boot0
+  echo '0' >> /sys/class/block/mmcblk0boot0/force_ro
+  dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k
+  # Write tiboot3.bin
+  dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=128k
 
-  # # Copy the rest of the boot binaries
-  # mount /dev/mmcblk0p1 /boot/firmware
-  # cp tispl.bin /boot/firmware
-  # cp u-boot.img /boot/firmware
-  # sync
+  # Copy the rest of the boot binaries
+  mount /dev/mmcblk0p1 /boot/firmware
+  cp tispl.bin /boot/firmware
+  cp u-boot.img /boot/firmware
+  sync
 
 .. warning ::
 
diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst
index d7437c6d22f7..10fd73a5cfb0 100644
--- a/doc/board/ti/am62x_sk.rst
+++ b/doc/board/ti/am62x_sk.rst
@@ -76,15 +76,15 @@ Set the variables corresponding to this platform:
 .. include::  ../ti/k3.rst
 :start-after: .. k3_rst_include_start_common_env_vars_defn
 :end-before: .. k3_rst_include_end_common_env_vars_defn
-.. code-block:: bash
+.. prompt:: bash $
 
- $ export UBOOT_CFG_CORTEXR=am62x_evm_r5_defconfig
- $ export UBOOT_CFG_CORTEXA=am62x_evm_a53_defconfig
- $ export TFA_BOARD=lite
- $ # we dont use any extra TFA parameters
- $ unset TFA_EXTRA_ARGS
- $ export OPTEE_PLATFORM=k3-am62x
- $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+ export UBOOT_CFG_CORTEXR=am62x_evm_r5_defconfig
+ export UBOOT_CFG_CORTEXA=am62x_evm_a53_defconfig
+ export TFA_BOARD=lite
+ # we dont use any extra TFA parameters
+ unset TFA_EXTRA_ARGS
+ export OPTEE_PLATFORM=k3-am62x
+ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
 
 .. am62x_evm_rst_include_start_build_steps
 
@@ -270,6 +270,6 @@ detailed setup information.
 
 To start OpenOCD and connect to the board
 
-.. code-block:: bash
+.. prompt:: bash $
 
   openocd -f board/ti_am625evm.cfg
diff --git a/doc/board/ti/am64x_evm.rst b/doc/board/ti/am64x_evm.rst
index db27461cb14d..05f3b34249e7 100644
--- a/doc/board/ti/am64x_evm.rst
+++ b/doc/board/ti/am64x_evm.rst
@@ -65,16 +65,16 @@ Set the variables corresponding to this platform:
 .. include::  k3.rst
 :start-after: .. k3_rst_include_start_common_env_vars_defn
 :end-before: .. k3_rst_include_end_common_env_vars_defn
-.. code-block:: bash
-
- $ export UBOOT_CFG_CORTEXR=am64x_evm_r5_defconfig
- $ export UBOOT_CFG_CORTEXA=am64x_evm_a53_defconfig
- $ export TFA_BOARD=lite
- $ # we dont use any extra TFA parameters
- $ unset TFA_EXTRA_ARGS
- $ export OPTEE_PLATFORM=k3-am64x
- $ # we dont use any extra TFA parameters
- $ unset OPTEE_EXTRA_ARGS
+.. prompt:: bash $
+
+ export 

Re: [PATCH] mmc: sdhci-cadence: Add support for Cadence sdmmc v6

2023-11-02 Thread Jaehoon Chung
Hi

On 10/3/23 16:22, Kuan Lim Lee wrote:
> From: Kuan Lim Lee 
> 
> Cadence SDMMC v6 controller has a lot of changes on initialize
> compared to v4 controller. PHY is needed by v6 controller.
> 
> Signed-off-by: Kuan Lim Lee 
> Reviewed-by: Alex Soo 
> Reviewed-by: Wei Liang Lim 

I didn't see their Reviewed-by tag in mailing list.

> ---
>  drivers/mmc/Kconfig  |  13 ++
>  drivers/mmc/Makefile |   1 +
>  drivers/mmc/sdhci-cadence.c  |  63 ++-
>  drivers/mmc/sdhci-cadence.h  |  68 +++
>  drivers/mmc/sdhci-cadence6-phy.c | 302 +++
>  5 files changed, 396 insertions(+), 51 deletions(-)
>  create mode 100644 drivers/mmc/sdhci-cadence.h
>  create mode 100644 drivers/mmc/sdhci-cadence6-phy.c
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index de01b9687b..cec881d862 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -573,6 +573,19 @@ config MMC_SDHCI_CADENCE
>  
> If unsure, say N.
>  
> +config MMC_SDHCI_CADENCE_V6
> + bool "SDHCI support for the Cadence SD/SDIO/eMMC controller & driver 
> version 6"
> + depends on BLK && DM_MMC
> + depends on MMC_SDHCI
> + depends on OF_CONTROL
> + select MMC_SDHCI_CADENCE
> + help
> +   This selects the Cadence SD/SDIO/eMMC driver version 6.
> +
> +   If you have a controller with this interface, say Y here.
> +
> +   If unsure, say N.
> +
>  config MMC_SDHCI_AM654
>   bool "SDHCI Controller on TI's Am654 devices"
>   depends on ARCH_K3
> diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
> index 2c65c4765a..cdcce55b8b 100644
> --- a/drivers/mmc/Makefile
> +++ b/drivers/mmc/Makefile
> @@ -61,6 +61,7 @@ obj-$(CONFIG_MMC_SDHCI_ATMEL)   += atmel_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_BCM2835)  += bcm2835_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_BCMSTB)   += bcmstb_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_CADENCE)  += sdhci-cadence.o
> +obj-$(CONFIG_MMC_SDHCI_CADENCE_V6)   += sdhci-cadence6-phy.o
>  obj-$(CONFIG_MMC_SDHCI_AM654)+= am654_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_IPROC)+= iproc_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_KONA) += kona_sdhci.o
> diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
> index 327a05ad11..d7a270e74c 100644
> --- a/drivers/mmc/sdhci-cadence.c
> +++ b/drivers/mmc/sdhci-cadence.c
> @@ -17,56 +17,7 @@
>  #include 
>  #include 
>  #include 
> -
> -/* HRS - Host Register Set (specific to Cadence) */
> -#define SDHCI_CDNS_HRS04 0x10/* PHY access port */
> -#define   SDHCI_CDNS_HRS04_ACK   BIT(26)
> -#define   SDHCI_CDNS_HRS04_RDBIT(25)
> -#define   SDHCI_CDNS_HRS04_WRBIT(24)
> -#define   SDHCI_CDNS_HRS04_RDATA GENMASK(23, 16)
> -#define   SDHCI_CDNS_HRS04_WDATA GENMASK(15, 8)
> -#define   SDHCI_CDNS_HRS04_ADDR  GENMASK(5, 0)
> -
> -#define SDHCI_CDNS_HRS06 0x18/* eMMC control */
> -#define   SDHCI_CDNS_HRS06_TUNE_UP   BIT(15)
> -#define   SDHCI_CDNS_HRS06_TUNE  GENMASK(13, 8)
> -#define   SDHCI_CDNS_HRS06_MODE  GENMASK(2, 0)
> -#define   SDHCI_CDNS_HRS06_MODE_SD   0x0
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_SDR  0x2
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_DDR  0x3
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_HS2000x4
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_HS4000x5
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_HS400ES  0x6
> -
> -/* SRS - Slot Register Set (SDHCI-compatible) */
> -#define SDHCI_CDNS_SRS_BASE  0x200
> -
> -/* PHY */
> -#define SDHCI_CDNS_PHY_DLY_SD_HS 0x00
> -#define SDHCI_CDNS_PHY_DLY_SD_DEFAULT0x01
> -#define SDHCI_CDNS_PHY_DLY_UHS_SDR12 0x02
> -#define SDHCI_CDNS_PHY_DLY_UHS_SDR25 0x03
> -#define SDHCI_CDNS_PHY_DLY_UHS_SDR50 0x04
> -#define SDHCI_CDNS_PHY_DLY_UHS_DDR50 0x05
> -#define SDHCI_CDNS_PHY_DLY_EMMC_LEGACY   0x06
> -#define SDHCI_CDNS_PHY_DLY_EMMC_SDR  0x07
> -#define SDHCI_CDNS_PHY_DLY_EMMC_DDR  0x08
> -#define SDHCI_CDNS_PHY_DLY_SDCLK 0x0b
> -#define SDHCI_CDNS_PHY_DLY_HSMMC 0x0c
> -#define SDHCI_CDNS_PHY_DLY_STROBE0x0d
> -
> -/*
> - * The tuned val register is 6 bit-wide, but not the whole of the range is
> - * available.  The range 0-42 seems to be available (then 43 wraps around to 
> 0)
> - * but I am not quite sure if it is official.  Use only 0 to 39 for safety.
> - */
> -#define SDHCI_CDNS_MAX_TUNING_LOOP   40
> -
> -struct sdhci_cdns_plat {
> - struct mmc_config cfg;
> - struct mmc mmc;
> - void __iomem *hrs_addr;
> -};
> +#include "sdhci-cadence.h"
>  
>  struct sdhci_cdns_phy_cfg {
>   const char *property;
> @@ -112,8 +63,11 @@ static int sdhci_cdns_write_phy_reg(struct 
> sdhci_cdns_plat *plat,
>  }
>  
>  static int sdhci_cdns_phy_init(struct sdhci_cdns_plat *plat,
> - 

Please pull u-boot-dm

2023-11-02 Thread Simon Glass
Hi Tom,

Just various bugfixes, apart from the TI one


https://source.denx.de/u-boot/custodians/u-boot-dm/-/commit/3227baad05481e37d75aeae7c7c1467fd6903f7d

https://dev.azure.com/simon0972/u-boot/_build/results?buildId=54=results
(not finished yet)


The following changes since commit 07fe79c93c5caba181f37844ca95fbda4db3f613:

  Merge tag 'i2cfixes-for-v2024-01-rc2' of
https://source.denx.de/u-boot/custodians/u-boot-i2c (2023-11-02
10:12:33 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-dm.git tags/dm-pull-2nov23

for you to fetch changes up to 3227baad05481e37d75aeae7c7c1467fd6903f7d:

  u_boot_pylib: Ensure subprocess is closed down (2023-11-02 09:38:54 -0600)


Heinrich Schuchardt (1):
  sandbox: eliminate unused functions from binaries

Maxim Cournoyer (1):
  patman: Add a 'keep_change_id' setting

Milan P. Stanić (1):
  cros_ec: spi: disable annoying key echo on console

Neha Malcom Francis (1):
  binman: openssl: x509: ti_secure_rom: Add support for bootcore_opts

Simon Glass (9):
  binman: Reset missing bintools after testing
  binman: Don't add compression attribute for uncompressed files
  binman: Ensure attributes always come last in the metadata
  binman: Replace FILENAME_ALIGN 16 with ATTRIBUTE_ALIGN 4
  binman: Rename TYPE_STAGE to TYPE_LEGACY_STAGE
  binman: Move stage header into a CBFS attribute
  buildman: Include symbols in the read-only data section
  buildman: Support upstream branch name containing /
  u_boot_pylib: Ensure subprocess is closed down

 arch/sandbox/config.mk  |   4 +-
 arch/sandbox/cpu/u-boot.lds |   2 +-
 cmd/cbfs.c  |   2 +-
 drivers/misc/cros_ec_spi.c  |   2 +-
 include/cbfs.h  |   2 +-
 tools/binman/btool/openssl.py   |   6 ++-
 tools/binman/cbfs_util.py   | 125
+---
 tools/binman/cbfs_util_test.py  |  23 
 tools/binman/control.py |   2 +
 tools/binman/entries.rst|   1 +
 tools/binman/etype/ti_secure_rom.py |  11 +++-
 tools/binman/etype/x509_cert.py |   3 +-
 tools/binman/ftest.py   |  10 ++--
 tools/binman/test/297_ti_secure_rom.dts |   1 +
 tools/buildman/builder.py   |   6 ++-
 tools/patman/__main__.py|   2 +
 tools/patman/control.py |  12 +++--
 tools/patman/gitutil.py |   5 +-
 tools/patman/patchstream.py |  17 --
 tools/patman/patman.rst |  11 ++--
 tools/patman/test_checkpatch.py |  16 ++
 tools/u_boot_pylib/command.py   |   4 +-
 22 files changed, 168 insertions(+), 99 deletions(-)

Regards,
Simon


Re: [PATCH v2] patman: Add a 'keep_change_id' setting

2023-11-02 Thread Simon Glass
On Thu, 12 Oct 2023 at 20:06, Maxim Cournoyer  wrote:
>
> A Change-Id can be useful for traceability purposes, and some projects
> may wish to have them preserved.  This change makes it configurable
> via a new 'keep_change_id' setting.
>
> Signed-off-by: Maxim Cournoyer 
> ---
>
> Changes in v2:
> - Add missing argument to send parser
> - Correctly propagate args.keep_change_id
>
>  tools/patman/__main__.py|  2 ++
>  tools/patman/control.py | 12 +---
>  tools/patman/patchstream.py | 17 -
>  tools/patman/patman.rst | 11 ++-
>  tools/patman/test_checkpatch.py | 16 
>  5 files changed, 45 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH 1/6] binman: Reset missing bintools after testing

2023-11-02 Thread Simon Glass
Hi Simon

On 15/10/23 02:10, Simon Glass wrote:
> For tests which fake bintools being missing, we need to reset the list
> afterwards, to ensure that future tests do not also see the bintools as
> missing.
>
> Reset the list when processing is complete.
>
> Signed-off-by: Simon Glass 
> ---
>
>   tools/binman/control.py | 2 ++
>   1 file changed, 2 insertions(+)
>
Applied to u-boot-dm, thanks!


Re: [PATCH 2/6] binman: Don't add compression attribute for uncompressed files

2023-11-02 Thread Simon Glass
Hi Simon

On 15/10/23 02:10, Simon Glass wrote:
> cbfsutil changed to skip adding a compression attribute if there is no
> compression. Adjust the binman implementation to do the same.
>
> This mirrors commit 105cdf5625 in coreboot.
>
> Signed-off-by: Simon Glass 
> ---
>
>   tools/binman/cbfs_util.py  | 13 -
>   tools/binman/cbfs_util_test.py |  8 
>   tools/binman/ftest.py  |  6 +++---
>   3 files changed, 15 insertions(+), 12 deletions(-)
>
Applied to u-boot-dm, thanks!


Re: [PATCH 3/6] binman: Ensure attributes always come last in the metadata

2023-11-02 Thread Simon Glass
cbfsutil changed to write zero bytes instead of 0xff when a small
padding must be added. Adjust the binman implementation to do the same.

Drop the code which looks for an unused attribute tag, since it is not
used. A future patch moves the attributes to the end of the header in
any case, so no data will follow the attributes.

This mirrors commit f0cc7adb2f in coreboot.

Signed-off-by: Simon Glass 
---

 tools/binman/cbfs_util.py | 46 ---
 1 file changed, 24 insertions(+), 22 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 4/6] binman: Replace FILENAME_ALIGN 16 with ATTRIBUTE_ALIGN 4

2023-11-02 Thread Simon Glass
cbfsutil changed to 4-byte alignment for filenames instead of 16.
Adjust the binman implementation to do the same.

This mirrors commit 5779ca718c in coreboot.

Signed-off-by: Simon Glass 
---

 tools/binman/cbfs_util.py  | 10 +-
 tools/binman/cbfs_util_test.py | 19 ++-
 tools/binman/ftest.py  | 10 +-
 3 files changed, 20 insertions(+), 19 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 5/6] binman: Rename TYPE_STAGE to TYPE_LEGACY_STAGE

2023-11-02 Thread Simon Glass
In preparation for changing how stages are stored, rename the existing
stage tag.

Signed-off-by: Simon Glass 
---

 cmd/cbfs.c |  2 +-
 include/cbfs.h |  2 +-
 tools/binman/cbfs_util.py  | 12 ++--
 tools/binman/cbfs_util_test.py |  3 ++-
 4 files changed, 10 insertions(+), 9 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 6/6] binman: Move stage header into a CBFS attribute

2023-11-02 Thread Simon Glass
cbfsutil completely changed the way that stages are formatted in CBFS.
Adjust the binman implementation to do the same.

This mirrors commit 81dc20e744 in coreboot.

Signed-off-by: Simon Glass 
---

 tools/binman/cbfs_util.py  | 64 +-
 tools/binman/cbfs_util_test.py |  7 ++--
 2 files changed, 42 insertions(+), 29 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH v2] cros_ec: spi: disable annoying key echo on console

2023-11-02 Thread Simon Glass
on Peach-pi console every key press is echoed with message
'cros_ec_command: Returned status 1'

this is not proper fix, just hack to disable this message

Signed-off-by: Milan P. Stanić 
Reviewed-by: Simon Glass 
---
changed patch to use log_debug and added forgoten Signed-off-by and
and Reviewed-by Simon response mail

 drivers/misc/cros_ec_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm, thanks!


Re: [PATCH] buildman: Include symbols in the read-only data section

2023-11-02 Thread Simon Glass
On Mon, Oct 23, 2023 at 12:52:43AM -0700, Simon Glass wrote:

> When symbols switch between the inited data section and the read-only
> data section their visbility changes, at present, with the -B option.
>
> This is confusing, since adding 'const' to a variable declaration can
> make it look like a significant improvement in bloat. But in fact
> nothing has changed.
>
> Add 'r' to the list of symbols types that are recorded, to correct this
> problem. Add a constant to make it easier to find this code next time.
>
> Signed-off-by: Simon Glass 

Thanks for fixing this.

Reported-by: Tom Rini 
Reviewed-by: Tom Rini 
Link: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/6

-- 
Tom

Applied to u-boot-dm, thanks!


Re: [PATCH v4 1/2] binman: openssl: x509: ti_secure_rom: Add support for bootcore_opts

2023-11-02 Thread Simon Glass
On Mon, 23 Oct 2023 at 01:01, Neha Malcom Francis  wrote:
>
> According to the TRMs of K3 platform of devices, the ROM boot image
> format specifies a "Core Options Field" that provides the capability to
> set the boot core in lockstep when set to 0 or to split mode when set
> to 2. Add support for providing the same from the binman DTS. Also
> modify existing test case for ensuring future coverage.
>
> Signed-off-by: Neha Malcom Francis 
> ---
> Link to J721E TRM: https://www.ti.com/lit/zip/spruil1
> Section 4.5.4.1 Boot Info
>
> Changes in v4:
> - corrected function comments, 0 for lockstep, 2 for split mode
>
> Changes in v3:
> - updated function comments
> - removed inconsistency in setting bootcore_opts to 32
>
> Changes in v2:
> - included TRM link in commit message
>
>  tools/binman/btool/openssl.py   |  6 --
>  tools/binman/entries.rst|  1 +
>  tools/binman/etype/ti_secure_rom.py | 11 +--
>  tools/binman/etype/x509_cert.py |  3 ++-
>  tools/binman/test/297_ti_secure_rom.dts |  1 +
>  5 files changed, 17 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH v3 1/1] sandbox: eliminate unused functions from binaries

2023-11-02 Thread Simon Glass
On Tue, Oct 24, 2023 at 08:30:47AM +0200, Heinrich Schuchardt wrote:

> The sandbox should closely mimic other architectures.
>
> Place each function or data in a separate section and let the linker
> eliminate unused ones. This will reduce the binary size.
>
> In the linker script mark that u_boot_sandbox_getopt are to be kept.
>
> Signed-off-by: Heinrich Schuchardt 

Reviewed-by: Tom Rini 

-- 
Tom

Applied to u-boot-dm, thanks!


Re: [PATCH] u_boot_pylib: Ensure subprocess is closed down

2023-11-02 Thread Simon Glass
It isn't clear why we need to have two different paths for closing down
the pipe. Unify them and use the Python to avoid this warning:

  subprocess.py:1127: ResourceWarning: subprocess 83531 is still running

Note that this code appears to originally have come from [1] and was
committed into the ChromeOS chromiumos/platform/crosutils repo in the
bin/cros_image_to_target.py file. The addition of the extra code path
came later, so that is chosen for the fixes tag.

[1] https://codereview.chromium.org/3391008

Signed-off-by: Simon Glass 
Fixes: a10fd93cbc patman: Make command methods return a CommandResult
---

 tools/u_boot_pylib/command.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH v2 3/5] common/board_f: Catch bloblist before starting resevations

2023-11-02 Thread Simon Glass
Hi Devarsh,

On Tue, 31 Oct 2023 at 13:12, Devarsh Thakkar  wrote:
>
> Start reservations needed for init sequence only after catching
> bloblists from previous stage.
>
> This is to avoid catching bloblists in the middle causing
> gaps while u-boot is reserving.
>
> Adjust the relocaddr as per video hand-off information
> received from previous stage so that further reservations
> start only after regions reserved for previous stages
>
> Skip reservation for video memory if it was already
> filled by a bloblist.
>
> Signed-off-by: Devarsh Thakkar 
> ---
> V2: Fix typo in commit title and checkpatch warnings/checks
> ---
>  common/board_f.c | 33 ++---
>  1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/common/board_f.c b/common/board_f.c
> index d4d7d01f8f..acf802c9cb 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -403,7 +403,7 @@ __weak int arch_reserve_mmu(void)
> return 0;
>  }
>
> -static int reserve_video(void)
> +static int reserve_video_from_videoblob(void)
>  {
> if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
> struct video_handoff *ho;
> @@ -412,8 +412,34 @@ static int reserve_video(void)
> if (!ho)
> return log_msg_ret("blf", -ENOENT);
> video_reserve_from_bloblist(ho);
> -   gd->relocaddr = ho->fb;
> -   } else if (CONFIG_IS_ENABLED(VIDEO)) {
> +
> +   /* Sanity check fb from blob is before current relocaddr */
> +   if (likely(gd->relocaddr > (unsigned long)ho->fb))
> +   gd->relocaddr = ho->fb;
> +   }
> +
> +   return 0;
> +}
> +
> +/*
> + * Check if any bloblist received specifying reserved areas from previous 
> stage and adjust
> + * gd->relocaddr accordingly, so that we start reserving after pre-reserved 
> areas
> + * from previous stage.
> + *
> + * NOTE:
> + * IT is recommended that all bloblists from previous stage are reserved 
> from ram_top
> + * as next stage will simply start reserving further regions after them.
> + */
> +static int setup_relocaddr_from_bloblist(void)
> +{
> +   reserve_video_from_videoblob();
> +
> +   return 0;
> +}
> +
> +static int reserve_video(void)
> +{
> +   if (CONFIG_IS_ENABLED(VIDEO)) {
> ulong addr;
> int ret;
>
> @@ -923,6 +949,7 @@ static const init_fnc_t init_sequence_f[] = {
> reserve_pram,
>  #endif
> reserve_round_4k,
> +   setup_relocaddr_from_bloblist,
> arch_reserve_mmu,
> reserve_video,

But you have renamed this function, so how does this commit build?

buildman -b  --board sandbox_spl

might help?

> reserve_trace,
> --
> 2.34.1
>

Regards,
Simon


Re: [PATCH v2 5/5] video: Fill video handoff in video post probe

2023-11-02 Thread Simon Glass
Hi Devarsh,

On Tue, 31 Oct 2023 at 13:12, Devarsh Thakkar  wrote:
>
> Fill video handoff fields in video_post_probe
> as at this point we have full framebuffer related

framebuffer-related

> information.
>
> Also fill all the fields available in video hand-off
> struct as those were missing earlier and u-boot

U-Boot

> framework expects them to be filled for some of the
> functionalities.
>
> Reported-by: Simon Glass 
> Signed-off-by: Devarsh Thakkar 
> ---
> V2: No change
> ---
>  drivers/video/video-uclass.c | 25 +++--
>  1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
> index 335a1a1828..635b70f668 100644
> --- a/drivers/video/video-uclass.c
> +++ b/drivers/video/video-uclass.c
> @@ -153,16 +153,6 @@ int video_reserve(ulong *addrp)
> debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
>   gd->video_top);
>
> -   if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(VIDEO_HANDOFF)) {
> -   struct video_handoff *ho;
> -
> -   ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
> -   if (!ho)
> -   return log_msg_ret("blf", -ENOENT);
> -   ho->fb = *addrp;
> -   ho->size = size;

You also need to fill out the other fields in there:

struct video_handoff {
   u64 fb;
   u32 size;
   u16 xsize;
   u16 ysize;
   u32 line_length;
   u8 bpix;
};


> -   }
> -
> return 0;
>  }
>
> @@ -558,6 +548,21 @@ static int video_post_probe(struct udevice *dev)
>
> priv->fb_size = priv->line_length * priv->ysize;
>
> +   /* Set up video handoff fields for passing video blob to next stage */
> +   if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST)) {
> +   struct video_handoff *ho;
> +
> +   ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
> +   if (!ho)
> +   return log_msg_ret("blf", -ENOENT);
> +   ho->fb = gd->video_bottom;

This is a bit odd, since it assumes there is a single video
framebuffer. I suppose that is normally the case, but please add a
comment saying that only one is supported.

> +   ho->size = gd->video_top - gd->video_bottom;
> +   ho->xsize = priv->xsize;
> +   ho->ysize = priv->ysize;
> +   ho->line_length = priv->line_length;
> +   ho->bpix = priv->bpix;
> +   }
> +
> if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_base)
> priv->copy_fb = map_sysmem(plat->copy_base, plat->size);
>
> --
> 2.34.1
>

Please can you add some documentation to doc/develop/spl.rst or similar?

Regards,
Simon


Re: [PATCH v2 4/5] video: Skip framebuffer reservation if already reserved

2023-11-02 Thread Simon Glass
On Tue, 31 Oct 2023 at 13:12, Devarsh Thakkar  wrote:
>
> Skip framebufer reservation if it was already reserved
> from previous stage and whose information was passed
> using a bloblist.
>
> Signed-off-by: Devarsh Thakkar 
> Reviewed-by: Simon Glass 
> ---
> V2:
> - Add debug prints
> - Fix commenting style
> ---
>  drivers/video/video-uclass.c | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
> index f743ed74c8..335a1a1828 100644
> --- a/drivers/video/video-uclass.c
> +++ b/drivers/video/video-uclass.c
> @@ -123,6 +123,18 @@ int video_reserve(ulong *addrp)
> struct udevice *dev;
> ulong size;
>
> +   if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
> +   /* Skip allocation if already received a bloblist which

comment style

/*
 * Skip ...

> +* filled below fields
> +*/
> +   if (gd->fb_base && gd->video_top && gd->video_bottom) {
> +   debug("Found pre-reserved video memory from %lx to 
> %lx\n",
> + gd->video_bottom, gd->video_top);
> +   debug("Skipping video frame buffer allocation\n");
> +   return 0;
> +   }
> +   }
> +
> gd->video_top = *addrp;
> for (uclass_find_first_device(UCLASS_VIDEO, );
>  dev;
> --
> 2.34.1
>

Regards,
Simon


Re: [PATCH v2 2/2] rng: add dm_rng_read_default() helper

2023-11-02 Thread Simon Glass
Hi Alexey,

On Thu, 2 Nov 2023 at 12:57, Alexey Romanov  wrote:
>
> Add dm_rng_read_default() function, which obtain a series
> of random bytes. In some cases, such function would be
> useful because it allows the caller to abstract away from
> RNG device.

It should not do that. It should create a RNG device for its needs.

>
> Signed-off-by: Alexey Romanov 
> ---
>  drivers/rng/rng-uclass.c | 18 ++
>  include/rng.h| 10 ++
>  2 files changed, 28 insertions(+)

Regards,
Simon


Re: [PATCH v3 4/4] sunxi: Enable SPL FIT loading for 32-bit SoCs

2023-11-02 Thread Simon Glass
On Tue, 31 Oct 2023 at 05:18, Samuel Holland  wrote:
>
> Now that 32-bit SoCs can load U-Boot proper (and possibly other
> firmware) from a FIT, use this method by default. SPL_FIT_IMAGE_TINY is
> required to stay within the 24 or 32 KiB SPL size limit on early SoCs;
> for consistency, enable it everywhere.
>
> Signed-off-by: Samuel Holland 
> ---
>
> (no changes since v2)
>
> Changes in v2:
>  - New patch for v2, split from the .dtsi changes
>
>  arch/arm/Kconfig   | 1 +
>  common/spl/Kconfig | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs

2023-11-02 Thread Simon Glass
On Tue, 31 Oct 2023 at 05:18, Samuel Holland  wrote:
>
> Some 32-bit SoCs can use SCP firmware to implement additional PSCI
> functionality, such as system suspend. In order to load this firmware
> from SPL, we need to generate and use a FIT instead of a legacy image.
>
> Adjust the binman FIT definition so it does not rely on TF-A BL31, as
> this is not used on 32-bit SoCs. Instead, after loading the firmware,
> U-Boot proper is executed directly.
>
> Signed-off-by: Samuel Holland 
> ---
>
> (no changes since v2)
>
> Changes in v2:
>  - Rely on binman min-size instead of using explicit offsets
>  - Use Kconfig for firmware addresses instead of an #ifdef staircase
>
>  arch/arm/dts/sunxi-u-boot.dtsi | 23 ++-
>  1 file changed, 18 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH v2 1/5] arm: mach-k3: common: Reserve video memory from end of the RAM

2023-11-02 Thread Simon Glass
Hi Devarsh,

On Tue, 31 Oct 2023 at 13:12, Devarsh Thakkar  wrote:
>
> Add function spl_reserve_video which is a wrapper
> around video_reserve to setup video memory and update
> the relocation address pointer.
>
> Setup video memory before page table reservation so that
> framebuffer memory gets reserved from the end of RAM.
>
> This is as per the new policy being discussed for passing
> blobs where each of the reserved areas for bloblists
> to be passed need to be reserved at the end of RAM.
>
> This is done to enable the next stage to directly skip
> the pre-reserved area from previous stage right from the end of RAM
> without having to make any gaps/holes to accommodate those
> regions which was the case before as previous stage
> reserved region not from the end of RAM.
>
> Suggested-by: Simon Glass 
> Signed-off-by: Devarsh Thakkar 
> ---
> V2: Make a generic function "spl_reserve_video" under
> common/spl which can be re-used by other platforms too
> for reserving video memory from spl.
> ---
>  arch/arm/mach-k3/common.c |  2 ++
>  common/spl/spl.c  | 19 +++
>  include/spl.h |  4 
>  3 files changed, 25 insertions(+)

>
> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> index c3006ba387..03e3b46282 100644
> --- a/arch/arm/mach-k3/common.c
> +++ b/arch/arm/mach-k3/common.c
> @@ -537,6 +537,8 @@ void spl_enable_dcache(void)
> if (ram_top >= 0x1)
> ram_top = (phys_addr_t) 0x1;
>
> +   gd->relocaddr = ram_top;
> +   spl_reserve_video();

Need to check error here

> gd->arch.tlb_addr = ram_top - gd->arch.tlb_size;
> gd->arch.tlb_addr &= ~(0x1 - 1);
> debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr,
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 732d90d39e..89172f2ebf 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -41,6 +41,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  DECLARE_GLOBAL_DATA_PTR;
>  DECLARE_BINMAN_MAGIC_SYM;
> @@ -151,6 +152,24 @@ void spl_fixup_fdt(void *fdt_blob)
>  #endif
>  }
>
> +int spl_reserve_video(void)
> +{
> +   if (CONFIG_IS_ENABLED(VIDEO)) {
> +   ulong addr;
> +   int ret;
> +
> +   addr = gd->relocaddr;
> +   ret = video_reserve();
> +   if (ret)
> +   return ret;
> +   debug("Reserving %luk for video at: %08lx\n",
> + ((unsigned long)gd->relocaddr - addr) >> 10, addr);
> +   gd->relocaddr = addr;
> +   }
> +
> +   return 0;
> +}
> +
>  ulong spl_get_image_pos(void)
>  {
> if (!CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS))
> diff --git a/include/spl.h b/include/spl.h
> index 0d49e4a454..9682e51fc1 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -825,6 +825,10 @@ int spl_usb_load(struct spl_image_info *spl_image,
>
>  int spl_ymodem_load_image(struct spl_image_info *spl_image,
>   struct spl_boot_device *bootdev);
> +/**
> + * spl_reserve_video() - Reserve video and update relocation address

This needs more detail about:
- gd->relocaddr
- where the video memory is allocated
- where the allocation is stored (in the video-device plat?)
- return value

> + */
> +int spl_reserve_video(void);
>
>  /**
>   * spl_invoke_atf - boot using an ARM trusted firmware image
> --
> 2.34.1
>

Regards,
Simon


Re: [PATCH v2 1/2] rng: move platform_get_rng_device() to rng-uclass.c

2023-11-02 Thread Simon Glass
Hi Alexey,

On Thu, 2 Nov 2023 at 12:58, Alexey Romanov  wrote:
>
> The correct declaration place for platform_get_rng_device()
> function is here. Also, this function is re-implemented to provide
> the first successfully probed RNG device.
>
> Signed-off-by: Alexey Romanov 
> ---
>  drivers/rng/rng-uclass.c | 16 
>  include/efi_rng.h|  2 --
>  include/rng.h| 11 +++
>  lib/efi_loader/efi_rng.c | 27 ---
>  4 files changed, 27 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/rng/rng-uclass.c b/drivers/rng/rng-uclass.c
> index 53108e1b31..d7236b9335 100644
> --- a/drivers/rng/rng-uclass.c
> +++ b/drivers/rng/rng-uclass.c
> @@ -9,6 +9,22 @@
>  #include 
>  #include 
>
> +int platform_get_rng_device(struct udevice **dev)
> +{
> +   int ret;
> +   struct udevice *devp;
> +
> +   ret = uclass_first_device_check(UCLASS_RNG, );
> +   if (ret) {
> +   pr_err("Unable to get RNG device (%d)\n", ret);
> +   return -ENODEV;
> +   }
> +
> +   *dev = devp;
> +
> +   return 0;
> +}

Why not delete this function? It doesn't seem to do anything useful
except return the wrong error code if something goes wrong :-)

I worry that people might add other logic to it.

Also you might consider using rng0, rng1 aliases so people can
actually choose the device to use? If you want that you could
uclass_get_device_by_seq()

> +
>  int dm_rng_read(struct udevice *dev, void *buffer, size_t size)
>  {
> const struct dm_rng_ops *ops = device_get_ops(dev);
> diff --git a/include/efi_rng.h b/include/efi_rng.h
> index 3c622381cb..f22e54adb0 100644
> --- a/include/efi_rng.h
> +++ b/include/efi_rng.h
> @@ -23,6 +23,4 @@ struct efi_rng_protocol {
>efi_uintn_t rng_value_length, uint8_t 
> *rng_value);
>  };
>
> -efi_status_t platform_get_rng_device(struct udevice **dev);
> -
>  #endif /* _EFI_RNG_H_ */
> diff --git a/include/rng.h b/include/rng.h
> index 37af554363..255c85d3e8 100644
> --- a/include/rng.h
> +++ b/include/rng.h
> @@ -20,6 +20,17 @@ struct udevice;
>   */
>  int dm_rng_read(struct udevice *dev, void *buffer, size_t size);
>
> +/**
> + * platform_get_rng_device() - retrieve random number generator
> + *
> + * This function retrieves the first udevice implementing a hardware
> + * random number generator. Device is already probed.
> + *
> + * @dev:   udevice
> + * Return: status code
> + */
> +int platform_get_rng_device(struct udevice **dev);

Better naming (if you do keep this) is rng_get_first()

There is no such thing as a 'platform' in U-Boot.

> +
>  /**
>   * struct dm_rng_ops - operations for the hwrng uclass
>   *
> diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c
> index bb11d8d0e0..0d8bf770f5 100644
> --- a/lib/efi_loader/efi_rng.c
> +++ b/lib/efi_loader/efi_rng.c
> @@ -17,33 +17,6 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID;
>
> -/**
> - * platform_get_rng_device() - retrieve random number generator
> - *
> - * This function retrieves the udevice implementing a hardware random
> - * number generator.
> - *
> - * This function may be overridden if special initialization is needed.
> - *
> - * @dev:   udevice
> - * Return: status code
> - */
> -__weak efi_status_t platform_get_rng_device(struct udevice **dev)
> -{
> -   int ret;
> -   struct udevice *devp;
> -
> -   ret = uclass_get_device(UCLASS_RNG, 0, );
> -   if (ret) {
> -   debug("Unable to get rng device\n");
> -   return EFI_DEVICE_ERROR;
> -   }
> -
> -   *dev = devp;
> -
> -   return EFI_SUCCESS;
> -}
> -
>  /**
>   * rng_getinfo() - get information about random number generation
>   *
> --
> 2.30.1
>

Regards,
Simon


Re: [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE

2023-11-02 Thread Tom Rini
On Tue, Sep 12, 2023 at 02:35:03PM -0700, seanedm...@linux.microsoft.com wrote:

> From: Sean Edmond 
> 
> There is a preference to use the "ofnode" API for FDT fixups
> moving forward.  The FDT fixup will usually be for the kernel FDT.  To
> fixup the kernel FDT with the ofnode API, it's required to set the
> OFNODE_MULTI_TREE option.
> 
> To ensure existing users of kaslr fdt fixup are not impacted, Let's modify
> the default value for OFNODE_MULTI_TREE to ensure it's always set if
> !OF_LIVE.  This will cause a 1007 byte increase in the code size.
> 
> Signed-off-by: Sean Edmond 
> Reviewed-by: Simon Glass 
> ---
>  drivers/core/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This leads to failure to build such as:
Building current source for 1 boards (1 thread, 12 jobs per thread)
   arm:  +   integratorap_cm946es
+(integratorap_cm946es) arm-linux-gnueabi-ld.bfd: common/board_r.o: in function 
`initr_dm':
+(integratorap_cm946es) common/board_r.c:231:(.text.initr_dm+0x4): undefined 
reference to `oftree_reset'
+(integratorap_cm946es) make[1]: *** [Makefile:1765: u-boot] Error 1
+(integratorap_cm946es) make: *** [Makefile:177: sub-make] Error 2
 
-- 
Tom


signature.asc
Description: PGP signature


[PULL] u-boot-sh/master_common_h_cleanup

2023-11-02 Thread Marek Vasut
The following changes since commit a803f87202aa48974bdff4d8100464a8288931e4:

  Merge https://source.denx.de/u-boot/custodians/u-boot-mmc (2023-11-01 
09:44:33 -0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-sh.git master_common_h_cleanup

for you to fetch changes up to 7d824618d7eb5340e63892c919abc62d831e7482:

  board: rzg2l: Drop  (2023-11-02 11:30:19 +0100)


Paul Barker (8):
  arm: armv8: mmu: Prepare for common.h removal
  arm: mach-rmobile: Drop 
  serial: sh: Drop 
  pinctrl: rzg2l: Drop 
  mmc: renesas-sdhi: Drop 
  gpio: rzg2l: Drop 
  clk: rzg2l: Drop 
  board: rzg2l: Drop 

 arch/arm/include/asm/armv8/mmu.h | 2 ++
 arch/arm/mach-rmobile/board.c| 2 +-
 arch/arm/mach-rmobile/cpu_info-r8a7740.c | 2 +-
 arch/arm/mach-rmobile/cpu_info-rcar.c| 2 +-
 arch/arm/mach-rmobile/cpu_info-rzg.c | 2 +-
 arch/arm/mach-rmobile/cpu_info-rzg2l.c   | 1 -
 arch/arm/mach-rmobile/cpu_info.c | 2 +-
 arch/arm/mach-rmobile/emac.c | 1 -
 arch/arm/mach-rmobile/memmap-gen3.c  | 4 ++--
 arch/arm/mach-rmobile/memmap-rzg2l.c | 2 +-
 arch/arm/mach-rmobile/pfc-r8a7740.c  | 2 +-
 arch/arm/mach-rmobile/psci-r8a779a0.c| 1 -
 board/renesas/rzg2l/rzg2l.c  | 1 -
 drivers/clk/renesas/r9a07g044-cpg.c  | 1 -
 drivers/clk/renesas/rzg2l-cpg.c  | 1 -
 drivers/gpio/rzg2l-gpio.c| 1 -
 drivers/mmc/renesas-sdhi.c   | 1 -
 drivers/pinctrl/renesas/rzg2l-pfc.c  | 1 -
 drivers/serial/serial_sh.c   | 1 -
 19 files changed, 11 insertions(+), 19 deletions(-)


Re: [PATCH v2 1/2] rng: move platform_get_rng_device() to rng-uclass.c

2023-11-02 Thread Heinrich Schuchardt

On 11/2/23 11:16, Alexey Romanov wrote:

The correct declaration place for platform_get_rng_device()
function is here. Also, this function is re-implemented to provide
the first successfully probed RNG device.

Signed-off-by: Alexey Romanov 
---
  drivers/rng/rng-uclass.c | 16 
  include/efi_rng.h|  2 --
  include/rng.h| 11 +++
  lib/efi_loader/efi_rng.c | 27 ---
  4 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/drivers/rng/rng-uclass.c b/drivers/rng/rng-uclass.c
index 53108e1b31..d7236b9335 100644
--- a/drivers/rng/rng-uclass.c
+++ b/drivers/rng/rng-uclass.c
@@ -9,6 +9,22 @@
  #include 
  #include 

+int platform_get_rng_device(struct udevice **dev)


You are dropping __weak here. The rationale behind this change should be
provided in the commit message.

Best regards

Heinrich


+{
+   int ret;
+   struct udevice *devp;
+
+   ret = uclass_first_device_check(UCLASS_RNG, );
+   if (ret) {
+   pr_err("Unable to get RNG device (%d)\n", ret);
+   return -ENODEV;
+   }
+
+   *dev = devp;
+
+   return 0;
+}
+
  int dm_rng_read(struct udevice *dev, void *buffer, size_t size)
  {
const struct dm_rng_ops *ops = device_get_ops(dev);
diff --git a/include/efi_rng.h b/include/efi_rng.h
index 3c622381cb..f22e54adb0 100644
--- a/include/efi_rng.h
+++ b/include/efi_rng.h
@@ -23,6 +23,4 @@ struct efi_rng_protocol {
   efi_uintn_t rng_value_length, uint8_t 
*rng_value);
  };

-efi_status_t platform_get_rng_device(struct udevice **dev);
-
  #endif /* _EFI_RNG_H_ */
diff --git a/include/rng.h b/include/rng.h
index 37af554363..255c85d3e8 100644
--- a/include/rng.h
+++ b/include/rng.h
@@ -20,6 +20,17 @@ struct udevice;
   */
  int dm_rng_read(struct udevice *dev, void *buffer, size_t size);

+/**
+ * platform_get_rng_device() - retrieve random number generator
+ *
+ * This function retrieves the first udevice implementing a hardware
+ * random number generator. Device is already probed.
+ *
+ * @dev:   udevice
+ * Return: status code
+ */
+int platform_get_rng_device(struct udevice **dev);
+
  /**
   * struct dm_rng_ops - operations for the hwrng uclass
   *
diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c
index bb11d8d0e0..0d8bf770f5 100644
--- a/lib/efi_loader/efi_rng.c
+++ b/lib/efi_loader/efi_rng.c
@@ -17,33 +17,6 @@ DECLARE_GLOBAL_DATA_PTR;

  const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID;

-/**
- * platform_get_rng_device() - retrieve random number generator
- *
- * This function retrieves the udevice implementing a hardware random
- * number generator.
- *
- * This function may be overridden if special initialization is needed.
- *
- * @dev:   udevice
- * Return: status code
- */
-__weak efi_status_t platform_get_rng_device(struct udevice **dev)
-{
-   int ret;
-   struct udevice *devp;
-
-   ret = uclass_get_device(UCLASS_RNG, 0, );
-   if (ret) {
-   debug("Unable to get rng device\n");
-   return EFI_DEVICE_ERROR;
-   }
-
-   *dev = devp;
-
-   return EFI_SUCCESS;
-}
-
  /**
   * rng_getinfo() - get information about random number generation
   *




[PATCH v2] bootstd: Skip over bad device during bootflows scanning

2023-11-02 Thread Tony Dinh
During bootstd scanning for bootdevs, if bootdev_hunt_drv() encounters
a device not found error (e.g. ENOENT), let it return a successful status
so that bootstd will continue scanning the next devices, not stopping
prematurely.

Background:

During scanning for bootflows, it's possible for bootstd to encounter a
faulty device controller. Also when the same u-boot is used for another
variant of the same board, some device controller such as SATA might
not exist.

I've found this issue while converting the Marvell Sheevaplug board to
use bootstd. This board has 2 variants, the original Sheevaplug has MMC and
USB only, but the later variant comes with USB, MMC, and eSATA ports. We
have been using the same u-boot (starting with CONFIG_IDE and later with DM
CONFIG_SATA) for both variants. This worked well with the old
envs-scripting booting scheme.

Signed-off-by: Tony Dinh 
---

Changes in v2:
- Restore bootdev_next_prio() to the original.
- Add a check in bootdev_hunt_drv(). If its descendant bootdev hunt driver
function returns -ENOENT, set the hunt status to successful (this is the
case where the device does not exist, or a bad device controller).
- Update bootdev_hunter_func() docs to indicate that a return
status -ENOENT is not an error, just a "device not found" status.
- Set status of sata_rescan() to -ENOENT when the SATA device is not found.

 boot/bootdev-uclass.c | 2 +-
 drivers/ata/sata.c| 2 +-
 include/bootdev.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 44ae98a926..4926a50da8 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -784,7 +784,7 @@ static int bootdev_hunt_drv(struct bootdev_hunter *info, 
uint seq, bool show)
if (info->hunt) {
ret = info->hunt(info, show);
log_debug("  - hunt result %d\n", ret);
-   if (ret)
+   if (ret && ret != -ENOENT)
return ret;
}
std->hunters_used |= BIT(seq);
diff --git a/drivers/ata/sata.c b/drivers/ata/sata.c
index dcb5fcf476..64fc078bad 100644
--- a/drivers/ata/sata.c
+++ b/drivers/ata/sata.c
@@ -65,7 +65,7 @@ int sata_rescan(bool verbose)
ret = uclass_find_first_device(UCLASS_AHCI, );
if (ret || !dev) {
printf("Cannot find SATA device (err=%d)\n", ret);
-   return -ENOSYS;
+   return -ENOENT;
}
 
ret = device_remove(dev, DM_REMOVE_NORMAL);
diff --git a/include/bootdev.h b/include/bootdev.h
index b079a91b5b..35fa25aff1 100644
--- a/include/bootdev.h
+++ b/include/bootdev.h
@@ -65,7 +65,7 @@ struct bootdev_hunter;
  *
  * @info: Info structure describing this hunter
  * @show: true to show information from the hunter
- * Returns: 0 if OK, -ve on error
+ * Returns: 0 if OK, -ENOENT on device not found, otherwise -ve on error
  */
 typedef int (*bootdev_hunter_func)(struct bootdev_hunter *info, bool show);
 
-- 
2.39.2



Re: [PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

2023-11-02 Thread Nishanth Menon
On 12:05-20231101, Andrew Davis wrote:
> Add am62x_beagleplay_r5_defconfig for R5 SPL and
> am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.
> 
> These defconfigs are composite defconfigs built from the config fragment
> board/ti/am62x/beagleplay_*.config applied onto the base
> am62x_evm_*_defconfig.
> 
> Signed-off-by: Andrew Davis 
> Reviewed-by: Simon Glass 
> ---
>  configs/am62x_beagleplay_a53_defconfig | 3 +++
>  configs/am62x_beagleplay_r5_defconfig  | 3 +++
>  2 files changed, 6 insertions(+)
>  create mode 100644 configs/am62x_beagleplay_a53_defconfig
>  create mode 100644 configs/am62x_beagleplay_r5_defconfig
> 
> diff --git a/configs/am62x_beagleplay_a53_defconfig 
> b/configs/am62x_beagleplay_a53_defconfig
> new file mode 100644
> index 000..ad708e15397
> --- /dev/null
> +++ b/configs/am62x_beagleplay_a53_defconfig
> @@ -0,0 +1,3 @@
> +// The BeaglePlay defconfig for A53 core
> +#include "configs/am62x_evm_a53_defconfig"
> +#include "board/ti/am62x/beagleplay_a53.config"
> diff --git a/configs/am62x_beagleplay_r5_defconfig 
> b/configs/am62x_beagleplay_r5_defconfig
> new file mode 100644
> index 000..276b1f81a3e
> --- /dev/null
> +++ b/configs/am62x_beagleplay_r5_defconfig
> @@ -0,0 +1,3 @@
> +// The BeaglePlay defconfig for R5 core
> +#include "configs/am62x_evm_r5_defconfig"
> +#include "board/ti/am62x/beagleplay_r5.config"

Let us also update the documentation doc/board/ti/am62x_beagleplay.rst
to point people to this configuration?


-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


Re: [PATCH 1/2] Makefile: Run defconfig files through the C preprocessor

2023-11-02 Thread Nishanth Menon
On 12:05-20231101, Andrew Davis wrote:
> This allows us to use some of the normal preprocessor directives inside
> defconfig files. Such as #define and #include.
> 
> Signed-off-by: Andrew Davis 
> Reviewed-by: Simon Glass 

Reviewed-by: Nishanth Menon 


-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
849D 1736 249D


Re: [PATCH 5/7] arm: mach-k3: am62x: Move board selection to mach-k3

2023-11-02 Thread Andrew Davis

On 11/2/23 3:55 AM, Francesco Dolcini wrote:

Hello Andrew,

On Wed, Nov 01, 2023 at 03:35:28PM -0500, Andrew Davis wrote:

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.


Is this oddity specific of ti k3 based board or is this a generic issue
in u-boot? Asking to understand if a k3-specific fix is the correct one
here.



Some platforms/archs do it this way, others don't, so it is mixed. Right
now I'm just fixing mach-k3 but I agree it would be good to audit for this
u-boot wide.

Thinking more on this, what we really need is a consistent strategy for
selecting target boards in Kconfig. I'd like to keep as much vendor
specific stuff in the board/ dirs, but in this case we end up
with the problem in the commit message.

I think arch/x86/ has the right idea. We can have in arch/arm/mach-k3/Kconfig

config VENDOR_*

selections which lets you choose only one vendor. From there we would
only include the one board directory matching that SoC+vendor combo.
That way we could keep the target selection down in the board/ dirs so
you don't have to make changes in arch/arm/mach-k3 when adding new board.

If everyone is okay with that, I can make that change to this series.
Could be a template then for other arch and vendors.

Andrew


Re: [PATCH 2/2] bootstd: cros: Correct condition for read method

2023-11-02 Thread Tom Rini
On Wed, Oct 25, 2023 at 07:17:37AM +1300, Simon Glass wrote:

> This has a typo which makes the method inoperable. Correct it so that
> 'bootflow read' works correctly for ChromeOS.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] arm: mach-k3: Move K3 common schema.yaml out of board directory

2023-11-02 Thread Francesco Dolcini
Hello Andrew,
thanks for the patch.

On Wed, Nov 01, 2023 at 01:33:29PM -0500, Andrew Davis wrote:
> This file is common for all K3, move it out of board/ directory and
> into mach-k3. As we need to change the path in k3-binman.dtsi let's
> take this opportunity to switch to absolute paths which makes adding
> non-TI boards (like Toradex Verdin) not need to override these paths.
> 
> Signed-off-by: Andrew Davis 

Reviewed-by: Francesco Dolcini 

Francesco


Re: [PATCH 1/1] bootstd: BOOTDEV_SPI_FLASH requires BOOTSTD

2023-11-02 Thread Tom Rini
On Mon, Aug 28, 2023 at 08:49:59PM +0200, Heinrich Schuchardt wrote:

> Compiling sandbox_defconfig with CONFIG_BOOTSTD=n fails:
> 
> /usr/bin/ld: drivers/mtd/spi/sf_bootdev.o:
> in function `sf_get_bootflow':
> /drivers/mtd/spi/sf_bootdev.c:43:(.text+0x96):
> undefined reference to `bootmeth_set_bootflow'
> 
> Add the missing Kconfig dependency.
> 
> Fixes: Fixes: 0c1f4a9fb13a ("bootstd: Add a SPI flash bootdev")
> Signed-off-by: Heinrich Schuchardt 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] bootstd: Make efi_mgr bootmeth work for non-sandbox setups

2023-11-02 Thread Tom Rini
On Sun, Sep 03, 2023 at 10:40:00PM +0200, Mark Kettenis wrote:

> Enable the bootflow based on this bootmeth if the BootOrder EFI
> variable is set.
> 
> Signed-off-by: Mark Kettenis 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Please pull u-boot-i2c

2023-11-02 Thread Tom Rini
On Thu, Nov 02, 2023 at 03:10:44PM +0100, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull from u-boot-i2c:
> 
> The following changes since commit d9650a48234058c645d1a07951c3d2cf129427e6:
> 
>   Merge branch '2023-10-28-assorted-platform-updates' (2023-10-28 09:23:27 
> -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-i2c.git 
> tags/i2cfixes-for-v2024-01-rc2
> 
> for you to fetch changes up to 5b6ee512ceb8d990e010646c4fe7b8a3633fad68:
> 
>   bootcount: Add driver model I2C driver (2023-10-31 09:09:04 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/2] bootstd: Handle a few special cases in cmdline_set_arg()

2023-11-02 Thread Tom Rini
On Wed, Oct 25, 2023 at 07:17:36AM +1300, Simon Glass wrote:

> Two bugs have appeared:
> 
> - arguments can have an equals sign embedded in them, which must be
>   considered part of the value
> - arguments must fully match the name; partial matches should be
>   ignored
> 
> Fix these and add a test to cover both.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] u-boot-riscv/master

2023-11-02 Thread Tom Rini
On Thu, Nov 02, 2023 at 06:49:56PM +0800, Leo Liang wrote:

> Hi Tom,
> 
> The following changes since commit a803f87202aa48974bdff4d8100464a8288931e4:
> 
>   Merge https://source.denx.de/u-boot/custodians/u-boot-mmc (2023-11-01 
> 09:44:33 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-riscv.git 
> 
> for you to fetch changes up to 9d22d4a7cef7f2fdaf5c060b71574e6f82ea5ff0:
> 
>   configs: visionfive2: Enable JH7110 RNG driver (2023-11-02 17:45:53 +0800)
> 
> CI result shows no issue: 
> https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/18407

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] CLock changes for 2024.01-rc2

2023-11-02 Thread Tom Rini
On Wed, Nov 01, 2023 at 05:03:29PM -0400, Sean Anderson wrote:

> The following changes since commit fb428b61819444b9337075f49c72f326f5d12085:
> 
>   Merge branch '2023-10-24-assorted-general-fixes-and-updates' (2023-10-24 
> 19:12:21 -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-clk.git tags/clk-2024.01-rc2
> 
> for you to fetch changes up to c4b52fda6924e92c6745351f32c4cafc36034170:
> 
>   clk: also handle ENOENT in *_optional functions (2023-11-01 15:14:51 -0400)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 00/15] nand: Add sandbox tests

2023-11-02 Thread Dario Binacchi
On Thu, Nov 2, 2023 at 3:13 PM Sean Anderson  wrote:
>
> On 11/2/23 10:08, Dario Binacchi wrote:
> > On Thu, Nov 2, 2023 at 3:06 PM Sean Anderson  wrote:
> >>
> >> On 11/2/23 10:01, Dario Binacchi wrote:
> >>> Sean, All,
> >>>
> >>> On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:
> 
>  This series tests raw nand flash in sandbox and fixes various bugs 
>  discovered in
>  the process. I've tried to do things in a contemporary manner, avoiding 
>  the
>  (numerous) variations present on only a few boards. The test is pretty 
>  minimal.
>  Future work could test the rest of the nand API as well as the MTD API.
> 
>  Bloat at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost
>  everything grows by a few bytes due to nand_page_size. A few boards grow 
>  more,
>  mostly those using nand_spl_loaders.c.
> 
>  [1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2
> 
> 
>  Sean Anderson (15):
>  spl: nand: Fix NULL-pointer dereference
>  nand: Don't dereference NULL manufacturer_desc
>  nand: Calculate SYS_NAND_PAGE_COUNT automatically
>  nand: spl_loaders: Only read enough pages to load the image
>  spl: legacy: Honor bl_len when decompressing
>  spl: nand: Set bl_len to page size
>  cmd: nand: Map memory before accessing it
>  spl: nand: Map memory before accessing it
>  mtd: Rename SPL_MTD_SUPPORT to SPL_MTD
>  mtd: Add some fallbacks for add/del_mtd_device
>  nand: Add function to unregister NAND devices
>  nand: Allow reinitialization
>  arch: sandbox: Add function to create temporary files
>  nand: Add sandbox driver
>  test: spl: Add a test for NAND
> 
> README|   9 +-
> arch/sandbox/cpu/os.c |  17 +
> arch/sandbox/dts/test.dts |  67 ++
> arch/sandbox/include/asm/spl.h|   1 +
> cmd/nand.c|  26 +-
> common/spl/Kconfig|   2 +-
> common/spl/spl_legacy.c   |  18 +-
> common/spl/spl_nand.c |  22 +-
> configs/am335x_baltos_defconfig   |   3 +-
> configs/am335x_evm_defconfig  |   3 +-
> configs/am335x_evm_spiboot_defconfig  |   2 +-
> configs/am335x_guardian_defconfig |   1 -
> configs/am335x_hs_evm_defconfig   |   2 +-
> configs/am335x_hs_evm_uart_defconfig  |   2 +-
> configs/am335x_igep003x_defconfig |   3 +-
> configs/am335x_sl50_defconfig |   2 +-
> configs/am3517_evm_defconfig  |   3 +-
> configs/am43xx_evm_defconfig  |   3 +-
> configs/am43xx_evm_rtconly_defconfig  |   3 +-
> configs/am43xx_evm_usbhost_boot_defconfig |   3 +-
> configs/am43xx_hs_evm_defconfig   |   3 +-
> configs/am62ax_evm_r5_defconfig   |   2 +-
> configs/am65x_evm_a53_defconfig   |   2 +-
> configs/axm_defconfig |   1 -
> configs/chiliboard_defconfig  |   1 -
> configs/cm_t43_defconfig  |   2 +-
> configs/corvus_defconfig  |   1 -
> configs/da850evm_nand_defconfig   |   1 -
> configs/devkit3250_defconfig  |   1 -
> configs/devkit8000_defconfig  |   1 -
> configs/dra7xx_evm_defconfig  |   1 -
> configs/draco_defconfig   |   1 -
> configs/etamin_defconfig  |   1 -
> .../gardena-smart-gateway-at91sam_defconfig   |   1 -
> configs/igep00x0_defconfig|   3 +-
> configs/imx6ulz_smm_m2_defconfig  |   2 +-
> configs/imx8mn_bsh_smm_s2_defconfig   |   2 +-
> configs/j7200_evm_a72_defconfig   |   2 +-
> configs/j7200_evm_r5_defconfig|   2 +-
> configs/j721e_evm_a72_defconfig   |   2 +-
> configs/j721e_evm_r5_defconfig|   2 +-
> configs/j721s2_evm_a72_defconfig  |   2 +-
> configs/j721s2_evm_r5_defconfig   |   2 +-
> configs/m53menlo_defconfig|   1 -
> configs/omap35_logic_defconfig|   3 +-
> configs/omap35_logic_somlv_defconfig  |   3 +-
> configs/omap3_beagle_defconfig|   3 +-
> configs/omap3_evm_defconfig   |   3 +-
> configs/omap3_logic_defconfig |   3 +-
> 

Re: [PATCH 03/15] nand: Calculate SYS_NAND_PAGE_COUNT automatically

2023-11-02 Thread Dario Binacchi
Sean, All

On Thu, Nov 2, 2023 at 3:17 PM Sean Anderson  wrote:
>
> On 11/2/23 05:53, Dario Binacchi wrote:
> > Sean, All
> >
> > On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:
> >>
> >> Contrary to what the help message says, this is the number of pages per
> >> block. Calculate it automatically based on SYS_NAND_BLOCK_SIZE and
> >> SYS_NAND_PAGE_SIZE.
> >>
> >> Signed-off-by: Sean Anderson 
> >> ---
> >>
> >>   README  | 9 -
> >>   configs/am335x_baltos_defconfig | 1 -
> >>   configs/am335x_evm_defconfig| 1 -
> >>   configs/am335x_guardian_defconfig   | 1 -
> >>   configs/am335x_igep003x_defconfig   | 1 -
> >>   configs/am3517_evm_defconfig| 1 -
> >>   configs/am43xx_evm_defconfig| 1 -
> >>   configs/am43xx_evm_rtconly_defconfig| 1 -
> >>   configs/am43xx_evm_usbhost_boot_defconfig   | 1 -
> >>   configs/am43xx_hs_evm_defconfig | 1 -
> >>   configs/axm_defconfig   | 1 -
> >>   configs/chiliboard_defconfig| 1 -
> >>   configs/corvus_defconfig| 1 -
> >>   configs/da850evm_nand_defconfig | 1 -
> >>   configs/devkit3250_defconfig| 1 -
> >>   configs/devkit8000_defconfig| 1 -
> >>   configs/dra7xx_evm_defconfig| 1 -
> >>   configs/draco_defconfig | 1 -
> >>   configs/etamin_defconfig| 1 -
> >>   configs/gardena-smart-gateway-at91sam_defconfig | 1 -
> >>   configs/igep00x0_defconfig  | 1 -
> >>   configs/m53menlo_defconfig  | 1 -
> >>   configs/omap35_logic_defconfig  | 1 -
> >>   configs/omap35_logic_somlv_defconfig| 1 -
> >>   configs/omap3_beagle_defconfig  | 1 -
> >>   configs/omap3_evm_defconfig | 1 -
> >>   configs/omap3_logic_defconfig   | 1 -
> >>   configs/omap3_logic_somlv_defconfig | 1 -
> >>   configs/omapl138_lcdk_defconfig | 1 -
> >>   configs/phycore-am335x-r2-regor_defconfig   | 1 -
> >>   configs/phycore-am335x-r2-wega_defconfig| 1 -
> >>   configs/pxm2_defconfig  | 1 -
> >>   configs/rastaban_defconfig  | 1 -
> >>   configs/rut_defconfig   | 1 -
> >>   configs/sama5d3_xplained_nandflash_defconfig| 1 -
> >>   configs/sama5d3xek_nandflash_defconfig  | 1 -
> >>   configs/sama5d4_xplained_nandflash_defconfig| 1 -
> >>   configs/sama5d4ek_nandflash_defconfig   | 1 -
> >>   configs/smartweb_defconfig  | 1 -
> >>   configs/taurus_defconfig| 1 -
> >>   configs/thuban_defconfig| 1 -
> >>   drivers/mtd/nand/raw/Kconfig| 8 
> >>   drivers/mtd/nand/raw/am335x_spl_bch.c   | 3 ++-
> >>   drivers/mtd/nand/raw/atmel_nand.c   | 5 +++--
> >>   drivers/mtd/nand/raw/mxc_nand_spl.c | 5 +++--
> >>   drivers/mtd/nand/raw/nand_spl_loaders.c | 2 +-
> >>   drivers/mtd/nand/raw/nand_spl_simple.c  | 5 +++--
> >>   drivers/mtd/nand/raw/omap_gpmc.c| 3 ++-
> >>   include/system-constants.h  | 3 +++
> >>   49 files changed, 21 insertions(+), 62 deletions(-)
> >>
> >> diff --git a/README b/README
> >> index 60c6b8a19db..00d422737fb 100644
> >> --- a/README
> >> +++ b/README
> >> @@ -1191,11 +1191,10 @@ The following options need to be configured:
> >>  Support for a lightweight UBI (fastmap) scanner and
> >>  loader
> >>
> >> -   CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_COUNT,
> >> -   CONFIG_SYS_NAND_PAGE_SIZE, CONFIG_SYS_NAND_OOBSIZE,
> >> -   CONFIG_SYS_NAND_BLOCK_SIZE, CONFIG_SYS_NAND_BAD_BLOCK_POS,
> >> -   CFG_SYS_NAND_ECCPOS, CFG_SYS_NAND_ECCSIZE,
> >> -   CFG_SYS_NAND_ECCBYTES
> >> +   CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_SIZE,
> >> +   CONFIG_SYS_NAND_OOBSIZE, CONFIG_SYS_NAND_BLOCK_SIZE,
> >> +   CONFIG_SYS_NAND_BAD_BLOCK_POS, CFG_SYS_NAND_ECCPOS,
> >> +   CFG_SYS_NAND_ECCSIZE, CFG_SYS_NAND_ECCBYTES
> >>  Defines the size and behavior of the NAND that SPL uses
> >>  to read U-Boot
> >>
> >> diff --git a/configs/am335x_baltos_defconfig 
> >> b/configs/am335x_baltos_defconfig
> >> index 16993ef5386..3891e48e9c7 100644
> >> --- a/configs/am335x_baltos_defconfig
> >> +++ b/configs/am335x_baltos_defconfig
> >> @@ -67,7 +67,6 @@ CONFIG_MTD=y
> >>   CONFIG_MTD_RAW_NAND=y
> >>   CONFIG_SYS_NAND_BLOCK_SIZE=0x2
> >>   CONFIG_SYS_NAND_ONFI_DETECTION=y
> >> -CONFIG_SYS_NAND_PAGE_COUNT=0x40
> >>   CONFIG_SYS_NAND_PAGE_SIZE=0x800
> >>   

Re: [PATCH 03/15] nand: Calculate SYS_NAND_PAGE_COUNT automatically

2023-11-02 Thread Sean Anderson

On 11/2/23 05:53, Dario Binacchi wrote:

Sean, All

On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:


Contrary to what the help message says, this is the number of pages per
block. Calculate it automatically based on SYS_NAND_BLOCK_SIZE and
SYS_NAND_PAGE_SIZE.

Signed-off-by: Sean Anderson 
---

  README  | 9 -
  configs/am335x_baltos_defconfig | 1 -
  configs/am335x_evm_defconfig| 1 -
  configs/am335x_guardian_defconfig   | 1 -
  configs/am335x_igep003x_defconfig   | 1 -
  configs/am3517_evm_defconfig| 1 -
  configs/am43xx_evm_defconfig| 1 -
  configs/am43xx_evm_rtconly_defconfig| 1 -
  configs/am43xx_evm_usbhost_boot_defconfig   | 1 -
  configs/am43xx_hs_evm_defconfig | 1 -
  configs/axm_defconfig   | 1 -
  configs/chiliboard_defconfig| 1 -
  configs/corvus_defconfig| 1 -
  configs/da850evm_nand_defconfig | 1 -
  configs/devkit3250_defconfig| 1 -
  configs/devkit8000_defconfig| 1 -
  configs/dra7xx_evm_defconfig| 1 -
  configs/draco_defconfig | 1 -
  configs/etamin_defconfig| 1 -
  configs/gardena-smart-gateway-at91sam_defconfig | 1 -
  configs/igep00x0_defconfig  | 1 -
  configs/m53menlo_defconfig  | 1 -
  configs/omap35_logic_defconfig  | 1 -
  configs/omap35_logic_somlv_defconfig| 1 -
  configs/omap3_beagle_defconfig  | 1 -
  configs/omap3_evm_defconfig | 1 -
  configs/omap3_logic_defconfig   | 1 -
  configs/omap3_logic_somlv_defconfig | 1 -
  configs/omapl138_lcdk_defconfig | 1 -
  configs/phycore-am335x-r2-regor_defconfig   | 1 -
  configs/phycore-am335x-r2-wega_defconfig| 1 -
  configs/pxm2_defconfig  | 1 -
  configs/rastaban_defconfig  | 1 -
  configs/rut_defconfig   | 1 -
  configs/sama5d3_xplained_nandflash_defconfig| 1 -
  configs/sama5d3xek_nandflash_defconfig  | 1 -
  configs/sama5d4_xplained_nandflash_defconfig| 1 -
  configs/sama5d4ek_nandflash_defconfig   | 1 -
  configs/smartweb_defconfig  | 1 -
  configs/taurus_defconfig| 1 -
  configs/thuban_defconfig| 1 -
  drivers/mtd/nand/raw/Kconfig| 8 
  drivers/mtd/nand/raw/am335x_spl_bch.c   | 3 ++-
  drivers/mtd/nand/raw/atmel_nand.c   | 5 +++--
  drivers/mtd/nand/raw/mxc_nand_spl.c | 5 +++--
  drivers/mtd/nand/raw/nand_spl_loaders.c | 2 +-
  drivers/mtd/nand/raw/nand_spl_simple.c  | 5 +++--
  drivers/mtd/nand/raw/omap_gpmc.c| 3 ++-
  include/system-constants.h  | 3 +++
  49 files changed, 21 insertions(+), 62 deletions(-)

diff --git a/README b/README
index 60c6b8a19db..00d422737fb 100644
--- a/README
+++ b/README
@@ -1191,11 +1191,10 @@ The following options need to be configured:
 Support for a lightweight UBI (fastmap) scanner and
 loader

-   CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_COUNT,
-   CONFIG_SYS_NAND_PAGE_SIZE, CONFIG_SYS_NAND_OOBSIZE,
-   CONFIG_SYS_NAND_BLOCK_SIZE, CONFIG_SYS_NAND_BAD_BLOCK_POS,
-   CFG_SYS_NAND_ECCPOS, CFG_SYS_NAND_ECCSIZE,
-   CFG_SYS_NAND_ECCBYTES
+   CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_SIZE,
+   CONFIG_SYS_NAND_OOBSIZE, CONFIG_SYS_NAND_BLOCK_SIZE,
+   CONFIG_SYS_NAND_BAD_BLOCK_POS, CFG_SYS_NAND_ECCPOS,
+   CFG_SYS_NAND_ECCSIZE, CFG_SYS_NAND_ECCBYTES
 Defines the size and behavior of the NAND that SPL uses
 to read U-Boot

diff --git a/configs/am335x_baltos_defconfig b/configs/am335x_baltos_defconfig
index 16993ef5386..3891e48e9c7 100644
--- a/configs/am335x_baltos_defconfig
+++ b/configs/am335x_baltos_defconfig
@@ -67,7 +67,6 @@ CONFIG_MTD=y
  CONFIG_MTD_RAW_NAND=y
  CONFIG_SYS_NAND_BLOCK_SIZE=0x2
  CONFIG_SYS_NAND_ONFI_DETECTION=y
-CONFIG_SYS_NAND_PAGE_COUNT=0x40
  CONFIG_SYS_NAND_PAGE_SIZE=0x800
  CONFIG_SYS_NAND_OOBSIZE=0x40
  CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index f048e60f7f3..73f221d55bc 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -84,7 +84,6 @@ CONFIG_MTD=y
  CONFIG_MTD_RAW_NAND=y
  CONFIG_SYS_NAND_BLOCK_SIZE=0x2
  CONFIG_SYS_NAND_ONFI_DETECTION=y
-CONFIG_SYS_NAND_PAGE_COUNT=0x40
  CONFIG_SYS_NAND_PAGE_SIZE=0x800
  CONFIG_SYS_NAND_OOBSIZE=0x40
  CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git 

Re: [PATCH v2] i2c: designware_i2c: adjust timing calculation

2023-11-02 Thread Heiko Schocher
Hello Heinrich,

On 13.10.23 15:09, Heinrich Schuchardt wrote:
> In SPL probing of the designware_i2c device on the StarFive VisionFive 2
> board fails with
> 
> dw_i2c: mode 0, ic_clk 100, speed 10,
> period 10 rise 1 fall 1 tlow 5 thigh 4 spk 0
> dw_i2c: bad counts. hcnt = -4 lcnt = 4
> device_probe: i2c@1205 failed to probe -22
> 
> When changing the offset for the high phase from 7 to 3 the device is
> probed correctly. This now matches the value from the Linux driver.
> 
> Without this fix the memory size of the StarFive VisionFive 2 board cannot
> be read from EEPROM.
> 
> Fixes: e71b6f6622d6 ("i2c: designware_i2c: Rewrite timing calculation")
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
> v2:
>   use the same timing offset at Linux
>   provide a descriptive comment for the constant
> ---
>  drivers/i2c/designware_i2c.c | 19 +++
>  1 file changed, 15 insertions(+), 4 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH 00/15] nand: Add sandbox tests

2023-11-02 Thread Dario Binacchi
On Thu, Nov 2, 2023 at 3:06 PM Sean Anderson  wrote:
>
> On 11/2/23 10:01, Dario Binacchi wrote:
> > Sean, All,
> >
> > On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:
> >>
> >> This series tests raw nand flash in sandbox and fixes various bugs 
> >> discovered in
> >> the process. I've tried to do things in a contemporary manner, avoiding the
> >> (numerous) variations present on only a few boards. The test is pretty 
> >> minimal.
> >> Future work could test the rest of the nand API as well as the MTD API.
> >>
> >> Bloat at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost
> >> everything grows by a few bytes due to nand_page_size. A few boards grow 
> >> more,
> >> mostly those using nand_spl_loaders.c.
> >>
> >> [1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2
> >>
> >>
> >> Sean Anderson (15):
> >>spl: nand: Fix NULL-pointer dereference
> >>nand: Don't dereference NULL manufacturer_desc
> >>nand: Calculate SYS_NAND_PAGE_COUNT automatically
> >>nand: spl_loaders: Only read enough pages to load the image
> >>spl: legacy: Honor bl_len when decompressing
> >>spl: nand: Set bl_len to page size
> >>cmd: nand: Map memory before accessing it
> >>spl: nand: Map memory before accessing it
> >>mtd: Rename SPL_MTD_SUPPORT to SPL_MTD
> >>mtd: Add some fallbacks for add/del_mtd_device
> >>nand: Add function to unregister NAND devices
> >>nand: Allow reinitialization
> >>arch: sandbox: Add function to create temporary files
> >>nand: Add sandbox driver
> >>test: spl: Add a test for NAND
> >>
> >>   README|   9 +-
> >>   arch/sandbox/cpu/os.c |  17 +
> >>   arch/sandbox/dts/test.dts |  67 ++
> >>   arch/sandbox/include/asm/spl.h|   1 +
> >>   cmd/nand.c|  26 +-
> >>   common/spl/Kconfig|   2 +-
> >>   common/spl/spl_legacy.c   |  18 +-
> >>   common/spl/spl_nand.c |  22 +-
> >>   configs/am335x_baltos_defconfig   |   3 +-
> >>   configs/am335x_evm_defconfig  |   3 +-
> >>   configs/am335x_evm_spiboot_defconfig  |   2 +-
> >>   configs/am335x_guardian_defconfig |   1 -
> >>   configs/am335x_hs_evm_defconfig   |   2 +-
> >>   configs/am335x_hs_evm_uart_defconfig  |   2 +-
> >>   configs/am335x_igep003x_defconfig |   3 +-
> >>   configs/am335x_sl50_defconfig |   2 +-
> >>   configs/am3517_evm_defconfig  |   3 +-
> >>   configs/am43xx_evm_defconfig  |   3 +-
> >>   configs/am43xx_evm_rtconly_defconfig  |   3 +-
> >>   configs/am43xx_evm_usbhost_boot_defconfig |   3 +-
> >>   configs/am43xx_hs_evm_defconfig   |   3 +-
> >>   configs/am62ax_evm_r5_defconfig   |   2 +-
> >>   configs/am65x_evm_a53_defconfig   |   2 +-
> >>   configs/axm_defconfig |   1 -
> >>   configs/chiliboard_defconfig  |   1 -
> >>   configs/cm_t43_defconfig  |   2 +-
> >>   configs/corvus_defconfig  |   1 -
> >>   configs/da850evm_nand_defconfig   |   1 -
> >>   configs/devkit3250_defconfig  |   1 -
> >>   configs/devkit8000_defconfig  |   1 -
> >>   configs/dra7xx_evm_defconfig  |   1 -
> >>   configs/draco_defconfig   |   1 -
> >>   configs/etamin_defconfig  |   1 -
> >>   .../gardena-smart-gateway-at91sam_defconfig   |   1 -
> >>   configs/igep00x0_defconfig|   3 +-
> >>   configs/imx6ulz_smm_m2_defconfig  |   2 +-
> >>   configs/imx8mn_bsh_smm_s2_defconfig   |   2 +-
> >>   configs/j7200_evm_a72_defconfig   |   2 +-
> >>   configs/j7200_evm_r5_defconfig|   2 +-
> >>   configs/j721e_evm_a72_defconfig   |   2 +-
> >>   configs/j721e_evm_r5_defconfig|   2 +-
> >>   configs/j721s2_evm_a72_defconfig  |   2 +-
> >>   configs/j721s2_evm_r5_defconfig   |   2 +-
> >>   configs/m53menlo_defconfig|   1 -
> >>   configs/omap35_logic_defconfig|   3 +-
> >>   configs/omap35_logic_somlv_defconfig  |   3 +-
> >>   configs/omap3_beagle_defconfig|   3 +-
> >>   configs/omap3_evm_defconfig   |   3 +-
> >>   configs/omap3_logic_defconfig |   3 +-
> >>   configs/omap3_logic_somlv_defconfig   |   3 +-
> >>   configs/omapl138_lcdk_defconfig   |   1 -
> >>   configs/phycore-am335x-r2-regor_defconfig |   3 +-
> >>   configs/phycore-am335x-r2-wega_defconfig  |   3 +-
> >>   configs/pxm2_defconfig|   1 -
> >>   configs/rastaban_defconfig|   1 -
> >> 

Re: [PATCH v3 1/3] bootcount: Remove legacy I2C driver

2023-11-02 Thread Heiko Schocher
Hello Philip,

On 31.10.23 08:38, Philip Richard Oberfichtner wrote:
> The legacy I2C bootcounter will hereby be removed and eventually
> be replaced by a driver model implementation in the follow-up commit.
> 
> The legacy driver has the following drawbacks:
>   - It's not adhering to the driver model
>   - Settings are grabbed from Kconfig rather than device tree
>   - i2c_{read,write} are being used instead of dm_i2c_{read,write}
> 
> Signed-off-by: Philip Richard Oberfichtner 
> ---
> 
> Notes:
> Changes in v3: none
> Changes in v2: none
> 
>  drivers/bootcount/Kconfig | 24 +++--
>  drivers/bootcount/Makefile|  1 -
>  drivers/bootcount/bootcount_i2c.c | 43 ---
>  3 files changed, 3 insertions(+), 65 deletions(-)
>  delete mode 100644 drivers/bootcount/bootcount_i2c.c

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH 00/15] nand: Add sandbox tests

2023-11-02 Thread Sean Anderson

On 11/2/23 10:08, Dario Binacchi wrote:

On Thu, Nov 2, 2023 at 3:06 PM Sean Anderson  wrote:


On 11/2/23 10:01, Dario Binacchi wrote:

Sean, All,

On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:


This series tests raw nand flash in sandbox and fixes various bugs discovered in
the process. I've tried to do things in a contemporary manner, avoiding the
(numerous) variations present on only a few boards. The test is pretty minimal.
Future work could test the rest of the nand API as well as the MTD API.

Bloat at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost
everything grows by a few bytes due to nand_page_size. A few boards grow more,
mostly those using nand_spl_loaders.c.

[1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2


Sean Anderson (15):
spl: nand: Fix NULL-pointer dereference
nand: Don't dereference NULL manufacturer_desc
nand: Calculate SYS_NAND_PAGE_COUNT automatically
nand: spl_loaders: Only read enough pages to load the image
spl: legacy: Honor bl_len when decompressing
spl: nand: Set bl_len to page size
cmd: nand: Map memory before accessing it
spl: nand: Map memory before accessing it
mtd: Rename SPL_MTD_SUPPORT to SPL_MTD
mtd: Add some fallbacks for add/del_mtd_device
nand: Add function to unregister NAND devices
nand: Allow reinitialization
arch: sandbox: Add function to create temporary files
nand: Add sandbox driver
test: spl: Add a test for NAND

   README|   9 +-
   arch/sandbox/cpu/os.c |  17 +
   arch/sandbox/dts/test.dts |  67 ++
   arch/sandbox/include/asm/spl.h|   1 +
   cmd/nand.c|  26 +-
   common/spl/Kconfig|   2 +-
   common/spl/spl_legacy.c   |  18 +-
   common/spl/spl_nand.c |  22 +-
   configs/am335x_baltos_defconfig   |   3 +-
   configs/am335x_evm_defconfig  |   3 +-
   configs/am335x_evm_spiboot_defconfig  |   2 +-
   configs/am335x_guardian_defconfig |   1 -
   configs/am335x_hs_evm_defconfig   |   2 +-
   configs/am335x_hs_evm_uart_defconfig  |   2 +-
   configs/am335x_igep003x_defconfig |   3 +-
   configs/am335x_sl50_defconfig |   2 +-
   configs/am3517_evm_defconfig  |   3 +-
   configs/am43xx_evm_defconfig  |   3 +-
   configs/am43xx_evm_rtconly_defconfig  |   3 +-
   configs/am43xx_evm_usbhost_boot_defconfig |   3 +-
   configs/am43xx_hs_evm_defconfig   |   3 +-
   configs/am62ax_evm_r5_defconfig   |   2 +-
   configs/am65x_evm_a53_defconfig   |   2 +-
   configs/axm_defconfig |   1 -
   configs/chiliboard_defconfig  |   1 -
   configs/cm_t43_defconfig  |   2 +-
   configs/corvus_defconfig  |   1 -
   configs/da850evm_nand_defconfig   |   1 -
   configs/devkit3250_defconfig  |   1 -
   configs/devkit8000_defconfig  |   1 -
   configs/dra7xx_evm_defconfig  |   1 -
   configs/draco_defconfig   |   1 -
   configs/etamin_defconfig  |   1 -
   .../gardena-smart-gateway-at91sam_defconfig   |   1 -
   configs/igep00x0_defconfig|   3 +-
   configs/imx6ulz_smm_m2_defconfig  |   2 +-
   configs/imx8mn_bsh_smm_s2_defconfig   |   2 +-
   configs/j7200_evm_a72_defconfig   |   2 +-
   configs/j7200_evm_r5_defconfig|   2 +-
   configs/j721e_evm_a72_defconfig   |   2 +-
   configs/j721e_evm_r5_defconfig|   2 +-
   configs/j721s2_evm_a72_defconfig  |   2 +-
   configs/j721s2_evm_r5_defconfig   |   2 +-
   configs/m53menlo_defconfig|   1 -
   configs/omap35_logic_defconfig|   3 +-
   configs/omap35_logic_somlv_defconfig  |   3 +-
   configs/omap3_beagle_defconfig|   3 +-
   configs/omap3_evm_defconfig   |   3 +-
   configs/omap3_logic_defconfig |   3 +-
   configs/omap3_logic_somlv_defconfig   |   3 +-
   configs/omapl138_lcdk_defconfig   |   1 -
   configs/phycore-am335x-r2-regor_defconfig |   3 +-
   configs/phycore-am335x-r2-wega_defconfig  |   3 +-
   configs/pxm2_defconfig|   1 -
   configs/rastaban_defconfig|   1 -
   configs/rut_defconfig |   1 -
   configs/sama5d3_xplained_nandflash_defconfig  |   1 -
   configs/sama5d3xek_nandflash_defconfig|   1 -
   configs/sama5d4_xplained_nandflash_defconfig  |   1 -
   configs/sama5d4ek_nandflash_defconfig |   1 -
   configs/sandbox64_defconfig   |  10 

Please pull u-boot-i2c

2023-11-02 Thread Heiko Schocher
Hello Tom,

please pull from u-boot-i2c:

The following changes since commit d9650a48234058c645d1a07951c3d2cf129427e6:

  Merge branch '2023-10-28-assorted-platform-updates' (2023-10-28 09:23:27 
-0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-i2c.git 
tags/i2cfixes-for-v2024-01-rc2

for you to fetch changes up to 5b6ee512ceb8d990e010646c4fe7b8a3633fad68:

  bootcount: Add driver model I2C driver (2023-10-31 09:09:04 +0100)


i2c updates for v2024.01-rc2

- nuvoton: support standard/fast/fast plus mode
- bootcount: remove legacy i2c driver and implement
  DM based version

Bugfixes:
- designware_i2c: adjust timing calculation
  SPL probing failed on the StarFive VisionFive 2 board
  Heinrich fixed this, by syncing timing calculation with
  linux implementation.


Heinrich Schuchardt (1):
  i2c: designware_i2c: adjust timing calculation

Jim Liu (1):
  i2c: nuvoton: remove standard mode only

Philip Richard Oberfichtner (3):
  bootcount: Remove legacy I2C driver
  i2c: Implement i2c_get_chip_by_phandle()
  bootcount: Add driver model I2C driver

 drivers/bootcount/Kconfig|  34 +-
 drivers/bootcount/Makefile   |   2 +-
 drivers/bootcount/bootcount_dm_i2c.c | 102
++
 drivers/bootcount/bootcount_i2c.c|  43 
---
 drivers/i2c/designware_i2c.c |  19 +++
 drivers/i2c/i2c-uclass.c |  75
+++
 drivers/i2c/npcm_i2c.c   |   5 -
 include/i2c.h|  12 
 8 files changed, 218 insertions(+), 74 deletions(-)
 create mode 100644 drivers/bootcount/bootcount_dm_i2c.c
 delete mode 100644 drivers/bootcount/bootcount_i2c.c

azure build is fine:

https://dev.azure.com/hs0298/hs/_build/results?buildId=109=results

Thanks!

bye,
Heiko

-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH v3 2/3] i2c: Implement i2c_get_chip_by_phandle()

2023-11-02 Thread Heiko Schocher
Hello Philip,

On 31.10.23 08:38, Philip Richard Oberfichtner wrote:
> This new function enhances the i2c_get_chip*() toolbox by implementing a
> variant that does not require a chip_addr. Instead, the desired device
> is pointed to by a phandle.
> 
> Signed-off-by: Philip Richard Oberfichtner 
> ---
> 
> Notes:
> Changes in v3: none
> Changes in v2: new
> 
>  drivers/i2c/i2c-uclass.c | 75 
>  include/i2c.h| 12 +++
>  2 files changed, 87 insertions(+)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH v3 3/3] bootcount: Add driver model I2C driver

2023-11-02 Thread Heiko Schocher
Hello Philip,

On 31.10.23 08:38, Philip Richard Oberfichtner wrote:
> This adds a generic I2C bootcounter adhering to driver model to replace
> the previously removed legacy implementation.
> 
> There is no change in functionality, it can be used on any I2C device.
> The device tree configuration may look like this for example:
> 
>   bootcount {
>   compatible = "u-boot,bootcount-i2c";
>   i2cbcdev = <_rtc>;
>   offset = <0x11>;
>   };
> 
> Signed-off-by: Philip Richard Oberfichtner 
> ---
> 
> Notes:
> Changes in v3:
>   - Remove common.h #include
> 
> Changes in v2:
>   - Adaption of Kconfig help message
>   - Rename chip to bcdev
>   - Adapt probe to use i2c_get_chip_by_phandle()
> 
>  drivers/bootcount/Kconfig|  10 +++
>  drivers/bootcount/Makefile   |   1 +
>  drivers/bootcount/bootcount_dm_i2c.c | 102 +++
>  3 files changed, 113 insertions(+)
>  create mode 100644 drivers/bootcount/bootcount_dm_i2c.c

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH 00/15] nand: Add sandbox tests

2023-11-02 Thread Sean Anderson

On 11/2/23 10:01, Dario Binacchi wrote:

Sean, All,

On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:


This series tests raw nand flash in sandbox and fixes various bugs discovered in
the process. I've tried to do things in a contemporary manner, avoiding the
(numerous) variations present on only a few boards. The test is pretty minimal.
Future work could test the rest of the nand API as well as the MTD API.

Bloat at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost
everything grows by a few bytes due to nand_page_size. A few boards grow more,
mostly those using nand_spl_loaders.c.

[1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2


Sean Anderson (15):
   spl: nand: Fix NULL-pointer dereference
   nand: Don't dereference NULL manufacturer_desc
   nand: Calculate SYS_NAND_PAGE_COUNT automatically
   nand: spl_loaders: Only read enough pages to load the image
   spl: legacy: Honor bl_len when decompressing
   spl: nand: Set bl_len to page size
   cmd: nand: Map memory before accessing it
   spl: nand: Map memory before accessing it
   mtd: Rename SPL_MTD_SUPPORT to SPL_MTD
   mtd: Add some fallbacks for add/del_mtd_device
   nand: Add function to unregister NAND devices
   nand: Allow reinitialization
   arch: sandbox: Add function to create temporary files
   nand: Add sandbox driver
   test: spl: Add a test for NAND

  README|   9 +-
  arch/sandbox/cpu/os.c |  17 +
  arch/sandbox/dts/test.dts |  67 ++
  arch/sandbox/include/asm/spl.h|   1 +
  cmd/nand.c|  26 +-
  common/spl/Kconfig|   2 +-
  common/spl/spl_legacy.c   |  18 +-
  common/spl/spl_nand.c |  22 +-
  configs/am335x_baltos_defconfig   |   3 +-
  configs/am335x_evm_defconfig  |   3 +-
  configs/am335x_evm_spiboot_defconfig  |   2 +-
  configs/am335x_guardian_defconfig |   1 -
  configs/am335x_hs_evm_defconfig   |   2 +-
  configs/am335x_hs_evm_uart_defconfig  |   2 +-
  configs/am335x_igep003x_defconfig |   3 +-
  configs/am335x_sl50_defconfig |   2 +-
  configs/am3517_evm_defconfig  |   3 +-
  configs/am43xx_evm_defconfig  |   3 +-
  configs/am43xx_evm_rtconly_defconfig  |   3 +-
  configs/am43xx_evm_usbhost_boot_defconfig |   3 +-
  configs/am43xx_hs_evm_defconfig   |   3 +-
  configs/am62ax_evm_r5_defconfig   |   2 +-
  configs/am65x_evm_a53_defconfig   |   2 +-
  configs/axm_defconfig |   1 -
  configs/chiliboard_defconfig  |   1 -
  configs/cm_t43_defconfig  |   2 +-
  configs/corvus_defconfig  |   1 -
  configs/da850evm_nand_defconfig   |   1 -
  configs/devkit3250_defconfig  |   1 -
  configs/devkit8000_defconfig  |   1 -
  configs/dra7xx_evm_defconfig  |   1 -
  configs/draco_defconfig   |   1 -
  configs/etamin_defconfig  |   1 -
  .../gardena-smart-gateway-at91sam_defconfig   |   1 -
  configs/igep00x0_defconfig|   3 +-
  configs/imx6ulz_smm_m2_defconfig  |   2 +-
  configs/imx8mn_bsh_smm_s2_defconfig   |   2 +-
  configs/j7200_evm_a72_defconfig   |   2 +-
  configs/j7200_evm_r5_defconfig|   2 +-
  configs/j721e_evm_a72_defconfig   |   2 +-
  configs/j721e_evm_r5_defconfig|   2 +-
  configs/j721s2_evm_a72_defconfig  |   2 +-
  configs/j721s2_evm_r5_defconfig   |   2 +-
  configs/m53menlo_defconfig|   1 -
  configs/omap35_logic_defconfig|   3 +-
  configs/omap35_logic_somlv_defconfig  |   3 +-
  configs/omap3_beagle_defconfig|   3 +-
  configs/omap3_evm_defconfig   |   3 +-
  configs/omap3_logic_defconfig |   3 +-
  configs/omap3_logic_somlv_defconfig   |   3 +-
  configs/omapl138_lcdk_defconfig   |   1 -
  configs/phycore-am335x-r2-regor_defconfig |   3 +-
  configs/phycore-am335x-r2-wega_defconfig  |   3 +-
  configs/pxm2_defconfig|   1 -
  configs/rastaban_defconfig|   1 -
  configs/rut_defconfig |   1 -
  configs/sama5d3_xplained_nandflash_defconfig  |   1 -
  configs/sama5d3xek_nandflash_defconfig|   1 -
  configs/sama5d4_xplained_nandflash_defconfig  |   1 -
  configs/sama5d4ek_nandflash_defconfig |   1 -
  configs/sandbox64_defconfig   |  10 +-
  configs/sandbox_defconfig |   9 +
  configs/sandbox_noinst_defconfig  |  21 +-
  configs/smartweb_defconfig|   1 -
 

Re: [PATCH v2] i2c: nuvoton: remove standard mode only

2023-11-02 Thread Heiko Schocher
Hello Jim Liu,

On 04.10.23 03:35, Jim Liu wrote:
> first version is only support standard mode.
> remove this judgment to support standard/fast/fast plus  mode.
> 
> Signed-off-by: Jim Liu 
> 
> Changes for v2:
>- add commit message
> ---
>  drivers/i2c/npcm_i2c.c | 5 -
>  1 file changed, 5 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH 00/15] nand: Add sandbox tests

2023-11-02 Thread Dario Binacchi
Sean, All,

On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson  wrote:
>
> This series tests raw nand flash in sandbox and fixes various bugs discovered 
> in
> the process. I've tried to do things in a contemporary manner, avoiding the
> (numerous) variations present on only a few boards. The test is pretty 
> minimal.
> Future work could test the rest of the nand API as well as the MTD API.
>
> Bloat at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost
> everything grows by a few bytes due to nand_page_size. A few boards grow more,
> mostly those using nand_spl_loaders.c.
>
> [1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2
>
>
> Sean Anderson (15):
>   spl: nand: Fix NULL-pointer dereference
>   nand: Don't dereference NULL manufacturer_desc
>   nand: Calculate SYS_NAND_PAGE_COUNT automatically
>   nand: spl_loaders: Only read enough pages to load the image
>   spl: legacy: Honor bl_len when decompressing
>   spl: nand: Set bl_len to page size
>   cmd: nand: Map memory before accessing it
>   spl: nand: Map memory before accessing it
>   mtd: Rename SPL_MTD_SUPPORT to SPL_MTD
>   mtd: Add some fallbacks for add/del_mtd_device
>   nand: Add function to unregister NAND devices
>   nand: Allow reinitialization
>   arch: sandbox: Add function to create temporary files
>   nand: Add sandbox driver
>   test: spl: Add a test for NAND
>
>  README|   9 +-
>  arch/sandbox/cpu/os.c |  17 +
>  arch/sandbox/dts/test.dts |  67 ++
>  arch/sandbox/include/asm/spl.h|   1 +
>  cmd/nand.c|  26 +-
>  common/spl/Kconfig|   2 +-
>  common/spl/spl_legacy.c   |  18 +-
>  common/spl/spl_nand.c |  22 +-
>  configs/am335x_baltos_defconfig   |   3 +-
>  configs/am335x_evm_defconfig  |   3 +-
>  configs/am335x_evm_spiboot_defconfig  |   2 +-
>  configs/am335x_guardian_defconfig |   1 -
>  configs/am335x_hs_evm_defconfig   |   2 +-
>  configs/am335x_hs_evm_uart_defconfig  |   2 +-
>  configs/am335x_igep003x_defconfig |   3 +-
>  configs/am335x_sl50_defconfig |   2 +-
>  configs/am3517_evm_defconfig  |   3 +-
>  configs/am43xx_evm_defconfig  |   3 +-
>  configs/am43xx_evm_rtconly_defconfig  |   3 +-
>  configs/am43xx_evm_usbhost_boot_defconfig |   3 +-
>  configs/am43xx_hs_evm_defconfig   |   3 +-
>  configs/am62ax_evm_r5_defconfig   |   2 +-
>  configs/am65x_evm_a53_defconfig   |   2 +-
>  configs/axm_defconfig |   1 -
>  configs/chiliboard_defconfig  |   1 -
>  configs/cm_t43_defconfig  |   2 +-
>  configs/corvus_defconfig  |   1 -
>  configs/da850evm_nand_defconfig   |   1 -
>  configs/devkit3250_defconfig  |   1 -
>  configs/devkit8000_defconfig  |   1 -
>  configs/dra7xx_evm_defconfig  |   1 -
>  configs/draco_defconfig   |   1 -
>  configs/etamin_defconfig  |   1 -
>  .../gardena-smart-gateway-at91sam_defconfig   |   1 -
>  configs/igep00x0_defconfig|   3 +-
>  configs/imx6ulz_smm_m2_defconfig  |   2 +-
>  configs/imx8mn_bsh_smm_s2_defconfig   |   2 +-
>  configs/j7200_evm_a72_defconfig   |   2 +-
>  configs/j7200_evm_r5_defconfig|   2 +-
>  configs/j721e_evm_a72_defconfig   |   2 +-
>  configs/j721e_evm_r5_defconfig|   2 +-
>  configs/j721s2_evm_a72_defconfig  |   2 +-
>  configs/j721s2_evm_r5_defconfig   |   2 +-
>  configs/m53menlo_defconfig|   1 -
>  configs/omap35_logic_defconfig|   3 +-
>  configs/omap35_logic_somlv_defconfig  |   3 +-
>  configs/omap3_beagle_defconfig|   3 +-
>  configs/omap3_evm_defconfig   |   3 +-
>  configs/omap3_logic_defconfig |   3 +-
>  configs/omap3_logic_somlv_defconfig   |   3 +-
>  configs/omapl138_lcdk_defconfig   |   1 -
>  configs/phycore-am335x-r2-regor_defconfig |   3 +-
>  configs/phycore-am335x-r2-wega_defconfig  |   3 +-
>  configs/pxm2_defconfig|   1 -
>  configs/rastaban_defconfig|   1 -
>  configs/rut_defconfig |   1 -
>  configs/sama5d3_xplained_nandflash_defconfig  |   1 -
>  configs/sama5d3xek_nandflash_defconfig|   1 -
>  configs/sama5d4_xplained_nandflash_defconfig  |   1 -
>  configs/sama5d4ek_nandflash_defconfig |   1 -
>  configs/sandbox64_defconfig   |  10 +-
>  configs/sandbox_defconfig |   9 +
>  configs/sandbox_noinst_defconfig  

TF-A Hang on NXP i.MX 8M Plus QuadLite

2023-11-02 Thread Marcel Ziswiler
Hi there

We recently got our first batch of i.MX 8M Plus QuadLite based SoMs. While NXP 
downstream works just fine on
them they just hang booting with latest upstream U-Boot (and TF-A). Replacing 
TF-A with the downstream NXP one
made upstream U-Boot work as well. Further debugging TF-A showed 
imx_gpc_pm_domain_enable() to be the culprit.
Looking more specifically I discovered the following so far downstream-only 
commit [1]. So it looks like in
downstream NXP is limiting the to-be-enabled power management domains to 
HSIOMIX, USB1_PHY and USB2_PHY.
Anybody knows why exactly this is done and why this got never upstreamed?

Thank you very much for any insights into this matter.

[1] 
https://github.com/nxp-imx/imx-atf/commit/47759cfca10b2286a218062915d4a280848cfc15

Cheers

Marcel


Re: [PATCH 14/15] nand: Add sandbox driver

2023-11-02 Thread Sean Anderson

On 11/2/23 07:15, Dario Binacchi wrote:

Sean, All

On Sun, Oct 29, 2023 at 4:49 AM Sean Anderson  wrote:


Add a sandbox NAND flash driver to facilitate testing. This driver supports
any number of devices, each using a single chip-select. The OOB data is
stored in-band, with the separation enforced through the API.

For now, create two devices to test with. The first is a very small device
with basic ECC. The second is an 8G device (chosen to be larger than 32
bits). It uses ONFI, with the values copied from the datasheet. It also
doesn't need too strong ECC, which speeds things up.

Although the nand subsystem determines the parameters of a chip based on
the ID, the driver itself requires devicetree properties for each
parameter. We do not derive parameters from the ID because parsing the ID
is non-trivial. We do not just use the parameters that the nand subsystem
has calculated since that is something we should be testing.

Despite using file I/O to access the backing data, we do not support using
external files. In my experience, these are unnecessary for testing since
tests can generally be written to write their expected data beforehand.
Additionally, we would need to store the "programmed" information somewhere
(complicating the format and the programming process) or try to detect
whether block are erased at runtime (degrading probe speeds).

Information about whether each page has been programmed is stored in an
in-memory buffer. To simplify the implementation, we only support a single
program per erase. While this is accurate for many larger flashes, some
smaller flashes (512 byte) support multiple programs and/or subpage
programs. Support for this could be added later as I believe some
filesystems expect this.

To test ECC, we support error-injection. Surprisingly, only ECC bytes in
the OOB area are protected, even though all bytes are equally susceptible
to error. Because of this, we take care to only corrupt ECC bytes.
Similarly, because ECC covers "steps" and not the whole page, we must take
care to corrupt data in the same way.

Signed-off-by: Sean Anderson 
---

  arch/sandbox/dts/test.dts|  67 +++
  configs/sandbox64_defconfig  |  10 +-
  configs/sandbox_defconfig|   9 +
  configs/sandbox_noinst_defconfig |  10 +-
  drivers/mtd/nand/raw/Kconfig |  14 +
  drivers/mtd/nand/raw/Makefile|   1 +
  drivers/mtd/nand/raw/sand_nand.c | 682 +++
  test/dm/Makefile |   1 +
  test/dm/nand.c   | 106 +
  9 files changed, 898 insertions(+), 2 deletions(-)
  create mode 100644 drivers/mtd/nand/raw/sand_nand.c
  create mode 100644 test/dm/nand.c

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 5b54651a1da..5fba2943fad 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1900,6 +1900,73 @@
 compatible = "sandbox,arm-ffa";
 };
 };
+
+   nand-controller {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "sandbox,nand";
+
+   nand@0 {
+   reg = <0>;
+   nand-ecc-mode = "soft";
+   sandbox,id = [00 e3];
+   sandbox,erasesize = <(8 * 1024)>;
+   sandbox,oobsize = <16>;
+   sandbox,pagesize = <512>;
+   sandbox,pages = <0x2000>;
+   sandbox,err-count = <1>;
+   sandbox,err-step-size = <512>;
+   sandbox,ecc-bytes = <6>;
+   };
+
+   /* MT29F64G08AKABA */
+   nand@1 {
+   reg = <1>;
+   nand-ecc-mode = "soft_bch";
+   sandbox,id = [2C 48 00 26 89 00 00 00];
+   sandbox,onfi = [
+   4f 4e 46 49 0e 00 5a 00
+   ff 01 00 00 00 00 03 00
+   00 00 00 00 00 00 00 00
+   00 00 00 00 00 00 00 00
+   4d 49 43 52 4f 4e 20 20
+   20 20 20 20 4d 54 32 39
+   46 36 34 47 30 38 41 4b
+   41 42 41 43 35 20 20 20
+   2c 00 00 00 00 00 00 00
+   00 00 00 00 00 00 00 00
+   00 10 00 00 e0 00 00 02
+   00 00 1c 00 80 00 00 00
+   00 10 00 00 02 23 01 50
+   00 01 05 01 00 00 04 00
+   04 01 1e 00 00 00 00 00
+   00 00 00 00 00 00 00 00
+   0e 1f 00 1f 00 f4 01 ac
+   0d 19 00 c8 00 00 00 00
+   00 00 00 00 00 00 0a 07
+

[PATCH] ARM: configs: libretech-ac: enable USB_DFU like in meson64.h

2023-11-02 Thread Neil Armstrong
USB_DFU was added in meson64.h but is missing in libretech-ac.h,
fix this to enable DFU RAM boot for libretech-ac.

Fixes 4aa027b3f8 ("configs: meson64: add alternate USB DFU boot target")

Signed-off-by: Neil Armstrong 
---
 include/configs/libretech-ac.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/libretech-ac.h b/include/configs/libretech-ac.h
index bf20d31543..16239f2520 100644
--- a/include/configs/libretech-ac.h
+++ b/include/configs/libretech-ac.h
@@ -11,6 +11,7 @@
 
 #define BOOT_TARGET_DEVICES(func) \
func(ROMUSB, romusb, na)  \
+   func(USB_DFU, usbdfu, na)  \
func(MMC, mmc, 0) \
BOOT_TARGET_DEVICES_USB(func) \
func(PXE, pxe, na) \

---
base-commit: a803f87202aa48974bdff4d8100464a8288931e4
change-id: 20231102-libretech-ac-fix-dfu-dbd8109d552d

Best regards,
-- 
Neil Armstrong 



Re: [PATCH v1 2/2] drivers: sm: bind child sm devices in the device tree

2023-11-02 Thread neil . armstrong

On 01/11/2023 15:04, Alexey Romanov wrote:

From: Dmitry Rokosov 

One well-known sm child device that provides secure power control is the
Secure Power Controller. This device utilizes SMC calls to communicate
with power domains on the secure monitor side.

Signed-off-by: Dmitry Rokosov 
Signed-off-by: Alexey Romanov 
---
  drivers/sm/meson-sm.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/sm/meson-sm.c b/drivers/sm/meson-sm.c
index faef369f35..1dd1584855 100644
--- a/drivers/sm/meson-sm.c
+++ b/drivers/sm/meson-sm.c
@@ -194,6 +194,7 @@ U_BOOT_DRIVER(meson_sm) = {
.id = UCLASS_SM,
.of_match = meson_sm_ids,
.probe = meson_sm_probe,
+   .bind = dm_scan_fdt_dev,
.priv_auto = sizeof(struct meson_sm_priv),
.ops = _ops,
  };


Reviewed-by: Neil Armstrong 


Re: [PATCH v1 1/2] clk: a1: add new clocks for USB stack

2023-11-02 Thread neil . armstrong

On 01/11/2023 15:04, Alexey Romanov wrote:

Since we sync device tree with Linux, we have to add this
clock definition for USB stack.

Signed-off-by: Alexey Romanov 
---
  drivers/clk/meson/a1.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/drivers/clk/meson/a1.c b/drivers/clk/meson/a1.c
index 1075ba7333..d0f5bb3753 100644
--- a/drivers/clk/meson/a1.c
+++ b/drivers/clk/meson/a1.c
@@ -241,6 +241,12 @@ static const struct meson_clk_info *meson_clocks[] = {
[CLKID_USB_PHY_IN] = CLK_GATE("usb_phy_in", A1_SYS_OSCIN_CTRL, 2,
EXTERNAL_XTAL
),
+   [CLKID_USB_CTRL_IN] = CLK_GATE("usb_ctrl_in", A1_SYS_OSCIN_CTRL, 3,
+   EXTERNAL_XTAL
+   ),
+   [CLKID_USB_CTRL] = CLK_GATE("usb_ctrl", A1_SYS_CLK_EN0, 28,
+   CLKID_SYS
+   ),
[CLKID_USB_PHY] = CLK_GATE("usb_phy", A1_SYS_CLK_EN0, 27,
CLKID_SYS
),


Reviewed-by: Neil Armstrong 


Re: [PATCH 1/1] board: sifive: unmatched: move kernel load address to 0x80200000

2023-11-02 Thread Tom Rini
On Thu, Nov 02, 2023 at 06:27:37PM +0800, Yong-Xuan Wang wrote:
> Hi Tom,
> 
> On Tue, Oct 31, 2023 at 7:54 PM Tom Rini  wrote:
> >
> > On Tue, Oct 31, 2023 at 03:56:45PM +0800, Yong-Xuan Wang wrote:
> >
> > > Hi Tom,
> > >
> > > 0x8020 comes from the result of the relocated_addr in booti_setup()
> > > on HiFive Unmatched board. If we load the Kernel Image to this address,
> > > it will not be moved. Currently one of the first two 8-byte of RISC-V
> > > Kernel Image is j _start_kernel instruction, so it's OK to execute the
> > > header of the Image.
> >
> > Thanks for confirming.
> >
> > Reviewed-by: Tom Rini 
> >
> > As a follow-up, can you please work on migrating to plain text
> > environment?
> >
> > >
> > > Regards,
> > > Yong-Xuan
> > >
> > >
> > > On Sat, Oct 28, 2023 at 12:43 AM Tom Rini  wrote:
> > > >
> > > > On Thu, Oct 26, 2023 at 03:22:52AM +, Yong-Xuan Wang wrote:
> > > >
> > > > > U-boot initially loads the kernel image to the kernel_addr_r, and
> > > > > subsequently relocates it to memory address 0x8020. Setting
> > > > > kernel_addr_r to 0x8020 can eliminate one copy operation.
> > > > >
> > > > > Signed-off-by: Yong-Xuan Wang 
> > > > > ---
> > > > >  include/configs/sifive-unmatched.h | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/include/configs/sifive-unmatched.h 
> > > > > b/include/configs/sifive-unmatched.h
> > > > > index 74150b7d4b..de8bfc1123 100644
> > > > > --- a/include/configs/sifive-unmatched.h
> > > > > +++ b/include/configs/sifive-unmatched.h
> > > > > @@ -36,7 +36,7 @@
> > > > >   "name=system,size=-,bootable,type=${type_guid_gpt_system};"
> > > > >
> > > > >  #define CFG_EXTRA_ENV_SETTINGS \
> > > > > - "kernel_addr_r=0x8400\0" \
> > > > > + "kernel_addr_r=0x8020\0" \
> > > > >   "kernel_comp_addr_r=0x8800\0" \
> > > > >   "kernel_comp_size=0x400\0" \
> > > > >   "fdt_addr_r=0x8c00\0" \
> > > >
> > > > This is I believe subtly wrong. If you want an execute in place kernel
> > > > image (and are using FIT images), this can be made to work. But if you
> > > > load your (Linux Kernel) Image to this address, the header will be at
> > > > 0x8020 and not the payload so you still end up moving it. Are you
> > > > sure this is (a) not still moving it and (b) it's OK to be executing the
> > > > header of the image like it's code (or is there some catch in the header
> > > > to lead to a jump over it, in that case) ?
> > > >
> > > > --
> > > > Tom
> >
> > --
> > Tom
> 
> Sure. Could you please provide more details or examples of the plain text
> environment? I want to ensure I fully understand your request before
> proceeding.

Sure.  An example conversion is:
commit fc2af2d978b525e188b15d909e321caf9445bdb0
Author: Simon Glass 
Date:   Thu Jul 27 15:54:30 2023 -0600

arm: rpi: Switch to a text environment

Use the new environment format so we can drop most of the config.h file.

Signed-off-by: Simon Glass 

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v2 1/2] rng: move platform_get_rng_device() to rng-uclass.c

2023-11-02 Thread Alexey Romanov
The correct declaration place for platform_get_rng_device()
function is here. Also, this function is re-implemented to provide
the first successfully probed RNG device.

Signed-off-by: Alexey Romanov 
---
 drivers/rng/rng-uclass.c | 16 
 include/efi_rng.h|  2 --
 include/rng.h| 11 +++
 lib/efi_loader/efi_rng.c | 27 ---
 4 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/drivers/rng/rng-uclass.c b/drivers/rng/rng-uclass.c
index 53108e1b31..d7236b9335 100644
--- a/drivers/rng/rng-uclass.c
+++ b/drivers/rng/rng-uclass.c
@@ -9,6 +9,22 @@
 #include 
 #include 
 
+int platform_get_rng_device(struct udevice **dev)
+{
+   int ret;
+   struct udevice *devp;
+
+   ret = uclass_first_device_check(UCLASS_RNG, );
+   if (ret) {
+   pr_err("Unable to get RNG device (%d)\n", ret);
+   return -ENODEV;
+   }
+
+   *dev = devp;
+
+   return 0;
+}
+
 int dm_rng_read(struct udevice *dev, void *buffer, size_t size)
 {
const struct dm_rng_ops *ops = device_get_ops(dev);
diff --git a/include/efi_rng.h b/include/efi_rng.h
index 3c622381cb..f22e54adb0 100644
--- a/include/efi_rng.h
+++ b/include/efi_rng.h
@@ -23,6 +23,4 @@ struct efi_rng_protocol {
   efi_uintn_t rng_value_length, uint8_t 
*rng_value);
 };
 
-efi_status_t platform_get_rng_device(struct udevice **dev);
-
 #endif /* _EFI_RNG_H_ */
diff --git a/include/rng.h b/include/rng.h
index 37af554363..255c85d3e8 100644
--- a/include/rng.h
+++ b/include/rng.h
@@ -20,6 +20,17 @@ struct udevice;
  */
 int dm_rng_read(struct udevice *dev, void *buffer, size_t size);
 
+/**
+ * platform_get_rng_device() - retrieve random number generator
+ *
+ * This function retrieves the first udevice implementing a hardware
+ * random number generator. Device is already probed.
+ *
+ * @dev:   udevice
+ * Return: status code
+ */
+int platform_get_rng_device(struct udevice **dev);
+
 /**
  * struct dm_rng_ops - operations for the hwrng uclass
  *
diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c
index bb11d8d0e0..0d8bf770f5 100644
--- a/lib/efi_loader/efi_rng.c
+++ b/lib/efi_loader/efi_rng.c
@@ -17,33 +17,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID;
 
-/**
- * platform_get_rng_device() - retrieve random number generator
- *
- * This function retrieves the udevice implementing a hardware random
- * number generator.
- *
- * This function may be overridden if special initialization is needed.
- *
- * @dev:   udevice
- * Return: status code
- */
-__weak efi_status_t platform_get_rng_device(struct udevice **dev)
-{
-   int ret;
-   struct udevice *devp;
-
-   ret = uclass_get_device(UCLASS_RNG, 0, );
-   if (ret) {
-   debug("Unable to get rng device\n");
-   return EFI_DEVICE_ERROR;
-   }
-
-   *dev = devp;
-
-   return EFI_SUCCESS;
-}
-
 /**
  * rng_getinfo() - get information about random number generation
  *
-- 
2.30.1



[PATCH v2 2/2] rng: add dm_rng_read_default() helper

2023-11-02 Thread Alexey Romanov
Add dm_rng_read_default() function, which obtain a series
of random bytes. In some cases, such function would be
useful because it allows the caller to abstract away from
RNG device.

Signed-off-by: Alexey Romanov 
---
 drivers/rng/rng-uclass.c | 18 ++
 include/rng.h| 10 ++
 2 files changed, 28 insertions(+)

diff --git a/drivers/rng/rng-uclass.c b/drivers/rng/rng-uclass.c
index d7236b9335..e298623e1d 100644
--- a/drivers/rng/rng-uclass.c
+++ b/drivers/rng/rng-uclass.c
@@ -35,6 +35,24 @@ int dm_rng_read(struct udevice *dev, void *buffer, size_t 
size)
return ops->read(dev, buffer, size);
 }
 
+int dm_rng_read_default(void *buffer, size_t size)
+{
+   struct udevice *rng;
+   int ret;
+
+   ret = platform_get_rng_device();
+   if (ret)
+   return ret;
+
+   ret = dm_rng_read(rng, buffer, size);
+   if (ret) {
+   pr_err("Can't read from RNG device (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 UCLASS_DRIVER(rng) = {
.name = "rng",
.id = UCLASS_RNG,
diff --git a/include/rng.h b/include/rng.h
index 255c85d3e8..6412fedad2 100644
--- a/include/rng.h
+++ b/include/rng.h
@@ -20,6 +20,16 @@ struct udevice;
  */
 int dm_rng_read(struct udevice *dev, void *buffer, size_t size);
 
+/**
+ * dm_rng_read_default() - same as dm_rng_read(), except that caller
+ * don't need to pass an argument with RNG udevice.
+ * @buffer:input buffer to put the read random seed into
+ * @size:  number of bytes of random seed read
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int dm_rng_read_default(void *buffer, size_t size);
+
 /**
  * platform_get_rng_device() - retrieve random number generator
  *
-- 
2.30.1



[PATCH v2 0/2] Add dm_rng_read_default() helper

2023-11-02 Thread Alexey Romanov
Hello!

This patchset adds dm_rng_read_default() helper function, 
that selects the first rng device and uses it to obtain
random bytes.

V2:

- Move platform_get_rng_device() to rng-uclass.c. 
- Re-implement it to get first successfully probed device.
- Use it in dm_rng_read_default().

Alexey Romanov (2):
  rng: move platform_get_rng_device() to rng-uclass.c
  rng: add dm_rng_read_default() helper

 drivers/rng/rng-uclass.c | 34 ++
 include/efi_rng.h|  2 --
 include/rng.h| 21 +
 lib/efi_loader/efi_rng.c | 27 ---
 4 files changed, 55 insertions(+), 29 deletions(-)

-- 
2.30.1



Re: [PATCH v2 0/7] arm: mach-snapdragon: Qualcomm clock driver cleanup

2023-11-02 Thread Sumit Garg
Hi Caleb,

On Tue, 31 Oct 2023 at 03:53, Caleb Connolly  wrote:
>
> This series begins making some headway towards cleaning up Qualcomm
> platform support in u-boot. The following is a rough overview of the
> changes:
>
> * Move the Qualcomm clock drivers out of mach-snapdragon and into clk/qcom
> * Introduce per-platform clock driver configs to decouple Qualcomm platform
>   support from mach-snapdragon targets.
> * Add the IPQ4019 clock driver, removing it from mach-ipq40xx and introducing
>   the reset map.
> * Merge the qcom reset driver is into clk/qcom and rework it to be
>   compatible with upstream devicetrees.
> * A callback model is added so that multiple clock drivers can be
>   compiled in at once.
> * SDM845 gains support for enabling/disabling all gate clocks (CBC's) by
>   way of a new "gate_clk" abstraction.
> * Preperatory cleanup work is done to simplify the bringup process for
>   new platforms.
>
> Further details are included in each commit.
>
> The primary goal of this series is to prepare for enabling several new
> Qualcomm platforms in u-boot as well as additional peripherals, while
> minimising the amount of copy/pasted board-specific code.
>
> This series conflicts with a previous series introducing support for the
> Qualcomm RB2 board [1], I plan to resend this initial support pending
> acceptance of this series and several other cleanups.
>
> [1]: 
> https://lore.kernel.org/u-boot/20230324080418.3856409-1-bhupesh.sha...@linaro.org/
>
> ---
> Changes in v2:
> * Added missing headers in clock-qcom.c for "fix rcg divider value"
>   patch
> * Use writel() instead of setbits_le32() in "fix rcg divider value"
>   patch to ensure that writes are propagated to hardware.
> * Adjust RCG configuration to be more similar to Linux
> * Remove sysmap headers and define macros directly in platform clock
>   code.
> * avoid renaming msm_* to qcom_* for now
> * only add relevant gate_clks for sdm845
> * Link to v1: 
> https://lore.kernel.org/r/20231024-b4-qcom-clk-v1-0-9d96359b9...@linaro.org
>
> ---
> Caleb Connolly (6):
>   clk/qcom: move from mach-snapdragon
>   clk/qcom: move ipq4019 driver from mach-ipq40xx
>   clk/qcom: sdm845: add register map for simple gate clocks
>   clk/qcom: use function pointers for enable and set_rate
>   clk/qcom: add mnd_width to clk_rcg_set_rate_mnd()
>   clk/qcom: fix rcg divider value
>
> Konrad Dybcio (1):
>   clk/qcom: handle resets and clocks in one device
>

This patch-set fails to apply on the u-boot mainline for me. Care to rebase?

-Sumit

>  arch/arm/Kconfig   |   2 +
>  arch/arm/dts/qcom-ipq4019.dtsi |  14 +-
>  arch/arm/dts/qcs404-evb.dts|  19 +-
>  arch/arm/mach-ipq40xx/Makefile |   1 -
>  arch/arm/mach-ipq40xx/clock-ipq4019.c  |  88 --
>  arch/arm/mach-snapdragon/Kconfig   |   4 +
>  arch/arm/mach-snapdragon/Makefile  |   5 -
>  arch/arm/mach-snapdragon/clock-sdm845.c|  98 ---
>  arch/arm/mach-snapdragon/clock-snapdragon.c| 181 
>  arch/arm/mach-snapdragon/clock-snapdragon.h|  48 
>  .../mach-snapdragon/include/mach/sysmap-apq8016.h  |  39 ---
>  .../mach-snapdragon/include/mach/sysmap-apq8096.h  |  37 ---
>  .../mach-snapdragon/include/mach/sysmap-qcs404.h   |  88 --
>  .../mach-snapdragon/include/mach/sysmap-sdm845.h   |  42 ---
>  board/qualcomm/dragonboard820c/dragonboard820c.c   |   6 +-
>  drivers/clk/Kconfig|   1 +
>  drivers/clk/Makefile   |   1 +
>  drivers/clk/qcom/Kconfig   |  52 
>  drivers/clk/qcom/Makefile  |  10 +
>  .../clk/qcom}/clock-apq8016.c  |  60 +++-
>  .../clk/qcom}/clock-apq8096.c  |  56 +++-
>  .../reset-qcom.c => clk/qcom/clock-ipq4019.c}  | 160 ---
>  drivers/clk/qcom/clock-qcom.c  | 309 
> +
>  drivers/clk/qcom/clock-qcom.h  | 100 +++
>  .../clk/qcom}/clock-qcs404.c   | 167 +--
>  drivers/clk/qcom/clock-sdm845.c| 190 +
>  drivers/reset/Kconfig  |   7 -
>  drivers/reset/Makefile |   1 -
>  include/configs/dragonboard410c.h  |   1 -
>  include/configs/dragonboard820c.h  |   1 -
>  include/configs/dragonboard845c.h  |   1 -
>  include/configs/qcs404-evb.h   |   1 -
>  .../{qcom,ipq4019-gcc.h => qcom,gcc-ipq4019.h} |  73 +
>  include/dt-bindings/reset/qcom,ipq4019-reset.h |  92 --
>  34 files changed, 1057 insertions(+), 898 deletions(-)
> ---
> base-commit: 30d01b582f2274eb8c808026c5fb4c33e9f2210d
>
> // Caleb (they/them)
>


[PATCH v5 7/8] clk: treewide: switch to clock dump from clk_ops

2023-11-02 Thread Igor Prusov
Switch to using new dump operation in clock provider drivers instead of
overriding soc_clk_dump.

Signed-off-by: Igor Prusov 
Tested-by: Patrice Chotard 
Reviewed-by: Sean Anderson 
---
 arch/mips/mach-pic32/cpu.c | 23 ---
 drivers/clk/aspeed/clk_ast2600.c   | 13 -
 drivers/clk/clk_k210.c | 11 +++-
 drivers/clk/clk_pic32.c| 39 ++
 drivers/clk/clk_versal.c   |  7 -
 drivers/clk/clk_zynq.c | 19 -
 drivers/clk/clk_zynqmp.c   | 13 -
 drivers/clk/imx/clk-imx8.c | 11 +++-
 drivers/clk/meson/a1.c | 24 
 drivers/clk/mvebu/armada-37xx-periph.c |  5 +++-
 drivers/clk/stm32/clk-stm32mp1.c   | 29 ++-
 11 files changed, 89 insertions(+), 105 deletions(-)

diff --git a/arch/mips/mach-pic32/cpu.c b/arch/mips/mach-pic32/cpu.c
index dbf8c9cd22..3181a946a2 100644
--- a/arch/mips/mach-pic32/cpu.c
+++ b/arch/mips/mach-pic32/cpu.c
@@ -143,26 +143,3 @@ const char *get_core_name(void)
return str;
 }
 #endif
-#ifdef CONFIG_CMD_CLK
-
-int soc_clk_dump(void)
-{
-   int i;
-
-   printf("PLL Speed: %lu MHz\n",
-  CLK_MHZ(rate(PLLCLK)));
-
-   printf("CPU Speed: %lu MHz\n", CLK_MHZ(rate(PB7CLK)));
-
-   printf("MPLL Speed: %lu MHz\n", CLK_MHZ(rate(MPLL)));
-
-   for (i = PB1CLK; i <= PB7CLK; i++)
-   printf("PB%d Clock Speed: %lu MHz\n", i - PB1CLK + 1,
-  CLK_MHZ(rate(i)));
-
-   for (i = REF1CLK; i <= REF5CLK; i++)
-   printf("REFO%d Clock Speed: %lu MHz\n", i - REF1CLK + 1,
-  CLK_MHZ(rate(i)));
-   return 0;
-}
-#endif
diff --git a/drivers/clk/aspeed/clk_ast2600.c b/drivers/clk/aspeed/clk_ast2600.c
index b3cc8392fa..e1365d3f81 100644
--- a/drivers/clk/aspeed/clk_ast2600.c
+++ b/drivers/clk/aspeed/clk_ast2600.c
@@ -1109,6 +1109,7 @@ struct aspeed_clks {
const char *name;
 };
 
+#if IS_ENABLED(CONFIG_CMD_CLK)
 static struct aspeed_clks aspeed_clk_names[] = {
{ ASPEED_CLK_HPLL, "hpll" },
{ ASPEED_CLK_MPLL, "mpll" },
@@ -1123,18 +1124,12 @@ static struct aspeed_clks aspeed_clk_names[] = {
{ ASPEED_CLK_HUARTX, "huxclk" },
 };
 
-int soc_clk_dump(void)
+static int ast2600_clk_dump(struct udevice *dev)
 {
-   struct udevice *dev;
struct clk clk;
unsigned long rate;
int i, ret;
 
-   ret = uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(aspeed_scu),
- );
-   if (ret)
-   return ret;
-
printf("Clk\t\tHz\n");
 
for (i = 0; i < ARRAY_SIZE(aspeed_clk_names); i++) {
@@ -1167,11 +1162,15 @@ int soc_clk_dump(void)
 
return 0;
 }
+#endif
 
 struct clk_ops ast2600_clk_ops = {
.get_rate = ast2600_clk_get_rate,
.set_rate = ast2600_clk_set_rate,
.enable = ast2600_clk_enable,
+#if IS_ENABLED(CONFIG_CMD_CLK)
+   .dump = ast2600_clk_dump,
+#endif
 };
 
 static int ast2600_clk_probe(struct udevice *dev)
diff --git a/drivers/clk/clk_k210.c b/drivers/clk/clk_k210.c
index 2f17152021..058940b828 100644
--- a/drivers/clk/clk_k210.c
+++ b/drivers/clk/clk_k210.c
@@ -1276,16 +1276,10 @@ static void show_clks(struct k210_clk_priv *priv, int 
id, int depth)
}
 }
 
-int soc_clk_dump(void)
+static int k210_clk_dump(struct udevice *dev)
 {
-   int ret;
-   struct udevice *dev;
struct k210_clk_priv *priv;
 
-   ret = uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(k210_clk),
- );
-   if (ret)
-   return ret;
priv = dev_get_priv(dev);
 
puts(" Rate  Enabled Name\n");
@@ -1304,6 +1298,9 @@ static const struct clk_ops k210_clk_ops = {
.set_parent = k210_clk_set_parent,
.enable = k210_clk_enable,
.disable = k210_clk_disable,
+#if IS_ENABLED(CONFIG_CMD_CLK)
+   .dump = k210_clk_dump,
+#endif
 };
 
 static int k210_clk_probe(struct udevice *dev)
diff --git a/drivers/clk/clk_pic32.c b/drivers/clk/clk_pic32.c
index ef06a7fb9f..f756fc88f0 100644
--- a/drivers/clk/clk_pic32.c
+++ b/drivers/clk/clk_pic32.c
@@ -20,6 +20,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define CLK_MHZ(x) ((x) / 100)
+
 /* Primary oscillator */
 #define SYS_POSC_CLK_HZ2400
 
@@ -385,9 +387,46 @@ static ulong pic32_set_rate(struct clk *clk, ulong rate)
return rate;
 }
 
+#if IS_ENABLED(CONFIG_CMD_CLK)
+static int pic32_dump(struct udevice *dev)
+{
+   int i;
+   struct clk clk;
+
+   clk.dev = dev;
+
+   clk.id = PLLCLK;
+   printf("PLL Speed: %lu MHz\n",
+  CLK_MHZ(pic32_get_rate()));
+
+   clk.id = PB7CLK;
+   printf("CPU Speed: %lu MHz\n", CLK_MHZ(pic32_get_rate()));
+
+   clk.id = MPLL;
+   printf("MPLL Speed: %lu MHz\n", CLK_MHZ(pic32_get_rate()));
+
+   for (i = PB1CLK; i <= PB7CLK; 

[PATCH v5 8/8] cmd: clk: Make soc_clk_dump static

2023-11-02 Thread Igor Prusov
After introducing dump to clk_ops there is no need to override or expose
this symbol anymore.

Signed-off-by: Igor Prusov 
Reviewed-by: Patrice Chotard 
Tested-by: Patrice Chotard 
Reviewed-by: Sean Anderson 
---
 cmd/clk.c | 4 ++--
 include/clk.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/cmd/clk.c b/cmd/clk.c
index 4b9709d3ff..7bbcbfeda3 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -59,7 +59,7 @@ static void show_clks(struct udevice *dev, int depth, int 
last_flag)
}
 }
 
-int __weak soc_clk_dump(void)
+static int soc_clk_dump(void)
 {
struct udevice *dev;
const struct clk_ops *ops;
@@ -81,7 +81,7 @@ int __weak soc_clk_dump(void)
return 0;
 }
 #else
-int __weak soc_clk_dump(void)
+static int soc_clk_dump(void)
 {
puts("Not implemented\n");
return 1;
diff --git a/include/clk.h b/include/clk.h
index d91285235f..bf0d9c9d7f 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -674,8 +674,6 @@ static inline bool clk_valid(struct clk *clk)
return clk && !!clk->dev;
 }
 
-int soc_clk_dump(void);
-
 #endif
 
 #define clk_prepare_enable(clk) clk_enable(clk)
-- 
2.34.1



[PATCH v5 6/8] cmd: clk: Use dump function from clk_ops

2023-11-02 Thread Igor Prusov
Add another loop to dump additional info from clock providers that
implement dump operation.

Signed-off-by: Igor Prusov 
Reviewed-by: Patrice Chotard 
Tested-by: Patrice Chotard 
---
 cmd/clk.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/cmd/clk.c b/cmd/clk.c
index c7c379d7a6..4b9709d3ff 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -62,6 +62,7 @@ static void show_clks(struct udevice *dev, int depth, int 
last_flag)
 int __weak soc_clk_dump(void)
 {
struct udevice *dev;
+   const struct clk_ops *ops;
 
printf(" Rate   Usecnt  Name\n");
printf("--\n");
@@ -69,6 +70,14 @@ int __weak soc_clk_dump(void)
uclass_foreach_dev_probe(UCLASS_CLK, dev)
show_clks(dev, -1, 0);
 
+   uclass_foreach_dev_probe(UCLASS_CLK, dev) {
+   ops = dev_get_driver_ops(dev);
+   if (ops && ops->dump) {
+   printf("\n%s %s:\n", dev->driver->name, dev->name);
+   ops->dump(dev);
+   }
+   }
+
return 0;
 }
 #else
-- 
2.34.1



[PATCH v5 5/8] clk: Add dump operation to clk_ops

2023-11-02 Thread Igor Prusov
This adds dump function to struct clk_ops which should replace
soc_clk_dump. It allows clock drivers to provide custom dump
implementation without overriding generic CCF dump function.

Signed-off-by: Igor Prusov 
Reviewed-by: Patrice Chotard 
Tested-by: Patrice Chotard 
---
 include/clk-uclass.h | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/include/clk-uclass.h b/include/clk-uclass.h
index a22f1a5d84..793bf14160 100644
--- a/include/clk-uclass.h
+++ b/include/clk-uclass.h
@@ -25,6 +25,7 @@ struct ofnode_phandle_args;
  * @set_parent: Set current clock parent
  * @enable: Enable a clock.
  * @disable: Disable a clock.
+ * @dump: Print clock information.
  *
  * The individual methods are described more fully below.
  */
@@ -39,6 +40,9 @@ struct clk_ops {
int (*set_parent)(struct clk *clk, struct clk *parent);
int (*enable)(struct clk *clk);
int (*disable)(struct clk *clk);
+#if IS_ENABLED(CONFIG_CMD_CLK)
+   int (*dump)(struct udevice *dev);
+#endif
 };
 
 #if 0 /* For documentation only */
@@ -135,6 +139,17 @@ int enable(struct clk *clk);
  * Return: zero on success, or -ve error code.
  */
 int disable(struct clk *clk);
+
+/**
+ * dump() - Print clock information.
+ * @clk:   The clock device to dump.
+ *
+ * If present, this function is called by "clk dump" command for each
+ * bound device.
+ *
+ * Return: zero on success, or -ve error code.
+ */
+int dump(struct udevice *dev);
 #endif
 
 #endif
-- 
2.34.1



[PATCH v5 1/8] clk: zynq: Move soc_clk_dump to Zynq clock driver

2023-11-02 Thread Igor Prusov
Move clock dump function in preparation for switching to dump function
in clk_ops.

Signed-off-by: Igor Prusov 
Acked-by: Michal Simek 
---
 arch/arm/mach-zynq/clk.c | 57 ---
 drivers/clk/clk_zynq.c   | 58 
 2 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/arch/arm/mach-zynq/clk.c b/arch/arm/mach-zynq/clk.c
index 1945f60e08..e6a67326dd 100644
--- a/arch/arm/mach-zynq/clk.c
+++ b/arch/arm/mach-zynq/clk.c
@@ -13,20 +13,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const char * const clk_names[clk_max] = {
-   "armpll", "ddrpll", "iopll",
-   "cpu_6or4x", "cpu_3or2x", "cpu_2x", "cpu_1x",
-   "ddr2x", "ddr3x", "dci",
-   "lqspi", "smc", "pcap", "gem0", "gem1",
-   "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1",
-   "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1", "dma",
-   "usb0_aper", "usb1_aper", "gem0_aper", "gem1_aper",
-   "sdio0_aper", "sdio1_aper", "spi0_aper", "spi1_aper",
-   "can0_aper", "can1_aper", "i2c0_aper", "i2c1_aper",
-   "uart0_aper", "uart1_aper", "gpio_aper", "lqspi_aper",
-   "smc_aper", "swdt", "dbg_trc", "dbg_apb"
-};
-
 /**
  * set_cpu_clk_info() - Setup clock information
  *
@@ -65,46 +51,3 @@ int set_cpu_clk_info(void)
 
return 0;
 }
-
-/**
- * soc_clk_dump() - Print clock frequencies
- * Returns zero on success
- *
- * Implementation for the clk dump command.
- */
-int soc_clk_dump(void)
-{
-   struct udevice *dev;
-   int i, ret;
-
-   ret = uclass_get_device_by_driver(UCLASS_CLK,
-   DM_DRIVER_GET(zynq_clk), );
-   if (ret)
-   return ret;
-
-   printf("clk\t\tfrequency\n");
-   for (i = 0; i < clk_max; i++) {
-   const char *name = clk_names[i];
-   if (name) {
-   struct clk clk;
-   unsigned long rate;
-
-   clk.id = i;
-   ret = clk_request(dev, );
-   if (ret < 0)
-   return ret;
-
-   rate = clk_get_rate();
-
-   clk_free();
-
-   if ((rate == (unsigned long)-ENOSYS) ||
-   (rate == (unsigned long)-ENXIO))
-   printf("%10s%20s\n", name, "unknown");
-   else
-   printf("%10s%20lu\n", name, rate);
-   }
-   }
-
-   return 0;
-}
diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c
index e80500e382..be5226175f 100644
--- a/drivers/clk/clk_zynq.c
+++ b/drivers/clk/clk_zynq.c
@@ -454,6 +454,64 @@ static int dummy_enable(struct clk *clk)
return 0;
 }
 
+static const char * const clk_names[clk_max] = {
+   "armpll", "ddrpll", "iopll",
+   "cpu_6or4x", "cpu_3or2x", "cpu_2x", "cpu_1x",
+   "ddr2x", "ddr3x", "dci",
+   "lqspi", "smc", "pcap", "gem0", "gem1",
+   "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1",
+   "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1", "dma",
+   "usb0_aper", "usb1_aper", "gem0_aper", "gem1_aper",
+   "sdio0_aper", "sdio1_aper", "spi0_aper", "spi1_aper",
+   "can0_aper", "can1_aper", "i2c0_aper", "i2c1_aper",
+   "uart0_aper", "uart1_aper", "gpio_aper", "lqspi_aper",
+   "smc_aper", "swdt", "dbg_trc", "dbg_apb"
+};
+
+/**
+ * soc_clk_dump() - Print clock frequencies
+ * Returns zero on success
+ *
+ * Implementation for the clk dump command.
+ */
+int soc_clk_dump(void)
+{
+   struct udevice *dev;
+   int i, ret;
+
+   ret = uclass_get_device_by_driver(UCLASS_CLK,
+ DM_DRIVER_GET(zynq_clk), );
+   if (ret)
+   return ret;
+
+   printf("clk\t\tfrequency\n");
+   for (i = 0; i < clk_max; i++) {
+   const char *name = clk_names[i];
+
+   if (name) {
+   struct clk clk;
+   unsigned long rate;
+
+   clk.id = i;
+   ret = clk_request(dev, );
+   if (ret < 0)
+   return ret;
+
+   rate = clk_get_rate();
+
+   clk_free();
+
+   if ((rate == (unsigned long)-ENOSYS) ||
+   (rate == (unsigned long)-ENXIO))
+   printf("%10s%20s\n", name, "unknown");
+   else
+   printf("%10s%20lu\n", name, rate);
+   }
+   }
+
+   return 0;
+}
+
 static struct clk_ops zynq_clk_ops = {
.get_rate = zynq_clk_get_rate,
 #ifndef CONFIG_SPL_BUILD
-- 
2.34.1



[PATCH v5 4/8] clk: amlogic: Move driver and ops structs

2023-11-02 Thread Igor Prusov
Move driver and ops structs to avoid forward declaration after switching
to dump in clk_ops.

Signed-off-by: Igor Prusov 
Reviewed-by: Neil Armstrong 
---
 drivers/clk/meson/a1.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/meson/a1.c b/drivers/clk/meson/a1.c
index 1075ba7333..e3fa9db7d0 100644
--- a/drivers/clk/meson/a1.c
+++ b/drivers/clk/meson/a1.c
@@ -601,14 +601,6 @@ static int meson_clk_set_parent(struct clk *clk, struct 
clk *parent_clk)
return meson_mux_set_parent_by_id(clk, parent_clk->id);
 }
 
-static struct clk_ops meson_clk_ops = {
-   .disable= meson_clk_disable,
-   .enable = meson_clk_enable,
-   .get_rate   = meson_clk_get_rate,
-   .set_rate   = meson_clk_set_rate,
-   .set_parent = meson_clk_set_parent,
-};
-
 static int meson_clk_probe(struct udevice *dev)
 {
struct meson_clk *priv = dev_get_priv(dev);
@@ -638,15 +630,6 @@ static const struct udevice_id meson_clk_ids[] = {
{ }
 };
 
-U_BOOT_DRIVER(meson_clk) = {
-   .name   = "meson-clk-a1",
-   .id = UCLASS_CLK,
-   .of_match   = meson_clk_ids,
-   .priv_auto  = sizeof(struct meson_clk),
-   .ops= _clk_ops,
-   .probe  = meson_clk_probe,
-};
-
 static const char *meson_clk_get_name(struct clk *clk, int id)
 {
const struct meson_clk_info *info;
@@ -727,3 +710,20 @@ int soc_clk_dump(void)
 
return 0;
 }
+
+static struct clk_ops meson_clk_ops = {
+   .disable= meson_clk_disable,
+   .enable = meson_clk_enable,
+   .get_rate   = meson_clk_get_rate,
+   .set_rate   = meson_clk_set_rate,
+   .set_parent = meson_clk_set_parent,
+};
+
+U_BOOT_DRIVER(meson_clk) = {
+   .name   = "meson-clk-a1",
+   .id = UCLASS_CLK,
+   .of_match   = meson_clk_ids,
+   .priv_auto  = sizeof(struct meson_clk),
+   .ops= _clk_ops,
+   .probe  = meson_clk_probe,
+};
-- 
2.34.1



[PATCH v5 3/8] clk: k210: Move soc_clk_dump function

2023-11-02 Thread Igor Prusov
Move clock dump function to avoid forward declaration after switching to
dump in clk_ops.

Signed-off-by: Igor Prusov 
Reviewed-by: Sean Anderson 
---
 drivers/clk/clk_k210.c | 92 +-
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/clk/clk_k210.c b/drivers/clk/clk_k210.c
index c534cc07e0..2f17152021 100644
--- a/drivers/clk/clk_k210.c
+++ b/drivers/clk/clk_k210.c
@@ -1238,52 +1238,6 @@ static int k210_clk_request(struct clk *clk)
return 0;
 }
 
-static const struct clk_ops k210_clk_ops = {
-   .request = k210_clk_request,
-   .set_rate = k210_clk_set_rate,
-   .get_rate = k210_clk_get_rate,
-   .set_parent = k210_clk_set_parent,
-   .enable = k210_clk_enable,
-   .disable = k210_clk_disable,
-};
-
-static int k210_clk_probe(struct udevice *dev)
-{
-   int ret;
-   struct k210_clk_priv *priv = dev_get_priv(dev);
-
-   priv->base = dev_read_addr_ptr(dev_get_parent(dev));
-   if (!priv->base)
-   return -EINVAL;
-
-   ret = clk_get_by_index(dev, 0, >in0);
-   if (ret)
-   return ret;
-
-   /*
-* Force setting defaults, even before relocation. This is so we can
-* set the clock rate for PLL1 before we relocate into aisram.
-*/
-   if (!(gd->flags & GD_FLG_RELOC))
-   clk_set_defaults(dev, CLK_DEFAULTS_POST_FORCE);
-
-   return 0;
-}
-
-static const struct udevice_id k210_clk_ids[] = {
-   { .compatible = "canaan,k210-clk" },
-   { },
-};
-
-U_BOOT_DRIVER(k210_clk) = {
-   .name = "k210_clk",
-   .id = UCLASS_CLK,
-   .of_match = k210_clk_ids,
-   .ops = _clk_ops,
-   .probe = k210_clk_probe,
-   .priv_auto = sizeof(struct k210_clk_priv),
-};
-
 #if IS_ENABLED(CONFIG_CMD_CLK)
 static char show_enabled(struct k210_clk_priv *priv, int id)
 {
@@ -1342,3 +1296,49 @@ int soc_clk_dump(void)
return 0;
 }
 #endif
+
+static const struct clk_ops k210_clk_ops = {
+   .request = k210_clk_request,
+   .set_rate = k210_clk_set_rate,
+   .get_rate = k210_clk_get_rate,
+   .set_parent = k210_clk_set_parent,
+   .enable = k210_clk_enable,
+   .disable = k210_clk_disable,
+};
+
+static int k210_clk_probe(struct udevice *dev)
+{
+   int ret;
+   struct k210_clk_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr_ptr(dev_get_parent(dev));
+   if (!priv->base)
+   return -EINVAL;
+
+   ret = clk_get_by_index(dev, 0, >in0);
+   if (ret)
+   return ret;
+
+   /*
+* Force setting defaults, even before relocation. This is so we can
+* set the clock rate for PLL1 before we relocate into aisram.
+*/
+   if (!(gd->flags & GD_FLG_RELOC))
+   clk_set_defaults(dev, CLK_DEFAULTS_POST_FORCE);
+
+   return 0;
+}
+
+static const struct udevice_id k210_clk_ids[] = {
+   { .compatible = "canaan,k210-clk" },
+   { },
+};
+
+U_BOOT_DRIVER(k210_clk) = {
+   .name = "k210_clk",
+   .id = UCLASS_CLK,
+   .of_match = k210_clk_ids,
+   .ops = _clk_ops,
+   .probe = k210_clk_probe,
+   .priv_auto = sizeof(struct k210_clk_priv),
+};
-- 
2.34.1



[PATCH v5 2/8] clk: ast2600: Move soc_clk_dump function

2023-11-02 Thread Igor Prusov
Move clock dump function to avoid forward declaration after switching to
dump in clk_ops.

Signed-off-by: Igor Prusov 
---
 drivers/clk/aspeed/clk_ast2600.c | 70 
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/clk/aspeed/clk_ast2600.c b/drivers/clk/aspeed/clk_ast2600.c
index e5ada5b6d4..b3cc8392fa 100644
--- a/drivers/clk/aspeed/clk_ast2600.c
+++ b/drivers/clk/aspeed/clk_ast2600.c
@@ -1104,41 +1104,6 @@ static int ast2600_clk_enable(struct clk *clk)
return 0;
 }
 
-struct clk_ops ast2600_clk_ops = {
-   .get_rate = ast2600_clk_get_rate,
-   .set_rate = ast2600_clk_set_rate,
-   .enable = ast2600_clk_enable,
-};
-
-static int ast2600_clk_probe(struct udevice *dev)
-{
-   struct ast2600_clk_priv *priv = dev_get_priv(dev);
-
-   priv->scu = devfdt_get_addr_ptr(dev);
-   if (IS_ERR(priv->scu))
-   return PTR_ERR(priv->scu);
-
-   ast2600_init_rgmii_clk(priv->scu, _clk_defconfig);
-   ast2600_init_rmii_clk(priv->scu, _clk_defconfig);
-   ast2600_configure_mac12_clk(priv->scu);
-   ast2600_configure_mac34_clk(priv->scu);
-   ast2600_configure_rsa_ecc_clk(priv->scu);
-
-   return 0;
-}
-
-static int ast2600_clk_bind(struct udevice *dev)
-{
-   int ret;
-
-   /* The reset driver does not have a device node, so bind it here */
-   ret = device_bind_driver(gd->dm_root, "ast_sysreset", "reset", );
-   if (ret)
-   debug("Warning: No reset driver: ret=%d\n", ret);
-
-   return 0;
-}
-
 struct aspeed_clks {
ulong id;
const char *name;
@@ -1203,6 +1168,41 @@ int soc_clk_dump(void)
return 0;
 }
 
+struct clk_ops ast2600_clk_ops = {
+   .get_rate = ast2600_clk_get_rate,
+   .set_rate = ast2600_clk_set_rate,
+   .enable = ast2600_clk_enable,
+};
+
+static int ast2600_clk_probe(struct udevice *dev)
+{
+   struct ast2600_clk_priv *priv = dev_get_priv(dev);
+
+   priv->scu = devfdt_get_addr_ptr(dev);
+   if (IS_ERR(priv->scu))
+   return PTR_ERR(priv->scu);
+
+   ast2600_init_rgmii_clk(priv->scu, _clk_defconfig);
+   ast2600_init_rmii_clk(priv->scu, _clk_defconfig);
+   ast2600_configure_mac12_clk(priv->scu);
+   ast2600_configure_mac34_clk(priv->scu);
+   ast2600_configure_rsa_ecc_clk(priv->scu);
+
+   return 0;
+}
+
+static int ast2600_clk_bind(struct udevice *dev)
+{
+   int ret;
+
+   /* The reset driver does not have a device node, so bind it here */
+   ret = device_bind_driver(gd->dm_root, "ast_sysreset", "reset", );
+   if (ret)
+   debug("Warning: No reset driver: ret=%d\n", ret);
+
+   return 0;
+}
+
 static const struct udevice_id ast2600_clk_ids[] = {
{ .compatible = "aspeed,ast2600-scu", },
{ },
-- 
2.34.1



[PATCH v5 0/8] clk: Switch from soc_clk_dump to clk_ops function

2023-11-02 Thread Igor Prusov
Currently clock providers may override default implementation of
soc_clk_dump function to replace clk dump command output. This causes
confusing behaviour when u-boot is built with one of such drivers
enabled but still has clocks defined using CCF. For example, enabling
CMD_CLK and using clk dump on sandbox target will not show CCF clocks
because k210 driver overrides common soc_clk_dump.

Changelog:
 v1 -> v2:
 - Add missing static to dump functions

 v2 -> v3:
 - Make soc_clk_dump in cmd/clk.c static instead of removing __weak

 v3 -> v4:
 - Rebase and refactor dump for new Amlogic A1 clock controller driver

 v4 -> v5:
 - Add docs for dump() function in clk_ops
 - Print driver and device names before calling corresponding dump()

Igor Prusov (8):
  clk: zynq: Move soc_clk_dump to Zynq clock driver
  clk: ast2600: Move soc_clk_dump function
  clk: k210: Move soc_clk_dump function
  clk: amlogic: Move driver and ops structs
  clk: Add dump operation to clk_ops
  cmd: clk: Use dump function from clk_ops
  clk: treewide: switch to clock dump from clk_ops
  cmd: clk: Make soc_clk_dump static

 arch/arm/mach-zynq/clk.c   |  57 --
 arch/mips/mach-pic32/cpu.c |  23 --
 cmd/clk.c  |  13 +++-
 drivers/clk/aspeed/clk_ast2600.c   |  83 ++--
 drivers/clk/clk_k210.c | 103 -
 drivers/clk/clk_pic32.c|  39 ++
 drivers/clk/clk_versal.c   |   7 +-
 drivers/clk/clk_zynq.c |  51 
 drivers/clk/clk_zynqmp.c   |  13 ++--
 drivers/clk/imx/clk-imx8.c |  11 +--
 drivers/clk/meson/a1.c |  54 +
 drivers/clk/mvebu/armada-37xx-periph.c |   5 +-
 drivers/clk/stm32/clk-stm32mp1.c   |  29 ++-
 include/clk-uclass.h   |  15 
 include/clk.h  |   2 -
 15 files changed, 256 insertions(+), 249 deletions(-)

-- 
2.34.1



Re: [PATCH] MAINTAINERS: update Qualcomm maintainer

2023-11-02 Thread Sumit Garg
On Tue, 31 Oct 2023 at 20:49, Caleb Connolly  wrote:
>
> As Ramon has been inactive for some time now, add myself and Neil
> Armstrong to maintain Qualcomm efforts going forwards.
>
> Signed-off-by: Caleb Connolly 
> ---
> I greatly appreciate the work done by Ramon Fried in keeping Qualcomm
> support alive in U-Boot the last few years. However it's clear that
> he hasn't been very active for some time now.
>
> I am currently working on a large cleanup effort to modernise Qualcomm
> support and enable several new reference platforms. To better facilitate
> this and to handle Qualcomm support going forwards, make myself maintainer
> of ARM SNAPDRAGON as well as my colleague Neil Armstrong (Amlogic
> maintainer).

Thanks Caleb and Neil for stepping up here. Although I won't be doing
any major development in the near future, I would like to keep an eye
on the Qcom platforms I maintain as of now. So you can add me as a
reviewer here if that's fine with you.

-Sumit

>
> I hope Ramon continues to participate in discussions and reviews going
> forward.
> ---
> base-commit: cbba1b7766bd93d74e28202c46e69095ac13760b
>
> // Caleb (they/them)
> ---
>  MAINTAINERS | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index cde778bc4d3d..be3666d14047 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -567,7 +567,8 @@ S:  Supported
>  F: arch/arm/dts/am335x-sancloud*
>
>  ARM SNAPDRAGON
> -M: Ramon Fried 
> +M: Caleb Connolly 
> +M: Neil Armstrong 
>  S: Maintained
>  F: arch/arm/mach-snapdragon/
>  F: drivers/gpio/msm_gpio.c
>


  1   2   >