summaryrefslogtreecommitdiff
path: root/arch/arm/mach-rockchip
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-rockchip')
-rw-r--r--arch/arm/mach-rockchip/px30/px30.c61
-rw-r--r--arch/arm/mach-rockchip/rk3528/rk3528.c6
-rw-r--r--arch/arm/mach-rockchip/rk3576/MAINTAINERS11
-rw-r--r--arch/arm/mach-rockchip/rk3576/rk3576.c54
-rw-r--r--arch/arm/mach-rockchip/rk3588/Kconfig18
-rw-r--r--arch/arm/mach-rockchip/rk3588/rk3588.c8
6 files changed, 158 insertions, 0 deletions
diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c
index 8ce9ac561f0..5a5c119328f 100644
--- a/arch/arm/mach-rockchip/px30/px30.c
+++ b/arch/arm/mach-rockchip/px30/px30.c
@@ -2,10 +2,14 @@
/*
* Copyright (c) 2017 Rockchip Electronics Co., Ltd
*/
+
+#define LOG_CATEGORY LOGC_ARCH
+
#include <clk.h>
#include <dm.h>
#include <fdt_support.h>
#include <init.h>
+#include <misc.h>
#include <spl.h>
#include <asm/armv8/mmu.h>
#include <asm/arch-rockchip/bootrom.h>
@@ -15,6 +19,7 @@
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_px30.h>
#include <dt-bindings/clock/px30-cru.h>
+#include <linux/bitfield.h>
const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
[BROM_BOOTSOURCE_EMMC] = "/mmc@ff390000",
@@ -442,3 +447,59 @@ void board_debug_uart_init(void)
#endif /* CONFIG_DEBUG_UART_BASE && CONFIG_DEBUG_UART_BASE == ... */
}
#endif /* CONFIG_DEBUG_UART_BOARD_INIT */
+
+#define PX30_OTP_SPECIFICATION_OFFSET 0x06
+
+#define DDR_GRF_BASE_ADDR 0xff630000
+#define DDR_GRF_CON(n) (0 + (n) * 4)
+
+int checkboard(void)
+{
+ struct udevice *dev;
+ u8 specification;
+ u32 base_soc;
+ int ret;
+
+ if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+ return 0;
+
+ ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_DRIVER_GET(rockchip_otp), &dev);
+ if (ret) {
+ log_debug("Could not find otp device, ret=%d\n", ret);
+ return 0;
+ }
+
+ /* base SoC: 0x26334b52 for RK3326; 0x30335850 for PX30 */
+ ret = misc_read(dev, 0, &base_soc, 4);
+ if (ret < 0) {
+ log_debug("Could not read specification, ret=%d\n", ret);
+ return 0;
+ }
+
+ if (base_soc != 0x26334b52 && base_soc != 0x30335850) {
+ log_debug("Could not identify SoC, got 0x%04x in OTP\n", base_soc);
+ return 0;
+ }
+
+ /* SoC variant: 0x21 for PX30/PX30S/RK3326/RK3326S; 0x2b for PX30K */
+ ret = misc_read(dev, PX30_OTP_SPECIFICATION_OFFSET, &specification, 1);
+ if (ret < 0) {
+ log_debug("Could not read specification, ret=%d\n", ret);
+ return 0;
+ }
+
+ if (specification == 0x2b) {
+ printf("SoC: PX30K\n");
+ return 0;
+ }
+
+ /* From vendor kernel: drivers/soc/rockchip/rockchip-cpuinfo.c */
+ specification = FIELD_GET(GENMASK(15, 14),
+ readl(DDR_GRF_BASE_ADDR + DDR_GRF_CON(1)));
+ log_debug("DDR specification is %d\n", specification);
+ printf("SoC: %s%s\n", base_soc == 0x26334b52 ? "RK3326" : "PX30",
+ specification == 0x3 ? "S" : "");
+
+ return 0;
+}
diff --git a/arch/arm/mach-rockchip/rk3528/rk3528.c b/arch/arm/mach-rockchip/rk3528/rk3528.c
index 4892ff6ba9d..f9bfc445b85 100644
--- a/arch/arm/mach-rockchip/rk3528/rk3528.c
+++ b/arch/arm/mach-rockchip/rk3528/rk3528.c
@@ -9,6 +9,9 @@
#include <asm/arch-rockchip/bootrom.h>
#include <asm/arch-rockchip/hardware.h>
+#define VPU_GRF_BASE 0xff340000
+#define USB3OTG_CON1 0x44
+
#define FIREWALL_DDR_BASE 0xff2e0000
#define FW_DDR_MST6_REG 0x58
#define FW_DDR_MST7_REG 0x5c
@@ -69,6 +72,9 @@ int arch_cpu_init(void)
val = readl(FIREWALL_DDR_BASE + FW_DDR_MST16_REG);
writel(val & 0xffff0000, FIREWALL_DDR_BASE + FW_DDR_MST16_REG);
+ /* Disable USB3OTG U3 port, later enabled in COMBPHY driver */
+ writel(0xffff0181, VPU_GRF_BASE + USB3OTG_CON1);
+
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk3576/MAINTAINERS b/arch/arm/mach-rockchip/rk3576/MAINTAINERS
new file mode 100644
index 00000000000..94ef74d429f
--- /dev/null
+++ b/arch/arm/mach-rockchip/rk3576/MAINTAINERS
@@ -0,0 +1,11 @@
+GENERIC-RK3576
+M: Jonas Karlman <jonas@kwiboo.se>
+S: Maintained
+F: arch/arm/dts/rk3576-generic*
+F: configs/generic-rk3576_defconfig
+
+SIGE5-RK3576
+M: Jonas Karlman <jonas@kwiboo.se>
+S: Maintained
+F: arch/arm/dts/rk3576-armsom-sige5*
+F: configs/sige5-rk3576_defconfig
diff --git a/arch/arm/mach-rockchip/rk3576/rk3576.c b/arch/arm/mach-rockchip/rk3576/rk3576.c
index ba5c94b4b3d..a6c2fbdc484 100644
--- a/arch/arm/mach-rockchip/rk3576/rk3576.c
+++ b/arch/arm/mach-rockchip/rk3576/rk3576.c
@@ -3,6 +3,10 @@
* Copyright (c) 2024 Rockchip Electronics Co., Ltd
*/
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <dm.h>
+#include <misc.h>
#include <asm/armv8/mmu.h>
#include <asm/arch-rockchip/bootrom.h>
#include <asm/arch-rockchip/hardware.h>
@@ -29,6 +33,9 @@
#define SGRF_DOMAIN_CON4 0x10
#define SGRF_DOMAIN_CON5 0x14
+#define USB_GRF_BASE 0x2601E000
+#define USB3OTG0_CON1 0x0030
+
const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
[BROM_BOOTSOURCE_EMMC] = "/soc/mmc@2a330000",
[BROM_BOOTSOURCE_SD] = "/soc/mmc@2a310000",
@@ -151,5 +158,52 @@ int arch_cpu_init(void)
*/
writel(0xffffff00, SYS_SGRF_BASE + SYS_SGRF_SOC_CON20);
+ /* Disable USB3OTG0 U3 port, later enabled by USBDP PHY driver */
+ writel(0xffff0188, USB_GRF_BASE + USB3OTG0_CON1);
+
+ return 0;
+}
+
+#define RK3576_OTP_CPU_CODE_OFFSET 0x02
+#define RK3576_OTP_SPECIFICATION_OFFSET 0x08
+
+int checkboard(void)
+{
+ u8 cpu_code[2], specification;
+ struct udevice *dev;
+ char suffix[2];
+ int ret;
+
+ if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+ return 0;
+
+ ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_DRIVER_GET(rockchip_otp), &dev);
+ if (ret) {
+ log_debug("Could not find otp device, ret=%d\n", ret);
+ return 0;
+ }
+
+ /* cpu-code: SoC model, e.g. 0x35 0x76 */
+ ret = misc_read(dev, RK3576_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+ if (ret < 0) {
+ log_debug("Could not read cpu-code, ret=%d\n", ret);
+ return 0;
+ }
+
+ /* specification: SoC variant, e.g. 0xA for RK3576J */
+ ret = misc_read(dev, RK3576_OTP_SPECIFICATION_OFFSET, &specification, 1);
+ if (ret < 0) {
+ log_debug("Could not read specification, ret=%d\n", ret);
+ return 0;
+ }
+ specification &= 0x1f;
+
+ /* for RK3576J i.e. '@' + 0xA = 'J' */
+ suffix[0] = specification > 1 ? '@' + specification : '\0';
+ suffix[1] = '\0';
+
+ printf("SoC: RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk3588/Kconfig b/arch/arm/mach-rockchip/rk3588/Kconfig
index 4e7942ada87..9fbe3f225aa 100644
--- a/arch/arm/mach-rockchip/rk3588/Kconfig
+++ b/arch/arm/mach-rockchip/rk3588/Kconfig
@@ -27,6 +27,23 @@ config TARGET_CM3588_NAS_RK3588
- 3.5mm Headphone out, 2.0mm PH-2A Mic in
- 5V Fan connector, PWM beeper, IR receiver, RTC battery connector
+config TARGET_GAMEFORCE_ACE_RK3588S
+ bool "GameForce Ace"
+ help
+ The GameForce Ace is a handheld game console from GameForce with
+ the Rockchip RK3588S SoC.
+
+ Hardware features:
+ - Rockchip RK3588S SoC
+ - 12GB LPDDR4x RAM
+ - 128GB eMMC
+ - MicroSD card slot
+ - 1x USB 3.0 Type-C with DP AltMode support
+ - 1x HDMI 2.1 micro-HDMI out
+ - 1920x1080 touchscreen MIPI-DSI panel
+ - Analog joysticks and L/R triggers
+ - 16 digital buttons
+
config TARGET_GENBOOK_CM5_RK3588
bool "Cool Pi CM5 GenBook"
help
@@ -410,6 +427,7 @@ source "board/friendlyelec/cm3588-nas-rk3588/Kconfig"
source "board/friendlyelec/nanopc-t6-rk3588/Kconfig"
source "board/friendlyelec/nanopi-r6c-rk3588s/Kconfig"
source "board/friendlyelec/nanopi-r6s-rk3588s/Kconfig"
+source "board/gameforce/ace-rk3588s/Kconfig"
source "board/hardkernel/odroid_m2/Kconfig"
source "board/indiedroid/nova/Kconfig"
source "board/khadas/khadas-edge2-rk3588s/Kconfig"
diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
index e2278ff792b..c01a4002089 100644
--- a/arch/arm/mach-rockchip/rk3588/rk3588.c
+++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
@@ -15,6 +15,10 @@
#include <asm/arch-rockchip/hardware.h>
#include <asm/arch-rockchip/ioc_rk3588.h>
+#define USB_GRF_BASE 0xfd5ac000
+#define USB3OTG0_CON1 0x001c
+#define USB3OTG1_CON1 0x0034
+
#define FIREWALL_DDR_BASE 0xfe030000
#define FW_DDR_MST5_REG 0x54
#define FW_DDR_MST13_REG 0x74
@@ -184,6 +188,10 @@ int arch_cpu_init(void)
/* Disable JTAG exposed on SDMMC */
rk_clrreg(&sys_grf->soc_con[6], SYS_GRF_FORCE_JTAG);
#endif
+
+ /* Disable USB3OTG U3 ports, later enabled by USBDP PHY driver */
+ writel(0xffff0188, USB_GRF_BASE + USB3OTG0_CON1);
+ writel(0xffff0188, USB_GRF_BASE + USB3OTG1_CON1);
#endif
return 0;