* [PATCH 0/2] can: flexcan: add transceiver capabilities
@ 2025-02-11 13:12 Dimitri Fedrau via B4 Relay
2025-02-11 13:12 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
2025-02-11 13:12 ` [PATCH 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
0 siblings, 2 replies; 14+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-02-11 13:12 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-can, linux-kernel, devicetree, Dimitri Fedrau,
Dimitri Fedrau
Currently the flexcan driver does not support adding PHYs. Add the
capability to ensure that the PHY is in operational state when the link
is set to an "up" state.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
Dimitri Fedrau (2):
dt-bindings: can: fsl,flexcan: add transceiver capabilities
can: flexcan: add transceiver capabilities
.../devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
drivers/net/can/flexcan/flexcan-core.c | 25 ++++++++++++++++------
drivers/net/can/flexcan/flexcan.h | 1 +
3 files changed, 23 insertions(+), 6 deletions(-)
---
base-commit: 25cc469d6d344f5772e9fb6a5cf9d82a690afe68
change-id: 20241209-flexcan-add-transceiver-caps-7cff9400c926
Best regards,
--
Dimitri Fedrau <dimitri.fedrau@liebherr.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-11 13:12 [PATCH 0/2] can: flexcan: add transceiver capabilities Dimitri Fedrau via B4 Relay
@ 2025-02-11 13:12 ` Dimitri Fedrau via B4 Relay
2025-02-11 16:38 ` Conor Dooley
2025-02-19 9:15 ` Marc Kleine-Budde
2025-02-11 13:12 ` [PATCH 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
1 sibling, 2 replies; 14+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-02-11 13:12 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-can, linux-kernel, devicetree, Dimitri Fedrau,
Dimitri Fedrau
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Currently the flexcan driver does not support adding PHYs. Add the
capability to ensure that the PHY is in operational state when the link
is set to an "up" state.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
index 97dd1a7c5ed26bb7f1b2f78c326d91e2c299938a..397957569588a61111a313cf9107e29dacc9e667 100644
--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
+++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
@@ -70,6 +70,9 @@ properties:
xceiver-supply:
description: Regulator that powers the CAN transceiver.
+ phys:
+ maxItems: 1
+
big-endian:
$ref: /schemas/types.yaml#/definitions/flag
description: |
--
2.39.5
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] can: flexcan: add transceiver capabilities
2025-02-11 13:12 [PATCH 0/2] can: flexcan: add transceiver capabilities Dimitri Fedrau via B4 Relay
2025-02-11 13:12 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
@ 2025-02-11 13:12 ` Dimitri Fedrau via B4 Relay
2025-02-19 9:41 ` Marc Kleine-Budde
1 sibling, 1 reply; 14+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-02-11 13:12 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-can, linux-kernel, devicetree, Dimitri Fedrau,
Dimitri Fedrau
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Currently the flexcan driver does not support adding PHYs. Add the
capability to ensure that the PHY is in operational state when the link
is set to an "up" state.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
drivers/net/can/flexcan/flexcan-core.c | 25 +++++++++++++++++++------
drivers/net/can/flexcan/flexcan.h | 1 +
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index ac1a860986df69a1dd64c25ff879490d5b21073b..a03dc8e3c80546a0e2fa9a85f0e0cc8159afa4f0 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -30,6 +30,7 @@
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
+#include <linux/phy/phy.h>
#include "flexcan.h"
@@ -634,18 +635,22 @@ static void flexcan_clks_disable(const struct flexcan_priv *priv)
static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv)
{
- if (!priv->reg_xceiver)
- return 0;
+ if (priv->reg_xceiver)
+ return regulator_enable(priv->reg_xceiver);
+ else if (priv->xceiver)
+ return phy_power_on(priv->xceiver);
- return regulator_enable(priv->reg_xceiver);
+ return 0;
}
static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv)
{
- if (!priv->reg_xceiver)
- return 0;
+ if (priv->reg_xceiver)
+ return regulator_disable(priv->reg_xceiver);
+ else if (priv->xceiver)
+ return phy_power_off(priv->xceiver);
- return regulator_disable(priv->reg_xceiver);
+ return 0;
}
static int flexcan_chip_enable(struct flexcan_priv *priv)
@@ -2061,6 +2066,7 @@ static int flexcan_probe(struct platform_device *pdev)
struct net_device *dev;
struct flexcan_priv *priv;
struct regulator *reg_xceiver;
+ struct phy *xceiver;
struct clk *clk_ipg = NULL, *clk_per = NULL;
struct flexcan_regs __iomem *regs;
struct flexcan_platform_data *pdata;
@@ -2076,6 +2082,12 @@ static int flexcan_probe(struct platform_device *pdev)
else if (IS_ERR(reg_xceiver))
return PTR_ERR(reg_xceiver);
+ xceiver = devm_phy_optional_get(&pdev->dev, NULL);
+ if (IS_ERR(xceiver)) {
+ dev_err(&pdev->dev, "failed to get phy\n");
+ return PTR_ERR(xceiver);
+ }
+
if (pdev->dev.of_node) {
of_property_read_u32(pdev->dev.of_node,
"clock-frequency", &clock_freq);
@@ -2173,6 +2185,7 @@ static int flexcan_probe(struct platform_device *pdev)
priv->clk_per = clk_per;
priv->clk_src = clk_src;
priv->reg_xceiver = reg_xceiver;
+ priv->xceiver = xceiver;
if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) {
priv->irq_boff = platform_get_irq(pdev, 1);
diff --git a/drivers/net/can/flexcan/flexcan.h b/drivers/net/can/flexcan/flexcan.h
index 4933d8c7439e62b5d6fcc445d88c2b5ccbfa13bb..56be40875eee24aee9297c4bc7c2fc4380e682ff 100644
--- a/drivers/net/can/flexcan/flexcan.h
+++ b/drivers/net/can/flexcan/flexcan.h
@@ -103,6 +103,7 @@ struct flexcan_priv {
struct clk *clk_per;
struct flexcan_devtype_data devtype_data;
struct regulator *reg_xceiver;
+ struct phy *xceiver;
struct flexcan_stop_mode stm;
int irq_boff;
--
2.39.5
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-11 13:12 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
@ 2025-02-11 16:38 ` Conor Dooley
2025-02-12 19:52 ` Dimitri Fedrau
2025-02-19 9:15 ` Marc Kleine-Budde
1 sibling, 1 reply; 14+ messages in thread
From: Conor Dooley @ 2025-02-11 16:38 UTC (permalink / raw)
To: dimitri.fedrau
Cc: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree, Dimitri Fedrau
[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]
On Tue, Feb 11, 2025 at 02:12:33PM +0100, Dimitri Fedrau via B4 Relay wrote:
> From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
>
> Currently the flexcan driver does not support adding PHYs. Add the
> capability to ensure that the PHY is in operational state when the link
> is set to an "up" state.
>
> Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> ---
> Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> index 97dd1a7c5ed26bb7f1b2f78c326d91e2c299938a..397957569588a61111a313cf9107e29dacc9e667 100644
> --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> @@ -70,6 +70,9 @@ properties:
> xceiver-supply:
> description: Regulator that powers the CAN transceiver.
>
> + phys:
> + maxItems: 1
Can all devices in this binding support external phy? Are all devices
limited to a single external phy?
> +
> big-endian:
> $ref: /schemas/types.yaml#/definitions/flag
> description: |
>
> --
> 2.39.5
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-11 16:38 ` Conor Dooley
@ 2025-02-12 19:52 ` Dimitri Fedrau
2025-02-13 20:07 ` Conor Dooley
0 siblings, 1 reply; 14+ messages in thread
From: Dimitri Fedrau @ 2025-02-12 19:52 UTC (permalink / raw)
To: Conor Dooley
Cc: dimitri.fedrau, Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree
Am Tue, Feb 11, 2025 at 04:38:48PM +0000 schrieb Conor Dooley:
> On Tue, Feb 11, 2025 at 02:12:33PM +0100, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
> > Currently the flexcan driver does not support adding PHYs. Add the
> > capability to ensure that the PHY is in operational state when the link
> > is set to an "up" state.
> >
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > ---
> > Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > index 97dd1a7c5ed26bb7f1b2f78c326d91e2c299938a..397957569588a61111a313cf9107e29dacc9e667 100644
> > --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > @@ -70,6 +70,9 @@ properties:
> > xceiver-supply:
> > description: Regulator that powers the CAN transceiver.
> >
> > + phys:
> > + maxItems: 1
>
> Can all devices in this binding support external phy? Are all devices
> limited to a single external phy?
>
As far as I know, these devices are controllers without integrated PHY.
So they need a single external PHY. Transceivers can be very simple like
xceiver-supply in the binding, but I want to use "ti,tcan1043" in
drivers/phy/phy-can-transceiver.
Best regards,
Dimitri Fedrau
[...]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-12 19:52 ` Dimitri Fedrau
@ 2025-02-13 20:07 ` Conor Dooley
2025-02-14 5:05 ` Dimitri Fedrau
0 siblings, 1 reply; 14+ messages in thread
From: Conor Dooley @ 2025-02-13 20:07 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: dimitri.fedrau, Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree
[-- Attachment #1: Type: text/plain, Size: 1794 bytes --]
On Wed, Feb 12, 2025 at 08:52:04PM +0100, Dimitri Fedrau wrote:
> Am Tue, Feb 11, 2025 at 04:38:48PM +0000 schrieb Conor Dooley:
> > On Tue, Feb 11, 2025 at 02:12:33PM +0100, Dimitri Fedrau via B4 Relay wrote:
> > > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > >
> > > Currently the flexcan driver does not support adding PHYs. Add the
> > > capability to ensure that the PHY is in operational state when the link
> > > is set to an "up" state.
> > >
> > > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > > ---
> > > Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > index 97dd1a7c5ed26bb7f1b2f78c326d91e2c299938a..397957569588a61111a313cf9107e29dacc9e667 100644
> > > --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > @@ -70,6 +70,9 @@ properties:
> > > xceiver-supply:
> > > description: Regulator that powers the CAN transceiver.
> > >
> > > + phys:
> > > + maxItems: 1
> >
> > Can all devices in this binding support external phy? Are all devices
> > limited to a single external phy?
> >
> As far as I know, these devices are controllers without integrated PHY.
> So they need a single external PHY. Transceivers can be very simple like
> xceiver-supply in the binding, but I want to use "ti,tcan1043" in
> drivers/phy/phy-can-transceiver.
I'm not quite following, do all of these devices need to have an
external phy but the property did not exist until now? How did any of
them work, if that's the case?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-13 20:07 ` Conor Dooley
@ 2025-02-14 5:05 ` Dimitri Fedrau
2025-02-18 17:15 ` Conor Dooley
0 siblings, 1 reply; 14+ messages in thread
From: Dimitri Fedrau @ 2025-02-14 5:05 UTC (permalink / raw)
To: Conor Dooley
Cc: dimitri.fedrau, Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree
Am Thu, Feb 13, 2025 at 08:07:22PM +0000 schrieb Conor Dooley:
> On Wed, Feb 12, 2025 at 08:52:04PM +0100, Dimitri Fedrau wrote:
> > Am Tue, Feb 11, 2025 at 04:38:48PM +0000 schrieb Conor Dooley:
> > > On Tue, Feb 11, 2025 at 02:12:33PM +0100, Dimitri Fedrau via B4 Relay wrote:
> > > > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > > >
> > > > Currently the flexcan driver does not support adding PHYs. Add the
> > > > capability to ensure that the PHY is in operational state when the link
> > > > is set to an "up" state.
> > > >
> > > > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > > > ---
> > > > Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
> > > > 1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > > index 97dd1a7c5ed26bb7f1b2f78c326d91e2c299938a..397957569588a61111a313cf9107e29dacc9e667 100644
> > > > --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > > @@ -70,6 +70,9 @@ properties:
> > > > xceiver-supply:
> > > > description: Regulator that powers the CAN transceiver.
> > > >
> > > > + phys:
> > > > + maxItems: 1
> > >
> > > Can all devices in this binding support external phy? Are all devices
> > > limited to a single external phy?
> > >
> > As far as I know, these devices are controllers without integrated PHY.
> > So they need a single external PHY. Transceivers can be very simple like
> > xceiver-supply in the binding, but I want to use "ti,tcan1043" in
> > drivers/phy/phy-can-transceiver.
>
> I'm not quite following, do all of these devices need to have an
> external phy but the property did not exist until now? How did any of
> them work, if that's the case?
The property xceiver-supply is used to describe connected transceiver
which do only rely on corresponding regulator configuration.
For example here:
https://elixir.bootlin.com/linux/v6.14-rc2/source/arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi#L105
But I want to enable support for these:
https://elixir.bootlin.com/linux/v6.14-rc2/source/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
Best regards,
Dimitri Fedrau
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-14 5:05 ` Dimitri Fedrau
@ 2025-02-18 17:15 ` Conor Dooley
0 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2025-02-18 17:15 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: dimitri.fedrau, Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree
[-- Attachment #1: Type: text/plain, Size: 2591 bytes --]
On Fri, Feb 14, 2025 at 06:05:40AM +0100, Dimitri Fedrau wrote:
> Am Thu, Feb 13, 2025 at 08:07:22PM +0000 schrieb Conor Dooley:
> > On Wed, Feb 12, 2025 at 08:52:04PM +0100, Dimitri Fedrau wrote:
> > > Am Tue, Feb 11, 2025 at 04:38:48PM +0000 schrieb Conor Dooley:
> > > > On Tue, Feb 11, 2025 at 02:12:33PM +0100, Dimitri Fedrau via B4 Relay wrote:
> > > > > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > > > >
> > > > > Currently the flexcan driver does not support adding PHYs. Add the
> > > > > capability to ensure that the PHY is in operational state when the link
> > > > > is set to an "up" state.
> > > > >
> > > > > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > > > > ---
> > > > > Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 3 +++
> > > > > 1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > > > index 97dd1a7c5ed26bb7f1b2f78c326d91e2c299938a..397957569588a61111a313cf9107e29dacc9e667 100644
> > > > > --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > > > +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> > > > > @@ -70,6 +70,9 @@ properties:
> > > > > xceiver-supply:
> > > > > description: Regulator that powers the CAN transceiver.
> > > > >
> > > > > + phys:
> > > > > + maxItems: 1
> > > >
> > > > Can all devices in this binding support external phy? Are all devices
> > > > limited to a single external phy?
> > > >
> > > As far as I know, these devices are controllers without integrated PHY.
> > > So they need a single external PHY. Transceivers can be very simple like
> > > xceiver-supply in the binding, but I want to use "ti,tcan1043" in
> > > drivers/phy/phy-can-transceiver.
> >
> > I'm not quite following, do all of these devices need to have an
> > external phy but the property did not exist until now? How did any of
> > them work, if that's the case?
>
> The property xceiver-supply is used to describe connected transceiver
> which do only rely on corresponding regulator configuration.
> For example here:
> https://elixir.bootlin.com/linux/v6.14-rc2/source/arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi#L105
>
> But I want to enable support for these:
> https://elixir.bootlin.com/linux/v6.14-rc2/source/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Thanks for the explanation,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-11 13:12 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
2025-02-11 16:38 ` Conor Dooley
@ 2025-02-19 9:15 ` Marc Kleine-Budde
2025-02-19 10:28 ` Dimitri Fedrau
1 sibling, 1 reply; 14+ messages in thread
From: Marc Kleine-Budde @ 2025-02-19 9:15 UTC (permalink / raw)
To: Dimitri Fedrau via B4 Relay
Cc: Vincent Mailhol, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-can, linux-kernel, devicetree, Dimitri Fedrau,
Dimitri Fedrau
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
Hey Dimitri,
thanks for your contribution!
On 11.02.2025 14:12:33, Dimitri Fedrau via B4 Relay wrote:
> From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
>
> Currently the flexcan driver does not support adding PHYs.
That's not 100% correct. The flexcan driver does support PHYs, but via
the old can-transceiver binding.
Can you rephrase the commit message.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] can: flexcan: add transceiver capabilities
2025-02-11 13:12 ` [PATCH 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
@ 2025-02-19 9:41 ` Marc Kleine-Budde
2025-02-19 10:39 ` Dimitri Fedrau
0 siblings, 1 reply; 14+ messages in thread
From: Marc Kleine-Budde @ 2025-02-19 9:41 UTC (permalink / raw)
To: Dimitri Fedrau via B4 Relay
Cc: Vincent Mailhol, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-can, linux-kernel, devicetree, Dimitri Fedrau,
Dimitri Fedrau
[-- Attachment #1: Type: text/plain, Size: 4017 bytes --]
On 11.02.2025 14:12:34, Dimitri Fedrau via B4 Relay wrote:
> From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
>
> Currently the flexcan driver does not support adding PHYs. Add the
> capability to ensure that the PHY is in operational state when the link
> is set to an "up" state.
>
> Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> ---
> drivers/net/can/flexcan/flexcan-core.c | 25 +++++++++++++++++++------
> drivers/net/can/flexcan/flexcan.h | 1 +
> 2 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index ac1a860986df69a1dd64c25ff879490d5b21073b..a03dc8e3c80546a0e2fa9a85f0e0cc8159afa4f0 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -30,6 +30,7 @@
> #include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/phy/phy.h>
>
> #include "flexcan.h"
>
> @@ -634,18 +635,22 @@ static void flexcan_clks_disable(const struct flexcan_priv *priv)
>
> static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv)
> {
> - if (!priv->reg_xceiver)
> - return 0;
> + if (priv->reg_xceiver)
> + return regulator_enable(priv->reg_xceiver);
> + else if (priv->xceiver)
> + return phy_power_on(priv->xceiver);
>
> - return regulator_enable(priv->reg_xceiver);
> + return 0;
> }
>
> static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv)
> {
> - if (!priv->reg_xceiver)
> - return 0;
> + if (priv->reg_xceiver)
> + return regulator_disable(priv->reg_xceiver);
> + else if (priv->xceiver)
> + return phy_power_off(priv->xceiver);
>
> - return regulator_disable(priv->reg_xceiver);
> + return 0;
> }
>
> static int flexcan_chip_enable(struct flexcan_priv *priv)
> @@ -2061,6 +2066,7 @@ static int flexcan_probe(struct platform_device *pdev)
> struct net_device *dev;
> struct flexcan_priv *priv;
> struct regulator *reg_xceiver;
> + struct phy *xceiver;
> struct clk *clk_ipg = NULL, *clk_per = NULL;
> struct flexcan_regs __iomem *regs;
> struct flexcan_platform_data *pdata;
> @@ -2076,6 +2082,12 @@ static int flexcan_probe(struct platform_device *pdev)
> else if (IS_ERR(reg_xceiver))
> return PTR_ERR(reg_xceiver);
>
> + xceiver = devm_phy_optional_get(&pdev->dev, NULL);
> + if (IS_ERR(xceiver)) {
> + dev_err(&pdev->dev, "failed to get phy\n");
> + return PTR_ERR(xceiver);
> + }
> +
> if (pdev->dev.of_node) {
> of_property_read_u32(pdev->dev.of_node,
> "clock-frequency", &clock_freq);
> @@ -2173,6 +2185,7 @@ static int flexcan_probe(struct platform_device *pdev)
> priv->clk_per = clk_per;
> priv->clk_src = clk_src;
> priv->reg_xceiver = reg_xceiver;
> + priv->xceiver = xceiver;
>
> if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) {
> priv->irq_boff = platform_get_irq(pdev, 1);
please also add
if (xceiver)
priv->can.bitrate_max = xceiver->attrs.max_link_rate;
> diff --git a/drivers/net/can/flexcan/flexcan.h b/drivers/net/can/flexcan/flexcan.h
> index 4933d8c7439e62b5d6fcc445d88c2b5ccbfa13bb..56be40875eee24aee9297c4bc7c2fc4380e682ff 100644
> --- a/drivers/net/can/flexcan/flexcan.h
> +++ b/drivers/net/can/flexcan/flexcan.h
> @@ -103,6 +103,7 @@ struct flexcan_priv {
> struct clk *clk_per;
> struct flexcan_devtype_data devtype_data;
> struct regulator *reg_xceiver;
> + struct phy *xceiver;
All other drivers name this variable "transceiver", does it make sense
to use this name here, too?
> struct flexcan_stop_mode stm;
>
> int irq_boff;
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
@ 2025-02-19 10:14 Fedrau Dimitri (LED)
0 siblings, 0 replies; 14+ messages in thread
From: Fedrau Dimitri (LED) @ 2025-02-19 10:14 UTC (permalink / raw)
To: Marc Kleine-Budde, Dimitri Fedrau via B4 Relay
Cc: Vincent Mailhol, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Dimitri Fedrau
Von: Marc Kleine-Budde <mkl@pengutronix.de>
Gesendet: Mittwoch, 19. Februar 2025 10:15
> Hey Dimitri,
>
> thanks for your contribution!
>
> On 11.02.2025 14:12:33, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
> > Currently the flexcan driver does not support adding PHYs.
>
> That's not 100% correct. The flexcan driver does support PHYs, but via
> the old can-transceiver binding.
>
> Can you rephrase the commit message.
You are right, will fix it in V2.
Best regards,
Dimitri Fedrau
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-19 9:15 ` Marc Kleine-Budde
@ 2025-02-19 10:28 ` Dimitri Fedrau
0 siblings, 0 replies; 14+ messages in thread
From: Dimitri Fedrau @ 2025-02-19 10:28 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Dimitri Fedrau via B4 Relay, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree, Dimitri Fedrau
Hi Marc,
thanks for reviewing. I think I messed up with the previous answer using
my corporate mail account. Sorry.
Am Wed, Feb 19, 2025 at 10:15:11AM +0100 schrieb Marc Kleine-Budde:
> Hey Dimitri,
>
> thanks for your contribution!
>
> On 11.02.2025 14:12:33, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
> > Currently the flexcan driver does not support adding PHYs.
>
> That's not 100% correct. The flexcan driver does support PHYs, but via
> the old can-transceiver binding.
>
> Can you rephrase the commit message.
You are right, will fix it in V2
Best regards,
Dimitri Fedrau
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] can: flexcan: add transceiver capabilities
2025-02-19 9:41 ` Marc Kleine-Budde
@ 2025-02-19 10:39 ` Dimitri Fedrau
2025-02-19 11:00 ` Marc Kleine-Budde
0 siblings, 1 reply; 14+ messages in thread
From: Dimitri Fedrau @ 2025-02-19 10:39 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Dimitri Fedrau via B4 Relay, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree, Dimitri Fedrau
Hi Marc,
Am Wed, Feb 19, 2025 at 10:41:24AM +0100 schrieb Marc Kleine-Budde:
> On 11.02.2025 14:12:34, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
[...]
> > +
> > if (pdev->dev.of_node) {
> > of_property_read_u32(pdev->dev.of_node,
> > "clock-frequency", &clock_freq);
> > @@ -2173,6 +2185,7 @@ static int flexcan_probe(struct platform_device *pdev)
> > priv->clk_per = clk_per;
> > priv->clk_src = clk_src;
> > priv->reg_xceiver = reg_xceiver;
> > + priv->xceiver = xceiver;
> >
> > if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) {
> > priv->irq_boff = platform_get_irq(pdev, 1);
>
> please also add
> if (xceiver)
> priv->can.bitrate_max = xceiver->attrs.max_link_rate;
>
>
Yes, will add it.
> > diff --git a/drivers/net/can/flexcan/flexcan.h b/drivers/net/can/flexcan/flexcan.h
> > index 4933d8c7439e62b5d6fcc445d88c2b5ccbfa13bb..56be40875eee24aee9297c4bc7c2fc4380e682ff 100644
> > --- a/drivers/net/can/flexcan/flexcan.h
> > +++ b/drivers/net/can/flexcan/flexcan.h
> > @@ -103,6 +103,7 @@ struct flexcan_priv {
> > struct clk *clk_per;
> > struct flexcan_devtype_data devtype_data;
> > struct regulator *reg_xceiver;
> > + struct phy *xceiver;
>
> All other drivers name this variable "transceiver", does it make sense
> to use this name here, too?
>
I have no preference on this, but my intention was to name it xceiver
according to reg_xceiver, so people familiar with the code would know
what it is about. I can change it to transceiver, what do you think ?
Best regards,
Dimitri Fedrau
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] can: flexcan: add transceiver capabilities
2025-02-19 10:39 ` Dimitri Fedrau
@ 2025-02-19 11:00 ` Marc Kleine-Budde
0 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2025-02-19 11:00 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: Dimitri Fedrau via B4 Relay, Vincent Mailhol, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-can, linux-kernel,
devicetree, Dimitri Fedrau
[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]
On 19.02.2025 11:39:55, Dimitri Fedrau wrote:
> > > diff --git a/drivers/net/can/flexcan/flexcan.h b/drivers/net/can/flexcan/flexcan.h
> > > index 4933d8c7439e62b5d6fcc445d88c2b5ccbfa13bb..56be40875eee24aee9297c4bc7c2fc4380e682ff 100644
> > > --- a/drivers/net/can/flexcan/flexcan.h
> > > +++ b/drivers/net/can/flexcan/flexcan.h
> > > @@ -103,6 +103,7 @@ struct flexcan_priv {
> > > struct clk *clk_per;
> > > struct flexcan_devtype_data devtype_data;
> > > struct regulator *reg_xceiver;
> > > + struct phy *xceiver;
> >
> > All other drivers name this variable "transceiver", does it make sense
> > to use this name here, too?
> >
> I have no preference on this, but my intention was to name it xceiver
> according to reg_xceiver, so people familiar with the code would know
> what it is about. I can change it to transceiver, what do you think ?
Please use transceiver.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-02-19 11:00 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 13:12 [PATCH 0/2] can: flexcan: add transceiver capabilities Dimitri Fedrau via B4 Relay
2025-02-11 13:12 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
2025-02-11 16:38 ` Conor Dooley
2025-02-12 19:52 ` Dimitri Fedrau
2025-02-13 20:07 ` Conor Dooley
2025-02-14 5:05 ` Dimitri Fedrau
2025-02-18 17:15 ` Conor Dooley
2025-02-19 9:15 ` Marc Kleine-Budde
2025-02-19 10:28 ` Dimitri Fedrau
2025-02-11 13:12 ` [PATCH 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
2025-02-19 9:41 ` Marc Kleine-Budde
2025-02-19 10:39 ` Dimitri Fedrau
2025-02-19 11:00 ` Marc Kleine-Budde
-- strict thread matches above, loose matches on Subject: below --
2025-02-19 10:14 [PATCH 1/2] dt-bindings: can: fsl,flexcan: " Fedrau Dimitri (LED)
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).