add all patches, move to 6.7-rc4

This commit is contained in:
Sparticuz 2023-12-19 14:56:14 -05:00
parent 9e7c7957fe
commit 52d9520372
22 changed files with 5928 additions and 1937 deletions

View file

@ -30,12 +30,8 @@ case ${DEVICE} in
PKG_GIT_CLONE_BRANCH="main"
;;
*ML)
PKG_VERSION="next-next-20231212"
# PKG_URL="https://git.kernel.org/torvalds/t/${PKG_NAME}-${PKG_VERSION}.tar.gz"
PKG_URL="https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/snapshot/linux-next-next-20231212.tar.gz"
# PKG_VERSION="6.7-rc4"
# PKG_URL="https://git.kernel.org/torvalds/t/${PKG_NAME}-${PKG_VERSION}.tar.gz"
PKG_VERSION="6.7-rc6"
PKG_URL="https://git.kernel.org/torvalds/t/${PKG_NAME}-${PKG_VERSION}.tar.gz"
;;
*X55)
PKG_URL="${PKG_SITE}/rk3566-x55-kernel.git"

View file

@ -1,13 +0,0 @@
diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index 79de6c886292..c44c6945662f 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -261,6 +261,8 @@ static int panel_nv3051d_unprepare(struct drm_panel *panel)
usleep_range(10000, 15000);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
regulator_disable(ctx->vdd);
return 0;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,715 @@
From: Chris Morgan <macroalpha82@gmail.com>
To: devicetree@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org, maccraft123mc@gmail.com,
sebastian.reichel@collabora.com, heiko@sntech.de,
conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
robh+dt@kernel.org, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH 0/3] Add Support for Anbernic RG351V
Date: Mon, 20 Nov 2023 17:01:28 -0600 [thread overview]
Message-ID: <20231120230131.57705-1-macroalpha82@gmail.com> (raw)
From: Chris Morgan <macromorgan@hotmail.com>
Add support for the Anbernic RG351V handheld gaming console.
Chris Morgan (3):
dt-bindings: arm: rockchip: Add Anbernic RG351V
arm64: dts: rockchip: Split RG351M from Odroid Go Advance
arm64: dts: rockchip: Add Anbernic RG351V
.../devicetree/bindings/arm/rockchip.yaml | 6 +-
arch/arm64/boot/dts/rockchip/Makefile | 1 +
.../dts/rockchip/rk3326-anbernic-rg351m.dts | 18 +-
.../dts/rockchip/rk3326-anbernic-rg351m.dtsi | 478 ++++++++++++++++++
.../dts/rockchip/rk3326-anbernic-rg351v.dts | 44 ++
5 files changed, 529 insertions(+), 18 deletions(-)
create mode 100644 arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dtsi
create mode 100644 arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts
--
2.34.1
From: Chris Morgan <macroalpha82@gmail.com>
To: devicetree@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org, maccraft123mc@gmail.com,
sebastian.reichel@collabora.com, heiko@sntech.de,
conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
robh+dt@kernel.org, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH 1/3] dt-bindings: arm: rockchip: Add Anbernic RG351V
Date: Mon, 20 Nov 2023 17:01:29 -0600 [thread overview]
Message-ID: <20231120230131.57705-2-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231120230131.57705-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
The Anbernic RG351V is a portable gaming console from Anbernic with the
RK3326 SoC.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
Documentation/devicetree/bindings/arm/rockchip.yaml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml
index 5f7c6c4aad8f..3786f901a1a7 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.yaml
+++ b/Documentation/devicetree/bindings/arm/rockchip.yaml
@@ -30,9 +30,11 @@ properties:
- const: amarula,vyasa-rk3288
- const: rockchip,rk3288
- - description: Anbernic RG351M
+ - description: Anbernic RK3326 Handheld Gaming Console
items:
- - const: anbernic,rg351m
+ - enum:
+ - anbernic,rg351m
+ - anbernic,rg351v
- const: rockchip,rk3326
- description: Anbernic RG353P
--
2.34.1
From: Chris Morgan <macroalpha82@gmail.com>
To: devicetree@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org, maccraft123mc@gmail.com,
sebastian.reichel@collabora.com, heiko@sntech.de,
conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
robh+dt@kernel.org, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH 2/3] arm64: dts: rockchip: Split RG351M from Odroid Go Advance
Date: Mon, 20 Nov 2023 17:01:30 -0600 [thread overview]
Message-ID: <20231120230131.57705-3-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231120230131.57705-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Split the RG351M into its own DTSI file. The RG351M, unlike the Odroid
Go Advance, has no ADC joysticks, no GPIO buttons (except for volume
on the RG351V), a PWM vibrator that interferes with an Odroid
regulator, and different LEDs. Split the RG351M into a DTSI file
that can then be imported into the DTS files for the RG351M and a
new RG351V.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
.../dts/rockchip/rk3326-anbernic-rg351m.dts | 18 +-
.../dts/rockchip/rk3326-anbernic-rg351m.dtsi | 478 ++++++++++++++++++
2 files changed, 480 insertions(+), 16 deletions(-)
create mode 100644 arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dtsi
diff --git a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts
index ce318e05f0a6..f4d20f29c1b4 100644
--- a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts
@@ -6,30 +6,16 @@
*/
/dts-v1/;
-#include "rk3326-odroid-go.dtsi"
+#include "rk3326-anbernic-rg351m.dtsi"
/ {
model = "Anbernic RG351M";
compatible = "anbernic,rg351m", "rockchip,rk3326";
-
- vibrator {
- compatible = "pwm-vibrator";
- pwms = <&pwm0 0 1000000 0>;
- pwm-names = "enable";
- };
};
-/delete-node/ &builtin_gamepad;
-/delete-node/ &vcc_host; /* conflicts with pwm vibration motor */
-
&internal_display {
compatible = "elida,kd35t133";
iovcc-supply = <&vcc_lcd>;
+ rotation = <270>;
vdd-supply = <&vcc_lcd>;
};
-
-&pwm0 {
- status = "okay";
-};
-
-/delete-node/ &rk817_charger;
diff --git a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dtsi b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dtsi
new file mode 100644
index 000000000000..89e64647b4fa
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dtsi
@@ -0,0 +1,478 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Hardkernel Co., Ltd
+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
+ * Copyright (c) 2022 Maya Matuszczyk <maccraft123mc@gmail.com>
+ */
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/pinctrl/rockchip.h>
+#include "rk3326.dtsi"
+
+/ {
+ aliases {
+ mmc0 = &sdmmc;
+ };
+
+ chosen {
+ stdout-path = "serial2:115200n8";
+ };
+
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ power-supply = <&vcc_bl>;
+ pwms = <&pwm1 0 25000 0>;
+ };
+
+ /*
+ * LED is a tri-state. Driven high it is red, driven low it is
+ * green, and not driven at all (pin set to input) it is amber.
+ * Additionally, there is a 2nd LED that is not controllable
+ * that is on (red) when plugged in to power.
+ */
+ gpio_led: gpio-leds {
+ compatible = "gpio-leds";
+ pinctrl-names = "default";
+ pinctrl-0 = <&led_pin>;
+
+ red_green_led: led-0 {
+ color = <LED_COLOR_ID_RED>;
+ gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>;
+ function = LED_FUNCTION_CHARGING;
+ };
+ };
+
+ rk817-sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "rk817_int";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+ simple-audio-card,mclk-fs = <256>;
+ simple-audio-card,widgets =
+ "Microphone", "Mic Jack",
+ "Headphone", "Headphones",
+ "Speaker", "Speaker";
+ simple-audio-card,routing =
+ "MICL", "Mic Jack",
+ "Headphones", "HPOL",
+ "Headphones", "HPOR",
+ "Speaker", "SPKO";
+
+ simple-audio-card,codec {
+ sound-dai = <&rk817>;
+ };
+
+ simple-audio-card,cpu {
+ sound-dai = <&i2s1_2ch>;
+ };
+ };
+
+ vccsys: vccsys {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc3v8_sys";
+ regulator-always-on;
+ regulator-min-microvolt = <3800000>;
+ regulator-max-microvolt = <3800000>;
+ };
+
+ vibrator {
+ compatible = "pwm-vibrator";
+ pwms = <&pwm0 0 1000000 0>;
+ pwm-names = "enable";
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+ cpu-supply = <&vdd_arm>;
+};
+
+&cpu2 {
+ cpu-supply = <&vdd_arm>;
+};
+
+&cpu3 {
+ cpu-supply = <&vdd_arm>;
+};
+
+&cru {
+ assigned-clocks = <&cru PLL_NPLL>,
+ <&cru ACLK_BUS_PRE>, <&cru ACLK_PERI_PRE>,
+ <&cru HCLK_BUS_PRE>, <&cru HCLK_PERI_PRE>,
+ <&cru PCLK_BUS_PRE>, <&cru SCLK_GPU>;
+
+ assigned-clock-rates = <1188000000>,
+ <200000000>, <200000000>,
+ <150000000>, <150000000>,
+ <100000000>, <200000000>;
+};
+
+&display_subsystem {
+ status = "okay";
+};
+
+&dsi {
+ status = "okay";
+
+ ports {
+ mipi_out: port@1 {
+ reg = <1>;
+
+ mipi_out_panel: endpoint {
+ remote-endpoint = <&mipi_in_panel>;
+ };
+ };
+ };
+
+ internal_display: panel@0 {
+ reg = <0>;
+ backlight = <&backlight>;
+ reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
+
+ port {
+ mipi_in_panel: endpoint {
+ remote-endpoint = <&mipi_out_panel>;
+ };
+ };
+ };
+};
+
+&dsi_dphy {
+ status = "okay";
+};
+
+&gpu {
+ mali-supply = <&vdd_logic>;
+ status = "okay";
+};
+
+&i2c0 {
+ clock-frequency = <400000>;
+ i2c-scl-falling-time-ns = <16>;
+ i2c-scl-rising-time-ns = <280>;
+ status = "okay";
+
+ rk817: pmic@20 {
+ compatible = "rockchip,rk817";
+ reg = <0x20>;
+ #clock-cells = <1>;
+ clock-names = "mclk";
+ clock-output-names = "rk808-clkout1", "xin32k";
+ clocks = <&cru SCLK_I2S1_OUT>;
+ interrupt-parent = <&gpio0>;
+ interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
+ pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>;
+ pinctrl-names = "default";
+ #sound-dai-cells = <0>;
+ wakeup-source;
+
+ vcc1-supply = <&vccsys>;
+ vcc2-supply = <&vccsys>;
+ vcc3-supply = <&vccsys>;
+ vcc4-supply = <&vccsys>;
+ vcc5-supply = <&vccsys>;
+ vcc6-supply = <&vccsys>;
+ vcc7-supply = <&vccsys>;
+ vcc8-supply = <&vccsys>;
+
+ regulators {
+ vdd_logic: DCDC_REG1 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <1150000>;
+ regulator-min-microvolt = <950000>;
+ regulator-name = "vdd_logic";
+ regulator-ramp-delay = <6001>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <950000>;
+ };
+ };
+
+ vdd_arm: DCDC_REG2 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <1350000>;
+ regulator-min-microvolt = <950000>;
+ regulator-name = "vdd_arm";
+ regulator-ramp-delay = <6001>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ regulator-suspend-microvolt = <950000>;
+ };
+ };
+
+ vcc_ddr: DCDC_REG3 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-name = "vcc_ddr";
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
+ };
+
+ vcc_3v3: DCDC_REG4 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-name = "vcc_3v3";
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ regulator-suspend-microvolt = <3300000>;
+ };
+ };
+
+ vcc_1v8: LDO_REG2 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <1800000>;
+ regulator-min-microvolt = <1800000>;
+ regulator-name = "vcc_1v8";
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <1800000>;
+ };
+ };
+
+ vdd_1v0: LDO_REG3 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <1000000>;
+ regulator-min-microvolt = <1000000>;
+ regulator-name = "vdd_1v0";
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <1000000>;
+ };
+ };
+
+ vcc3v3_pmu: LDO_REG4 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-name = "vcc3v3_pmu";
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <3300000>;
+ };
+ };
+
+ vccio_sd: LDO_REG5 {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <1800000>;
+ regulator-name = "vccio_sd";
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <3300000>;
+ };
+ };
+
+ vcc_sd: LDO_REG6 {
+ regulator-boot-on;
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-name = "vcc_sd";
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <3300000>;
+ };
+ };
+
+ vcc_bl: LDO_REG7 {
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-name = "vcc_bl";
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ regulator-suspend-microvolt = <3300000>;
+ };
+ };
+
+ vcc_lcd: LDO_REG8 {
+ regulator-max-microvolt = <2800000>;
+ regulator-min-microvolt = <2800000>;
+ regulator-name = "vcc_lcd";
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ regulator-suspend-microvolt = <2800000>;
+ };
+ };
+
+ vcc_wifi: LDO_REG9 {
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-name = "vcc_wifi";
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ regulator-suspend-microvolt = <3300000>;
+ };
+ };
+
+ usb_midu: BOOST {
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-max-microvolt = <5400000>;
+ regulator-min-microvolt = <5000000>;
+ regulator-name = "usb_midu";
+ };
+ };
+
+ rk817_codec: codec {
+ rockchip,mic-in-differential;
+ };
+ };
+};
+
+&i2s1_2ch {
+ status = "okay";
+};
+
+&io_domains {
+ vccio1-supply = <&vcc_3v3>;
+ vccio2-supply = <&vccio_sd>;
+ vccio3-supply = <&vcc_3v3>;
+ vccio4-supply = <&vcc_3v3>;
+ vccio5-supply = <&vcc_3v3>;
+ vccio6-supply = <&vcc_3v3>;
+ status = "okay";
+};
+
+&pmu_io_domains {
+ pmuio1-supply = <&vcc3v3_pmu>;
+ pmuio2-supply = <&vcc3v3_pmu>;
+ status = "okay";
+};
+
+&pwm0 {
+ status = "okay";
+};
+
+&pwm1 {
+ status = "okay";
+};
+
+&saradc {
+ vref-supply = <&vcc_1v8>;
+ status = "okay";
+};
+
+&sdmmc {
+ cap-sd-highspeed;
+ card-detect-delay = <200>;
+ cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>;
+ sd-uhs-sdr12;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ vmmc-supply = <&vcc_sd>;
+ vqmmc-supply = <&vccio_sd>;
+ status = "okay";
+};
+
+&sfc {
+ #address-cells = <1>;
+ pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>;
+ pinctrl-names = "default";
+ #size-cells = <0>;
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <108000000>;
+ spi-rx-bus-width = <2>;
+ spi-tx-bus-width = <1>;
+ };
+};
+
+&tsadc {
+ status = "okay";
+};
+
+&u2phy {
+ status = "okay";
+
+ u2phy_host: host-port {
+ status = "okay";
+ };
+
+ u2phy_otg: otg-port {
+ status = "disabled";
+ };
+};
+
+&usb20_otg {
+ status = "okay";
+};
+
+&uart2 {
+ pinctrl-0 = <&uart2m1_xfer>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&vopb {
+ status = "okay";
+};
+
+&vopb_mmu {
+ status = "okay";
+};
+
+&pinctrl {
+ headphone {
+ hp_det: hp-det {
+ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
+ };
+ };
+
+ leds {
+ led_pin: led-pin {
+ rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
+
+ pmic {
+ dc_det: dc-det {
+ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ pmic_int: pmic-int {
+ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+ };
+
+ soc_slppin_gpio: soc_slppin_gpio {
+ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_output_low>;
+ };
+
+ soc_slppin_rst: soc_slppin_rst {
+ rockchip,pins = <0 RK_PA4 2 &pcfg_pull_none>;
+ };
+
+ soc_slppin_slp: soc_slppin_slp {
+ rockchip,pins = <0 RK_PA4 1 &pcfg_pull_none>;
+ };
+ };
+};
--
2.34.1
From: Chris Morgan <macroalpha82@gmail.com>
To: devicetree@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org, maccraft123mc@gmail.com,
sebastian.reichel@collabora.com, heiko@sntech.de,
conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
robh+dt@kernel.org, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH 3/3] arm64: dts: rockchip: Add Anbernic RG351V
Date: Mon, 20 Nov 2023 17:01:31 -0600 [thread overview]
Message-ID: <20231120230131.57705-4-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231120230131.57705-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Add support for the Anbernic RG351V, which is a handheld gaming console
from Anbernic with an RK3326 SoC, a 640x480 LCD display, a single
analog joystick with several face buttons, two USB C ports, and
internal WiFi over USB. All hardware has been tested as working
except for the battery, which will require further modification to the
mainline rk817 battery driver before it can be used (the device was
built without a shunt resistor, and as such the battery cannot
measure current; only voltage).
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
arch/arm64/boot/dts/rockchip/Makefile | 1 +
.../dts/rockchip/rk3326-anbernic-rg351v.dts | 44 +++++++++++++++++++
2 files changed, 45 insertions(+)
create mode 100644 arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts
diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile
index a18f33bf0c0e..0ac27cf782d7 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -9,6 +9,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-roc-cc.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-rock-pi-s.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3318-a95x-z2.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-anbernic-rg351m.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-anbernic-rg351v.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2-v11.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go3.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts
new file mode 100644
index 000000000000..c2f9b56ca5f9
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+#include "rk3326-anbernic-rg351m.dtsi"
+
+/ {
+ model = "Anbernic RG351V";
+ compatible = "anbernic,rg351v", "rockchip,rk3326";
+
+ gpio_keys_vol: gpio-keys-vol {
+ compatible = "gpio-keys";
+ autorepeat;
+
+ button-vol-down {
+ label = "VOLUMEDOWN";
+ linux,code = <KEY_VOLUMEDOWN>;
+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>;
+ };
+
+ button-vol-up {
+ label = "VOLUMEUP";
+ linux,code = <KEY_VOLUMEUP>;
+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&internal_display {
+ compatible = "anbernic,rg351v-panel", "newvision,nv3051d";
+ vdd-supply = <&vcc_lcd>;
+};
+
+&io_domains {
+ vccio1-supply = <&vccio_sd>;
+};
+
+&vcc_sd {
+ regulator-max-microvolt = <3000000>;
+ regulator-min-microvolt = <1800000>;
+};
+
+&vccio_sd {
+ regulator-max-microvolt = <1800000>;
+};
--
2.34.1

View file

@ -0,0 +1,15 @@
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 4a33d2e47f33..6d22628129d0 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2008,6 +2008,11 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev)
efuse->ext_pa_5g = efuse->pa_type_5g & BIT(0) ? 1 : 0;
efuse->ext_lna_2g = efuse->lna_type_5g & BIT(3) ? 1 : 0;
+ if (!is_valid_ether_addr(efuse->addr)) {
+ eth_random_addr(efuse->addr);
+ dev_warn(rtwdev->dev, "efuse MAC invalid, using random\n");
+ }
+
out_disable:
rtw_chip_efuse_disable(rtwdev);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,10 @@
diff --git a/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat b/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat
index 22ab7452..8ad5768a 100644
--- a/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat
+++ b/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat
@@ -20,4 +20,4 @@ ath9k_htc/*
brcm/*
rtl_bt/*
rtlwifi/*
-rtw89/*
+rtw*/*

View file

@ -0,0 +1,11 @@
diff -rupN a/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi b/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi
--- a/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi 2023-12-11 11:39:10.610833310 -0500
+++ b/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi 2023-12-11 11:39:20.677499539 -0500
@@ -224,7 +224,7 @@
clock-names = "ext_clock";
pinctrl-0 = <&wifi_enable_h>;
pinctrl-names = "default";
- post-power-on-delay-ms = <200>;
+ post-power-on-delay-ms = <800>;
reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_LOW>;
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index 3f1a42d18..b8e094032 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -33,7 +33,7 @@
#define GPIO_WRITEMASK(bits) ((bits) << 16)
-#define DTB_DIR "rockchip/"
+#define DTB_DIR ""
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
--- 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
CONFIG_OF_BOARD_SETUP=y
CONFIG_OF_STDOUT_VIA_ALIAS=y
-CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-anbernic-rgxx3.dtb"
+CONFIG_DEFAULT_FDT_FILE="rk3566-anbernic-rgxx3.dtb"
# CONFIG_CONSOLE_MUX is not set
# CONFIG_DISPLAY_CPUINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y

View file

@ -1,60 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 0/7] Add Additional Boards and Features to RGxx3
Date: Mon, 11 Dec 2023 17:21:18 -0600 [thread overview]
Message-ID: <20231211232125.171438-1-macroalpha82@gmail.com> (raw)
From: Chris Morgan <macromorgan@hotmail.com>
The RGxx3 is a pseudo-device for U-Boot that works for every Anbernic
RGxx3 series device on the market. Add support for another series of
very similar devices from Powkiddy.
Changes since V2:
- Modify the mach-rockchip level rockchip_dnl_key_pressed() so that
we can also call it in SPL mode and eliminate the board specific
function. This requires adding ADC support to SPL. Additionally,
I had to change the regulator for the saradc to a fixed regulator
and add GPIO and regulator support to SPL.
- Move the board specific board_rng_seed to the mach-rockchip level
board file so that other rockchip boards with a hardware RNG can
benefit. This should only be called if both the Rockchip
hardware RNG as well as the rng seed functions are enabled.
- Add two new boards (the RG-ARC-D and RG-ARC-S). I removed the
previous code review due to the extensive changes made.
Changes since V1:
- Update verbiage around function button to say "recovery" mode
instead of calling it "maskrom" mode, which has a specific
meaning. Also note that recovery function was done in a board
specific manner to ensure it can run early.
- Update board level documentation for the RGxx3.
Chris Morgan (7):
board: rockchip: Refactor panel auto-detect code
spl: Add Kconfig options for ADC
rockchip: boot_mode: Allow rockchip_dnl_key_pressed() in SPL
board: rockchip: Add Recovery Button for Anbernic RGxx3
rockchip: board: Add board_rng_seed() for all Rockchip devices
board: rockchip: Add support for new boards to RGxx3
doc: board: anbernic: Update rgxx3 to add new boards
.../arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi | 11 +
arch/arm/mach-rockchip/Makefile | 4 +-
arch/arm/mach-rockchip/board.c | 32 +++
arch/arm/mach-rockchip/boot_mode.c | 11 +-
board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 194 +++++++++++-------
common/spl/Kconfig | 7 +
configs/anbernic-rgxx3-rk3566_defconfig | 16 +-
doc/board/anbernic/rgxx3.rst | 20 +-
drivers/Makefile | 1 +
drivers/adc/Makefile | 2 +-
include/configs/anbernic-rgxx3-rk3566.h | 2 +
11 files changed, 210 insertions(+), 90 deletions(-)
--
2.34.1

View file

@ -1,230 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 1/7] board: rockchip: Refactor panel auto-detect code
Date: Mon, 11 Dec 2023 17:21:19 -0600 [thread overview]
Message-ID: <20231211232125.171438-2-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Make the inability to detect a panel using the auto detection code not
fail the entire boot process. This means that if the panel ID cannot
be read we don't set an environment variable for the panel, and if an
environment variable for the panel is not set we don't attempt to
update the compatible string. Changes to the code also ensure that
when there are multiple compatible strings required for the panel
we use them both, which solves some issues that will pop up soon
for the Linux driver.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 115 +++++++++++++--------
1 file changed, 74 insertions(+), 41 deletions(-)
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index 3f1a42d184..3d0c614623 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -40,6 +40,7 @@ struct rg3xx_model {
const char *board;
const char *board_name;
const char *fdtfile;
+ const bool detect_panel;
};
enum rgxx3_device_id {
@@ -54,52 +55,67 @@ enum rgxx3_device_id {
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,
},
/* 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,
},
};
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,
+ },
};
/*
@@ -298,11 +314,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;
}
@@ -367,13 +382,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 +416,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 +431,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 +447,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 +455,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;
}
--
2.34.1

View file

@ -1,66 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 2/7] spl: Add Kconfig options for ADC
Date: Mon, 11 Dec 2023 17:21:20 -0600 [thread overview]
Message-ID: <20231211232125.171438-3-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Add kconfig options to enable ADC in SPL
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
common/spl/Kconfig | 7 +++++++
drivers/Makefile | 1 +
drivers/adc/Makefile | 2 +-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index c521b02f4a..ada9dcea5c 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/drivers/Makefile b/drivers/Makefile
index bf73b7718c..81ba2c534e 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 5336c82097..9eb07769b0 100644
--- a/drivers/adc/Makefile
+++ b/drivers/adc/Makefile
@@ -4,7 +4,7 @@
# Przemyslaw Marczak <p.marczak@samsung.com>
#
-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
--
2.34.1

View file

@ -1,100 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 3/7] rockchip: boot_mode: Allow rockchip_dnl_key_pressed() in SPL
Date: Mon, 11 Dec 2023 17:21:21 -0600 [thread overview]
Message-ID: <20231211232125.171438-4-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Update the rockchip_dnl_key_pressed() so that it can run in
SPL. Also change the ADC channel to a define that can be
overridden by a board specific option.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
arch/arm/mach-rockchip/Makefile | 4 ++--
arch/arm/mach-rockchip/boot_mode.c | 11 ++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 1dc92066bb..ff089ae949 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/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c
index eb8f65ae4e..d2308768be 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;
}
--
2.34.1

View file

@ -1,172 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 4/7] board: rockchip: Add Recovery Button for Anbernic RGxx3
Date: Mon, 11 Dec 2023 17:21:22 -0600 [thread overview]
Message-ID: <20231211232125.171438-5-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-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

View file

@ -1,110 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 5/7] rockchip: board: Add board_rng_seed() for all Rockchip devices
Date: Mon, 11 Dec 2023 17:21:23 -0600 [thread overview]
Message-ID: <20231211232125.171438-6-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Allow all rockchip devices to use the hardware RNG to seed Linux
RNG.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
arch/arm/mach-rockchip/board.c | 32 ++++++++++++++++++++++
board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 29 --------------------
2 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 57f08e0be0..77145524ea 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 <rng.h>
+
+/* 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/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index 45854709f5..7bef5a53f0 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -17,7 +17,6 @@
#include <mmc.h>
#include <panel.h>
#include <pwm.h>
-#include <rng.h>
#include <stdlib.h>
#include <video_bridge.h>
@@ -137,34 +136,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.
--
2.34.1

View file

@ -1,112 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 6/7] board: rockchip: Add support for new boards to RGxx3
Date: Mon, 11 Dec 2023 17:21:24 -0600 [thread overview]
Message-ID: <20231211232125.171438-7-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Add support for the Anbernic RG-ARC-D, Anbernic RG-ARC-S, Powkiddy
RK2023, and Powkiddy RGB30 to the Anbernic RGxx3. While the Powkiddy
devices are manufactured by Powkiddy instead of Anbernic,
the hardware is so similar they can all use the same bootloader.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c | 44 +++++++++++++++++++---
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index 7bef5a53f0..2445663d43 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -48,9 +48,13 @@ 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[] = {
@@ -83,6 +87,27 @@ static const struct rg3xx_model rg3xx_model_details[] = {
.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] = {
.adc_value = 860, /* Observed average from device */
@@ -98,6 +123,13 @@ static const struct rg3xx_model rg3xx_model_details[] = {
.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 {
@@ -332,19 +364,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;
}
}
}
--
2.34.1

View file

@ -1,68 +0,0 @@
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,
Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 7/7] doc: board: anbernic: Update rgxx3 to add new boards
Date: Mon, 11 Dec 2023 17:21:25 -0600 [thread overview]
Message-ID: <20231211232125.171438-8-macroalpha82@gmail.com> (raw)
In-Reply-To: <20231211232125.171438-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Update the RGxx3 documentation to note that it now supports the
RG-ARC-D, RG-ARC-S, Powkiddy RK2023, and Powkiddy RGB30. Also update
verbiage around panel detection to note that it is no longer hard coded
to the RG503.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
doc/board/anbernic/rgxx3.rst | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/doc/board/anbernic/rgxx3.rst b/doc/board/anbernic/rgxx3.rst
index 7d1beb423c..d159ed2f76 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.
--
2.34.1

View file

@ -1,653 +0,0 @@
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 <rng.h>
+
+/* 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..978ed2662 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>
@@ -16,7 +17,6 @@
#include <mmc.h>
#include <panel.h>
#include <pwm.h>
-#include <rng.h>
#include <stdlib.h>
#include <video_bridge.h>
@@ -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..27911cc9f 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,15 +25,17 @@ 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"
+CONFIG_DEFAULT_FDT_FILE="rk3566-anbernic-rgxx3.dtb"
# CONFIG_CONSOLE_MUX is not set
# 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 <p.marczak@samsung.com>
#
-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