imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051
@ 2025-08-25  8:36 Peng Fan
  2025-08-25  8:36 ` [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048 Peng Fan
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Peng Fan @ 2025-08-25  8:36 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Haibo Chen
  Cc: linux-can, linux-phy, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

TJA1048 is a Dual channel can transceiver with Sleep mode supported.
TJA1051 is a Single Channel can transceiver with Sleep mode supported.

To support them:
patch 1: add binding doc
patch 2: To support dual channel,
   - Introduce new flag CAN_TRANSCEIVER_DUAL_CH to indicate the phy
     has two channels.
   - Introduce can_transceiver_priv as a higher level encapsulation for
     phy, mux_state, num_ch.
   - Alloc a phy for each channel
patch 3,4,5: Update dts to use phys

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
---
Changes in v2:
- Update standby-gpios constraints per Conor's comments
- Drop patch 2 which is not needed.
- Link to v1: https://lore.kernel.org/r/20250822-can-v1-0-c075f702adea@nxp.com

---
Peng Fan (5):
      dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048
      phy: phy-can-transceiver: Add dual channel support for TJA1048
      arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply
      arm64: dts: imx8mp-evk: Use phys to replace xceiver-supply
      arm64: dts: imx93-11x11-evk: Use phys to replace xceiver-supply

 .../devicetree/bindings/phy/ti,tcan104x-can.yaml   |  33 +++++-
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts       |  43 +++-----
 arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts  |  17 ++-
 arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts  |  13 ++-
 drivers/phy/phy-can-transceiver.c                  | 117 +++++++++++++++------
 5 files changed, 140 insertions(+), 83 deletions(-)
---
base-commit: b4498e5df1daaf2832141a27c1e5bc34a7553087
change-id: 20250821-can-c832cb4f0323

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048
  2025-08-25  8:36 [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051 Peng Fan
@ 2025-08-25  8:36 ` Peng Fan
  2025-08-25 15:39   ` Frank Li
  2025-08-25  8:36 ` [PATCH v2 2/5] phy: phy-can-transceiver: Add dual channel support for TJA1048 Peng Fan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Peng Fan @ 2025-08-25  8:36 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Haibo Chen
  Cc: linux-can, linux-phy, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

The TJA1051 is a high-speed CAN transceiver which is a pin-compatible
alternative for TI TCAN1043 with Sleep mode supported, and has a compatible
programming model, therefore use ti,tcan1043 as fallback compatible.

The TJA1048 is a dual high-speed CAN transceiver with Sleep mode supported.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 .../devicetree/bindings/phy/ti,tcan104x-can.yaml   | 33 ++++++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
index 4a8c3829d85d3c4a4963750d03567c1c345beb91..3ae08815225d82b6a09cf8a6deacadbddf781fed 100644
--- a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
+++ b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
@@ -19,18 +19,23 @@ properties:
           - enum:
               - microchip,ata6561
           - const: ti,tcan1042
+      - items:
+          - enum:
+              - nxp,tja1051
+          - const: ti,tcan1043
       - enum:
           - ti,tcan1042
           - ti,tcan1043
+          - nxp,tja1048
           - nxp,tjr1443
 
-  '#phy-cells':
-    const: 0
+  '#phy-cells': true
 
   standby-gpios:
     description:
       gpio node to toggle standby signal on transceiver
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   enable-gpios:
     description:
@@ -53,12 +58,34 @@ required:
   - compatible
   - '#phy-cells'
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,tja1048
+    then:
+      properties:
+        '#phy-cells':
+          const: 1
+        standby-gpios:
+          minItems: 2
+          maxItems: 2
+    else:
+      properties:
+        '#phy-cells':
+          const: 0
+        standby-gpios:
+          minItems: 1
+          maxItems: 1
+
 additionalProperties: false
 
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
 
+
     transceiver1: can-phy {
       compatible = "ti,tcan1043";
       #phy-cells = <0>;

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/5] phy: phy-can-transceiver: Add dual channel support for TJA1048
  2025-08-25  8:36 [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051 Peng Fan
  2025-08-25  8:36 ` [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048 Peng Fan
@ 2025-08-25  8:36 ` Peng Fan
  2025-08-25 15:52   ` Frank Li
  2025-08-25  8:36 ` [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply Peng Fan
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Peng Fan @ 2025-08-25  8:36 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Haibo Chen
  Cc: linux-can, linux-phy, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

- Introduce new flag CAN_TRANSCEIVER_DUAL_CH to indicate the phy
  has two channels.
- Introduce can_transceiver_priv as a higher level encapsulation for
  phy, mux_state, num_ch.
- Alloc a phy for each channel
- Support TJA1048 which is a dual high-speed CAN transceiver with
  Sleep mode supported.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/phy/phy-can-transceiver.c | 117 +++++++++++++++++++++++++++-----------
 1 file changed, 83 insertions(+), 34 deletions(-)

diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c
index f59caff4b3d4c267feca4220bf1547b6fad08f95..8f0baf0d29536d2b18c5839d6275f020f9af7e45 100644
--- a/drivers/phy/phy-can-transceiver.c
+++ b/drivers/phy/phy-can-transceiver.c
@@ -17,13 +17,20 @@ struct can_transceiver_data {
 	u32 flags;
 #define CAN_TRANSCEIVER_STB_PRESENT	BIT(0)
 #define CAN_TRANSCEIVER_EN_PRESENT	BIT(1)
+#define CAN_TRANSCEIVER_DUAL_CH		BIT(2)
 };
 
 struct can_transceiver_phy {
 	struct phy *generic_phy;
 	struct gpio_desc *standby_gpio;
 	struct gpio_desc *enable_gpio;
+	struct can_transceiver_priv *priv;
+};
+
+struct can_transceiver_priv {
+	struct can_transceiver_phy *can_transceiver_phy;
 	struct mux_state *mux_state;
+	int num_ch;
 };
 
 /* Power on function */
@@ -32,8 +39,8 @@ static int can_transceiver_phy_power_on(struct phy *phy)
 	struct can_transceiver_phy *can_transceiver_phy = phy_get_drvdata(phy);
 	int ret;
 
-	if (can_transceiver_phy->mux_state) {
-		ret = mux_state_select(can_transceiver_phy->mux_state);
+	if (can_transceiver_phy->priv->mux_state) {
+		ret = mux_state_select(can_transceiver_phy->priv->mux_state);
 		if (ret) {
 			dev_err(&phy->dev, "Failed to select CAN mux: %d\n", ret);
 			return ret;
@@ -56,8 +63,8 @@ static int can_transceiver_phy_power_off(struct phy *phy)
 		gpiod_set_value_cansleep(can_transceiver_phy->standby_gpio, 1);
 	if (can_transceiver_phy->enable_gpio)
 		gpiod_set_value_cansleep(can_transceiver_phy->enable_gpio, 0);
-	if (can_transceiver_phy->mux_state)
-		mux_state_deselect(can_transceiver_phy->mux_state);
+	if (can_transceiver_phy->priv->mux_state)
+		mux_state_deselect(can_transceiver_phy->priv->mux_state);
 
 	return 0;
 }
@@ -76,6 +83,10 @@ static const struct can_transceiver_data tcan1043_drvdata = {
 	.flags = CAN_TRANSCEIVER_STB_PRESENT | CAN_TRANSCEIVER_EN_PRESENT,
 };
 
+static const struct can_transceiver_data tja1048_drvdata = {
+	.flags = CAN_TRANSCEIVER_STB_PRESENT | CAN_TRANSCEIVER_DUAL_CH,
+};
+
 static const struct of_device_id can_transceiver_phy_ids[] = {
 	{
 		.compatible = "ti,tcan1042",
@@ -85,6 +96,10 @@ static const struct of_device_id can_transceiver_phy_ids[] = {
 		.compatible = "ti,tcan1043",
 		.data = &tcan1043_drvdata
 	},
+	{
+		.compatible = "nxp,tja1048",
+		.data = &tja1048_drvdata
+	},
 	{
 		.compatible = "nxp,tjr1443",
 		.data = &tcan1043_drvdata
@@ -103,11 +118,27 @@ devm_mux_state_get_optional(struct device *dev, const char *mux_name)
 	return devm_mux_state_get(dev, mux_name);
 }
 
+static struct phy *can_transceiver_phy_xlate(struct device *dev, const struct of_phandle_args *args)
+{
+	struct can_transceiver_priv *priv = dev_get_drvdata(dev);
+	u32 idx;
+
+	if (priv->num_ch == 1)
+		return priv->can_transceiver_phy[0].generic_phy;
+
+	if (args->args_count != 1)
+		return ERR_PTR(-EINVAL);
+
+	idx = args->args[0];
+
+	return priv->can_transceiver_phy[idx].generic_phy;
+}
+
 static int can_transceiver_phy_probe(struct platform_device *pdev)
 {
 	struct phy_provider *phy_provider;
 	struct device *dev = &pdev->dev;
-	struct can_transceiver_phy *can_transceiver_phy;
+	struct can_transceiver_priv *priv;
 	const struct can_transceiver_data *drvdata;
 	const struct of_device_id *match;
 	struct phy *phy;
@@ -115,52 +146,70 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
 	struct gpio_desc *enable_gpio;
 	struct mux_state *mux_state;
 	u32 max_bitrate = 0;
-	int err;
-
-	can_transceiver_phy = devm_kzalloc(dev, sizeof(struct can_transceiver_phy), GFP_KERNEL);
-	if (!can_transceiver_phy)
-		return -ENOMEM;
+	int num_ch = 1;
+	int err, i;
 
 	match = of_match_node(can_transceiver_phy_ids, pdev->dev.of_node);
 	drvdata = match->data;
 
+	priv = devm_kzalloc(dev, sizeof(struct can_transceiver_priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, priv);
+
+	if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH)
+		num_ch = 2;
+
+	priv->num_ch = num_ch;
+	priv->can_transceiver_phy = devm_kcalloc(dev, num_ch, sizeof(struct can_transceiver_phy),
+						 GFP_KERNEL);
+	if (!priv->can_transceiver_phy)
+		return -ENOMEM;
+
 	mux_state = devm_mux_state_get_optional(dev, NULL);
 	if (IS_ERR(mux_state))
 		return PTR_ERR(mux_state);
 
-	can_transceiver_phy->mux_state = mux_state;
-
-	phy = devm_phy_create(dev, dev->of_node,
-			      &can_transceiver_phy_ops);
-	if (IS_ERR(phy)) {
-		dev_err(dev, "failed to create can transceiver phy\n");
-		return PTR_ERR(phy);
-	}
+	priv->mux_state = mux_state;
 
 	err = device_property_read_u32(dev, "max-bitrate", &max_bitrate);
 	if ((err != -EINVAL) && !max_bitrate)
 		dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n");
-	phy->attrs.max_link_rate = max_bitrate;
 
-	can_transceiver_phy->generic_phy = phy;
+	for (i = 0; i < num_ch; i++) {
+		phy = devm_phy_create(dev, dev->of_node, &can_transceiver_phy_ops);
+		if (IS_ERR(phy)) {
+			dev_err(dev, "failed to create can transceiver phy\n");
+			return PTR_ERR(phy);
+		}
 
-	if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) {
-		standby_gpio = devm_gpiod_get_optional(dev, "standby", GPIOD_OUT_HIGH);
-		if (IS_ERR(standby_gpio))
-			return PTR_ERR(standby_gpio);
-		can_transceiver_phy->standby_gpio = standby_gpio;
-	}
+		phy->attrs.max_link_rate = max_bitrate;
 
-	if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) {
-		enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
-		if (IS_ERR(enable_gpio))
-			return PTR_ERR(enable_gpio);
-		can_transceiver_phy->enable_gpio = enable_gpio;
-	}
+		priv->can_transceiver_phy[i].generic_phy = phy;
+		priv->can_transceiver_phy[i].priv = priv;
+
+		if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) {
+			standby_gpio = devm_gpiod_get_index_optional(dev, "standby", i,
+								     GPIOD_OUT_HIGH);
+			if (IS_ERR(standby_gpio))
+				return PTR_ERR(standby_gpio);
+			priv->can_transceiver_phy[i].standby_gpio = standby_gpio;
+		}
+
+		if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) {
+			enable_gpio = devm_gpiod_get_index_optional(dev, "enable", i,
+								    GPIOD_OUT_LOW);
+			if (IS_ERR(enable_gpio))
+				return PTR_ERR(enable_gpio);
+			priv->can_transceiver_phy[i].enable_gpio = enable_gpio;
+		}
 
-	phy_set_drvdata(can_transceiver_phy->generic_phy, can_transceiver_phy);
+		phy_set_drvdata(priv->can_transceiver_phy[i].generic_phy,
+				&priv->can_transceiver_phy[i]);
+	}
 
-	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+	phy_provider = devm_of_phy_provider_register(dev, can_transceiver_phy_xlate);
 
 	return PTR_ERR_OR_ZERO(phy_provider);
 }

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051 Peng Fan
  2025-08-25  8:36 ` [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048 Peng Fan
  2025-08-25  8:36 ` [PATCH v2 2/5] phy: phy-can-transceiver: Add dual channel support for TJA1048 Peng Fan
@ 2025-08-25  8:36 ` Peng Fan
  2025-08-25 15:53   ` Frank Li
  2025-08-26  2:19   ` Sherry Sun
  2025-08-25  8:36 ` [PATCH v2 4/5] arm64: dts: imx8mp-evk: " Peng Fan
  2025-08-25  8:36 ` [PATCH v2 5/5] arm64: dts: imx93-11x11-evk: " Peng Fan
  4 siblings, 2 replies; 13+ messages in thread
From: Peng Fan @ 2025-08-25  8:36 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Haibo Chen
  Cc: linux-can, linux-phy, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

The TJA1051T/3 used on i.MX95-15x15-EVK is actually high-speed CAN
transceiver, not a regulator supply. So use phys to reflect the truth.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
index 46f6e0fbf2b09106e6e726ff8b61522d1359cfa4..f6197ba356d49b97bf7287c3f0f86ef84f89bac9 100644
--- a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
@@ -89,12 +89,11 @@ reg_audio_switch1: regulator-audio-switch1 {
 		gpio = <&pcal6524 0 GPIO_ACTIVE_LOW>;
 	};
 
-	reg_can2_stby: regulator-can2-stby {
-		compatible = "regulator-fixed";
-		regulator-max-microvolt = <3300000>;
-		regulator-min-microvolt = <3300000>;
-		regulator-name = "can2-stby";
-		gpio = <&pcal6524 14 GPIO_ACTIVE_LOW>;
+	flexcan2_phy: can-phy {
+		compatible = "nxp,tja1051", "ti,tcan1043";
+		#phy-cells = <0>;
+		max-bitrate = <1000000>;
+		standby-gpios = <&pcal6524 14 GPIO_ACTIVE_HIGH>;
 	};
 
 	reg_m2_pwr: regulator-m2-pwr {
@@ -300,7 +299,7 @@ &enetc_port1 {
 &flexcan2 {
 	pinctrl-0 = <&pinctrl_flexcan2>;
 	pinctrl-names = "default";
-	xceiver-supply = <&reg_can2_stby>;
+	phys = <&flexcan2_phy>;
 	status = "okay";
 };
 

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/5] arm64: dts: imx8mp-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051 Peng Fan
                   ` (2 preceding siblings ...)
  2025-08-25  8:36 ` [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply Peng Fan
@ 2025-08-25  8:36 ` Peng Fan
  2025-08-25 15:55   ` Frank Li
  2025-08-25  8:36 ` [PATCH v2 5/5] arm64: dts: imx93-11x11-evk: " Peng Fan
  4 siblings, 1 reply; 13+ messages in thread
From: Peng Fan @ 2025-08-25  8:36 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Haibo Chen
  Cc: linux-can, linux-phy, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

The TJA1048 used on i.MX8MP-EVK is actually high-speed CAN
transceiver, not a regulator supply. So use phys to reflect the truth.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 43 +++++++++-------------------
 1 file changed, 13 insertions(+), 30 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
index c0cc5611048e6a739f13c14bbd2e7b26f2715696..d238d419d87cc7c99d472720c96aade90275cb0f 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
@@ -56,6 +56,16 @@ memory@40000000 {
 		      <0x1 0x00000000 0 0xc0000000>;
 	};
 
+	flexcan_phy: can-phy {
+		compatible = "nxp,tja1048";
+		#phy-cells = <1>;
+		max-bitrate = <5000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_flexcan_phy>;
+		standby-gpios = <&gpio5 5 GPIO_ACTIVE_LOW>,
+				<&gpio4 27 GPIO_ACTIVE_LOW>;
+	};
+
 	native-hdmi-connector {
 		compatible = "hdmi-connector";
 		label = "HDMI OUT";
@@ -103,28 +113,6 @@ reg_audio_pwr: regulator-audio-pwr {
 		enable-active-high;
 	};
 
-	reg_can1_stby: regulator-can1-stby {
-		compatible = "regulator-fixed";
-		regulator-name = "can1-stby";
-		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_flexcan1_reg>;
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		gpio = <&gpio5 5 GPIO_ACTIVE_HIGH>;
-		enable-active-high;
-	};
-
-	reg_can2_stby: regulator-can2-stby {
-		compatible = "regulator-fixed";
-		regulator-name = "can2-stby";
-		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_flexcan2_reg>;
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
-		enable-active-high;
-	};
-
 	reg_pcie0: regulator-pcie {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
@@ -431,14 +419,14 @@ ethphy1: ethernet-phy@1 {
 &flexcan1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_flexcan1>;
-	xceiver-supply = <&reg_can1_stby>;
+	phys = <&flexcan_phy 0>;
 	status = "okay";
 };
 
 &flexcan2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_flexcan2>;
-	xceiver-supply = <&reg_can2_stby>;
+	phys = <&flexcan_phy 1>;
 	status = "disabled";/* can2 pin conflict with pdm */
 };
 
@@ -903,14 +891,9 @@ MX8MP_IOMUXC_SAI5_RXD3__CAN2_TX         0x154
 		>;
 	};
 
-	pinctrl_flexcan1_reg: flexcan1reggrp {
+	pinctrl_flexcan_phy: flexcanphygrp {
 		fsl,pins = <
 			MX8MP_IOMUXC_SPDIF_EXT_CLK__GPIO5_IO05  0x154   /* CAN1_STBY */
-		>;
-	};
-
-	pinctrl_flexcan2_reg: flexcan2reggrp {
-		fsl,pins = <
 			MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27      0x154   /* CAN2_STBY */
 		>;
 	};

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/5] arm64: dts: imx93-11x11-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051 Peng Fan
                   ` (3 preceding siblings ...)
  2025-08-25  8:36 ` [PATCH v2 4/5] arm64: dts: imx8mp-evk: " Peng Fan
@ 2025-08-25  8:36 ` Peng Fan
  2025-08-25 15:58   ` Frank Li
  4 siblings, 1 reply; 13+ messages in thread
From: Peng Fan @ 2025-08-25  8:36 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Haibo Chen
  Cc: linux-can, linux-phy, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

The TJA1057 used on i.MX93 EVK is actually high-speed CAN
transceiver, not a regulator supply. So use phys to reflect the truth.

And TJA1057 is compatible with TJA1051, so use nxp,tja1051 compatible
string.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
index e24e12f04526c3a08c0bdc6134297fb010e6e926..94be59771cd05c93a6569ee08fff71bc11da21c1 100644
--- a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
@@ -62,6 +62,13 @@ vdevbuffer: vdevbuffer@a4020000 {
 
 	};
 
+	flexcan_phy: can-phy {
+		compatible = "nxp,tja1051", "ti,tcan1043";
+		#phy-cells = <0>;
+		max-bitrate = <5000000>;
+		standby-gpios = <&adp5585 6 GPIO_ACTIVE_HIGH>;
+	};
+
 	reg_vdd_12v: regulator-vdd-12v {
 		compatible = "regulator-fixed";
 		regulator-name = "VDD_12V";
@@ -87,14 +94,6 @@ reg_audio_pwr: regulator-audio-pwr {
 		enable-active-high;
 	};
 
-	reg_can2_standby: regulator-can2-standby {
-		compatible = "regulator-fixed";
-		regulator-name = "can2-stby";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		gpio = <&adp5585 6 GPIO_ACTIVE_LOW>;
-	};
-
 	reg_m2_pwr: regulator-m2-pwr {
 		compatible = "regulator-fixed";
 		regulator-name = "M.2-power";
@@ -284,7 +283,7 @@ ethphy2: ethernet-phy@2 {
 &flexcan2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_flexcan2>;
-	xceiver-supply = <&reg_can2_standby>;
+	phys = <&flexcan_phy>;
 	status = "okay";
 };
 

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048
  2025-08-25  8:36 ` [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048 Peng Fan
@ 2025-08-25 15:39   ` Frank Li
  0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2025-08-25 15:39 UTC (permalink / raw)
  To: Peng Fan
  Cc: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Haibo Chen, linux-can,
	linux-phy, devicetree, linux-kernel, imx, linux-arm-kernel

On Mon, Aug 25, 2025 at 04:36:42PM +0800, Peng Fan wrote:
> The TJA1051 is a high-speed CAN transceiver which is a pin-compatible
> alternative for TI TCAN1043 with Sleep mode supported, and has a compatible
> programming model, therefore use ti,tcan1043 as fallback compatible.
>
> The TJA1048 is a dual high-speed CAN transceiver with Sleep mode supported.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/phy/ti,tcan104x-can.yaml   | 33 ++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> index 4a8c3829d85d3c4a4963750d03567c1c345beb91..3ae08815225d82b6a09cf8a6deacadbddf781fed 100644
> --- a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> +++ b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> @@ -19,18 +19,23 @@ properties:
>            - enum:
>                - microchip,ata6561
>            - const: ti,tcan1042
> +      - items:
> +          - enum:
> +              - nxp,tja1051
> +          - const: ti,tcan1043
>        - enum:
>            - ti,tcan1042
>            - ti,tcan1043
> +          - nxp,tja1048
>            - nxp,tjr1443
>
> -  '#phy-cells':
> -    const: 0
> +  '#phy-cells': true

need restrict number, although you limit in allOf, still prefer provide
wide restriction here.

     'phy-cells':
        enum: [ 0, 1]

>
>    standby-gpios:
>      description:
>        gpio node to toggle standby signal on transceiver
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
>
>    enable-gpios:
>      description:
> @@ -53,12 +58,34 @@ required:
>    - compatible
>    - '#phy-cells'
>
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1048
> +    then:
> +      properties:
> +        '#phy-cells':
> +          const: 1
> +        standby-gpios:
> +          minItems: 2
> +          maxItems: 2
> +    else:
> +      properties:
> +        '#phy-cells':
> +          const: 0
> +        standby-gpios:
> +          minItems: 1
> +          maxItems: 1
> +
>  additionalProperties: false
>
>  examples:
>    - |
>      #include <dt-bindings/gpio/gpio.h>
>
> +

uncessary change here

Frank
>      transceiver1: can-phy {
>        compatible = "ti,tcan1043";
>        #phy-cells = <0>;
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/5] phy: phy-can-transceiver: Add dual channel support for TJA1048
  2025-08-25  8:36 ` [PATCH v2 2/5] phy: phy-can-transceiver: Add dual channel support for TJA1048 Peng Fan
@ 2025-08-25 15:52   ` Frank Li
  0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2025-08-25 15:52 UTC (permalink / raw)
  To: Peng Fan
  Cc: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Haibo Chen, linux-can,
	linux-phy, devicetree, linux-kernel, imx, linux-arm-kernel

On Mon, Aug 25, 2025 at 04:36:43PM +0800, Peng Fan wrote:
> - Introduce new flag CAN_TRANSCEIVER_DUAL_CH to indicate the phy
>   has two channels.
> - Introduce can_transceiver_priv as a higher level encapsulation for
>   phy, mux_state, num_ch.
> - Alloc a phy for each channel
> - Support TJA1048 which is a dual high-speed CAN transceiver with
>   Sleep mode supported.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/phy/phy-can-transceiver.c | 117 +++++++++++++++++++++++++++-----------
>  1 file changed, 83 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c
> index f59caff4b3d4c267feca4220bf1547b6fad08f95..8f0baf0d29536d2b18c5839d6275f020f9af7e45 100644
> --- a/drivers/phy/phy-can-transceiver.c
> +++ b/drivers/phy/phy-can-transceiver.c
> @@ -17,13 +17,20 @@ struct can_transceiver_data {
>  	u32 flags;
>  #define CAN_TRANSCEIVER_STB_PRESENT	BIT(0)
>  #define CAN_TRANSCEIVER_EN_PRESENT	BIT(1)
> +#define CAN_TRANSCEIVER_DUAL_CH		BIT(2)
>  };
>
>  struct can_transceiver_phy {
>  	struct phy *generic_phy;
>  	struct gpio_desc *standby_gpio;
>  	struct gpio_desc *enable_gpio;
> +	struct can_transceiver_priv *priv;
> +};

I suggest create new patch, just add priv (without num_ch), which simple
straight forward. Then add num_ch, which will be easy to review.

Frank

> +
> +struct can_transceiver_priv {
> +	struct can_transceiver_phy *can_transceiver_phy;
>  	struct mux_state *mux_state;
> +	int num_ch;
>  };
>
>  /* Power on function */
> @@ -32,8 +39,8 @@ static int can_transceiver_phy_power_on(struct phy *phy)
>  	struct can_transceiver_phy *can_transceiver_phy = phy_get_drvdata(phy);
>  	int ret;
>
> -	if (can_transceiver_phy->mux_state) {
> -		ret = mux_state_select(can_transceiver_phy->mux_state);
> +	if (can_transceiver_phy->priv->mux_state) {
> +		ret = mux_state_select(can_transceiver_phy->priv->mux_state);
>  		if (ret) {
>  			dev_err(&phy->dev, "Failed to select CAN mux: %d\n", ret);
>  			return ret;
> @@ -56,8 +63,8 @@ static int can_transceiver_phy_power_off(struct phy *phy)
>  		gpiod_set_value_cansleep(can_transceiver_phy->standby_gpio, 1);
>  	if (can_transceiver_phy->enable_gpio)
>  		gpiod_set_value_cansleep(can_transceiver_phy->enable_gpio, 0);
> -	if (can_transceiver_phy->mux_state)
> -		mux_state_deselect(can_transceiver_phy->mux_state);
> +	if (can_transceiver_phy->priv->mux_state)
> +		mux_state_deselect(can_transceiver_phy->priv->mux_state);
>
>  	return 0;
>  }
> @@ -76,6 +83,10 @@ static const struct can_transceiver_data tcan1043_drvdata = {
>  	.flags = CAN_TRANSCEIVER_STB_PRESENT | CAN_TRANSCEIVER_EN_PRESENT,
>  };
>
> +static const struct can_transceiver_data tja1048_drvdata = {
> +	.flags = CAN_TRANSCEIVER_STB_PRESENT | CAN_TRANSCEIVER_DUAL_CH,
> +};
> +
>  static const struct of_device_id can_transceiver_phy_ids[] = {
>  	{
>  		.compatible = "ti,tcan1042",
> @@ -85,6 +96,10 @@ static const struct of_device_id can_transceiver_phy_ids[] = {
>  		.compatible = "ti,tcan1043",
>  		.data = &tcan1043_drvdata
>  	},
> +	{
> +		.compatible = "nxp,tja1048",
> +		.data = &tja1048_drvdata
> +	},
>  	{
>  		.compatible = "nxp,tjr1443",
>  		.data = &tcan1043_drvdata
> @@ -103,11 +118,27 @@ devm_mux_state_get_optional(struct device *dev, const char *mux_name)
>  	return devm_mux_state_get(dev, mux_name);
>  }
>
> +static struct phy *can_transceiver_phy_xlate(struct device *dev, const struct of_phandle_args *args)
> +{
> +	struct can_transceiver_priv *priv = dev_get_drvdata(dev);
> +	u32 idx;
> +
> +	if (priv->num_ch == 1)
> +		return priv->can_transceiver_phy[0].generic_phy;
> +
> +	if (args->args_count != 1)
> +		return ERR_PTR(-EINVAL);
> +
> +	idx = args->args[0];
> +
> +	return priv->can_transceiver_phy[idx].generic_phy;
> +}
> +
>  static int can_transceiver_phy_probe(struct platform_device *pdev)
>  {
>  	struct phy_provider *phy_provider;
>  	struct device *dev = &pdev->dev;
> -	struct can_transceiver_phy *can_transceiver_phy;
> +	struct can_transceiver_priv *priv;
>  	const struct can_transceiver_data *drvdata;
>  	const struct of_device_id *match;
>  	struct phy *phy;
> @@ -115,52 +146,70 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
>  	struct gpio_desc *enable_gpio;
>  	struct mux_state *mux_state;
>  	u32 max_bitrate = 0;
> -	int err;
> -
> -	can_transceiver_phy = devm_kzalloc(dev, sizeof(struct can_transceiver_phy), GFP_KERNEL);
> -	if (!can_transceiver_phy)
> -		return -ENOMEM;
> +	int num_ch = 1;
> +	int err, i;
>
>  	match = of_match_node(can_transceiver_phy_ids, pdev->dev.of_node);
>  	drvdata = match->data;
>
> +	priv = devm_kzalloc(dev, sizeof(struct can_transceiver_priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, priv);
> +
> +	if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH)
> +		num_ch = 2;
> +
> +	priv->num_ch = num_ch;
> +	priv->can_transceiver_phy = devm_kcalloc(dev, num_ch, sizeof(struct can_transceiver_phy),
> +						 GFP_KERNEL);
> +	if (!priv->can_transceiver_phy)
> +		return -ENOMEM;
> +
>  	mux_state = devm_mux_state_get_optional(dev, NULL);
>  	if (IS_ERR(mux_state))
>  		return PTR_ERR(mux_state);
>
> -	can_transceiver_phy->mux_state = mux_state;
> -
> -	phy = devm_phy_create(dev, dev->of_node,
> -			      &can_transceiver_phy_ops);
> -	if (IS_ERR(phy)) {
> -		dev_err(dev, "failed to create can transceiver phy\n");
> -		return PTR_ERR(phy);
> -	}
> +	priv->mux_state = mux_state;
>
>  	err = device_property_read_u32(dev, "max-bitrate", &max_bitrate);
>  	if ((err != -EINVAL) && !max_bitrate)
>  		dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n");
> -	phy->attrs.max_link_rate = max_bitrate;
>
> -	can_transceiver_phy->generic_phy = phy;
> +	for (i = 0; i < num_ch; i++) {
> +		phy = devm_phy_create(dev, dev->of_node, &can_transceiver_phy_ops);
> +		if (IS_ERR(phy)) {
> +			dev_err(dev, "failed to create can transceiver phy\n");
> +			return PTR_ERR(phy);
> +		}
>
> -	if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) {
> -		standby_gpio = devm_gpiod_get_optional(dev, "standby", GPIOD_OUT_HIGH);
> -		if (IS_ERR(standby_gpio))
> -			return PTR_ERR(standby_gpio);
> -		can_transceiver_phy->standby_gpio = standby_gpio;
> -	}
> +		phy->attrs.max_link_rate = max_bitrate;
>
> -	if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) {
> -		enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
> -		if (IS_ERR(enable_gpio))
> -			return PTR_ERR(enable_gpio);
> -		can_transceiver_phy->enable_gpio = enable_gpio;
> -	}
> +		priv->can_transceiver_phy[i].generic_phy = phy;
> +		priv->can_transceiver_phy[i].priv = priv;
> +
> +		if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) {
> +			standby_gpio = devm_gpiod_get_index_optional(dev, "standby", i,
> +								     GPIOD_OUT_HIGH);
> +			if (IS_ERR(standby_gpio))
> +				return PTR_ERR(standby_gpio);
> +			priv->can_transceiver_phy[i].standby_gpio = standby_gpio;
> +		}
> +
> +		if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) {
> +			enable_gpio = devm_gpiod_get_index_optional(dev, "enable", i,
> +								    GPIOD_OUT_LOW);
> +			if (IS_ERR(enable_gpio))
> +				return PTR_ERR(enable_gpio);
> +			priv->can_transceiver_phy[i].enable_gpio = enable_gpio;
> +		}
>
> -	phy_set_drvdata(can_transceiver_phy->generic_phy, can_transceiver_phy);
> +		phy_set_drvdata(priv->can_transceiver_phy[i].generic_phy,
> +				&priv->can_transceiver_phy[i]);
> +	}
>
> -	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> +	phy_provider = devm_of_phy_provider_register(dev, can_transceiver_phy_xlate);
>
>  	return PTR_ERR_OR_ZERO(phy_provider);
>  }
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 ` [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply Peng Fan
@ 2025-08-25 15:53   ` Frank Li
  2025-08-26  2:19   ` Sherry Sun
  1 sibling, 0 replies; 13+ messages in thread
From: Frank Li @ 2025-08-25 15:53 UTC (permalink / raw)
  To: Peng Fan
  Cc: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Haibo Chen, linux-can,
	linux-phy, devicetree, linux-kernel, imx, linux-arm-kernel

On Mon, Aug 25, 2025 at 04:36:44PM +0800, Peng Fan wrote:
> The TJA1051T/3 used on i.MX95-15x15-EVK is actually high-speed CAN
> transceiver, not a regulator supply. So use phys to reflect the truth.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> index 46f6e0fbf2b09106e6e726ff8b61522d1359cfa4..f6197ba356d49b97bf7287c3f0f86ef84f89bac9 100644
> --- a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> @@ -89,12 +89,11 @@ reg_audio_switch1: regulator-audio-switch1 {
>  		gpio = <&pcal6524 0 GPIO_ACTIVE_LOW>;
>  	};
>
> -	reg_can2_stby: regulator-can2-stby {
> -		compatible = "regulator-fixed";
> -		regulator-max-microvolt = <3300000>;
> -		regulator-min-microvolt = <3300000>;
> -		regulator-name = "can2-stby";
> -		gpio = <&pcal6524 14 GPIO_ACTIVE_LOW>;
> +	flexcan2_phy: can-phy {
> +		compatible = "nxp,tja1051", "ti,tcan1043";
> +		#phy-cells = <0>;
> +		max-bitrate = <1000000>;
> +		standby-gpios = <&pcal6524 14 GPIO_ACTIVE_HIGH>;
>  	};
>
>  	reg_m2_pwr: regulator-m2-pwr {
> @@ -300,7 +299,7 @@ &enetc_port1 {
>  &flexcan2 {
>  	pinctrl-0 = <&pinctrl_flexcan2>;
>  	pinctrl-names = "default";
> -	xceiver-supply = <&reg_can2_stby>;
> +	phys = <&flexcan2_phy>;
>  	status = "okay";
>  };
>
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/5] arm64: dts: imx8mp-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 ` [PATCH v2 4/5] arm64: dts: imx8mp-evk: " Peng Fan
@ 2025-08-25 15:55   ` Frank Li
  0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2025-08-25 15:55 UTC (permalink / raw)
  To: Peng Fan
  Cc: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Haibo Chen, linux-can,
	linux-phy, devicetree, linux-kernel, imx, linux-arm-kernel

On Mon, Aug 25, 2025 at 04:36:45PM +0800, Peng Fan wrote:
> The TJA1048 used on i.MX8MP-EVK is actually high-speed CAN
> transceiver, not a regulator supply. So use phys to reflect the truth.

nit: wrap at 75 chars. 'transceiver', should be at first line.

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 43 +++++++++-------------------
>  1 file changed, 13 insertions(+), 30 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> index c0cc5611048e6a739f13c14bbd2e7b26f2715696..d238d419d87cc7c99d472720c96aade90275cb0f 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> @@ -56,6 +56,16 @@ memory@40000000 {
>  		      <0x1 0x00000000 0 0xc0000000>;
>  	};
>
> +	flexcan_phy: can-phy {
> +		compatible = "nxp,tja1048";
> +		#phy-cells = <1>;
> +		max-bitrate = <5000000>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&pinctrl_flexcan_phy>;
> +		standby-gpios = <&gpio5 5 GPIO_ACTIVE_LOW>,
> +				<&gpio4 27 GPIO_ACTIVE_LOW>;
> +	};
> +
>  	native-hdmi-connector {
>  		compatible = "hdmi-connector";
>  		label = "HDMI OUT";
> @@ -103,28 +113,6 @@ reg_audio_pwr: regulator-audio-pwr {
>  		enable-active-high;
>  	};
>
> -	reg_can1_stby: regulator-can1-stby {
> -		compatible = "regulator-fixed";
> -		regulator-name = "can1-stby";
> -		pinctrl-names = "default";
> -		pinctrl-0 = <&pinctrl_flexcan1_reg>;
> -		regulator-min-microvolt = <3300000>;
> -		regulator-max-microvolt = <3300000>;
> -		gpio = <&gpio5 5 GPIO_ACTIVE_HIGH>;
> -		enable-active-high;
> -	};
> -
> -	reg_can2_stby: regulator-can2-stby {
> -		compatible = "regulator-fixed";
> -		regulator-name = "can2-stby";
> -		pinctrl-names = "default";
> -		pinctrl-0 = <&pinctrl_flexcan2_reg>;
> -		regulator-min-microvolt = <3300000>;
> -		regulator-max-microvolt = <3300000>;
> -		gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
> -		enable-active-high;
> -	};
> -
>  	reg_pcie0: regulator-pcie {
>  		compatible = "regulator-fixed";
>  		pinctrl-names = "default";
> @@ -431,14 +419,14 @@ ethphy1: ethernet-phy@1 {
>  &flexcan1 {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_flexcan1>;
> -	xceiver-supply = <&reg_can1_stby>;
> +	phys = <&flexcan_phy 0>;
>  	status = "okay";
>  };
>
>  &flexcan2 {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_flexcan2>;
> -	xceiver-supply = <&reg_can2_stby>;
> +	phys = <&flexcan_phy 1>;
>  	status = "disabled";/* can2 pin conflict with pdm */
>  };
>
> @@ -903,14 +891,9 @@ MX8MP_IOMUXC_SAI5_RXD3__CAN2_TX         0x154
>  		>;
>  	};
>
> -	pinctrl_flexcan1_reg: flexcan1reggrp {
> +	pinctrl_flexcan_phy: flexcanphygrp {
>  		fsl,pins = <
>  			MX8MP_IOMUXC_SPDIF_EXT_CLK__GPIO5_IO05  0x154   /* CAN1_STBY */
> -		>;
> -	};
> -
> -	pinctrl_flexcan2_reg: flexcan2reggrp {
> -		fsl,pins = <
>  			MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27      0x154   /* CAN2_STBY */
>  		>;
>  	};
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/5] arm64: dts: imx93-11x11-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 ` [PATCH v2 5/5] arm64: dts: imx93-11x11-evk: " Peng Fan
@ 2025-08-25 15:58   ` Frank Li
  0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2025-08-25 15:58 UTC (permalink / raw)
  To: Peng Fan
  Cc: Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Haibo Chen, linux-can,
	linux-phy, devicetree, linux-kernel, imx, linux-arm-kernel

On Mon, Aug 25, 2025 at 04:36:46PM +0800, Peng Fan wrote:
> The TJA1057 used on i.MX93 EVK is actually high-speed CAN
> transceiver, not a regulator supply. So use phys to reflect the truth.
>
> And TJA1057 is compatible with TJA1051, so use nxp,tja1051 compatible
> string.

Need add TJA1057 into binding, "nxp,tja1057", "ti,tcan1043". You already
touch binding doc, just add nxp,tja1057.

Frank

>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
> index e24e12f04526c3a08c0bdc6134297fb010e6e926..94be59771cd05c93a6569ee08fff71bc11da21c1 100644
> --- a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
> @@ -62,6 +62,13 @@ vdevbuffer: vdevbuffer@a4020000 {
>
>  	};
>
> +	flexcan_phy: can-phy {
> +		compatible = "nxp,tja1051", "ti,tcan1043";
> +		#phy-cells = <0>;
> +		max-bitrate = <5000000>;
> +		standby-gpios = <&adp5585 6 GPIO_ACTIVE_HIGH>;
> +	};
> +
>  	reg_vdd_12v: regulator-vdd-12v {
>  		compatible = "regulator-fixed";
>  		regulator-name = "VDD_12V";
> @@ -87,14 +94,6 @@ reg_audio_pwr: regulator-audio-pwr {
>  		enable-active-high;
>  	};
>
> -	reg_can2_standby: regulator-can2-standby {
> -		compatible = "regulator-fixed";
> -		regulator-name = "can2-stby";
> -		regulator-min-microvolt = <3300000>;
> -		regulator-max-microvolt = <3300000>;
> -		gpio = <&adp5585 6 GPIO_ACTIVE_LOW>;
> -	};
> -
>  	reg_m2_pwr: regulator-m2-pwr {
>  		compatible = "regulator-fixed";
>  		regulator-name = "M.2-power";
> @@ -284,7 +283,7 @@ ethphy2: ethernet-phy@2 {
>  &flexcan2 {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_flexcan2>;
> -	xceiver-supply = <&reg_can2_standby>;
> +	phys = <&flexcan_phy>;
>  	status = "okay";
>  };
>
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply
  2025-08-25  8:36 ` [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply Peng Fan
  2025-08-25 15:53   ` Frank Li
@ 2025-08-26  2:19   ` Sherry Sun
  2025-08-26  2:28     ` Bough Chen
  1 sibling, 1 reply; 13+ messages in thread
From: Sherry Sun @ 2025-08-26  2:19 UTC (permalink / raw)
  To: Peng Fan, Marc Kleine-Budde, Vincent Mailhol, Vinod Koul,
	Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Aswath Govindraju, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Bough Chen
  Cc: linux-can@vger.kernel.org, linux-phy@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Peng Fan



> -----Original Message-----
> From: Peng Fan <peng.fan@nxp.com>
> Sent: Monday, August 25, 2025 4:37 PM
> To: Marc Kleine-Budde <mkl@pengutronix.de>; Vincent Mailhol
> <mailhol.vincent@wanadoo.fr>; Vinod Koul <vkoul@kernel.org>; Kishon Vijay
> Abraham I <kishon@kernel.org>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>;
> Aswath Govindraju <a-govindraju@ti.com>; Shawn Guo
> <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; Frank Li <frank.li@nxp.com>; Bough Chen
> <haibo.chen@nxp.com>
> Cc: linux-can@vger.kernel.org; linux-phy@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> imx@lists.linux.dev; linux-arm-kernel@lists.infradead.org; Peng Fan
> <peng.fan@nxp.com>
> Subject: [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace
> xceiver-supply
> 
> The TJA1051T/3 used on i.MX95-15x15-EVK is actually high-speed CAN
> transceiver, not a regulator supply. So use phys to reflect the truth.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> index
> 46f6e0fbf2b09106e6e726ff8b61522d1359cfa4..f6197ba356d49b97bf7287c3f0
> f86ef84f89bac9 100644
> --- a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> @@ -89,12 +89,11 @@ reg_audio_switch1: regulator-audio-switch1 {
>  		gpio = <&pcal6524 0 GPIO_ACTIVE_LOW>;
>  	};
> 
> -	reg_can2_stby: regulator-can2-stby {
> -		compatible = "regulator-fixed";
> -		regulator-max-microvolt = <3300000>;
> -		regulator-min-microvolt = <3300000>;
> -		regulator-name = "can2-stby";
> -		gpio = <&pcal6524 14 GPIO_ACTIVE_LOW>;
> +	flexcan2_phy: can-phy {
> +		compatible = "nxp,tja1051", "ti,tcan1043";
> +		#phy-cells = <0>;
> +		max-bitrate = <1000000>;

Hi Peng, shouldn't the max-bitrate of TJA1051 be 5000000?

Best Regards
Sherry

> +		standby-gpios = <&pcal6524 14 GPIO_ACTIVE_HIGH>;
>  	};
> 
>  	reg_m2_pwr: regulator-m2-pwr {
> @@ -300,7 +299,7 @@ &enetc_port1 {
>  &flexcan2 {
>  	pinctrl-0 = <&pinctrl_flexcan2>;
>  	pinctrl-names = "default";
> -	xceiver-supply = <&reg_can2_stby>;
> +	phys = <&flexcan2_phy>;
>  	status = "okay";
>  };
> 
> 
> --
> 2.37.1
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply
  2025-08-26  2:19   ` Sherry Sun
@ 2025-08-26  2:28     ` Bough Chen
  0 siblings, 0 replies; 13+ messages in thread
From: Bough Chen @ 2025-08-26  2:28 UTC (permalink / raw)
  To: Sherry Sun, Peng Fan, Marc Kleine-Budde, Vincent Mailhol,
	Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Aswath Govindraju, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Frank Li
  Cc: linux-can@vger.kernel.org, linux-phy@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Peng Fan

> -----Original Message-----
> From: Sherry Sun <sherry.sun@nxp.com>
> Sent: 2025年8月26日 10:19
> To: Peng Fan <peng.fan@nxp.com>; Marc Kleine-Budde <mkl@pengutronix.de>;
> Vincent Mailhol <mailhol.vincent@wanadoo.fr>; Vinod Koul
> <vkoul@kernel.org>; Kishon Vijay Abraham I <kishon@kernel.org>; Rob Herring
> <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>; Conor Dooley
> <conor+dt@kernel.org>; Aswath Govindraju <a-govindraju@ti.com>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; Frank Li <frank.li@nxp.com>; Bough Chen
> <haibo.chen@nxp.com>
> Cc: linux-can@vger.kernel.org; linux-phy@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; Peng Fan <peng.fan@nxp.com>
> Subject: RE: [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace
> xceiver-supply
> 
> 
> 
> > -----Original Message-----
> > From: Peng Fan <peng.fan@nxp.com>
> > Sent: Monday, August 25, 2025 4:37 PM
> > To: Marc Kleine-Budde <mkl@pengutronix.de>; Vincent Mailhol
> > <mailhol.vincent@wanadoo.fr>; Vinod Koul <vkoul@kernel.org>; Kishon
> > Vijay Abraham I <kishon@kernel.org>; Rob Herring <robh@kernel.org>;
> > Krzysztof Kozlowski <krzk+dt@kernel.org>; Conor Dooley
> > <conor+dt@kernel.org>; Aswath Govindraju <a-govindraju@ti.com>; Shawn
> > Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> > Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> > <festevam@gmail.com>; Frank Li <frank.li@nxp.com>; Bough Chen
> > <haibo.chen@nxp.com>
> > Cc: linux-can@vger.kernel.org; linux-phy@lists.infradead.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > imx@lists.linux.dev; linux-arm-kernel@lists.infradead.org; Peng Fan
> > <peng.fan@nxp.com>
> > Subject: [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to
> > replace xceiver-supply
> >
> > The TJA1051T/3 used on i.MX95-15x15-EVK is actually high-speed CAN
> > transceiver, not a regulator supply. So use phys to reflect the truth.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts | 13 ++++++-------
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> > b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> > index
> >
> 46f6e0fbf2b09106e6e726ff8b61522d1359cfa4..f6197ba356d49b97bf7287c3f0
> > f86ef84f89bac9 100644
> > --- a/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx95-15x15-evk.dts
> > @@ -89,12 +89,11 @@ reg_audio_switch1: regulator-audio-switch1 {
> >  		gpio = <&pcal6524 0 GPIO_ACTIVE_LOW>;
> >  	};
> >
> > -	reg_can2_stby: regulator-can2-stby {
> > -		compatible = "regulator-fixed";
> > -		regulator-max-microvolt = <3300000>;
> > -		regulator-min-microvolt = <3300000>;
> > -		regulator-name = "can2-stby";
> > -		gpio = <&pcal6524 14 GPIO_ACTIVE_LOW>;
> > +	flexcan2_phy: can-phy {
> > +		compatible = "nxp,tja1051", "ti,tcan1043";
> > +		#phy-cells = <0>;
> > +		max-bitrate = <1000000>;
> 
> Hi Peng, shouldn't the max-bitrate of TJA1051 be 5000000?

Yes, according to the datasheet of TJA1051, CAN FD fast phase at data rates up to 5 Mbit/s
https://www.nxp.com/docs/en/data-sheet/TJA1051.pdf

Please correct this, here the max-bitrate also limit the data bitrate.

Regards
Haibo Chen
> 
> Best Regards
> Sherry
> 
> > +		standby-gpios = <&pcal6524 14 GPIO_ACTIVE_HIGH>;
> >  	};
> >
> >  	reg_m2_pwr: regulator-m2-pwr {
> > @@ -300,7 +299,7 @@ &enetc_port1 {
> >  &flexcan2 {
> >  	pinctrl-0 = <&pinctrl_flexcan2>;
> >  	pinctrl-names = "default";
> > -	xceiver-supply = <&reg_can2_stby>;
> > +	phys = <&flexcan2_phy>;
> >  	status = "okay";
> >  };
> >
> >
> > --
> > 2.37.1
> >


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-08-26  2:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25  8:36 [PATCH v2 0/5] phy: phy-can-transceiver: Support TJA1048/TJA1051 Peng Fan
2025-08-25  8:36 ` [PATCH v2 1/5] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA1051/1048 Peng Fan
2025-08-25 15:39   ` Frank Li
2025-08-25  8:36 ` [PATCH v2 2/5] phy: phy-can-transceiver: Add dual channel support for TJA1048 Peng Fan
2025-08-25 15:52   ` Frank Li
2025-08-25  8:36 ` [PATCH v2 3/5] arm64: dts: imx95-15x15-evk: Use phys to replace xceiver-supply Peng Fan
2025-08-25 15:53   ` Frank Li
2025-08-26  2:19   ` Sherry Sun
2025-08-26  2:28     ` Bough Chen
2025-08-25  8:36 ` [PATCH v2 4/5] arm64: dts: imx8mp-evk: " Peng Fan
2025-08-25 15:55   ` Frank Li
2025-08-25  8:36 ` [PATCH v2 5/5] arm64: dts: imx93-11x11-evk: " Peng Fan
2025-08-25 15:58   ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).