Skip to contentSkip to conversation

Support the timer on RK3368 SoC

PATCH In review Caesar Wang 6 participants 18 messages Sep 17, 2015 – Sep 18, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Support the timer on RK3368 SoC

Timer0~11 count up from zero to a programmed value and generate an interrupt when the count reaches the programmed value.

TIMER0, TIMER1, TIMER2, Timer3, TIMER4 and TIMER5 are in the CPU subsystem, using timer ch0 ~ ch5 respectively. The timer clock is 24MHz OSC.

This series are found on RK3368 SoC, verified on rk3368 evb board.

Caesar Wang (3):
clocksource: rockchip: Make the driver more readability and compatible
arm64: Enable the timer on Rockchip architecture
arm64: dts: rockchip: Add the needed timer for rk3368 SoC

 arch/arm64/Kconfig.platforms             |  1 +
 arch/arm64/boot/dts/rockchip/rk3368.dtsi |  6 ++++++
 drivers/clocksource/rockchip_timer.c     | 29 +++++++++++++++--------------
 3 files changed, 22 insertions(+), 14 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 clocksource: rockchip: Make the driver more readability and compatible

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared /tmp/ccdAnNy5.s:47: Error: missing immediate expression at operand 1 -- dsb
...

The problem was different semantics of dsb on btw arm32 and arm64, Here we can convert the dsb with insteading of dsb(sy).

Meanwhile, I change a bit to make the code more readability for driver when I check the code style.

---

 drivers/clocksource/rockchip_timer.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/clocksource/rockchip_timer.c +15 -14
index bb2c2b0..c479d76 100644
@@ -17,16 +17,16 @@
 
 #define TIMER_NAME "rk_timer"
 
-#define TIMER_LOAD_COUNT0 0x00
-#define TIMER_LOAD_COUNT1 0x04
-#define TIMER_CONTROL_REG 0x10
-#define TIMER_INT_STATUS 0x18
+#define TIMER_LOAD_COUNT0	0x00
+#define TIMER_LOAD_COUNT1	0x04
+#define TIMER_CONTROL_REG	0x10
+#define TIMER_INT_STATUS	0x18
 
-#define TIMER_DISABLE 0x0
-#define TIMER_ENABLE 0x1
-#define TIMER_MODE_FREE_RUNNING (0 << 1)
-#define TIMER_MODE_USER_DEFINED_COUNT (1 << 1)
-#define TIMER_INT_UNMASK (1 << 2)
+#define TIMER_DISABLE			(0 << 0)
+#define TIMER_ENABLE			(1 << 0)
+#define TIMER_MODE_FREE_RUNNING		(0 << 1)
+#define TIMER_MODE_USER_DEFINED_COUNT	(1 << 1)
+#define TIMER_INT_UNMASK		(1 << 2)
 
 struct bc_timer {
 	struct clock_event_device ce;
@@ -49,14 +49,14 @@ static inline void __iomem *rk_base(struct clock_event_device *ce)
 static inline void rk_timer_disable(struct clock_event_device *ce)
 {
 	writel_relaxed(TIMER_DISABLE, rk_base(ce) + TIMER_CONTROL_REG);
-	dsb();
+	dsb(sy);
 }
 
 static inline void rk_timer_enable(struct clock_event_device *ce, u32 flags)
 {
 	writel_relaxed(TIMER_ENABLE | TIMER_INT_UNMASK | flags,
 		       rk_base(ce) + TIMER_CONTROL_REG);
-	dsb();
+	dsb(sy);
 }
 
 static void rk_timer_update_counter(unsigned long cycles,
@@ -64,13 +64,13 @@ static void rk_timer_update_counter(unsigned long cycles,
 {
 	writel_relaxed(cycles, rk_base(ce) + TIMER_LOAD_COUNT0);
 	writel_relaxed(0, rk_base(ce) + TIMER_LOAD_COUNT1);
-	dsb();
+	dsb(sy);
 }
 
 static void rk_timer_interrupt_clear(struct clock_event_device *ce)
 {
 	writel_relaxed(1, rk_base(ce) + TIMER_INT_STATUS);
-	dsb();
+	dsb(sy);
 }
 
 static inline int rk_timer_set_next_event(unsigned long cycles,
@@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np)
 	bc_timer.freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq == NO_IRQ) {
+	if (irq < 0) {
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		return;
 	}
@@ -173,4 +173,5 @@ static void __init rk_timer_init(struct device_node *np)
 
 	clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX);
 }
+
 CLOCKSOURCE_OF_DECLARE(rk_timer, "rockchip,rk3288-timer", rk_timer_init);
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Hi Caesar,

Quoted 6 lines · Caesar Wang

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Quoted 6 lines

/tmp/ccdAnNy5.s:47: Error: missing immediate expression at operand 1 -- dsb
...

The problem was different semantics of dsb on btw arm32 and arm64, Here we can convert the dsb with insteading of dsb(sy).

What happens to ARM32 then ?

Quoted 4 lines

Meanwhile, I change a bit to make the code more readability for driver when I check the code style.

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Hi Daniel,

? 2015?09?17? 17:11, Daniel Lezcano ??:

Quoted 5 lines

Hi Caesar,

On 09/17/2015 09:51 AM, Caesar Wang wrote:

Quoted 8 lines
Quoted 6 lines

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Quoted 10 lines
Quoted 7 lines

/tmp/ccdAnNy5.s:47: Error: missing immediate expression at operand 1 -- dsb
...

The problem was different semantics of dsb on btw arm32 and arm64, Here we can convert the dsb with insteading of dsb(sy).

What happens to ARM32 then ?

The dsb() is ok for ARM32, the ARM32/64 are OK if we can convert the dsb() to dsb(sy).
I believe all drivers with 'dsb()' have same issue on ARM64 platform.

Quoted 6 lines
Quoted 4 lines

Meanwhile, I change a bit to make the code more readability for driver when I check the code style.

Signature · 2 lines
Thanks,
Caesar
maintainer
#4 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Hi,

Am Donnerstag, 17. September 2015, 17:28:10 schrieb Caesar Wang:

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem was different semantics of dsb on btw arm32 and arm64, Here we can convert the dsb with insteading of dsb(sy).

What happens to ARM32 then ?

The dsb() is ok for ARM32, the ARM32/64 are OK if we can convert the dsb() to dsb(sy).
I believe all drivers with 'dsb()' have same issue on ARM64 platform.

correct ... I read this up in the ARM docs 2 days ago too for something.

The "sy" param is the default, which you are allow to omit, so on arm32 dsb() and dsb(sy) are the same.

Heiko

#5 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

In reply to Caesar Wang
Quoted 12 lines · Caesar Wang

Hi Daniel,

? 2015?09?17? 17:11, Daniel Lezcano ??:

Quoted 8 lines

Hi Caesar,

Quoted 3 lines · Caesar Wang

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

Quoted 22 lines
Quoted 9 lines
Quoted 6 lines

/tmp/ccdAnNy5.s:47: Error: missing immediate expression at operand 1 -- dsb
...

The problem was different semantics of dsb on btw arm32 and arm64, Here we can convert the dsb with insteading of dsb(sy).

What happens to ARM32 then ?

The dsb() is ok for ARM32, the ARM32/64 are OK if we can convert the dsb() to dsb(sy).
I believe all drivers with 'dsb()' have same issue on ARM64 platform.

Quoted 6 lines
Quoted 4 lines

Meanwhile, I change a bit to make the code more readability for driver when I check the code style.

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#6 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Quoted 10 lines · Daniel Lezcano
Quoted 3 lines · Caesar Wang
Quoted 1 line

I think the NO_IRQ definition is missing for ARM64.

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

IRQ0 is invalid for historical reasons. End of story.

Thanks,

tglx

#7 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Quoted 6 lines · Thomas Gleixner
Quoted 5 lines · Daniel Lezcano
Quoted 3 lines · Caesar Wang
Quoted 1 line

I think the NO_IRQ definition is missing for ARM64.

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Quoted 7 lines
Quoted 5 lines

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

IRQ0 is invalid for historical reasons. End of story.

Hi Thomas,

there is one thing I don't understand.

If the IRQ0 is invalid, irq_of_parse_and_map returning zero means an error and from what you said it is ok.

But I see the NO_IRQ on ARM is (-1) and the drivers are checking with NO_IRQ the return code of irq_of_parse_and_map. So if there is an error, that won't be detected.

For this specific use case above, shall irq_of_parse_and_map returns NO_IRQ or the caller checks against zero ?

Beside that, some drivers are internally defining NO_IRQ:
drivers/scsi/NCR5380.h drivers/ata/sata_dwc_460ex.c drivers/input/touchscreen/ucb1400_ts.c drivers/mmc/host/of_mmc_spi.c drivers/rtc/rtc-m48t59.c
drivers/scsi/NCR5380.h

I don't know the historical changes and the subtleties of the irq subsystem (I guess it is considerably complicated by each architecture specific bits and the drivers supported on different architectures)

If you have the time, can you give some clarification ?

Thanks

-- Daniel

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#8 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Quoted 10 lines · Daniel Lezcano

Hi Thomas,

there is one thing I don't understand.

If the IRQ0 is invalid, irq_of_parse_and_map returning zero means an error and from what you said it is ok.

But I see the NO_IRQ on ARM is (-1) and the drivers are checking with NO_IRQ the return code of irq_of_parse_and_map. So if there is an error, that won't be detected.

NO_IRQ being -1 is a legacy thing for ARM - all ARM drivers are supposed to be converted to use <= 0 or == 0 to detect invalid IRQs, and _eventually_ once all users are gone, NO_IRQ deleted.

Moreover, there are supposed to be no _new_ users of NO_IRQ ever added to the kernel.

Modern drivers should _all_ be using !irq to detect invalid IRQs, and not using NO_IRQ.

The steps here are:

1. Convert all ARM platforms to start numbering IRQs from 1 rather than 0.
2. Convert all drivers used on ARM to detect lack of IRQ by checking for <= 0.
3. Replace NO_IRQ assignments with zero-initialisations.
4. Remove NO_IRQ.

The reason it hasn't happened is that it requires effort and testing, and rather than running around getting old platforms to boot (which includes remembering _how_ to get them to boot) with recent kernels, I prefer to spend my time doing more productive work with modern code.

Signature · 2 lines
FTTC broadband for 0.8mile line: [email protected] down 400kbps up
according to speedtest.net.
#9 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Daniel Lezcano

Hi Thomas,

there is one thing I don't understand.

If the IRQ0 is invalid, irq_of_parse_and_map returning zero means an error and from what you said it is ok.

But I see the NO_IRQ on ARM is (-1) and the drivers are checking with NO_IRQ the return code of irq_of_parse_and_map. So if there is an error, that won't be detected.

Hi Russel,

Quoted 9 lines

NO_IRQ being -1 is a legacy thing for ARM - all ARM drivers are supposed to be converted to use <= 0 or == 0 to detect invalid IRQs, and _eventually_ once all users are gone, NO_IRQ deleted.

Moreover, there are supposed to be no _new_ users of NO_IRQ ever added to the kernel.

Modern drivers should _all_ be using !irq to detect invalid IRQs, and not using NO_IRQ.

Ah, ok. Thanks for the clarification.

Quoted 4 lines

The steps here are:

1. Convert all ARM platforms to start numbering IRQs from 1 rather than 0.
2. Convert all drivers used on ARM to detect lack of IRQ by checking for

Quoted 8 lines
    <= 0.

3. Replace NO_IRQ assignments with zero-initialisations.
4. Remove NO_IRQ.

The reason it hasn't happened is that it requires effort and testing, and rather than running around getting old platforms to boot (which includes remembering _how_ to get them to boot) with recent kernels, I prefer to spend my time doing more productive work with modern code.

I understand. I will take the opportunity track down those NO_IRQ in the clocksource directory.

-- Daniel

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#10 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

In reply to Daniel Lezcano

? 2015?09?17? 18:06, Daniel Lezcano ??:

Quoted 20 lines · Caesar Wang
Quoted 19 lines

Hi Daniel,

? 2015?09?17? 17:11, Daniel Lezcano ??:

Quoted 14 lines

Hi Caesar,

Quoted 7 lines · Caesar Wang

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Quoted 7 lines
Quoted 1 line

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

I believe the 'NO_IRQ' is better select if 'NO_IRQ' is defined on ARM64 platform.

     irq = irq_of_parse_and_map(np, 0);

     if (irq  == NO_IRQ)

...
Also, that's ok if we instead of the 'irq < 0' or '!irq' , right?

Quoted 30 lines
Quoted 24 lines
Quoted 11 lines
Quoted 8 lines

/tmp/ccdAnNy5.s:47: Error: missing immediate expression at operand 1 --
dsb
...

The problem was different semantics of dsb on btw arm32 and arm64, Here we can convert the dsb with insteading of dsb(sy).

What happens to ARM32 then ?

The dsb() is ok for ARM32, the ARM32/64 are OK if we can convert the dsb() to dsb(sy).
I believe all drivers with 'dsb()' have same issue on ARM64 platform.

Quoted 6 lines
Quoted 4 lines

Meanwhile, I change a bit to make the code more readability for driver when I check the code style.

Signature · 2 lines
Thanks,
Caesar
#11 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Quoted 31 lines · Caesar Wang

? 2015?09?17? 18:06, Daniel Lezcano ??:

Quoted 20 lines · Caesar Wang
Quoted 19 lines

Hi Daniel,

? 2015?09?17? 17:11, Daniel Lezcano ??:

Quoted 14 lines

Hi Caesar,

Quoted 7 lines · Caesar Wang

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Quoted 7 lines
Quoted 1 line

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

Quoted 8 lines

I believe the 'NO_IRQ' is better select if 'NO_IRQ' is defined on ARM64 platform.

     irq = irq_of_parse_and_map(np, 0);

     if (irq  == NO_IRQ)

...
Also, that's ok if we instead of the 'irq < 0' or '!irq' , right?

Hi Caesar,

so regarding Thomas and Russel answers, let's replace NO_IRQ by '!irq'.

Thanks.

-- Daniel

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#12 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

Hi Daniel,

? 2015?09?18? 15:55, Daniel Lezcano ??:

Quoted 37 lines · Caesar Wang
Quoted 36 lines

? 2015?09?17? 18:06, Daniel Lezcano ??:

Quoted 20 lines · Caesar Wang
Quoted 19 lines

Hi Daniel,

? 2015?09?17? 17:11, Daniel Lezcano ??:

Quoted 14 lines

Hi Caesar,

Quoted 7 lines · Caesar Wang

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Quoted 7 lines
Quoted 1 line

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

I believe the 'NO_IRQ' is better select if 'NO_IRQ' is defined on ARM64 platform.

     irq = irq_of_parse_and_map(np, 0);
Quoted 8 lines
Quoted 3 lines
     if (irq  == NO_IRQ)

...
Also, that's ok if we instead of the 'irq < 0' or '!irq' , right?

Hi Caesar,

so regarding Thomas and Russel answers, let's replace NO_IRQ by '!irq'.

Fixed, I will send the patch v1.

Quoted 6 lines

Thanks.

-- Daniel

Signature · 2 lines
Thanks,
Caesar
#13 lore raw

Re: [PATCH 1/3] clocksource: rockchip: Make the driver more readability and compatible

In reply to Daniel Lezcano
Quoted 37 lines · Daniel Lezcano
Quoted 36 lines · Caesar Wang

? 2015?09?17? 18:06, Daniel Lezcano ??:

Quoted 20 lines · Caesar Wang
Quoted 19 lines

Hi Daniel,

? 2015?09?17? 17:11, Daniel Lezcano ??:

Quoted 14 lines

Hi Caesar,

Quoted 7 lines · Caesar Wang

Build the arm64 SoCs (e.g.: RK3368) on Rockchip platform, There are some failure with build up on timer driver for rockchip.

logs:
...
drivers/clocksource/rockchip_timer.c:156:13: error: 'NO_IRQ' undeclared

I think the NO_IRQ definition is missing for ARM64.

Quoted 7 lines
Quoted 1 line

Yep, Maybe better to compatible if we don't use the 'NO_IRQ',

Hmm, after digging into drivers/of/irq.c and kernel/irq/irqdomain.c

when there is an error it returns zero. So NO_IRQ and -1 are not correct and on the other side zero can be a valid irq. That sounds a little bit fuzzy to me.

I believe the 'NO_IRQ' is better select if 'NO_IRQ' is defined on ARM64 platform.

    irq = irq_of_parse_and_map(np, 0);
Quoted 8 lines
Quoted 3 lines
    if (irq  == NO_IRQ)

...
Also, that's ok if we instead of the 'irq < 0' or '!irq' , right?

Hi Caesar,

so regarding Thomas and Russel answers, let's replace NO_IRQ by '!irq'.

                                ^

Definitely in this case. irq_create_of_mapping() and therefore irq_of_parse_and_map() both return _zero_ when they fail, not whatever happens to be NO_IRQ on a particular architecture. New code should _never_ be making any use of NO_IRQ.

That's why I said:

"Modern drivers should _all_ be using !irq to detect invalid IRQs, and not using NO_IRQ."

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#14 lore raw

PATCH 2/3 arm64: Enable the timer on Rockchip architecture

In reply to Caesar Wang

On the RK3368 SoC, support the APB timers for rockchip platform.

---

 arch/arm64/Kconfig.platforms | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/Kconfig.platforms +1 -0
index 23800a1..0dae08d 100644
@@ -57,6 +57,7 @@ config ARCH_ROCKCHIP
 	select ARCH_REQUIRE_GPIOLIB
 	select PINCTRL
 	select PINCTRL_ROCKCHIP
+	select ROCKCHIP_TIMER
 	help
 	  This enables support for the ARMv8 based Rockchip chipsets,
 	  like the RK3368.
Signature · 1 line
1.9.1
#15 lore raw

PATCH 3/3 arm64: dts: rockchip: Add the needed timer for rk3368 SoC

In reply to Caesar Wang

There is a need of a broadcast timer in this case to ensure proper wakeup when the cpus are in sleep mode and a timer expires.

---

 arch/arm64/boot/dts/rockchip/rk3368.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/rockchip/rk3368.dtsi +6 -0
index a712bea..99edbaa 100644
@@ -214,6 +214,12 @@
 			(GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
+	timer at ff810000 {
+		compatible = "rockchip,rk3288-timer";
+		reg = <0x0 0xff810000 0x0 0x20>;
+		interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
 	xin24m: oscillator {
 		compatible = "fixed-clock";
 		clock-frequency = <24000000>;
Signature · 1 line
1.9.1
maintainer
#16 lore raw

Re: [PATCH 3/3] arm64: dts: rockchip: Add the needed timer for rk3368 SoC

Am Donnerstag, 17. September 2015, 15:51:12 schrieb Caesar Wang:

Quoted 14 lines

There is a need of a broadcast timer in this case to ensure proper wakeup when the cpus are in sleep mode and a timer expires.

---

 arch/arm64/boot/dts/rockchip/rk3368.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/rockchip/rk3368.dtsi index a712bea..99edbaa 100644

arch/arm64/boot/dts/rockchip/rk3368.dtsi line 218

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3368.dtsi +2 -0
@@ -214,6 +214,12 @@
 			(GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
+	timer at ff810000 {
+		compatible = "rockchip,rk3288-timer";

you probably want a

		compatible = "rockchip,rk3368-timer", "rockchip,rk3288-timer";
Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3368.dtsi +4 -0
+		reg = <0x0 0xff810000 0x0 0x20>;
+		interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
 	xin24m: oscillator {
 		compatible = "fixed-clock";
 		clock-frequency = <24000000>;
#17 lore raw

Re: [PATCH 3/3] arm64: dts: rockchip: Add the needed timer for rk3368 SoC

? 2015?09?18? 03:01, Heiko St?bner ??:

Quoted 18 lines

Am Donnerstag, 17. September 2015, 15:51:12 schrieb Caesar Wang:

Quoted 17 lines

There is a need of a broadcast timer in this case to ensure proper wakeup when the cpus are in sleep mode and a timer expires.

---

  arch/arm64/boot/dts/rockchip/rk3368.dtsi | 6 ++++++
  1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/rockchip/rk3368.dtsi index a712bea..99edbaa 100644

arch/arm64/boot/dts/rockchip/rk3368.dtsi +0 -0
@@ -214,6 +214,12 @@
  			(GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
  	};
 
Quoted 4 lines

arch/arm64/boot/dts/rockchip/rk3368.dtsi line 218

Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3368.dtsi +2 -0
+	timer at ff810000 {
+		compatible = "rockchip,rk3288-timer";

you probably want a

		compatible = "rockchip,rk3368-timer", "rockchip,rk3288-timer";

Done.

More consideration for the future.
Although the "rk3288-timer" is working for 3368, agreed to add the 'rk3368-timer' for the rk3368-spec timer in the future.

Quoted 15 lines
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3368.dtsi +4 -0
+		reg = <0x0 0xff810000 0x0 0x20>;
+		interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
  	xin24m: oscillator {
  		compatible = "fixed-clock";
  		clock-frequency = <24000000>;
Signature · 2 lines
Thanks,
Caesar