Skip to contentSkip to conversation

rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

PATCH New Kever Yang 2 participants 15 messages Apr 18, 2018 – Apr 26, 2018

Subsystems (3)
lore
Share & tools
lore

Kever Yang

author
#0 lore raw

PATCH 1/3 rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

We should a -u-boot.dtsi for those config need by U-Boot only, and other part sync with kernel.

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 18 ++++++++++++++++++
 arch/arm/dts/rk3188-radxarock.dts         |  6 +-----
 arch/arm/dts/rk3188.dtsi                  |  2 --
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/rk3188-radxarock-u-boot.dtsi
arch/arm/dts/rk3188-radxarock-u-boot.dtsi new file +18 -0
new file mode 100644
index 0000000..5d650b1
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+&cru {
+	u-boot,dm-spl;
+};
+
+&pinctrl {
+	u-boot,dm-spl;
+};
+
+&uart2 {
+	status = "okay";
+	u-boot,dm-spl;
+};
arch/arm/dts/rk3188-radxarock.dts +1 -5
index 5f5b5e9..0fc4f54 100644
@@ -7,6 +7,7 @@
 /dts-v1/;
 #include <dt-bindings/input/input.h>
 #include "rk3188.dtsi"
+#include "rk3188-radxarock-u-boot.dtsi"
 
 / {
 	model = "Radxa Rock";
@@ -356,11 +357,6 @@
 	status = "okay";
 };
 
-&uart2 {
-	status = "okay";
-	u-boot,dm-spl;
-};
-
 &uart3 {
 	status = "okay";
 };
arch/arm/dts/rk3188.dtsi +0 -2
index f4d438e..1a06843 100644
@@ -105,7 +105,6 @@
 		compatible = "rockchip,rk3188-cru";
 		reg = <0x20000000 0x1000>;
 		rockchip,grf = <&grf>;
-		u-boot,dm-spl;
 
 		#clock-cells = <1>;
 		#reset-cells = <1>;
@@ -156,7 +155,6 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
-		u-boot,dm-spl;
 
 		gpio0: gpio0 at 2000a000 {
 			compatible = "rockchip,gpio-bank";
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
 arch/arm/dts/rk3188.dtsi                  | 6 ++++++
 2 files changed, 12 insertions(+)
arch/arm/dts/rk3188-radxarock-u-boot.dtsi +6 -0
index 5d650b1..26f5707 100644
@@ -16,3 +16,9 @@
 	status = "okay";
 	u-boot,dm-spl;
 };
+
+&timer3 {
+	compatible = "rockchip,rk3368-timer", "rockchip,rk3288-timer";
+	u-boot,dm-spl;
+	clock-frequency = <24000000>;
+};
arch/arm/dts/rk3188.dtsi +6 -0
index 1a06843..aeb5b80 100644
@@ -123,6 +123,12 @@
 		};
 	};
 
+	timer3: timer at 2000e000 {
+		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
+		reg = <0x2000e000 0x20>;
+		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
 	usbphy: phy {
 		compatible = "rockchip,rk3188-usb-phy", "rockchip,rk3288-usb-phy";
 		rockchip,grf = <&grf>;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

Quoted 5 lines

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

Quoted 7 lines

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
 arch/arm/dts/rk3188.dtsi                  | 6 ++++++
 2 files changed, 12 insertions(+)
#3 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

Kever,

Quoted 10 lines · Philipp Tomsich
Quoted 9 lines

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

---

Quoted 6 lines
Quoted 4 lines

arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
arch/arm/dts/rk3188.dtsi | 6 ++++++

2 files changed, 12 insertions(+)

This looks like a work-around that we’ll have to revert eventually. I would instead extend the driver to recognise the ‘rockchip,rk3188-timer’ and ‘rockchip,rk3288-timer’ as well.

Please confirm that both these .compatible strings should also be handled by the same driver and I’ll make the change when applying this series.

Thanks,
Philipp.

author
#4 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

Hi Philipp,

Quoted 16 lines · Dr. Philipp Tomsich

Kever,

Quoted 14 lines · Philipp Tomsich
Quoted 13 lines

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

---

arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
arch/arm/dts/rk3188.dtsi | 6 ++++++

2 files changed, 12 insertions(+)
Quoted 7 lines
Quoted 1 line

This looks like a work-around that we’ll have to revert eventually. I would instead extend the driver to recognise the ‘rockchip,rk3188-timer’ and ‘rockchip,rk3288-timer’ as well.

Please confirm that both these .compatible strings should also be handled by the same driver and I’ll make the change when applying this series.

Do you mean you want patch like this? I do not like add lots #ifdef/#elif like this.
+++ b/drivers/timer/rockchip_timer.c
@@ -17,7 +17,11 @@ DECLARE_GLOBAL_DATA_PTR;

 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 struct rockchip_timer_plat {
+#ifdef CONFIG_ROCKCHIP_RK3368
        struct dtd_rockchip_rk3368_timer dtd;
+#elif CONFIG_ROCKCHIP_RK3188
+       struct dtd_rockchip_rk3188_timer dtd;
+#endif
 };
 #endif

@@ -153,6 +157,7 @@ static const struct timer_ops rockchip_timer_ops = {
 static const struct udevice_id rockchip_timer_ids[] = {
        { .compatible = "rockchip,rk3368-timer" },
+       { .compatible = "rockchip,rk3188-timer" },
        {}
 };

Thanks,
- Kever

Quoted 3 lines

Thanks,
Philipp.

#5 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

Quoted 34 lines · Kever Yang

Hi Philipp,

Quoted 16 lines · Dr. Philipp Tomsich

Kever,

Quoted 14 lines · Philipp Tomsich
Quoted 13 lines

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

---

arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
arch/arm/dts/rk3188.dtsi | 6 ++++++

2 files changed, 12 insertions(+)
Quoted 7 lines
Quoted 1 line

This looks like a work-around that we’ll have to revert eventually. I would instead extend the driver to recognise the ‘rockchip,rk3188-timer’ and ‘rockchip,rk3288-timer’ as well.

Please confirm that both these .compatible strings should also be handled by the same driver and I’ll make the change when applying this series.

Do you mean you want patch like this? I do not like add lots #ifdef/#elif like this.
+++ b/drivers/timer/rockchip_timer.c

Review DECLARE_GLOBAL_DATA_PTR; · line 26

Quoted 10 lines
(quoted diff) +4 -0
@@ -17,7 +17,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 struct rockchip_timer_plat {
+#ifdef CONFIG_ROCKCHIP_RK3368
        struct dtd_rockchip_rk3368_timer dtd;
+#elif CONFIG_ROCKCHIP_RK3188
+       struct dtd_rockchip_rk3188_timer dtd;
+#endif
 };
 #endif

The OF_PLATDATA implementation is really broken in this regard: the only fix I can think of would be to emit "struct dtd_…” for every compatible listed in the DTS.

Review static const struct timer_ops rockchip_timer_ops = { · line 162

Quoted 7 lines
(quoted diff) +1 -0
@@ -153,6 +157,7 @@ static const struct timer_ops rockchip_timer_ops = {
 
 static const struct udevice_id rockchip_timer_ids[] = {
        { .compatible = "rockchip,rk3368-timer" },
+       { .compatible = "rockchip,rk3188-timer" },
        {}
 };

I actually referred only to this part (i.e. adding the .compatible).

#6 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

Quoted 38 lines · Dr. Philipp Tomsich
Quoted 36 lines · Kever Yang

Hi Philipp,

Quoted 16 lines · Dr. Philipp Tomsich

Kever,

Quoted 14 lines · Philipp Tomsich
Quoted 13 lines

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

---

arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
arch/arm/dts/rk3188.dtsi | 6 ++++++

2 files changed, 12 insertions(+)
Quoted 7 lines
Quoted 1 line

This looks like a work-around that we’ll have to revert eventually. I would instead extend the driver to recognise the ‘rockchip,rk3188-timer’ and ‘rockchip,rk3288-timer’ as well.

Please confirm that both these .compatible strings should also be handled by the same driver and I’ll make the change when applying this series.

Do you mean you want patch like this? I do not like add lots #ifdef/#elif like this.
+++ b/drivers/timer/rockchip_timer.c

(quoted diff) +0 -0
@@ -17,7 +17,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
Quoted 13 lines

Review DECLARE_GLOBAL_DATA_PTR; · line 26

Quoted 9 lines
(quoted diff) +4 -0
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 struct rockchip_timer_plat {
+#ifdef CONFIG_ROCKCHIP_RK3368
       struct dtd_rockchip_rk3368_timer dtd;
+#elif CONFIG_ROCKCHIP_RK3188
+       struct dtd_rockchip_rk3188_timer dtd;
+#endif
 };
 #endif

The OF_PLATDATA implementation is really broken in this regard: the only fix I can think of would be to emit "struct dtd_…” for every compatible listed in the DTS.

I stand corrected: the OF_PLATDATA implementation (i.e. dtoc) already created #define entries for all aliases in the compatible-list of a DTS node.

We’ll have to clean up our DTS files and this driver in the next release cycle and simply need to make sure that a common compatible is found across all devices (and the driver expects that common structure name).

—Philipp.

#7 lore raw

PATCH 2/3 rockchip: rk3188: add timer3 node

In reply to Kever Yang
Quoted 5 lines

Add dts node for timer3.
Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer" with OF_PLATDATA enable, so we override its compatible to "rockchip,rk3368-timer".

Quoted 8 lines

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++++++
 arch/arm/dts/rk3188.dtsi                  | 6 ++++++
 2 files changed, 12 insertions(+)

Applied to u-boot-rockchip, thanks!

author
#8 lore raw

PATCH 3/3 rockchip: rk3188: use DM timer instead of rk_timer

In reply to Kever Yang

Disable rk_timer as SYS timer and use DM timer instead, so that we can get a better timer framework, the rk_timer is going to be clean after we conver to use DM timer or ARM arch/generic timer.

---

 arch/arm/mach-rockchip/Makefile           | 2 ++
 arch/arm/mach-rockchip/rk3188-board-spl.c | 2 --
 configs/rock_defconfig                    | 3 +++
 include/configs/rk3188_common.h           | 5 -----
 4 files changed, 5 insertions(+), 7 deletions(-)
arch/arm/mach-rockchip/Makefile +2 -0
index e1b0519..096dbac 100644
@@ -40,8 +40,10 @@ endif
 obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o
 
 ifndef CONFIG_ARM64
+ifndef CONFIG_ROCKCHIP_RK3188
 obj-y += rk_timer.o
 endif
+endif
 
 obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/
 obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/
arch/arm/mach-rockchip/rk3188-board-spl.c +0 -2
index 74771d3..3ccc4f1 100644
@@ -131,8 +131,6 @@ void board_init_f(ulong dummy)
 		hang();
 	}
 
-	rockchip_timer_init();
-
 	ret = rockchip_get_clk(&dev);
 	if (ret) {
 		debug("CLK init failed: %d\n", ret);
configs/rock_defconfig +3 -0
index f4882a8..e46cc29 100644
@@ -5,6 +5,9 @@ CONFIG_ARCH_ROCKCHIP=y
 CONFIG_SYS_TEXT_BASE=0x60000000
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ROCKCHIP_RK3188=y
+CONFIG_TIMER=y
+CONFIG_SPL_TIMER=y
+CONFIG_ROCKCHIP_TIMER=y
 CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
 CONFIG_TARGET_ROCK=y
 CONFIG_SPL_STACK_R_ADDR=0x60080000
include/configs/rk3188_common.h +0 -5
index 94f8cda..e07facd 100644
@@ -17,11 +17,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(32 << 20)
 #define CONFIG_SYS_CBSIZE		1024
 
-#define CONFIG_SYS_TIMER_RATE		(24 * 1000 * 1000)
-#define CONFIG_SYS_TIMER_BASE		0x2000e000 /* TIMER3 */
-#define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMER_BASE + 8)
-#define CONFIG_SYS_TIMER_COUNTS_DOWN
-
 #define CONFIG_SYS_NS16550_MEM32
 
 #ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM
Signature · 1 line
1.9.1
#9 lore raw

PATCH 3/3 rockchip: rk3188: use DM timer instead of rk_timer

Quoted 5 lines

Disable rk_timer as SYS timer and use DM timer instead, so that we can get a better timer framework, the rk_timer is going to be clean after we conver to use DM timer or ARM arch/generic timer.

Quoted 9 lines

---

 arch/arm/mach-rockchip/Makefile           | 2 ++
 arch/arm/mach-rockchip/rk3188-board-spl.c | 2 --
 configs/rock_defconfig                    | 3 +++
 include/configs/rk3188_common.h           | 5 -----
 4 files changed, 5 insertions(+), 7 deletions(-)
#10 lore raw

PATCH 3/3 rockchip: rk3188: use DM timer instead of rk_timer

In reply to Kever Yang
Quoted 5 lines

Disable rk_timer as SYS timer and use DM timer instead, so that we can get a better timer framework, the rk_timer is going to be clean after we conver to use DM timer or ARM arch/generic timer.

Quoted 9 lines

---

 arch/arm/mach-rockchip/Makefile           | 2 ++
 arch/arm/mach-rockchip/rk3188-board-spl.c | 2 --
 configs/rock_defconfig                    | 3 +++
 include/configs/rk3188_common.h           | 5 -----
 4 files changed, 5 insertions(+), 7 deletions(-)
#11 lore raw

PATCH 3/3 rockchip: rk3188: use DM timer instead of rk_timer

In reply to Kever Yang
Quoted 8 lines

Disable rk_timer as SYS timer and use DM timer instead, so that we can get a better timer framework, the rk_timer is going to be clean after we conver to use DM timer or ARM arch/generic timer.

Quoted 8 lines

---

 arch/arm/mach-rockchip/Makefile           | 2 ++
 arch/arm/mach-rockchip/rk3188-board-spl.c | 2 --
 configs/rock_defconfig                    | 3 +++
 include/configs/rk3188_common.h           | 5 -----
 4 files changed, 5 insertions(+), 7 deletions(-)

Applied to u-boot-rockchip, thanks!

#12 lore raw

PATCH 1/3 rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

In reply to Kever Yang
Quoted 12 lines

We should a -u-boot.dtsi for those config need by U-Boot only, and other part sync with kernel.

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 18 ++++++++++++++++++
 arch/arm/dts/rk3188-radxarock.dts         |  6 +-----
 arch/arm/dts/rk3188.dtsi                  |  2 --
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/rk3188-radxarock-u-boot.dtsi
#13 lore raw

PATCH 1/3 rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

In reply to Kever Yang
Quoted 12 lines

We should a -u-boot.dtsi for those config need by U-Boot only, and other part sync with kernel.

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 18 ++++++++++++++++++
 arch/arm/dts/rk3188-radxarock.dts         |  6 +-----
 arch/arm/dts/rk3188.dtsi                  |  2 --
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/rk3188-radxarock-u-boot.dtsi
#14 lore raw

PATCH 1/3 rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

In reply to Kever Yang
Quoted 6 lines

We should a -u-boot.dtsi for those config need by U-Boot only, and other part sync with kernel.

Quoted 8 lines

---

 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 18 ++++++++++++++++++
 arch/arm/dts/rk3188-radxarock.dts         |  6 +-----
 arch/arm/dts/rk3188.dtsi                  |  2 --
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/rk3188-radxarock-u-boot.dtsi

Applied to u-boot-rockchip, thanks!