Re: [PATCH v2 22/22] rockchip: rk3399: Drop ethernet0 alias from SoC u-boot.dtsi

2024-05-02 Thread Christopher Obbard
Hi Jonas,

On Wed, 2024-05-01 at 16:22 +, Jonas Karlman wrote:
> Remove the obsolete ethernet0 alias now that all board device tree files
> have been fully synced with Linux kernel v6.8.
> 
> Signed-off-by: Jonas Karlman 

Looks good to me.

Reviewed-by: Christopher Obbard 

> ---
> v2: New patch
> ---
>  arch/arm/dts/rk3399-u-boot.dtsi | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-
> boot.dtsi
> index 6af9621ac3d0..b6b43271172e 100644
> --- a/arch/arm/dts/rk3399-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-u-boot.dtsi
> @@ -6,7 +6,6 @@
>  
>  / {
>   aliases {
> - ethernet0 = 
>   mmc0 = 
>   mmc1 = 
>   pci0 = 



Re: [PATCH 28/31] rockchip: rk3399-rock-pi-4: Sync device tree from linux v6.8

2024-04-02 Thread Christopher Obbard
Hi Jonas,

On Sun, 2024-03-31 at 20:28 +, Jonas Karlman wrote:
> Sync rk3399-rock-pi-4 related device tree from linux v6.8.
> 
> Add SPI flash related options to support booting from SPI flash.
> 
> Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA boot.
> 
> Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.
> 
> Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.
> 
> Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.
> 
> Remove SPL_TINY_MEMSET=y to use full memset in SPL.
> 
> Signed-off-by: Jonas Karlman 

Thank you for taking care of this.

Reviewed-by: Christopher Obbard 

> ---
>  arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi | 12 ++
>  arch/arm/dts/rk3399-rock-4c-plus.dts |  1 +
>  arch/arm/dts/rk3399-rock-4se-u-boot.dtsi | 12 ++
>  arch/arm/dts/rk3399-rock-pi-4.dtsi   |  4 +++-
>  arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi   |  7 ++
>  arch/arm/dts/rk3399-rock-pi-4c.dts   | 10 
>  configs/rock-4c-plus-rk3399_defconfig    | 24 +++-
>  configs/rock-4se-rk3399_defconfig    | 23 +--
>  configs/rock-pi-4-rk3399_defconfig   |  8 +++
>  configs/rock-pi-4c-rk3399_defconfig  | 24 ++--
>  10 files changed, 114 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
> b/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
> index 9785b97b9eea..b5ee644a83dd 100644
> --- a/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
> @@ -11,3 +11,15 @@
>  _pull_up_8ma {
>   bootph-pre-ram;
>  };
> +
> + {
> + status = "okay";
> +
> + flash@0 {
> + bootph-pre-ram;
> + bootph-some-ram;
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + spi-max-frequency = <1000>;
> + };
> +};
> diff --git a/arch/arm/dts/rk3399-rock-4c-plus.dts b/arch/arm/dts/rk3399-
> rock-4c-plus.dts
> index 8bfd5f88d1ef..7baf9d1b22fd 100644
> --- a/arch/arm/dts/rk3399-rock-4c-plus.dts
> +++ b/arch/arm/dts/rk3399-rock-4c-plus.dts
> @@ -15,6 +15,7 @@
>   compatible = "radxa,rock-4c-plus", "rockchip,rk3399";
>  
>   aliases {
> + ethernet0 = 
>   mmc0 = 
>   mmc1 = 
>   };
> diff --git a/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi b/arch/arm/dts/rk3399-
> rock-4se-u-boot.dtsi
> index 85ee5770add0..2213d0093052 100644
> --- a/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
> @@ -4,3 +4,15 @@
>   */
>  
>  #include "rk3399-rock-pi-4-u-boot.dtsi"
> +
> + {
> + status = "okay";
> +
> + flash@0 {
> + bootph-pre-ram;
> + bootph-some-ram;
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + spi-max-frequency = <1000>;
> + };
> +};
> diff --git a/arch/arm/dts/rk3399-rock-pi-4.dtsi b/arch/arm/dts/rk3399-rock-
> pi-4.dtsi
> index b1b7f4ffb1d4..281a12180703 100644
> --- a/arch/arm/dts/rk3399-rock-pi-4.dtsi
> +++ b/arch/arm/dts/rk3399-rock-pi-4.dtsi
> @@ -12,6 +12,7 @@
>  
>  / {
>   aliases {
> + ethernet0 = 
>   mmc0 = 
>   mmc1 = 
>   };
> @@ -44,7 +45,7 @@
>   sdio_pwrseq: sdio-pwrseq {
>   compatible = "mmc-pwrseq-simple";
>   clocks = < 1>;
> - clock-names = "ext_clock";
> + clock-names = "lpo";
>   pinctrl-names = "default";
>   pinctrl-0 = <_enable_h>;
>   reset-gpios = < RK_PB2 GPIO_ACTIVE_LOW>;
> @@ -492,6 +493,7 @@
>  
>   {
>   pinctrl-0 = <_2ch_bus>;
> + pinctrl-1 = <_2ch_bus_bclk_off>;
>   rockchip,capture-channels = <2>;
>   rockchip,playback-channels = <2>;
>   status = "okay";
> diff --git a/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
> b/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
> index 85ee5770add0..38385621deb1 100644
> --- a/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
> @@ -4,3 +4,10 @@
>   */
>  
>  #include "rk3399-rock-pi-4-u-boot.dtsi"
> +
> + {
> + flash@0 {
> + bootph-pre-ram;
> + bootph-some-ram;
> + };
> +};
> diff --git a/arch/arm/dts/rk3399-rock-pi-4c.dts b/arch/arm/dts/rk3399-rock-
> pi-4c.dts
> index d32efab74e94..de2ebe4cb4f3 100

Re: [PATCH] am625x_evm_a53: Tweak boot command to set fdt

2024-03-26 Thread Christopher Obbard
Hi Martyn.

On Tue, 2024-03-26 at 14:26 +, Martyn Welch wrote:
> With the current config for tha SK-AM62, fdtfile isn't set in the U-Boot
> environment. When using bootflow to boot from a block device, where the
> extlinux.conf file specifies `fdtdir`, a fallback device tree is being
> constructed from the `soc` (`k3`) and `board` (`am62x`) environment
> variables, resulting in u-Boot trying to retrieve
> `/dtbs/6.8.1+/k3-am62x.dtb`. This file doesn't exist.
> 
> The environment variables `default_device_tree` and
> `default_device_tree_arch` are set in the config, the `findfdt` script
> can be called to construct `fdtfile` from the environment variables set
> by these config options, however this script currently isn't being run.
> 
> Calling this script results in the correct device tree being retrieved:
> 
>    Retrieving file: /dtbs/6.8.1+/ti/k3-am625-sk.dtb
> 
> Many boards are calling this script as part of their boot command. The
> am62x currently isn't. Rectify this so that booting works correctly.
> 
> Signed-off-by: Martyn Welch 

Would this also be appropriate to add to the defconfig for other AM62x boards
(e.g beagleplay) ?

Anyway, for this device:

Reviewed-by: Christopher Obbard 

> ---
>  configs/am62x_evm_a53_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configs/am62x_evm_a53_defconfig
> b/configs/am62x_evm_a53_defconfig
> index 78287ec18a..e373e44a93 100644
> --- a/configs/am62x_evm_a53_defconfig
> +++ b/configs/am62x_evm_a53_defconfig
> @@ -30,7 +30,7 @@ CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
>  CONFIG_BOOTSTD_FULL=y
>  CONFIG_SYS_BOOTM_LEN=0x80
> -CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
> +CONFIG_BOOTCOMMAND="run findfdt; run envboot; bootflow scan -lb"
>  CONFIG_BOARD_LATE_INIT=y
>  CONFIG_SPL_MAX_SIZE=0x58000
>  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y

Thanks!

Chris


Re: [PATCH v2 2/2] rockchip: rock-pi-4-rk3399: enable booting from SPI flash

2024-03-22 Thread Christopher Obbard
Hi Jonas,

On Mon, 2024-03-18 at 11:37 +0100, Jonas Karlman wrote:
> Hi Christopher,
> 
> On 2024-03-15 13:01, Christopher Obbard wrote:
> > Some variants of the ROCK Pi 4 series have an SPI flash chip populated
> > which can be booted from. This patch enables support in U-Boot for
> > building the image for the SPI flash, support for booting U-Boot from the
> > SPI flash chip and support in U-Boot for accessing the SPI flash using
> > `sf` commands.
> > 
> > Not all variants (e.g. ROCK Pi 4B, ROCK 4 Model C Plus, ROCK 4SE) come
> > populated with an SPI flash chip, but have the footprint on the board so
> > a user could solder their own to the board. With this patchset applied,
> > these board variants without an SPI flash chip still boot from MMC.
> > 
> > I have enabled support for both Winbond and XTX SPI flash devices since
> > different hardware variants have different devices populated:
> > 
> >  - `rockpi4_v13_sch_20181112.pdf` contains a Winbond part `W25Q64FWZPIG`
> >  - `rockpi4_v14_sch_20210114.pdf` contains an XTX part `XT25F32BWOIGT`
> > 
> > The ROCK Pi 4 I have is marked as "ROCK PI 4 v1.48" and contains an SPI
> > flash chip from XTX:
> > 
> >     => sf probe
> >     SF: Detected xt25f32 with page size 256 Bytes, erase size 4 KiB, total
> > 4 MiB
> > 
> > In the interest of supporting all board variants and not regressing
> > existing users who boot from MMC, I have enabled support for booting from
> > both SPI flash chip variants in the defconfig and left the environment
> > storage location as MMC to not break existing users who have the
> > environment stored on MMC.
> > 
> > Signed-off-by: Christopher Obbard 
> 
> With a small nit below this is:
> 
> Reviewed-by: Jonas Karlman 
> 
> > 
> > ---
> > 
> > Changes in v2:
> > - Rebase on top of rockchip/for-next.
> > - Sync configuration changes with savedefconfig.
> > - Remove GigaDevice SPI flash chip support (suggested by Kever Y).
> > - Re-enable CONFIG_SPL_FIT_SIGNATURE=y (fixed in rockchip/for-next, solves
> >   multiple problems mentioned in v1. Thanks Jonas!).
> > - Remove spl-boot-order from rk3399-rock-pi-4a-u-boot.dtsi (suggested by
> >   Jonas K).
> > - Enable CONFIG_SPI_FLASH_SFDP_SUPPORT=y (suggested by Jonas K).
> > 
> >  arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi |  7 +++
> >  configs/rock-pi-4-rk3399_defconfig | 17 ++---
> >  2 files changed, 21 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > index 85ee5770add..38385621deb 100644
> > --- a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > +++ b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > @@ -4,3 +4,10 @@
> >   */
> >  
> >  #include "rk3399-rock-pi-4-u-boot.dtsi"
> > +
> > + {
> > +   flash@0 {
> > +   bootph-pre-ram;
> > +   bootph-some-ram;
> > +   };
> > +};
> > diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-
> > rk3399_defconfig
> > index bca44beca12..315b8b853fc 100644
> > --- a/configs/rock-pi-4-rk3399_defconfig
> > +++ b/configs/rock-pi-4-rk3399_defconfig
> > @@ -3,25 +3,30 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
> >  CONFIG_COUNTER_FREQUENCY=2400
> >  CONFIG_ARCH_ROCKCHIP=y
> >  CONFIG_NR_DRAM_BANKS=1
> > +CONFIG_SF_DEFAULT_SPEED=1000
> >  CONFIG_ENV_OFFSET=0x3F8000
> >  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a"
> >  CONFIG_OF_LIBFDT_OVERLAY=y
> >  CONFIG_DM_RESET=y
> >  CONFIG_ROCKCHIP_RK3399=y
> > +CONFIG_ROCKCHIP_SPI_IMAGE=y
> >  CONFIG_TARGET_ROCKPI4_RK3399=y
> >  CONFIG_DEBUG_UART_BASE=0xFF1A
> >  CONFIG_DEBUG_UART_CLOCK=2400
> > +CONFIG_SPL_SPI_FLASH_SUPPORT=y
> > +CONFIG_SPL_SPI=y
> >  CONFIG_SYS_LOAD_ADDR=0x800800
> >  CONFIG_PCI=y
> >  CONFIG_DEBUG_UART=y
> >  # CONFIG_ANDROID_BOOT_IMAGE is not set
> >  CONFIG_SPL_FIT_SIGNATURE=y
> > -CONFIG_LEGACY_IMAGE_FORMAT=y
> 
> This may stop scripts from working.
> 
> I am getting very close to send out a big rk3399 DT sync and update
> series [1] on top of your series. That series will move to imply
> LEGACY_IMAGE_FORMAT in Kconfig file, so this does not matter that much.
> 
> Please let me know if you will revert this line or if I should send out
> my series on top of this patch as-is :-)

Thanks for the review!

I will spin v3 of this series next week.

> 
> [1] https://github.com/Kwiboo/u-boot-rockchip/commits/rk3

[PATCH v2 2/2] rockchip: rock-pi-4-rk3399: enable booting from SPI flash

2024-03-15 Thread Christopher Obbard
Some variants of the ROCK Pi 4 series have an SPI flash chip populated
which can be booted from. This patch enables support in U-Boot for
building the image for the SPI flash, support for booting U-Boot from the
SPI flash chip and support in U-Boot for accessing the SPI flash using
`sf` commands.

Not all variants (e.g. ROCK Pi 4B, ROCK 4 Model C Plus, ROCK 4SE) come
populated with an SPI flash chip, but have the footprint on the board so
a user could solder their own to the board. With this patchset applied,
these board variants without an SPI flash chip still boot from MMC.

I have enabled support for both Winbond and XTX SPI flash devices since
different hardware variants have different devices populated:

 - `rockpi4_v13_sch_20181112.pdf` contains a Winbond part `W25Q64FWZPIG`
 - `rockpi4_v14_sch_20210114.pdf` contains an XTX part `XT25F32BWOIGT`

The ROCK Pi 4 I have is marked as "ROCK PI 4 v1.48" and contains an SPI
flash chip from XTX:

=> sf probe
SF: Detected xt25f32 with page size 256 Bytes, erase size 4 KiB, total 4 MiB

In the interest of supporting all board variants and not regressing
existing users who boot from MMC, I have enabled support for booting from
both SPI flash chip variants in the defconfig and left the environment
storage location as MMC to not break existing users who have the
environment stored on MMC.

Signed-off-by: Christopher Obbard 

---

Changes in v2:
- Rebase on top of rockchip/for-next.
- Sync configuration changes with savedefconfig.
- Remove GigaDevice SPI flash chip support (suggested by Kever Y).
- Re-enable CONFIG_SPL_FIT_SIGNATURE=y (fixed in rockchip/for-next, solves
  multiple problems mentioned in v1. Thanks Jonas!).
- Remove spl-boot-order from rk3399-rock-pi-4a-u-boot.dtsi (suggested by
  Jonas K).
- Enable CONFIG_SPI_FLASH_SFDP_SUPPORT=y (suggested by Jonas K).

 arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi |  7 +++
 configs/rock-pi-4-rk3399_defconfig | 17 ++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
index 85ee5770add..38385621deb 100644
--- a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
@@ -4,3 +4,10 @@
  */
 
 #include "rk3399-rock-pi-4-u-boot.dtsi"
+
+ {
+   flash@0 {
+   bootph-pre-ram;
+   bootph-some-ram;
+   };
+};
diff --git a/configs/rock-pi-4-rk3399_defconfig 
b/configs/rock-pi-4-rk3399_defconfig
index bca44beca12..315b8b853fc 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -3,25 +3,30 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
 CONFIG_COUNTER_FREQUENCY=2400
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_SF_DEFAULT_SPEED=1000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3399=y
+CONFIG_ROCKCHIP_SPI_IMAGE=y
 CONFIG_TARGET_ROCKPI4_RK3399=y
 CONFIG_DEBUG_UART_BASE=0xFF1A
 CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
 CONFIG_SYS_LOAD_ADDR=0x800800
 CONFIG_PCI=y
 CONFIG_DEBUG_UART=y
 # CONFIG_ANDROID_BOOT_IMAGE is not set
 CONFIG_SPL_FIT_SIGNATURE=y
-CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4a.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
 CONFIG_SPL_PAD_TO=0x7f8000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0xE
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
 CONFIG_CMD_BOOTZ=y
@@ -40,14 +45,20 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names 
interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_DFU_MMC=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_XTX=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
 CONFIG_NVME_PCI=y
@@ -61,6 +72,7 @@ CONFIG_RAM_ROCKCHIP_LPDDR4=y
 CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550_MEM32=y
+CONFIG_ROCKCHIP_SPI=y
 CONFIG_SYSRESET=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
@@ -81,7 +93,6 @@ CONFIG_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
 CONFIG_DISPLAY_ROCKCHIP_HDMI=y
-CONFIG_SPL_TINY_MEMSET=y
 CONFIG_ERRNO_STR=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-- 
2.43.0



[PATCH v2 1/2] arm: rockchip: sync ROCK Pi 4A DTS from Linux

2024-03-15 Thread Christopher Obbard
To prepare for ROCK Pi 4A SPI flash support, sync the DTS from Linux which
includes an SPI flash node.

Kernel tag: v6.6-rc1
Kernel commits:
 - eddf73029770 ("arm64: dts: rockchip: Enable internal SPI flash for ROCK \
  Pi 4A/B/C")

Reviewed-by: Kever Yang 
Signed-off-by: Christopher Obbard 
---

Changes in v2:
- Collect Reviewed-by tag from Kever Y.

 arch/arm/dts/rk3399-rock-pi-4a.dts | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/dts/rk3399-rock-pi-4a.dts 
b/arch/arm/dts/rk3399-rock-pi-4a.dts
index 931334aa3d6..d5df8939a65 100644
--- a/arch/arm/dts/rk3399-rock-pi-4a.dts
+++ b/arch/arm/dts/rk3399-rock-pi-4a.dts
@@ -12,3 +12,13 @@
model = "Radxa ROCK Pi 4A";
compatible = "radxa,rockpi4a", "radxa,rockpi4", "rockchip,rk3399";
 };
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+   };
+};
-- 
2.43.0



[PATCH v2 0/2] Enable booting from SPI flash on ROCK Pi 4

2024-03-15 Thread Christopher Obbard
This series brings up and enables booting from the SPI flash present on
some variants of the ROCK Pi 4 in U-Boot.

The first patch syncs the ROCK Pi 4A devicetree from Linux, which contains
the SPI flash node.

The second patch enables support in U-Boot for the SPI flash chip and
booting U-Boot from the SPI flash on the Radxa ROCK Pi 4.

This series may be found at [0].

[0]: 
https://gitlab.collabora.com/obbardc/u-boot/-/tree/wip/obbardc/rockchip-rock4-enable-spi-boot-v2

Changes in v2:
- Collect Reviewed-by tags.
- Rebase on top of rockchip/for-next.
- Sync configuration changes with savedefconfig.
- Remove GigaDevice SPI flash chip support (suggested by Kever Y).
- Re-enable CONFIG_SPL_FIT_SIGNATURE=y (fixed in rockchip/for-next, solves
  multiple problems mentioned in v1. Thanks Jonas!).
- Remove spl-boot-order from rk3399-rock-pi-4a-u-boot.dtsi (suggested by
  Jonas K).
- Enable CONFIG_SPI_FLASH_SFDP_SUPPORT=y (suggested by Jonas K).
- v1: https://lists.denx.de/pipermail/u-boot/2024-March/547173.html

Christopher Obbard (2):
  arm: rockchip: sync ROCK Pi 4A DTS from Linux
  rockchip: rock-pi-4-rk3399: enable booting from SPI flash

 arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi |  7 +++
 arch/arm/dts/rk3399-rock-pi-4a.dts | 10 ++
 configs/rock-pi-4-rk3399_defconfig | 17 ++---
 3 files changed, 31 insertions(+), 3 deletions(-)

-- 
2.43.0



[PATCH v2 2/2] rockchip: spl-boot-order: show DT path for missing device

2024-03-14 Thread Christopher Obbard
When debugging the SPL boot order, the node ID of a device which hasn't
been found is printed but it can be quite hard to relate that to the
specific devicetree node. To aid debugging, print the node path instead of
the cryptic node ID.

Original debug message:

board_boot_order: could not map node @73c to a boot-device

With this patch applied this becomes e.g:

   board_boot_order: could not map node /spi@ff1d/flash@0 to a boot-device

Reviewed-by: Dragan Simic 
Signed-off-by: Christopher Obbard 
---

Changes in v2:
- Improve patch subject (suggested by Dragan S).
- Print node path instead of node ID (suggested by Quentin S).
- Collect Reviewed-by tag from Dragan S.

 arch/arm/mach-rockchip/spl-boot-order.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c 
b/arch/arm/mach-rockchip/spl-boot-order.c
index 8f479ac0ec0..3543267aa57 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -148,8 +148,8 @@ void board_boot_order(u32 *spl_boot_list)
/* Try to map this back onto SPL boot devices */
boot_device = spl_node_to_boot_device(node);
if (boot_device < 0) {
-   debug("%s: could not map node @%x to a boot-device\n",
- __func__, node);
+   debug("%s: could not map node %s to a boot-device\n",
+ __func__, conf);
continue;
}
 
-- 
2.43.0



[PATCH v2 1/2] rockchip: spl-boot-order: fix typo in comment succes→success

2024-03-14 Thread Christopher Obbard
Fix a simple spelling mistake in a comment.

Reviewed-by: Dragan Simic 
Reviewed-by: Quentin Schulz 
Signed-off-by: Christopher Obbard 
---

Changes in v2:
- Improve patch subject (suggested by Dragan S).
- Collect Reviewed-by tags from Dragan S and Quentin S.

 arch/arm/mach-rockchip/spl-boot-order.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c 
b/arch/arm/mach-rockchip/spl-boot-order.c
index 79c856d2a0a..8f479ac0ec0 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -29,7 +29,7 @@
  *   -ENOSYS, if the device matching the node can not be mapped onto a
  *SPL boot device (e.g. the third MMC device)
  *   -1, for unspecified failures
- *   a positive integer (from the BOOT_DEVICE_... family) on succes.
+ *   a positive integer (from the BOOT_DEVICE_... family) on success.
  */
 
 static int spl_node_to_boot_device(int node)
-- 
2.43.0



[PATCH v2 0/2] Trivial fixes for Rockchip SPL boot order

2024-03-14 Thread Christopher Obbard
This series contains some trivial fixes for the Rockchip SPL boot order
driver.

The first patch fixes a typo in a comment.

The second patch prints the full devicetree node path (rather than just
the node ID) in the debug message when a boot device can't be found.

This series may be found at [0].

[0]: 
https://gitlab.collabora.com/obbardc/u-boot/-/tree/wip/obbardc/rockchip-spl-boot-order-fixes-v2

Changes in v2:
- Print node path instead of node ID (suggested by Quentin S).
- Improve patch subjects (suggested by Dragan S).
- Improve cover letter a little.
- Collect Reviewed-by tags.
- Rebase series on top of rockchip/for-next.
- v1: https://lists.denx.de/pipermail/u-boot/2024-March/547175.html

Christopher Obbard (2):
  rockchip: spl-boot-order: fix typo in comment succes→success
  rockchip: spl-boot-order: show DT path for missing device

 arch/arm/mach-rockchip/spl-boot-order.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.0



Re: [PATCH] configs: rockchip: rock5b: enable environment

2024-03-05 Thread Christopher Obbard
Hi Jonas & Trevor,

On Tue, 2024-03-05 at 10:31 +0100, Jonas Karlman wrote:
> Hi Trevor,
> 
> On 2024-03-05 03:10, Trevor Woerner wrote:
> > Following the pattern of other Rockchip devices, enable the U-Boot
> > environment to be stored in MMC. This patch specifically assumes the
> > environment will be stored on the SDcard.
> 
> This board has SPI flash, so storing env in SPI flash is probably a
> better default.

I agree with that.

> However, preferably the env should be stored/loaded from
> the same device that TPL/SPL was loaded from.

Do you know if there is some mechanism in U-Boot to do this already ?

It could be useful to enable autodetection on many boards which can boot U-
Boot from either SPI flash / eMMC / SD card.


Cheers!

Chris

> 
> Regards,
> Jonas
> 
> > 
> > Signed-off-by: Trevor Woerner 
> > ---
> >  configs/rock5b-rk3588_defconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-
> > rk3588_defconfig
> > index 0595325e8107..64a242003aa1 100644
> > --- a/configs/rock5b-rk3588_defconfig
> > +++ b/configs/rock5b-rk3588_defconfig
> > @@ -60,6 +60,8 @@ CONFIG_CMD_REGULATOR=y
> >  CONFIG_SPL_OF_CONTROL=y
> >  CONFIG_OF_LIVE=y
> >  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks
> > assigned-clock-rates assigned-clock-parents"
> > +CONFIG_ENV_IS_IN_MMC=y
> > +CONFIG_SYS_MMC_ENV_DEV=1
> >  CONFIG_SPL_DM_SEQ_ALIAS=y
> >  CONFIG_SPL_REGMAP=y
> >  CONFIG_SPL_SYSCON=y
> 


Re: [PATCH v1 2/2] rockchip: rock-pi-4-rk3399: Enable booting from SPI flash

2024-03-02 Thread Christopher Obbard
Hi Jonas,

On Sat, 2024-03-02 at 16:28 +0100, Jonas Karlman wrote:
> Hi Christopher,
> 
> On 2024-03-02 15:34, Christopher Obbard wrote:
> > Some variants of the ROCK Pi 4 series contain an SPI flash chip, which can
> > be booted from. This patch enables support in U-Boot for building the
> > image for the SPI flash, support for booting U-Boot from the SPI flash
> > chip and support in U-Boot for accessing the SPI flash using `sf`
> > commands.
> > 
> > Not all variants (e.g. ROCK Pi 4B, ROCK 4 Model C Plus, ROCK 4SE) come
> > populated with an SPI flash chip, but have the footprint on the board so
> > a user could solder their own to the board. With this patchset applied,
> > these board variants without an SPI flash chip still boot from MMC.
> > 
> > I have enabled support for both Winbond and XTX SPI flash devices since
> > different hardware variants have different devices populated:
> > 
> >  - `rockpi4_v13_sch_20181112.pdf` contains a Winbond part `W25Q64FWZPIG`
> >  - `rockpi4_v14_sch_20210114.pdf` contains an XTX part `XT25F32BWOIGT`
> > 
> > The ROCK Pi 4 I have is marked as "ROCK PI 4 v1.48" and contains an SPI
> > flash chip from XTX:
> > 
> >     => sf probe
> >     SF: Detected xt25f32 with page size 256 Bytes, erase size 4 KiB, total
> > 4 MiB
> > 
> > In the interest of supporting all board variants and not regressing
> > existing users who boot from MMC, I have enabled support for booting from
> > both SPI flash chip variants in the defconfig and left the environment
> > storage location as MMC to not break existing users who have the
> > environment stored on MMC.
> > 
> > I have also enabled GigaDevice SPI flash chip support, since without it
> > U-Boot (unexplainably) fails to load with an error:
> > 
> >     U-Boot SPL 2024.04-rc3-2-g06b486900e2 (Mar 02 2024 - 13:20:45
> > +)
> >     Trying to boot from SPI
> >     load_simple_fit: Skip load 'atf-5': image size is 0!
> >     initcall failed at call 0029beec (err=-11: Try again)
> >     ### ERROR ### Please RESET the board ###
> 
> This is possibly because of pinctrl no being configured in SPL. I have a
> big incoming rk3399 series that tries to fix this for most rk3399 boards.
> It will be a variant of what I did in [1] for rk3328.

Sounds good! Let me know if you want to take these patches in that series, or
how you wish to work together to not duplicate work. I am open to suggestions
if it makes things easier for Kever to merge ;-).


> 
> BROM will only configure pinctrl for each device it tries to locate IDB
> from, so if it locates IDB in SPL it will not have configured emmc or
> sd-card. So for SPL to be able to fall back on other storage it will
> need to do proper pinctrl.
> 
> [1] https://patchwork.ozlabs.org/cover/1900345/
> 
> > 
> > Building with `CONFIG_SPL_FIT_SIGNATURE=y` causes an error when booting
> > from SPI flash, so I disabled it:
> > 
> >     U-Boot 2024.04-rc3-00010-g2e7974a13b9 (Mar 02 2024 - 14:00:17 +)
> >     SoC: Rockchip rk3399
> >     Reset cause: unknown reset
> >     Model: Radxa ROCK Pi 4A
> >     DRAM:  initcall failed at call 00228efc (err=-19: No such
> > device)
> >     ### ERROR ### Please RESET the board ###
> 
> This is unexpected but if your u-boot.bin is close to or larger then 1
> MiB the stack and pre-alloc heap may be overlapping with U-Boot proper
> or the FDT. That can cause all sort of strange and unexpected issues :-)
> 
> Have another incoming series to address this for RK3328, RK3399 and
> ROCK 5A [2]. Should hit list later today, it will be a rework of [3].

Great, please keep me in CC of those series and I will test & rebase my work
on top.


Thanks!
Chris

> 
> [2]
> https://github.com/Kwiboo/u-boot-rockchip/compare/2011cf069a8b...9767374d6a8a
> [3] https://patchwork.ozlabs.org/cover/1900376/
> 
> > 
> > Signed-off-by: Christopher Obbard 
> > ---
> > 
> >  arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi | 12 
> >  configs/rock-pi-4-rk3399_defconfig | 15 +--
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > index 85ee5770add..04c152a291f 100644
> > --- a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > +++ b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
> > @@ -4,3 +4,15 @@
> >   */
> >  
> >  #include "rk3399-rock-pi-4-u-boot.dtsi"
> > +
> > +/ {
> > +   chosen {
> > +   u

[PATCH v1 2/2] rockchip: spl-boot-order: Improve debugging message when device isn't found

2024-03-02 Thread Christopher Obbard
When debugging the SPL boot order, the node ID of a device which hasn't
been found is printed but it can be quite hard to relate that to the
specific devicetree node. To aid debugging, print the node path as well as
the ID.

Original debug message:

board_boot_order: could not map node @73c to a boot-device

With this patch applied this becomes e.g:

   board_boot_order: could not map node @73c (/spi@ff1d/flash@0) to a 
boot-device

Signed-off-by: Christopher Obbard 
---

 arch/arm/mach-rockchip/spl-boot-order.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c 
b/arch/arm/mach-rockchip/spl-boot-order.c
index e548a7dc718..b23666fb017 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -151,8 +151,8 @@ void board_boot_order(u32 *spl_boot_list)
/* Try to map this back onto SPL boot devices */
boot_device = spl_node_to_boot_device(node);
if (boot_device < 0) {
-   debug("%s: could not map node @%x to a boot-device\n",
- __func__, node);
+   debug("%s: could not map node @%x (%s) to a 
boot-device\n",
+ __func__, node, conf);
continue;
}
 
-- 
2.43.0



[PATCH v1 1/2] rockchip: spl-boot-order: Fix spelling succes→success

2024-03-02 Thread Christopher Obbard
Fix a simple spelling mistake in a comment.

Signed-off-by: Christopher Obbard 
---

 arch/arm/mach-rockchip/spl-boot-order.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c 
b/arch/arm/mach-rockchip/spl-boot-order.c
index 2c39a215c10..e548a7dc718 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -29,7 +29,7 @@
  *   -ENOSYS, if the device matching the node can not be mapped onto a
  *SPL boot device (e.g. the third MMC device)
  *   -1, for unspecified failures
- *   a positive integer (from the BOOT_DEVICE_... family) on succes.
+ *   a positive integer (from the BOOT_DEVICE_... family) on success.
  */
 
 static int spl_node_to_boot_device(int node)
-- 
2.43.0



[PATCH v1 0/2] Trivial fixes for Rockchip's SPL boot order

2024-03-02 Thread Christopher Obbard
This series contains some trivial fixes.

The first patch fixes a spelling mistake in a comment.

The second patch adds the full devicetree node path (rather than just the
ID) in the debug message when a boot device can't be found.

This series may be found at [0].

[0]: 
https://gitlab.collabora.com/obbardc/u-boot/-/tree/wip/obbardc/rockchip-spl-boot-order-fixes-v1


Christopher Obbard (2):
  rockchip: spl-boot-order: Fix spelling succes→success
  rockchip: spl-boot-order: Improve debugging message when device isn't
found

 arch/arm/mach-rockchip/spl-boot-order.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.0



[PATCH v1 2/2] rockchip: rock-pi-4-rk3399: Enable booting from SPI flash

2024-03-02 Thread Christopher Obbard
Some variants of the ROCK Pi 4 series contain an SPI flash chip, which can
be booted from. This patch enables support in U-Boot for building the
image for the SPI flash, support for booting U-Boot from the SPI flash
chip and support in U-Boot for accessing the SPI flash using `sf` commands.

Not all variants (e.g. ROCK Pi 4B, ROCK 4 Model C Plus, ROCK 4SE) come
populated with an SPI flash chip, but have the footprint on the board so
a user could solder their own to the board. With this patchset applied,
these board variants without an SPI flash chip still boot from MMC.

I have enabled support for both Winbond and XTX SPI flash devices since
different hardware variants have different devices populated:

 - `rockpi4_v13_sch_20181112.pdf` contains a Winbond part `W25Q64FWZPIG`
 - `rockpi4_v14_sch_20210114.pdf` contains an XTX part `XT25F32BWOIGT`

The ROCK Pi 4 I have is marked as "ROCK PI 4 v1.48" and contains an SPI
flash chip from XTX:

=> sf probe
SF: Detected xt25f32 with page size 256 Bytes, erase size 4 KiB, total 4 MiB

In the interest of supporting all board variants and not regressing
existing users who boot from MMC, I have enabled support for booting from
both SPI flash chip variants in the defconfig and left the environment
storage location as MMC to not break existing users who have the
environment stored on MMC.

I have also enabled GigaDevice SPI flash chip support, since without it
U-Boot (unexplainably) fails to load with an error:

U-Boot SPL 2024.04-rc3-2-g06b486900e2 (Mar 02 2024 - 13:20:45 +)
Trying to boot from SPI
load_simple_fit: Skip load 'atf-5': image size is 0!
initcall failed at call 0029beec (err=-11: Try again)
### ERROR ### Please RESET the board ###

Building with `CONFIG_SPL_FIT_SIGNATURE=y` causes an error when booting
from SPI flash, so I disabled it:

U-Boot 2024.04-rc3-00010-g2e7974a13b9 (Mar 02 2024 - 14:00:17 +)
SoC: Rockchip rk3399
Reset cause: unknown reset
Model: Radxa ROCK Pi 4A
DRAM:  initcall failed at call 00228efc (err=-19: No such device)
### ERROR ### Please RESET the board ###

Signed-off-by: Christopher Obbard 
---

 arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi | 12 
 configs/rock-pi-4-rk3399_defconfig | 15 +--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
index 85ee5770add..04c152a291f 100644
--- a/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
@@ -4,3 +4,15 @@
  */
 
 #include "rk3399-rock-pi-4-u-boot.dtsi"
+
+/ {
+   chosen {
+   u-boot,spl-boot-order = "same-as-spl", _flash, , 

+   };
+};
+
+ {
+   spi_flash: flash@0 {
+   bootph-all;
+   };
+};
diff --git a/configs/rock-pi-4-rk3399_defconfig 
b/configs/rock-pi-4-rk3399_defconfig
index 83fc4ad7dab..3a38b51c46b 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -6,25 +6,28 @@ CONFIG_TEXT_BASE=0x0020
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x30
+CONFIG_SF_DEFAULT_SPEED=1000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3399=y
+CONFIG_ROCKCHIP_SPI_IMAGE=y
 CONFIG_TARGET_EVB_RK3399=y
 CONFIG_SPL_STACK=0x40
 CONFIG_DEBUG_UART_BASE=0xFF1A
 CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
 CONFIG_SYS_LOAD_ADDR=0x800800
 CONFIG_PCI=y
 CONFIG_DEBUG_UART=y
 # CONFIG_ANDROID_BOOT_IMAGE is not set
-CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4a.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x40
@@ -33,6 +36,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x1
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0xE
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
 CONFIG_CMD_BOOTZ=y
@@ -52,6 +57,7 @@ CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names 
clock-names interrupt-parent
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DFU_MMC=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
@@ -61,6 +67,10 @@ CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_XTX=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
 CONFIG_NVME_PCI=y
@@ -74,6 +84,7 @@ CONFIG_RAM_ROCKCHIP_LP

[PATCH v1 0/2] Enable booting from SPI flash on ROCK Pi 4

2024-03-02 Thread Christopher Obbard
This series brings up and enables booting from the SPI flash present on
some variants of the ROCK Pi 4 in U-Boot.

The first patch syncs the ROCK Pi 4A devicetree from Linux, which contains
the SPI flash node.

The second patch enables support in U-Boot for the SPI flash chip and
booting U-Boot from the SPI flash on the Radxa ROCK Pi 4.

This series may be found at [0].

[0]: 
https://gitlab.collabora.com/obbardc/u-boot/-/tree/wip/obbardc/rockchip-rock4-enable-spi-boot-v1


Christopher Obbard (2):
  arm: rockchip: sync ROCK Pi 4A DTS from Linux
  rockchip: rock-pi-4-rk3399: Enable booting from SPI flash

 arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi | 12 
 arch/arm/dts/rk3399-rock-pi-4a.dts | 10 ++
 configs/rock-pi-4-rk3399_defconfig | 15 +--
 3 files changed, 35 insertions(+), 2 deletions(-)

-- 
2.43.0



[PATCH v1 1/2] arm: rockchip: sync ROCK Pi 4A DTS from Linux

2024-03-02 Thread Christopher Obbard
To prepare for ROCK Pi 4A SPI flash support, sync the DTS from Linux which
includes an SPI flash node.

Kernel tag: v6.6-rc1
Kernel commits:
 - eddf73029770 ("arm64: dts: rockchip: Enable internal SPI flash for ROCK \
  Pi 4A/B/C")

Signed-off-by: Christopher Obbard 
---

 arch/arm/dts/rk3399-rock-pi-4a.dts | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/dts/rk3399-rock-pi-4a.dts 
b/arch/arm/dts/rk3399-rock-pi-4a.dts
index 931334aa3d6..d5df8939a65 100644
--- a/arch/arm/dts/rk3399-rock-pi-4a.dts
+++ b/arch/arm/dts/rk3399-rock-pi-4a.dts
@@ -12,3 +12,13 @@
model = "Radxa ROCK Pi 4A";
compatible = "radxa,rockpi4a", "radxa,rockpi4", "rockchip,rk3399";
 };
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+   };
+};
-- 
2.43.0



Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

2024-02-18 Thread Christopher Obbard
Hi Jonas,

On Sat, 2024-02-17 at 18:35 +, Jonas Karlman wrote:
> Move ROCK Pi 4 specific board code from the shared evb_rk3399 target
> into its own board target and update related defconfigs to use the new
> TARGET_ROCKPI4_RK3399 option.
> 
> Also move the call to gpt_capsule_update_setup() from the weak function
> rk_board_late_init() into the main board_late_init() function.
> 
> Signed-off-by: Jonas Karlman 

Reviewed-by: Christopher Obbard 

> ---
>  arch/arm/mach-rockchip/board.c    | 10 +++---
>  arch/arm/mach-rockchip/rk3399/Kconfig |  6 
>  board/radxa/rockpi4-rk3399/Kconfig    | 15 +
>  board/radxa/rockpi4-rk3399/MAINTAINERS    | 29 +
>  .../rockpi4-rk3399}/Makefile  |  2 +-
>  .../rockpi4-rk3399/rockpi4-rk3399.c}  | 13 ++--
>  board/rockchip/evb_rk3399/MAINTAINERS | 29 -
>  configs/rock-4c-plus-rk3399_defconfig |  2 +-
>  configs/rock-4se-rk3399_defconfig |  2 +-
>  configs/rock-pi-4-rk3399_defconfig    |  2 +-
>  configs/rock-pi-4c-rk3399_defconfig   |  2 +-
>  include/configs/rk3399_common.h   | 16 --
>  include/configs/rockpi4-rk3399.h  | 32 +++
>  13 files changed, 95 insertions(+), 65 deletions(-)
>  create mode 100644 board/radxa/rockpi4-rk3399/Kconfig
>  create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS
>  rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%)
>  rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-
> rk3399/rockpi4-rk3399.c} (79%)
>  create mode 100644 include/configs/rockpi4-rk3399.h
> 
> diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
> index 4f666aee706f..dea5805c4665 100644
> --- a/arch/arm/mach-rockchip/board.c
> +++ b/arch/arm/mach-rockchip/board.c
> @@ -34,7 +34,7 @@
>  #include 
>  #include 
>  
> -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) &&
> defined(CONFIG_EFI_PARTITION)
> +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) &&
> IS_ENABLED(CONFIG_EFI_PARTITION)
>  
>  #define DFU_ALT_BUF_LEN  SZ_1K
>  
> @@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void)
>  
>  __weak int rk_board_late_init(void)
>  {
> -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) &&
> defined(CONFIG_EFI_PARTITION)
> - gpt_capsule_update_setup();
> -#endif
> -
>   return 0;
>  }
>  
> @@ -196,6 +192,10 @@ int board_late_init(void)
>  {
>   setup_boot_mode();
>  
> +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) &&
> IS_ENABLED(CONFIG_EFI_PARTITION)
> + gpt_capsule_update_setup();
> +#endif
> +
>   return rk_board_late_init();
>  }
>  
> diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-
> rockchip/rk3399/Kconfig
> index d01063ac98b6..bf3600aee2ad 100644
> --- a/arch/arm/mach-rockchip/rk3399/Kconfig
> +++ b/arch/arm/mach-rockchip/rk3399/Kconfig
> @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399
>      * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only),
>    1x USB 3.0 type C OTG
>  
> +config TARGET_ROCKPI4_RK3399
> + bool "Radxa ROCK Pi 4 board"
> + help
> +   Support for ROCK Pi 4 board family by Radxa.
> +
>  config TARGET_ROCKPRO64_RK3399
>   bool "Pine64 Rockpro64 board"
>   help
> @@ -174,6 +179,7 @@ source "board/google/gru/Kconfig"
>  source "board/pine64/pinebook-pro-rk3399/Kconfig"
>  source "board/pine64/pinephone-pro-rk3399/Kconfig"
>  source "board/pine64/rockpro64_rk3399/Kconfig"
> +source "board/radxa/rockpi4-rk3399/Kconfig"
>  source "board/rockchip/evb_rk3399/Kconfig"
>  source "board/theobroma-systems/puma_rk3399/Kconfig"
>  source "board/vamrs/rock960_rk3399/Kconfig"
> diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-
> rk3399/Kconfig
> new file mode 100644
> index ..d82663506b12
> --- /dev/null
> +++ b/board/radxa/rockpi4-rk3399/Kconfig
> @@ -0,0 +1,15 @@
> +if TARGET_ROCKPI4_RK3399
> +
> +config SYS_BOARD
> + default "rockpi4-rk3399"
> +
> +config SYS_VENDOR
> + default "radxa"
> +
> +config SYS_CONFIG_NAME
> + default "rockpi4-rk3399"
> +
> +config BOARD_SPECIFIC_OPTIONS # dummy
> + def_bool y
> +
> +endif
> diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-
> rk3399/MAINTAINERS
> new file mode 100644
> index ..12d4f35af881
> --- /dev/null
> +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS
> @@

Re: [PATCH 0/4] rockchip: Read cpuid and generate MAC address from efuse for RK3328 and RK3399

2024-02-10 Thread Christopher Obbard
Hi Chen-Yu,

For the entire series:

Reviewed-by: Christopher Obbard 

On 10 February 2024 06:32:46 GMT, Chen-Yu Tsai  wrote:
>From: Chen-Yu Tsai 
>
>Hi folks,
>
>This series enables ROCKCHIP_EFUSE and MISC_INIT_R by default for RK3328
>and RK3399 so that the cpuid is read from the efuse and used to generate
>a serial number and MAC addresses for all boards.
>
>This stacks on top of the recent defconfig update series [1] from Jonas.
>
>[1] https://lore.kernel.org/u-boot/20240207000301.3270722-1-jo...@kwiboo.se/
>
>
>Chen-Yu Tsai (4):
>  rockchip: rk3328: Read cpuid and generate MAC address from efuse
>  rockchip: rk3399: Read cpuid and generate MAC address from efuse
>  rockchip: rk3328: regenerate defconfigs
>  rockchip: rk3399: regenerate defconfigs
>
> arch/arm/mach-rockchip/Kconfig| 4 
> configs/chromebook_bob_defconfig  | 2 --
> configs/chromebook_kevin_defconfig| 2 --
> configs/evb-rk3328_defconfig  | 2 --
> configs/firefly-rk3399_defconfig  | 2 --
> configs/nanopi-r2c-plus-rk3328_defconfig  | 2 --
> configs/nanopi-r2c-rk3328_defconfig   | 2 --
> configs/nanopi-r2s-rk3328_defconfig   | 2 --
> configs/nanopi-r4s-rk3399_defconfig   | 2 --
> configs/orangepi-r1-plus-lts-rk3328_defconfig | 2 --
> configs/orangepi-r1-plus-rk3328_defconfig | 2 --
> configs/pinebook-pro-rk3399_defconfig | 2 --
> configs/pinephone-pro-rk3399_defconfig| 2 --
> configs/puma-rk3399_defconfig | 2 --
> configs/roc-cc-rk3328_defconfig   | 2 --
> configs/roc-pc-mezzanine-rk3399_defconfig | 2 --
> configs/roc-pc-rk3399_defconfig   | 2 --
> configs/rock-4c-plus-rk3399_defconfig | 3 ---
> configs/rock-4se-rk3399_defconfig | 3 ---
> configs/rock-pi-4-rk3399_defconfig| 3 ---
> configs/rock-pi-4c-rk3399_defconfig   | 3 ---
> configs/rock-pi-e-rk3328_defconfig| 2 --
> configs/rock-pi-n10-rk3399pro_defconfig   | 1 -
> configs/rock64-rk3328_defconfig   | 2 --
> configs/rock960-rk3399_defconfig  | 1 -
> configs/rockpro64-rk3399_defconfig| 2 --
> 26 files changed, 4 insertions(+), 52 deletions(-)
>
>-- 
>2.39.2
>


Re: [PATCH 1/5] board: rockchip: Add Pine64 Quartz64-A Board

2023-10-17 Thread Christopher Obbard
Hi Jonas,

On Sat, 2023-10-14 at 21:22 +0200, Jonas Karlman wrote:
> On 2023-10-14 20:58, Jonas Karlman wrote:
> > Hi Christopher,
> > 
> > On 2023-10-12 13:46, Christopher Obbard wrote:
> > > Hi Jonas,
> > > 
> > > On Thu, 2023-10-12 at 10:51 +0100, Christopher Obbard wrote:
> > > > Hi Jonas,
> > > > 
> > > > Sorry for the late response, I've been meaning to test this for a while 
> > > > but not got around to it.
> > > > 
> > > > On Thu, 2023-08-17 at 23:56 +, Jonas Karlman wrote:
> > > > > Hi Christopher,
> > > > > 
> > > > > On 2023-08-08 16:25, Christopher Obbard wrote:
> > > > > > Hi Jonas,
> > > > > > 
> > > > > > On Sun, 2023-07-23 at 15:04 +, Jonas Karlman wrote:
> > > > > > > On 2023-07-23 16:55, Jonas Karlman wrote:
> > > > > > > > The Pine64 Quartz64 Model A is a single-board computer based on 
> > > > > > > > the
> > > > > > > > Rockchip RK3566 SoC. The board features USB3, SATA, PCIe, HDMI, 
> > > > > > > > USB2.0,
> > > > > > > > CSI, DSI, eDP, eMMC, SD, and an e-paper parallel port, as well 
> > > > > > > > as a
> > > > > > > > 20 pin GPIO header.
> > > > > > > > 
> > > > > > > > Features tested on a Quartz64-A 8GB v2.0 2021-04-27:
> > > > > > > > - SD-card boot
> > > > > > > > - eMMC boot
> > > > > > > > - PCIe/NVMe/AHCI
> > > > > > > > - USB host
> > > > > > > > 
> > > > > > > > Device tree is imported from linux v6.4.
> > > > > > > > 
> > > > > > > > Co-developed-by: Nicolas Frattaroli 
> > > > > > > > 
> > > > > > > > Signed-off-by: Nicolas Frattaroli 
> > > > > > > > Signed-off-by: Jonas Karlman 
> > > > > > > > ---
> > > > > > > 
> > > > > > > [...]
> > > > > > > 
> > > > > > > Boot log with ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and
> > > > > > > BL31=rk3568_bl31_v1.43.elf:
> > > > > > > 
> > > > > > > [...]
> > > > > > > 
> > > > > > > U-Boot 2023.07 (Jul 23 2023 - 12:42:18 +)
> > > > > > > 
> > > > > > > Model: Pine64 RK3566 Quartz64-A Board
> > > > > > > DRAM:  8 GiB (effective 7.7 GiB)
> > > > > > > PMIC:  RK8170 (on=0x10, off=0x00)
> > > > > > > Core:  321 devices, 27 uclasses, devicetree: separate
> > > > > > > MMC:   rockchip_sdhci_probe clk set rate fail!
> > > > > > > mmc@fe2b: 1, mmc@fe2c: 2, mmc@fe31: 0
> > > > > > > Loading Environment from nowhere... OK
> > > > > > > In:    serial@fe66
> > > > > > > Out:   serial@fe66
> > > > > > > Err:   serial@fe66
> > > > > > > Model: Pine64 RK3566 Quartz64-A Board
> > > > > > > Net:   No ethernet found.
> > > > > > > 
> > > > > > > Hit any key to stop autoboot:  0
> > > > > > > =>
> > > > > > 
> > > > > > 
> > > > > > I just tried booting U-Boot v2023.10-rc2 with 
> > > > > > ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and 
> > > > > > BL31=rk3568_bl31_v1.43.elf, on my Quartz64-A but it fails during
> > > > > > loading of some parts. I removed the output of the RK TPL from my 
> > > > > > logs as there were no errors.
> > > > > 
> > > > > Try with latest rk3566_ddr_1056MHz_v1.18.bin and see if that makes any
> > > > > difference.
> > > > 
> > > > No difference.
> > > > 
> > > > I've also checked, there is no other maskrom bootable media such as SPI 
> > > > flash connected to the board.
> > > > 
> > > > > 
> > > > > > This is when booting from eMMC.
> > > > > 
> > > > > Does it boot with SD-card or other eMMC modules?
> > > > 
> > > > Booting from SD card (without eMMC connected), everything works fine.
> > > >

Re: [PATCH 1/5] board: rockchip: Add Pine64 Quartz64-A Board

2023-10-12 Thread Christopher Obbard
Hi Jonas,

On Thu, 2023-10-12 at 10:51 +0100, Christopher Obbard wrote:
> Hi Jonas,
> 
> Sorry for the late response, I've been meaning to test this for a while but 
> not got around to it.
> 
> On Thu, 2023-08-17 at 23:56 +, Jonas Karlman wrote:
> > Hi Christopher,
> > 
> > On 2023-08-08 16:25, Christopher Obbard wrote:
> > > Hi Jonas,
> > > 
> > > On Sun, 2023-07-23 at 15:04 +, Jonas Karlman wrote:
> > > > On 2023-07-23 16:55, Jonas Karlman wrote:
> > > > > The Pine64 Quartz64 Model A is a single-board computer based on the
> > > > > Rockchip RK3566 SoC. The board features USB3, SATA, PCIe, HDMI, 
> > > > > USB2.0,
> > > > > CSI, DSI, eDP, eMMC, SD, and an e-paper parallel port, as well as a
> > > > > 20 pin GPIO header.
> > > > > 
> > > > > Features tested on a Quartz64-A 8GB v2.0 2021-04-27:
> > > > > - SD-card boot
> > > > > - eMMC boot
> > > > > - PCIe/NVMe/AHCI
> > > > > - USB host
> > > > > 
> > > > > Device tree is imported from linux v6.4.
> > > > > 
> > > > > Co-developed-by: Nicolas Frattaroli 
> > > > > Signed-off-by: Nicolas Frattaroli 
> > > > > Signed-off-by: Jonas Karlman 
> > > > > ---
> > > > 
> > > > [...]
> > > > 
> > > > Boot log with ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and
> > > > BL31=rk3568_bl31_v1.43.elf:
> > > > 
> > > > [...]
> > > > 
> > > > U-Boot 2023.07 (Jul 23 2023 - 12:42:18 +)
> > > > 
> > > > Model: Pine64 RK3566 Quartz64-A Board
> > > > DRAM:  8 GiB (effective 7.7 GiB)
> > > > PMIC:  RK8170 (on=0x10, off=0x00)
> > > > Core:  321 devices, 27 uclasses, devicetree: separate
> > > > MMC:   rockchip_sdhci_probe clk set rate fail!
> > > > mmc@fe2b: 1, mmc@fe2c: 2, mmc@fe31: 0
> > > > Loading Environment from nowhere... OK
> > > > In:    serial@fe66
> > > > Out:   serial@fe66
> > > > Err:   serial@fe66
> > > > Model: Pine64 RK3566 Quartz64-A Board
> > > > Net:   No ethernet found.
> > > > 
> > > > Hit any key to stop autoboot:  0
> > > > =>
> > > 
> > > 
> > > I just tried booting U-Boot v2023.10-rc2 with 
> > > ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and BL31=rk3568_bl31_v1.43.elf, 
> > > on my Quartz64-A but it fails during
> > > loading of some parts. I removed the output of the RK TPL from my logs as 
> > > there were no errors.
> > 
> > Try with latest rk3566_ddr_1056MHz_v1.18.bin and see if that makes any
> > difference.
> 
> No difference.
> 
> I've also checked, there is no other maskrom bootable media such as SPI flash 
> connected to the board.
> 
> > 
> > > This is when booting from eMMC.
> > 
> > Does it boot with SD-card or other eMMC modules?
> 
> Booting from SD card (without eMMC connected), everything works fine.
> 
> > 
> 
> > > I also tried building your branch from 
> > > https://github.com/Kwiboo/u-boot-rockchip/tree/rk3568-2023.10 and 
> > 
> > Please try with a GitHub actions built u-boot-rockchip.bin based on my
> > rk3568-2023.07.02 branch at
> > https://github.com/Kwiboo/u-boot-build/actions/runs/561235
> 
> With that exact artifact, flashed with:
> 
> > rkdeveloptool db rk356x_spl_loader_v1.18.113.bin
> > rkdeveloptool ef
> > rkdeveloptool wl 64 u-boot-rockchip.bin
> > rkdeveloptool rd
> 
> it fails to boot with with:
> 
> > DDR V1.18 f366f69a7d typ 23/07/17-15:48:58
> > ln
> > LP4/4x derate en, other dram:1x trefi
> > SRX
> > ddrconfig:7
> > LPDDR4X, 324MHz
> > BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=8 Size=8192MB
> > 
> > change to: 324MHz
> > clk skew:0x60
> > 
> > change to: 528MHz
> > clk skew:0x58
> > 
> > change to: 780MHz
> > clk skew:0x58
> > 
> > change to: 1056MHz(final freq)
> > clk skew:0x32
> > out
> > 
> > U-Boot SPL 2023.07.02-g09919887 (Aug 06 2023 - 16:59:31 +)
> > Trying to boot from MMC1
> > spl: mmc init failed with error: -70
> > Trying to boot from MMC2
> > Card did not respond to voltage select! : -110
> > spl: mmc init failed with error: -95
> > Trying to boot from MMC1
> > mmc fail to send stop cmd
> > mmc_load_image_raw_

Re: [PATCH 1/5] board: rockchip: Add Pine64 Quartz64-A Board

2023-10-12 Thread Christopher Obbard
Hi Jonas,

Sorry for the late response, I've been meaning to test this for a while but not 
got around to it.

On Thu, 2023-08-17 at 23:56 +, Jonas Karlman wrote:
> Hi Christopher,
> 
> On 2023-08-08 16:25, Christopher Obbard wrote:
> > Hi Jonas,
> > 
> > On Sun, 2023-07-23 at 15:04 +, Jonas Karlman wrote:
> > > On 2023-07-23 16:55, Jonas Karlman wrote:
> > > > The Pine64 Quartz64 Model A is a single-board computer based on the
> > > > Rockchip RK3566 SoC. The board features USB3, SATA, PCIe, HDMI, USB2.0,
> > > > CSI, DSI, eDP, eMMC, SD, and an e-paper parallel port, as well as a
> > > > 20 pin GPIO header.
> > > > 
> > > > Features tested on a Quartz64-A 8GB v2.0 2021-04-27:
> > > > - SD-card boot
> > > > - eMMC boot
> > > > - PCIe/NVMe/AHCI
> > > > - USB host
> > > > 
> > > > Device tree is imported from linux v6.4.
> > > > 
> > > > Co-developed-by: Nicolas Frattaroli 
> > > > Signed-off-by: Nicolas Frattaroli 
> > > > Signed-off-by: Jonas Karlman 
> > > > ---
> > > 
> > > [...]
> > > 
> > > Boot log with ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and
> > > BL31=rk3568_bl31_v1.43.elf:
> > > 
> > > [...]
> > > 
> > > U-Boot 2023.07 (Jul 23 2023 - 12:42:18 +)
> > > 
> > > Model: Pine64 RK3566 Quartz64-A Board
> > > DRAM:  8 GiB (effective 7.7 GiB)
> > > PMIC:  RK8170 (on=0x10, off=0x00)
> > > Core:  321 devices, 27 uclasses, devicetree: separate
> > > MMC:   rockchip_sdhci_probe clk set rate fail!
> > > mmc@fe2b: 1, mmc@fe2c: 2, mmc@fe31: 0
> > > Loading Environment from nowhere... OK
> > > In:    serial@fe66
> > > Out:   serial@fe66
> > > Err:   serial@fe66
> > > Model: Pine64 RK3566 Quartz64-A Board
> > > Net:   No ethernet found.
> > > 
> > > Hit any key to stop autoboot:  0
> > > =>
> > 
> > 
> > I just tried booting U-Boot v2023.10-rc2 with 
> > ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and BL31=rk3568_bl31_v1.43.elf, 
> > on my Quartz64-A but it fails during
> > loading of some parts. I removed the output of the RK TPL from my logs as 
> > there were no errors.
> 
> Try with latest rk3566_ddr_1056MHz_v1.18.bin and see if that makes any
> difference.

No difference.

I've also checked, there is no other maskrom bootable media such as SPI flash 
connected to the board.

> 
> > This is when booting from eMMC.
> 
> Does it boot with SD-card or other eMMC modules?

Booting from SD card (without eMMC connected), everything works fine.

> 

> > I also tried building your branch from 
> > https://github.com/Kwiboo/u-boot-rockchip/tree/rk3568-2023.10 and 
> 
> Please try with a GitHub actions built u-boot-rockchip.bin based on my
> rk3568-2023.07.02 branch at
> https://github.com/Kwiboo/u-boot-build/actions/runs/561235

With that exact artifact, flashed with:

> rkdeveloptool db rk356x_spl_loader_v1.18.113.bin
> rkdeveloptool ef
> rkdeveloptool wl 64 u-boot-rockchip.bin
> rkdeveloptool rd

it fails to boot with with:

> DDR V1.18 f366f69a7d typ 23/07/17-15:48:58
> ln
> LP4/4x derate en, other dram:1x trefi
> SRX
> ddrconfig:7
> LPDDR4X, 324MHz
> BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=8 Size=8192MB
> 
> change to: 324MHz
> clk skew:0x60
> 
> change to: 528MHz
> clk skew:0x58
> 
> change to: 780MHz
> clk skew:0x58
> 
> change to: 1056MHz(final freq)
> clk skew:0x32
> out
> 
> U-Boot SPL 2023.07.02-g09919887 (Aug 06 2023 - 16:59:31 +)
> Trying to boot from MMC1
> spl: mmc init failed with error: -70
> Trying to boot from MMC2
> Card did not respond to voltage select! : -110
> spl: mmc init failed with error: -95
> Trying to boot from MMC1
> mmc fail to send stop cmd
> mmc_load_image_raw_sector: mmc block read error
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###

I also tried a second eMMC, but it also failed to boot with the same "mmc block 
read error" message.


> 
> What happens if you write u-boot-rockchip.bin to eMMC module usinga USB 
> adapter:
> 
>   dd if=u-boot-rockchip.bin of=/dev/ bs=32k seek=1 conv=fsync
> 
> or using U-Boot cmd when booted from a SD-card?
> 
>   # Read u-boot-rockchip.bin from first partition of a SD card
>   load mmc 1:1 1000 u-boot-rockchip.bin
> 
>   # Change to eMMC
>   mmc dev 0
> 
>   # Write 10 MiB (0x5000 blocks) at sector 64 (0x40)
>   mmc write $fileaddr 40 5

Re: [PATCH 2/4] rockchip: rk3588-rock-5b: Enable support for PCIe SATA cards

2023-10-11 Thread Christopher Obbard
Hi Jonas,

On Tue, 2023-10-10 at 22:23 +, Jonas Karlman wrote:
> Enable support for PCIe SATA cards and the on-board SATA controller.
> 
> This also revert use of CONFIG_PCI_INIT_R in order to speed up boot from
> eMMC or SD-cards. Standard boot will initialize pci after faster boot
> media have been enumerated.
> 
> Signed-off-by: Jonas Karlman 

With this patch applied, things work perfectly and the boot falls back to 
booting from ethernet
just fine. Thank you!

Reviewed-by: Christopher Obbard 
Tested-by: Christopher Obbard 

> ---
> Cc: Christopher Obbard 
> ---
>  configs/rock5b-rk3588_defconfig | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig
> index 447913faccc4..ec22e70033a0 100644
> --- a/configs/rock5b-rk3588_defconfig
> +++ b/configs/rock5b-rk3588_defconfig
> @@ -26,6 +26,7 @@ CONFIG_SPL_SPI=y
>  CONFIG_SYS_LOAD_ADDR=0xc00800
>  CONFIG_PCI=y
>  CONFIG_DEBUG_UART=y
> +CONFIG_AHCI=y
>  CONFIG_FIT=y
>  CONFIG_FIT_VERBOSE=y
>  CONFIG_SPL_FIT_SIGNATURE=y
> @@ -35,7 +36,6 @@ CONFIG_OF_BOARD_SETUP=y
>  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb"
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_DISPLAY_BOARDINFO_LATE=y
> -CONFIG_PCI_INIT_R=y
>  CONFIG_SPL_MAX_SIZE=0x4
>  CONFIG_SPL_PAD_TO=0x7f8000
>  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> @@ -63,6 +63,8 @@ CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent 
> assigned-clocks assigne
>  CONFIG_SPL_DM_SEQ_ALIAS=y
>  CONFIG_SPL_REGMAP=y
>  CONFIG_SPL_SYSCON=y
> +CONFIG_AHCI_PCI=y
> +CONFIG_DWC_AHCI=y
>  CONFIG_SPL_CLK=y
>  # CONFIG_USB_FUNCTION_FASTBOOT is not set
>  CONFIG_ROCKCHIP_GPIO=y
> @@ -89,6 +91,8 @@ CONFIG_SPL_PINCTRL=y
>  CONFIG_REGULATOR_PWM=y
>  CONFIG_PWM_ROCKCHIP=y
>  CONFIG_SPL_RAM=y
> +CONFIG_SCSI=y
> +CONFIG_DM_SCSI=y
>  CONFIG_BAUDRATE=150
>  CONFIG_DEBUG_UART_SHIFT=2
>  CONFIG_SYS_NS16550_MEM32=y




Re: [PATCH 3/4] rockchip: rk3588-rock-5b: Sync USB3 nodes from mainline linux patches

2023-10-11 Thread Christopher Obbard
Hi Jonas,

On Tue, 2023-10-10 at 22:23 +, Jonas Karlman wrote:
> The device tree for rk3588 and rock-5b contain usb3 nodes that have
> deviated too much from current state of submitted mainline linux usb3
> patches, see [1].
> 
> Sync usb3 related nodes from latest patches and collaboras rk3588 tree
> so that dwc3-generic driver can be updated to include support for the
> rockchip,rk3588-dwc3 compatible.
> 
> [1] 
> https://lore.kernel.org/lkml/20231009172129.43568-1-sebastian.reic...@collabora.com/
> 
> Signed-off-by: Jonas Karlman 

These will be upstream shortly. Maybe we can wait until they appear in Heiko's 
tree?

> ---
> Cc: Sebastian Reichel 
> ---
>  arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 148 +++-
>  arch/arm/dts/rk3588-u-boot.dtsi |  39 +++
>  arch/arm/dts/rk3588s-u-boot.dtsi    |  68 ++-
>  configs/rock5b-rk3588_defconfig |   1 -
>  4 files changed, 99 insertions(+), 157 deletions(-)
> 
> diff --git a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi 
> b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
> index 3f390ef26a3f..b595ddef7028 100644
> --- a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
> +++ b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
> @@ -19,38 +19,10 @@
>   regulator-min-microvolt = <1200>;
>   regulator-max-microvolt = <1200>;
>   };
> +};
>  
> - vcc5v0_usbdcin: vcc5v0-usbdcin {
> - compatible = "regulator-fixed";
> - regulator-name = "vcc5v0_usbdcin";
> - regulator-always-on;
> - regulator-boot-on;
> - regulator-min-microvolt = <500>;
> - regulator-max-microvolt = <500>;
> - vin-supply = <_dcin>;
> - };
> -
> - vcc5v0_usb: vcc5v0-usb {
> - compatible = "regulator-fixed";
> - regulator-name = "vcc5v0_usb";
> - regulator-always-on;
> - regulator-boot-on;
> - regulator-min-microvolt = <500>;
> - regulator-max-microvolt = <500>;
> - vin-supply = <_usbdcin>;
> - };
> -
> - vbus5v0_typec: vbus5v0-typec {
> - compatible = "regulator-fixed";
> - regulator-name = "vbus5v0_typec";
> - regulator-min-microvolt = <500>;
> - regulator-max-microvolt = <500>;
> - enable-active-high;
> - gpio = < RK_PB6 GPIO_ACTIVE_HIGH>;
> - vin-supply = <_usb>;
> - pinctrl-names = "default";
> - pinctrl-0 = <_pwren>;
> - };
> +_psu {
> + status = "okay";
>  };
>  
>  _pins {
> @@ -58,13 +30,9 @@
>  };
>  
>   {
> - usb-typec {
> + usb {
>   usbc0_int: usbc0-int {
> - rockchip,pins = <3 RK_PB4 RK_FUNC_GPIO _pull_up>;
> - };
> -
> - typec5v_pwren: typec5v-pwren {
> - rockchip,pins = <2 RK_PB6 RK_FUNC_GPIO _pull_none>;
> + rockchip,pins = <3 RK_PB4 RK_FUNC_GPIO _pull_none>;
>   };
>   };
>  };
> @@ -97,7 +65,6 @@
>  };
>  
>  _otg {
> - rockchip,typec-vbus-det;
>   status = "okay";
>  };
>  
> @@ -109,25 +76,17 @@
>   status = "okay";
>  };
>  
> -_grf {
> +_phy1 {
>   status = "okay";
>  };
>  
> -_grf {
> +_phy1_u3 {
>   status = "okay";
>  };
>  
> -_host0_ehci {
> - companion = <_host0_ohci>;
> -};
> -
> -_host1_ehci {
> - companion = <_host1_ohci>;
> -};
> -
>  _phy0 {
>   orientation-switch;
> - svid = <0xff01>;
> + mode-switch;
>   sbu1-dc-gpios = < RK_PA6 GPIO_ACTIVE_HIGH>;
>   sbu2-dc-gpios = < RK_PA7 GPIO_ACTIVE_HIGH>;
>   status = "okay";
> @@ -135,14 +94,15 @@
>   port {
>   #address-cells = <1>;
>   #size-cells = <0>;
> - usbdp_phy0_orientation_switch: endpoint@0 {
> +
> + usbdp_phy0_typec_ss: endpoint@0 {
>   reg = <0>;
> - remote-endpoint = <_orien_sw>;
> + remote-endpoint = <_ss>;
>   };
>  
> - usbdp_phy0_dp_altmode_mux: endpoint@1 {
> + usbdp_phy0_typec_sbu: endpoint@1 {
>   reg = <1>;
> - remote-endpoint = <_altmode_mux>;
> + remote-endpoint = <_sbu>;
>   };
>   };
>  };
> @@ -151,84 +111,53 @@
>   status = "okay";
>  };
>  
> -_phy1 {
> - rockchip,dp-lane-mux = <2 3>;
> +_host0_xhci {
> + usb-role-switch;
>   status = "okay";
> -};
>  
> -_phy1_u3 {
> - status = "okay";
> -};
> + port {
> + #address-cells = <1>;
> + #size-cells = <0>;
>  
> -_0 {
> - status = "okay";
> + usb_host0_xhci_drd_sw: endpoint {
> + remote-endpoint = <_hs>;
> + };
> + };
>  };
>  
> -_1 {
> +_host1_xhci {
>   status = "okay";
>  };
>  
> -_dwc3_0 {
> - usb-role-switch;
> -
> - port {
> - #address-cells = <1>;
> -  

Re: [PATCH 1/4] rockchip: rk3588: Sync device tree from linux maintainer tree

2023-10-11 Thread Christopher Obbard
Hi Jonas,

On Tue, 2023-10-10 at 22:23 +, Jonas Karlman wrote:
> Sync rk3588 device tree from linux maintainer tree (v6.7-armsoc/dts64).
> Adds PCIe nodes to rk3588-evb1-v10 and rk3588-rock-5b boards. Also
> remove includes from u-boot.dtsi-files that is no longer needed.
> 
> Linux commits:
> 42145b7a8235 ("arm64: dts: rockchip: add PCIe network controller to rock-5b")
> 199cbd5f195a ("arm64: dts: rockchip: add PCIe for M.2 M-key to rock-5b")
> da447ec38780 ("arm64: dts: rockchip: add PCIe for M.2 E-Key to rock-5b")
> 86a2024d95e2 ("arm64: dts: rockchip: add PCIe2 network controller to 
> rk3588-evb1")
> 46bb398ea1d8 ("arm64: dts: rockchip: add PCIe3 bus to rk3588-evb1")
> 1c9a53ff7ece ("arm64: dts: rockchip: Add sdio node to rock-5b")
> 3eaf2abd11aa ("arm64: dts: rockchip: Add sfc node to rk3588s")
> bf012368bb0a ("arm64: dts: rockchip: Add I2S2 M0 pin definitions to rk3588s")
> 3d77a3e51b0f ("arm64: dts: rockchip: Add UART9 M0 pin definitions to rk3588s")
> 
> Signed-off-by: Jonas Karlman 

Reviewed-by: Christopher Obbard 

> ---
>  arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi |  11 +-
>  arch/arm/dts/rk3588-evb1-v10.dts |  98 
>  arch/arm/dts/rk3588-rock-5b-u-boot.dtsi  |  60 --
>  arch/arm/dts/rk3588-rock-5b.dts  | 140 +++
>  arch/arm/dts/rk3588-u-boot.dtsi  |   1 -
>  arch/arm/dts/rk3588s-pinctrl.dtsi    |  44 +++
>  arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi |   4 -
>  arch/arm/dts/rk3588s-u-boot.dtsi |  10 --
>  arch/arm/dts/rk3588s.dtsi    |  11 ++
>  9 files changed, 294 insertions(+), 85 deletions(-)
> 
> diff --git a/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi 
> b/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi
> index bd2e25948633..e8566785e965 100644
> --- a/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi
> +++ b/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi
> @@ -6,16 +6,7 @@
>  #include "rk3588-u-boot.dtsi"
>  
>  / {
> - aliases {
> - mmc0 = 
> - mmc1 = 
> - };
> -
>   chosen {
> - u-boot,spl-boot-order = 
> + u-boot,spl-boot-order = "same-as-spl", 
>   };
>  };
> -
> - {
> - bootph-all;
> -};
> diff --git a/arch/arm/dts/rk3588-evb1-v10.dts 
> b/arch/arm/dts/rk3588-evb1-v10.dts
> index 229a9111f5eb..c3fe58e39e99 100644
> --- a/arch/arm/dts/rk3588-evb1-v10.dts
> +++ b/arch/arm/dts/rk3588-evb1-v10.dts
> @@ -29,6 +29,46 @@
>   pwms = < 0 25000 0>;
>   };
>  
> + pcie20_avdd0v85: pcie20-avdd0v85-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie20_avdd0v85";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <85>;
> + regulator-max-microvolt = <85>;
> + vin-supply = <_0v85_s0>;
> + };
> +
> + pcie20_avdd1v8: pcie20-avdd1v8-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie20_avdd1v8";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <180>;
> + vin-supply = <_1v8_s0>;
> + };
> +
> + pcie30_avdd0v75: pcie30-avdd0v75-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie30_avdd0v75";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <75>;
> + regulator-max-microvolt = <75>;
> + vin-supply = <_0v75_s0>;
> + };
> +
> + pcie30_avdd1v8: pcie30-avdd1v8-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie30_avdd1v8";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <180>;
> + vin-supply = <_1v8_s0>;
> + };
> +
>   vcc12v_dcin: vcc12v-dcin-regulator {
>   compatible = "regulator-fixed";
>   regulator-name = "vcc12v_dcin";
> @@ -38,6 +78,19 @@
>   regulator-max-microvolt = <1200>;
>   };
>  
> + vcc3v3_pcie30: vcc3v3-pcie30-regulator {
> + compatible = "regulator-fixed";
> + re

Re: [PATCH 1/4] rockchip: rk3588: Sync device tree from linux maintainer tree

2023-10-11 Thread Christopher Obbard
Hi Jonas,

On Tue, 2023-10-10 at 22:23 +, Jonas Karlman wrote:
> Sync rk3588 device tree from linux maintainer tree (v6.7-armsoc/dts64).
> Adds PCIe nodes to rk3588-evb1-v10 and rk3588-rock-5b boards. Also
> remove includes from u-boot.dtsi-files that is no longer needed.
> 
> Linux commits:
> 42145b7a8235 ("arm64: dts: rockchip: add PCIe network controller to rock-5b")
> 199cbd5f195a ("arm64: dts: rockchip: add PCIe for M.2 M-key to rock-5b")
> da447ec38780 ("arm64: dts: rockchip: add PCIe for M.2 E-Key to rock-5b")
> 86a2024d95e2 ("arm64: dts: rockchip: add PCIe2 network controller to 
> rk3588-evb1")
> 46bb398ea1d8 ("arm64: dts: rockchip: add PCIe3 bus to rk3588-evb1")
> 1c9a53ff7ece ("arm64: dts: rockchip: Add sdio node to rock-5b")
> 3eaf2abd11aa ("arm64: dts: rockchip: Add sfc node to rk3588s")
> bf012368bb0a ("arm64: dts: rockchip: Add I2S2 M0 pin definitions to rk3588s")
> 3d77a3e51b0f ("arm64: dts: rockchip: Add UART9 M0 pin definitions to rk3588s")
> 
> Signed-off-by: Jonas Karlman 

Reviewed-by: Christopher Obbard 

> ---
>  arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi |  11 +-
>  arch/arm/dts/rk3588-evb1-v10.dts |  98 
>  arch/arm/dts/rk3588-rock-5b-u-boot.dtsi  |  60 --
>  arch/arm/dts/rk3588-rock-5b.dts  | 140 +++
>  arch/arm/dts/rk3588-u-boot.dtsi  |   1 -
>  arch/arm/dts/rk3588s-pinctrl.dtsi    |  44 +++
>  arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi |   4 -
>  arch/arm/dts/rk3588s-u-boot.dtsi |  10 --
>  arch/arm/dts/rk3588s.dtsi    |  11 ++
>  9 files changed, 294 insertions(+), 85 deletions(-)
> 
> diff --git a/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi 
> b/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi
> index bd2e25948633..e8566785e965 100644
> --- a/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi
> +++ b/arch/arm/dts/rk3588-evb1-v10-u-boot.dtsi
> @@ -6,16 +6,7 @@
>  #include "rk3588-u-boot.dtsi"
>  
>  / {
> - aliases {
> - mmc0 = 
> - mmc1 = 
> - };
> -
>   chosen {
> - u-boot,spl-boot-order = 
> + u-boot,spl-boot-order = "same-as-spl", 
>   };
>  };
> -
> - {
> - bootph-all;
> -};
> diff --git a/arch/arm/dts/rk3588-evb1-v10.dts 
> b/arch/arm/dts/rk3588-evb1-v10.dts
> index 229a9111f5eb..c3fe58e39e99 100644
> --- a/arch/arm/dts/rk3588-evb1-v10.dts
> +++ b/arch/arm/dts/rk3588-evb1-v10.dts
> @@ -29,6 +29,46 @@
>   pwms = < 0 25000 0>;
>   };
>  
> + pcie20_avdd0v85: pcie20-avdd0v85-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie20_avdd0v85";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <85>;
> + regulator-max-microvolt = <85>;
> + vin-supply = <_0v85_s0>;
> + };
> +
> + pcie20_avdd1v8: pcie20-avdd1v8-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie20_avdd1v8";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <180>;
> + vin-supply = <_1v8_s0>;
> + };
> +
> + pcie30_avdd0v75: pcie30-avdd0v75-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie30_avdd0v75";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <75>;
> + regulator-max-microvolt = <75>;
> + vin-supply = <_0v75_s0>;
> + };
> +
> + pcie30_avdd1v8: pcie30-avdd1v8-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "pcie30_avdd1v8";
> + regulator-always-on;
> + regulator-boot-on;
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <180>;
> + vin-supply = <_1v8_s0>;
> + };
> +
>   vcc12v_dcin: vcc12v-dcin-regulator {
>   compatible = "regulator-fixed";
>   regulator-name = "vcc12v_dcin";
> @@ -38,6 +78,19 @@
>   regulator-max-microvolt = <1200>;
>   };
>  
> + vcc3v3_pcie30: vcc3v3-pcie30-regulator {
> + compatible = "regulator-fixed";
> + re

Re: [PATCH 1/5] board: rockchip: Add Pine64 Quartz64-A Board

2023-08-08 Thread Christopher Obbard
Hi Jonas,

On Sun, 2023-07-23 at 15:04 +, Jonas Karlman wrote:
> On 2023-07-23 16:55, Jonas Karlman wrote:
> > The Pine64 Quartz64 Model A is a single-board computer based on the
> > Rockchip RK3566 SoC. The board features USB3, SATA, PCIe, HDMI, USB2.0,
> > CSI, DSI, eDP, eMMC, SD, and an e-paper parallel port, as well as a
> > 20 pin GPIO header.
> > 
> > Features tested on a Quartz64-A 8GB v2.0 2021-04-27:
> > - SD-card boot
> > - eMMC boot
> > - PCIe/NVMe/AHCI
> > - USB host
> > 
> > Device tree is imported from linux v6.4.
> > 
> > Co-developed-by: Nicolas Frattaroli 
> > Signed-off-by: Nicolas Frattaroli 
> > Signed-off-by: Jonas Karlman 
> > ---
> 
> [...]
> 
> Boot log with ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and
> BL31=rk3568_bl31_v1.43.elf:
> 
> [...]
> 
> U-Boot 2023.07 (Jul 23 2023 - 12:42:18 +)
> 
> Model: Pine64 RK3566 Quartz64-A Board
> DRAM:  8 GiB (effective 7.7 GiB)
> PMIC:  RK8170 (on=0x10, off=0x00)
> Core:  321 devices, 27 uclasses, devicetree: separate
> MMC:   rockchip_sdhci_probe clk set rate fail!
> mmc@fe2b: 1, mmc@fe2c: 2, mmc@fe31: 0
> Loading Environment from nowhere... OK
> In:    serial@fe66
> Out:   serial@fe66
> Err:   serial@fe66
> Model: Pine64 RK3566 Quartz64-A Board
> Net:   No ethernet found.
> 
> Hit any key to stop autoboot:  0
> =>


I just tried booting U-Boot v2023.10-rc2 with 
ROCKCHIP_TPL=rk3566_ddr_1056MHz_v1.17.bin and BL31=rk3568_bl31_v1.43.elf, on my 
Quartz64-A but it fails during
loading of some parts. I removed the output of the RK TPL from my logs as there 
were no errors.

This is when booting from eMMC.

I also tried building your branch from 
https://github.com/Kwiboo/u-boot-rockchip/tree/rk3568-2023.10 and 


The full build commands:

export ROCKCHIP_TPL=rkbin/bin/rk35/rk3566_ddr_1056MHz_v1.17.bin
export BL31=rkbin/bin/rk35/rk3568_bl31_v1.43.elf
make quartz64-a-rk3566_defconfig
make -j16

rkdeveloptool db rk356x_spl_loader_v1.13.112.bin
rkdeveloptool wl 64 u-boot-rockchip.bin

Boot log (v2023.10-rc2):

U-Boot SPL 2023.10-rc2 (Aug 08 2023 - 14:02:34 +0100)
rockchip_sdhci_probe clk set rate fail!
Trying to boot from MMC1
spl: mmc init failed with error: -110
Trying to boot from MMC2
Card did not respond to voltage select! : -110
spl: mmc init failed with error: -95
Trying to boot from MMC1
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
spl_load_simple_fit: can't load image loadables index 0 (ret = -5)
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###


Boot log (your branch):

U-Boot SPL 2023.10-rc1-00368-g16cb31d427 (Aug 08 2023 - 15:17:35 +0100)
Trying to boot from MMC1
spl: mmc init failed with error: -70
Trying to boot from MMC2
Card did not respond to voltage select! : -110
spl: mmc init failed with error: -95
Trying to boot from MMC1
## Checking hash(es) for config config-1 ... OK
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###


Thanks!

Chris



Re: [PATCH] configs: rock64-rk3328_defconfig: Enable ROCKCHIP_EFUSE

2023-07-28 Thread Christopher Obbard
On Thu, 2023-07-27 at 19:33 +0300, Matwey V. Kornilov wrote:
> Enable missed CONFIG_ROCKCHIP_EFUSE to use fixed Ethernet MAC address.
> 
> Signed-off-by: Matwey V. Kornilov 

Reviewed-by: Christopher Obbard 

> ---
>  configs/rock64-rk3328_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig
> index 74a9cc0a7d..aba488bed0 100644
> --- a/configs/rock64-rk3328_defconfig
> +++ b/configs/rock64-rk3328_defconfig
> @@ -71,6 +71,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
>  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
>  CONFIG_ROCKCHIP_GPIO=y
>  CONFIG_SYS_I2C_ROCKCHIP=y
> +CONFIG_MISC=y
> +CONFIG_ROCKCHIP_EFUSE=y
>  CONFIG_MMC_DW=y
>  CONFIG_MMC_DW_ROCKCHIP=y
>  CONFIG_SPI_FLASH_GIGADEVICE=y


[PATCH v1 2/2] arm: rockchip: Add Radxa ROCK 4SE

2023-07-19 Thread Christopher Obbard
Add board-specific devicetree/config for the RK3399T-based Radxa ROCK 4SE
board. This board offers similar peripherals in a similar form-factor to
the existing ROCK Pi 4B but uses the cost-optimised RK3399T processor
(which has different OPP table than the RK3399) and other minimal hardware
changes.

Kernel tag: next-20230719
Kernel commits:
- 86a0e14a82ea ("arm64: dts: rockchip: Add Radxa ROCK 4SE")

Signed-off-by: Christopher Obbard 
---

 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/rk3399-rock-4se-u-boot.dtsi |   6 ++
 arch/arm/dts/rk3399-rock-4se.dts |  65 +++
 board/rockchip/evb_rk3399/MAINTAINERS|   6 ++
 configs/rock-4se-rk3399_defconfig| 100 +++
 doc/board/rockchip/rockchip.rst  |   2 +-
 6 files changed, 179 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-rock-4se.dts
 create mode 100644 configs/rock-4se-rk3399_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 07b26df275..69c6f74636 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -159,6 +159,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
rk3399-roc-pc.dtb \
rk3399-roc-pc-mezzanine.dtb \
rk3399-rock-4c-plus.dtb \
+   rk3399-rock-4se.dtb \
rk3399-rock-pi-4a.dtb \
rk3399-rock-pi-4c.dtb \
rk3399-rock960.dtb \
diff --git a/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
new file mode 100644
index 00..85ee5770ad
--- /dev/null
+++ b/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki 
+ */
+
+#include "rk3399-rock-pi-4-u-boot.dtsi"
diff --git a/arch/arm/dts/rk3399-rock-4se.dts b/arch/arm/dts/rk3399-rock-4se.dts
new file mode 100644
index 00..7cfc198bba
--- /dev/null
+++ b/arch/arm/dts/rk3399-rock-4se.dts
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Akash Gajjar 
+ * Copyright (c) 2019 Pragnesh Patel 
+ */
+
+/dts-v1/;
+#include "rk3399-rock-pi-4.dtsi"
+#include "rk3399-t-opp.dtsi"
+
+/ {
+   model = "Radxa ROCK 4SE";
+   compatible = "radxa,rock-4se", "rockchip,rk3399";
+
+   aliases {
+   mmc2 = 
+   };
+};
+
+ {
+   usb2 {
+   vcc5v0_host_en: vcc5v0-host-en {
+   rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO _pull_none>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+
+   brcmf: wifi@1 {
+   compatible = "brcm,bcm4329-fmac";
+   reg = <1>;
+   interrupt-parent = <>;
+   interrupts = ;
+   interrupt-names = "host-wake";
+   pinctrl-names = "default";
+   pinctrl-0 = <_host_wake_l>;
+   };
+};
+
+ {
+   status = "okay";
+
+   bluetooth {
+   compatible = "brcm,bcm4345c5";
+   clocks = < 1>;
+   clock-names = "lpo";
+   device-wakeup-gpios = < RK_PD3 GPIO_ACTIVE_HIGH>;
+   host-wakeup-gpios = < RK_PA4 GPIO_ACTIVE_HIGH>;
+   shutdown-gpios = < RK_PB1 GPIO_ACTIVE_HIGH>;
+   max-speed = <150>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_host_wake_l _wake_l _enable_h>;
+   vbat-supply = <_sys>;
+   vddio-supply = <_1v8>;
+   };
+};
+
+_host {
+   enable-active-high;
+   gpio = < RK_PD1 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_host_en>;
+};
diff --git a/board/rockchip/evb_rk3399/MAINTAINERS 
b/board/rockchip/evb_rk3399/MAINTAINERS
index 5be58f80f9..7d931dfd3a 100644
--- a/board/rockchip/evb_rk3399/MAINTAINERS
+++ b/board/rockchip/evb_rk3399/MAINTAINERS
@@ -80,6 +80,12 @@ F:   configs/orangepi-rk3399_defconfig
 F: arch/arm/dts/rk3399-u-boot.dtsi
 F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
 
+ROCK-4SE
+M: Christopher Obbard 
+S: Maintained
+F: configs/rock-4se-rk3399_defconfig
+F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
+
 ROCK-PI-4
 M: Akash Gajjar 
 M: Jagan Teki 
diff --git a/configs/rock-4se-rk3399_defconfig 
b/configs/rock-4se-rk3399_defconfig
new file mode 100644
index 00..9abe8bf853
--- /dev/null
+++ b/configs/rock-4se-rk3399_defconfig
@@ -0,0 +1,100 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=2400
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_TEXT_BASE=0x0020
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x30
+CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se"
+CONFIG_

[PATCH v1 1/2] arm: rockchip: sync ROCK Pi 4 SoCs from Linux

2023-07-19 Thread Christopher Obbard
To prepare for ROCK 4 SE support, changes are needed to the common ROCK
Pi 4 devicetree to move the OPP from the common devicetree to individual
board devicetrees. Sync the Rockchip RK3399 ROCK Pi 4-related DTs from
Linux to gain from these changes.

Kernel tag: next-20230719
Kernel commits:
cfa12c32b96f ("arm64: dts: rockchip: correct wifi interrupt flag in Rock \
Pi 4B")
cee572756aa2 ("arm64: dts: rockchip: Disable HS400 for eMMC on ROCK Pi 4")
2bd1d2dd808c ("arm64: dts: rockchip: Disable HS400 for eMMC on ROCK 4C+")
fd2762a62646 ("arm64: dts: rockchip: Move OPP table from ROCK Pi 4 dtsi")

Signed-off-by: Christopher Obbard 
---

 arch/arm/dts/rk3399-rock-4c-plus.dts | 3 +--
 arch/arm/dts/rk3399-rock-pi-4.dtsi   | 5 ++---
 arch/arm/dts/rk3399-rock-pi-4a.dts   | 1 +
 arch/arm/dts/rk3399-rock-pi-4c.dts   | 1 +
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/rk3399-rock-4c-plus.dts 
b/arch/arm/dts/rk3399-rock-4c-plus.dts
index 028eb508ae..8bfd5f88d1 100644
--- a/arch/arm/dts/rk3399-rock-4c-plus.dts
+++ b/arch/arm/dts/rk3399-rock-4c-plus.dts
@@ -548,9 +548,8 @@
  {
max-frequency = <15000>;
bus-width = <8>;
-   mmc-hs400-1_8v;
+   mmc-hs200-1_8v;
non-removable;
-   mmc-hs400-enhanced-strobe;
status = "okay";
 };
 
diff --git a/arch/arm/dts/rk3399-rock-pi-4.dtsi 
b/arch/arm/dts/rk3399-rock-pi-4.dtsi
index 907071d4fe..b1b7f4ffb1 100644
--- a/arch/arm/dts/rk3399-rock-pi-4.dtsi
+++ b/arch/arm/dts/rk3399-rock-pi-4.dtsi
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include "rk3399.dtsi"
-#include "rk3399-opp.dtsi"
 
 / {
aliases {
@@ -645,9 +644,9 @@
 };
 
  {
+   max-frequency = <15000>;
bus-width = <8>;
-   mmc-hs400-1_8v;
-   mmc-hs400-enhanced-strobe;
+   mmc-hs200-1_8v;
non-removable;
status = "okay";
 };
diff --git a/arch/arm/dts/rk3399-rock-pi-4a.dts 
b/arch/arm/dts/rk3399-rock-pi-4a.dts
index 89f2af5e11..931334aa3d 100644
--- a/arch/arm/dts/rk3399-rock-pi-4a.dts
+++ b/arch/arm/dts/rk3399-rock-pi-4a.dts
@@ -6,6 +6,7 @@
 
 /dts-v1/;
 #include "rk3399-rock-pi-4.dtsi"
+#include "rk3399-opp.dtsi"
 
 / {
model = "Radxa ROCK Pi 4A";
diff --git a/arch/arm/dts/rk3399-rock-pi-4c.dts 
b/arch/arm/dts/rk3399-rock-pi-4c.dts
index 4053ba7261..d32efab74e 100644
--- a/arch/arm/dts/rk3399-rock-pi-4c.dts
+++ b/arch/arm/dts/rk3399-rock-pi-4c.dts
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 #include "rk3399-rock-pi-4.dtsi"
+#include "rk3399-opp.dtsi"
 
 / {
model = "Radxa ROCK Pi 4C";
-- 
2.40.1



[PATCH v1 0/2] Add support for Radxa ROCK 4SE

2023-07-19 Thread Christopher Obbard
Add support for the RK3399T-based Radxa ROCK 4SE board. This board offers
similar peripherals and form-factor to the ROCK Pi 4B but uses the
cost-optimised RK3399T processor (which has different a OPP table but
otherwise minimal changes) and some other minor hardware changes between
the Rock Pi 4B (described in the devicetree).

The first patch syncs the RK3399-based ROCK Pi 4 boards from Linux,
moving the RK3399 OPP table from the generic Radxa ROCK Pi 4 dtsi into
board-specific devicetree files, in preparation for the ROCK 4SE
devicetree file.

The second patch adds support for the Radxa ROCK 4SE.


Christopher Obbard (2):
  arm: rockchip: sync ROCK Pi 4 SoCs from Linux
  arm: rockchip: Add Radxa ROCK 4SE

 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/rk3399-rock-4c-plus.dts |   3 +-
 arch/arm/dts/rk3399-rock-4se-u-boot.dtsi |   6 ++
 arch/arm/dts/rk3399-rock-4se.dts |  65 +++
 arch/arm/dts/rk3399-rock-pi-4.dtsi   |   5 +-
 arch/arm/dts/rk3399-rock-pi-4a.dts   |   1 +
 arch/arm/dts/rk3399-rock-pi-4c.dts   |   1 +
 board/rockchip/evb_rk3399/MAINTAINERS|   6 ++
 configs/rock-4se-rk3399_defconfig| 100 +++
 doc/board/rockchip/rockchip.rst  |   2 +-
 10 files changed, 184 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-rock-4se.dts
 create mode 100644 configs/rock-4se-rk3399_defconfig

-- 
2.40.1



Re: [bug report] sunxi: H6: no ethernet on Orange Pi One Plus

2023-07-05 Thread Christopher Obbard
Hi Anne,

[please don't forget to CC the list, in case someone else
has the same issue in future they don't miss the context ;-)]

On Wed, 2023-07-05 at 10:12 +, Anne Macedo wrote:
> On Wed, Jul 05, 2023 at 09:23:35AM +0100, Christopher Obbard wrote:
> > Hi Anne,
> > 
> > On Tue, 2023-07-04 at 23:22 +, Anne Macedo wrote:
> > > Hey!
> > > 
> > > I'm trying to bake Linux images for the Orange Pi One Plus using Yocto.
> > > Everything works fine, except for Ethernet.
> > > 
> > > On the u-boot prompt:
> > > 
> > > => dhcp
> > > No ethernet found.
> > > 
> > > After adding:
> > > 
> > > CONFIG_SPL_SPI_SUNXI=y
> > > CONFIG_SUN8I_EMAC=y
> > > 
> > > to configs/orangepi_one_plus_defconfig, I started seeing this error:
> > > 
> > > => dhcp
> > > sun8i_emac_eth_start: Timeout
> > 
> > Can you attempt to change the TF-A target from sun50i_h6 to 
> > sun50i_h6_no_pmic?
> 
> Hello Christopher! I tried this, but it failed. It doesn't seem that
> there's any PLAT for sun50i_h6_no_pmic on TF-A:
> 
> https://github.com/ARM-software/arm-trusted-firmware/tree/master/plat/allwinner
> 
> This is the error I get: 
> 
> "Error: Invalid platform. The following platforms are available:
> a3700|a5ds|a70x0|a70x0_amc|a70x0_mochabin|a80x0|a80x0_mcbin|a80x0_puzzle|agilex|arm_fpga|axg|corstone1000|corstone700|fvp|fvp_r|fvp_ve|g12a|gxbb|gxl|hikey|hikey960|imx8mm|imx8mn|imx8mp|imx8mq|imx8qm
> |imx8qx|juno|k3|ls1028ardb|ls1043ardb|ls1046afrwy|ls1046aqds|ls1046ardb|ls1088aqds|ls1088ardb|lx2160aqds|lx2160ardb|lx2162aqds|morello|msm8916|mt8173|mt8183|mt8186|mt8188|mt8192|mt8195|n1sdp|n5x|pic
> opi|poplar|px30|qemu|qemu_sbsa|rcar|rde1edge|rdn1edge|rdn2|rdv1|rdv1mc|rk3288|rk3328|rk3368|rk3399|rpi3|rpi4|rzg|sc7180|sc7280|sgi575|stingray|stm32mp1|stratix10|sun50i_a64|sun50i_h6|sun50i_h616|sun
> 50i_r329|synquacer|t9130|t9130_cex7_eval|tc|tegra|uniphier|versal|versal_net|warp7|zynqmp"
> > 
> 
> I also tried adding CONFIG_SUNXI_NO_PMIC=y but it also didn't work :( 
> 
> I didn't find the sun50i_h6_no_pmic platform being defined anywhere...
> https://packages.debian.org/bookworm/arm-trusted-firmware
> 
> Wow, this is very recent!
> https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1911472.html.
>  
> The change was merged a few days ago.

Right, looking at the packaging once more, it seems like this is a custom target
just for Debian which sets SUNXI_SETUP_REGULATORS=0


Cheers!

Chris


Re: [bug report] sunxi: H6: no ethernet on Orange Pi One Plus

2023-07-05 Thread Christopher Obbard
Hi Anne,

On Tue, 2023-07-04 at 23:22 +, Anne Macedo wrote:
> Hey!
> 
> I'm trying to bake Linux images for the Orange Pi One Plus using Yocto.
> Everything works fine, except for Ethernet.
> 
> On the u-boot prompt:
> 
> => dhcp
> No ethernet found.
> 
> After adding:
> 
> CONFIG_SPL_SPI_SUNXI=y
> CONFIG_SUN8I_EMAC=y
> 
> to configs/orangepi_one_plus_defconfig, I started seeing this error:
> 
> => dhcp
> sun8i_emac_eth_start: Timeout

Can you attempt to change the TF-A target from sun50i_h6 to sun50i_h6_no_pmic?

This at least seems to have been the fix accepted into the Debian packaging for 
the Orange Pi One Plus.

I have one around somewhere, I could hook it up and do some more investigation 
if that doesn't help you.

(PS: We should probably update the U-Boot documentation if that suggestion does 
work.)

> 
> I saw this other bug report but I couldn't really understand what has
> been made to fix this issue [1].
> 
> More context here [2].
> 
> [1] https://lists.denx.de/pipermail/u-boot/2021-June/451357.html
> [2] https://github.com/linux-sunxi/meta-sunxi/issues/387
> 
> Regards,
> Anne

Cheers!

Chris


[PATCH v1] configs: rockchip: rock5b-rk3588: Enable CONFIG_PCI_INIT_R

2023-07-03 Thread Christopher Obbard
Enable CONFIG_PCI_INIT_R for rock5b pci enumeration during boot in order
to autodetect the PCI ethernet NIC during the boot process.

Signed-off-by: Christopher Obbard 
---

 configs/rock5b-rk3588_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig
index c1155c20ef..ed2d0cc54a 100644
--- a/configs/rock5b-rk3588_defconfig
+++ b/configs/rock5b-rk3588_defconfig
@@ -33,6 +33,7 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_PCI_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x4
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-- 
2.40.1



[PATCH] include: rk3328: Add default env for compressed kernel images

2023-01-27 Thread Christopher Obbard
Add default memory addresses for kernel_comp_addr_r and kernel_comp_size
to enable booting from a compressed kernel image. This area is temporarily
used to decompress the kernel image on-the-fly.

Signed-off-by: Christopher Obbard 
---

 include/configs/rk3328_common.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/configs/rk3328_common.h b/include/configs/rk3328_common.h
index fadcb93a5f..24b21c024d 100644
--- a/include/configs/rk3328_common.h
+++ b/include/configs/rk3328_common.h
@@ -19,7 +19,9 @@
"pxefile_addr_r=0x0060\0" \
"fdt_addr_r=0x01f0\0" \
"kernel_addr_r=0x0208\0" \
-   "ramdisk_addr_r=0x0600\0"
+   "ramdisk_addr_r=0x0600\0" \
+   "kernel_comp_addr_r=0x0800\0" \
+   "kernel_comp_size=0x200\0"
 
 #include 
 #define CFG_EXTRA_ENV_SETTINGS \
-- 
2.39.1



[PATCH v2] configs: roc-pc-rk3399: Enable rockchip efuse support

2022-11-23 Thread Christopher Obbard
Enable efuse support which allows reading of the cpuid#, serial#
and also generates a unique mac address from the board's serial.

Signed-off-by: Christopher Obbard 
---
Changes in v2:
- added missing configuration symbol CONFIG_MISC_INIT_R=y

 configs/roc-pc-mezzanine-rk3399_defconfig | 2 ++
 configs/roc-pc-rk3399_defconfig   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig 
b/configs/roc-pc-mezzanine-rk3399_defconfig
index 3cdcc729f853..d936309709ed 100644
--- a/configs/roc-pc-mezzanine-rk3399_defconfig
+++ b/configs/roc-pc-mezzanine-rk3399_defconfig
@@ -22,6 +22,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x30
 # CONFIG_ANDROID_BOOT_IMAGE is not set
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
@@ -50,6 +51,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
+CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index e03442afa462..865d4e0e9f25 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -22,6 +22,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x30
 # CONFIG_ANDROID_BOOT_IMAGE is not set
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
@@ -49,6 +50,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
+CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
-- 
2.38.1



[PATCH] configs: roc-pc-rk3399: Enable rockchip efuse support

2022-11-12 Thread Christopher Obbard
Enable efuse support which allows reading of the cpuid#, serial#
and also generates a unique mac address from the board's serial.

Signed-off-by: Christopher Obbard 
---
 configs/roc-pc-mezzanine-rk3399_defconfig | 1 +
 configs/roc-pc-rk3399_defconfig   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig 
b/configs/roc-pc-mezzanine-rk3399_defconfig
index 3cdcc729f853..5c3bb62bcb71 100644
--- a/configs/roc-pc-mezzanine-rk3399_defconfig
+++ b/configs/roc-pc-mezzanine-rk3399_defconfig
@@ -50,6 +50,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
+CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index e03442afa462..b10552ed2db3 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -49,6 +49,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
+CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
-- 
2.38.1



Re: [PATCH] rockchip: rk3399: Add Nanopi M4V2 board support

2022-04-25 Thread Christopher Obbard
Hi Shuying Li & Libunko,

Would you be able to resend this patch to uboot mailing list ?

If you are no longer interested, I can resend it if you would like.

Thank you
Chris

On Sun, 18 Oct 2020 at 13:10, Shuying Li  wrote:
>
> From: Libunko 
>
> Add initial support for Nanopi M4V2 board.
>
> Specification
> - Rockchip RK3399
> - Dual-Channel 4GB LPDDR4
> - SD card slot
> - eMMC socket
> - RTL8211E 1Gbps
> - AP6356S WiFI/BT
> - HDMI In/Out, MIPI DSI/CSI
> - USB 3.0 x4
> - USB Type C power and data
> - GPIO1, GPIO2 expansion ports
> - DC5V/3A
>
> Signed-off-by: Shuying Li 
> ---
>  arch/arm/dts/Makefile   |  1 +
>  arch/arm/dts/rk3399-nanopi-m4v2-u-boot.dtsi |  7 +++
>  arch/arm/dts/rk3399-nanopi-m4v2.dts | 67 +
>  board/rockchip/evb_rk3399/MAINTAINERS   |  6 ++
>  configs/nanopi-m4v2-rk3399_defconfig| 61 +++
>  doc/board/rockchip/rockchip.rst |  1 +
>  6 files changed, 143 insertions(+)
>  create mode 100644 arch/arm/dts/rk3399-nanopi-m4v2-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3399-nanopi-m4v2.dts
>  create mode 100644 configs/nanopi-m4v2-rk3399_defconfig
>
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index f8f529435b..7e8dfcef88 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -130,6 +130,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
> rk3399-nanopc-t4.dtb \
> rk3399-nanopi-m4.dtb \
> rk3399-nanopi-m4-2gb.dtb \
> +   rk3399-nanopi-m4v2.dtb \
> rk3399-nanopi-neo4.dtb \
> rk3399-orangepi.dtb \
> rk3399-pinebook-pro.dtb \
> diff --git a/arch/arm/dts/rk3399-nanopi-m4v2-u-boot.dtsi 
> b/arch/arm/dts/rk3399-nanopi-m4v2-u-boot.dtsi
> new file mode 100644
> index 00..ff8e99cb7f
> --- /dev/null
> +++ b/arch/arm/dts/rk3399-nanopi-m4v2-u-boot.dtsi
> @@ -0,0 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2020 Shuying Li 
> + */
> +
> +#include "rk3399-nanopi4-u-boot.dtsi"
> +#include "rk3399-sdram-lpddr4-100.dtsi"
> diff --git a/arch/arm/dts/rk3399-nanopi-m4v2.dts 
> b/arch/arm/dts/rk3399-nanopi-m4v2.dts
> new file mode 100644
> index 00..03d956d2c4
> --- /dev/null
> +++ b/arch/arm/dts/rk3399-nanopi-m4v2.dts
> @@ -0,0 +1,67 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * FriendlyElec NanoPi M4V2 board device tree source
> + *
> + * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
> + * (http://www.friendlyarm.com)
> + *
> + * Copyright (c) 2018 Collabora Ltd.
> + * Copyright (c) 2019 Arm Ltd.
> + * Copyright (C) 2020 Shuying Li 
> + */
> +
> +/dts-v1/;
> +#include "rk3399-nanopi4.dtsi"
> +
> +/ {
> +   model = "FriendlyElec NanoPi M4V2";
> +   compatible = "friendlyarm,nanopi-m4v2", "rockchip,rk3399";
> +
> +   vdd_5v: vdd-5v {
> +   compatible = "regulator-fixed";
> +   regulator-name = "vdd_5v";
> +   regulator-always-on;
> +   regulator-boot-on;
> +   };
> +
> +   vcc5v0_core: vcc5v0-core {
> +   compatible = "regulator-fixed";
> +   regulator-name = "vcc5v0_core";
> +   regulator-always-on;
> +   regulator-boot-on;
> +   vin-supply = <_5v>;
> +   };
> +
> +   vcc5v0_usb1: vcc5v0-usb1 {
> +   compatible = "regulator-fixed";
> +   regulator-name = "vcc5v0_usb1";
> +   regulator-always-on;
> +   regulator-boot-on;
> +   vin-supply = <_sys>;
> +   };
> +
> +   vcc5v0_usb2: vcc5v0-usb2 {
> +   compatible = "regulator-fixed";
> +   regulator-name = "vcc5v0_usb2";
> +   regulator-always-on;
> +   regulator-boot-on;
> +   vin-supply = <_sys>;
> +   };
> +};
> +
> +_sys {
> +   vin-supply = <_core>;
> +};
> +
> +_host {
> +   phy-supply = <_usb1>;
> +};
> +
> +_host {
> +   phy-supply = <_usb2>;
> +};
> +
> +_typec {
> +   regulator-always-on;
> +   vin-supply = <_5v>;
> +};
> diff --git a/board/rockchip/evb_rk3399/MAINTAINERS 
> b/board/rockchip/evb_rk3399/MAINTAINERS
> index 4c889e06a6..9967d68a88 100644
> --- a/board/rockchip/evb_rk3399/MAINTAINERS
> +++ b/board/rockchip/evb_rk3399/MAINTAINERS
> @@ -49,6 +49,12 @@ S:   Maintained
>  F: configs/nanopi-m4-2gb-rk3399_defconfig
>  F: arch/arm/dts/rk3399-nanopi-m4-2gb-u-boot.dtsi
>
> +NANOPC-M4V2
> +M: Shuying Li 
> +S: Maintained
> +F: configs/nanopi-m4v2-rk3399_defconfig
> +F: arch/arm/dts/rk3399-nanopi-m4v2-u-boot.dtsi
> +
>  NANOPI-NEO4
>  M: Jagan Teki 
>  S: Maintained
> diff --git a/configs/nanopi-m4v2-rk3399_defconfig 
> b/configs/nanopi-m4v2-rk3399_defconfig
> new file mode 100644
> index 00..d5c58d549f
> --- /dev/null
> +++ b/configs/nanopi-m4v2-rk3399_defconfig
> @@ -0,0 +1,61 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_ROCKCHIP=y
> +CONFIG_SYS_TEXT_BASE=0x0020
> +CONFIG_NR_DRAM_BANKS=1
> 

Re: u-boot idbloader.img fails to initialise LPDDR3 on nanopi m4 v1

2021-02-07 Thread Christopher Obbard
Turns out I was using the wrong defconfig, my board is a 2gb model
which has a separate defconfig.

Although, u-boot HEAD doesn't work, with an error:

U-Boot TPL 2021.04-rc1-00079-g8308a28af8 (Feb 07 2021 - 13:04:30)
Missing DTB
### ERROR ### Please RESET the board ###

On Sat, 6 Feb 2021 at 09:36, Christopher Obbard  wrote:
>
> hi!
>
> Both 2020.04, 2021.01 and latest u-boot HEAD fails to setup nano pi m4
> V1 LPDDR3.
>
> these are compiled with latest ATF HEAD. Any pointers on where to debug ?
>
> For what it's worth; I can boot on nanopi m4 V2 board with patch[1],
> so I am sure it's a DDR thing.
>
> U-Boot TPL 2020.04 (Feb 06 2021 - 09:28:53)
> sdram_init: LPDDR3 - 933MHz failed!
> rk3399_dmc_init DRAM init failed -22
> Missing DTB
>
> U-Boot TPL 2021.01 (Feb 05 2021 - 12:45:32)
> sdram_init: LPDDR3 - 933MHz failed!
> rk3399_dmc_init DRAM init failed -22
> Missing DTB
>
> thanks!
> Chris
>
> [1]: 
> https://patchwork.ozlabs.org/project/uboot/patch/20201018052548.29195-1-libu...@qq.com/


Re: [PATCH] rockchip: rk3399: Add Nanopi M4V2 board support

2021-02-07 Thread Christopher Obbard
On Fri, 5 Feb 2021 at 16:15, Christopher Obbard  wrote:
>
> Hi!
>
> I tested this patch, all working well apart from ethernet:
>
> Model: FriendlyElec NanoPi M4V2
> Net:
> Error: ethernet@fe30 address not set.
> No ethernet found.
> Any tips to get ethernet going ?
>
> thinking about it, i should try a NanopiM4 V1...

right, I had to set ethaddr first in the environment...
The vendor u-boot seems to derive a default ethernet address from the
serial number.

thanks!

>
> thanks!
>
> On Sat, 16 Jan 2021 at 12:41, Jamislike  wrote:
> >
> > Hi All,
> > Shuying kindly pointed me to his branch:
> >
> > git clone -b v2020.10.m4v2 https://github.com/Libunko/u-boot.git
> >
> > What needs to be done to get this into mainline?
> > Jam
> >
> >
> >
> >
> >
> > --
> > Sent from: http://u-boot.10912.n7.nabble.com/


u-boot idbloader.img fails to initialise LPDDR3 on nanopi m4 v1

2021-02-06 Thread Christopher Obbard
hi!

Both 2020.04, 2021.01 and latest u-boot HEAD fails to setup nano pi m4
V1 LPDDR3.

these are compiled with latest ATF HEAD. Any pointers on where to debug ?

For what it's worth; I can boot on nanopi m4 V2 board with patch[1],
so I am sure it's a DDR thing.

U-Boot TPL 2020.04 (Feb 06 2021 - 09:28:53)
sdram_init: LPDDR3 - 933MHz failed!
rk3399_dmc_init DRAM init failed -22
Missing DTB

U-Boot TPL 2021.01 (Feb 05 2021 - 12:45:32)
sdram_init: LPDDR3 - 933MHz failed!
rk3399_dmc_init DRAM init failed -22
Missing DTB

thanks!
Chris

[1]: 
https://patchwork.ozlabs.org/project/uboot/patch/20201018052548.29195-1-libu...@qq.com/


Re: [PATCH] rockchip: rk3399: Add Nanopi M4V2 board support

2021-02-05 Thread Christopher Obbard
Hi!

I tested this patch, all working well apart from ethernet:

Model: FriendlyElec NanoPi M4V2
Net:
Error: ethernet@fe30 address not set.
No ethernet found.

Hit any key to stop autoboot:  0

=> nfs
mdio_register: non unique device name 'ethernet@fe30'
mdio_register: non unique device name 'ethernet@fe30'
mdio_register: non unique device name 'ethernet@fe30'
mdio_register: non unique device name 'ethernet@fe30'
No ethernet found.
mdio_register: non unique device name 'ethernet@fe30'


Any tips to get ethernet going ?

thinking about it, i should try a NanopiM4 V1...

thanks!

On Sat, 16 Jan 2021 at 12:41, Jamislike  wrote:
>
> Hi All,
> Shuying kindly pointed me to his branch:
>
> git clone -b v2020.10.m4v2 https://github.com/Libunko/u-boot.git
>
> What needs to be done to get this into mainline?
> Jam
>
>
>
>
>
> --
> Sent from: http://u-boot.10912.n7.nabble.com/


Re: [PATCH v2] riscv: Add support for SPI on Kendryte K210

2020-12-23 Thread Christopher Obbard
Hi Sean,

everything looks good!

On Tue, 22 Dec 2020 at 23:58, Sean Anderson  wrote:
>
> This enables configs necessary for using SPI. The environment is saved to
> the very end of SPI flash. This is unlikely to be overwritten unless the
> entire flash is reprogrammed.
>
> This also supplies a default bootcommand. It loads an image and device tree
> from the first partition of the MMC. This is a minimal/least effort
> bootcmd, so suggestions (especially in the form of patches) are welcome. I
> didn't set up distro boot because I think it is unlikely that any
> general-purpose linux distros will ever be ported to this board.
>
> Signed-off-by: Sean Anderson 

Tested-by: Chrstopher Obbard 

> ---
> Sorry for the late follow-up Jagen.
>
> This patch was previously part of
> https://patchwork.ozlabs.org/project/uboot/list/?series=208443
>
> Changes in v2:
> - Add CONFIG_HUSH_PARSER to run the bootcmd
>   (In my haste I forgot to commit my changes)
>
>  board/sipeed/maix/Kconfig  |  16 ++
>  configs/sipeed_maix_bitm_defconfig |  11 +
>  doc/board/sipeed/maix.rst  | 319 -
>  include/configs/sipeed-maix.h  |   7 +-
>  4 files changed, 301 insertions(+), 52 deletions(-)
>
> diff --git a/board/sipeed/maix/Kconfig b/board/sipeed/maix/Kconfig
> index 4c42dd2087..2cdea8ea81 100644
> --- a/board/sipeed/maix/Kconfig
> +++ b/board/sipeed/maix/Kconfig
> @@ -53,4 +53,20 @@ config BOARD_SPECIFIC_OPTIONS
> imply CMD_GPIO
> imply LED
> imply LED_GPIO
> +   imply SPI
> +   imply DESIGNWARE_SPI
> +   imply SPI_FLASH_GIGADEVICE
> +   imply SPI_FLASH_WINBOND
> +   imply DM_MTD
> +   imply SPI_FLASH_MTD
> +   imply CMD_MTD
> +   imply ENV_IS_IN_SPI_FLASH
> +   imply MMC
> +   imply MMC_BROKEN_CD
> +   imply MMC_SPI
> +   imply CMD_MMC
> +   imply DOS_PARTITION
> +   imply EFI_PARTITION
> +   imply CMD_PART
> +   imply CMD_FS_GENERIC
>  endif
> diff --git a/configs/sipeed_maix_bitm_defconfig 
> b/configs/sipeed_maix_bitm_defconfig
> index 459bf0d530..210848cccf 100644
> --- a/configs/sipeed_maix_bitm_defconfig
> +++ b/configs/sipeed_maix_bitm_defconfig
> @@ -1,8 +1,19 @@
>  CONFIG_RISCV=y
> +CONFIG_ENV_SIZE=0x1000
> +CONFIG_ENV_OFFSET=0xfff000
> +CONFIG_ENV_SECT_SIZE=0x1000
>  CONFIG_TARGET_SIPEED_MAIX=y
>  CONFIG_ARCH_RV64I=y
>  CONFIG_STACK_SIZE=0x10
> +CONFIG_USE_BOOTCOMMAND=y
> +CONFIG_BOOTCOMMAND="run k210_bootcmd"
> +CONFIG_HUSH_PARSER=y
> +CONFIG_MTDIDS_DEFAULT="nor0=spi3:0"
> +CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
>  # CONFIG_NET is not set
>  # CONFIG_INPUT is not set
> +CONFIG_SF_DEFAULT_BUS=3
>  # CONFIG_DM_ETH is not set
> +CONFIG_FS_EXT4=y
> +CONFIG_FS_FAT=y
>  # CONFIG_EFI_LOADER is not set
> diff --git a/doc/board/sipeed/maix.rst b/doc/board/sipeed/maix.rst
> index 92f2d112a9..bf945b3458 100644
> --- a/doc/board/sipeed/maix.rst
> +++ b/doc/board/sipeed/maix.rst
> @@ -70,6 +70,7 @@ console shall be opened immediately. Boot output should 
> look like the following:
>  U-Boot 2020.04-rc2-00087-g2221cc09c1-dirty (Feb 28 2020 - 13:53:09 -0500)
>
>  DRAM:  8 MiB
> +MMC:   spi@5300:slot@0: 0
>  In:serial@3800
>  Out:   serial@3800
>  Err:   serial@3800
> @@ -118,14 +119,115 @@ The value of FW_PAYLOAD_OFFSET must match 
> CONFIG_SYS_TEXT_BASE - 0x8000.
>
>  The file to flash is build/platform/kendryte/k210/firmware/fw_payload.bin.
>
> -Loading Images
> -^^
> +Booting
> +^^^
>
> -To load a kernel, transfer it over serial.
> +The default boot process is to load and boot the files ``/uImage`` and
> +``/k210.dtb`` off of the first partition of the MMC. For Linux, this will 
> result
> +in an output like
>
>  .. code-block:: none
>
> -=> loady 8000 150
> +U-Boot 2020.10-00691-gd1d651d988-dirty (Oct 16 2020 - 17:05:24 -0400)
> +
> +DRAM:  8 MiB
> +MMC:   spi@5300:slot@0: 0
> +Loading Environment from SPIFlash... SF: Detected w25q128fw with page 
> size 256 Bytes, erase size 4 KiB, total 16 MiB
> +OK
> +In:serial@3800
> +Out:   serial@3800
> +Err:   serial@3800
> +Hit any key to stop autoboot:  0
> +1827380 bytes read in 1044 ms (1.7 MiB/s)
> +13428 bytes read in 10 ms (1.3 MiB/s)
> +## Booting kernel from Legacy Image at 8006 ...
> +   Image Name:   linux
> +   Image Type:   RISC-V Linux Kernel Image (uncompressed)
> +   Data Size:1827316 Bytes = 1.7 MiB
> +   Load Address: 8000
> +   Entry Point:  8000
> +   Verifying Checksum ... OK
> +## Flattened Device Tree blob at 8040
> +   Booting using the fdt blob at 0x8040
> +   Loading Kernel Image
> +   Loading Device Tree to 803f9000, end 803ff473 ... OK
> +
> +Starting kernel ...
> +
> +[0.00] Linux version 5.9.0-00021-g6dcc2f0814c6-dirty 
> (sean@godwin) (riscv64-linux-gnu-gcc (GCC)