summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-05-06 12:46:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-02 08:54:02 +0200
commit23c7cba0a423dd7cb349ad7e6500fd9e75197d10 (patch)
tree14f13f76abc42c21361a3f7000c8a5243a87c7c7
parent7689055a8b037363dae840eee33a0ed43f905b7a (diff)
downloadbarebox-23c7cba0a423dd7cb349ad7e6500fd9e75197d10.tar.gz
barebox-23c7cba0a423dd7cb349ad7e6500fd9e75197d10.tar.xz
ARM: rockchip: Allow to build for multiple SoCs
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-rockchip/Kconfig12
-rw-r--r--arch/arm/mach-rockchip/Makefile1
-rw-r--r--arch/arm/mach-rockchip/include/mach/debug_ll.h12
-rw-r--r--arch/arm/mach-rockchip/include/mach/rockchip.h22
-rw-r--r--arch/arm/mach-rockchip/rk3188.c4
-rw-r--r--arch/arm/mach-rockchip/rk3288.c25
-rw-r--r--arch/arm/mach-rockchip/rockchip.c17
-rw-r--r--common/Kconfig18
8 files changed, 82 insertions, 29 deletions
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index f2fa3c634..65bcbcac9 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -11,27 +11,23 @@ config RK_TIMER
hex
default 1
-choice
- prompt "Select Rockchip SoC"
-
config ARCH_RK3188
- bool "Rockchip RK3188 SoCs"
+ bool
config ARCH_RK3288
- bool "Rockchip RK3288 SoCs"
+ bool
select CLOCKSOURCE_ROCKCHIP
-endchoice
comment "select Rockchip boards:"
config MACH_RADXA_ROCK
- depends on ARCH_RK3188
+ select ARCH_RK3188
select I2C
select MFD_ACT8846
bool "Radxa rock board"
config MACH_PHYTEC_SOM_RK3288
- depends on ARCH_RK3288
+ select ARCH_RK3288
select I2C
bool "RK3288 phyCORE SOM"
help
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 4ca7f17d8..0188d0252 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -1,2 +1,3 @@
+obj-y += rockchip.o
obj-$(CONFIG_ARCH_RK3188) += rk3188.o
obj-$(CONFIG_ARCH_RK3288) += rk3288.o
diff --git a/arch/arm/mach-rockchip/include/mach/debug_ll.h b/arch/arm/mach-rockchip/include/mach/debug_ll.h
index 9fde2976f..7806aab8b 100644
--- a/arch/arm/mach-rockchip/include/mach/debug_ll.h
+++ b/arch/arm/mach-rockchip/include/mach/debug_ll.h
@@ -6,14 +6,16 @@
#include <mach/rk3188-regs.h>
#include <mach/rk3288-regs.h>
-#ifdef CONFIG_ARCH_RK3188
+#ifdef CONFIG_DEBUG_LL
+
+#ifdef CONFIG_DEBUG_ROCKCHIP_RK3188_UART
#define UART_CLOCK 100000000
#define RK_DEBUG_SOC RK3188
#define serial_out(a, v) writeb(v, a)
#define serial_in(a) readb(a)
-#elif defined CONFIG_ARCH_RK3288
+#elif defined CONFIG_DEBUG_ROCKCHIP_RK3288_UART
#define UART_CLOCK 24000000
#define RK_DEBUG_SOC RK3288
@@ -70,4 +72,10 @@ static inline void PUTC_LL(char c)
while ((serial_in(base + LSR) & LSR_THRE) == 0)
;
}
+#else
+static inline void INIT_LL(void)
+{
+}
+#endif
+
#endif
diff --git a/arch/arm/mach-rockchip/include/mach/rockchip.h b/arch/arm/mach-rockchip/include/mach/rockchip.h
new file mode 100644
index 000000000..8d37c67d4
--- /dev/null
+++ b/arch/arm/mach-rockchip/include/mach/rockchip.h
@@ -0,0 +1,22 @@
+#ifndef __MACH_ROCKCHIP_H
+#define __MACH_ROCKCHIP_H
+
+#ifdef CONFIG_ARCH_RK3188
+int rk3188_init(void);
+#else
+static inline int rk3188_init(void)
+{
+ return -ENOTSUPP;
+}
+#endif
+
+#ifdef CONFIG_ARCH_RK3288
+int rk3288_init(void);
+#else
+static inline int rk3288_init(void)
+{
+ return -ENOTSUPP;
+}
+#endif
+
+#endif /* __MACH_ROCKCHIP_H */
diff --git a/arch/arm/mach-rockchip/rk3188.c b/arch/arm/mach-rockchip/rk3188.c
index 572e9dc58..178bf2be1 100644
--- a/arch/arm/mach-rockchip/rk3188.c
+++ b/arch/arm/mach-rockchip/rk3188.c
@@ -16,6 +16,7 @@
#include <init.h>
#include <restart.h>
#include <mach/rk3188-regs.h>
+#include <mach/rockchip.h>
static void __noreturn rockchip_restart_soc(struct restart_handler *rst)
{
@@ -27,10 +28,9 @@ static void __noreturn rockchip_restart_soc(struct restart_handler *rst)
hang();
}
-static int restart_register_feature(void)
+int rk3188_init(void)
{
restart_handler_register_fn("soc", rockchip_restart_soc);
return 0;
}
-coredevice_initcall(restart_register_feature);
diff --git a/arch/arm/mach-rockchip/rk3288.c b/arch/arm/mach-rockchip/rk3288.c
index 9076fd922..2a1d4ab7a 100644
--- a/arch/arm/mach-rockchip/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288.c
@@ -21,6 +21,7 @@
#include <mach/rk3288-regs.h>
#include <mach/cru_rk3288.h>
#include <mach/hardware.h>
+#include <mach/rockchip.h>
static void __noreturn rockchip_restart_soc(struct restart_handler *rst)
{
@@ -58,17 +59,6 @@ static void rk3288_detect_reset_reason(void)
}
}
-static int rk3288_init(void)
-{
- restart_handler_register_fn("soc", rockchip_restart_soc);
-
- if (IS_ENABLED(CONFIG_RESET_SOURCE))
- rk3288_detect_reset_reason();
-
- return 0;
-}
-postcore_initcall(rk3288_init);
-
/*
* ATM we are not able to determine the boot source.
* So let's handle the environment on eMMC, regardless which device
@@ -89,4 +79,15 @@ static int rk3288_env_init(void)
return 0;
}
-device_initcall(rk3288_env_init);
+
+int rk3288_init(void)
+{
+ restart_handler_register_fn("soc", rockchip_restart_soc);
+
+ if (IS_ENABLED(CONFIG_RESET_SOURCE))
+ rk3288_detect_reset_reason();
+
+ rk3288_env_init();
+
+ return 0;
+}
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
new file mode 100644
index 000000000..b0fbb4945
--- /dev/null
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <common.h>
+#include <init.h>
+#include <mach/rockchip.h>
+
+static int rockchip_init(void)
+{
+ if (of_machine_is_compatible("rockchip,rk3188"))
+ rk3188_init();
+ else if (of_machine_is_compatible("rockchip,rk3288"))
+ rk3288_init();
+ else
+ pr_err("Unknown rockchip SoC\n");
+
+ return 0;
+}
+postcore_initcall(rockchip_init);
diff --git a/common/Kconfig b/common/Kconfig
index db7cc6713..a823e7038 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1322,12 +1322,19 @@ config DEBUG_AM33XX_UART
Say Y here if you want kernel low-level debugging support
on AM33XX.
-config DEBUG_ROCKCHIP_UART
- bool "RK3xxx Debug UART"
- depends on ARCH_ROCKCHIP
+config DEBUG_ROCKCHIP_RK3188_UART
+ bool "RK3188 Debug UART"
+ depends on ARCH_RK3188
+ help
+ Say Y here if you want kernel low-level debugging support
+ on RK3188.
+
+config DEBUG_ROCKCHIP_RK3288_UART
+ bool "RK3288 Debug UART"
+ depends on ARCH_RK3288
help
Say Y here if you want kernel low-level debugging support
- on RK3XXX.
+ on RK3288.
config DEBUG_SOCFPGA_UART0
bool "Use SOCFPGA UART0 for low-level debug"
@@ -1414,7 +1421,8 @@ config DEBUG_OMAP_UART_PORT
AM33XX: 0 - 2
config DEBUG_ROCKCHIP_UART_PORT
- int "RK3xxx UART debug port" if DEBUG_ROCKCHIP_UART
+ int "RK3xxx UART debug port" if DEBUG_ROCKCHIP_RK3188_UART || \
+ DEBUG_ROCKCHIP_RK3288_UART
default 2
depends on ARCH_ROCKCHIP
help