diff mbox series

[10/13] arm64: dts: freescale: imx93-phyboard-segin: Add CAN support

Message ID 20250410090251.1103979-11-primoz.fiser@norik.com (mailing list archive)
State New
Headers show
Series Update PHYTEC i.MX93 DTS | expand

Commit Message

Primoz Fiser April 10, 2025, 9:02 a.m. UTC
Add support for CAN networking on phyBOARD-Segin-i.MX93 via the flexcan1
interface. The CAN1_EN regulator enables the SN65HVD234 CAN transceiver
chip.

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
---
 .../dts/freescale/imx93-phyboard-segin.dts    | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Frank Li April 10, 2025, 3:23 p.m. UTC | #1
On Thu, Apr 10, 2025 at 11:02:48AM +0200, Primoz Fiser wrote:
> Add support for CAN networking on phyBOARD-Segin-i.MX93 via the flexcan1
> interface. The CAN1_EN regulator enables the SN65HVD234 CAN transceiver
> chip.

Can you use drivers/phy/phy-can-transceiver.c to enable CAN phy instead
of use hacked regulator-flexcan1-en.

Frank

>
> Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
> ---
>  .../dts/freescale/imx93-phyboard-segin.dts    | 32 +++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
> index 38b89398e646..027a34dbaf04 100644
> --- a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
> +++ b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
> @@ -26,6 +26,17 @@ chosen {
>  		stdout-path = &lpuart1;
>  	};
>
> +	reg_flexcan1_en: regulator-flexcan1-en {
> +		compatible = "regulator-fixed";
> +		enable-active-high;
> +		gpio = <&gpio4 16 GPIO_ACTIVE_HIGH>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&pinctrl_reg_flexcan1_en>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-min-microvolt = <3300000>;
> +		regulator-name = "CAN1_EN";
> +	};
> +
>  	reg_usdhc2_vmmc: regulator-usdhc2 {
>  		compatible = "regulator-fixed";
>  		enable-active-high;
> @@ -38,6 +49,14 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
>  	};
>  };
>
> +/* CAN */
> +&flexcan1 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_flexcan1>;
> +	xceiver-supply = <&reg_flexcan1_en>;
> +	status = "okay";
> +};
> +
>  /* I2C2 */
>  &lpi2c2 {
>  	clock-frequency = <400000>;
> @@ -79,6 +98,19 @@ &usdhc2 {
>  };
>
>  &iomuxc {
> +	pinctrl_flexcan1: flexcan1grp {
> +		fsl,pins = <
> +			MX93_PAD_PDM_BIT_STREAM0__CAN1_RX	0x139e
> +			MX93_PAD_PDM_CLK__CAN1_TX		0x139e
> +		>;
> +	};
> +
> +	pinctrl_reg_flexcan1_en: regflexcan1engrp {
> +		fsl,pins = <
> +			MX93_PAD_ENET2_TD3__GPIO4_IO16		0x31e
> +		>;
> +	};
> +
>  	pinctrl_lpi2c2: lpi2c2grp {
>  		fsl,pins = <
>  			MX93_PAD_I2C2_SCL__LPI2C2_SCL		0x40000b9e
> --
> 2.34.1
>
Primoz Fiser April 11, 2025, 8:08 a.m. UTC | #2
Hi Frank,

On 10. 04. 25 17:23, Frank Li wrote:
> On Thu, Apr 10, 2025 at 11:02:48AM +0200, Primoz Fiser wrote:
>> Add support for CAN networking on phyBOARD-Segin-i.MX93 via the flexcan1
>> interface. The CAN1_EN regulator enables the SN65HVD234 CAN transceiver
>> chip.
> 
> Can you use drivers/phy/phy-can-transceiver.c to enable CAN phy instead
> of use hacked regulator-flexcan1-en.

Sorry can't do.

This doesn't align with other i.MX PHYTEC products using flexcan such as
imx8mp-phyboard-pollux-rdk.dts.

Even the i.MX93 EVK uses the same mechanism.

BR,
Primoz


> 
> Frank
> 
>>
>> Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
>> ---
>>  .../dts/freescale/imx93-phyboard-segin.dts    | 32 +++++++++++++++++++
>>  1 file changed, 32 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
>> index 38b89398e646..027a34dbaf04 100644
>> --- a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
>> +++ b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
>> @@ -26,6 +26,17 @@ chosen {
>>  		stdout-path = &lpuart1;
>>  	};
>>
>> +	reg_flexcan1_en: regulator-flexcan1-en {
>> +		compatible = "regulator-fixed";
>> +		enable-active-high;
>> +		gpio = <&gpio4 16 GPIO_ACTIVE_HIGH>;
>> +		pinctrl-names = "default";
>> +		pinctrl-0 = <&pinctrl_reg_flexcan1_en>;
>> +		regulator-max-microvolt = <3300000>;
>> +		regulator-min-microvolt = <3300000>;
>> +		regulator-name = "CAN1_EN";
>> +	};
>> +
>>  	reg_usdhc2_vmmc: regulator-usdhc2 {
>>  		compatible = "regulator-fixed";
>>  		enable-active-high;
>> @@ -38,6 +49,14 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
>>  	};
>>  };
>>
>> +/* CAN */
>> +&flexcan1 {
>> +	pinctrl-names = "default";
>> +	pinctrl-0 = <&pinctrl_flexcan1>;
>> +	xceiver-supply = <&reg_flexcan1_en>;
>> +	status = "okay";
>> +};
>> +
>>  /* I2C2 */
>>  &lpi2c2 {
>>  	clock-frequency = <400000>;
>> @@ -79,6 +98,19 @@ &usdhc2 {
>>  };
>>
>>  &iomuxc {
>> +	pinctrl_flexcan1: flexcan1grp {
>> +		fsl,pins = <
>> +			MX93_PAD_PDM_BIT_STREAM0__CAN1_RX	0x139e
>> +			MX93_PAD_PDM_CLK__CAN1_TX		0x139e
>> +		>;
>> +	};
>> +
>> +	pinctrl_reg_flexcan1_en: regflexcan1engrp {
>> +		fsl,pins = <
>> +			MX93_PAD_ENET2_TD3__GPIO4_IO16		0x31e
>> +		>;
>> +	};
>> +
>>  	pinctrl_lpi2c2: lpi2c2grp {
>>  		fsl,pins = <
>>  			MX93_PAD_I2C2_SCL__LPI2C2_SCL		0x40000b9e
>> --
>> 2.34.1
>>
Frank Li April 11, 2025, 2:30 p.m. UTC | #3
On Fri, Apr 11, 2025 at 10:08:21AM +0200, Primoz Fiser wrote:
> Hi Frank,
>
> On 10. 04. 25 17:23, Frank Li wrote:
> > On Thu, Apr 10, 2025 at 11:02:48AM +0200, Primoz Fiser wrote:
> >> Add support for CAN networking on phyBOARD-Segin-i.MX93 via the flexcan1
> >> interface. The CAN1_EN regulator enables the SN65HVD234 CAN transceiver
> >> chip.
> >
> > Can you use drivers/phy/phy-can-transceiver.c to enable CAN phy instead
> > of use hacked regulator-flexcan1-en.
>
> Sorry can't do.
>
> This doesn't align with other i.MX PHYTEC products using flexcan such as
> imx8mp-phyboard-pollux-rdk.dts.
>
> Even the i.MX93 EVK uses the same mechanism.

I think previous method is NOT good enough. Suggest involve CAN and PHY
maintainer to discuss these.

Frank

>
> BR,
> Primoz
>
>
> >
> > Frank
> >
> >>
> >> Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
> >> ---
> >>  .../dts/freescale/imx93-phyboard-segin.dts    | 32 +++++++++++++++++++
> >>  1 file changed, 32 insertions(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
> >> index 38b89398e646..027a34dbaf04 100644
> >> --- a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
> >> +++ b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
> >> @@ -26,6 +26,17 @@ chosen {
> >>  		stdout-path = &lpuart1;
> >>  	};
> >>
> >> +	reg_flexcan1_en: regulator-flexcan1-en {
> >> +		compatible = "regulator-fixed";
> >> +		enable-active-high;
> >> +		gpio = <&gpio4 16 GPIO_ACTIVE_HIGH>;
> >> +		pinctrl-names = "default";
> >> +		pinctrl-0 = <&pinctrl_reg_flexcan1_en>;
> >> +		regulator-max-microvolt = <3300000>;
> >> +		regulator-min-microvolt = <3300000>;
> >> +		regulator-name = "CAN1_EN";
> >> +	};
> >> +
> >>  	reg_usdhc2_vmmc: regulator-usdhc2 {
> >>  		compatible = "regulator-fixed";
> >>  		enable-active-high;
> >> @@ -38,6 +49,14 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
> >>  	};
> >>  };
> >>
> >> +/* CAN */
> >> +&flexcan1 {
> >> +	pinctrl-names = "default";
> >> +	pinctrl-0 = <&pinctrl_flexcan1>;
> >> +	xceiver-supply = <&reg_flexcan1_en>;
> >> +	status = "okay";
> >> +};
> >> +
> >>  /* I2C2 */
> >>  &lpi2c2 {
> >>  	clock-frequency = <400000>;
> >> @@ -79,6 +98,19 @@ &usdhc2 {
> >>  };
> >>
> >>  &iomuxc {
> >> +	pinctrl_flexcan1: flexcan1grp {
> >> +		fsl,pins = <
> >> +			MX93_PAD_PDM_BIT_STREAM0__CAN1_RX	0x139e
> >> +			MX93_PAD_PDM_CLK__CAN1_TX		0x139e
> >> +		>;
> >> +	};
> >> +
> >> +	pinctrl_reg_flexcan1_en: regflexcan1engrp {
> >> +		fsl,pins = <
> >> +			MX93_PAD_ENET2_TD3__GPIO4_IO16		0x31e
> >> +		>;
> >> +	};
> >> +
> >>  	pinctrl_lpi2c2: lpi2c2grp {
> >>  		fsl,pins = <
> >>  			MX93_PAD_I2C2_SCL__LPI2C2_SCL		0x40000b9e
> >> --
> >> 2.34.1
> >>
>
> --
> Primoz Fiser
> phone: +386-41-390-545
> email: primoz.fiser@norik.com
> --
> Norik systems d.o.o.
> Your embedded software partner
> Slovenia, EU
> phone: +386-41-540-545
> email: info@norik.com
Marc Kleine-Budde April 12, 2025, 1:41 p.m. UTC | #4
On 11.04.2025 10:30:18, Frank Li wrote:
> On Fri, Apr 11, 2025 at 10:08:21AM +0200, Primoz Fiser wrote:
> > Hi Frank,
> >
> > On 10. 04. 25 17:23, Frank Li wrote:
> > > On Thu, Apr 10, 2025 at 11:02:48AM +0200, Primoz Fiser wrote:
> > >> Add support for CAN networking on phyBOARD-Segin-i.MX93 via the flexcan1
> > >> interface. The CAN1_EN regulator enables the SN65HVD234 CAN transceiver
> > >> chip.
> > >
> > > Can you use drivers/phy/phy-can-transceiver.c to enable CAN phy instead
> > > of use hacked regulator-flexcan1-en.
> >
> > Sorry can't do.
> >
> > This doesn't align with other i.MX PHYTEC products using flexcan such as
> > imx8mp-phyboard-pollux-rdk.dts.
> >
> > Even the i.MX93 EVK uses the same mechanism.
> 
> I think previous method is NOT good enough. Suggest involve CAN and PHY
> maintainer to discuss these.

Since d80bfde3c57a ("can: flexcan: add transceiver capabilities"), which
git mainline with v6.15-rc1 there is proper PHY support in the flexcan
driver. So from my point of view, there's no need to stick to regulator
hack.

regards,
Marc
Primoz Fiser April 14, 2025, 8:02 a.m. UTC | #5
Hi Marc and Frank,

On 12. 04. 25 15:41, Marc Kleine-Budde wrote:
> On 11.04.2025 10:30:18, Frank Li wrote:
>> On Fri, Apr 11, 2025 at 10:08:21AM +0200, Primoz Fiser wrote:
>>> Hi Frank,
>>>
>>> On 10. 04. 25 17:23, Frank Li wrote:
>>>> On Thu, Apr 10, 2025 at 11:02:48AM +0200, Primoz Fiser wrote:
>>>>> Add support for CAN networking on phyBOARD-Segin-i.MX93 via the flexcan1
>>>>> interface. The CAN1_EN regulator enables the SN65HVD234 CAN transceiver
>>>>> chip.
>>>>
>>>> Can you use drivers/phy/phy-can-transceiver.c to enable CAN phy instead
>>>> of use hacked regulator-flexcan1-en.
>>>
>>> Sorry can't do.
>>>
>>> This doesn't align with other i.MX PHYTEC products using flexcan such as
>>> imx8mp-phyboard-pollux-rdk.dts.
>>>
>>> Even the i.MX93 EVK uses the same mechanism.
>>
>> I think previous method is NOT good enough. Suggest involve CAN and PHY
>> maintainer to discuss these.
> 
> Since d80bfde3c57a ("can: flexcan: add transceiver capabilities"), which
> git mainline with v6.15-rc1 there is proper PHY support in the flexcan
> driver. So from my point of view, there's no need to stick to regulator
> hack.

This arrived at the perfect moment. Just in time :)

I will switch to this mechanism in v2.

Thank you both for your input.

BR,
Primoz

> 
> regards,
> Marc
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
index 38b89398e646..027a34dbaf04 100644
--- a/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
+++ b/arch/arm64/boot/dts/freescale/imx93-phyboard-segin.dts
@@ -26,6 +26,17 @@  chosen {
 		stdout-path = &lpuart1;
 	};
 
+	reg_flexcan1_en: regulator-flexcan1-en {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio4 16 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_reg_flexcan1_en>;
+		regulator-max-microvolt = <3300000>;
+		regulator-min-microvolt = <3300000>;
+		regulator-name = "CAN1_EN";
+	};
+
 	reg_usdhc2_vmmc: regulator-usdhc2 {
 		compatible = "regulator-fixed";
 		enable-active-high;
@@ -38,6 +49,14 @@  reg_usdhc2_vmmc: regulator-usdhc2 {
 	};
 };
 
+/* CAN */
+&flexcan1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_flexcan1>;
+	xceiver-supply = <&reg_flexcan1_en>;
+	status = "okay";
+};
+
 /* I2C2 */
 &lpi2c2 {
 	clock-frequency = <400000>;
@@ -79,6 +98,19 @@  &usdhc2 {
 };
 
 &iomuxc {
+	pinctrl_flexcan1: flexcan1grp {
+		fsl,pins = <
+			MX93_PAD_PDM_BIT_STREAM0__CAN1_RX	0x139e
+			MX93_PAD_PDM_CLK__CAN1_TX		0x139e
+		>;
+	};
+
+	pinctrl_reg_flexcan1_en: regflexcan1engrp {
+		fsl,pins = <
+			MX93_PAD_ENET2_TD3__GPIO4_IO16		0x31e
+		>;
+	};
+
 	pinctrl_lpi2c2: lpi2c2grp {
 		fsl,pins = <
 			MX93_PAD_I2C2_SCL__LPI2C2_SCL		0x40000b9e