mbox series

[00/14] Canaan devicetree fixes

Message ID 20220618123035.563070-1-mail@conchuod.ie
Headers show
Series Canaan devicetree fixes | expand

Message

Conor Dooley June 18, 2022, 12:30 p.m. UTC
From: Conor Dooley <conor.dooley@microchip.com>

Hey all,
This series should rid us of dtbs_check errors for the RISC-V Canaan k210
based boards (well, unless you enable W=1 but that's another days work).
I *DO NOT* have any Canaan hardware so I have not tested any of this in
anger. I based the series on next-20220617.

For the bindings, I am never sure about which of {unevaluated,additional}
Properties is correct to use, but the if statements in the binding didn't
work with additional so I used unevaluated...

@Mark, for your two bindings I was not sure about the properties that I
made depend on the compatible, but I looked in tree and was not able to
find other users to contradict what's in the Canaan devicetrees nor did
I get that much help from their docs.

@Rob, yesterday's removal of ilitek,ili9341.txt is moved to ths series
since I was editing the dt-schema binding here anyway.

Finally, @Palmer:
This + Atul's stuff + the sifive dts watchdog patch will get us sorted
in terms of dtbs_check errors. To make keeping it that way a little
easier, I changed the Canaan devicetree Makefile so that it would build
all of the devicetrees in the directory if SOC_CANAAN. Hopefully someone
with a device can test it - but my build log *looked* fine but that's
not exactly sufficient.

Thanks,
Conor.

Conor Dooley (14):
  dt-bindings: display: convert ilitek,ili9341.txt to dt-schema
  dt-bindings: display: panel: allow ilitek,ili9341 in isolation
  ASoC: dt-bindings: convert designware-i2s to dt-schema
  dt-bindings: dma: add Canaan k210 to Synopsys DesignWare DMA
  dt-bindings: timer: add Canaan k210 to Synopsys DesignWare timer
  spi: dt-bindings: dw-apb-ssi: update spi-{r,t}x-bus-width for dwc-ssi
  riscv: dts: canaan: fix the k210's memory node
  riscv: dts: canaan: add a specific compatible for k210's dma
  riscv: dts: canaan: add a specific compatible for k210's timers
  riscv: dts: canaan: fix mmc node names
  riscv: dts: canaan: fix kd233 display spi frequency
  riscv: dts: canaan: use custom compatible for k210 i2s
  riscv: dts: canaan: remove spi-max-frequency from controllers
  riscv: dts: canaan: build all devicetress if SOC_CANAAN

 .../bindings/display/ilitek,ili9341.txt       | 27 ------
 .../display/panel/ilitek,ili9341.yaml         | 60 ++++++++----
 .../bindings/dma/snps,dw-axi-dmac.yaml        | 35 +++++--
 .../bindings/sound/designware-i2s.txt         | 35 -------
 .../bindings/sound/snps,designware-i2s.yaml   | 93 +++++++++++++++++++
 .../bindings/spi/snps,dw-apb-ssi.yaml         | 48 +++++++---
 .../bindings/timer/snps,dw-apb-timer.yaml     | 28 ++++--
 arch/riscv/boot/dts/canaan/Makefile           | 10 +-
 arch/riscv/boot/dts/canaan/canaan_kd233.dts   |  4 +-
 arch/riscv/boot/dts/canaan/k210.dtsi          | 25 ++---
 .../riscv/boot/dts/canaan/sipeed_maix_bit.dts |  2 +-
 .../boot/dts/canaan/sipeed_maix_dock.dts      |  2 +-
 arch/riscv/boot/dts/canaan/sipeed_maix_go.dts |  2 +-
 .../boot/dts/canaan/sipeed_maixduino.dts      |  2 +-
 14 files changed, 239 insertions(+), 134 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/display/ilitek,ili9341.txt
 delete mode 100644 Documentation/devicetree/bindings/sound/designware-i2s.txt
 create mode 100644 Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml


base-commit: 07dc787be2316e243a16a33d0a9b734cd9365bd3

Comments

Conor Dooley June 18, 2022, 12:35 p.m. UTC | #1
On 18/06/2022 13:30, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> The k210 memory node has a compatible string that does not match with
> any driver or dt-binding & has several non standard properties.
> Replace the reg names with a comment and delete the rest.

Gah, should've fixed that during rebase.
I'm sure there'll need to be (at least) a v2 & I'll wait rather
than resend.
Thanks,
Conor.

> 
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> ---
>  arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
> index 44d338514761..287ea6eebe47 100644
> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>  
>  	sram: memory@80000000 {
>  		device_type = "memory";
> -		compatible = "canaan,k210-sram";
>  		reg = <0x80000000 0x400000>,
>  		      <0x80400000 0x200000>,
>  		      <0x80600000 0x200000>;
> -		reg-names = "sram0", "sram1", "aisram";
> -		clocks = <&sysclk K210_CLK_SRAM0>,
> -			 <&sysclk K210_CLK_SRAM1>,
> -			 <&sysclk K210_CLK_AI>;
> -		clock-names = "sram0", "sram1", "aisram";
>  	};
>  
>  	clocks {
Damien Le Moal June 19, 2022, 11:38 p.m. UTC | #2
On 6/18/22 21:30, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> The k210 memory node has a compatible string that does not match with
> any driver or dt-binding & has several non standard properties.
> Replace the reg names with a comment and delete the rest.
> 
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> ---
>  arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
> index 44d338514761..287ea6eebe47 100644
> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>  
>  	sram: memory@80000000 {
>  		device_type = "memory";
> -		compatible = "canaan,k210-sram";
>  		reg = <0x80000000 0x400000>,
>  		      <0x80400000 0x200000>,
>  		      <0x80600000 0x200000>;
> -		reg-names = "sram0", "sram1", "aisram";
> -		clocks = <&sysclk K210_CLK_SRAM0>,
> -			 <&sysclk K210_CLK_SRAM1>,
> -			 <&sysclk K210_CLK_AI>;
> -		clock-names = "sram0", "sram1", "aisram";
>  	};

These are used by u-boot to setup the memory clocks and initialize the
aisram. Sure the kernel actually does not use this, but to be in sync with
u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
kernel work fine with both u-boot internal DT and the kernel DT.
Conor Dooley June 19, 2022, 11:54 p.m. UTC | #3
On 20/06/2022 00:38, Damien Le Moal wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 6/18/22 21:30, Conor Dooley wrote:
>> From: Conor Dooley <conor.dooley@microchip.com>
>>
>> The k210 memory node has a compatible string that does not match with
>> any driver or dt-binding & has several non standard properties.
>> Replace the reg names with a comment and delete the rest.
>>
>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>> ---
>> ---
>>  arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>  1 file changed, 6 deletions(-)
>>
>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>> index 44d338514761..287ea6eebe47 100644
>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>
>>       sram: memory@80000000 {
>>               device_type = "memory";
>> -             compatible = "canaan,k210-sram";
>>               reg = <0x80000000 0x400000>,
>>                     <0x80400000 0x200000>,
>>                     <0x80600000 0x200000>;
>> -             reg-names = "sram0", "sram1", "aisram";
>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>> -                      <&sysclk K210_CLK_SRAM1>,
>> -                      <&sysclk K210_CLK_AI>;
>> -             clock-names = "sram0", "sram1", "aisram";
>>       };
> 
> These are used by u-boot to setup the memory clocks and initialize the
> aisram. Sure the kernel actually does not use this, but to be in sync with
> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
> kernel work fine with both u-boot internal DT and the kernel DT.

Right, but unfortunately that desire alone doesn't do anything about
the dtbs_check complaints.

I guess the alternative approach of actually documenting the compatible
would be more palatable?

Thanks,
Conor.
Damien Le Moal June 20, 2022, 12:25 a.m. UTC | #4
On 6/20/22 08:54, Conor.Dooley@microchip.com wrote:
> On 20/06/2022 00:38, Damien Le Moal wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> On 6/18/22 21:30, Conor Dooley wrote:
>>> From: Conor Dooley <conor.dooley@microchip.com>
>>>
>>> The k210 memory node has a compatible string that does not match with
>>> any driver or dt-binding & has several non standard properties.
>>> Replace the reg names with a comment and delete the rest.
>>>
>>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>>> ---
>>> ---
>>>  arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>>  1 file changed, 6 deletions(-)
>>>
>>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>>> index 44d338514761..287ea6eebe47 100644
>>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>>
>>>       sram: memory@80000000 {
>>>               device_type = "memory";
>>> -             compatible = "canaan,k210-sram";
>>>               reg = <0x80000000 0x400000>,
>>>                     <0x80400000 0x200000>,
>>>                     <0x80600000 0x200000>;
>>> -             reg-names = "sram0", "sram1", "aisram";
>>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>>> -                      <&sysclk K210_CLK_SRAM1>,
>>> -                      <&sysclk K210_CLK_AI>;
>>> -             clock-names = "sram0", "sram1", "aisram";
>>>       };
>>
>> These are used by u-boot to setup the memory clocks and initialize the
>> aisram. Sure the kernel actually does not use this, but to be in sync with
>> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
>> kernel work fine with both u-boot internal DT and the kernel DT.
> 
> Right, but unfortunately that desire alone doesn't do anything about
> the dtbs_check complaints.
> 
> I guess the alternative approach of actually documenting the compatible
> would be more palatable?

Yes, I think so. That would allow keeping the fields without the DTB build
warnings.

> 
> Thanks,
> Conor.
> 
> 
>
Conor Dooley June 21, 2022, 9:49 a.m. UTC | #5
On 20/06/2022 01:25, Damien Le Moal wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 6/20/22 08:54, Conor.Dooley@microchip.com wrote:
>> On 20/06/2022 00:38, Damien Le Moal wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On 6/18/22 21:30, Conor Dooley wrote:
>>>> From: Conor Dooley <conor.dooley@microchip.com>
>>>>
>>>> The k210 memory node has a compatible string that does not match with
>>>> any driver or dt-binding & has several non standard properties.
>>>> Replace the reg names with a comment and delete the rest.
>>>>
>>>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>>>> ---
>>>> ---
>>>>   arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>>>   1 file changed, 6 deletions(-)
>>>>
>>>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>> index 44d338514761..287ea6eebe47 100644
>>>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>>>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>>>
>>>>        sram: memory@80000000 {
>>>>                device_type = "memory";
>>>> -             compatible = "canaan,k210-sram";
>>>>                reg = <0x80000000 0x400000>,
>>>>                      <0x80400000 0x200000>,
>>>>                      <0x80600000 0x200000>;
>>>> -             reg-names = "sram0", "sram1", "aisram";
>>>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>>>> -                      <&sysclk K210_CLK_SRAM1>,
>>>> -                      <&sysclk K210_CLK_AI>;
>>>> -             clock-names = "sram0", "sram1", "aisram";
>>>>        };
>>>
>>> These are used by u-boot to setup the memory clocks and initialize the
>>> aisram. Sure the kernel actually does not use this, but to be in sync with
>>> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
>>> kernel work fine with both u-boot internal DT and the kernel DT.
>>
>> Right, but unfortunately that desire alone doesn't do anything about
>> the dtbs_check complaints.
>>
>> I guess the alternative approach of actually documenting the compatible
>> would be more palatable?
> 
> Yes, I think so. That would allow keeping the fields without the DTB build
> warnings.

Hmm looks like that approach contradicts the dt-schema;
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/memory.yaml

@Rob,Krzysztof what is one meant to do here?

Thanks,
Conor.
Krzysztof Kozlowski June 27, 2022, 6:55 a.m. UTC | #6
On 21/06/2022 11:49, Conor.Dooley@microchip.com wrote:
> On 20/06/2022 01:25, Damien Le Moal wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> On 6/20/22 08:54, Conor.Dooley@microchip.com wrote:
>>> On 20/06/2022 00:38, Damien Le Moal wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>
>>>> On 6/18/22 21:30, Conor Dooley wrote:
>>>>> From: Conor Dooley <conor.dooley@microchip.com>
>>>>>
>>>>> The k210 memory node has a compatible string that does not match with
>>>>> any driver or dt-binding & has several non standard properties.
>>>>> Replace the reg names with a comment and delete the rest.
>>>>>
>>>>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>>>>> ---
>>>>> ---
>>>>>   arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>>>>   1 file changed, 6 deletions(-)
>>>>>
>>>>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>> index 44d338514761..287ea6eebe47 100644
>>>>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>>>>
>>>>>        sram: memory@80000000 {
>>>>>                device_type = "memory";
>>>>> -             compatible = "canaan,k210-sram";
>>>>>                reg = <0x80000000 0x400000>,
>>>>>                      <0x80400000 0x200000>,
>>>>>                      <0x80600000 0x200000>;
>>>>> -             reg-names = "sram0", "sram1", "aisram";
>>>>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>>>>> -                      <&sysclk K210_CLK_SRAM1>,
>>>>> -                      <&sysclk K210_CLK_AI>;
>>>>> -             clock-names = "sram0", "sram1", "aisram";
>>>>>        };
>>>>
>>>> These are used by u-boot to setup the memory clocks and initialize the
>>>> aisram. Sure the kernel actually does not use this, but to be in sync with
>>>> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
>>>> kernel work fine with both u-boot internal DT and the kernel DT.
>>>
>>> Right, but unfortunately that desire alone doesn't do anything about
>>> the dtbs_check complaints.
>>>
>>> I guess the alternative approach of actually documenting the compatible
>>> would be more palatable?
>>
>> Yes, I think so. That would allow keeping the fields without the DTB build
>> warnings.
> 
> Hmm looks like that approach contradicts the dt-schema;
> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/memory.yaml
> 
> @Rob,Krzysztof what is one meant to do here?

Why do you think it contradict bindings? Bindings for memory allow
additional properties, so you just need to create binding for this one.
And make it a correct binding, IOW, be sure that these clocks are real etc.

Although usually we had separate bindings (and device drivers) for
memory controllers, instead of including them in the "memory" node.

Best regards,
Krzysztof
Conor Dooley June 27, 2022, 7:06 a.m. UTC | #7
On 27/06/2022 07:55, Krzysztof Kozlowski wrote:
> On 21/06/2022 11:49, Conor.Dooley@microchip.com wrote:
>> On 20/06/2022 01:25, Damien Le Moal wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On 6/20/22 08:54, Conor.Dooley@microchip.com wrote:
>>>> On 20/06/2022 00:38, Damien Le Moal wrote:
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> On 6/18/22 21:30, Conor Dooley wrote:
>>>>>> From: Conor Dooley <conor.dooley@microchip.com>
>>>>>>
>>>>>> The k210 memory node has a compatible string that does not match with
>>>>>> any driver or dt-binding & has several non standard properties.
>>>>>> Replace the reg names with a comment and delete the rest.
>>>>>>
>>>>>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>>>>>> ---
>>>>>> ---
>>>>>>    arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>>>>>    1 file changed, 6 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>> index 44d338514761..287ea6eebe47 100644
>>>>>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>>>>>
>>>>>>         sram: memory@80000000 {
>>>>>>                 device_type = "memory";
>>>>>> -             compatible = "canaan,k210-sram";
>>>>>>                 reg = <0x80000000 0x400000>,
>>>>>>                       <0x80400000 0x200000>,
>>>>>>                       <0x80600000 0x200000>;
>>>>>> -             reg-names = "sram0", "sram1", "aisram";
>>>>>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>>>>>> -                      <&sysclk K210_CLK_SRAM1>,
>>>>>> -                      <&sysclk K210_CLK_AI>;
>>>>>> -             clock-names = "sram0", "sram1", "aisram";
>>>>>>         };
>>>>>
>>>>> These are used by u-boot to setup the memory clocks and initialize the
>>>>> aisram. Sure the kernel actually does not use this, but to be in sync with
>>>>> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
>>>>> kernel work fine with both u-boot internal DT and the kernel DT.
>>>>
>>>> Right, but unfortunately that desire alone doesn't do anything about
>>>> the dtbs_check complaints.
>>>>
>>>> I guess the alternative approach of actually documenting the compatible
>>>> would be more palatable?
>>>
>>> Yes, I think so. That would allow keeping the fields without the DTB build
>>> warnings.
>>
>> Hmm looks like that approach contradicts the dt-schema;
>> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/memory.yaml
>>
>> @Rob,Krzysztof what is one meant to do here?
> 
> Why do you think it contradict bindings? Bindings for memory allow

Because when I tried to write the binding, the memory node complained
about the clock properties etc and referenced the dt-schema (which
for memory@foo nodes has additionalProperties: false.

> additional properties, so you just need to create binding for this one.
> And make it a correct binding, IOW, be sure that these clocks are real etc.
> 
> Although usually we had separate bindings (and device drivers) for
> memory controllers, instead of including them in the "memory" node.

I guess changing to that format would probably require some changes on
the U-Boot side of things. Taking "calxeda,hb-ddr-ctrl" as an example,
looks like the clocks etc go in a controller node, which seems like a
"better" way of doing it - but would break existing dts in U-Boot
without changes to handle both methods there.

Thanks,
Conor.
Krzysztof Kozlowski June 27, 2022, 9:24 a.m. UTC | #8
On 27/06/2022 09:06, Conor.Dooley@microchip.com wrote:
> 
> 
> On 27/06/2022 07:55, Krzysztof Kozlowski wrote:
>> On 21/06/2022 11:49, Conor.Dooley@microchip.com wrote:
>>> On 20/06/2022 01:25, Damien Le Moal wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>
>>>> On 6/20/22 08:54, Conor.Dooley@microchip.com wrote:
>>>>> On 20/06/2022 00:38, Damien Le Moal wrote:
>>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>>
>>>>>> On 6/18/22 21:30, Conor Dooley wrote:
>>>>>>> From: Conor Dooley <conor.dooley@microchip.com>
>>>>>>>
>>>>>>> The k210 memory node has a compatible string that does not match with
>>>>>>> any driver or dt-binding & has several non standard properties.
>>>>>>> Replace the reg names with a comment and delete the rest.
>>>>>>>
>>>>>>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>>>>>>> ---
>>>>>>> ---
>>>>>>>    arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>>>>>>    1 file changed, 6 deletions(-)
>>>>>>>
>>>>>>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>>> index 44d338514761..287ea6eebe47 100644
>>>>>>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>>>>>>
>>>>>>>         sram: memory@80000000 {
>>>>>>>                 device_type = "memory";
>>>>>>> -             compatible = "canaan,k210-sram";
>>>>>>>                 reg = <0x80000000 0x400000>,
>>>>>>>                       <0x80400000 0x200000>,
>>>>>>>                       <0x80600000 0x200000>;
>>>>>>> -             reg-names = "sram0", "sram1", "aisram";
>>>>>>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>>>>>>> -                      <&sysclk K210_CLK_SRAM1>,
>>>>>>> -                      <&sysclk K210_CLK_AI>;
>>>>>>> -             clock-names = "sram0", "sram1", "aisram";
>>>>>>>         };
>>>>>>
>>>>>> These are used by u-boot to setup the memory clocks and initialize the
>>>>>> aisram. Sure the kernel actually does not use this, but to be in sync with
>>>>>> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
>>>>>> kernel work fine with both u-boot internal DT and the kernel DT.
>>>>>
>>>>> Right, but unfortunately that desire alone doesn't do anything about
>>>>> the dtbs_check complaints.
>>>>>
>>>>> I guess the alternative approach of actually documenting the compatible
>>>>> would be more palatable?
>>>>
>>>> Yes, I think so. That would allow keeping the fields without the DTB build
>>>> warnings.
>>>
>>> Hmm looks like that approach contradicts the dt-schema;
>>> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/memory.yaml
>>>
>>> @Rob,Krzysztof what is one meant to do here?
>>
>> Why do you think it contradict bindings? Bindings for memory allow
> 
> Because when I tried to write the binding, the memory node complained
> about the clock properties etc and referenced the dt-schema (which
> for memory@foo nodes has additionalProperties: false.

Ah, I see, I looked at wrong level. Indeed memory node cannot have
anything else.

> 
>> additional properties, so you just need to create binding for this one.
>> And make it a correct binding, IOW, be sure that these clocks are real etc.
>>
>> Although usually we had separate bindings (and device drivers) for
>> memory controllers, instead of including them in the "memory" node.
> 
> I guess changing to that format would probably require some changes on
> the U-Boot side of things. Taking "calxeda,hb-ddr-ctrl" as an example,
> looks like the clocks etc go in a controller node, which seems like a
> "better" way of doing it - 

Yes, because I think memory node is kind of special. It describes the
physical memory layout for the system, not the memory controller or
memory characteristics (like timings).

What U-Boot needs is indeed memory controller node. It's not only
calxeda but also few others using JEDEC LPDDR bindings.

> but would break existing dts in U-Boot
> without changes to handle both methods there.

Yes, that's a bit inconvenient but also a price someone has to pay for
introducing DTS properties without bindings.

Best regards,
Krzysztof
Conor Dooley June 27, 2022, 11:03 a.m. UTC | #9
On 27/06/2022 10:24, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 27/06/2022 09:06, Conor.Dooley@microchip.com wrote:
>>
>>
>> On 27/06/2022 07:55, Krzysztof Kozlowski wrote:
>>> On 21/06/2022 11:49, Conor.Dooley@microchip.com wrote:
>>>> On 20/06/2022 01:25, Damien Le Moal wrote:
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> On 6/20/22 08:54, Conor.Dooley@microchip.com wrote:
>>>>>> On 20/06/2022 00:38, Damien Le Moal wrote:
>>>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>>>
>>>>>>> On 6/18/22 21:30, Conor Dooley wrote:
>>>>>>>> From: Conor Dooley <conor.dooley@microchip.com>
>>>>>>>>
>>>>>>>> The k210 memory node has a compatible string that does not match with
>>>>>>>> any driver or dt-binding & has several non standard properties.
>>>>>>>> Replace the reg names with a comment and delete the rest.
>>>>>>>>
>>>>>>>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>>>>>>>> ---
>>>>>>>> ---
>>>>>>>>     arch/riscv/boot/dts/canaan/k210.dtsi | 6 ------
>>>>>>>>     1 file changed, 6 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>>>> index 44d338514761..287ea6eebe47 100644
>>>>>>>> --- a/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>>>> +++ b/arch/riscv/boot/dts/canaan/k210.dtsi
>>>>>>>> @@ -69,15 +69,9 @@ cpu1_intc: interrupt-controller {
>>>>>>>>
>>>>>>>>          sram: memory@80000000 {
>>>>>>>>                  device_type = "memory";
>>>>>>>> -             compatible = "canaan,k210-sram";
>>>>>>>>                  reg = <0x80000000 0x400000>,
>>>>>>>>                        <0x80400000 0x200000>,
>>>>>>>>                        <0x80600000 0x200000>;
>>>>>>>> -             reg-names = "sram0", "sram1", "aisram";
>>>>>>>> -             clocks = <&sysclk K210_CLK_SRAM0>,
>>>>>>>> -                      <&sysclk K210_CLK_SRAM1>,
>>>>>>>> -                      <&sysclk K210_CLK_AI>;
>>>>>>>> -             clock-names = "sram0", "sram1", "aisram";
>>>>>>>>          };
>>>>>>>
>>>>>>> These are used by u-boot to setup the memory clocks and initialize the
>>>>>>> aisram. Sure the kernel actually does not use this, but to be in sync with
>>>>>>> u-boot DT, I would prefer keeping this as is. Right now, u-boot *and* the
>>>>>>> kernel work fine with both u-boot internal DT and the kernel DT.
>>>>>>
>>>>>> Right, but unfortunately that desire alone doesn't do anything about
>>>>>> the dtbs_check complaints.
>>>>>>
>>>>>> I guess the alternative approach of actually documenting the compatible
>>>>>> would be more palatable?
>>>>>
>>>>> Yes, I think so. That would allow keeping the fields without the DTB build
>>>>> warnings.
>>>>
>>>> Hmm looks like that approach contradicts the dt-schema;
>>>> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/memory.yaml
>>>>
>>>> @Rob,Krzysztof what is one meant to do here?
>>>
>>> Why do you think it contradict bindings? Bindings for memory allow
>>
>> Because when I tried to write the binding, the memory node complained
>> about the clock properties etc and referenced the dt-schema (which
>> for memory@foo nodes has additionalProperties: false.
> 
> Ah, I see, I looked at wrong level. Indeed memory node cannot have
> anything else.
> 
>>
>>> additional properties, so you just need to create binding for this one.
>>> And make it a correct binding, IOW, be sure that these clocks are real etc.
>>>
>>> Although usually we had separate bindings (and device drivers) for
>>> memory controllers, instead of including them in the "memory" node.
>>
>> I guess changing to that format would probably require some changes on
>> the U-Boot side of things. Taking "calxeda,hb-ddr-ctrl" as an example,
>> looks like the clocks etc go in a controller node, which seems like a
>> "better" way of doing it -
> 
> Yes, because I think memory node is kind of special. It describes the
> physical memory layout for the system, not the memory controller or
> memory characteristics (like timings).
> 
> What U-Boot needs is indeed memory controller node. It's not only
> calxeda but also few others using JEDEC LPDDR bindings.
> 
>> but would break existing dts in U-Boot
>> without changes to handle both methods there.
> 
> Yes, that's a bit inconvenient but also a price someone has to pay for
> introducing DTS properties without bindings.
> 

Alright so, I'll make it a memory controller and conjure up a v2.
As always, thanks for your help Krzysztof!