build/patch/u-boot/u-boot-rockchip64-v2022.04/board-rock-pi-4-enable-spi-flash.patch

226 lines
9.3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Piotr Szczepanik <piter75@gmail.com>
Date: Sat, 17 Oct 2020 23:38:05 +0200
Subject: [ARCHEOLOGY] Reserve last 32KiB for environment in SPI for ROCK Pi 4
> X-Git-Archeology: - Revision 5d68d4a68e58b402bbf9c14532a27bea241adaa5: https://github.com/armbian/build/commit/5d68d4a68e58b402bbf9c14532a27bea241adaa5
> X-Git-Archeology: Date: Sat, 17 Oct 2020 23:38:05 +0200
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Reserve last 32KiB for environment in SPI for ROCK Pi 4
> X-Git-Archeology:
> X-Git-Archeology: - Revision 20242214ecbc845da2615d757899bb3db8af701f: https://github.com/armbian/build/commit/20242214ecbc845da2615d757899bb3db8af701f
> X-Git-Archeology: Date: Sat, 17 Oct 2020 23:38:05 +0200
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Split ROCK Pi 4 into 4A, 4B and 4C in u-boot (4A uses 4B DT)
> X-Git-Archeology:
> X-Git-Archeology: - Revision c43c4e9cbd08e136c098eabe4c92b465ca377d0c: https://github.com/armbian/build/commit/c43c4e9cbd08e136c098eabe4c92b465ca377d0c
> X-Git-Archeology: Date: Sat, 17 Oct 2020 23:38:05 +0200
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Add SPI flash boot support to rockchip64/rk3399
> X-Git-Archeology:
> X-Git-Archeology: - Revision 20e661846473f946bb003d0df584dfd6cc7fa9d3: https://github.com/armbian/build/commit/20e661846473f946bb003d0df584dfd6cc7fa9d3
> X-Git-Archeology: Date: Sat, 17 Oct 2020 23:38:05 +0200
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Enabled SPI flash for ROCK Pi 4
> X-Git-Archeology:
> X-Git-Archeology: - Revision b3ad046d4ce26732342df22a886b7f0f51fe5498: https://github.com/armbian/build/commit/b3ad046d4ce26732342df22a886b7f0f51fe5498
> X-Git-Archeology: Date: Fri, 04 Dec 2020 00:19:05 +0100
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Enable additional SPI flash chips for ROCK Pi 4 in u-boot (#2408)
> X-Git-Archeology:
> X-Git-Archeology: - Revision ef96d0862b82582cef2cb4ad711a169106d18eab: https://github.com/armbian/build/commit/ef96d0862b82582cef2cb4ad711a169106d18eab
> X-Git-Archeology: Date: Fri, 04 Dec 2020 22:21:50 +0100
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Enable additional SPI flash chips for ROCK Pi 4 in u-boot (also for C model)
> X-Git-Archeology:
> X-Git-Archeology: - Revision 2a3c216d4107ddf30abadc6ba3c5707c1fa59ff2: https://github.com/armbian/build/commit/2a3c216d4107ddf30abadc6ba3c5707c1fa59ff2
> X-Git-Archeology: Date: Mon, 04 Jan 2021 01:02:20 +0100
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Switched rockchip64/rk3399 to u-boot v2020.10 (#2512)
> X-Git-Archeology:
> X-Git-Archeology: - Revision 86abac1fd4e169712a44d245cf7adef4ee17c420: https://github.com/armbian/build/commit/86abac1fd4e169712a44d245cf7adef4ee17c420
> X-Git-Archeology: Date: Tue, 26 Oct 2021 22:14:41 +0200
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Cleanup u-boot configurations for rockchip64 derivatives (#3150)
> X-Git-Archeology:
> X-Git-Archeology: - Revision 71ff7b3b989dcb7e86b7e1c00a408a2f53744ea0: https://github.com/armbian/build/commit/71ff7b3b989dcb7e86b7e1c00a408a2f53744ea0
> X-Git-Archeology: Date: Thu, 11 Nov 2021 23:49:52 +0100
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Switched rockchip64 u-boot to v2021.07 (#3233)
> X-Git-Archeology:
> X-Git-Archeology: - Revision 26437e36c18bb09484f4150e396a1784cc6471b7: https://github.com/armbian/build/commit/26437e36c18bb09484f4150e396a1784cc6471b7
> X-Git-Archeology: Date: Thu, 16 Jun 2022 12:27:05 +0200
> X-Git-Archeology: From: Piotr Szczepanik <piter75@gmail.com>
> X-Git-Archeology: Subject: Switched rockchip64 u-boot to v2022.04 (#3871)
> X-Git-Archeology:
> X-Git-Archeology: - Revision f99b356ff47757f59bee370a6c2b0329b0a028e6: https://github.com/armbian/build/commit/f99b356ff47757f59bee370a6c2b0329b0a028e6
> X-Git-Archeology: Date: Fri, 14 Oct 2022 09:19:50 +0200
> X-Git-Archeology: From: Igor Pecovnik <igorpecovnik@users.noreply.github.com>
> X-Git-Archeology: Subject: Bump Rockchip64 u-boot to 2022.07 (#4246)
> X-Git-Archeology:
> X-Git-Archeology: - Revision 2813365dd25e3ad110936cbf014b95b38d7090ec: https://github.com/armbian/build/commit/2813365dd25e3ad110936cbf014b95b38d7090ec
> X-Git-Archeology: Date: Mon, 07 Nov 2022 21:29:00 +0100
> X-Git-Archeology: From: Igor Pecovnik <igorpecovnik@users.noreply.github.com>
> X-Git-Archeology: Subject: Move known non working rockhip64 boards to previous boot loader (#4392)
> X-Git-Archeology:
---
arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 22 +++++++++-
configs/rock-pi-4-rk3399_defconfig | 13 +++++-
configs/rock-pi-4c-rk3399_defconfig | 13 +++++-
3 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi b/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi
index c17e769f64..bd8c60b4cd 100644
--- a/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi
@@ -8,7 +8,27 @@
/ {
chosen {
- u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc;
+ u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci;
+ };
+
+ config {
+ u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */
+ };
+};
+
+&spi1 {
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+ };
+};
+
+&spi1 {
+ spi_flash: flash@0 {
+ u-boot,dm-pre-reloc;
};
};
diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig
index 4f15627d59..63d04ced6e 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -3,12 +3,16 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x6000
CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_ENV_SECT_SIZE=0x1000
CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4b"
CONFIG_ROCKCHIP_RK3399=y
CONFIG_TARGET_EVB_RK3399=y
CONFIG_DEBUG_UART_BASE=0xFF1A0000
CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
CONFIG_DEBUG_UART=y
CONFIG_SYS_LOAD_ADDR=0x800800
# CONFIG_ANDROID_BOOT_IMAGE is not set
@@ -18,6 +22,7 @@ CONFIG_MISC_INIT_R=y
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
CONFIG_SPL_STACK_R=y
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
+CONFIG_SPL_SPI_LOAD=y
CONFIG_TPL=y
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GPT=y
@@ -28,8 +33,9 @@ CONFIG_CMD_USB=y
CONFIG_CMD_TIME=y
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_ENV_IS_IN_SPI_FLASH=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=y
CONFIG_MISC=y
@@ -38,6 +44,10 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_SDHCI=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_DM_ETH=y
CONFIG_ETH_DESIGNWARE=y
CONFIG_GMAC_ROCKCHIP=y
@@ -53,6 +63,7 @@ CONFIG_RAM_RK3399_LPDDR4=y
CONFIG_DM_RESET=y
CONFIG_BAUDRATE=1500000
CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_ROCKCHIP_SPI=y
CONFIG_SYSRESET=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig
index 0381a1ca3f..77c9b9d98f 100644
--- a/configs/rock-pi-4c-rk3399_defconfig
+++ b/configs/rock-pi-4c-rk3399_defconfig
@@ -3,12 +3,16 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x6000
CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_ENV_SECT_SIZE=0x1000
CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c"
CONFIG_ROCKCHIP_RK3399=y
CONFIG_TARGET_EVB_RK3399=y
CONFIG_DEBUG_UART_BASE=0xFF1A0000
CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
CONFIG_DEBUG_UART=y
CONFIG_SYS_LOAD_ADDR=0x800800
# CONFIG_ANDROID_BOOT_IMAGE is not set
@@ -18,6 +22,7 @@ CONFIG_MISC_INIT_R=y
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
CONFIG_SPL_STACK_R=y
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
+CONFIG_SPL_SPI_LOAD=y
CONFIG_TPL=y
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GPT=y
@@ -28,8 +33,9 @@ CONFIG_CMD_USB=y
CONFIG_CMD_TIME=y
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_ENV_IS_IN_SPI_FLASH=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=y
CONFIG_MISC=y
@@ -38,6 +44,10 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_SDHCI=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_DM_ETH=y
CONFIG_ETH_DESIGNWARE=y
CONFIG_GMAC_ROCKCHIP=y
@@ -53,6 +63,7 @@ CONFIG_RAM_RK3399_LPDDR4=y
CONFIG_DM_RESET=y
CONFIG_BAUDRATE=1500000
CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_ROCKCHIP_SPI=y
CONFIG_SYSRESET=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
--
Armbian