diff mbox series

[v2,6/7] riscv: Update Kendryte device tree for new CLINT driver

Message ID 20200729095636.1077054-7-seanga2@gmail.com
State Superseded
Delegated to: Andes
Headers show
Series riscv: Clean up timer drivers | expand

Commit Message

Sean Anderson July 29, 2020, 9:56 a.m. UTC
AFAIK because the K210 clock driver does not come up until after
relocation, the clint will always use the clock-frequency parameter.
Ideally, it should update itself after relocation to take into account the
actual CPU frequency.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- New

 arch/riscv/dts/k210.dtsi | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Bin Meng Aug. 20, 2020, 7:45 a.m. UTC | #1
On Wed, Jul 29, 2020 at 5:57 PM Sean Anderson <seanga2@gmail.com> wrote:
>
> AFAIK because the K210 clock driver does not come up until after
> relocation, the clint will always use the clock-frequency parameter.
> Ideally, it should update itself after relocation to take into account the
> actual CPU frequency.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
> Changes in v2:
> - New
>
>  arch/riscv/dts/k210.dtsi | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/dts/k210.dtsi b/arch/riscv/dts/k210.dtsi
> index 2546c7d4e0..2698a33a5c 100644
> --- a/arch/riscv/dts/k210.dtsi
> +++ b/arch/riscv/dts/k210.dtsi
> @@ -17,6 +17,8 @@
>         compatible = "kendryte,k210";
>
>         aliases {
> +               cpu0 = &cpu0;
> +               cpu1 = &cpu1;
>                 dma0 = &dmac0;
>                 gpio0 = &gpio0;
>                 gpio1 = &gpio1_0;
> @@ -126,14 +128,15 @@
>                         read-only;
>                 };
>
> -               clint0: interrupt-controller@2000000 {
> +               clint0: clint@2000000 {
>                         #interrupt-cells = <1>;
>                         compatible = "kendryte,k210-clint", "riscv,clint0";
>                         reg = <0x2000000 0xC000>;
> -                       interrupt-controller;

Why is this property dropped?

>                         interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>,
>                                               <&cpu1_intc 3>, <&cpu1_intc 7>;
> -                       clocks = <&sysclk K210_CLK_CPU>;
> +                       clocks = <&sysclk K210_CLK_CLINT>;
> +                       /* sysclk is only available post-relocation */
> +                       clock-frequency = <7800000>;
>                 };
>
>                 plic0: interrupt-controller@C000000 {
> --

Regards,
Bin
Sean Anderson Aug. 20, 2020, 10:05 a.m. UTC | #2
On 8/20/20 3:45 AM, Bin Meng wrote:
> On Wed, Jul 29, 2020 at 5:57 PM Sean Anderson <seanga2@gmail.com> wrote:
>>
>> AFAIK because the K210 clock driver does not come up until after
>> relocation, the clint will always use the clock-frequency parameter.
>> Ideally, it should update itself after relocation to take into account the
>> actual CPU frequency.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> Changes in v2:
>> - New
>>
>>  arch/riscv/dts/k210.dtsi | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/riscv/dts/k210.dtsi b/arch/riscv/dts/k210.dtsi
>> index 2546c7d4e0..2698a33a5c 100644
>> --- a/arch/riscv/dts/k210.dtsi
>> +++ b/arch/riscv/dts/k210.dtsi
>> @@ -17,6 +17,8 @@
>>         compatible = "kendryte,k210";
>>
>>         aliases {
>> +               cpu0 = &cpu0;
>> +               cpu1 = &cpu1;
>>                 dma0 = &dmac0;
>>                 gpio0 = &gpio0;
>>                 gpio1 = &gpio1_0;
>> @@ -126,14 +128,15 @@
>>                         read-only;
>>                 };
>>
>> -               clint0: interrupt-controller@2000000 {
>> +               clint0: clint@2000000 {
>>                         #interrupt-cells = <1>;
>>                         compatible = "kendryte,k210-clint", "riscv,clint0";
>>                         reg = <0x2000000 0xC000>;
>> -                       interrupt-controller;
> 
> Why is this property dropped?

Because the clint is not an interrupt-controller. That is, no other
devices have an interrupt which is controlled by the clint.

> 
>>                         interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>,
>>                                               <&cpu1_intc 3>, <&cpu1_intc 7>;
>> -                       clocks = <&sysclk K210_CLK_CPU>;
>> +                       clocks = <&sysclk K210_CLK_CLINT>;
>> +                       /* sysclk is only available post-relocation */
>> +                       clock-frequency = <7800000>;
>>                 };
>>
>>                 plic0: interrupt-controller@C000000 {
>> --
> 
> Regards,
> Bin
>
diff mbox series

Patch

diff --git a/arch/riscv/dts/k210.dtsi b/arch/riscv/dts/k210.dtsi
index 2546c7d4e0..2698a33a5c 100644
--- a/arch/riscv/dts/k210.dtsi
+++ b/arch/riscv/dts/k210.dtsi
@@ -17,6 +17,8 @@ 
 	compatible = "kendryte,k210";
 
 	aliases {
+		cpu0 = &cpu0;
+		cpu1 = &cpu1;
 		dma0 = &dmac0;
 		gpio0 = &gpio0;
 		gpio1 = &gpio1_0;
@@ -126,14 +128,15 @@ 
 			read-only;
 		};
 
-		clint0: interrupt-controller@2000000 {
+		clint0: clint@2000000 {
 			#interrupt-cells = <1>;
 			compatible = "kendryte,k210-clint", "riscv,clint0";
 			reg = <0x2000000 0xC000>;
-			interrupt-controller;
 			interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>,
 					      <&cpu1_intc 3>, <&cpu1_intc 7>;
-			clocks = <&sysclk K210_CLK_CPU>;
+			clocks = <&sysclk K210_CLK_CLINT>;
+			/* sysclk is only available post-relocation */
+			clock-frequency = <7800000>;
 		};
 
 		plic0: interrupt-controller@C000000 {