ARM: dts: Add Raspberry Pi Compute Module 4 CANOPi Board
Subsystems (3)
PATCH 1/1 ARM: dts: Add Raspberry Pi Compute Module 4 CANOPi Board
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
[0] https://github.com/boschresearch/kuksa.hardware
--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+) create mode 100644 arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dts
arch/arm/boot/dts/Makefile +1 -0
@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtb
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +139 -0
139 lines not on this page · raw message
arch/arm64/boot/dts/broadcom/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \
arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dts new file +2 -0
@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "arm/bcm2711-rpi-cm4-canopi.dts"
Signature · 1 line
2.37.2
Hi Ariel,
Am 16.09.22 um 17:31 schrieb Ariel D'Alessandro:
Quoted 3 lines
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
this is a cool piece of hardware :-)
Is it correct this baseboard is only intended for Compute Modules without Wifi/BT? Otherwise we get conflicts with UART0. The bcm2711-rpi-cm4.dtsi is currently written for all Compute Module variants. A possible solution is to use delete-node, another cleaner ones is to split bcm2711-rpi-cm4 into wifi and non-wifi variants and include the non-wifi one in your case.
Quoted 48 lines
[0] https://github.com/boschresearch/kuksa.hardware
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+)create mode 100644
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dtscreate mode 100644arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dtsarch/arm/boot/dts/Makefile +1
-0@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtbarch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +17
-0@@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-cm4.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 CANOPi Board"; + + clocks { + clk_mcp251xfd_osc: mcp251xfd-osc { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <20000000>; + }; + }; + + leds { + led-act {
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 27
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; + }; + };
are these LEDs really populated and wired to the BCM2711? The schematics suggests that they are connected to the STN2120.
Quoted 7 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +7
-0+}; + +&ddc0 { + status = "okay"; +}; + +&ddc1 {
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 44
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + +&hdmi1 { + status = "okay"; +};
I cannot see any graphical interface in the schematics. So why they are enabled?
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 52
Quoted 8 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +8
-0+ +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio44>; + status = "okay"; + clock-frequency = <100000>; + + pcf85063a@51 {
Please use the actual function for the node name like rtc@51
Quoted 26 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +26
-0+ compatible = "nxp,pcf85063a"; + reg = <0x51>; + }; +}; + +&pcie0 { + pci@0,0 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + + usb@0,0 { + reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +}; + +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 {
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 88
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ status = "okay"; +}; + +&pixelvalve2 { + status = "okay"; +}; + +&pixelvalve4 { + status = "okay"; +};
Without a graphical interface they shouldn't be necessary?
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 98
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ +&spi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_gpio7>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + dmas = <&dma 6>, <&dma 7>; + dma-names = "tx", "rx"; + + mcp251xfd0: mcp251xfd@0 {
mcp251xfd0: can@0
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 103
Quoted 5 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +5
-0+ compatible = "microchip,mcp251xfd"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd0_pins>; + spi-max-frequency = <20000000>;
I wasn't good at physics, but having spi-max-frequency equal to the oscillator frequency seems wrong. Is it because of the hack in the downstream kernel which halves the SPI frequency?
Just guessing because imx6qp-prtwd3.dts uses 10 MHz.
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 109
Quoted 6 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +6
-0+ interrupt-parent = <&gpio>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; + + mcp251xfd1: mcp251xfd@1 {
mcp251xfd1: can@1
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 121
Quoted 12 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +12
-0+ compatible = "microchip,mcp251xfd"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd1_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <22 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; +}; + +&gpio {
In case there are any GPIOs which should be controlled via user space (like LTE or FAN control), it would be nice to describe them via gpio-line-names.
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 125
Quoted 4 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +4
-0+ mcp251xfd0_pins: mcp251xfd0_pins { + brcm,pins = <27>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + };
The vendor specific pin properties are deprecated for BCM2711. We have generic ones for this:
mcp251xfd0_pins: mcp251xfd0_pins {
pin-irq {
pins = "gpio27";
function = "gpio_in";
};
};
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 130
Quoted 5 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +5
-0+ + mcp251xfd1_pins: mcp251xfd1_pins { + brcm,pins = <22>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + };
dito
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 135
Quoted 5 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +5
-0+}; + +&vc4 { + status = "okay"; +};
I think this is also not necessary for a headless device.
Quoted 24 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +4
-0+ +&vec { + status = "disabled"; +};arch/arm64/boot/dts/broadcom/Makefile +1
-0@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dts new file +2
-0@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "arm/bcm2711-rpi-cm4-canopi.dts"
Hei hei,
Am Fri, Sep 16, 2022 at 12:31:56PM -0300 schrieb Ariel D'Alessandro:
Quoted 51 lines
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
[0] https://github.com/boschresearch/kuksa.hardware
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+) create mode 100644 arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dtsarch/arm/boot/dts/Makefile +1
-0@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtbarch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +17
-0@@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-cm4.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 CANOPi Board"; + + clocks { + clk_mcp251xfd_osc: mcp251xfd-osc { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <20000000>; + }; + }; + + leds { + led-act {
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 27
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; + }; + };
This looks like using the node name and the deprecated "label" property for LED naming. Please see Documentation/devicetree/bindings/leds/common.yaml and use the properties "function" and "color" instead. Also check the node names itself, see the example in that binding or the leds-gpio binding for reference.
Greets
Alex
Quoted 135 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +112
-0+}; + +&ddc0 { + status = "okay"; +}; + +&ddc1 { + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + +&hdmi1 { + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio44>; + status = "okay"; + clock-frequency = <100000>; + + pcf85063a@51 { + compatible = "nxp,pcf85063a"; + reg = <0x51>; + }; +}; + +&pcie0 { + pci@0,0 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + + usb@0,0 { + reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +}; + +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 { + status = "okay"; +}; + +&pixelvalve2 { + status = "okay"; +}; + +&pixelvalve4 { + status = "okay"; +}; + +&spi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_gpio7>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + dmas = <&dma 6>, <&dma 7>; + dma-names = "tx", "rx"; + + mcp251xfd0: mcp251xfd@0 { + compatible = "microchip,mcp251xfd"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd0_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; + + mcp251xfd1: mcp251xfd@1 { + compatible = "microchip,mcp251xfd"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd1_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <22 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; +}; + +&gpio { + mcp251xfd0_pins: mcp251xfd0_pins { + brcm,pins = <27>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; + + mcp251xfd1_pins: mcp251xfd1_pins { + brcm,pins = <22>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; +}; + +&vc4 { + status = "okay"; +}; + +&vec { + status = "disabled"; +};arch/arm64/boot/dts/broadcom/Makefile +1
-0@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dts new file +2
-0@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "arm/bcm2711-rpi-cm4-canopi.dts"Signature · 1 line
2.37.2
Hi Alexander,
[fix address of Krzysztof]
Am 19.09.22 um 09:47 schrieb Alexander Dahl:
Quoted 62 lines
Hei hei,
Am Fri, Sep 16, 2022 at 12:31:56PM -0300 schrieb Ariel D'Alessandro:
Quoted 59 lines
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
[0] https://github.com/boschresearch/kuksa.hardware
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+)create mode 100644
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dtscreate mode 100644arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dtsarch/arm/boot/dts/Makefile +1
-0@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtbarch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +25
-0@@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-cm4.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 CANOPi Board"; + + clocks { + clk_mcp251xfd_osc: mcp251xfd-osc { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <20000000>; + }; + }; + + leds { + led-act { + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on";
Quoted 8 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 27
Quoted 2 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +2
-0+ }; + };This looks like using the node name and the deprecated "label" property for LED naming. Please see
Documentation/devicetree/bindings/leds/common.yamland use the properties "function" and "color" instead. Also check the node names itself, see the example in that binding or the leds-gpio binding for reference.
Oops, i didn't noticed this.
Unfortunately the ACT-LED is already a little bit opaque defined in bcm2835-rpi.dtsi:
leds {
compatible = "gpio-leds";
led-act {
label = "ACT";
default-state = "keep";
linux,default-trigger = "heartbeat";
};
};
So a reference (currently missing) would have make it clear that the ACT-LED is common for all Raspberry Pi boards.
So you wish that this is fixed for the CANOPi board or all Raspberry Pi boards?
I'm asking because switching to function would change the sysfs path and breaking userspace ABI.
Quoted 139 lines
Greets
AlexQuoted 135 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +112
-0+}; + +&ddc0 { + status = "okay"; +}; + +&ddc1 { + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + +&hdmi1 { + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio44>; + status = "okay"; + clock-frequency = <100000>; + + pcf85063a@51 { + compatible = "nxp,pcf85063a"; + reg = <0x51>; + }; +}; + +&pcie0 { + pci@0,0 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + + usb@0,0 { + reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +}; + +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 { + status = "okay"; +}; + +&pixelvalve2 { + status = "okay"; +}; + +&pixelvalve4 { + status = "okay"; +}; + +&spi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_gpio7>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + dmas = <&dma 6>, <&dma 7>; + dma-names = "tx", "rx"; + + mcp251xfd0: mcp251xfd@0 { + compatible = "microchip,mcp251xfd"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd0_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; + + mcp251xfd1: mcp251xfd@1 { + compatible = "microchip,mcp251xfd"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd1_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <22 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; +}; + +&gpio { + mcp251xfd0_pins: mcp251xfd0_pins { + brcm,pins = <27>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; + + mcp251xfd1_pins: mcp251xfd1_pins { + brcm,pins = <22>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; +}; + +&vc4 { + status = "okay"; +}; + +&vec { + status = "disabled"; +};arch/arm64/boot/dts/broadcom/Makefile +1
-0@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dts new file +2
-0@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "arm/bcm2711-rpi-cm4-canopi.dts"Signature · 1 line
2.37.2
Hello Stefan,
Am Mon, Sep 19, 2022 at 01:18:21PM +0200 schrieb Stefan Wahren:
Quoted 91 lines
Hi Alexander,
[fix address of Krzysztof]
Am 19.09.22 um 09:47 schrieb Alexander Dahl:
Quoted 62 lines
Hei hei,
Am Fri, Sep 16, 2022 at 12:31:56PM -0300 schrieb Ariel D'Alessandro:
Quoted 59 lines
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
[0] https://github.com/boschresearch/kuksa.hardware
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+)create mode 100644
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dtscreate mode 100644arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dtsarch/arm/boot/dts/Makefile +1
-0@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtbarch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +25
-0@@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-cm4.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 CANOPi Board"; + + clocks { + clk_mcp251xfd_osc: mcp251xfd-osc { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <20000000>; + }; + }; + + leds { + led-act { + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on";Quoted 8 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 27
Quoted 2 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +2
-0+ }; + };This looks like using the node name and the deprecated "label" property for LED naming. Please see
Documentation/devicetree/bindings/leds/common.yamland use the properties "function" and "color" instead. Also check the node names itself, see the example in that binding or the leds-gpio binding for reference.Oops, i didn't noticed this.
Unfortunately the ACT-LED is already a little bit opaque defined in
bcm2835-rpi.dtsi:leds {
compatible = "gpio-leds";led-act {
label = "ACT";
default-state = "keep";
linux,default-trigger = "heartbeat";
};
};
Quoted 2 lines
So a reference (currently missing) would have make it clear that the ACT-LED is common for all Raspberry Pi boards.
Yes, a reference would probably good, would make it easier to spot this is already defined in the dtsi.
Quoted 5 lines
So you wish that this is fixed for the CANOPi board or all Raspberry Pi boards?
I'm asking because switching to function would change the sysfs path and breaking userspace ABI.
You're right, and the effective label should stay as is for existing boards to not break userspace.
Not sure what the policy is for baseboards with compute modules. Are those LEDs on the compute module? Or does the CM just expose those GPIOs? Is there some policy all baseboards must use them for LEDs? An what about additional LEDs on the baseboard? Is this allowed? (I don't think there a generic rules for that, but maybe some best practices for certain SoMs like the RPi CM?)
IMHO for new independent boards though, new LEDs should not be introduced the old way. I thought this is the case here, but it seems I was wrong due to that baseboard vs. SoM thing.
Greets
Alex
Quoted 140 lines
Quoted 140 lines
Greets
AlexQuoted 135 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +112
-0+}; + +&ddc0 { + status = "okay"; +}; + +&ddc1 { + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + +&hdmi1 { + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio44>; + status = "okay"; + clock-frequency = <100000>; + + pcf85063a@51 { + compatible = "nxp,pcf85063a"; + reg = <0x51>; + }; +}; + +&pcie0 { + pci@0,0 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + + usb@0,0 { + reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +}; + +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 { + status = "okay"; +}; + +&pixelvalve2 { + status = "okay"; +}; + +&pixelvalve4 { + status = "okay"; +}; + +&spi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_gpio7>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; + dmas = <&dma 6>, <&dma 7>; + dma-names = "tx", "rx"; + + mcp251xfd0: mcp251xfd@0 { + compatible = "microchip,mcp251xfd"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd0_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; + + mcp251xfd1: mcp251xfd@1 { + compatible = "microchip,mcp251xfd"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd1_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <22 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; +}; + +&gpio { + mcp251xfd0_pins: mcp251xfd0_pins { + brcm,pins = <27>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; + + mcp251xfd1_pins: mcp251xfd1_pins { + brcm,pins = <22>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; +}; + +&vc4 { + status = "okay"; +}; + +&vec { + status = "disabled"; +};arch/arm64/boot/dts/broadcom/Makefile +1
-0@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dts new file +2
-0@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "arm/bcm2711-rpi-cm4-canopi.dts"Signature · 1 line
2.37.2
Hi Alexander,
Am 20.09.22 um 10:31 schrieb Alexander Dahl:
Quoted 93 lines
Hello Stefan,
Am Mon, Sep 19, 2022 at 01:18:21PM +0200 schrieb Stefan Wahren:
Quoted 90 lines
Hi Alexander,
[fix address of Krzysztof]
Am 19.09.22 um 09:47 schrieb Alexander Dahl:
Quoted 62 lines
Hei hei,
Am Fri, Sep 16, 2022 at 12:31:56PM -0300 schrieb Ariel D'Alessandro:
Quoted 59 lines
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
[0] https://github.com/boschresearch/kuksa.hardware
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+)create mode 100644
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dtscreate mode 100644arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dtsarch/arm/boot/dts/Makefile +1
-0@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtbarch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +25
-0@@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-cm4.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 CANOPi Board"; + + clocks { + clk_mcp251xfd_osc: mcp251xfd-osc { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <20000000>; + }; + }; + + leds { + led-act { + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on";Quoted 8 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 27
Quoted 2 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +2
-0+ }; + };This looks like using the node name and the deprecated "label" property for LED naming. Please see
Documentation/devicetree/bindings/leds/common.yamland use the properties "function" and "color" instead. Also check the node names itself, see the example in that binding or the leds-gpio binding for reference.Oops, i didn't noticed this.
Unfortunately the ACT-LED is already a little bit opaque defined in
bcm2835-rpi.dtsi:leds {
compatible = "gpio-leds";led-act {
label = "ACT";
default-state = "keep";
linux,default-trigger = "heartbeat";
};
};
Quoted 4 lines
Quoted 2 lines
So a reference (currently missing) would have make it clear that the ACT-LED is common for all Raspberry Pi boards.
Yes, a reference would probably good, would make it easier to spot this is already defined in the dtsi.
I will take care of this.
Quoted 4 lines
Quoted 4 lines
So you wish that this is fixed for the CANOPi board or all Raspberry Pi boards?
Quoted 8 lines
Quoted 2 lines
I'm asking because switching to function would change the sysfs path and breaking userspace ABI.
You're right, and the effective label should stay as is for existing boards to not break userspace.
Not sure what the policy is for baseboards with compute modules. Are those LEDs on the compute module? Or does the CM just expose those GPIOs?
These are GPIOs expose by the Compute Module. Since these are initialized by the VC4 firmware, it's not the best idea to use them for other functions.
Quoted 2 lines
Is there some policy all baseboards must use them for LEDs?
An what about additional LEDs on the baseboard? Is this allowed?
Definitely
Quoted 2 lines
(I don't think there a generic rules for that, but maybe some best practices for certain SoMs like the RPi CM?)
I think we should for Ariel's reponse.
Quoted 3 lines
IMHO for new independent boards though, new LEDs should not be introduced the old way. I thought this is the case here, but it seems I was wrong due to that baseboard vs. SoM thing.
Without your comment i hadn't noticed this :-)
I'm thinking of a dtsi file in order to encapsulate the deprecated LED stuff, remove the global ACT-LED from bcm2835-rpi.dtsi and include the dtsi from all board files.
Best regards
Quoted 34 lines · Ariel D'Alessandro
The Eclipse KUKSA CANOPi [0] is a baseboard for the Raspberry Compute Module 4 (CM4). It contains a VIA VL805 4 Port USB controller and two MCP251xFD based CAN-FD interfaces.
[0] https://github.com/boschresearch/kuksa.hardware
Signed-off-by Ariel D'Alessandro <[email protected]>--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts | 139 ++++++++++++++++++ arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2711-rpi-cm4-canopi.dts | 2 + 4 files changed, 143 insertions(+) create mode 100644 arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-canopi.dtsarch/arm/boot/dts/Makefile +1
-0@@ -98,6 +98,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-zero-2-w.dtb \ bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-canopi.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtbarch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +0
-0
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 6
Quoted 6 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +6
-0@@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-cm4.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 CANOPi Board";
Where is the compatible?
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 9
Quoted 3 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +3
-0+ + clocks { + clk_mcp251xfd_osc: mcp251xfd-osc {
Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 16
Quoted 7 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +7
-0+ #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <20000000>; + }; + }; + + leds {
This does not look valid.
Does not look like you tested the DTS against bindings. Please run make dtbs_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions).
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 18
Quoted 2 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +2
-0+ led-act { + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
What about the rest? Why only gpios? Does it pass dtbs_check?
Quoted 24 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +24
-0+ }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; + }; + }; +}; + +&ddc0 { + status = "okay"; +}; + +&ddc1 { + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + +&hdmi1 {
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 52
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio44>; + status = "okay"; + clock-frequency = <100000>; + + pcf85063a@51 {
Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Quoted 32 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +32
-0+ compatible = "nxp,pcf85063a"; + reg = <0x51>; + }; +}; + +&pcie0 { + pci@0,0 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + + usb@0,0 { + reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +}; + +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 { + status = "okay"; +}; + +&pixelvalve2 { + status = "okay"; +};
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 94
Quoted 10 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +10
-0+ +&pixelvalve4 { + status = "okay"; +}; + +&spi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_gpio7>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
Use GPIO flags/defines. This applies everywhere.
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 98
Quoted 4 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +4
-0+ dmas = <&dma 6>, <&dma 7>; + dma-names = "tx", "rx"; + + mcp251xfd0: mcp251xfd@0 {
Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 109
Quoted 11 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +11
-0+ compatible = "microchip,mcp251xfd"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd0_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; + + mcp251xfd1: mcp251xfd@1 {
Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 122
Quoted 13 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +13
-0+ compatible = "microchip,mcp251xfd"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&mcp251xfd1_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <22 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clk_mcp251xfd_osc>; + }; +}; + +&gpio { + mcp251xfd0_pins: mcp251xfd0_pins {
No underscores in node names.
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 127
Quoted 5 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +5
-0+ brcm,pins = <27>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; + + mcp251xfd1_pins: mcp251xfd1_pins {
Ditto
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 139
Quoted 12 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +12
-0+ brcm,pins = <22>; + brcm,function = <BCM2835_FSEL_GPIO_IN>; + }; +}; + +&vc4 { + status = "okay"; +}; + +&vec { + status = "disabled"; +};
Best regards,
Krzysztof
Hi!
Quoted 6 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts line 26
Quoted 6 lines
arch/arm/boot/dts/bcm2711-rpi-cm4-canopi.dts new file +6
-0+ led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; + };
NAK on the label, see/modify well-known-leds.txt.