* [U-Boot] [PATCH 01/24] rockchip: rk3328: add board_debug_uart_init()
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
@ 2019-07-22 12:01 ` Kever Yang
2019-07-22 12:01 ` [U-Boot] [PATCH 02/24] rockchip: convert to use ROCKCHIP_BOOT_MODE_REG for fastboot tag Kever Yang
` (22 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:01 UTC (permalink / raw)
To: u-boot
Add board_debug_uart_init() to make the debug UART work with
correct setting.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3328/rk3328.c | 49 ++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c b/arch/arm/mach-rockchip/rk3328/rk3328.c
index 222a8d36d3..afd9de4a1f 100644
--- a/arch/arm/mach-rockchip/rk3328/rk3328.c
+++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
@@ -6,11 +6,17 @@
#include <common.h>
#include <asm/arch-rockchip/bootrom.h>
#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3328.h>
+#include <asm/arch-rockchip/uart.h>
#include <asm/armv8/mmu.h>
#include <asm/io.h>
DECLARE_GLOBAL_DATA_PTR;
+#define CRU_BASE 0xFF440000
+#define GRF_BASE 0xFF100000
+#define UART2_BASE 0xFF130000
+
const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
[BROM_BOOTSOURCE_EMMC] = "rksdmmc at ff520000",
[BROM_BOOTSOURCE_SD] = "rksdmmc at ff500000",
@@ -55,3 +61,46 @@ int arch_cpu_init(void)
return 0;
}
+
+void board_debug_uart_init(void)
+{
+ struct rk3328_grf_regs * const grf = (void *)GRF_BASE;
+ struct rk_uart * const uart = (void *)UART2_BASE;
+ enum{
+ GPIO2A0_SEL_SHIFT = 0,
+ GPIO2A0_SEL_MASK = 3 << GPIO2A0_SEL_SHIFT,
+ GPIO2A0_UART2_TX_M1 = 1,
+
+ GPIO2A1_SEL_SHIFT = 2,
+ GPIO2A1_SEL_MASK = 3 << GPIO2A1_SEL_SHIFT,
+ GPIO2A1_UART2_RX_M1 = 1,
+ };
+ enum {
+ IOMUX_SEL_UART2_SHIFT = 0,
+ IOMUX_SEL_UART2_MASK = 3 << IOMUX_SEL_UART2_SHIFT,
+ IOMUX_SEL_UART2_M0 = 0,
+ IOMUX_SEL_UART2_M1,
+ };
+
+ /* uart_sel_clk default select 24MHz */
+ writel((3 << (8 + 16)) | (2 << 8), CRU_BASE + 0x148);
+
+ /* init uart baud rate 1500000 */
+ writel(0x83, &uart->lcr);
+ writel(0x1, &uart->rbr);
+ writel(0x3, &uart->lcr);
+
+ /* Enable early UART2 */
+ rk_clrsetreg(&grf->com_iomux,
+ IOMUX_SEL_UART2_MASK,
+ IOMUX_SEL_UART2_M1 << IOMUX_SEL_UART2_SHIFT);
+ rk_clrsetreg(&grf->gpio2a_iomux,
+ GPIO2A0_SEL_MASK,
+ GPIO2A0_UART2_TX_M1 << GPIO2A0_SEL_SHIFT);
+ rk_clrsetreg(&grf->gpio2a_iomux,
+ GPIO2A1_SEL_MASK,
+ GPIO2A1_UART2_RX_M1 << GPIO2A1_SEL_SHIFT);
+
+ /* enable FIFO */
+ writel(0x1, &uart->sfe);
+}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 02/24] rockchip: convert to use ROCKCHIP_BOOT_MODE_REG for fastboot tag
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
2019-07-22 12:01 ` [U-Boot] [PATCH 01/24] rockchip: rk3328: add board_debug_uart_init() Kever Yang
@ 2019-07-22 12:01 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 03/24] rockchip: clean up board_usb_init() for all SoCs Kever Yang
` (21 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:01 UTC (permalink / raw)
To: u-boot
The fastboot_set_reboot_flag() update a TAG into a register
for next boot, use the common macro for the register so that
we can re-use the function for different SoCs.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3128-board.c | 5 +----
arch/arm/mach-rockchip/rk322x-board.c | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3128-board.c b/arch/arm/mach-rockchip/rk3128-board.c
index 0945829d0e..636ee65fee 100644
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ b/arch/arm/mach-rockchip/rk3128-board.c
@@ -111,12 +111,9 @@ int board_usb_cleanup(int index, enum usb_init_type init)
#if CONFIG_IS_ENABLED(FASTBOOT)
int fastboot_set_reboot_flag(void)
{
- struct rk3128_grf *grf;
-
printf("Setting reboot to fastboot flag ...\n");
- grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
/* Set boot mode to fastboot */
- writel(BOOT_FASTBOOT, &grf->os_reg[0]);
+ writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c
index e7a1e54874..c0a537616c 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -115,12 +115,9 @@ int board_usb_cleanup(int index, enum usb_init_type init)
#if CONFIG_IS_ENABLED(FASTBOOT)
int fastboot_set_reboot_flag(void)
{
- struct rk322x_grf *grf;
-
printf("Setting reboot to fastboot flag ...\n");
- grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
/* Set boot mode to fastboot */
- writel(BOOT_FASTBOOT, &grf->os_reg[0]);
+ writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 03/24] rockchip: clean up board_usb_init() for all SoCs
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
2019-07-22 12:01 ` [U-Boot] [PATCH 01/24] rockchip: rk3328: add board_debug_uart_init() Kever Yang
2019-07-22 12:01 ` [U-Boot] [PATCH 02/24] rockchip: convert to use ROCKCHIP_BOOT_MODE_REG for fastboot tag Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 04/24] rockchip: add common board file for U-Boot proper Kever Yang
` (20 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use "snps,dwc2" for compatible name and and common variable
names so that we can share the common code for all SoCs.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3036-board.c | 10 +++---
arch/arm/mach-rockchip/rk3128-board.c | 10 +++---
arch/arm/mach-rockchip/rk322x-board.c | 10 +++---
arch/arm/mach-rockchip/rk3288-board.c | 38 ++++----------------
arch/arm/mach-rockchip/rv1108-board.c | 49 ++++++--------------------
board/rockchip/evb_rk3328/evb-rk3328.c | 11 +++---
6 files changed, 36 insertions(+), 92 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
index c594c4d61c..b7967b8577 100644
--- a/arch/arm/mach-rockchip/rk3036-board.c
+++ b/arch/arm/mach-rockchip/rk3036-board.c
@@ -59,7 +59,7 @@ void enable_caches(void)
#include <usb.h>
#include <usb/dwc2_udc.h>
-static struct dwc2_plat_otg_data rk3036_otg_data = {
+static struct dwc2_plat_otg_data otg_data = {
.rx_fifo_sz = 512,
.np_tx_fifo_sz = 16,
.tx_fifo_sz = 128,
@@ -74,7 +74,7 @@ int board_usb_init(int index, enum usb_init_type init)
/* find the usb_otg node */
node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rk3288-usb");
+ "snps,dwc2");
while (node > 0) {
mode = fdt_getprop(blob, node, "dr_mode", NULL);
@@ -84,15 +84,15 @@ int board_usb_init(int index, enum usb_init_type init)
}
node = fdt_node_offset_by_compatible(blob, node,
- "rockchip,rk3288-usb");
+ "snps,dwc2");
}
if (!matched) {
debug("Not found usb_otg device\n");
return -ENODEV;
}
- rk3036_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
- return dwc2_udc_probe(&rk3036_otg_data);
+ return dwc2_udc_probe(&otg_data);
}
int board_usb_cleanup(int index, enum usb_init_type init)
diff --git a/arch/arm/mach-rockchip/rk3128-board.c b/arch/arm/mach-rockchip/rk3128-board.c
index 636ee65fee..cfc41286e7 100644
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ b/arch/arm/mach-rockchip/rk3128-board.c
@@ -66,7 +66,7 @@ void enable_caches(void)
#include <usb.h>
#include <usb/dwc2_udc.h>
-static struct dwc2_plat_otg_data rk3128_otg_data = {
+static struct dwc2_plat_otg_data otg_data = {
.rx_fifo_sz = 512,
.np_tx_fifo_sz = 16,
.tx_fifo_sz = 128,
@@ -81,7 +81,7 @@ int board_usb_init(int index, enum usb_init_type init)
/* find the usb_otg node */
node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rk3128-usb");
+ "snps,dwc2");
while (node > 0) {
mode = fdt_getprop(blob, node, "dr_mode", NULL);
@@ -91,15 +91,15 @@ int board_usb_init(int index, enum usb_init_type init)
}
node = fdt_node_offset_by_compatible(blob, node,
- "rockchip,rk3128-usb");
+ "snps,dwc2");
}
if (!matched) {
debug("Not found usb_otg device\n");
return -ENODEV;
}
- rk3128_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
- return dwc2_udc_probe(&rk3128_otg_data);
+ return dwc2_udc_probe(&otg_data);
}
int board_usb_cleanup(int index, enum usb_init_type init)
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c
index c0a537616c..5103ad4ccc 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -70,7 +70,7 @@ void enable_caches(void)
#include <usb.h>
#include <usb/dwc2_udc.h>
-static struct dwc2_plat_otg_data rk322x_otg_data = {
+static struct dwc2_plat_otg_data otg_data = {
.rx_fifo_sz = 512,
.np_tx_fifo_sz = 16,
.tx_fifo_sz = 128,
@@ -85,7 +85,7 @@ int board_usb_init(int index, enum usb_init_type init)
/* find the usb_otg node */
node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rk3288-usb");
+ "snps,dwc2");
while (node > 0) {
mode = fdt_getprop(blob, node, "dr_mode", NULL);
@@ -95,15 +95,15 @@ int board_usb_init(int index, enum usb_init_type init)
}
node = fdt_node_offset_by_compatible(blob, node,
- "rockchip,rk3288-usb");
+ "snps,dwc2");
}
if (!matched) {
debug("Not found usb_otg device\n");
return -ENODEV;
}
- rk322x_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
- return dwc2_udc_probe(&rk322x_otg_data);
+ return dwc2_udc_probe(&otg_data);
}
int board_usb_cleanup(int index, enum usb_init_type init)
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index a250d50387..23c5343eb8 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -171,7 +171,7 @@ void enable_caches(void)
#include <usb.h>
#include <usb/dwc2_udc.h>
-static struct dwc2_plat_otg_data rk3288_otg_data = {
+static struct dwc2_plat_otg_data otg_data = {
.rx_fifo_sz = 512,
.np_tx_fifo_sz = 16,
.tx_fifo_sz = 128,
@@ -179,15 +179,14 @@ static struct dwc2_plat_otg_data rk3288_otg_data = {
int board_usb_init(int index, enum usb_init_type init)
{
- int node, phy_node;
+ int node;
const char *mode;
bool matched = false;
const void *blob = gd->fdt_blob;
- u32 grf_phy_offset;
/* find the usb_otg node */
node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rk3288-usb");
+ "snps,dwc2");
while (node > 0) {
mode = fdt_getprop(blob, node, "dr_mode", NULL);
@@ -197,40 +196,15 @@ int board_usb_init(int index, enum usb_init_type init)
}
node = fdt_node_offset_by_compatible(blob, node,
- "rockchip,rk3288-usb");
+ "snps,dwc2");
}
if (!matched) {
debug("Not found usb_otg device\n");
return -ENODEV;
}
- rk3288_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
- node = fdtdec_lookup_phandle(blob, node, "phys");
- if (node <= 0) {
- debug("Not found usb phy device\n");
- return -ENODEV;
- }
-
- phy_node = fdt_parent_offset(blob, node);
- if (phy_node <= 0) {
- debug("Not found usb phy device\n");
- return -ENODEV;
- }
-
- rk3288_otg_data.phy_of_node = phy_node;
- grf_phy_offset = fdtdec_get_addr(blob, node, "reg");
-
- /* find the grf node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rk3288-grf");
- if (node <= 0) {
- debug("Not found grf device\n");
- return -ENODEV;
- }
- rk3288_otg_data.regs_phy = grf_phy_offset +
- fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&rk3288_otg_data);
+ return dwc2_udc_probe(&otg_data);
}
int board_usb_cleanup(int index, enum usb_init_type init)
diff --git a/arch/arm/mach-rockchip/rv1108-board.c b/arch/arm/mach-rockchip/rv1108-board.c
index 3412f2c063..3c683cb8ac 100644
--- a/arch/arm/mach-rockchip/rv1108-board.c
+++ b/arch/arm/mach-rockchip/rv1108-board.c
@@ -11,7 +11,7 @@ DECLARE_GLOBAL_DATA_PTR;
#include <usb.h>
#include <usb/dwc2_udc.h>
-static struct dwc2_plat_otg_data rv1108_otg_data = {
+static struct dwc2_plat_otg_data otg_data = {
.rx_fifo_sz = 512,
.np_tx_fifo_sz = 16,
.tx_fifo_sz = 128,
@@ -19,14 +19,14 @@ static struct dwc2_plat_otg_data rv1108_otg_data = {
int board_usb_init(int index, enum usb_init_type init)
{
- const void *blob = gd->fdt_blob;
- bool matched = false;
- int node, phy_node;
- u32 grf_phy_offset;
+ int node;
const char *mode;
+ bool matched = false;
+ const void *blob = gd->fdt_blob;
/* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1, "rockchip,rk3066-usb");
+ node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc2");
+
while (node > 0) {
mode = fdt_getprop(blob, node, "dr_mode", NULL);
if (mode && strcmp(mode, "otg") == 0) {
@@ -34,44 +34,15 @@ int board_usb_init(int index, enum usb_init_type init)
break;
}
- node = fdt_node_offset_by_compatible(blob, node,
- "rockchip,rk3066-usb");
+ node = fdt_node_offset_by_compatible(blob, node, "snps,dwc2");
}
-
if (!matched) {
- debug("usb_otg device not found\n");
- return -ENODEV;
- }
-
- rv1108_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- node = fdtdec_lookup_phandle(blob, node, "phys");
- if (node <= 0) {
- debug("phys node not found\n");
+ debug("Not found usb_otg device\n");
return -ENODEV;
}
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
- phy_node = fdt_parent_offset(blob, node);
- if (phy_node <= 0) {
- debug("usb phy node not found\n");
- return -ENODEV;
- }
-
- rv1108_otg_data.phy_of_node = phy_node;
- grf_phy_offset = fdtdec_get_addr(blob, node, "reg");
-
- /* find the grf node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rv1108-grf");
- if (node <= 0) {
- debug("grf node not found\n");
- return -ENODEV;
- }
-
- rv1108_otg_data.regs_phy = grf_phy_offset + fdtdec_get_addr(blob, node,
- "reg");
-
- return dwc2_udc_probe(&rv1108_otg_data);
+ return dwc2_udc_probe(&otg_data);
}
int board_usb_cleanup(int index, enum usb_init_type init)
diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c
index bc9ef5e98b..64595c783d 100644
--- a/board/rockchip/evb_rk3328/evb-rk3328.c
+++ b/board/rockchip/evb_rk3328/evb-rk3328.c
@@ -26,7 +26,7 @@ int board_init(void)
#include <usb.h>
#include <usb/dwc2_udc.h>
-static struct dwc2_plat_otg_data rk3328_otg_data = {
+static struct dwc2_plat_otg_data otg_data = {
.rx_fifo_sz = 512,
.np_tx_fifo_sz = 16,
.tx_fifo_sz = 128,
@@ -41,7 +41,7 @@ int board_usb_init(int index, enum usb_init_type init)
/* find the usb_otg node */
node = fdt_node_offset_by_compatible(blob, -1,
- "rockchip,rk3328-usb");
+ "snps,dwc2");
while (node > 0) {
mode = fdt_getprop(blob, node, "dr_mode", NULL);
@@ -51,16 +51,15 @@ int board_usb_init(int index, enum usb_init_type init)
}
node = fdt_node_offset_by_compatible(blob, node,
- "rockchip,rk3328-usb");
+ "snps,dwc2");
}
if (!matched) {
debug("Not found usb_otg device\n");
return -ENODEV;
}
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
- rk3328_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&rk3328_otg_data);
+ return dwc2_udc_probe(&otg_data);
}
int board_usb_cleanup(int index, enum usb_init_type init)
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 04/24] rockchip: add common board file for U-Boot proper
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (2 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 03/24] rockchip: clean up board_usb_init() for all SoCs Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 05/24] rockchip: sdram_common: add common dram_init_banksize Kever Yang
` (19 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Add common board file for Rockchip SoCs to avoid too much
copy-paste work for different SoCs.
This board file in charge for common board_init() and board_late_init()
in U-Boot proper.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 7 +++
arch/arm/mach-rockchip/Makefile | 1 +
arch/arm/mach-rockchip/board.c | 104 ++++++++++++++++++++++++++++++++
3 files changed, 112 insertions(+)
create mode 100644 arch/arm/mach-rockchip/board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 81dee9e5c7..4d983f8fce 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -229,6 +229,13 @@ config TPL_ROCKCHIP_BACK_TO_BROM
SPL will return to the boot rom, which will then load the U-Boot
binary to keep going on.
+config ROCKCHIP_COMMON_BOARD
+ bool "Rockchip common board file"
+ help
+ Rockchip SoCs have similar boot process, Common board file is mainly
+ in charge of common process of board_init() and board_late_init() for
+ U-Boot proper.
+
config SPL_ROCKCHIP_COMMON_BOARD
bool "Rockchip SPL common board file"
depends on SPL
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 5cb2c6dcc9..7d2a227794 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -20,6 +20,7 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
# we can have the preprocessor correctly recognise both 0x0 and 0
# meaning "turn it off".
obj-y += boot_mode.o
+obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
new file mode 100644
index 0000000000..b2a88e789d
--- /dev/null
+++ b/arch/arm/mach-rockchip/board.c
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd.
+ */
+#include <common.h>
+#include <clk.h>
+#include <dm.h>
+#include <ram.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/arch-rockchip/boot_mode.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/periph.h>
+#include <power/regulator.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+__weak int rk_board_late_init(void)
+{
+ return 0;
+}
+
+int board_late_init(void)
+{
+ setup_boot_mode();
+
+ return rk_board_late_init();
+}
+
+int board_init(void)
+{
+ int ret;
+
+#ifdef CONFIG_DM_REGULATOR
+ ret = regulators_enable_boot_on(false);
+ if (ret)
+ debug("%s: Cannot enable boot on regulator\n", __func__);
+#endif
+
+ return 0;
+}
+
+#if !defined(CONFIG_SYS_DCACHE_OFF) && !defined(CONFIG_ARM64)
+void enable_caches(void)
+{
+ /* Enable D-cache. I-cache is already enabled in start.S */
+ dcache_enable();
+}
+#endif
+
+#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
+#include <usb.h>
+#include <usb/dwc2_udc.h>
+
+static struct dwc2_plat_otg_data otg_data = {
+ .rx_fifo_sz = 512,
+ .np_tx_fifo_sz = 16,
+ .tx_fifo_sz = 128,
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+ int node;
+ const char *mode;
+ bool matched = false;
+ const void *blob = gd->fdt_blob;
+
+ /* find the usb_otg node */
+ node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc2");
+
+ while (node > 0) {
+ mode = fdt_getprop(blob, node, "dr_mode", NULL);
+ if (mode && strcmp(mode, "otg") == 0) {
+ matched = true;
+ break;
+ }
+
+ node = fdt_node_offset_by_compatible(blob, node, "snps,dwc2");
+ }
+ if (!matched) {
+ debug("Not found usb_otg device\n");
+ return -ENODEV;
+ }
+ otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
+
+ return dwc2_udc_probe(&otg_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+ return 0;
+}
+#endif
+
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
+{
+ printf("Setting reboot to fastboot flag ...\n");
+ /* Set boot mode to fastboot */
+ writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);
+
+ return 0;
+}
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 05/24] rockchip: sdram_common: add common dram_init_banksize
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (3 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 04/24] rockchip: add common board file for U-Boot proper Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 06/24] rockchip: rk3036: move dram_init() into soc file Kever Yang
` (18 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
dram_init_banksize() can be common used by all SoCs, move it into
sdram_common.c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3128-board.c | 13 ------
arch/arm/mach-rockchip/rk3128/rk3128.c | 3 ++
arch/arm/mach-rockchip/rk322x-board.c | 13 ------
arch/arm/mach-rockchip/rk3328/rk3328.c | 11 -----
arch/arm/mach-rockchip/rk3368/rk3368.c | 11 -----
arch/arm/mach-rockchip/rk3399/rk3399.c | 11 -----
arch/arm/mach-rockchip/sdram_common.c | 63 ++++++++++++++++++++++++++
board/rockchip/evb_rv1108/evb_rv1108.c | 8 ----
8 files changed, 66 insertions(+), 67 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3128-board.c b/arch/arm/mach-rockchip/rk3128-board.c
index cfc41286e7..b931057329 100644
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ b/arch/arm/mach-rockchip/rk3128-board.c
@@ -41,19 +41,6 @@ int board_init(void)
return 0;
}
-int dram_init_banksize(void)
-{
- gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
- gd->bd->bi_dram[0].size = 0x8400000;
- /* Reserve 0xe00000(14MB) for OPTEE with TA enabled, otherwise 2MB */
- gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
- + gd->bd->bi_dram[0].size + 0xe00000;
- gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
- + gd->ram_size - gd->bd->bi_dram[1].start;
-
- return 0;
-}
-
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void enable_caches(void)
{
diff --git a/arch/arm/mach-rockchip/rk3128/rk3128.c b/arch/arm/mach-rockchip/rk3128/rk3128.c
index 11bba148c3..ee176de80b 100644
--- a/arch/arm/mach-rockchip/rk3128/rk3128.c
+++ b/arch/arm/mach-rockchip/rk3128/rk3128.c
@@ -2,6 +2,9 @@
/*
* Copyright (c) 2017 Rockchip Electronics Co., Ltd
*/
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
int arch_cpu_init(void)
{
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c
index 5103ad4ccc..91fbd6abb8 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -45,19 +45,6 @@ int board_init(void)
return 0;
}
-int dram_init_banksize(void)
-{
- gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
- gd->bd->bi_dram[0].size = 0x8400000;
- /* Reserve 0x200000 for OPTEE */
- gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
- + gd->bd->bi_dram[0].size + 0x200000;
- gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
- + gd->ram_size - gd->bd->bi_dram[1].start;
-
- return 0;
-}
-
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void enable_caches(void)
{
diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c b/arch/arm/mach-rockchip/rk3328/rk3328.c
index afd9de4a1f..592f287613 100644
--- a/arch/arm/mach-rockchip/rk3328/rk3328.c
+++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
@@ -44,17 +44,6 @@ static struct mm_region rk3328_mem_map[] = {
struct mm_region *mem_map = rk3328_mem_map;
-int dram_init_banksize(void)
-{
- size_t max_size = min((unsigned long)gd->ram_size, gd->ram_top);
-
- /* Reserve 0x200000 for ATF bl31 */
- gd->bd->bi_dram[0].start = 0x200000;
- gd->bd->bi_dram[0].size = max_size - gd->bd->bi_dram[0].start;
-
- return 0;
-}
-
int arch_cpu_init(void)
{
/* We do some SoC one time setting here. */
diff --git a/arch/arm/mach-rockchip/rk3368/rk3368.c b/arch/arm/mach-rockchip/rk3368/rk3368.c
index c75a5cd0c4..7ccd417a18 100644
--- a/arch/arm/mach-rockchip/rk3368/rk3368.c
+++ b/arch/arm/mach-rockchip/rk3368/rk3368.c
@@ -58,17 +58,6 @@ const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
[BROM_BOOTSOURCE_SD] = "dwmmc at ff0c0000",
};
-int dram_init_banksize(void)
-{
- size_t max_size = min((unsigned long)gd->ram_size, gd->ram_top);
-
- /* Reserve 0x200000 for ATF bl31 */
- gd->bd->bi_dram[0].start = 0x200000;
- gd->bd->bi_dram[0].size = max_size - gd->bd->bi_dram[0].start;
-
- return 0;
-}
-
#ifdef CONFIG_ARCH_EARLY_INIT_R
static int mcu_init(void)
{
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index bca1871b9a..d5c0377fd1 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -78,17 +78,6 @@ void rockchip_stimer_init(void)
}
#endif
-int dram_init_banksize(void)
-{
- size_t max_size = min((unsigned long)gd->ram_size, gd->ram_top);
-
- /* Reserve 0x200000 for ATF bl31 */
- gd->bd->bi_dram[0].start = 0x200000;
- gd->bd->bi_dram[0].size = max_size - gd->bd->bi_dram[0].start;
-
- return 0;
-}
-
int arch_cpu_init(void)
{
diff --git a/arch/arm/mach-rockchip/sdram_common.c b/arch/arm/mach-rockchip/sdram_common.c
index 8684dbd4fa..22a4aca940 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -11,6 +11,69 @@
#include <dm/uclass-internal.h>
DECLARE_GLOBAL_DATA_PTR;
+
+#define TRUST_PARAMETER_OFFSET (34 * 1024 * 1024)
+
+struct tos_parameter_t {
+ u32 version;
+ u32 checksum;
+ struct {
+ char name[8];
+ s64 phy_addr;
+ u32 size;
+ u32 flags;
+ } tee_mem;
+ struct {
+ char name[8];
+ s64 phy_addr;
+ u32 size;
+ u32 flags;
+ } drm_mem;
+ s64 reserve[8];
+};
+
+int dram_init_banksize(void)
+{
+ size_t top = min((unsigned long)(gd->ram_size + CONFIG_SYS_SDRAM_BASE),
+ gd->ram_top);
+
+#ifdef CONFIG_ARM64
+ /* Reserve 0x200000 for ATF bl31 */
+ gd->bd->bi_dram[0].start = 0x200000;
+ gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
+#else
+#ifdef CONFIG_SPL_OPTEE
+ struct tos_parameter_t *tos_parameter;
+
+ tos_parameter = (struct tos_parameter_t *)(CONFIG_SYS_SDRAM_BASE +
+ TRUST_PARAMETER_OFFSET);
+
+ if (tos_parameter->tee_mem.flags == 1) {
+ gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+ gd->bd->bi_dram[0].size = tos_parameter->tee_mem.phy_addr
+ - CONFIG_SYS_SDRAM_BASE;
+ gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr +
+ tos_parameter->tee_mem.size;
+ gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
+ + top - gd->bd->bi_dram[1].start;
+ } else {
+ gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+ gd->bd->bi_dram[0].size = 0x8400000;
+ /* Reserve 32M for OPTEE with TA */
+ gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
+ + gd->bd->bi_dram[0].size + 0x2000000;
+ gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
+ + top - gd->bd->bi_dram[1].start;
+ }
+#else
+ gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+ gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
+#endif
+#endif
+
+ return 0;
+}
+
size_t rockchip_sdram_size(phys_addr_t reg)
{
u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4;
diff --git a/board/rockchip/evb_rv1108/evb_rv1108.c b/board/rockchip/evb_rv1108/evb_rv1108.c
index 457b110cd5..6d934f8805 100644
--- a/board/rockchip/evb_rv1108/evb_rv1108.c
+++ b/board/rockchip/evb_rv1108/evb_rv1108.c
@@ -59,11 +59,3 @@ int dram_init(void)
return 0;
}
-
-int dram_init_banksize(void)
-{
- gd->bd->bi_dram[0].start = 0x60000000;
- gd->bd->bi_dram[0].size = 0x8000000;
-
- return 0;
-}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 06/24] rockchip: rk3036: move dram_init() into soc file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (4 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 05/24] rockchip: sdram_common: add common dram_init_banksize Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 07/24] rockchip: rk3036: Migrate to use common board file Kever Yang
` (17 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Move dram_init() into rk3036.c so that we can use to common board
file later.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3036-board.c | 14 --------------
arch/arm/mach-rockchip/rk3036/rk3036.c | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
index b7967b8577..40f5e0aa3d 100644
--- a/arch/arm/mach-rockchip/rk3036-board.c
+++ b/arch/arm/mach-rockchip/rk3036-board.c
@@ -13,7 +13,6 @@
#include <asm/arch-rockchip/periph.h>
#include <asm/arch-rockchip/grf_rk3036.h>
#include <asm/arch-rockchip/boot_mode.h>
-#include <asm/arch-rockchip/sdram_rk3036.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -34,19 +33,6 @@ int board_init(void)
return 0;
}
-#if !CONFIG_IS_ENABLED(RAM)
-/*
- * When CONFIG_RAM is enabled, the dram_init() function is implemented
- * in sdram_common.c.
- */
-int dram_init(void)
-{
- gd->ram_size = sdram_size();
-
- return 0;
-}
-#endif
-
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void enable_caches(void)
{
diff --git a/arch/arm/mach-rockchip/rk3036/rk3036.c b/arch/arm/mach-rockchip/rk3036/rk3036.c
index 481af8a934..be458cfb64 100644
--- a/arch/arm/mach-rockchip/rk3036/rk3036.c
+++ b/arch/arm/mach-rockchip/rk3036/rk3036.c
@@ -5,6 +5,9 @@
#include <asm/io.h>
#include <asm/arch-rockchip/grf_rk3036.h>
#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/sdram_rk3036.h>
+
+DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_DEBUG_UART_BOARD_INIT
void board_debug_uart_init(void)
@@ -36,3 +39,16 @@ void board_debug_uart_init(void)
GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
}
#endif
+
+#if !CONFIG_IS_ENABLED(RAM)
+/*
+ * When CONFIG_RAM is enabled, the dram_init() function is implemented
+ * in sdram_common.c.
+ */
+int dram_init(void)
+{
+ gd->ram_size = sdram_size();
+
+ return 0;
+}
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 07/24] rockchip: rk3036: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (5 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 06/24] rockchip: rk3036: move dram_init() into soc file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 08/24] rockchip: rk3128: " Kever Yang
` (16 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 1 -
arch/arm/mach-rockchip/rk3036-board.c | 88 ---------------------------
3 files changed, 1 insertion(+), 89 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3036-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 4d983f8fce..74e37eeb2a 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -7,6 +7,7 @@ config ROCKCHIP_RK3036
select SPL
imply USB_FUNCTION_ROCKUSB
imply CMD_ROCKUSB
+ imply ROCKCHIP_COMMON_BOARD
help
The Rockchip RK3036 is a ARM-based SoC with a dual-core Cortex-A7
including NEON and GPU, Mali-400 graphics, several DDR3 options
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 7d2a227794..e7f9a11a97 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o
obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o
-obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.o
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
endif
diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
deleted file mode 100644
index 40f5e0aa3d..0000000000
--- a/arch/arm/mach-rockchip/rk3036-board.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2015 Rockchip Electronics Co., Ltd
- */
-
-#include <common.h>
-#include <clk.h>
-#include <dm.h>
-#include <ram.h>
-#include <asm/gpio.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/periph.h>
-#include <asm/arch-rockchip/grf_rk3036.h>
-#include <asm/arch-rockchip/boot_mode.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
- return 0;
-}
-
-int board_late_init(void)
-{
- setup_boot_mode();
-
- return rk_board_late_init();
-}
-
-int board_init(void)
-{
- return 0;
-}
-
-#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include <usb.h>
-#include <usb/dwc2_udc.h>
-
-static struct dwc2_plat_otg_data otg_data = {
- .rx_fifo_sz = 512,
- .np_tx_fifo_sz = 16,
- .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const char *mode;
- bool matched = false;
- const void *blob = gd->fdt_blob;
-
- /* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "snps,dwc2");
-
- while (node > 0) {
- mode = fdt_getprop(blob, node, "dr_mode", NULL);
- if (mode && strcmp(mode, "otg") == 0) {
- matched = true;
- break;
- }
-
- node = fdt_node_offset_by_compatible(blob, node,
- "snps,dwc2");
- }
- if (!matched) {
- debug("Not found usb_otg device\n");
- return -ENODEV;
- }
- otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- return 0;
-}
-#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 08/24] rockchip: rk3128: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (6 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 07/24] rockchip: rk3036: Migrate to use common board file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 09/24] rockchip: rk322x: move SoC setting into arch_cpu_init() Kever Yang
` (15 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 1 -
arch/arm/mach-rockchip/rk3128-board.c | 107 --------------------------
3 files changed, 1 insertion(+), 108 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3128-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 74e37eeb2a..ea8908cd29 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -17,6 +17,7 @@ config ROCKCHIP_RK3036
config ROCKCHIP_RK3128
bool "Support Rockchip RK3128"
select CPU_V7A
+ imply ROCKCHIP_COMMON_BOARD
help
The Rockchip RK3128 is a ARM-based SoC with a quad-core Cortex-A7
including NEON and GPU, Mali-400 graphics, several DDR3 options
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index e7f9a11a97..260a0cfabb 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -23,7 +23,6 @@ obj-y += boot_mode.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
-obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o
obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
diff --git a/arch/arm/mach-rockchip/rk3128-board.c b/arch/arm/mach-rockchip/rk3128-board.c
deleted file mode 100644
index b931057329..0000000000
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ /dev/null
@@ -1,107 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2017 Rockchip Electronics Co., Ltd.
- */
-#include <common.h>
-#include <clk.h>
-#include <dm.h>
-#include <ram.h>
-#include <syscon.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/periph.h>
-#include <asm/arch-rockchip/grf_rk3128.h>
-#include <asm/arch-rockchip/boot_mode.h>
-#include <power/regulator.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
- return 0;
-}
-
-int board_late_init(void)
-{
- setup_boot_mode();
-
- return rk_board_late_init();
-}
-
-int board_init(void)
-{
- int ret = 0;
-
- ret = regulators_enable_boot_on(false);
- if (ret) {
- debug("%s: Cannot enable boot on regulator\n", __func__);
- return ret;
- }
-
- return 0;
-}
-
-#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include <usb.h>
-#include <usb/dwc2_udc.h>
-
-static struct dwc2_plat_otg_data otg_data = {
- .rx_fifo_sz = 512,
- .np_tx_fifo_sz = 16,
- .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const char *mode;
- bool matched = false;
- const void *blob = gd->fdt_blob;
-
- /* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "snps,dwc2");
-
- while (node > 0) {
- mode = fdt_getprop(blob, node, "dr_mode", NULL);
- if (mode && strcmp(mode, "otg") == 0) {
- matched = true;
- break;
- }
-
- node = fdt_node_offset_by_compatible(blob, node,
- "snps,dwc2");
- }
- if (!matched) {
- debug("Not found usb_otg device\n");
- return -ENODEV;
- }
- otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- return 0;
-}
-#endif
-
-#if CONFIG_IS_ENABLED(FASTBOOT)
-int fastboot_set_reboot_flag(void)
-{
- printf("Setting reboot to fastboot flag ...\n");
- /* Set boot mode to fastboot */
- writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);
-
- return 0;
-}
-#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 09/24] rockchip: rk322x: move SoC setting into arch_cpu_init()
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (7 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 08/24] rockchip: rk3128: " Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 10/24] rockchip: rk322x: Migrate to use common board file Kever Yang
` (14 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
The SoC one time setting should go to arch_cpu_init() in
rk322x.c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk322x-board.c | 14 --------------
arch/arm/mach-rockchip/rk322x/rk322x.c | 11 +++++++++++
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c
index 91fbd6abb8..0a129520da 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -10,7 +10,6 @@
#include <asm/io.h>
#include <asm/arch-rockchip/boot_mode.h>
#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/grf_rk322x.h>
#include <asm/arch-rockchip/periph.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -29,19 +28,6 @@ int board_late_init(void)
int board_init(void)
{
-#include <asm/arch-rockchip/grf_rk322x.h>
- /* Enable early UART2 channel 1 on the RK322x */
-#define GRF_BASE 0x11000000
- static struct rk322x_grf * const grf = (void *)GRF_BASE;
-
- /*
- * The integrated macphy is enabled by default, disable it
- * for saving power consuming.
- */
- rk_clrsetreg(&grf->macphy_con[0],
- MACPHY_CFG_ENABLE_MASK,
- 0 << MACPHY_CFG_ENABLE_SHIFT);
-
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk322x/rk322x.c b/arch/arm/mach-rockchip/rk322x/rk322x.c
index a8677b9783..cd0bf8a70c 100644
--- a/arch/arm/mach-rockchip/rk322x/rk322x.c
+++ b/arch/arm/mach-rockchip/rk322x/rk322x.c
@@ -57,6 +57,17 @@ int arch_cpu_init(void)
/* Disable the ddr secure region setting to make it non-secure */
rk_clrreg(&sgrf->soc_con[0], 0x4000);
+#else
+#define GRF_BASE 0x11000000
+ static struct rk322x_grf * const grf = (void *)GRF_BASE;
+ /*
+ * The integrated macphy is enabled by default, disable it
+ * for saving power consuming.
+ */
+ rk_clrsetreg(&grf->macphy_con[0],
+ MACPHY_CFG_ENABLE_MASK,
+ 0 << MACPHY_CFG_ENABLE_SHIFT);
+
#endif
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 10/24] rockchip: rk322x: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (8 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 09/24] rockchip: rk322x: move SoC setting into arch_cpu_init() Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 11/24] rockchip: rk3188: Move SoC one time setting into arch_cpu_init() Kever Yang
` (13 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 1 -
arch/arm/mach-rockchip/rk322x-board.c | 97 ---------------------------
3 files changed, 1 insertion(+), 98 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk322x-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index ea8908cd29..a62ce448a4 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -60,6 +60,7 @@ config ROCKCHIP_RK322X
select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL
select TPL_NEEDS_SEPARATE_STACK if TPL
select SPL_DRIVERS_MISC_SUPPORT
+ imply ROCKCHIP_COMMON_BOARD
imply SPL_SERIAL_SUPPORT
imply SPL_ROCKCHIP_COMMON_BOARD
imply TPL_SERIAL_SUPPORT
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 260a0cfabb..1dd9d2fd25 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -23,7 +23,6 @@ obj-y += boot_mode.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
-obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o
obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c
deleted file mode 100644
index 0a129520da..0000000000
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ /dev/null
@@ -1,97 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2017 Rockchip Electronics Co., Ltd.
- */
-#include <common.h>
-#include <clk.h>
-#include <dm.h>
-#include <ram.h>
-#include <syscon.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/boot_mode.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/periph.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
- return 0;
-}
-
-int board_late_init(void)
-{
- setup_boot_mode();
-
- return rk_board_late_init();
-}
-
-int board_init(void)
-{
- return 0;
-}
-
-#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include <usb.h>
-#include <usb/dwc2_udc.h>
-
-static struct dwc2_plat_otg_data otg_data = {
- .rx_fifo_sz = 512,
- .np_tx_fifo_sz = 16,
- .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const char *mode;
- bool matched = false;
- const void *blob = gd->fdt_blob;
-
- /* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "snps,dwc2");
-
- while (node > 0) {
- mode = fdt_getprop(blob, node, "dr_mode", NULL);
- if (mode && strcmp(mode, "otg") == 0) {
- matched = true;
- break;
- }
-
- node = fdt_node_offset_by_compatible(blob, node,
- "snps,dwc2");
- }
- if (!matched) {
- debug("Not found usb_otg device\n");
- return -ENODEV;
- }
- otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- return 0;
-}
-#endif
-
-#if CONFIG_IS_ENABLED(FASTBOOT)
-int fastboot_set_reboot_flag(void)
-{
- printf("Setting reboot to fastboot flag ...\n");
- /* Set boot mode to fastboot */
- writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);
-
- return 0;
-}
-#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 11/24] rockchip: rk3188: Move SoC one time setting into arch_cpu_init()
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (9 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 10/24] rockchip: rk322x: Migrate to use common board file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 12/24] rockchip: rk3188: Migrate to use common board file Kever Yang
` (12 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
The setting for noc remap should goto arch_cpu_init().
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3188-board.c | 15 ---------------
arch/arm/mach-rockchip/rk3188/rk3188.c | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3188-board.c b/arch/arm/mach-rockchip/rk3188-board.c
index 94fd6c01eb..5b6f21577f 100644
--- a/arch/arm/mach-rockchip/rk3188-board.c
+++ b/arch/arm/mach-rockchip/rk3188-board.c
@@ -7,13 +7,9 @@
#include <clk.h>
#include <dm.h>
#include <ram.h>
-#include <syscon.h>
#include <asm/gpio.h>
#include <asm/io.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/grf_rk3188.h>
#include <asm/arch-rockchip/periph.h>
-#include <asm/arch-rockchip/pmu_rk3288.h>
#include <asm/arch-rockchip/boot_mode.h>
__weak int rk_board_late_init(void)
@@ -23,18 +19,7 @@ __weak int rk_board_late_init(void)
int board_late_init(void)
{
- struct rk3188_grf *grf;
-
setup_boot_mode();
- grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- if (IS_ERR(grf)) {
- pr_err("grf syscon returned %ld\n", PTR_ERR(grf));
- } else {
- /* enable noc remap to mimic legacy loaders */
- rk_clrsetreg(&grf->soc_con0,
- NOC_REMAP_MASK << NOC_REMAP_SHIFT,
- NOC_REMAP_MASK << NOC_REMAP_SHIFT);
- }
return rk_board_late_init();
}
diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c
index 08792f1674..ee994f2990 100644
--- a/arch/arm/mach-rockchip/rk3188/rk3188.c
+++ b/arch/arm/mach-rockchip/rk3188/rk3188.c
@@ -3,8 +3,11 @@
* (C) Copyright 2019 Rockchip Electronics Co., Ltd
*/
#include <common.h>
+#include <dm.h>
+#include <syscon.h>
#include <asm/io.h>
#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/grf_rk3188.h>
#include <asm/arch-rockchip/hardware.h>
@@ -42,6 +45,7 @@ void board_debug_uart_init(void)
}
#endif
+#ifdef CONFIG_SPL_BUILD
int arch_cpu_init(void)
{
#ifdef CONFIG_ROCKCHIP_USB_UART
@@ -64,8 +68,20 @@ int arch_cpu_init(void)
BYPASSSEL_MASK | BYPASSDMEN_MASK,
1 << BYPASSSEL_SHIFT | 1 << BYPASSDMEN_SHIFT);
#endif
+
+ grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+ if (IS_ERR(grf)) {
+ pr_err("grf syscon returned %ld\n", PTR_ERR(grf));
+ } else {
+ /* enable noc remap to mimic legacy loaders */
+ rk_clrsetreg(&grf->soc_con0,
+ NOC_REMAP_MASK << NOC_REMAP_SHIFT,
+ NOC_REMAP_MASK << NOC_REMAP_SHIFT);
+ }
+
return 0;
}
+#endif
#ifdef CONFIG_SPL_BUILD
static int setup_led(void)
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 12/24] rockchip: rk3188: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (10 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 11/24] rockchip: rk3188: Move SoC one time setting into arch_cpu_init() Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 13/24] rockchip: rk3288: move SOC setting into arch_cpu_init() Kever Yang
` (11 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 1 -
arch/arm/mach-rockchip/rk3188-board.c | 38 ---------------------------
3 files changed, 1 insertion(+), 39 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3188-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index a62ce448a4..86b01df8c4 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -38,6 +38,7 @@ config ROCKCHIP_RK3188
select SPL_ROCKCHIP_EARLYRETURN_TO_BROM
select SPL_ROCKCHIP_BACK_TO_BROM
select BOARD_LATE_INIT
+ imply ROCKCHIP_COMMON_BOARD
imply SPL_ROCKCHIP_COMMON_BOARD
help
The Rockchip RK3188 is a ARM-based SoC with a quad-core Cortex-A9
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 1dd9d2fd25..dd7297d3c8 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -22,7 +22,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
obj-y += boot_mode.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
-obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
diff --git a/arch/arm/mach-rockchip/rk3188-board.c b/arch/arm/mach-rockchip/rk3188-board.c
deleted file mode 100644
index 5b6f21577f..0000000000
--- a/arch/arm/mach-rockchip/rk3188-board.c
+++ /dev/null
@@ -1,38 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2015 Google, Inc
- */
-
-#include <common.h>
-#include <clk.h>
-#include <dm.h>
-#include <ram.h>
-#include <asm/gpio.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/periph.h>
-#include <asm/arch-rockchip/boot_mode.h>
-
-__weak int rk_board_late_init(void)
-{
- return 0;
-}
-
-int board_late_init(void)
-{
- setup_boot_mode();
-
- return rk_board_late_init();
-}
-
-int board_init(void)
-{
- return 0;
-}
-
-#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 13/24] rockchip: rk3288: move SOC setting into arch_cpu_init()
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (11 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 12/24] rockchip: rk3188: Migrate to use common board file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 14/24] rockchip: rk3288: move board_early_init_f() back to veyron Kever Yang
` (10 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Qos setting and emmc relate SoC setting should go to arch_cpu_init().
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3288-board.c | 30 --------------------------
arch/arm/mach-rockchip/rk3288/rk3288.c | 30 ++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 23c5343eb8..9d88365fff 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -13,7 +13,6 @@
#include <asm/arch-rockchip/cru_rk3288.h>
#include <asm/arch-rockchip/periph.h>
#include <asm/arch-rockchip/pmu_rk3288.h>
-#include <asm/arch-rockchip/qos_rk3288.h>
#include <asm/arch-rockchip/boot_mode.h>
#include <asm/gpio.h>
#include <dt-bindings/clock/rk3288-cru.h>
@@ -26,24 +25,6 @@ __weak int rk_board_late_init(void)
return 0;
}
-int rk3288_qos_init(void)
-{
- int val = 2 << PRIORITY_HIGH_SHIFT | 2 << PRIORITY_LOW_SHIFT;
- /* set vop qos to higher priority */
- writel(val, CPU_AXI_QOS_PRIORITY + VIO0_VOP_QOS);
- writel(val, CPU_AXI_QOS_PRIORITY + VIO1_VOP_QOS);
-
- if (!fdt_node_check_compatible(gd->fdt_blob, 0,
- "rockchip,rk3288-tinker"))
- {
- /* set isp qos to higher priority */
- writel(val, CPU_AXI_QOS_PRIORITY + VIO1_ISP_R_QOS);
- writel(val, CPU_AXI_QOS_PRIORITY + VIO1_ISP_W0_QOS);
- writel(val, CPU_AXI_QOS_PRIORITY + VIO1_ISP_W1_QOS);
- }
- return 0;
-}
-
static void rk3288_detect_reset_reason(void)
{
struct rk3288_cru *cru = rockchip_get_cru();
@@ -84,7 +65,6 @@ static void rk3288_detect_reset_reason(void)
int board_late_init(void)
{
setup_boot_mode();
- rk3288_qos_init();
rk3288_detect_reset_reason();
return rk_board_late_init();
@@ -266,8 +246,6 @@ U_BOOT_CMD(
int board_early_init_f(void)
{
- const uintptr_t GRF_SOC_CON0 = 0xff770244;
- const uintptr_t GRF_SOC_CON2 = 0xff77024c;
struct udevice *dev;
int ret;
@@ -282,13 +260,5 @@ int board_early_init_f(void)
return ret;
}
- rk_setreg(GRF_SOC_CON2, 1 << 0);
-
- /*
- * Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is
- * cleared
- */
- rk_clrreg(GRF_SOC_CON0, 1 << 12);
-
return 0;
}
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index de9e396288..d938d4bff8 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -2,11 +2,15 @@
/*
* Copyright (c) 2016 Rockchip Electronics Co., Ltd
*/
+#include <common.h>
#include <asm/armv7.h>
#include <asm/io.h>
#include <asm/arch-rockchip/bootrom.h>
#include <asm/arch-rockchip/hardware.h>
#include <asm/arch-rockchip/grf_rk3288.h>
+#include <asm/arch-rockchip/qos_rk3288.h>
+
+DECLARE_GLOBAL_DATA_PTR;
#define GRF_BASE 0xff770000
@@ -36,6 +40,24 @@ static void configure_l2ctlr(void)
}
#endif
+int rk3288_qos_init(void)
+{
+ int val = 2 << PRIORITY_HIGH_SHIFT | 2 << PRIORITY_LOW_SHIFT;
+ /* set vop qos to higher priority */
+ writel(val, CPU_AXI_QOS_PRIORITY + VIO0_VOP_QOS);
+ writel(val, CPU_AXI_QOS_PRIORITY + VIO1_VOP_QOS);
+
+ if (!fdt_node_check_compatible(gd->fdt_blob, 0,
+ "rockchip,rk3288-tinker")) {
+ /* set isp qos to higher priority */
+ writel(val, CPU_AXI_QOS_PRIORITY + VIO1_ISP_R_QOS);
+ writel(val, CPU_AXI_QOS_PRIORITY + VIO1_ISP_W0_QOS);
+ writel(val, CPU_AXI_QOS_PRIORITY + VIO1_ISP_W1_QOS);
+ }
+
+ return 0;
+}
+
int arch_cpu_init(void)
{
#ifdef CONFIG_SPL_BUILD
@@ -46,6 +68,14 @@ int arch_cpu_init(void)
/* Use rkpwm by default */
rk_setreg(&grf->soc_con2, 1 << 0);
+
+ /*
+ * Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is
+ * cleared
+ */
+ rk_clrreg(&grf->soc_con0, 1 << 12);
+
+ rk3288_qos_init();
#endif
return 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 14/24] rockchip: rk3288: move board_early_init_f() back to veyron
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (12 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 13/24] rockchip: rk3288: move SOC setting into arch_cpu_init() Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 15/24] rockchip: rk3288: Move veyron_init() back to veyron.c Kever Yang
` (9 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
The board_early_init_f() is only used by veyron board now,
move it into the board file veyron.c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3288-board.c | 19 -------------------
board/google/veyron/veyron.c | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 9d88365fff..e629df3abb 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -243,22 +243,3 @@ U_BOOT_CMD(
"display information about clocks",
""
);
-
-int board_early_init_f(void)
-{
- struct udevice *dev;
- int ret;
-
- /*
- * This init is done in SPL, but when chain-loading U-Boot SPL will
- * have been skipped. Allow the clock driver to check if it needs
- * setting up.
- */
- ret = rockchip_get_clk(&dev);
- if (ret) {
- debug("CLK init failed: %d\n", ret);
- return ret;
- }
-
- return 0;
-}
diff --git a/board/google/veyron/veyron.c b/board/google/veyron/veyron.c
index 19edb18a66..361f0e9da2 100644
--- a/board/google/veyron/veyron.c
+++ b/board/google/veyron/veyron.c
@@ -4,9 +4,29 @@
*/
#include <common.h>
+#include <asm/arch-rockchip/clock.h>
/*
* We should increase the DDR voltage to 1.2V using the PWM regulator.
* There is a U-Boot driver for this but it may need to add support for the
* 'voltage-table' property.
*/
+
+int board_early_init_f(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ /*
+ * This init is done in SPL, but when chain-loading U-Boot SPL will
+ * have been skipped. Allow the clock driver to check if it needs
+ * setting up.
+ */
+ ret = rockchip_get_clk(&dev);
+ if (ret) {
+ debug("CLK init failed: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 15/24] rockchip: rk3288: Move veyron_init() back to veyron.c
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (13 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 14/24] rockchip: rk3288: move board_early_init_f() back to veyron Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 16/24] rockchip: rk3288: Move clock CMD to SoC file Kever Yang
` (8 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
The veyron_init() should go to its board file veyron.c,
and the board_early_init_f() could be the right place.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3288-board.c | 65 ---------------------------
board/google/veyron/veyron.c | 63 ++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 65 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index e629df3abb..915f82e8ba 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -15,7 +15,6 @@
#include <asm/arch-rockchip/pmu_rk3288.h>
#include <asm/arch-rockchip/boot_mode.h>
#include <asm/gpio.h>
-#include <dt-bindings/clock/rk3288-cru.h>
#include <power/regulator.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -70,73 +69,9 @@ int board_late_init(void)
return rk_board_late_init();
}
-#if !CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
-static int veyron_init(void)
-{
- struct udevice *dev;
- struct clk clk;
- int ret;
-
- ret = regulator_get_by_platname("vdd_arm", &dev);
- if (ret) {
- debug("Cannot set regulator name\n");
- return ret;
- }
-
- /* Slowly raise to max CPU voltage to prevent overshoot */
- ret = regulator_set_value(dev, 1200000);
- if (ret)
- return ret;
- udelay(175); /* Must wait for voltage to stabilize, 2mV/us */
- ret = regulator_set_value(dev, 1400000);
- if (ret)
- return ret;
- udelay(100); /* Must wait for voltage to stabilize, 2mV/us */
-
- ret = rockchip_get_clk(&clk.dev);
- if (ret)
- return ret;
- clk.id = PLL_APLL;
- ret = clk_set_rate(&clk, 1800000000);
- if (IS_ERR_VALUE(ret))
- return ret;
-
- ret = regulator_get_by_platname("vcc33_sd", &dev);
- if (ret) {
- debug("Cannot get regulator name\n");
- return ret;
- }
-
- ret = regulator_set_value(dev, 3300000);
- if (ret)
- return ret;
-
- ret = regulators_enable_boot_on(false);
- if (ret) {
- debug("%s: Cannot enable boot on regulators\n", __func__);
- return ret;
- }
-
- return 0;
-}
-#endif
-
int board_init(void)
{
-#if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
return 0;
-#else
- int ret;
-
- /* We do some SoC one time setting here */
- if (!fdt_node_check_compatible(gd->fdt_blob, 0, "google,veyron")) {
- ret = veyron_init();
- if (ret)
- return ret;
- }
-
- return 0;
-#endif
}
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
diff --git a/board/google/veyron/veyron.c b/board/google/veyron/veyron.c
index 361f0e9da2..dd2c014c60 100644
--- a/board/google/veyron/veyron.c
+++ b/board/google/veyron/veyron.c
@@ -3,20 +3,82 @@
* (C) Copyright 2015 Google, Inc
*/
+#include <clk.h>
#include <common.h>
+#include <dm.h>
#include <asm/arch-rockchip/clock.h>
+#include <dt-bindings/clock/rk3288-cru.h>
+#include <power/regulator.h>
/*
* We should increase the DDR voltage to 1.2V using the PWM regulator.
* There is a U-Boot driver for this but it may need to add support for the
* 'voltage-table' property.
*/
+#ifndef CONFIG_SPL_BUILD
+#if !CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
+static int veyron_init(void)
+{
+ struct udevice *dev;
+ struct clk clk;
+ int ret;
+
+ ret = regulator_get_by_platname("vdd_arm", &dev);
+ if (ret) {
+ debug("Cannot set regulator name\n");
+ return ret;
+ }
+
+ /* Slowly raise to max CPU voltage to prevent overshoot */
+ ret = regulator_set_value(dev, 1200000);
+ if (ret)
+ return ret;
+ udelay(175); /* Must wait for voltage to stabilize, 2mV/us */
+ ret = regulator_set_value(dev, 1400000);
+ if (ret)
+ return ret;
+ udelay(100); /* Must wait for voltage to stabilize, 2mV/us */
+
+ ret = rockchip_get_clk(&clk.dev);
+ if (ret)
+ return ret;
+ clk.id = PLL_APLL;
+ ret = clk_set_rate(&clk, 1800000000);
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ ret = regulator_get_by_platname("vcc33_sd", &dev);
+ if (ret) {
+ debug("Cannot get regulator name\n");
+ return ret;
+ }
+
+ ret = regulator_set_value(dev, 3300000);
+ if (ret)
+ return ret;
+
+ ret = regulators_enable_boot_on(false);
+ if (ret) {
+ debug("%s: Cannot enable boot on regulators\n", __func__);
+ return ret;
+ }
+
+ return 0;
+}
+#endif
int board_early_init_f(void)
{
struct udevice *dev;
int ret;
+#if !CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
+ if (!fdt_node_check_compatible(gd->fdt_blob, 0, "google,veyron")) {
+ ret = veyron_init();
+ if (ret)
+ return ret;
+ }
+#endif
/*
* This init is done in SPL, but when chain-loading U-Boot SPL will
* have been skipped. Allow the clock driver to check if it needs
@@ -30,3 +92,4 @@ int board_early_init_f(void)
return 0;
}
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 16/24] rockchip: rk3288: Move clock CMD to SoC file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (14 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 15/24] rockchip: rk3288: Move veyron_init() back to veyron.c Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 17/24] rockchip: rk3288: Move rk3288_detect_reset_reason to soc file Kever Yang
` (7 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Move the do_clock CMD to rk3288.c so that we can re-use
the common board file later.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3288-board.c | 51 ------------------------
arch/arm/mach-rockchip/rk3288/rk3288.c | 55 ++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 51 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 915f82e8ba..1c37038c99 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -127,54 +127,3 @@ int board_usb_cleanup(int index, enum usb_init_type init)
return 0;
}
#endif
-
-static int do_clock(cmd_tbl_t *cmdtp, int flag, int argc,
- char * const argv[])
-{
- static const struct {
- char *name;
- int id;
- } clks[] = {
- { "osc", CLK_OSC },
- { "apll", CLK_ARM },
- { "dpll", CLK_DDR },
- { "cpll", CLK_CODEC },
- { "gpll", CLK_GENERAL },
-#ifdef CONFIG_ROCKCHIP_RK3036
- { "mpll", CLK_NEW },
-#else
- { "npll", CLK_NEW },
-#endif
- };
- int ret, i;
- struct udevice *dev;
-
- ret = rockchip_get_clk(&dev);
- if (ret) {
- printf("clk-uclass not found\n");
- return 0;
- }
-
- for (i = 0; i < ARRAY_SIZE(clks); i++) {
- struct clk clk;
- ulong rate;
-
- clk.id = clks[i].id;
- ret = clk_request(dev, &clk);
- if (ret < 0)
- continue;
-
- rate = clk_get_rate(&clk);
- printf("%s: %lu\n", clks[i].name, rate);
-
- clk_free(&clk);
- }
-
- return 0;
-}
-
-U_BOOT_CMD(
- clock, 2, 1, do_clock,
- "display information about clocks",
- ""
-);
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index d938d4bff8..98e8610691 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -3,9 +3,13 @@
* Copyright (c) 2016 Rockchip Electronics Co., Ltd
*/
#include <common.h>
+#include <dm.h>
+#include <clk.h>
#include <asm/armv7.h>
#include <asm/io.h>
#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3288.h>
#include <asm/arch-rockchip/hardware.h>
#include <asm/arch-rockchip/grf_rk3288.h>
#include <asm/arch-rockchip/qos_rk3288.h>
@@ -108,3 +112,54 @@ int dram_init_banksize(void)
return 0;
}
#endif
+
+static int do_clock(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ static const struct {
+ char *name;
+ int id;
+ } clks[] = {
+ { "osc", CLK_OSC },
+ { "apll", CLK_ARM },
+ { "dpll", CLK_DDR },
+ { "cpll", CLK_CODEC },
+ { "gpll", CLK_GENERAL },
+#ifdef CONFIG_ROCKCHIP_RK3036
+ { "mpll", CLK_NEW },
+#else
+ { "npll", CLK_NEW },
+#endif
+ };
+ int ret, i;
+ struct udevice *dev;
+
+ ret = rockchip_get_clk(&dev);
+ if (ret) {
+ printf("clk-uclass not found\n");
+ return 0;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(clks); i++) {
+ struct clk clk;
+ ulong rate;
+
+ clk.id = clks[i].id;
+ ret = clk_request(dev, &clk);
+ if (ret < 0)
+ continue;
+
+ rate = clk_get_rate(&clk);
+ printf("%s: %lu\n", clks[i].name, rate);
+
+ clk_free(&clk);
+ }
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ clock, 2, 1, do_clock,
+ "display information about clocks",
+ ""
+);
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 17/24] rockchip: rk3288: Move rk3288_detect_reset_reason to soc file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (15 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 16/24] rockchip: rk3288: Move clock CMD to SoC file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 18/24] rockchip: rk3288: Migrate to use common board file Kever Yang
` (6 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
The rk3288_detect_reset_reason() is per-SoC operation, move
it to rk3288.c, and extend the rk_board_late_init() with
rk3288_board_late_init() to make all the board works fine
as before.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3288-board.c | 38 --------------
arch/arm/mach-rockchip/rk3288/rk3288.c | 49 +++++++++++++++++++
.../popmetal_rk3288/popmetal-rk3288.c | 2 +-
board/phytec/phycore_rk3288/phycore-rk3288.c | 2 +-
board/rockchip/tinker_rk3288/tinker-rk3288.c | 2 +-
5 files changed, 52 insertions(+), 41 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 1c37038c99..1f33f25943 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -24,47 +24,9 @@ __weak int rk_board_late_init(void)
return 0;
}
-static void rk3288_detect_reset_reason(void)
-{
- struct rk3288_cru *cru = rockchip_get_cru();
- const char *reason;
-
- if (IS_ERR(cru))
- return;
-
- switch (cru->cru_glb_rst_st) {
- case GLB_POR_RST:
- reason = "POR";
- break;
- case FST_GLB_RST_ST:
- case SND_GLB_RST_ST:
- reason = "RST";
- break;
- case FST_GLB_TSADC_RST_ST:
- case SND_GLB_TSADC_RST_ST:
- reason = "THERMAL";
- break;
- case FST_GLB_WDT_RST_ST:
- case SND_GLB_WDT_RST_ST:
- reason = "WDOG";
- break;
- default:
- reason = "unknown reset";
- }
-
- env_set("reset_reason", reason);
-
- /*
- * Clear cru_glb_rst_st, so we can determine the last reset cause
- * for following resets.
- */
- rk_clrreg(&cru->cru_glb_rst_st, GLB_RST_ST_MASK);
-}
-
int board_late_init(void)
{
setup_boot_mode();
- rk3288_detect_reset_reason();
return rk_board_late_init();
}
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index 98e8610691..eae05ac849 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -113,6 +113,55 @@ int dram_init_banksize(void)
}
#endif
+static void rk3288_detect_reset_reason(void)
+{
+ struct rk3288_cru *cru = rockchip_get_cru();
+ const char *reason;
+
+ if (IS_ERR(cru))
+ return;
+
+ switch (cru->cru_glb_rst_st) {
+ case GLB_POR_RST:
+ reason = "POR";
+ break;
+ case FST_GLB_RST_ST:
+ case SND_GLB_RST_ST:
+ reason = "RST";
+ break;
+ case FST_GLB_TSADC_RST_ST:
+ case SND_GLB_TSADC_RST_ST:
+ reason = "THERMAL";
+ break;
+ case FST_GLB_WDT_RST_ST:
+ case SND_GLB_WDT_RST_ST:
+ reason = "WDOG";
+ break;
+ default:
+ reason = "unknown reset";
+ }
+
+ env_set("reset_reason", reason);
+
+ /*
+ * Clear cru_glb_rst_st, so we can determine the last reset cause
+ * for following resets.
+ */
+ rk_clrreg(&cru->cru_glb_rst_st, GLB_RST_ST_MASK);
+}
+
+__weak int rk3288_board_late_init(void)
+{
+ return 0;
+}
+
+int rk_board_late_init(void)
+{
+ rk3288_detect_reset_reason();
+
+ return rk3288_board_late_init();
+}
+
static int do_clock(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
index 9ba1fbd0e2..47b921a748 100644
--- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
+++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
@@ -8,7 +8,7 @@
#define GPIO7A3_HUB_RST 227
-int rk_board_late_init(void)
+int rk3288_board_late_init(void)
{
int ret;
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index fbf1511978..92f3bd25f4 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -30,7 +30,7 @@ static int valid_rk3288_som(struct rk3288_som *som)
return hw == som->bs;
}
-int rk_board_late_init(void)
+int rk3288_board_late_init(void)
{
int ret;
struct udevice *dev;
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
index 44f13183a5..e6b018d89c 100644
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
@@ -21,7 +21,7 @@ static int get_ethaddr_from_eeprom(u8 *addr)
return i2c_eeprom_read(dev, 0, addr, 6);
}
-int rk_board_late_init(void)
+int rk3288_board_late_init(void)
{
u8 ethaddr[6];
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 18/24] rockchip: rk3288: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (16 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 17/24] rockchip: rk3288: Move rk3288_detect_reset_reason to soc file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 19/24] rockchip: rk3328: " Kever Yang
` (5 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 1 -
arch/arm/mach-rockchip/rk3288-board.c | 91 ---------------------------
3 files changed, 1 insertion(+), 92 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3288-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 86b01df8c4..b75c209b66 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -80,6 +80,7 @@ config ROCKCHIP_RK3288
select SUPPORT_SPL
select SPL
select SUPPORT_TPL
+ imply ROCKCHIP_COMMON_BOARD
imply SPL_ROCKCHIP_COMMON_BOARD
imply TPL_CLK
imply TPL_DM
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index dd7297d3c8..210e80ece2 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -22,7 +22,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
obj-y += boot_mode.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
-obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
endif
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
deleted file mode 100644
index 1f33f25943..0000000000
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2015 Google, Inc
- */
-
-#include <common.h>
-#include <clk.h>
-#include <dm.h>
-#include <ram.h>
-#include <syscon.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/cru_rk3288.h>
-#include <asm/arch-rockchip/periph.h>
-#include <asm/arch-rockchip/pmu_rk3288.h>
-#include <asm/arch-rockchip/boot_mode.h>
-#include <asm/gpio.h>
-#include <power/regulator.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
- return 0;
-}
-
-int board_late_init(void)
-{
- setup_boot_mode();
-
- return rk_board_late_init();
-}
-
-int board_init(void)
-{
- return 0;
-}
-
-#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include <usb.h>
-#include <usb/dwc2_udc.h>
-
-static struct dwc2_plat_otg_data otg_data = {
- .rx_fifo_sz = 512,
- .np_tx_fifo_sz = 16,
- .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const char *mode;
- bool matched = false;
- const void *blob = gd->fdt_blob;
-
- /* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "snps,dwc2");
-
- while (node > 0) {
- mode = fdt_getprop(blob, node, "dr_mode", NULL);
- if (mode && strcmp(mode, "otg") == 0) {
- matched = true;
- break;
- }
-
- node = fdt_node_offset_by_compatible(blob, node,
- "snps,dwc2");
- }
- if (!matched) {
- debug("Not found usb_otg device\n");
- return -ENODEV;
- }
- otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- return 0;
-}
-#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 19/24] rockchip: rk3328: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (17 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 18/24] rockchip: rk3288: Migrate to use common board file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-23 19:51 ` Matwey V. Kornilov
2019-07-22 12:02 ` [U-Boot] [PATCH 20/24] " Kever Yang
` (4 subsequent siblings)
23 siblings, 1 reply; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
board/rockchip/evb_rk3328/evb-rk3328.c | 64 --------------------------
2 files changed, 1 insertion(+), 64 deletions(-)
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b75c209b66..2b8bb8aa25 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -110,6 +110,7 @@ config ROCKCHIP_RK3328
select ARM64
select SUPPORT_SPL
select SPL
+ imply ROCKCHIP_COMMON_BOARD
imply SPL_ROCKCHIP_COMMON_BOARD
imply SPL_SERIAL_SUPPORT
imply SPL_SEPARATE_BSS
diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c
index 64595c783d..779bc646b2 100644
--- a/board/rockchip/evb_rk3328/evb-rk3328.c
+++ b/board/rockchip/evb_rk3328/evb-rk3328.c
@@ -3,67 +3,3 @@
* (C) Copyright 2016 Rockchip Electronics Co., Ltd
*/
-#include <common.h>
-#include <asm/armv8/mmu.h>
-#include <dwc3-uboot.h>
-#include <power/regulator.h>
-#include <usb.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int board_init(void)
-{
- int ret;
-
- ret = regulators_enable_boot_on(false);
- if (ret)
- debug("%s: Cannot enable boot on regulator\n", __func__);
-
- return ret;
-}
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include <usb.h>
-#include <usb/dwc2_udc.h>
-
-static struct dwc2_plat_otg_data otg_data = {
- .rx_fifo_sz = 512,
- .np_tx_fifo_sz = 16,
- .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const char *mode;
- bool matched = false;
- const void *blob = gd->fdt_blob;
-
- /* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1,
- "snps,dwc2");
-
- while (node > 0) {
- mode = fdt_getprop(blob, node, "dr_mode", NULL);
- if (mode && strcmp(mode, "otg") == 0) {
- matched = true;
- break;
- }
-
- node = fdt_node_offset_by_compatible(blob, node,
- "snps,dwc2");
- }
- if (!matched) {
- debug("Not found usb_otg device\n");
- return -ENODEV;
- }
- otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- return 0;
-}
-#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 19/24] rockchip: rk3328: Migrate to use common board file
2019-07-22 12:02 ` [U-Boot] [PATCH 19/24] rockchip: rk3328: " Kever Yang
@ 2019-07-23 19:51 ` Matwey V. Kornilov
0 siblings, 0 replies; 26+ messages in thread
From: Matwey V. Kornilov @ 2019-07-23 19:51 UTC (permalink / raw)
To: u-boot
22.07.2019 15:02, Kever Yang пишет:
> Use common board file for board_init() and board_late_init(),
> for Rockchip SoCs have very similar process.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Hi,
I've just checked that rock64-rk3328_defconfig is still bootable with
this series.
> ---
>
> arch/arm/mach-rockchip/Kconfig | 1 +
> board/rockchip/evb_rk3328/evb-rk3328.c | 64 --------------------------
> 2 files changed, 1 insertion(+), 64 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index b75c209b66..2b8bb8aa25 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -110,6 +110,7 @@ config ROCKCHIP_RK3328
> select ARM64
> select SUPPORT_SPL
> select SPL
> + imply ROCKCHIP_COMMON_BOARD
> imply SPL_ROCKCHIP_COMMON_BOARD
> imply SPL_SERIAL_SUPPORT
> imply SPL_SEPARATE_BSS
> diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c
> index 64595c783d..779bc646b2 100644
> --- a/board/rockchip/evb_rk3328/evb-rk3328.c
> +++ b/board/rockchip/evb_rk3328/evb-rk3328.c
> @@ -3,67 +3,3 @@
> * (C) Copyright 2016 Rockchip Electronics Co., Ltd
> */
>
> -#include <common.h>
> -#include <asm/armv8/mmu.h>
> -#include <dwc3-uboot.h>
> -#include <power/regulator.h>
> -#include <usb.h>
> -
> -DECLARE_GLOBAL_DATA_PTR;
> -
> -int board_init(void)
> -{
> - int ret;
> -
> - ret = regulators_enable_boot_on(false);
> - if (ret)
> - debug("%s: Cannot enable boot on regulator\n", __func__);
> -
> - return ret;
> -}
> -
> -#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
> -#include <usb.h>
> -#include <usb/dwc2_udc.h>
> -
> -static struct dwc2_plat_otg_data otg_data = {
> - .rx_fifo_sz = 512,
> - .np_tx_fifo_sz = 16,
> - .tx_fifo_sz = 128,
> -};
> -
> -int board_usb_init(int index, enum usb_init_type init)
> -{
> - int node;
> - const char *mode;
> - bool matched = false;
> - const void *blob = gd->fdt_blob;
> -
> - /* find the usb_otg node */
> - node = fdt_node_offset_by_compatible(blob, -1,
> - "snps,dwc2");
> -
> - while (node > 0) {
> - mode = fdt_getprop(blob, node, "dr_mode", NULL);
> - if (mode && strcmp(mode, "otg") == 0) {
> - matched = true;
> - break;
> - }
> -
> - node = fdt_node_offset_by_compatible(blob, node,
> - "snps,dwc2");
> - }
> - if (!matched) {
> - debug("Not found usb_otg device\n");
> - return -ENODEV;
> - }
> - otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
> -
> - return dwc2_udc_probe(&otg_data);
> -}
> -
> -int board_usb_cleanup(int index, enum usb_init_type init)
> -{
> - return 0;
> -}
> -#endif
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 20/24] rockchip: rk3328: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (18 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 19/24] rockchip: rk3328: " Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 21/24] rockchip: rk3399: init vbus regulator in board_early_init_f() Kever Yang
` (3 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
board/rockchip/evb_px5/evb-px5.c | 6 ------
board/rockchip/sheep_rk3368/sheep_rk3368.c | 15 ---------------
.../lion_rk3368/lion_rk3368.c | 18 ------------------
4 files changed, 1 insertion(+), 39 deletions(-)
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 2b8bb8aa25..90916a382e 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -131,6 +131,7 @@ config ROCKCHIP_RK3368
select SUPPORT_TPL
select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL
select TPL_NEEDS_SEPARATE_STACK if TPL
+ imply ROCKCHIP_COMMON_BOARD
imply SPL_ROCKCHIP_COMMON_BOARD
imply SPL_SEPARATE_BSS
imply SPL_SERIAL_SUPPORT
diff --git a/board/rockchip/evb_px5/evb-px5.c b/board/rockchip/evb_px5/evb-px5.c
index 53e753fc17..b81f970883 100644
--- a/board/rockchip/evb_px5/evb-px5.c
+++ b/board/rockchip/evb_px5/evb-px5.c
@@ -2,9 +2,3 @@
/*
* Copyright (c) 2017 Andy Yan
*/
-#include <common.h>
-
-int board_init(void)
-{
- return 0;
-}
diff --git a/board/rockchip/sheep_rk3368/sheep_rk3368.c b/board/rockchip/sheep_rk3368/sheep_rk3368.c
index 9bb93c7d16..b81f970883 100644
--- a/board/rockchip/sheep_rk3368/sheep_rk3368.c
+++ b/board/rockchip/sheep_rk3368/sheep_rk3368.c
@@ -2,18 +2,3 @@
/*
* Copyright (c) 2017 Andy Yan
*/
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/grf_rk3368.h>
-#include <syscon.h>
-
-int mach_cpu_init(void)
-{
- return 0;
-}
-
-int board_init(void)
-{
- return 0;
-}
diff --git a/board/theobroma-systems/lion_rk3368/lion_rk3368.c b/board/theobroma-systems/lion_rk3368/lion_rk3368.c
index 6cd5a5f18e..1b0d504631 100644
--- a/board/theobroma-systems/lion_rk3368/lion_rk3368.c
+++ b/board/theobroma-systems/lion_rk3368/lion_rk3368.c
@@ -2,21 +2,3 @@
/*
* Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
*/
-#include <common.h>
-#include <dm.h>
-#include <ram.h>
-#include <asm/io.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/grf_rk3368.h>
-#include <asm/arch-rockchip/timer.h>
-#include <syscon.h>
-
-int mach_cpu_init(void)
-{
- return 0;
-}
-
-int board_init(void)
-{
- return 0;
-}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 21/24] rockchip: rk3399: init vbus regulator in board_early_init_f()
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (19 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 20/24] " Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 22/24] rockchip: rk3399: Migrate to use common board file Kever Yang
` (2 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Handle per-board init in board_early_init_f() and use the
common board_init() for per-platform board init later.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
board/rockchip/evb_rk3399/evb-rk3399.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index eb1b832274..c7e93a358d 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -9,15 +9,12 @@
#include <asm/arch-rockchip/periph.h>
#include <power/regulator.h>
-int board_init(void)
+#ifndef CONFIG_SPL_BUILD
+int board_early_init_f(void)
{
struct udevice *regulator;
int ret;
- ret = regulators_enable_boot_on(false);
- if (ret)
- debug("%s: Cannot enable boot on regulator\n", __func__);
-
ret = regulator_get_by_platname("vcc5v0_host", ®ulator);
if (ret) {
debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
@@ -25,11 +22,22 @@ int board_init(void)
}
ret = regulator_set_enable(regulator, true);
- if (ret) {
- debug("%s vcc5v0-host-en set fail!\n", __func__);
- goto out;
- }
+ if (ret)
+ debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
out:
return 0;
}
+
+int board_init(void)
+{
+ struct udevice *regulator;
+ int ret;
+
+ ret = regulators_enable_boot_on(false);
+ if (ret)
+ debug("%s: Cannot enable boot on regulator\n", __func__);
+
+ return 0;
+}
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 22/24] rockchip: rk3399: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (20 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 21/24] rockchip: rk3399: init vbus regulator in board_early_init_f() Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 23/24] rockchip: elgin-rv1108: use board_early_init_f for per-boar init Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 24/24] rockchip: rv1108: Migrate to use common board file Kever Yang
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 1 -
arch/arm/mach-rockchip/rk3399-board.c | 13 -------------
board/rockchip/evb_rk3399/evb-rk3399.c | 13 -------------
board/theobroma-systems/puma_rk3399/puma-rk3399.c | 15 ---------------
board/vamrs/rock960_rk3399/rock960-rk3399.c | 15 ---------------
6 files changed, 1 insertion(+), 57 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3399-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 90916a382e..4b211794c6 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -177,6 +177,7 @@ config ROCKCHIP_RK3399
select DM_PMIC
select DM_REGULATOR_FIXED
select BOARD_LATE_INIT
+ imply ROCKCHIP_COMMON_BOARD
imply SPL_ROCKCHIP_COMMON_BOARD
imply TPL_SERIAL_SUPPORT
imply TPL_LIBCOMMON_SUPPORT
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 210e80ece2..ca633afcbb 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -22,7 +22,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
obj-y += boot_mode.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
-obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
endif
diff --git a/arch/arm/mach-rockchip/rk3399-board.c b/arch/arm/mach-rockchip/rk3399-board.c
deleted file mode 100644
index 443c87cccc..0000000000
--- a/arch/arm/mach-rockchip/rk3399-board.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2017 Rockchip Electronics Co., Ltd
- */
-
-#include <common.h>
-#include <asm/arch-rockchip/boot_mode.h>
-
-int board_late_init(void)
-{
- setup_boot_mode();
- return 0;
-}
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index c7e93a358d..b9049abcc7 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -5,7 +5,6 @@
#include <common.h>
#include <dm.h>
-#include <dm/pinctrl.h>
#include <asm/arch-rockchip/periph.h>
#include <power/regulator.h>
@@ -28,16 +27,4 @@ int board_early_init_f(void)
out:
return 0;
}
-
-int board_init(void)
-{
- struct udevice *regulator;
- int ret;
-
- ret = regulators_enable_boot_on(false);
- if (ret)
- debug("%s: Cannot enable boot on regulator\n", __func__);
-
- return 0;
-}
#endif
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 251cd2d566..a7e7f022ba 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -21,21 +21,6 @@
#include <power/regulator.h>
#include <u-boot/sha256.h>
-int board_init(void)
-{
- int ret;
-
- /*
- * We need to call into regulators_enable_boot_on() again, as the call
- * during SPL may have not included all regulators.
- */
- ret = regulators_enable_boot_on(false);
- if (ret)
- debug("%s: Cannot enable boot on regulator\n", __func__);
-
- return 0;
-}
-
static void setup_macaddr(void)
{
#if CONFIG_IS_ENABLED(CMD_NET)
diff --git a/board/vamrs/rock960_rk3399/rock960-rk3399.c b/board/vamrs/rock960_rk3399/rock960-rk3399.c
index 2eb7120e84..68a127b9ac 100644
--- a/board/vamrs/rock960_rk3399/rock960-rk3399.c
+++ b/board/vamrs/rock960_rk3399/rock960-rk3399.c
@@ -2,18 +2,3 @@
/*
* Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
*/
-
-#include <common.h>
-#include <dm.h>
-#include <power/regulator.h>
-
-int board_init(void)
-{
- int ret;
-
- ret = regulators_enable_boot_on(false);
- if (ret)
- debug("%s: Cannot enable boot on regulator\n", __func__);
-
- return 0;
-}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 23/24] rockchip: elgin-rv1108: use board_early_init_f for per-boar init
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (21 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 22/24] rockchip: rk3399: Migrate to use common board file Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
2019-07-22 12:02 ` [U-Boot] [PATCH 24/24] rockchip: rv1108: Migrate to use common board file Kever Yang
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use board_early_init_f() for per-board init operation and
use board_init() from common board file.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
board/elgin/elgin_rv1108/elgin_rv1108.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/board/elgin/elgin_rv1108/elgin_rv1108.c b/board/elgin/elgin_rv1108/elgin_rv1108.c
index 0de1f4243e..6f33f2ce6f 100644
--- a/board/elgin/elgin_rv1108/elgin_rv1108.c
+++ b/board/elgin/elgin_rv1108/elgin_rv1108.c
@@ -50,11 +50,14 @@ int mach_cpu_init(void)
#define MODEM_ENABLE_GPIO 111
-int board_init(void)
+int board_early_init_f(void)
{
gpio_request(MODEM_ENABLE_GPIO, "modem_enable");
gpio_direction_output(MODEM_ENABLE_GPIO, 0);
+}
+int board_init(void)
+{
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [U-Boot] [PATCH 24/24] rockchip: rv1108: Migrate to use common board file
2019-07-22 12:01 [U-Boot] [PATCH 00/24] rockchip: Migrate to use common board file Kever Yang
` (22 preceding siblings ...)
2019-07-22 12:02 ` [U-Boot] [PATCH 23/24] rockchip: elgin-rv1108: use board_early_init_f for per-boar init Kever Yang
@ 2019-07-22 12:02 ` Kever Yang
23 siblings, 0 replies; 26+ messages in thread
From: Kever Yang @ 2019-07-22 12:02 UTC (permalink / raw)
To: u-boot
Use common board file for board_init() and board_late_init(),
for Rockchip SoCs have very similar process.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/Makefile | 2 -
arch/arm/mach-rockchip/rv1108-board.c | 52 -------------------------
arch/arm/mach-rockchip/rv1108/rv1108.c | 10 -----
board/elgin/elgin_rv1108/elgin_rv1108.c | 5 ---
board/rockchip/evb_rv1108/evb_rv1108.c | 6 ---
6 files changed, 1 insertion(+), 75 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rv1108-board.c
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 4b211794c6..e337d06b99 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -203,6 +203,7 @@ config ROCKCHIP_RK3399
config ROCKCHIP_RV1108
bool "Support Rockchip RV1108"
select CPU_V7A
+ imply ROCKCHIP_COMMON_BOARD
help
The Rockchip RV1108 is a ARM-based SoC with a single-core Cortex-A7
and a DSP.
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index ca633afcbb..aed379a0dc 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -21,8 +21,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
# meaning "turn it off".
obj-y += boot_mode.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
-
-obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
endif
obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o
diff --git a/arch/arm/mach-rockchip/rv1108-board.c b/arch/arm/mach-rockchip/rv1108-board.c
deleted file mode 100644
index 3c683cb8ac..0000000000
--- a/arch/arm/mach-rockchip/rv1108-board.c
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2015 Google, Inc
- */
-
-#include <common.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include <usb.h>
-#include <usb/dwc2_udc.h>
-
-static struct dwc2_plat_otg_data otg_data = {
- .rx_fifo_sz = 512,
- .np_tx_fifo_sz = 16,
- .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const char *mode;
- bool matched = false;
- const void *blob = gd->fdt_blob;
-
- /* find the usb_otg node */
- node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc2");
-
- while (node > 0) {
- mode = fdt_getprop(blob, node, "dr_mode", NULL);
- if (mode && strcmp(mode, "otg") == 0) {
- matched = true;
- break;
- }
-
- node = fdt_node_offset_by_compatible(blob, node, "snps,dwc2");
- }
- if (!matched) {
- debug("Not found usb_otg device\n");
- return -ENODEV;
- }
- otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
- return dwc2_udc_probe(&otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- return 0;
-}
-#endif
diff --git a/arch/arm/mach-rockchip/rv1108/rv1108.c b/arch/arm/mach-rockchip/rv1108/rv1108.c
index 66aeb3ffcc..6362af995b 100644
--- a/arch/arm/mach-rockchip/rv1108/rv1108.c
+++ b/arch/arm/mach-rockchip/rv1108/rv1108.c
@@ -3,13 +3,3 @@
* (C) Copyright 2016 Rockchip Electronics Co., Ltd
* Author: Andy Yan <andy.yan@rock-chips.com>
*/
-
-#include <common.h>
-
-#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
diff --git a/board/elgin/elgin_rv1108/elgin_rv1108.c b/board/elgin/elgin_rv1108/elgin_rv1108.c
index 6f33f2ce6f..2087bffeb9 100644
--- a/board/elgin/elgin_rv1108/elgin_rv1108.c
+++ b/board/elgin/elgin_rv1108/elgin_rv1108.c
@@ -56,11 +56,6 @@ int board_early_init_f(void)
gpio_direction_output(MODEM_ENABLE_GPIO, 0);
}
-int board_init(void)
-{
- return 0;
-}
-
int dram_init(void)
{
gd->ram_size = 0x8000000;
diff --git a/board/rockchip/evb_rv1108/evb_rv1108.c b/board/rockchip/evb_rv1108/evb_rv1108.c
index 6d934f8805..733f29376e 100644
--- a/board/rockchip/evb_rv1108/evb_rv1108.c
+++ b/board/rockchip/evb_rv1108/evb_rv1108.c
@@ -47,12 +47,6 @@ int mach_cpu_init(void)
return 0;
}
-
-int board_init(void)
-{
- return 0;
-}
-
int dram_init(void)
{
gd->ram_size = 0x8000000;
--
2.17.1
^ permalink raw reply related [flat|nested] 26+ messages in thread