Skip to contentSkip to conversation

arm64: dts: qcom: db845c: Add support for MCP2517FD

PATCH Superseded Vinod Koul 2 participants 3 messages Apr 19, 2022 – Apr 21, 2022

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH v2 1/1 arm64: dts: qcom: db845c: Add support for MCP2517FD

Add support for onboard MCP2517FD SPI CAN transceiver attached to SPI0 of RB3.

---
Changes in v2:
- add cs and pinctrl config
- remove misleading comment

 arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +33 -0
index 28fe45c5d516..4f4d45be93e3 100644
@@ -28,6 +28,13 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	/* Fixed crystal oscillator dedicated to MCP2517FD */
+	clk40M: can_clock {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <40000000>;
+	};
+
 	dc12v: dc12v-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "DC12V";
@@ -746,6 +753,24 @@ codec {
 	};
 };
 
+&spi0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&qup_spi0_default>;
+	cs-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>;
+
+	can@0 {
+		compatible = "microchip,mcp2517fd";
+		reg = <0>;
+		clocks = <&clk40M>;
+		interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
+		spi-max-frequency = <10000000>;
+		vdd-supply = <&vdc_5v>;
+		xceiver-supply = <&vdc_5v>;
+		status = "okay";
+	};
+};
+
 &spi2 {
 	/* On Low speed expansion */
 	label = "LS-SPI0";
@@ -1219,3 +1244,11 @@ ov7251_ep: endpoint {
 		};
 	};
 };
+
+/* PINCTRL - additions to nodes defined in sdm845.dtsi */
+&qup_spi0_default {
+	config {
+		drive-strength = <6>;
+		bias-disable;
+	};
+};
Signature · 1 line
2.34.1
#1 lore raw
Quoted 17 lines · Vinod Koul

Add support for onboard MCP2517FD SPI CAN transceiver attached to SPI0 of RB3.

---
Changes in v2:
- add cs and pinctrl config
- remove misleading comment

 arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +0 -0
index 28fe45c5d516..4f4d45be93e3 100644

arch/arm64/boot/dts/qcom/sdm845-db845c.dts chosen { · line 32

Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +2 -0
@@ -28,6 +28,13 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	/* Fixed crystal oscillator dedicated to MCP2517FD */
+	clk40M: can_clock {

No underscores in node names.

Quoted 17 lines
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +10 -0
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <40000000>;
+	};
+
 	dc12v: dc12v-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "DC12V";
@@ -746,6 +753,24 @@ codec {
 	};
 };
 
+&spi0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&qup_spi0_default>;
+	cs-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>;

arch/arm64/boot/dts/qcom/sdm845-db845c.dts codec { · line 770

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +10 -0
+
+	can@0 {
+		compatible = "microchip,mcp2517fd";
+		reg = <0>;
+		clocks = <&clk40M>;
+		interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
+		spi-max-frequency = <10000000>;
+		vdd-supply = <&vdc_5v>;
+		xceiver-supply = <&vdc_5v>;
+		status = "okay";

No need for status for new nodes (unless it is an extension of existing node?), it is okay by default.

Best regards,
Krzysztof

author
#2 lore raw
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Vinod Koul

Add support for onboard MCP2517FD SPI CAN transceiver attached to SPI0 of RB3.

---
Changes in v2:
- add cs and pinctrl config
- remove misleading comment

 arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +0 -0
index 28fe45c5d516..4f4d45be93e3 100644
@@ -28,6 +28,13 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
Quoted 4 lines

arch/arm64/boot/dts/qcom/sdm845-db845c.dts chosen { · line 32

Quoted 2 lines
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +2 -0
+	/* Fixed crystal oscillator dedicated to MCP2517FD */
+	clk40M: can_clock {

No underscores in node names.

right, will patch up the original source as well :D

Quoted 23 lines
Quoted 23 lines
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +15 -0
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <40000000>;
+	};
+
 	dc12v: dc12v-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "DC12V";
@@ -746,6 +753,24 @@ codec {
 	};
 };
 
+&spi0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&qup_spi0_default>;
+	cs-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>;
+
+	can@0 {
+		compatible = "microchip,mcp2517fd";
+		reg = <0>;
+		clocks = <&clk40M>;
Quoted 8 lines

arch/arm64/boot/dts/qcom/sdm845-db845c.dts codec { · line 770

Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +5 -0
+		interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
+		spi-max-frequency = <10000000>;
+		vdd-supply = <&vdc_5v>;
+		xceiver-supply = <&vdc_5v>;
+		status = "okay";

No need for status for new nodes (unless it is an extension of existing node?), it is okay by default.

Yep

Signature · 1 line
~Vinod