From: Chris Morgan <macroalpha82@gmail.com>
To: u-boot@lists.denx.de
Cc: andre.przywara@arm.com, kever.yang@rock-chips.com,
philipp.tomsich@vrull.eu, sjg@chromium.org, jagan@edgeble.ai,
jonas@kwiboo.se, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V4 4/7] board: rockchip: Add Recovery Button for Anbernic RGxx3
Date: Tue, 2 Jan 2024 09:46:51 -0600 [thread overview]
Message-ID: <20240102154654.191055-5-macroalpha82@gmail.com> (raw)
In-Reply-To: <20240102154654.191055-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Add support for users to enter recovery mode by holding the function
button when they power up the device.
Since the device has soldered eMMC and sometimes does not expose a clk
pin on the mainboard there is a small chance that a user who flashes a
bad bootloader may not be able to recover if the headers themselves
are valid. As a result this check is done during spl_early_init() to
ensure that it runs as early as possible, and it does so by directly
manipulating the ADC hardware in lieu of loading the ADC driver.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi | 11 +++++++++++
board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 6 +++++-
configs/anbernic-rgxx3-rk3566_defconfig | 16 ++++++++++++----
include/configs/anbernic-rgxx3-rk3566.h | 2 ++
4 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi
index f986e1941e..e3ab196d22 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/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index 3d0c614623..45854709f5 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -5,6 +5,7 @@
#include <abuf.h>
#include <adc.h>
+#include <asm/arch-rockchip/boot_mode.h>
#include <asm/io.h>
#include <display.h>
#include <dm.h>
@@ -119,11 +120,14 @@ static const struct rg353_panel rg353_panel_details[] = {
};
/*
- * 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),
diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig
index ed6643d9d4..4e72f75815 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/include/configs/anbernic-rgxx3-rk3566.h b/include/configs/anbernic-rgxx3-rk3566.h
index 3c4ea4e7d8..2aaac55c06 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
--
2.34.1
next prev parent reply other threads:[~2024-01-02 15:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 15:46 [PATCH V4 0/7] Add Additional Boards and Features to RGxx3 Chris Morgan
2024-01-02 15:46 ` [PATCH V4 1/7] board: rockchip: Refactor panel auto-detect code Chris Morgan
2024-01-18 7:10 ` Kever Yang
2024-01-02 15:46 ` [PATCH V4 2/7] spl: Add Kconfig options for ADC Chris Morgan
2024-01-02 15:46 ` [PATCH V4 3/7] rockchip: boot_mode: Allow rockchip_dnl_key_pressed() in SPL Chris Morgan
2024-01-18 7:20 ` Kever Yang
2024-01-18 15:06 ` Chris Morgan
2024-01-19 9:01 ` Kever Yang
2024-01-24 22:55 ` Chris Morgan
[not found] ` <20240125065543.BA9B5440469@smtp.qiye.163.com>
2024-02-06 2:59 ` Kever Yang
2024-01-02 15:46 ` Chris Morgan [this message]
2024-01-02 15:46 ` [PATCH V4 5/7] rockchip: board: Add board_rng_seed() for all Rockchip devices Chris Morgan
2024-01-18 7:21 ` Kever Yang
2024-01-02 15:46 ` [PATCH V4 6/7] board: rockchip: Add support for new boards to RGxx3 Chris Morgan
2024-01-18 7:21 ` Kever Yang
2024-01-02 15:46 ` [PATCH V4 7/7] doc: board: anbernic: Update rgxx3 to add new boards Chris Morgan
2024-01-18 7:30 ` Kever Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240102154654.191055-5-macroalpha82@gmail.com \
--to=macroalpha82@gmail.com \
--cc=andre.przywara@arm.com \
--cc=jagan@edgeble.ai \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=macromorgan@hotmail.com \
--cc=philipp.tomsich@vrull.eu \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.