Message ID | 20210112005848.199951-4-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | RISC-V Kendryte K210 support improvements | expand |
On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: > Update the Canaan Kendryte K210 base device tree k210.dtsi to define > all peripherals of the SoC, their clocks and reset lines. The device > tree file k210.dts is renamed to k210_generic.dts and becomes the > default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE > configuration option. No device beside the serial console is defined by > this device tree. This makes this generic device tree suitable for use > with a builtin initramfs with all known K210 based boards. > > These changes result in the K210_CLK_ACLK clock ID to be unused and > removed from the dt-bindings k210-clk.h header file. > > Most updates to the k210.dtsi file come from Sean Anderson's work on > U-Boot support for the K210. > > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> > Reviewed-by: Anup Patel <anup@brainfault.org> > --- > arch/riscv/Kconfig.socs | 2 +- > arch/riscv/boot/dts/canaan/k210.dts | 23 - > arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- > arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ > include/dt-bindings/clock/k210-clk.h | 1 - > 5 files changed, 573 insertions(+), 50 deletions(-) > delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts > create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts [Snipping this to the relevant bits, in case you missed it before.] > @@ -81,40 +107,515 @@ in0: oscillator { > soc { > #address-cells = <1>; > #size-cells = <1>; > - compatible = "kendryte,k210-soc", "simple-bus"; > + compatible = "canaan,k210-soc", "simple-bus"; > ranges; > interrupt-parent = <&plic0>; > > - sysctl: sysctl@50440000 { > - compatible = "kendryte,k210-sysctl", "simple-mfd"; > - reg = <0x50440000 0x1000>; > - #clock-cells = <1>; > + debug0: debug@0 { > + compatible = "canaan,k210-debug", "riscv,debug"; I'm still getting lots of warnings about undocumented DT compatible strings from checpatch. Some of them might be in flight, but I don't see many of them (including both of these debug ones) having been defined anywhere. We went through a whole process to sort out the SiFive DT naming conventions, I don't want to just circumvent that for the Canaan stuff by merging it as-is.
On 1/14/21 7:01 PM, Sean Anderson wrote: > > On 1/14/21 6:32 PM, Palmer Dabbelt wrote: >> On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: >>> Update the Canaan Kendryte K210 base device tree k210.dtsi to define >>> all peripherals of the SoC, their clocks and reset lines. The device >>> tree file k210.dts is renamed to k210_generic.dts and becomes the >>> default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE >>> configuration option. No device beside the serial console is defined by >>> this device tree. This makes this generic device tree suitable for use >>> with a builtin initramfs with all known K210 based boards. >>> >>> These changes result in the K210_CLK_ACLK clock ID to be unused and >>> removed from the dt-bindings k210-clk.h header file. >>> >>> Most updates to the k210.dtsi file come from Sean Anderson's work on >>> U-Boot support for the K210. >>> >>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >>> Reviewed-by: Anup Patel <anup@brainfault.org> >>> --- >>> arch/riscv/Kconfig.socs | 2 +- >>> arch/riscv/boot/dts/canaan/k210.dts | 23 - >>> arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- >>> arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ >>> include/dt-bindings/clock/k210-clk.h | 1 - >>> 5 files changed, 573 insertions(+), 50 deletions(-) >>> delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts >>> create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts >> >> [Snipping this to the relevant bits, in case you missed it before.] >> >>> @@ -81,40 +107,515 @@ in0: oscillator { >>> soc { >>> #address-cells = <1>; >>> #size-cells = <1>; >>> - compatible = "kendryte,k210-soc", "simple-bus"; >>> + compatible = "canaan,k210-soc", "simple-bus"; >>> ranges; >>> interrupt-parent = <&plic0>; >>> >>> - sysctl: sysctl@50440000 { >>> - compatible = "kendryte,k210-sysctl", "simple-mfd"; >>> - reg = <0x50440000 0x1000>; >>> - #clock-cells = <1>; >>> + debug0: debug@0 { >>> + compatible = "canaan,k210-debug", "riscv,debug"; >> >> I'm still getting lots of warnings about undocumented DT compatible strings >> from checpatch. Some of them might be in flight, but I don't see many of them >> (including both of these debug ones) having been defined anywhere. We went >> through a whole process to sort out the SiFive DT naming conventions, I don't >> want to just circumvent that for the Canaan stuff by merging it as-is. > > As far as I'm aware, it's recommended practice to add device-specific compatible > Here it's because "riscv,debug" doesn't exist. This is the "debug" device as described in the debug spec. AFAIK Linux never needs to configure this device. It could probably be removed. I am going to try and go through the list of nonexistant compatibles and see if there are any other devices like this (nothing else like it in Linux). --Sean
On 2021/01/15 8:32, Palmer Dabbelt wrote: > On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: >> Update the Canaan Kendryte K210 base device tree k210.dtsi to define >> all peripherals of the SoC, their clocks and reset lines. The device >> tree file k210.dts is renamed to k210_generic.dts and becomes the >> default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE >> configuration option. No device beside the serial console is defined by >> this device tree. This makes this generic device tree suitable for use >> with a builtin initramfs with all known K210 based boards. >> >> These changes result in the K210_CLK_ACLK clock ID to be unused and >> removed from the dt-bindings k210-clk.h header file. >> >> Most updates to the k210.dtsi file come from Sean Anderson's work on >> U-Boot support for the K210. >> >> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >> Reviewed-by: Anup Patel <anup@brainfault.org> >> --- >> arch/riscv/Kconfig.socs | 2 +- >> arch/riscv/boot/dts/canaan/k210.dts | 23 - >> arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- >> arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ >> include/dt-bindings/clock/k210-clk.h | 1 - >> 5 files changed, 573 insertions(+), 50 deletions(-) >> delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts >> create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts > > [Snipping this to the relevant bits, in case you missed it before.] > >> @@ -81,40 +107,515 @@ in0: oscillator { >> soc { >> #address-cells = <1>; >> #size-cells = <1>; >> - compatible = "kendryte,k210-soc", "simple-bus"; >> + compatible = "canaan,k210-soc", "simple-bus"; >> ranges; >> interrupt-parent = <&plic0>; >> >> - sysctl: sysctl@50440000 { >> - compatible = "kendryte,k210-sysctl", "simple-mfd"; >> - reg = <0x50440000 0x1000>; >> - #clock-cells = <1>; >> + debug0: debug@0 { >> + compatible = "canaan,k210-debug", "riscv,debug"; > > I'm still getting lots of warnings about undocumented DT compatible strings > from checpatch. Some of them might be in flight, but I don't see many of them > (including both of these debug ones) having been defined anywhere. We went > through a whole process to sort out the SiFive DT naming conventions, I don't > want to just circumvent that for the Canaan stuff by merging it as-is. > As mentioned in my previous reply about this, I am aware of the warnings and I am ignoring them. The reason is that I really would like to keep the DTs as-is, describing all pieces of the SoC, even the nodes that do not have Linux support yet. Doing so, we end up with what amounts to the best public documentation ever for this SoC and the boards as what is available publicly from the SoC and boards vendors is not great (that is an understatement). All this information was extracted from the Kendryte SDK and from board design CAD prints (available from https://dl.sipeed.com/MAIX). Sean did most of that for the MAIX Bit board and I added other boards and some corrections. I really do not wish anybody to have to do this again to figure out the memory mapping, clocks, reset lines, and pinctrl mapping. That was hard and painful. Having these unsupported DT nodes around will also allow us to point to them for people who want to start getting involved with risc-v & Linux and want a project to start with. I see these boards as cheap hardware for hobbyist and educational tools rather than production hardware. I am having a blast building a biped walking robot with a MAIX Bit as the controller right now... So unless you keep insisting, I would like to keep the DTs as they are. The naming convention of all nodes in the DT is fine and follows the "vendor,soc-function" pattern. All unsupported nodes are also marked with "status = disabled;" so they do not cause any problem. Thoughts ?
On 1/14/21 7:06 PM, Sean Anderson wrote: > > On 1/14/21 7:01 PM, Sean Anderson wrote: >> >> On 1/14/21 6:32 PM, Palmer Dabbelt wrote: >>> On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: >>>> Update the Canaan Kendryte K210 base device tree k210.dtsi to define >>>> all peripherals of the SoC, their clocks and reset lines. The device >>>> tree file k210.dts is renamed to k210_generic.dts and becomes the >>>> default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE >>>> configuration option. No device beside the serial console is defined by >>>> this device tree. This makes this generic device tree suitable for use >>>> with a builtin initramfs with all known K210 based boards. >>>> >>>> These changes result in the K210_CLK_ACLK clock ID to be unused and >>>> removed from the dt-bindings k210-clk.h header file. >>>> >>>> Most updates to the k210.dtsi file come from Sean Anderson's work on >>>> U-Boot support for the K210. >>>> >>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >>>> Reviewed-by: Anup Patel <anup@brainfault.org> >>>> --- >>>> arch/riscv/Kconfig.socs | 2 +- >>>> arch/riscv/boot/dts/canaan/k210.dts | 23 - >>>> arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- >>>> arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ >>>> include/dt-bindings/clock/k210-clk.h | 1 - >>>> 5 files changed, 573 insertions(+), 50 deletions(-) >>>> delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts >>>> create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts >>> >>> [Snipping this to the relevant bits, in case you missed it before.] >>> >>>> @@ -81,40 +107,515 @@ in0: oscillator { >>>> soc { >>>> #address-cells = <1>; >>>> #size-cells = <1>; >>>> - compatible = "kendryte,k210-soc", "simple-bus"; >>>> + compatible = "canaan,k210-soc", "simple-bus"; >>>> ranges; >>>> interrupt-parent = <&plic0>; >>>> >>>> - sysctl: sysctl@50440000 { >>>> - compatible = "kendryte,k210-sysctl", "simple-mfd"; >>>> - reg = <0x50440000 0x1000>; >>>> - #clock-cells = <1>; >>>> + debug0: debug@0 { >>>> + compatible = "canaan,k210-debug", "riscv,debug"; >>> >>> I'm still getting lots of warnings about undocumented DT compatible strings >>> from checpatch. Some of them might be in flight, but I don't see many of them >>> (including both of these debug ones) having been defined anywhere. We went >>> through a whole process to sort out the SiFive DT naming conventions, I don't >>> want to just circumvent that for the Canaan stuff by merging it as-is. >> >> As far as I'm aware, it's recommended practice to add device-specific compatible >> > > Here it's because "riscv,debug" doesn't exist. This is the "debug" > device as described in the debug spec. AFAIK Linux never needs to > configure this device. It could probably be removed. > > I am going to try and go through the list of nonexistant compatibles and > see if there are any other devices like this (nothing else like it in > Linux). > > --Sean Ok, here is the (abbreviated) output: > cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): > cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long > cpu@0: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] This is a device-specific compatible string as recommended by the current DT docs. > cpu@0: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] This should be added (though it is technically incorrect). (perhaps a version number should be added like 'riscv,sv39-1.10') > cpu@0: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] Should probably be fixed, as the g is redundant. However, this is probably not a good warning going forward, as more exotic combinations of extensions are implemented. > cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): > cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long > cpu@1: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] > > cpu@1: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] > cpu@1: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] see above > serial@38000000: compatible:0: 'canaan,k210-uarths' is not one of ['sifive,fu540-c000-uart', 'sifive,fu740-c000-uart'] device-specific, and intentional > gpio-controller@38001000: compatible:0: 'canaan,k210-gpiohs' is not one of ['sifive,fu540-c000-gpio', 'sifive,fu740-c000-gpio'] ditto > gpio-controller@38001000: 'ngpios' does not match any of the regexes: 'pinctrl-[0-9]+' known shortcoming with this dt property, but alas > gpio-controller@50200000: $nodename:0: 'gpio-controller@50200000' does not match '^gpio@[0-9a-f]+$' This matches devicetree/bindings/gpio/snps,dw-apb-gpio.yaml > gpio-controller@50200000: compatible: ['canaan,k210-gpio', 'snps,dw-apb-gpio'] is too long > gpio-controller@50200000: compatible: Additional items are not allowed ('snps,dw-apb-gpio' was unexpected) > gpio-controller@50200000: 'gpio1@0' does not match any of the regexes: '^gpio-(port|controller)@[0-9a-f]+$', 'pinctrl-[0-9]+' > serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): > serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long > serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] > serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] > serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] > > serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): > serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long > serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] > serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] > serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] > > serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): > serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long > serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] > serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] > serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] More device-specific strings. > spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): > spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long > spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] > spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] ditto > i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): > i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long > > i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): > i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long > > i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): > i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long ditto > timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): > timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long > timer@502D0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] > > timer@502D0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' `resets` is the correct name for this property. > timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): > timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long > timer@502E0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] More device-specific. > timer@502E0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' > timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): > timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long > timer@502F0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] > > timer@502F0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' > watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): > watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long > watchdog@50400000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] > > watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): > watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long > watchdog@50410000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] > > spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): > spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long > spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] > spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] > > spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): > spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long > spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] > spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] > > spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is not valid under any of the given schemas (Possible causes of the failure): > spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is too long > spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] > spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] Ok, so the vast majority of these warnings are from unknown compatible strings. IMO this is not an issue, but the simple fix is to just add these strings to the yaml files. --Sean
On 2021/01/15 9:35, Sean Anderson wrote: > On 1/14/21 7:06 PM, Sean Anderson wrote: >> >> On 1/14/21 7:01 PM, Sean Anderson wrote: >>> >>> On 1/14/21 6:32 PM, Palmer Dabbelt wrote: >>>> On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: >>>>> Update the Canaan Kendryte K210 base device tree k210.dtsi to define >>>>> all peripherals of the SoC, their clocks and reset lines. The device >>>>> tree file k210.dts is renamed to k210_generic.dts and becomes the >>>>> default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE >>>>> configuration option. No device beside the serial console is defined by >>>>> this device tree. This makes this generic device tree suitable for use >>>>> with a builtin initramfs with all known K210 based boards. >>>>> >>>>> These changes result in the K210_CLK_ACLK clock ID to be unused and >>>>> removed from the dt-bindings k210-clk.h header file. >>>>> >>>>> Most updates to the k210.dtsi file come from Sean Anderson's work on >>>>> U-Boot support for the K210. >>>>> >>>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >>>>> Reviewed-by: Anup Patel <anup@brainfault.org> >>>>> --- >>>>> arch/riscv/Kconfig.socs | 2 +- >>>>> arch/riscv/boot/dts/canaan/k210.dts | 23 - >>>>> arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- >>>>> arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ >>>>> include/dt-bindings/clock/k210-clk.h | 1 - >>>>> 5 files changed, 573 insertions(+), 50 deletions(-) >>>>> delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts >>>>> create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts >>>> >>>> [Snipping this to the relevant bits, in case you missed it before.] >>>> >>>>> @@ -81,40 +107,515 @@ in0: oscillator { >>>>> soc { >>>>> #address-cells = <1>; >>>>> #size-cells = <1>; >>>>> - compatible = "kendryte,k210-soc", "simple-bus"; >>>>> + compatible = "canaan,k210-soc", "simple-bus"; >>>>> ranges; >>>>> interrupt-parent = <&plic0>; >>>>> >>>>> - sysctl: sysctl@50440000 { >>>>> - compatible = "kendryte,k210-sysctl", "simple-mfd"; >>>>> - reg = <0x50440000 0x1000>; >>>>> - #clock-cells = <1>; >>>>> + debug0: debug@0 { >>>>> + compatible = "canaan,k210-debug", "riscv,debug"; >>>> >>>> I'm still getting lots of warnings about undocumented DT compatible strings >>>> from checpatch. Some of them might be in flight, but I don't see many of them >>>> (including both of these debug ones) having been defined anywhere. We went >>>> through a whole process to sort out the SiFive DT naming conventions, I don't >>>> want to just circumvent that for the Canaan stuff by merging it as-is. >>> >>> As far as I'm aware, it's recommended practice to add device-specific compatible >>> >> >> Here it's because "riscv,debug" doesn't exist. This is the "debug" >> device as described in the debug spec. AFAIK Linux never needs to >> configure this device. It could probably be removed. >> >> I am going to try and go through the list of nonexistant compatibles and >> see if there are any other devices like this (nothing else like it in >> Linux). >> >> --Sean > > Ok, here is the (abbreviated) output: > > >> cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): >> cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long >> cpu@0: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] > > This is a device-specific compatible string as recommended by the > current DT docs. > >> cpu@0: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] > > This should be added (though it is technically incorrect). will do. > > (perhaps a version number should be added like 'riscv,sv39-1.10') > >> cpu@0: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] > > Should probably be fixed, as the g is redundant. However, this is > probably not a good warning going forward, as more exotic combinations > of extensions are implemented. I had removed the "g" here. I guess I messed up a rebase and it is back. Will fix that. > >> cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): >> cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long >> cpu@1: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] >> >> cpu@1: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] >> cpu@1: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] > > see above > >> serial@38000000: compatible:0: 'canaan,k210-uarths' is not one of ['sifive,fu540-c000-uart', 'sifive,fu740-c000-uart'] > > device-specific, and intentional We can add this one to the sifive serial yaml. > >> gpio-controller@38001000: compatible:0: 'canaan,k210-gpiohs' is not one of ['sifive,fu540-c000-gpio', 'sifive,fu740-c000-gpio'] > > ditto > >> gpio-controller@38001000: 'ngpios' does not match any of the regexes: 'pinctrl-[0-9]+' > > known shortcoming with this dt property, but alas Yes. The driver was fixed. But the yaml is behind I guess. Will send a patch for this one. > >> gpio-controller@50200000: $nodename:0: 'gpio-controller@50200000' does not match '^gpio@[0-9a-f]+$' > > This matches devicetree/bindings/gpio/snps,dw-apb-gpio.yaml This may be similar to the ngpios problem: the core expect something while the yaml defines something older... Will have a look. > >> gpio-controller@50200000: compatible: ['canaan,k210-gpio', 'snps,dw-apb-gpio'] is too long >> gpio-controller@50200000: compatible: Additional items are not allowed ('snps,dw-apb-gpio' was unexpected) I wonder if we can just remove 'canaan,k210-gpio' here ? >> gpio-controller@50200000: 'gpio1@0' does not match any of the regexes: '^gpio-(port|controller)@[0-9a-f]+$', 'pinctrl-[0-9]+' Not sure what to do about this one. >> serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >> serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >> >> serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >> serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >> >> serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >> serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] > > More device-specific strings. > >> spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >> spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >> spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >> spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] > > ditto Actually a false warning from checkpatch. canaan,k210-spi was already added to the DW spi yaml. > >> i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >> i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >> >> i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >> i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >> >> i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >> i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long > > ditto > >> timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >> timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >> timer@502D0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >> >> timer@502D0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' > > `resets` is the correct name for this property. > >> timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >> timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >> timer@502E0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] > > More device-specific. > >> timer@502E0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >> timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >> timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >> timer@502F0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >> >> timer@502F0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >> watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): >> watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long >> watchdog@50400000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] >> >> watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): >> watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long >> watchdog@50410000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] >> >> spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >> spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >> spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >> spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >> >> spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >> spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >> spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >> spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] canaan,k210-spi is already added to the dw spi doc. Will check that again. canaan,k210-ssi is missing though but since there is no quirk associated with it, we should not need to mention it in the yaml. >> >> spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is not valid under any of the given schemas (Possible causes of the failure): >> spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is too long >> spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >> spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] > > Ok, so the vast majority of these warnings are from unknown compatible > strings. IMO this is not an issue, but the simple fix is to just add > these strings to the yaml files. We could, but given that checkpatch spits out warnings for the ones already added, we should probably start with fixing checkpatch :) And there are some nodes that have no drive in Linux, so no yaml. So a warning will remain for these but I do not want to remove the nodes. Thansk for checking all this ! > > --Sean >
On 1/14/21 8:03 PM, Damien Le Moal wrote: > On 2021/01/15 9:35, Sean Anderson wrote: >> On 1/14/21 7:06 PM, Sean Anderson wrote: >>> >>> On 1/14/21 7:01 PM, Sean Anderson wrote: >>>> >>>> On 1/14/21 6:32 PM, Palmer Dabbelt wrote: >>>>> On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: >>>>>> Update the Canaan Kendryte K210 base device tree k210.dtsi to define >>>>>> all peripherals of the SoC, their clocks and reset lines. The device >>>>>> tree file k210.dts is renamed to k210_generic.dts and becomes the >>>>>> default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE >>>>>> configuration option. No device beside the serial console is defined by >>>>>> this device tree. This makes this generic device tree suitable for use >>>>>> with a builtin initramfs with all known K210 based boards. >>>>>> >>>>>> These changes result in the K210_CLK_ACLK clock ID to be unused and >>>>>> removed from the dt-bindings k210-clk.h header file. >>>>>> >>>>>> Most updates to the k210.dtsi file come from Sean Anderson's work on >>>>>> U-Boot support for the K210. >>>>>> >>>>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >>>>>> Reviewed-by: Anup Patel <anup@brainfault.org> >>>>>> --- >>>>>> arch/riscv/Kconfig.socs | 2 +- >>>>>> arch/riscv/boot/dts/canaan/k210.dts | 23 - >>>>>> arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- >>>>>> arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ >>>>>> include/dt-bindings/clock/k210-clk.h | 1 - >>>>>> 5 files changed, 573 insertions(+), 50 deletions(-) >>>>>> delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts >>>>>> create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts >>>>> >>>>> [Snipping this to the relevant bits, in case you missed it before.] >>>>> >>>>>> @@ -81,40 +107,515 @@ in0: oscillator { >>>>>> soc { >>>>>> #address-cells = <1>; >>>>>> #size-cells = <1>; >>>>>> - compatible = "kendryte,k210-soc", "simple-bus"; >>>>>> + compatible = "canaan,k210-soc", "simple-bus"; >>>>>> ranges; >>>>>> interrupt-parent = <&plic0>; >>>>>> >>>>>> - sysctl: sysctl@50440000 { >>>>>> - compatible = "kendryte,k210-sysctl", "simple-mfd"; >>>>>> - reg = <0x50440000 0x1000>; >>>>>> - #clock-cells = <1>; >>>>>> + debug0: debug@0 { >>>>>> + compatible = "canaan,k210-debug", "riscv,debug"; >>>>> >>>>> I'm still getting lots of warnings about undocumented DT compatible strings >>>>> from checpatch. Some of them might be in flight, but I don't see many of them >>>>> (including both of these debug ones) having been defined anywhere. We went >>>>> through a whole process to sort out the SiFive DT naming conventions, I don't >>>>> want to just circumvent that for the Canaan stuff by merging it as-is. >>>> >>>> As far as I'm aware, it's recommended practice to add device-specific compatible >>>> >>> >>> Here it's because "riscv,debug" doesn't exist. This is the "debug" >>> device as described in the debug spec. AFAIK Linux never needs to >>> configure this device. It could probably be removed. >>> >>> I am going to try and go through the list of nonexistant compatibles and >>> see if there are any other devices like this (nothing else like it in >>> Linux). >>> >>> --Sean >> >> Ok, here is the (abbreviated) output: >> >> >>> cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): >>> cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long >>> cpu@0: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] >> >> This is a device-specific compatible string as recommended by the >> current DT docs. >> >>> cpu@0: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] >> >> This should be added (though it is technically incorrect). > > will do. > >> >> (perhaps a version number should be added like 'riscv,sv39-1.10') >> >>> cpu@0: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] >> >> Should probably be fixed, as the g is redundant. However, this is >> probably not a good warning going forward, as more exotic combinations >> of extensions are implemented. > > I had removed the "g" here. I guess I messed up a rebase and it is back. Will > fix that. > >> >>> cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): >>> cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long >>> cpu@1: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] >>> >>> cpu@1: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] >>> cpu@1: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] >> >> see above >> >>> serial@38000000: compatible:0: 'canaan,k210-uarths' is not one of ['sifive,fu540-c000-uart', 'sifive,fu740-c000-uart'] >> >> device-specific, and intentional > > We can add this one to the sifive serial yaml. > >> >>> gpio-controller@38001000: compatible:0: 'canaan,k210-gpiohs' is not one of ['sifive,fu540-c000-gpio', 'sifive,fu740-c000-gpio'] >> >> ditto >> >>> gpio-controller@38001000: 'ngpios' does not match any of the regexes: 'pinctrl-[0-9]+' >> >> known shortcoming with this dt property, but alas > > Yes. The driver was fixed. But the yaml is behind I guess. Will send a patch for > this one. > >> >>> gpio-controller@50200000: $nodename:0: 'gpio-controller@50200000' does not match '^gpio@[0-9a-f]+$' >> >> This matches devicetree/bindings/gpio/snps,dw-apb-gpio.yaml > > This may be similar to the ngpios problem: the core expect something while the > yaml defines something older... Will have a look. > >> >>> gpio-controller@50200000: compatible: ['canaan,k210-gpio', 'snps,dw-apb-gpio'] is too long >>> gpio-controller@50200000: compatible: Additional items are not allowed ('snps,dw-apb-gpio' was unexpected) > > I wonder if we can just remove 'canaan,k210-gpio' here ? > >>> gpio-controller@50200000: 'gpio1@0' does not match any of the regexes: '^gpio-(port|controller)@[0-9a-f]+$', 'pinctrl-[0-9]+' > > Not sure what to do about this one. > >>> serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >>> serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >>> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >>> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >>> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >>> >>> serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >>> serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >>> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >>> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >>> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >>> >>> serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >>> serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >>> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >>> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >>> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >> >> More device-specific strings. >> >>> spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >>> spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >>> spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>> spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >> >> ditto > > Actually a false warning from checkpatch. canaan,k210-spi was already added to > the DW spi yaml. > >> >>> i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >>> i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >>> >>> i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >>> i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >>> >>> i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >>> i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >> >> ditto >> >>> timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >>> timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >>> timer@502D0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >>> >>> timer@502D0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >> >> `resets` is the correct name for this property. >> >>> timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >>> timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >>> timer@502E0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >> >> More device-specific. >> >>> timer@502E0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >>> timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >>> timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >>> timer@502F0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >>> >>> timer@502F0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >>> watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): >>> watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long >>> watchdog@50400000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] >>> >>> watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): >>> watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long >>> watchdog@50410000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] >>> >>> spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >>> spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >>> spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>> spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >>> >>> spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >>> spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >>> spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>> spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] > > canaan,k210-spi is already added to the dw spi doc. Will check that again. > canaan,k210-ssi is missing though but since there is no quirk associated with > it, we should not need to mention it in the yaml. > >>> >>> spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is not valid under any of the given schemas (Possible causes of the failure): >>> spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is too long >>> spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>> spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >> >> Ok, so the vast majority of these warnings are from unknown compatible >> strings. IMO this is not an issue, but the simple fix is to just add >> these strings to the yaml files. > > We could, but given that checkpatch spits out warnings for the ones already > added, we should probably start with fixing checkpatch :) Well, it could also be that I was on the wrong branch, or had some old build artifacts. > > And there are some nodes that have no drive in Linux, so no yaml. So a warning > will remain for these but I do not want to remove the nodes. > > Thansk for checking all this ! Just install dt-schema and you can check it too ;) --Sean > > >> >> --Sean >> > >
On 2021/01/15 10:14, Sean Anderson wrote: > On 1/14/21 8:03 PM, Damien Le Moal wrote: >> On 2021/01/15 9:35, Sean Anderson wrote: >>> On 1/14/21 7:06 PM, Sean Anderson wrote: >>>> >>>> On 1/14/21 7:01 PM, Sean Anderson wrote: >>>>> >>>>> On 1/14/21 6:32 PM, Palmer Dabbelt wrote: >>>>>> On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: >>>>>>> Update the Canaan Kendryte K210 base device tree k210.dtsi to define >>>>>>> all peripherals of the SoC, their clocks and reset lines. The device >>>>>>> tree file k210.dts is renamed to k210_generic.dts and becomes the >>>>>>> default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE >>>>>>> configuration option. No device beside the serial console is defined by >>>>>>> this device tree. This makes this generic device tree suitable for use >>>>>>> with a builtin initramfs with all known K210 based boards. >>>>>>> >>>>>>> These changes result in the K210_CLK_ACLK clock ID to be unused and >>>>>>> removed from the dt-bindings k210-clk.h header file. >>>>>>> >>>>>>> Most updates to the k210.dtsi file come from Sean Anderson's work on >>>>>>> U-Boot support for the K210. >>>>>>> >>>>>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >>>>>>> Reviewed-by: Anup Patel <anup@brainfault.org> >>>>>>> --- >>>>>>> arch/riscv/Kconfig.socs | 2 +- >>>>>>> arch/riscv/boot/dts/canaan/k210.dts | 23 - >>>>>>> arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- >>>>>>> arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ >>>>>>> include/dt-bindings/clock/k210-clk.h | 1 - >>>>>>> 5 files changed, 573 insertions(+), 50 deletions(-) >>>>>>> delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts >>>>>>> create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts >>>>>> >>>>>> [Snipping this to the relevant bits, in case you missed it before.] >>>>>> >>>>>>> @@ -81,40 +107,515 @@ in0: oscillator { >>>>>>> soc { >>>>>>> #address-cells = <1>; >>>>>>> #size-cells = <1>; >>>>>>> - compatible = "kendryte,k210-soc", "simple-bus"; >>>>>>> + compatible = "canaan,k210-soc", "simple-bus"; >>>>>>> ranges; >>>>>>> interrupt-parent = <&plic0>; >>>>>>> >>>>>>> - sysctl: sysctl@50440000 { >>>>>>> - compatible = "kendryte,k210-sysctl", "simple-mfd"; >>>>>>> - reg = <0x50440000 0x1000>; >>>>>>> - #clock-cells = <1>; >>>>>>> + debug0: debug@0 { >>>>>>> + compatible = "canaan,k210-debug", "riscv,debug"; >>>>>> >>>>>> I'm still getting lots of warnings about undocumented DT compatible strings >>>>>> from checpatch. Some of them might be in flight, but I don't see many of them >>>>>> (including both of these debug ones) having been defined anywhere. We went >>>>>> through a whole process to sort out the SiFive DT naming conventions, I don't >>>>>> want to just circumvent that for the Canaan stuff by merging it as-is. >>>>> >>>>> As far as I'm aware, it's recommended practice to add device-specific compatible >>>>> >>>> >>>> Here it's because "riscv,debug" doesn't exist. This is the "debug" >>>> device as described in the debug spec. AFAIK Linux never needs to >>>> configure this device. It could probably be removed. >>>> >>>> I am going to try and go through the list of nonexistant compatibles and >>>> see if there are any other devices like this (nothing else like it in >>>> Linux). >>>> >>>> --Sean >>> >>> Ok, here is the (abbreviated) output: >>> >>> >>>> cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): >>>> cpu@0: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long >>>> cpu@0: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] >>> >>> This is a device-specific compatible string as recommended by the >>> current DT docs. >>> >>>> cpu@0: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] >>> >>> This should be added (though it is technically incorrect). >> >> will do. >> >>> >>> (perhaps a version number should be added like 'riscv,sv39-1.10') >>> >>>> cpu@0: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] >>> >>> Should probably be fixed, as the g is redundant. However, this is >>> probably not a good warning going forward, as more exotic combinations >>> of extensions are implemented. >> >> I had removed the "g" here. I guess I messed up a rebase and it is back. Will >> fix that. >> >>> >>>> cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is not valid under any of the given schemas (Possible causes of the failure): >>>> cpu@1: compatible: ['canaan,k210', 'sifive,rocket0', 'riscv'] is too long >>>> cpu@1: compatible:0: 'canaan,k210' is not one of ['sifive,rocket0', 'sifive,bullet0', 'sifive,e5', 'sifive,e7', 'sifive,e51', 'sifive,e71', 'sifive,u54-mc', 'sifive,u74-mc', 'sifive,u54', 'sifive,u74', 'sifive,u5', 'sifive,u7'] >>>> >>>> cpu@1: mmu-type:0: 'none' is not one of ['riscv,sv32', 'riscv,sv39', 'riscv,sv48'] >>>> cpu@1: riscv,isa:0: 'rv64imafdgc' is not one of ['rv64imac', 'rv64imafdc'] >>> >>> see above >>> >>>> serial@38000000: compatible:0: 'canaan,k210-uarths' is not one of ['sifive,fu540-c000-uart', 'sifive,fu740-c000-uart'] >>> >>> device-specific, and intentional >> >> We can add this one to the sifive serial yaml. >> >>> >>>> gpio-controller@38001000: compatible:0: 'canaan,k210-gpiohs' is not one of ['sifive,fu540-c000-gpio', 'sifive,fu740-c000-gpio'] >>> >>> ditto >>> >>>> gpio-controller@38001000: 'ngpios' does not match any of the regexes: 'pinctrl-[0-9]+' >>> >>> known shortcoming with this dt property, but alas >> >> Yes. The driver was fixed. But the yaml is behind I guess. Will send a patch for >> this one. >> >>> >>>> gpio-controller@50200000: $nodename:0: 'gpio-controller@50200000' does not match '^gpio@[0-9a-f]+$' >>> >>> This matches devicetree/bindings/gpio/snps,dw-apb-gpio.yaml >> >> This may be similar to the ngpios problem: the core expect something while the >> yaml defines something older... Will have a look. >> >>> >>>> gpio-controller@50200000: compatible: ['canaan,k210-gpio', 'snps,dw-apb-gpio'] is too long >>>> gpio-controller@50200000: compatible: Additional items are not allowed ('snps,dw-apb-gpio' was unexpected) >> >> I wonder if we can just remove 'canaan,k210-gpio' here ? >> >>>> gpio-controller@50200000: 'gpio1@0' does not match any of the regexes: '^gpio-(port|controller)@[0-9a-f]+$', 'pinctrl-[0-9]+' >> >> Not sure what to do about this one. >> >>>> serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >>>> serial@50210000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >>>> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >>>> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >>>> serial@50210000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >>>> >>>> serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >>>> serial@50220000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >>>> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >>>> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >>>> serial@50220000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >>>> >>>> serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is not valid under any of the given schemas (Possible causes of the failure): >>>> serial@50230000: compatible: ['canaan,k210-uart', 'snps,dw-apb-uart'] is too long >>>> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['renesas,r9a06g032-uart', 'renesas,r9a06g033-uart'] >>>> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['rockchip,px30-uart', 'rockchip,rk3036-uart', 'rockchip,rk3066-uart', 'rockchip,rk3188-uart', 'rockchip,rk3288-uart', 'rockchip,rk3308-uart', 'rockchip,rk3328-uart', 'rockchip,rk3368-uart', 'rockchip,rk3399-uart', 'rockchip,rv1108-uart'] >>>> serial@50230000: compatible:0: 'canaan,k210-uart' is not one of ['brcm,bcm11351-dw-apb-uart', 'brcm,bcm21664-dw-apb-uart'] >>> >>> More device-specific strings. >>> >>>> spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >>>> spi@50240000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >>>> spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>>> spi@50240000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >>> >>> ditto >> >> Actually a false warning from checkpatch. canaan,k210-spi was already added to >> the DW spi yaml. >> >>> >>>> i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >>>> i2c@50280000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >>>> >>>> i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >>>> i2c@50290000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >>>> >>>> i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is not valid under any of the given schemas (Possible causes of the failure): >>>> i2c@502A0000: compatible: ['canaan,k210-i2c', 'snps,designware-i2c'] is too long >>> >>> ditto >>> >>>> timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >>>> timer@502D0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >>>> timer@502D0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >>>> >>>> timer@502D0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >>> >>> `resets` is the correct name for this property. >>> >>>> timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >>>> timer@502E0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >>>> timer@502E0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >>> >>> More device-specific. >>> >>>> timer@502E0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >>>> timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is not valid under any of the given schemas (Possible causes of the failure): >>>> timer@502F0000: compatible: ['canaan,k210-timer', 'snps,dw-apb-timer'] is too long >>>> timer@502F0000: compatible:0: 'canaan,k210-timer' is not one of ['snps,dw-apb-timer-sp', 'snps,dw-apb-timer-osc'] >>>> >>>> timer@502F0000: 'resets' does not match any of the regexes: 'pinctrl-[0-9]+' >>>> watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): >>>> watchdog@50400000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long >>>> watchdog@50400000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] >>>> >>>> watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is not valid under any of the given schemas (Possible causes of the failure): >>>> watchdog@50410000: compatible: ['canaan,k210-wdt', 'snps,dw-wdt'] is too long >>>> watchdog@50410000: compatible:0: 'canaan,k210-wdt' is not one of ['rockchip,rk3066-wdt', 'rockchip,rk3188-wdt', 'rockchip,rk3288-wdt', 'rockchip,rk3368-wdt'] >>>> >>>> spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >>>> spi@52000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >>>> spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>>> spi@52000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >>>> >>>> spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is not valid under any of the given schemas (Possible causes of the failure): >>>> spi@53000000: compatible: ['canaan,k210-spi', 'snps,dw-apb-ssi-4.01', 'snps,dw-apb-ssi'] is too long >>>> spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>>> spi@53000000: compatible:0: 'canaan,k210-spi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >> >> canaan,k210-spi is already added to the dw spi doc. Will check that again. >> canaan,k210-ssi is missing though but since there is no quirk associated with >> it, we should not need to mention it in the yaml. >> >>>> >>>> spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is not valid under any of the given schemas (Possible causes of the failure): >>>> spi@54000000: compatible: ['canaan,k210-ssi', 'snps,dwc-ssi-1.01a'] is too long >>>> spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['snps,dw-apb-ssi', 'snps,dwc-ssi-1.01a'] >>>> spi@54000000: compatible:0: 'canaan,k210-ssi' is not one of ['mscc,ocelot-spi', 'mscc,jaguar2-spi'] >>> >>> Ok, so the vast majority of these warnings are from unknown compatible >>> strings. IMO this is not an issue, but the simple fix is to just add >>> these strings to the yaml files. >> >> We could, but given that checkpatch spits out warnings for the ones already >> added, we should probably start with fixing checkpatch :) > > Well, it could also be that I was on the wrong branch, or had some old > build artifacts. Any branch based on 5.11 has the DW SPI fixes already. That was queued during the last cycle. > >> >> And there are some nodes that have no drive in Linux, so no yaml. So a warning >> will remain for these but I do not want to remove the nodes. >> >> Thansk for checking all this ! > > Just install dt-schema and you can check it too ;) I have that installed already. Will rerun the check to reduce the amount of warnings. > > --Sean > >> >> >>> >>> --Sean >>> >> >> > >
On Thu, 2021-01-14 at 15:32 -0800, Palmer Dabbelt wrote: > On Mon, 11 Jan 2021 16:58:41 PST (-0800), Damien Le Moal wrote: > > Update the Canaan Kendryte K210 base device tree k210.dtsi to define > > all peripherals of the SoC, their clocks and reset lines. The device > > tree file k210.dts is renamed to k210_generic.dts and becomes the > > default value selection of the SOC_CANAAN_K210_DTB_BUILTIN_SOURCE > > configuration option. No device beside the serial console is defined by > > this device tree. This makes this generic device tree suitable for use > > with a builtin initramfs with all known K210 based boards. > > > > These changes result in the K210_CLK_ACLK clock ID to be unused and > > removed from the dt-bindings k210-clk.h header file. > > > > Most updates to the k210.dtsi file come from Sean Anderson's work on > > U-Boot support for the K210. > > > > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> > > Reviewed-by: Anup Patel <anup@brainfault.org> > > --- > > arch/riscv/Kconfig.socs | 2 +- > > arch/riscv/boot/dts/canaan/k210.dts | 23 - > > arch/riscv/boot/dts/canaan/k210.dtsi | 551 +++++++++++++++++++- > > arch/riscv/boot/dts/canaan/k210_generic.dts | 46 ++ > > include/dt-bindings/clock/k210-clk.h | 1 - > > 5 files changed, 573 insertions(+), 50 deletions(-) > > delete mode 100644 arch/riscv/boot/dts/canaan/k210.dts > > create mode 100644 arch/riscv/boot/dts/canaan/k210_generic.dts > > [Snipping this to the relevant bits, in case you missed it before.] > > > @@ -81,40 +107,515 @@ in0: oscillator { > > soc { > > #address-cells = <1>; > > #size-cells = <1>; > > - compatible = "kendryte,k210-soc", "simple-bus"; > > + compatible = "canaan,k210-soc", "simple-bus"; > > ranges; > > interrupt-parent = <&plic0>; > > > > - sysctl: sysctl@50440000 { > > - compatible = "kendryte,k210-sysctl", "simple-mfd"; > > - reg = <0x50440000 0x1000>; > > - #clock-cells = <1>; > > + debug0: debug@0 { > > + compatible = "canaan,k210-debug", "riscv,debug"; > > I'm still getting lots of warnings about undocumented DT compatible strings > from checpatch. Some of them might be in flight, but I don't see many of them > (including both of these debug ones) having been defined anywhere. We went > through a whole process to sort out the SiFive DT naming conventions, I don't > want to just circumvent that for the Canaan stuff by merging it as-is. I fixed all warnings generated by make dtbs_check. Nothing shows up now. I removed most of the "canaan,k210-xxx" compatible strings for nodes that have a well defined driver, according to the driver binding docs (that is the same as other boards/SoC which do not add an SoC specific compatible string). That is only for the IP blocks that do not need a specific tweak/quirk. The DesignWare SPI is the exception, but that one is already documented. For the ones I did not remove, I added documentation (e.g. boards under riscv/canaan.yaml). I also fixed several nodes and several existing yaml files. E.g. The sifive gpio requires a clocks property but the K210 sifive gpio does not have any software controllable clock defined. So for that one, there is a cannan,k210-gpiohs compatible string added and the clocks property is made optional if that string is used. What remains is some checkpatch.pl warnings about undocumented compatible strings for the disabled nodes that have no Linux driver. But I am not removing these. Finishing polishing the clock driver and retesting now. I will soon send v12 with these fixes.
diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs index 6402746c68f3..7efcece8896c 100644 --- a/arch/riscv/Kconfig.socs +++ b/arch/riscv/Kconfig.socs @@ -51,7 +51,7 @@ config SOC_CANAAN_K210_DTB_SOURCE string "Source file for the Canaan Kendryte K210 builtin DTB" depends on SOC_CANAAN depends on SOC_CANAAN_K210_DTB_BUILTIN - default "k210" + default "k210_generic" help Base name (without suffix, relative to arch/riscv/boot/dts/canaan) for the DTS file that will be used to produce the DTB linked into the diff --git a/arch/riscv/boot/dts/canaan/k210.dts b/arch/riscv/boot/dts/canaan/k210.dts deleted file mode 100644 index 0d1f28fce6b2..000000000000 --- a/arch/riscv/boot/dts/canaan/k210.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2020 Western Digital Corporation or its affiliates. - */ - -/dts-v1/; - -#include "k210.dtsi" - -/ { - model = "Kendryte K210 generic"; - compatible = "kendryte,k210"; - - chosen { - bootargs = "earlycon console=ttySIF0"; - stdout-path = "serial0"; - }; -}; - -&uarths0 { - status = "okay"; -}; - diff --git a/arch/riscv/boot/dts/canaan/k210.dtsi b/arch/riscv/boot/dts/canaan/k210.dtsi index 354b263195a3..196096eedd73 100644 --- a/arch/riscv/boot/dts/canaan/k210.dtsi +++ b/arch/riscv/boot/dts/canaan/k210.dtsi @@ -1,9 +1,11 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2019 Sean Anderson <seanga2@gmail.com> + * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com> * Copyright (C) 2020 Western Digital Corporation or its affiliates. */ #include <dt-bindings/clock/k210-clk.h> +#include <dt-bindings/pinctrl/k210-fpioa.h> +#include <dt-bindings/reset/k210-rst.h> / { /* @@ -12,10 +14,29 @@ / { */ #address-cells = <1>; #size-cells = <1>; - compatible = "kendryte,k210"; + compatible = "canaan,kendryte-k210"; aliases { + cpu0 = &cpu0; + cpu1 = &cpu1; + dma0 = &dmac0; + gpio0 = &gpio0; + gpio1 = &gpio1_0; + i2c0 = &i2c0; + i2c1 = &i2c1; + i2c2 = &i2c2; + pinctrl0 = &fpioa; serial0 = &uarths0; + serial1 = &uart1; + serial2 = &uart2; + serial3 = &uart3; + spi0 = &spi0; + spi1 = &spi1; + spi2 = &spi2; + spi3 = &spi3; + timer0 = &timer0; + timer1 = &timer1; + timer2 = &timer2; }; /* @@ -30,14 +51,14 @@ cpus { timebase-frequency = <7800000>; cpu0: cpu@0 { device_type = "cpu"; + compatible = "canaan,k210", "sifive,rocket0", "riscv"; reg = <0>; - compatible = "kendryte,k210", "sifive,rocket0", "riscv"; - riscv,isa = "rv64imafdc"; + riscv,isa = "rv64imafdgc"; mmu-type = "none"; - i-cache-size = <0x8000>; i-cache-block-size = <64>; - d-cache-size = <0x8000>; + i-cache-size = <0x8000>; d-cache-block-size = <64>; + d-cache-size = <0x8000>; cpu0_intc: interrupt-controller { #interrupt-cells = <1>; interrupt-controller; @@ -46,14 +67,14 @@ cpu0_intc: interrupt-controller { }; cpu1: cpu@1 { device_type = "cpu"; + compatible = "canaan,k210", "sifive,rocket0", "riscv"; reg = <1>; - compatible = "kendryte,k210", "sifive,rocket0", "riscv"; - riscv,isa = "rv64imafdc"; + riscv,isa = "rv64imafdgc"; mmu-type = "none"; - i-cache-size = <0x8000>; i-cache-block-size = <64>; - d-cache-size = <0x8000>; + i-cache-size = <0x8000>; d-cache-block-size = <64>; + d-cache-size = <0x8000>; cpu1_intc: interrupt-controller { #interrupt-cells = <1>; interrupt-controller; @@ -64,10 +85,15 @@ 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 { @@ -81,40 +107,515 @@ in0: oscillator { soc { #address-cells = <1>; #size-cells = <1>; - compatible = "kendryte,k210-soc", "simple-bus"; + compatible = "canaan,k210-soc", "simple-bus"; ranges; interrupt-parent = <&plic0>; - sysctl: sysctl@50440000 { - compatible = "kendryte,k210-sysctl", "simple-mfd"; - reg = <0x50440000 0x1000>; - #clock-cells = <1>; + debug0: debug@0 { + compatible = "canaan,k210-debug", "riscv,debug"; + reg = <0x0 0x1000>; + status = "disabled"; + }; + + rom0: nvmem@1000 { + reg = <0x1000 0x1000>; + read-only; + status = "disabled"; }; clint0: clint@2000000 { #interrupt-cells = <1>; - compatible = "riscv,clint0"; + compatible = "canaan,k210-clint", "riscv,clint0"; reg = <0x2000000 0xC000>; - interrupts-extended = <&cpu0_intc 3 &cpu0_intc 7 - &cpu1_intc 3 &cpu1_intc 7>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>, + <&cpu1_intc 3>, <&cpu1_intc 7>; }; - plic0: interrupt-controller@c000000 { + plic0: interrupt-controller@C000000 { #interrupt-cells = <1>; - interrupt-controller; - compatible = "kendryte,k210-plic0", "riscv,plic0"; + compatible = "canaan,k210-plic", "riscv,plic0"; reg = <0xC000000 0x4000000>; - interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 0xffffffff>, - <&cpu1_intc 11>, <&cpu1_intc 0xffffffff>; + interrupt-controller; + interrupts-extended = <&cpu0_intc 11>, + <&cpu1_intc 11>; riscv,ndev = <65>; riscv,max-priority = <7>; }; uarths0: serial@38000000 { - compatible = "kendryte,k210-uarths", "sifive,uart0"; + compatible = "canaan,k210-uarths", "sifive,uart0"; reg = <0x38000000 0x1000>; interrupts = <33>; - clocks = <&sysctl K210_CLK_CPU>; + clocks = <&sysclk K210_CLK_CPU>; + status = "disabled"; + }; + + gpio0: gpio-controller@38001000 { + #interrupt-cells = <2>; + #gpio-cells = <2>; + compatible = "canaan,k210-gpiohs", "sifive,gpio0"; + reg = <0x38001000 0x1000>; + interrupt-controller; + interrupts = <34 35 36 37 38 39 40 41 + 42 43 44 45 46 47 48 49 + 50 51 52 53 54 55 56 57 + 58 59 60 61 62 63 64 65>; + gpio-controller; + ngpios = <32>; + status = "disabled"; + }; + + kpu0: kpu@40800000 { + compatible = "canaan,k210-kpu"; + reg = <0x40800000 0xc00000>; + interrupts = <25>; + clocks = <&sysclk K210_CLK_AI>; + status = "disabled"; + }; + + fft0: fft@42000000 { + compatible = "canaan,k210-fft"; + reg = <0x42000000 0x400000>; + interrupts = <26>; + clocks = <&sysclk K210_CLK_FFT>; + resets = <&sysrst K210_RST_FFT>; + status = "disabled"; + }; + + dmac0: dma-controller@50000000 { + compatible = "canaan,k210-dmac", "snps,axi-dma-1.01a"; + reg = <0x50000000 0x1000>; + interrupts = <27 28 29 30 31 32>; + clocks = <&sysclk K210_CLK_DMA>, <&sysclk K210_CLK_DMA>; + clock-names = "core-clk", "cfgr-clk"; + resets = <&sysrst K210_RST_DMA>; + dma-channels = <6>; + snps,dma-masters = <2>; + snps,priority = <0 1 2 3 4 5>; + snps,data-width = <5>; + snps,block-size = <0x200000 0x200000 0x200000 + 0x200000 0x200000 0x200000>; + snps,axi-max-burst-len = <256>; + status = "disabled"; + }; + + apb0: bus@50200000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "canaan,k210-apb", "simple-pm-bus"; + ranges; + clocks = <&sysclk K210_CLK_APB0>; + + gpio1: gpio-controller@50200000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "canaan,k210-gpio", + "snps,dw-apb-gpio"; + reg = <0x50200000 0x80>; + clocks = <&sysclk K210_CLK_APB0>, + <&sysclk K210_CLK_GPIO>; + clock-names = "bus", "db"; + resets = <&sysrst K210_RST_GPIO>; + status = "disabled"; + + gpio1_0: gpio1@0 { + #gpio-cells = <2>; + #interrupt-cells = <2>; + compatible = "snps,dw-apb-gpio-port"; + reg = <0>; + interrupt-controller; + interrupts = <23>; + gpio-controller; + ngpios = <8>; + }; + }; + + uart1: serial@50210000 { + compatible = "canaan,k210-uart", + "snps,dw-apb-uart"; + reg = <0x50210000 0x100>; + interrupts = <11>; + clocks = <&sysclk K210_CLK_UART1>, + <&sysclk K210_CLK_APB0>; + clock-names = "baudclk", "apb_pclk"; + resets = <&sysrst K210_RST_UART1>; + reg-io-width = <4>; + reg-shift = <2>; + dcd-override; + dsr-override; + cts-override; + ri-override; + status = "disabled"; + }; + + uart2: serial@50220000 { + compatible = "canaan,k210-uart", + "snps,dw-apb-uart"; + reg = <0x50220000 0x100>; + interrupts = <12>; + clocks = <&sysclk K210_CLK_UART2>, + <&sysclk K210_CLK_APB0>; + clock-names = "baudclk", "apb_pclk"; + resets = <&sysrst K210_RST_UART2>; + reg-io-width = <4>; + reg-shift = <2>; + dcd-override; + dsr-override; + cts-override; + ri-override; + status = "disabled"; + }; + + uart3: serial@50230000 { + compatible = "canaan,k210-uart", + "snps,dw-apb-uart"; + reg = <0x50230000 0x100>; + interrupts = <13>; + clocks = <&sysclk K210_CLK_UART3>, + <&sysclk K210_CLK_APB0>; + clock-names = "baudclk", "apb_pclk"; + resets = <&sysrst K210_RST_UART3>; + reg-io-width = <4>; + reg-shift = <2>; + dcd-override; + dsr-override; + cts-override; + ri-override; + status = "disabled"; + }; + + spi2: spi@50240000 { + compatible = "canaan,k210-spi", + "snps,dw-apb-ssi-4.01", + "snps,dw-apb-ssi"; + spi-slave; + reg = <0x50240000 0x100>; + interrupts = <3>; + clocks = <&sysclk K210_CLK_SPI2>, + <&sysclk K210_CLK_APB0>; + clock-names = "ssi_clk", "pclk"; + resets = <&sysrst K210_RST_SPI2>; + spi-max-frequency = <25000000>; + status = "disabled"; + }; + + i2s0: i2s@50250000 { + compatible = "canaan,k210-i2s", + "snps,designware-i2s"; + reg = <0x50250000 0x200>; + interrupts = <5>; + clocks = <&sysclk K210_CLK_I2S0>; + clock-names = "i2sclk"; + resets = <&sysrst K210_RST_I2S0>; + status = "disabled"; + }; + + apu0: sound@520250200 { + compatible = "canaan,k210-apu"; + reg = <0x50250200 0x200>; + status = "disabled"; + }; + + i2s1: i2s@50260000 { + compatible = "canaan,k210-i2s", + "snps,designware-i2s"; + reg = <0x50260000 0x200>; + interrupts = <6>; + clocks = <&sysclk K210_CLK_I2S1>; + clock-names = "i2sclk"; + resets = <&sysrst K210_RST_I2S1>; + status = "disabled"; + }; + + i2s2: i2s@50270000 { + compatible = "canaan,k210-i2s", + "snps,designware-i2s"; + reg = <0x50270000 0x200>; + interrupts = <7>; + clocks = <&sysclk K210_CLK_I2S2>; + clock-names = "i2sclk"; + resets = <&sysrst K210_RST_I2S2>; + status = "disabled"; + }; + + i2c0: i2c@50280000 { + compatible = "canaan,k210-i2c", + "snps,designware-i2c"; + reg = <0x50280000 0x100>; + interrupts = <8>; + clocks = <&sysclk K210_CLK_I2C0>, + <&sysclk K210_CLK_APB0>; + clock-names = "ref", "pclk"; + resets = <&sysrst K210_RST_I2C0>; + status = "disabled"; + }; + + i2c1: i2c@50290000 { + compatible = "canaan,k210-i2c", + "snps,designware-i2c"; + reg = <0x50290000 0x100>; + interrupts = <9>; + clocks = <&sysclk K210_CLK_I2C1>, + <&sysclk K210_CLK_APB0>; + clock-names = "ref", "pclk"; + resets = <&sysrst K210_RST_I2C1>; + status = "disabled"; + }; + + i2c2: i2c@502A0000 { + compatible = "canaan,k210-i2c", + "snps,designware-i2c"; + reg = <0x502A0000 0x100>; + interrupts = <10>; + clocks = <&sysclk K210_CLK_I2C2>, + <&sysclk K210_CLK_APB0>; + clock-names = "ref", "pclk"; + resets = <&sysrst K210_RST_I2C2>; + status = "disabled"; + }; + + fpioa: pinmux@502B0000 { + compatible = "canaan,k210-fpioa"; + reg = <0x502B0000 0x100>; + clocks = <&sysclk K210_CLK_FPIOA>, + <&sysclk K210_CLK_APB0>; + clock-names = "ref", "pclk"; + resets = <&sysrst K210_RST_FPIOA>; + canaan,k210-sysctl-power = <&sysctl 108>; + status = "disabled"; + }; + + sha256: sha256@502C0000 { + compatible = "canaan,k210-sha256"; + reg = <0x502C0000 0x100>; + clocks = <&sysclk K210_CLK_SHA>; + resets = <&sysrst K210_RST_SHA>; + status = "disabled"; + }; + + timer0: timer@502D0000 { + compatible = "canaan,k210-timer", + "snps,dw-apb-timer"; + reg = <0x502D0000 0x100>; + interrupts = <14 15>; + clocks = <&sysclk K210_CLK_TIMER0>, + <&sysclk K210_CLK_APB0>; + clock-names = "timer", "pclk"; + resets = <&sysrst K210_RST_TIMER0>; + status = "disabled"; + }; + + timer1: timer@502E0000 { + compatible = "canaan,k210-timer", + "snps,dw-apb-timer"; + reg = <0x502E0000 0x100>; + interrupts = <16 17>; + clocks = <&sysclk K210_CLK_TIMER1>, + <&sysclk K210_CLK_APB0>; + clock-names = "timer", "pclk"; + resets = <&sysrst K210_RST_TIMER1>; + status = "disabled"; + }; + + timer2: timer@502F0000 { + compatible = "canaan,k210-timer", + "snps,dw-apb-timer"; + reg = <0x502F0000 0x100>; + interrupts = <18 19>; + clocks = <&sysclk K210_CLK_TIMER2>, + <&sysclk K210_CLK_APB0>; + clock-names = "timer", "pclk"; + resets = <&sysrst K210_RST_TIMER2>; + status = "disabled"; + }; + }; + + apb1: bus@50400000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "canaan,k210-apb", "simple-pm-bus"; + ranges; + clocks = <&sysclk K210_CLK_APB1>; + + wdt0: watchdog@50400000 { + compatible = "canaan,k210-wdt", "snps,dw-wdt"; + reg = <0x50400000 0x100>; + interrupts = <21>; + clocks = <&sysclk K210_CLK_WDT0>, + <&sysclk K210_CLK_APB1>; + clock-names = "tclk", "pclk"; + resets = <&sysrst K210_RST_WDT0>; + status = "disabled"; + }; + + wdt1: watchdog@50410000 { + compatible = "canaan,k210-wdt", "snps,dw-wdt"; + reg = <0x50410000 0x100>; + interrupts = <22>; + clocks = <&sysclk K210_CLK_WDT1>, + <&sysclk K210_CLK_APB1>; + clock-names = "tclk", "pclk"; + resets = <&sysrst K210_RST_WDT1>; + status = "disabled"; + }; + + otp0: nvmem@50420000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "canaan,k210-otp"; + reg = <0x50420000 0x100>, + <0x88000000 0x20000>; + reg-names = "reg", "mem"; + clocks = <&sysclk K210_CLK_ROM>; + resets = <&sysrst K210_RST_ROM>; + read-only; + status = "disabled"; + + /* Bootloader */ + firmware@00000 { + reg = <0x00000 0xC200>; + }; + + /* + * config string as described in RISC-V + * privileged spec 1.9 + */ + config-1-9@1c000 { + reg = <0x1C000 0x1000>; + }; + + /* + * Device tree containing only registers, + * interrupts, and cpus + */ + fdt@1d000 { + reg = <0x1D000 0x2000>; + }; + + /* CPU/ROM credits */ + credits@1f000 { + reg = <0x1F000 0x1000>; + }; + }; + + dvp0: camera@50430000 { + compatible = "canaan,k210-dvp"; + reg = <0x50430000 0x100>; + interrupts = <24>; + clocks = <&sysclk K210_CLK_DVP>; + resets = <&sysrst K210_RST_DVP>; + canaan,k210-misc-offset = <&sysctl 84>; + status = "disabled"; + }; + + sysctl: syscon@50440000 { + compatible = "canaan,k210-sysctl", + "syscon", "simple-mfd"; + reg = <0x50440000 0x100>; + clocks = <&sysclk K210_CLK_APB1>; + clock-names = "pclk"; + + sysclk: clock-controller { + #clock-cells = <1>; + compatible = "canaan,k210-clk"; + clocks = <&in0>; + }; + + sysrst: reset-controller { + compatible = "canaan,k210-rst"; + #reset-cells = <1>; + }; + + reboot: syscon-reboot { + compatible = "syscon-reboot"; + regmap = <&sysctl>; + offset = <48>; + mask = <1>; + value = <1>; + }; + }; + + aes0: aes@50450000 { + compatible = "canaan,k210-aes"; + reg = <0x50450000 0x100>; + clocks = <&sysclk K210_CLK_AES>; + resets = <&sysrst K210_RST_AES>; + status = "disabled"; + }; + + rtc: rtc@50460000 { + compatible = "canaan,k210-rtc"; + reg = <0x50460000 0x100>; + clocks = <&in0>; + resets = <&sysrst K210_RST_RTC>; + interrupts = <20>; + status = "disabled"; + }; + }; + + apb2: bus@52000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "canaan,k210-apb", "simple-pm-bus"; + ranges; + clocks = <&sysclk K210_CLK_APB2>; + + spi0: spi@52000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "canaan,k210-spi", + "snps,dw-apb-ssi-4.01", + "snps,dw-apb-ssi"; + reg = <0x52000000 0x100>; + interrupts = <1>; + clocks = <&sysclk K210_CLK_SPI0>, + <&sysclk K210_CLK_APB2>; + clock-names = "ssi_clk", "pclk"; + resets = <&sysrst K210_RST_SPI0>; + reset-names = "spi"; + spi-max-frequency = <25000000>; + num-cs = <4>; + reg-io-width = <4>; + status = "disabled"; + }; + + spi1: spi@53000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "canaan,k210-spi", + "snps,dw-apb-ssi-4.01", + "snps,dw-apb-ssi"; + reg = <0x53000000 0x100>; + interrupts = <2>; + clocks = <&sysclk K210_CLK_SPI1>, + <&sysclk K210_CLK_APB2>; + clock-names = "ssi_clk", "pclk"; + resets = <&sysrst K210_RST_SPI1>; + reset-names = "spi"; + spi-max-frequency = <25000000>; + num-cs = <4>; + reg-io-width = <4>; + status = "disabled"; + }; + + spi3: spi@54000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "canaan,k210-ssi", + "snps,dwc-ssi-1.01a"; + reg = <0x54000000 0x200>; + interrupts = <4>; + clocks = <&sysclk K210_CLK_SPI3>, + <&sysclk K210_CLK_APB2>; + 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>; + status = "disabled"; + }; }; }; }; diff --git a/arch/riscv/boot/dts/canaan/k210_generic.dts b/arch/riscv/boot/dts/canaan/k210_generic.dts new file mode 100644 index 000000000000..396c8ca4d24d --- /dev/null +++ b/arch/riscv/boot/dts/canaan/k210_generic.dts @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com> + * Copyright (C) 2020 Western Digital Corporation or its affiliates. + */ + +/dts-v1/; + +#include "k210.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> + +/ { + model = "Kendryte K210 generic"; + compatible = "canaan,kendryte-k210"; + + chosen { + bootargs = "earlycon console=ttySIF0"; + stdout-path = "serial0:115200n8"; + }; +}; + +&fpioa { + pinctrl-0 = <&jtag_pins>; + pinctrl-names = "default"; + status = "okay"; + + jtag_pins: jtag-pinmux { + pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>, + <K210_FPIOA(1, K210_PCF_JTAG_TDI)>, + <K210_FPIOA(2, K210_PCF_JTAG_TMS)>, + <K210_FPIOA(3, K210_PCF_JTAG_TDO)>; + }; + + uarths_pins: uarths-pinmux { + pinmux = <K210_FPIOA(4, K210_PCF_UARTHS_RX)>, + <K210_FPIOA(5, K210_PCF_UARTHS_TX)>; + }; +}; + +&uarths0 { + pinctrl-0 = <&uarths_pins>; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/include/dt-bindings/clock/k210-clk.h b/include/dt-bindings/clock/k210-clk.h index a48176ad3c23..b2de702cbf75 100644 --- a/include/dt-bindings/clock/k210-clk.h +++ b/include/dt-bindings/clock/k210-clk.h @@ -9,7 +9,6 @@ /* * Kendryte K210 SoC clock identifiers (arbitrary values). */ -#define K210_CLK_ACLK 0 #define K210_CLK_CPU 0 #define K210_CLK_SRAM0 1 #define K210_CLK_SRAM1 2