Merge pull request #70 from sydarn/rk3566-update-uboot-linux

rk3566: update u-boot, detect rgb30 revisions
This commit is contained in:
sydarn 2024-04-08 20:39:47 +02:00 committed by GitHub
commit 09cbfc9963
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 123 additions and 113 deletions

View file

@ -20,7 +20,7 @@ case ${DEVICE} in
;;
RK3566*)
PKG_URL="https://github.com/u-boot/u-boot.git"
PKG_VERSION="e8f2404e093daf6cc3ac2b3233e3c6770d13e371"
PKG_VERSION="9cba29b19f43f9450117e8bc89e7dda691ed5ab5"
PKG_GIT_CLONE_BRANCH="master"
;;
RK3399)

View file

@ -100,7 +100,7 @@ index eb8f65ae4..d2308768b 100644
return 0;
}
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index d05502f67..e12a85a02 100644
index 099eea60c3..043769dfe0 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -5,6 +5,7 @@
@ -109,24 +109,24 @@ index d05502f67..e12a85a02 100644
#include <adc.h>
+#include <asm/arch-rockchip/boot_mode.h>
#include <asm/io.h>
#include <command.h>
#include <display.h>
#include <dm.h>
@@ -150,11 +151,14 @@ static const struct rg353_panel rg353_panel_details[] = {
@@ -220,12 +221,12 @@ void read_func_button(void)
};
/*
- * Start LED very early so user knows device is on. Set color
- * to red.
+ * Check if rockchip_dnl button is pressed and reboot into rockusb if
+ * true. Start LED very early so user knows device is on. Set color
* to red.
+ * true. Start LED very early so user knows device is on. Set color*
*/
void spl_board_init(void)
{
- read_func_button();
+ setup_boot_mode();
+
/* Set GPIO0_C5, GPIO0_C6, and GPIO0_C7 to output. */
writel(GPIO_WRITEMASK(GPIO_C7 | GPIO_C6 | GPIO_C5) | \
(GPIO_C7 | GPIO_C6 | GPIO_C5),
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 6405374bc..bd3fe74fc 100644
--- a/common/spl/Kconfig
@ -146,80 +146,17 @@ index 6405374bc..bd3fe74fc 100644
bool "Support CACHE drivers"
help
diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig
index ed6643d9d..4e72f7581 100644
index c8c9238f96..923c05d130 100644
--- a/configs/anbernic-rgxx3-rk3566_defconfig
+++ b/configs/anbernic-rgxx3-rk3566_defconfig
@@ -3,6 +3,7 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_TEXT_BASE=0x00a00000
+CONFIG_SPL_GPIO=y
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_NR_DRAM_BANKS=2
@@ -24,7 +25,9 @@ CONFIG_SYS_LOAD_ADDR=0xc00800
CONFIG_DEBUG_UART=y
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_FIT_SIGNATURE=y
CONFIG_SPL_LOAD_FIT=y
+CONFIG_LEGACY_IMAGE_FORMAT=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_OF_STDOUT_VIA_ALIAS=y
CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-anbernic-rgxx3.dtb"
@@ -32,7 +35,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-anbernic-rgxx3.dtb"
# CONFIG_DISPLAY_CPUINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_BOARD_RNG_SEED=y
-CONFIG_SPL_MAX_SIZE=0x20000
+CONFIG_SPL_MAX_SIZE=0x40000
@@ -31,6 +31,7 @@ CONFIG_SPL_MAX_SIZE=0x40000
CONFIG_SPL_PAD_TO=0x7f8000
CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
CONFIG_SPL_BSS_START_ADDR=0x4000000
@@ -41,6 +44,8 @@ CONFIG_SPL_BOARD_INIT=y
CONFIG_SPL_BOARD_INIT=y
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
CONFIG_SPL_STACK_R=y
+CONFIG_SPL_ADC=y
+CONFIG_SPL_POWER=y
CONFIG_SPL_POWER=y
CONFIG_SPL_ATF=y
CONFIG_CMD_PWM=y
CONFIG_CMD_GPT=y
@@ -50,8 +55,10 @@ CONFIG_CMD_MMC=y
# CONFIG_SPL_DOS_PARTITION is not set
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_VARS_UBOOT_RUNTIME_CONFIG=y
# CONFIG_NET is not set
+CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_SPL_REGMAP=y
CONFIG_SPL_SYSCON=y
CONFIG_SPL_CLK=y
@@ -67,13 +74,13 @@ CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_ROCKCHIP=y
CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY=y
+CONFIG_SPL_PINCTRL=y
CONFIG_DM_PMIC=y
CONFIG_DM_PMIC_FAN53555=y
CONFIG_PMIC_RK8XX=y
-CONFIG_REGULATOR_PWM=y
-CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
CONFIG_REGULATOR_RK8XX=y
-CONFIG_DM_REGULATOR_SCMI=y
CONFIG_PWM_ROCKCHIP=y
CONFIG_SPL_RAM=y
# CONFIG_RAM_ROCKCHIP_DEBUG is not set
@@ -89,5 +96,6 @@ CONFIG_VIDEO_ROCKCHIP=y
CONFIG_DISPLAY_ROCKCHIP_DW_MIPI=y
CONFIG_VIDEO_BRIDGE=y
CONFIG_REGEX=y
+# CONFIG_RSA is not set
CONFIG_ERRNO_STR=y
# CONFIG_EFI_LOADER is not set
diff --git a/drivers/Makefile b/drivers/Makefile
index bf73b7718..81ba2c534 100644
--- a/drivers/Makefile

View file

@ -56,17 +56,17 @@ Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
create mode 100644 include/configs/powkiddy-x55-rk3566.h
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 5fc888680b..6e5cb7c3e9 100644
index 2634bb4c9a..6d4df7bccc 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -172,6 +172,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
@@ -148,6 +148,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
dtb-$(CONFIG_ROCKCHIP_RK3568) += \
rk3566-anbernic-rgxx3.dtb \
+ rk3566-powkiddy-x55.dtb \
rk3566-pinetab2-v0.1.dtb \
rk3566-pinetab2-v2.0.dtb \
rk3566-quartz64-a.dtb \
rk3566-quartz64-b.dtb \
rk3566-radxa-cm3-io.dtb \
diff --git a/arch/arm/dts/rk3566-powkiddy-x55-u-boot.dtsi b/arch/arm/dts/rk3566-powkiddy-x55-u-boot.dtsi
new file mode 100644
index 0000000000..1a3089b598

View file

@ -1,10 +1,10 @@
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index d05502f67..98b3bc145 100644
index 043769dfe0..b44c0b63fe 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -32,7 +32,7 @@
#define GPIO_WRITEMASK(bits) ((bits) << 16)
@@ -45,7 +45,7 @@
#define SARADC_INPUT_SRC_MSK 0x7
#define SARADC_POWER_CTRL BIT(3)
-#define DTB_DIR "rockchip/"
+#define DTB_DIR ""
@ -12,11 +12,11 @@ index d05502f67..98b3bc145 100644
struct rg3xx_model {
const u16 adc_value;
diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig
index ed6643d9d..83e8358a0 100644
index c8c9238f96..f26801f4eb 100644
--- a/configs/anbernic-rgxx3-rk3566_defconfig
+++ b/configs/anbernic-rgxx3-rk3566_defconfig
@@ -27,7 +27,7 @@ CONFIG_FIT_VERBOSE=y
CONFIG_SPL_LOAD_FIT=y
@@ -22,7 +22,7 @@ CONFIG_SPL_LOAD_FIT=y
CONFIG_LEGACY_IMAGE_FORMAT=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-anbernic-rgxx3.dtb"

View file

@ -1,26 +0,0 @@
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index 194605ff06..ee498631ba 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -49,6 +49,7 @@ enum rgxx3_device_id {
RG353V,
RG503,
RGB30,
+ RGB10MAX3,
RK2023,
RGARCD,
/* Devices with duplicate ADC value */
@@ -94,6 +95,13 @@ static const struct rg3xx_model rg3xx_model_details[] = {
.fdtfile = DTB_DIR "rk3566-powkiddy-rgb30.dtb",
.detect_panel = 0,
},
+ [RGB10MAX3] = {
+ .adc_value = 765, /* Observed average from device */
+ .board = "rk3566-powkiddy-rgb10max3",
+ .board_name = "RGB10MAX3",
+ .fdtfile = DTB_DIR "rk3566-powkiddy-rgb10max3.dtb",
+ .detect_panel = 0,
+ },
[RK2023] = {
.adc_value = 635, /* Observed average from device */
.board = "rk3566-powkiddy-rk2023",

View file

@ -0,0 +1,99 @@
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index b44c0b63fe..9f30c3a6d0 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -21,6 +21,7 @@
#include <pwm.h>
#include <stdlib.h>
#include <video_bridge.h>
+#include <i2c.h>
#define BOOT_BROM_DOWNLOAD 0xef08a53c
@@ -46,6 +47,7 @@
#define SARADC_POWER_CTRL BIT(3)
#define DTB_DIR ""
+#define RGB30R2_VDD_CPU_REGULATOR_ADDR 0x40
struct rg3xx_model {
const u16 adc_value;
@@ -68,6 +70,7 @@ enum rgxx3_device_id {
RG353PS,
RG353VS,
RGARCS,
+ RGB30R2,
};
static const struct rg3xx_model rg3xx_model_details[] = {
@@ -150,6 +153,13 @@ static const struct rg3xx_model rg3xx_model_details[] = {
.fdtfile = DTB_DIR "rk3566-anbernic-rg-arc-s.dtb",
.detect_panel = 0,
},
+ [RGB30R2] = {
+ .adc_value = 383, /* Gathered from second hand information */
+ .board = "rk3566-powkiddy-rgb30",
+ .board_name = "RGB30R2",
+ .fdtfile = DTB_DIR "rk3566-powkiddy-rgb30r2.dtb",
+ .detect_panel = 0,
+ },
};
struct rg353_panel {
@@ -398,6 +408,29 @@ int rgxx3_detect_display(void)
return 0;
}
+/*
+ * Detect vdd_cpu regulator, RGB30 has two revisions where this differs.
+ */
+int probe_rgb30r2_detect_vdd_cpu_regulator(void)
+{
+ struct udevice *bus, *dev;
+ int ret;
+
+ ret = uclass_get_device(UCLASS_I2C, 0, &bus);
+ if (ret) {
+ printf("i2c0 bus not found, regulator probe attempt failed.\n");
+ return ret;
+ }
+
+ ret = dm_i2c_probe(bus, RGB30R2_VDD_CPU_REGULATOR_ADDR, 0, &dev);
+ if (ret) {
+ printf("Regulator not found found\n");
+ return ret;
+ }
+
+ return 0;
+}
+
/* Detect which Anbernic RGXX3 device we are using so as to load the
* correct devicetree for Linux. Set an environment variable once
* found. The detection depends on the value of ADC channel 1, the
@@ -452,6 +485,10 @@ int rgxx3_detect_device(void)
}
}
+ if (board_id == RGB30 && probe_rgb30r2_detect_vdd_cpu_regulator() == 0) {
+ board_id = RGB30R2;
+ }
+
if (board_id < 0)
return board_id;
diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig
index f26801f4eb..ff9a6bd81b 100644
--- a/configs/anbernic-rgxx3-rk3566_defconfig
+++ b/configs/anbernic-rgxx3-rk3566_defconfig
@@ -52,6 +52,11 @@ CONFIG_ARM_SMCCC_FEATURES=y
CONFIG_SCMI_FIRMWARE=y
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_DM=y
+CONFIG_DM_I2C=y
+CONFIG_DM_I2C_COMPAT=y
+CONFIG_SPL_I2C=y
+CONFIG_I2C0_ENABLE=y
CONFIG_MISC=y
CONFIG_SUPPORT_EMMC_RPMB=y
CONFIG_MMC_DW=y