diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/001-fixup_locating_dts.dont_patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/001-fixup_locating_dts.dont_patch deleted file mode 100644 index fbc9379ac..000000000 --- a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/001-fixup_locating_dts.dont_patch +++ /dev/null @@ -1,58 +0,0 @@ -diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c -index 3f1a42d184..6af078d390 100644 ---- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c -+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c -@@ -33,8 +33,6 @@ - - #define GPIO_WRITEMASK(bits) ((bits) << 16) - --#define DTB_DIR "rockchip/" -- - struct rg3xx_model { - const u16 adc_value; - const char *board; -@@ -57,38 +55,38 @@ static const struct rg3xx_model rg3xx_model_details[] = { - 517, /* Observed average from device */ - "rk3566-anbernic-rg353m", - "RG353M", -- DTB_DIR "rk3566-anbernic-rg353p.dtb", /* Identical devices */ -+ "rk3566-anbernic-rg353p.dtb", /* Identical devices */ - }, - [RG353P] = { - 860, /* Documented value of 860 */ - "rk3566-anbernic-rg353p", - "RG353P", -- DTB_DIR "rk3566-anbernic-rg353p.dtb", -+ "rk3566-anbernic-rg353p.dtb", - }, - [RG353V] = { - 695, /* Observed average from device */ - "rk3566-anbernic-rg353v", - "RG353V", -- DTB_DIR "rk3566-anbernic-rg353v.dtb", -+ "rk3566-anbernic-rg353v.dtb", - }, - [RG503] = { - 1023, /* Observed average from device */ - "rk3566-anbernic-rg503", - "RG503", -- DTB_DIR "rk3566-anbernic-rg503.dtb", -+ "rk3566-anbernic-rg503.dtb", - }, - /* Devices with duplicate ADC value */ - [RG353PS] = { - 860, /* Observed average from device */ - "rk3566-anbernic-rg353ps", - "RG353PS", -- DTB_DIR "rk3566-anbernic-rg353ps.dtb", -+ "rk3566-anbernic-rg353ps.dtb", - }, - [RG353VS] = { - 695, /* Gathered from second hand information */ - "rk3566-anbernic-rg353vs", - "RG353VS", -- DTB_DIR "rk3566-anbernic-rg353vs.dtb", -+ "rk3566-anbernic-rg353vs.dtb", - }, - }; - diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/101_V3_1_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/101_V3_1_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/101_V3_1_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/101_V3_1_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/102_V3_2_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/102_V3_2_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/102_V3_2_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/102_V3_2_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/103_V3_3_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/103_V3_3_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/103_V3_3_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/103_V3_3_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/104_V3_4_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/104_V3_4_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/104_V3_4_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/104_V3_4_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/105_V3_5_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/105_V3_5_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/105_V3_5_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/105_V3_5_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/106_V3_6_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/106_V3_6_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/106_V3_6_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/106_V3_6_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/107_V3_7_7_Add_additional_boards_and_features_to_rgxx3.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/107_V3_7_7_Add_additional_boards_and_features_to_rgxx3.dont_patch similarity index 100% rename from projects/Rockchip/packages/u-boot/patches/RK3566-ML/107_V3_7_7_Add_additional_boards_and_features_to_rgxx3.patch rename to projects/Rockchip/packages/u-boot/patches/RK3566-ML/107_V3_7_7_Add_additional_boards_and_features_to_rgxx3.dont_patch diff --git a/projects/Rockchip/packages/u-boot/patches/RK3566-ML/200_Omnibus_patch_with_rgxxx3_changes_and_removal_of_dir_from_uboot_dtb_path.patch b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/200_Omnibus_patch_with_rgxxx3_changes_and_removal_of_dir_from_uboot_dtb_path.patch new file mode 100644 index 000000000..908b5f4d1 --- /dev/null +++ b/projects/Rockchip/packages/u-boot/patches/RK3566-ML/200_Omnibus_patch_with_rgxxx3_changes_and_removal_of_dir_from_uboot_dtb_path.patch @@ -0,0 +1,652 @@ +diff --git a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi +index f986e1941..e3ab196d2 100644 +--- a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi ++++ b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi +@@ -76,6 +76,12 @@ + /delete-property/ clock-names; + }; + ++&saradc { ++ bootph-all; ++ vref-supply = <&vcc_sys>; ++ status = "okay"; ++}; ++ + &sdhci { + pinctrl-0 = <&emmc_bus8>, <&emmc_clk>, <&emmc_cmd>, + <&emmc_datastrobe>, <&emmc_rstnout>; +@@ -94,3 +100,8 @@ + bootph-all; + status = "okay"; + }; ++ ++&vcc_sys { ++ bootph-all; ++ status = "okay"; ++}; +diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile +index 1dc92066b..ff089ae94 100644 +--- a/arch/arm/mach-rockchip/Makefile ++++ b/arch/arm/mach-rockchip/Makefile +@@ -15,13 +15,13 @@ obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o + + obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o + +-ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) +- + # Always include boot_mode.o, as we bypass it (i.e. turn it off) + # inside of boot_mode.c when CONFIG_ROCKCHIP_BOOT_MODE_REG is 0. This way, + # we can have the preprocessor correctly recognise both 0x0 and 0 + # meaning "turn it off". + obj-y += boot_mode.o ++ ++ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) + obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o + obj-$(CONFIG_MISC_INIT_R) += misc.o + endif +diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c +index 57f08e0be..77145524e 100644 +--- a/arch/arm/mach-rockchip/board.c ++++ b/arch/arm/mach-rockchip/board.c +@@ -348,3 +348,35 @@ __weak int misc_init_r(void) + return ret; + } + #endif ++ ++#if IS_ENABLED(CONFIG_BOARD_RNG_SEED) && IS_ENABLED(CONFIG_RNG_ROCKCHIP) ++#include ++ ++/* Use hardware rng to seed Linux random. */ ++__weak int board_rng_seed(struct abuf *buf) ++{ ++ struct udevice *dev; ++ size_t len = 0x8; ++ u64 *data; ++ ++ data = malloc(len); ++ if (!data) { ++ printf("Out of memory\n"); ++ return -ENOMEM; ++ } ++ ++ if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { ++ printf("No RNG device\n"); ++ return -ENODEV; ++ } ++ ++ if (dm_rng_read(dev, data, len)) { ++ printf("Reading RNG failed\n"); ++ return -EIO; ++ } ++ ++ abuf_init_set(buf, data, len); ++ ++ return 0; ++} ++#endif +diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c +index eb8f65ae4..d2308768b 100644 +--- a/arch/arm/mach-rockchip/boot_mode.c ++++ b/arch/arm/mach-rockchip/boot_mode.c +@@ -38,6 +38,10 @@ void set_back_to_bootrom_dnl_flag(void) + #define KEY_DOWN_MIN_VAL 0 + #define KEY_DOWN_MAX_VAL 30 + ++#ifndef RK_DNL_ADC_CHAN ++#define RK_DNL_ADC_CHAN 1 ++#endif ++ + __weak int rockchip_dnl_key_pressed(void) + { + unsigned int val; +@@ -52,7 +56,8 @@ __weak int rockchip_dnl_key_pressed(void) + ret = -ENODEV; + uclass_foreach_dev(dev, uc) { + if (!strncmp(dev->name, "saradc", 6)) { +- ret = adc_channel_single_shot(dev->name, 1, &val); ++ ret = adc_channel_single_shot(dev->name, ++ RK_DNL_ADC_CHAN, &val); + break; + } + } +@@ -73,11 +78,13 @@ __weak int rockchip_dnl_key_pressed(void) + + void rockchip_dnl_mode_check(void) + { ++#if CONFIG_IS_ENABLED(ADC) + if (rockchip_dnl_key_pressed()) { + printf("download key pressed, entering download mode..."); + set_back_to_bootrom_dnl_flag(); + do_reset(NULL, 0, 0, NULL); + } ++#endif + } + + int setup_boot_mode(void) +@@ -90,6 +97,7 @@ int setup_boot_mode(void) + boot_mode = readl(reg); + debug("%s: boot mode 0x%08x\n", __func__, boot_mode); + ++#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) + /* Clear boot mode */ + writel(BOOT_NORMAL, reg); + +@@ -103,6 +111,7 @@ int setup_boot_mode(void) + env_set("preboot", "setenv preboot; ums mmc 0"); + break; + } ++#endif + + return 0; + } +diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +index 3f1a42d18..94af45cf0 100644 +--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c ++++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +@@ -5,6 +5,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -16,7 +17,6 @@ + #include + #include + #include +-#include + #include + #include + +@@ -33,13 +33,15 @@ + + #define GPIO_WRITEMASK(bits) ((bits) << 16) + +-#define DTB_DIR "rockchip/" ++// #define DTB_DIR "rockchip/" ++#define DTB_DIR "" + + struct rg3xx_model { + const u16 adc_value; + const char *board; + const char *board_name; + const char *fdtfile; ++ const bool detect_panel; + }; + + enum rgxx3_device_id { +@@ -47,67 +49,117 @@ enum rgxx3_device_id { + RG353P, + RG353V, + RG503, ++ RGB30, ++ RK2023, ++ RGARCD, + /* Devices with duplicate ADC value */ + RG353PS, + RG353VS, ++ RGARCS, + }; + + static const struct rg3xx_model rg3xx_model_details[] = { + [RG353M] = { +- 517, /* Observed average from device */ +- "rk3566-anbernic-rg353m", +- "RG353M", +- DTB_DIR "rk3566-anbernic-rg353p.dtb", /* Identical devices */ ++ .adc_value = 517, /* Observed average from device */ ++ .board = "rk3566-anbernic-rg353m", ++ .board_name = "RG353M", ++ /* Device is identical to RG353P. */ ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg353p.dtb", ++ .detect_panel = 1, + }, + [RG353P] = { +- 860, /* Documented value of 860 */ +- "rk3566-anbernic-rg353p", +- "RG353P", +- DTB_DIR "rk3566-anbernic-rg353p.dtb", ++ .adc_value = 860, /* Documented value of 860 */ ++ .board = "rk3566-anbernic-rg353p", ++ .board_name = "RG353P", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg353p.dtb", ++ .detect_panel = 1, + }, + [RG353V] = { +- 695, /* Observed average from device */ +- "rk3566-anbernic-rg353v", +- "RG353V", +- DTB_DIR "rk3566-anbernic-rg353v.dtb", ++ .adc_value = 695, /* Observed average from device */ ++ .board = "rk3566-anbernic-rg353v", ++ .board_name = "RG353V", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg353v.dtb", ++ .detect_panel = 1, + }, + [RG503] = { +- 1023, /* Observed average from device */ +- "rk3566-anbernic-rg503", +- "RG503", +- DTB_DIR "rk3566-anbernic-rg503.dtb", ++ .adc_value = 1023, /* Observed average from device */ ++ .board = "rk3566-anbernic-rg503", ++ .board_name = "RG503", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg503.dtb", ++ .detect_panel = 0, ++ }, ++ [RGB30] = { ++ .adc_value = 383, /* Gathered from second hand information */ ++ .board = "rk3566-powkiddy-rgb30", ++ .board_name = "RGB30", ++ .fdtfile = DTB_DIR "rk3566-powkiddy-rgb30.dtb", ++ .detect_panel = 0, ++ }, ++ [RK2023] = { ++ .adc_value = 635, /* Observed average from device */ ++ .board = "rk3566-powkiddy-rk2023", ++ .board_name = "RK2023", ++ .fdtfile = DTB_DIR "rk3566-powkiddy-rk2023.dtb", ++ .detect_panel = 0, ++ }, ++ [RGARCD] = { ++ .adc_value = 183, /* Observed average from device */ ++ .board = "rk3566-anbernic-rg-arc-d", ++ .board_name = "Anbernic RG ARC-D", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg-arc-d.dtb", ++ .detect_panel = 0, + }, + /* Devices with duplicate ADC value */ + [RG353PS] = { +- 860, /* Observed average from device */ +- "rk3566-anbernic-rg353ps", +- "RG353PS", +- DTB_DIR "rk3566-anbernic-rg353ps.dtb", ++ .adc_value = 860, /* Observed average from device */ ++ .board = "rk3566-anbernic-rg353ps", ++ .board_name = "RG353PS", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg353ps.dtb", ++ .detect_panel = 1, + }, + [RG353VS] = { +- 695, /* Gathered from second hand information */ +- "rk3566-anbernic-rg353vs", +- "RG353VS", +- DTB_DIR "rk3566-anbernic-rg353vs.dtb", ++ .adc_value = 695, /* Gathered from second hand information */ ++ .board = "rk3566-anbernic-rg353vs", ++ .board_name = "RG353VS", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg353vs.dtb", ++ .detect_panel = 1, ++ }, ++ [RGARCS] = { ++ .adc_value = 183, /* Observed average from device */ ++ .board = "rk3566-anbernic-rg-arc-s", ++ .board_name = "Anbernic RG ARC-S", ++ .fdtfile = DTB_DIR "rk3566-anbernic-rg-arc-s.dtb", ++ .detect_panel = 0, + }, + }; + + struct rg353_panel { + const u16 id; +- const char *panel_compat; ++ const char *panel_compat[2]; + }; + + static const struct rg353_panel rg353_panel_details[] = { +- { .id = 0x3052, .panel_compat = "newvision,nv3051d"}, +- { .id = 0x3821, .panel_compat = "anbernic,rg353v-panel-v2"}, ++ { ++ .id = 0x3052, ++ .panel_compat[0] = "anbernic,rg353p-panel", ++ .panel_compat[1] = "newvision,nv3051d", ++ }, ++ { ++ .id = 0x3821, ++ .panel_compat[0] = "anbernic,rg353v-panel-v2", ++ .panel_compat[1] = NULL, ++ }, + }; + + /* +- * Start LED very early so user knows device is on. Set color ++ * 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. + */ + void spl_board_init(void) + { ++ 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), +@@ -117,34 +169,6 @@ void spl_board_init(void) + (GPIO0_BASE + GPIO_SWPORT_DR_H)); + } + +-/* Use hardware rng to seed Linux random. */ +-int board_rng_seed(struct abuf *buf) +-{ +- struct udevice *dev; +- size_t len = 0x8; +- u64 *data; +- +- data = malloc(len); +- if (!data) { +- printf("Out of memory\n"); +- return -ENOMEM; +- } +- +- if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { +- printf("No RNG device\n"); +- return -ENODEV; +- } +- +- if (dm_rng_read(dev, data, len)) { +- printf("Reading RNG failed\n"); +- return -EIO; +- } +- +- abuf_init_set(buf, data, len); +- +- return 0; +-} +- + /* + * Buzz the buzzer so the user knows something is going on. Make it + * optional in case PWM is disabled. +@@ -298,11 +322,10 @@ int rgxx3_detect_display(void) + if (!panel) { + printf("Unable to identify panel_id %x\n", + (panel_id[0] << 8) | panel_id[1]); +- env_set("panel", "unknown"); + return -EINVAL; + } + +- env_set("panel", panel->panel_compat); ++ env_set("panel", panel->panel_compat[0]); + + return 0; + } +@@ -342,19 +365,21 @@ int rgxx3_detect_device(void) + } + + /* +- * Try to access the eMMC on an RG353V or RG353P. If it's +- * missing, it's an RG353VS or RG353PS. Note we could also +- * check for a touchscreen at 0x1a on i2c2. ++ * Try to access the eMMC on an RG353V, RG353P, or RG Arc D. ++ * If it's missing, it's an RG353VS, RG353PS, or RG Arc S. ++ * Note we could also check for a touchscreen at 0x1a on i2c2. + */ +- if (board_id == RG353V || board_id == RG353P) { ++ if (board_id == RG353V || board_id == RG353P || board_id == RGARCD) { + mmc = find_mmc_device(0); + if (mmc) { + ret = mmc_init(mmc); + if (ret) { + if (board_id == RG353V) + board_id = RG353VS; +- else ++ if (board_id == RG353P) + board_id = RG353PS; ++ else ++ board_id = RGARCS; + } + } + } +@@ -367,13 +392,14 @@ int rgxx3_detect_device(void) + rg3xx_model_details[board_id].board_name); + env_set("fdtfile", rg3xx_model_details[board_id].fdtfile); + +- /* Detect the panel type for any device that isn't a 503. */ +- if (board_id == RG503) ++ /* Skip panel detection for when it is not needed. */ ++ if (!rg3xx_model_details[board_id].detect_panel) + return 0; + ++ /* Warn but don't fail for errors in auto-detection of the panel. */ + ret = rgxx3_detect_display(); + if (ret) +- return ret; ++ printf("Failed to detect panel type\n"); + + return 0; + } +@@ -400,7 +426,8 @@ int rk_board_late_init(void) + + int ft_board_setup(void *blob, struct bd_info *bd) + { +- int node, ret; ++ const struct rg353_panel *panel = NULL; ++ int node, ret, i; + char *env; + + /* No fixups necessary for the RG503 */ +@@ -414,6 +441,12 @@ int ft_board_setup(void *blob, struct bd_info *bd) + rg3xx_model_details[RG353M].board_name, + sizeof(rg3xx_model_details[RG353M].board_name)); + ++ env = env_get("panel"); ++ if (!env) { ++ printf("Can't get panel env\n"); ++ return 0; ++ } ++ + /* + * Check if the environment variable doesn't equal the panel. + * If it doesn't, update the devicetree to the correct panel. +@@ -424,12 +457,6 @@ int ft_board_setup(void *blob, struct bd_info *bd) + return -ENODEV; + } + +- env = env_get("panel"); +- if (!env) { +- printf("Can't get panel env\n"); +- return -ENODEV; +- } +- + ret = fdt_node_check_compatible(blob, node, env); + if (ret < 0) + return -ENODEV; +@@ -438,8 +465,24 @@ int ft_board_setup(void *blob, struct bd_info *bd) + if (!ret) + return 0; + +- do_fixup_by_path_string(blob, "/dsi@fe060000/panel@0", +- "compatible", env); ++ /* Panels don't match, search by first compatible value. */ ++ for (i = 0; i < ARRAY_SIZE(rg353_panel_details); i++) { ++ if (!strcmp(env, rg353_panel_details[i].panel_compat[0])) { ++ panel = &rg353_panel_details[i]; ++ break; ++ } ++ } ++ ++ if (!panel) { ++ printf("Unable to identify panel by compat string\n"); ++ return -ENODEV; ++ } ++ ++ /* Set the compatible with the auto-detected values */ ++ fdt_setprop_string(blob, node, "compatible", panel->panel_compat[0]); ++ if (panel->panel_compat[1]) ++ fdt_appendprop_string(blob, node, "compatible", ++ panel->panel_compat[1]); + + return 0; + } +diff --git a/common/spl/Kconfig b/common/spl/Kconfig +index c521b02f4..ada9dcea5 100644 +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -579,6 +579,13 @@ config SPL_FIT_IMAGE_TINY + ensure this information is available to the next image + invoked). + ++config SPL_ADC ++ bool "Support ADC drivers" ++ help ++ Enable ADC drivers in SPL. These drivers can allow the reading of ++ analog values from one or more channels. Enable this option to ++ build the drivers in drivers/adc as part of an SPL build. ++ + config SPL_CACHE + bool "Support CACHE drivers" + help +diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig +index ed6643d9d..4e72f7581 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 + 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_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_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/doc/board/anbernic/rgxx3.rst b/doc/board/anbernic/rgxx3.rst +index 7d1beb423..d159ed2f7 100644 +--- a/doc/board/anbernic/rgxx3.rst ++++ b/doc/board/anbernic/rgxx3.rst +@@ -5,6 +5,8 @@ U-Boot for Anbernic RGxx3 Devices + + This allows U-Boot to boot the following Anbernic devices: + ++ - Anbernic RG-ARC-D ++ - Anbernic RG-ARC-S + - Anbernic RG353M + - Anbernic RG353P + - Anbernic RG353PS +@@ -12,18 +14,24 @@ This allows U-Boot to boot the following Anbernic devices: + - Anbernic RG353VS + - Anbernic RG503 + ++Additionally, the following very similar non-Anbernic devices are also ++supported: ++ ++ - Powkiddy RGB30 ++ - Powkiddy RK2023 ++ + The correct device is detected automatically by comparing ADC values + from ADC channel 1. In the event of an RG353V or RG353P, an attempt + is then made to probe for an eMMC and if it fails the device is assumed + to be an RG353VS or RG353PS. Based on the detected device, the + environment variables "board", "board_name", and "fdtfile" are set to + the correct values corresponding to the board which can be read by a +-boot script to boot with the correct device tree. If the board detected +-is not of type RG503 (which currently has only 1 panel revision) a +-panel detect is then performed by probing a "dummy" display on the DSI +-bus and then querying the display ID. The display ID is then compared +-to a table to get the known compatible string for use in Linux, and +-this string is saved as an environment variable of "panel". ++boot script to boot with the correct device tree. If a board is defined ++as requiring panel detection, a panel detect is then performed by ++probing a "dummy" display on the DSI bus and then querying the display ++ID. The display ID is then compared to a table to get the known ++compatible string for use in Linux, and this string is saved as an ++environment variable of "panel". + + FDT fixups are performed in the event of an RG353M to change the device + name, or in the event the panel detected does not match the devicetree. +diff --git a/drivers/Makefile b/drivers/Makefile +index bf73b7718..81ba2c534 100644 +--- a/drivers/Makefile ++++ b/drivers/Makefile +@@ -1,5 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0+ + ++obj-$(CONFIG_$(SPL_)ADC) += adc/ + obj-$(CONFIG_$(SPL_TPL_)BIOSEMU) += bios_emulator/ + obj-$(CONFIG_$(SPL_TPL_)BLK) += block/ + obj-$(CONFIG_$(SPL_TPL_)BOOTCOUNT_LIMIT) += bootcount/ +diff --git a/drivers/adc/Makefile b/drivers/adc/Makefile +index 5336c8209..9eb07769b 100644 +--- a/drivers/adc/Makefile ++++ b/drivers/adc/Makefile +@@ -4,7 +4,7 @@ + # Przemyslaw Marczak + # + +-obj-$(CONFIG_ADC) += adc-uclass.o ++obj-$(CONFIG_$(SPL_)ADC) += adc-uclass.o + obj-$(CONFIG_ADC_EXYNOS) += exynos-adc.o + obj-$(CONFIG_ADC_SANDBOX) += sandbox.o + obj-$(CONFIG_SARADC_ROCKCHIP) += rockchip-saradc.o +diff --git a/include/configs/anbernic-rgxx3-rk3566.h b/include/configs/anbernic-rgxx3-rk3566.h +index 3c4ea4e7d..2aaac55c0 100644 +--- a/include/configs/anbernic-rgxx3-rk3566.h ++++ b/include/configs/anbernic-rgxx3-rk3566.h +@@ -9,4 +9,6 @@ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0" + ++#define RK_DNL_ADC_CHAN 0 ++ + #endif