RISC-V: Canaan devicetree fixes
authorPalmer Dabbelt <palmer@rivosinc.com>
Wed, 10 Aug 2022 21:33:45 +0000 (14:33 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 10 Aug 2022 21:43:14 +0000 (14:43 -0700)
This series should rid us of dtbs_check errors for the RISC-V Canaan
k210 based boards. 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.

Link: https://lore.kernel.org/all/mhng-85044754-c361-40bc-a6a2-7082f35930bb@palmer-ri-x1c9/
* remotes/palmer/riscv-canaan_dt_schema:
  riscv: dts: canaan: build all devicetress if SOC_CANAAN
  riscv: dts: canaan: add specific compatible for kd233's LCD
  riscv: dts: canaan: fix bus {ranges,reg} warnings
  riscv: dts: canaan: remove spi-max-frequency from controllers
  riscv: dts: canaan: use custom compatible for k210 i2s
  riscv: dts: canaan: fix kd233 display spi frequency
  riscv: dts: canaan: fix mmc node names
  riscv: dts: canaan: fix the k210's timer nodes
  riscv: dts: canaan: fix the k210's memory node
  dt-bindings: memory-controllers: add canaan k210 sram controller
  dt-bindings: display: ili9341: document canaan kd233's lcd
  dt-bindings: display: convert ilitek,ili9341.txt to dt-schema

Documentation/devicetree/bindings/display/ilitek,ili9341.txt [deleted file]
Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
Documentation/devicetree/bindings/memory-controllers/canaan,k210-sram.yaml [new file with mode: 0644]
arch/riscv/boot/dts/canaan/Makefile
arch/riscv/boot/dts/canaan/canaan_kd233.dts
arch/riscv/boot/dts/canaan/k210.dtsi
arch/riscv/boot/dts/canaan/sipeed_maix_bit.dts
arch/riscv/boot/dts/canaan/sipeed_maix_dock.dts
arch/riscv/boot/dts/canaan/sipeed_maix_go.dts
arch/riscv/boot/dts/canaan/sipeed_maixduino.dts

diff --git a/Documentation/devicetree/bindings/display/ilitek,ili9341.txt b/Documentation/devicetree/bindings/display/ilitek,ili9341.txt
deleted file mode 100644 (file)
index 169b32e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-Ilitek ILI9341 display panels
-
-This binding is for display panels using an Ilitek ILI9341 controller in SPI
-mode.
-
-Required properties:
-- compatible:  "adafruit,yx240qv29", "ilitek,ili9341"
-- dc-gpios:    D/C pin
-- reset-gpios: Reset pin
-
-The node for this driver must be a child node of a SPI controller, hence
-all mandatory properties described in ../spi/spi-bus.txt must be specified.
-
-Optional properties:
-- rotation:    panel rotation in degrees counter clockwise (0,90,180,270)
-- backlight:   phandle of the backlight device attached to the panel
-
-Example:
-       display@0{
-               compatible = "adafruit,yx240qv29", "ilitek,ili9341";
-               reg = <0>;
-               spi-max-frequency = <32000000>;
-               dc-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
-               reset-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
-               rotation = <270>;
-               backlight = <&backlight>;
-       };
index 6058948a976497cbff0876faed17bb635a836626..99e0cb9440cf255a2a0d7c3255a8253c4b190849 100644 (file)
@@ -21,8 +21,10 @@ properties:
   compatible:
     items:
       - enum:
+          - adafruit,yx240qv29
           # ili9341 240*320 Color on stm32f429-disco board
           - st,sf-tc240t-9370-t
+          - canaan,kd233-tft
       - const: ilitek,ili9341
 
   reg: true
@@ -47,31 +49,50 @@ properties:
   vddi-led-supply:
     description: Voltage supply for the LED driver (1.65 .. 3.3 V)
 
-additionalProperties: false
+unevaluatedProperties: false
 
 required:
   - compatible
   - reg
   - dc-gpios
-  - port
+
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - st,sf-tc240t-9370-t
+then:
+  required:
+    - port
 
 examples:
   - |+
+    #include <dt-bindings/gpio/gpio.h>
     spi {
         #address-cells = <1>;
         #size-cells = <0>;
         panel: display@0 {
-                 compatible = "st,sf-tc240t-9370-t",
-                              "ilitek,ili9341";
-                 reg = <0>;
-                 spi-3wire;
-                 spi-max-frequency = <10000000>;
-                 dc-gpios = <&gpiod 13 0>;
-                 port {
-                         panel_in: endpoint {
-                           remote-endpoint = <&display_out>;
-                      };
-                 };
-             };
+            compatible = "st,sf-tc240t-9370-t",
+                         "ilitek,ili9341";
+            reg = <0>;
+            spi-3wire;
+            spi-max-frequency = <10000000>;
+            dc-gpios = <&gpiod 13 0>;
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&display_out>;
+                };
+            };
+        };
+        display@1{
+            compatible = "adafruit,yx240qv29", "ilitek,ili9341";
+            reg = <1>;
+            spi-max-frequency = <10000000>;
+            dc-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
+            reset-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
+            rotation = <270>;
+            backlight = <&backlight>;
         };
+    };
 ...
diff --git a/Documentation/devicetree/bindings/memory-controllers/canaan,k210-sram.yaml b/Documentation/devicetree/bindings/memory-controllers/canaan,k210-sram.yaml
new file mode 100644 (file)
index 0000000..f81fb86
--- /dev/null
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/memory-controllers/canaan,k210-sram.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Canaan K210 SRAM memory controller
+
+description:
+  The Canaan K210 SRAM memory controller is responsible for the system's 8 MiB
+  of SRAM. The controller is initialised by the bootloader, which configures
+  its clocks, before OS bringup.
+
+maintainers:
+  - Conor Dooley <conor@kernel.org>
+
+properties:
+  compatible:
+    enum:
+      - canaan,k210-sram
+
+  clocks:
+    minItems: 1
+    items:
+      - description: sram0 clock
+      - description: sram1 clock
+      - description: aisram clock
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: sram0
+      - const: sram1
+      - const: aisram
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/k210-clk.h>
+    memory-controller {
+        compatible = "canaan,k210-sram";
+        clocks = <&sysclk K210_CLK_SRAM0>,
+                 <&sysclk K210_CLK_SRAM1>,
+                 <&sysclk K210_CLK_AI>;
+        clock-names = "sram0", "sram1", "aisram";
+    };
index c61b08ac8554dcb5fb001ca34d1f8a80d06326da..befe4eb7527b8fff59c37121dfbbf8404c37d41d 100644 (file)
@@ -1,3 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb, $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))
-obj-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .o, $(dtb-y))
+dtb-$(CONFIG_SOC_CANAAN) += canaan_kd233.dtb
+dtb-$(CONFIG_SOC_CANAAN) += k210_generic.dtb
+dtb-$(CONFIG_SOC_CANAAN) += sipeed_maix_bit.dtb
+dtb-$(CONFIG_SOC_CANAAN) += sipeed_maix_dock.dtb
+dtb-$(CONFIG_SOC_CANAAN) += sipeed_maix_go.dtb
+dtb-$(CONFIG_SOC_CANAAN) += sipeed_maixduino.dtb
+
+obj-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb.o, $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))
index f72540bd14a3be3f05222d5f0bacc31b5f3f6f44..8df4cf3656f2c93249f0576fe6b10529b5ccd335 100644 (file)
        cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
 
        panel@0 {
-               compatible = "ilitek,ili9341";
+               compatible = "canaan,kd233-tft", "ilitek,ili9341";
                reg = <0>;
                dc-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
-               spi-max-frequency = <15000000>;
+               spi-max-frequency = <10000000>;
                status = "disabled";
        };
 };
        cs-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
        status = "okay";
 
-       slot@0 {
+       mmc@0 {
                compatible = "mmc-spi-slot";
                reg = <0>;
                voltage-ranges = <3300 3300>;
index ec944d1537dc40ea3e40ad5a1bd72c09a6a6992c..07e2e2649604640156aa61b6c7594b3c23e7a902 100644 (file)
 
        sram: memory@80000000 {
                device_type = "memory";
+               reg = <0x80000000 0x400000>, /* sram0 4 MiB */
+                     <0x80400000 0x200000>, /* sram1 2 MiB */
+                     <0x80600000 0x200000>; /* aisram 2 MiB */
+       };
+
+       sram_controller: memory-controller {
                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>;
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "simple-pm-bus";
-                       ranges;
+                       ranges = <0x50200000 0x50200000 0x200000>;
                        clocks = <&sysclk K210_CLK_APB0>;
 
                        gpio1: gpio@50200000 {
                        };
 
                        i2s0: i2s@50250000 {
-                               compatible = "snps,designware-i2s";
+                               compatible = "canaan,k210-i2s", "snps,designware-i2s";
                                reg = <0x50250000 0x200>;
                                interrupts = <5>;
                                clocks = <&sysclk K210_CLK_I2S0>;
                        };
 
                        i2s1: i2s@50260000 {
-                               compatible = "snps,designware-i2s";
+                               compatible = "canaan,k210-i2s", "snps,designware-i2s";
                                reg = <0x50260000 0x200>;
                                interrupts = <6>;
                                clocks = <&sysclk K210_CLK_I2S1>;
                        };
 
                        i2s2: i2s@50270000 {
-                               compatible = "snps,designware-i2s";
+                               compatible = "canaan,k210-i2s", "snps,designware-i2s";
                                reg = <0x50270000 0x200>;
                                interrupts = <7>;
                                clocks = <&sysclk K210_CLK_I2S2>;
 
                        timer0: timer@502d0000 {
                                compatible = "snps,dw-apb-timer";
-                               reg = <0x502D0000 0x100>;
-                               interrupts = <14>, <15>;
+                               reg = <0x502D0000 0x14>;
+                               interrupts = <14>;
                                clocks = <&sysclk K210_CLK_TIMER0>,
                                         <&sysclk K210_CLK_APB0>;
                                clock-names = "timer", "pclk";
                                resets = <&sysrst K210_RST_TIMER0>;
                        };
 
-                       timer1: timer@502e0000 {
+                       timer1: timer@502d0014 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x502D0014 0x14>;
+                               interrupts = <15>;
+                               clocks = <&sysclk K210_CLK_TIMER0>,
+                                        <&sysclk K210_CLK_APB0>;
+                               clock-names = "timer", "pclk";
+                               resets = <&sysrst K210_RST_TIMER0>;
+                       };
+
+                       timer2: timer@502e0000 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x502E0000 0x14>;
+                               interrupts = <16>;
+                               clocks = <&sysclk K210_CLK_TIMER1>,
+                                        <&sysclk K210_CLK_APB0>;
+                               clock-names = "timer", "pclk";
+                               resets = <&sysrst K210_RST_TIMER1>;
+                       };
+
+                       timer3: timer@502e0014 {
                                compatible = "snps,dw-apb-timer";
-                               reg = <0x502E0000 0x100>;
-                               interrupts = <16>, <17>;
+                               reg = <0x502E0014 0x114>;
+                               interrupts = <17>;
                                clocks = <&sysclk K210_CLK_TIMER1>,
                                         <&sysclk K210_CLK_APB0>;
                                clock-names = "timer", "pclk";
                                resets = <&sysrst K210_RST_TIMER1>;
                        };
 
-                       timer2: timer@502f0000 {
+                       timer4: timer@502f0000 {
                                compatible = "snps,dw-apb-timer";
-                               reg = <0x502F0000 0x100>;
-                               interrupts = <18>, <19>;
+                               reg = <0x502F0000 0x14>;
+                               interrupts = <18>;
+                               clocks = <&sysclk K210_CLK_TIMER2>,
+                                        <&sysclk K210_CLK_APB0>;
+                               clock-names = "timer", "pclk";
+                               resets = <&sysrst K210_RST_TIMER2>;
+                       };
+
+                       timer5: timer@502f0014 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x502F0014 0x14>;
+                               interrupts = <19>;
                                clocks = <&sysclk K210_CLK_TIMER2>,
                                         <&sysclk K210_CLK_APB0>;
                                clock-names = "timer", "pclk";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "simple-pm-bus";
-                       ranges;
+                       ranges = <0x50400000 0x50400000 0x40100>;
                        clocks = <&sysclk K210_CLK_APB1>;
 
                        wdt0: watchdog@50400000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "simple-pm-bus";
-                       ranges;
+                       ranges = <0x52000000 0x52000000 0x2000200>;
                        clocks = <&sysclk K210_CLK_APB2>;
 
                        spi0: spi@52000000 {
                                clock-names = "ssi_clk", "pclk";
                                resets = <&sysrst K210_RST_SPI0>;
                                reset-names = "spi";
-                               spi-max-frequency = <25000000>;
                                num-cs = <4>;
                                reg-io-width = <4>;
                        };
                                clock-names = "ssi_clk", "pclk";
                                resets = <&sysrst K210_RST_SPI1>;
                                reset-names = "spi";
-                               spi-max-frequency = <25000000>;
                                num-cs = <4>;
                                reg-io-width = <4>;
                        };
                                clock-names = "ssi_clk", "pclk";
                                resets = <&sysrst K210_RST_SPI3>;
                                reset-names = "spi";
-                               /* Could possibly go up to 200 MHz */
-                               spi-max-frequency = <100000000>;
+
                                num-cs = <4>;
                                reg-io-width = <4>;
                        };
index 8abdbe26a1d098583f99b4e87116b5dbc6acf45b..6d25bf07481a6ed8ecbe74e10316825f630cc559 100644 (file)
        cs-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
        status = "okay";
 
-       slot@0 {
+       mmc@0 {
                compatible = "mmc-spi-slot";
                reg = <0>;
                voltage-ranges = <3300 3300>;
index 3c6df1ecf76fd7f3534fdc557837ffad5e2ad1f1..f4f4d8d5e8b88cad89664f6c6d4e105f97e44c92 100644 (file)
        cs-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
        status = "okay";
 
-       slot@0 {
+       mmc@0 {
                compatible = "mmc-spi-slot";
                reg = <0>;
                voltage-ranges = <3300 3300>;
index 03c9843d503e6fc23cd3196c82aae6a96164a543..0d86df47e1ed3987afd424db059ec5a271bf0fdf 100644 (file)
        cs-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
        status = "okay";
 
-       slot@0 {
+       mmc@0 {
                compatible = "mmc-spi-slot";
                reg = <0>;
                voltage-ranges = <3300 3300>;
index 7164ad06317812d7ee53fc81871345b98e69a77b..5c05c498e2b88bf4f6310b4168e47ef810f33745 100644 (file)
        cs-gpios = <&gpio1_0 2 GPIO_ACTIVE_LOW>;
        status = "okay";
 
-       slot@0 {
+       mmc@0 {
                compatible = "mmc-spi-slot";
                reg = <0>;
                voltage-ranges = <3300 3300>;