2021-07-20 14:28:59

by Aswath Govindraju

[permalink] [raw]
Subject: [PATCH 0/6] CAN: Add support for CAN in AM65,J721e and AM64

The following series of patches add support for CAN in SoC's AM65, J721e
and AM64.

This patch series is dependent on [1] and I have requested for a immutable
tag from the Marc Kleine-Budde(maintainer of net tree).

[1] - https://lore.kernel.org/patchwork/project/lkml/list/?series=498360&state=%2A&archive=both

Aswath Govindraju (3):
arm64: dts: ti: am654-base-board: Disable mcan nodes
arm64: dts: ti: k3-am64-main: Add support for MCAN
arm64: dts: ti: k3-am642-evm/sk: Add support for main domain mcan
nodes in EVM and disable them on SK

Faiz Abbas (3):
arm64: dts: ti: k3-am65-mcu: Add Support for MCAN
arm64: dts: ti: k3-j721e: Add support for MCAN nodes
arm64: dts: ti: k3-j721e-common-proc-board: Add support for mcu_mcan
nodes

arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 28 +++
arch/arm64/boot/dts/ti/k3-am642-evm.dts | 40 ++++
arch/arm64/boot/dts/ti/k3-am642-sk.dts | 8 +
arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi | 30 +++
.../arm64/boot/dts/ti/k3-am654-base-board.dts | 8 +
.../dts/ti/k3-j721e-common-proc-board.dts | 116 +++++++++++
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 196 ++++++++++++++++++
.../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi | 28 +++
8 files changed, 454 insertions(+)

--
2.17.1


2021-07-20 14:29:27

by Aswath Govindraju

[permalink] [raw]
Subject: [PATCH 1/6] arm64: dts: ti: k3-am65-mcu: Add Support for MCAN

From: Faiz Abbas <[email protected]>

Add Support for two MCAN controllers present on the am65x SOC. Both support
classic CAN messages as well as CAN-FD.

Signed-off-by: Faiz Abbas <[email protected]>
Signed-off-by: Aswath Govindraju <[email protected]>
---
arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi | 30 +++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
index c93ff1520a0e..f8fff0a5b127 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
@@ -159,6 +159,36 @@
};
};

+ m_can0: mcan@40528000 {
+ compatible = "bosch,m_can";
+ reg = <0x0 0x40528000 0x0 0x400>,
+ <0x0 0x40500000 0x0 0x4400>;
+ reg-names = "m_can", "message_ram";
+ power-domains = <&k3_pds 102 TI_SCI_PD_EXCLUSIVE>;
+ clocks = <&k3_clks 102 0>, <&k3_clks 102 5>;
+ clock-names = "cclk", "hclk";
+ interrupt-parent = <&gic500>;
+ interrupts = <GIC_SPI 544 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 545 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "int0", "int1";
+ bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
+ };
+
+ m_can1: mcan@40568000 {
+ compatible = "bosch,m_can";
+ reg = <0x0 0x40568000 0x0 0x400>,
+ <0x0 0x40540000 0x0 0x4400>;
+ reg-names = "m_can", "message_ram";
+ power-domains = <&k3_pds 103 TI_SCI_PD_EXCLUSIVE>;
+ clocks = <&k3_clks 103 0>, <&k3_clks 103 5>;
+ clock-names = "cclk", "hclk";
+ interrupt-parent = <&gic500>;
+ interrupts = <GIC_SPI 547 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 548 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "int0", "int1";
+ bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
+ };
+
fss: fss@47000000 {
compatible = "simple-bus";
#address-cells = <2>;
--
2.17.1

2021-07-20 14:29:27

by Aswath Govindraju

[permalink] [raw]
Subject: [PATCH 4/6] arm64: dts: ti: k3-j721e-common-proc-board: Add support for mcu_mcan nodes

From: Faiz Abbas <[email protected]>

Add two MCAN nodes present on the common processor board and set a
maximum data rate of 5 Mbps. Disable all other nodes for now.

Signed-off-by: Faiz Abbas <[email protected]>
Signed-off-by: Aswath Govindraju <[email protected]>
---
.../dts/ti/k3-j721e-common-proc-board.dts | 116 ++++++++++++++++++
1 file changed, 116 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
index 8bd02d9e28ad..d40e282325c9 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
+++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
@@ -109,6 +109,25 @@
"cpb-codec-scki",
"cpb-codec-scki-48000", "cpb-codec-scki-44100";
};
+
+ transceiver1: can-phy0 {
+ compatible = "ti,tcan1043";
+ #phy-cells = <0>;
+ max-bitrate = <5000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&mcu_mcan0_gpio_pins_default>;
+ standby-gpios = <&wkup_gpio0 54 GPIO_ACTIVE_LOW>;
+ enable-gpios = <&wkup_gpio0 0 GPIO_ACTIVE_HIGH>;
+ };
+
+ transceiver2: can-phy1 {
+ compatible = "ti,tcan1042";
+ #phy-cells = <0>;
+ max-bitrate = <5000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&mcu_mcan1_gpio_pins_default>;
+ standby-gpios = <&wkup_gpio0 2 GPIO_ACTIVE_HIGH>;
+ };
};

&main_pmx0 {
@@ -249,6 +268,33 @@
J721E_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* MCU_MDIO0_MDIO */
>;
};
+
+ mcu_mcan0_pins_default: mcu-mcan0-pins-default {
+ pinctrl-single,pins = <
+ J721E_WKUP_IOPAD(0xac, PIN_INPUT, 0) /* (C29) MCU_MCAN0_RX */
+ J721E_WKUP_IOPAD(0xa8, PIN_OUTPUT, 0) /* (D29) MCU_MCAN0_TX */
+ >;
+ };
+
+ mcu_mcan0_gpio_pins_default: mcu-mcan0-gpio-pins-default {
+ pinctrl-single,pins = <
+ J721E_WKUP_IOPAD(0xb0, PIN_INPUT, 7) /* (F26) WKUP_GPIO0_0 */
+ J721E_WKUP_IOPAD(0x98, PIN_INPUT, 7) /* (E28) MCU_SPI0_D1.WKUP_GPIO0_54 */
+ >;
+ };
+
+ mcu_mcan1_pins_default: mcu-mcan1-pins-default {
+ pinctrl-single,pins = <
+ J721E_WKUP_IOPAD(0xc4, PIN_INPUT, 0) /* (G24) WKUP_GPIO0_5.MCU_MCAN1_RX */
+ J721E_WKUP_IOPAD(0xc0, PIN_OUTPUT, 0) /* (G25) WKUP_GPIO0_4.MCU_MCAN1_TX */
+ >;
+ };
+
+ mcu_mcan1_gpio_pins_default: mcu-mcan1-gpio-pins-default {
+ pinctrl-single,pins = <
+ J721E_WKUP_IOPAD(0xb8, PIN_INPUT, 7) /* (F28) WKUP_GPIO0_2 */
+ >;
+ };
};

&wkup_uart0 {
@@ -770,3 +816,73 @@
&icssg1_mdio {
status = "disabled";
};
+
+&mcu_mcan0 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mcu_mcan0_pins_default>;
+ phys = <&transceiver1>;
+};
+
+&mcu_mcan1 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mcu_mcan1_pins_default>;
+ phys = <&transceiver2>;
+};
+
+&main_mcan0 {
+ status = "disabled";
+};
+
+&main_mcan1 {
+ status = "disabled";
+};
+
+&main_mcan2 {
+ status = "disabled";
+};
+
+&main_mcan3 {
+ status = "disabled";
+};
+
+&main_mcan4 {
+ status = "disabled";
+};
+
+&main_mcan5 {
+ status = "disabled";
+};
+
+&main_mcan6 {
+ status = "disabled";
+};
+
+&main_mcan7 {
+ status = "disabled";
+};
+
+&main_mcan8 {
+ status = "disabled";
+};
+
+&main_mcan9 {
+ status = "disabled";
+};
+
+&main_mcan10 {
+ status = "disabled";
+};
+
+&main_mcan11 {
+ status = "disabled";
+};
+
+&main_mcan12 {
+ status = "disabled";
+};
+
+&main_mcan13 {
+ status = "disabled";
+};
--
2.17.1

2021-07-20 14:39:43

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH 1/6] arm64: dts: ti: k3-am65-mcu: Add Support for MCAN

On 20.07.2021 19:46:37, Aswath Govindraju wrote:
> From: Faiz Abbas <[email protected]>
>
> Add Support for two MCAN controllers present on the am65x SOC. Both support
> classic CAN messages as well as CAN-FD.

Thanks for the patch!

Why don't you disable the CAN cores by default in the dtsi?

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


Attachments:
(No filename) (593.00 B)
signature.asc (499.00 B)
Download all attachments

2021-07-20 14:52:52

by Aswath Govindraju

[permalink] [raw]
Subject: Re: [PATCH 1/6] arm64: dts: ti: k3-am65-mcu: Add Support for MCAN

Hi Marc,

On 20/07/21 7:50 pm, Marc Kleine-Budde wrote:
> On 20.07.2021 19:46:37, Aswath Govindraju wrote:
>> From: Faiz Abbas <[email protected]>
>>
>> Add Support for two MCAN controllers present on the am65x SOC. Both support
>> classic CAN messages as well as CAN-FD.
>
> Thanks for the patch!
>
> Why don't you disable the CAN cores by default in the dtsi?

As far as I know, in the dtsi file we mention all the subsystems or
periherals present in the SoC and in the specific board dts file we
enable or disable the DT nodes depending on whether the pins are
brought out.

Thanks,
Aswath

>
> regards,
> Marc
>

2021-07-20 14:56:08

by Nishanth Menon

[permalink] [raw]
Subject: Re: [PATCH 1/6] arm64: dts: ti: k3-am65-mcu: Add Support for MCAN

On 20:00-20210720, Aswath Govindraju wrote:
> Hi Marc,
>
> On 20/07/21 7:50 pm, Marc Kleine-Budde wrote:
> > On 20.07.2021 19:46:37, Aswath Govindraju wrote:
> >> From: Faiz Abbas <[email protected]>
> >>
> >> Add Support for two MCAN controllers present on the am65x SOC. Both support
> >> classic CAN messages as well as CAN-FD.
> >
> > Thanks for the patch!
> >
> > Why don't you disable the CAN cores by default in the dtsi?
>
> As far as I know, in the dtsi file we mention all the subsystems or
> periherals present in the SoC and in the specific board dts file we
> enable or disable the DT nodes depending on whether the pins are
> brought out.


There is a long history on this. You should be able to look the
discussion up in lore archives. The nutshell is the dtsi files should
maintain DT standard which is "default, status if not explicitly
provided is enabled" and the board dts files will explicitly disable
OR reserve the nodes that are not pinned out / used / reserved (due to
firmware usage) etc. There is the entire string parsing, size arguments
that run around this topic, but, anyways.

--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D

2021-07-20 15:09:47

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH 1/6] arm64: dts: ti: k3-am65-mcu: Add Support for MCAN

On 20.07.2021 20:00:32, Aswath Govindraju wrote:
> Hi Marc,
>
> On 20/07/21 7:50 pm, Marc Kleine-Budde wrote:
> > On 20.07.2021 19:46:37, Aswath Govindraju wrote:
> >> From: Faiz Abbas <[email protected]>
> >>
> >> Add Support for two MCAN controllers present on the am65x SOC. Both support
> >> classic CAN messages as well as CAN-FD.
> >
> > Thanks for the patch!
> >
> > Why don't you disable the CAN cores by default in the dtsi?
>
> As far as I know, in the dtsi file we mention all the subsystems or
> periherals present in the SoC and in the specific board dts file we
> enable or disable the DT nodes depending on whether the pins are
> brought out.

If you disable the subsystems (that need pins) by default, you only have
to list and configure only the used subsystems and not disable the
unused ones. But it seems in the TI land you're following the rule you
outlined above, so go ahead.

Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


Attachments:
(No filename) (1.18 kB)
signature.asc (499.00 B)
Download all attachments