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 19, 2022, 11:54 p.m. UTC | #1
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.
Rob Herring June 27, 2022, 11:22 p.m. UTC | #2
On Sat, Jun 18, 2022 at 01:30:25PM +0100, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> Convert the Synopsys DesignWare I2S controller binding to dt-schema.
> There was no listed maintainer but Jose Abreu was the last editor of the
> txt binding so add him as maintainer.
> 
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>  .../bindings/sound/designware-i2s.txt         | 35 -------
>  .../bindings/sound/snps,designware-i2s.yaml   | 93 +++++++++++++++++++
>  2 files changed, 93 insertions(+), 35 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/sound/designware-i2s.txt
>  create mode 100644 Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml
> 
> diff --git a/Documentation/devicetree/bindings/sound/designware-i2s.txt b/Documentation/devicetree/bindings/sound/designware-i2s.txt
> deleted file mode 100644
> index 6a536d570e29..000000000000
> --- a/Documentation/devicetree/bindings/sound/designware-i2s.txt
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -DesignWare I2S controller
> -
> -Required properties:
> - - compatible : Must be "snps,designware-i2s"
> - - reg : Must contain the I2S core's registers location and length
> - - clocks : Pairs of phandle and specifier referencing the controller's
> -   clocks. The controller expects one clock: the clock used as the sampling
> -   rate reference clock sample.
> - - clock-names : "i2sclk" for the sample rate reference clock.
> - - dmas: Pairs of phandle and specifier for the DMA channels that are used by
> -   the core. The core expects one or two dma channels: one for transmit and
> -   one for receive.
> - - dma-names : "tx" for the transmit channel, "rx" for the receive channel.
> -
> -Optional properties:
> - - interrupts: The interrupt line number for the I2S controller. Add this
> -   parameter if the I2S controller that you are using does not support DMA.
> -
> -For more details on the 'dma', 'dma-names', 'clock' and 'clock-names'
> -properties please check:
> -	* resource-names.txt
> -	* clock/clock-bindings.txt
> -	* dma/dma.txt
> -
> -Example:
> -
> -	soc_i2s: i2s@7ff90000 {
> -		compatible = "snps,designware-i2s";
> -		reg = <0x0 0x7ff90000 0x0 0x1000>;
> -		clocks = <&scpi_i2sclk 0>;
> -		clock-names = "i2sclk";
> -		#sound-dai-cells = <0>;
> -		dmas = <&dma0 5>;
> -		dma-names = "tx";
> -	};
> diff --git a/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml b/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml
> new file mode 100644
> index 000000000000..5ac9c00157bf
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml
> @@ -0,0 +1,93 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/snps,designware-i2s.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: DesignWare I2S controller
> +
> +maintainers:
> +  - Jose Abreu <joabreu@synopsys.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - const: canaan,k210-i2s
> +          - const: snps,designware-i2s
> +      - enum:
> +          - snps,designware-i2s
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    description: |
> +      The interrupt line number for the I2S controller. Add this
> +      parameter if the I2S controller that you are using does not
> +      support DMA.
> +    maxItems: 1
> +
> +  clocks:
> +    description: Sampling rate reference clock

How many?

> +
> +  clock-names:
> +    const: i2sclk
> +
> +  resets:
> +    maxItems: 1
> +
> +  dmas:
> +    items:
> +      - description: TX DMA Channel
> +      - description: RX DMA Channel
> +    minItems: 1
> +
> +  dma-names:
> +    items:
> +      - const: tx
> +      - const: rx
> +    minItems: 1
> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        const: canaan,k210-i2s
> +
> +then:
> +  properties:
> +    "#sound-dai-cells":
> +      const: 1
> +
> +else:
> +  properties:
> +    "#sound-dai-cells":
> +      const: 0
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +
> +oneOf:
> +  - required:
> +      - dmas
> +      - dma-names
> +  - required:
> +      - interrupts
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    soc_i2s: i2s@7ff90000 {
> +      compatible = "snps,designware-i2s";
> +      reg = <0x7ff90000 0x1000>;
> +      clocks = <&scpi_i2sclk 0>;
> +      clock-names = "i2sclk";
> +      #sound-dai-cells = <0>;
> +      dmas = <&dma0 5>;
> +      dma-names = "tx";
> +    };
> -- 
> 2.36.1
> 
>
Rob Herring June 27, 2022, 11:30 p.m. UTC | #3
On Sat, Jun 18, 2022 at 01:30:27PM +0100, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> The Canaan k210 apparently has a Sysnopsys Designware timer but
> according to the documentation & devicetree it has 2 interrupts rather
> than the standard one. Add a custom compatible that supports the 2
> interrupt configuration and falls back to the standard binding (which
> is currently the one in use in the devicetree entry).
> 
> Link: https://canaan-creative.com/wp-content/uploads/2020/03/kendryte_standalone_programming_guide_20190311144158_en.pdf #Page 58
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>  .../bindings/timer/snps,dw-apb-timer.yaml     | 28 +++++++++++++++----
>  1 file changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml b/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml
> index d33c9205a909..9a76acc7a66f 100644
> --- a/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml
> +++ b/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml
> @@ -12,6 +12,9 @@ maintainers:
>  properties:
>    compatible:
>      oneOf:
> +      - items:
> +          - const: canaan,k210-apb-timer
> +          - const: snps,dw-apb-timer
>        - const: snps,dw-apb-timer
>        - enum:
>            - snps,dw-apb-timer-sp
> @@ -21,9 +24,6 @@ properties:
>    reg:
>      maxItems: 1
>  
> -  interrupts:
> -    maxItems: 1
> -
>    resets:
>      maxItems: 1
>  
> @@ -41,7 +41,23 @@ properties:
>  
>    clock-frequency: true
>  
> -additionalProperties: false
> +unevaluatedProperties: false
> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        const: canaan,k210-apb-timer
> +
> +then:
> +  properties:
> +    interrupts:
> +      maxItems: 2

When more than 1, you need to define what they are and the order.

> +
> +else:
> +  properties:
> +    interrupts:
> +      maxItems: 1
>  
>  required:
>    - compatible
> @@ -60,8 +76,8 @@ oneOf:
>  examples:
>    - |
>      timer@ffe00000 {
> -      compatible = "snps,dw-apb-timer";
> -      interrupts = <0 170 4>;
> +      compatible = "canaan,k210-apb-timer", "snps,dw-apb-timer";
> +      interrupts = <0 170 4>, <0 170 4>;
>        reg = <0xffe00000 0x1000>;
>        clocks = <&timer_clk>, <&timer_pclk>;
>        clock-names = "timer", "pclk";
> -- 
> 2.36.1
> 
>