* [PATCH v2 0/2] can: flexcan: add transceiver capabilities
@ 2025-02-20 8:22 Dimitri Fedrau via B4 Relay
2025-02-20 8:22 ` [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
2025-02-20 8:22 ` [PATCH v2 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
0 siblings, 2 replies; 9+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-02-20 8:22 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, Conor Dooley
Currently the flexcan driver does only support adding PHYs by using the
"old" regulator bindings. Add support for CAN transceivers as a PHY. 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>
---
Changes in v2:
- Rename variable xceiver to transceiver in struct flexcan_priv and in
flexcan_probe
- Set priv->can.bitrate_max if transceiver is found
- Fix commit messages which claim that transceivers are not supported
- Do not print error on EPROBE_DEFER after calling devm_phy_optional_get in
flexcan_probe
- Link to v1: https://lore.kernel.org/r/20250211-flexcan-add-transceiver-caps-v1-0-c6abb7817b0f@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 | 30 +++++++++++++++++-----
drivers/net/can/flexcan/flexcan.h | 1 +
3 files changed, 28 insertions(+), 6 deletions(-)
---
base-commit: 6a24171b9625471abfc90c7b28c4b45bee64b3a4
change-id: 20241209-flexcan-add-transceiver-caps-7cff9400c926
Best regards,
--
Dimitri Fedrau <dimitri.fedrau@liebherr.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-20 8:22 [PATCH v2 0/2] can: flexcan: add transceiver capabilities Dimitri Fedrau via B4 Relay
@ 2025-02-20 8:22 ` Dimitri Fedrau via B4 Relay
2025-02-20 8:44 ` Marc Kleine-Budde
2025-02-20 8:22 ` [PATCH v2 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
1 sibling, 1 reply; 9+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-02-20 8:22 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, Conor Dooley
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Currently the flexcan driver does only support adding PHYs by using the
"old" regulator bindings. Add support for CAN transceivers as a PHY.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
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 73252fe56fe6c8e9fd19142208bb655dc86d47cd..a7b9ae2b2546b801623117179e16c4ffc11a234e 100644
--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
+++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
@@ -77,6 +77,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] 9+ messages in thread* Re: [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-20 8:22 ` [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
@ 2025-02-20 8:44 ` Marc Kleine-Budde
2025-02-20 15:56 ` Dimitri Fedrau
0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2025-02-20 8:44 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, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]
On 20.02.2025 09:22:10, Dimitri Fedrau via B4 Relay wrote:
> From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
>
> Currently the flexcan driver does only support adding PHYs by using the
> "old" regulator bindings. Add support for CAN transceivers as a PHY.
>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Is it possible express in the biding that we either want to have
xceiver-supply or phys?
regards,
Marc
> ---
> 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 73252fe56fe6c8e9fd19142208bb655dc86d47cd..a7b9ae2b2546b801623117179e16c4ffc11a234e 100644
> --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> @@ -77,6 +77,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
>
>
>
--
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] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-20 8:44 ` Marc Kleine-Budde
@ 2025-02-20 15:56 ` Dimitri Fedrau
2025-02-20 16:02 ` Marc Kleine-Budde
0 siblings, 1 reply; 9+ messages in thread
From: Dimitri Fedrau @ 2025-02-20 15:56 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, Conor Dooley
Am Thu, Feb 20, 2025 at 09:44:50AM +0100 schrieb Marc Kleine-Budde:
> On 20.02.2025 09:22:10, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
> > Currently the flexcan driver does only support adding PHYs by using the
> > "old" regulator bindings. Add support for CAN transceivers as a PHY.
> >
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
>
> Is it possible express in the biding that we either want to have
> xceiver-supply or phys?
>
I didn't found anything to express that in the binding.
Best regards,
Dimitri Fedrau
[...]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-20 15:56 ` Dimitri Fedrau
@ 2025-02-20 16:02 ` Marc Kleine-Budde
2025-02-20 17:20 ` Conor Dooley
0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2025-02-20 16:02 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, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]
On 20.02.2025 16:56:42, Dimitri Fedrau wrote:
> Am Thu, Feb 20, 2025 at 09:44:50AM +0100 schrieb Marc Kleine-Budde:
> > On 20.02.2025 09:22:10, Dimitri Fedrau via B4 Relay wrote:
> > > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > >
> > > Currently the flexcan driver does only support adding PHYs by using the
> > > "old" regulator bindings. Add support for CAN transceivers as a PHY.
> > >
> > > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> > > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
> > Is it possible express in the biding that we either want to have
> > xceiver-supply or phys?
> >
> I didn't found anything to express that in the binding.
What about something like this:
| dependencies:
| prop-a: ["!prop-b"]
| prop-b: ["!prop-a"]
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] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities
2025-02-20 16:02 ` Marc Kleine-Budde
@ 2025-02-20 17:20 ` Conor Dooley
0 siblings, 0 replies; 9+ messages in thread
From: Conor Dooley @ 2025-02-20 17:20 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Dimitri Fedrau, Dimitri Fedrau via B4 Relay, Vincent Mailhol,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-can,
linux-kernel, devicetree, Dimitri Fedrau, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]
On Thu, Feb 20, 2025 at 05:02:56PM +0100, Marc Kleine-Budde wrote:
> On 20.02.2025 16:56:42, Dimitri Fedrau wrote:
> > Am Thu, Feb 20, 2025 at 09:44:50AM +0100 schrieb Marc Kleine-Budde:
> > > On 20.02.2025 09:22:10, Dimitri Fedrau via B4 Relay wrote:
> > > > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > > >
> > > > Currently the flexcan driver does only support adding PHYs by using the
> > > > "old" regulator bindings. Add support for CAN transceivers as a PHY.
> > > >
> > > > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> > > > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > >
> > > Is it possible express in the biding that we either want to have
> > > xceiver-supply or phys?
> > >
> > I didn't found anything to express that in the binding.
>
> What about something like this:
>
> | dependencies:
> | prop-a: ["!prop-b"]
> | prop-b: ["!prop-a"]
# the internal reference buffer always requires high-z mode
- if:
required:
- refin-supply
then:
properties:
adi,no-ref-high-z: false
Do it like so ;)
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] can: flexcan: add transceiver capabilities
2025-02-20 8:22 [PATCH v2 0/2] can: flexcan: add transceiver capabilities Dimitri Fedrau via B4 Relay
2025-02-20 8:22 ` [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
@ 2025-02-20 8:22 ` Dimitri Fedrau via B4 Relay
2025-02-20 8:43 ` Marc Kleine-Budde
1 sibling, 1 reply; 9+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-02-20 8:22 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 only support adding PHYs by using the
"old" regulator bindings. Add support for CAN transceivers as a PHY. 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 | 30 ++++++++++++++++++++++++------
drivers/net/can/flexcan/flexcan.h | 1 +
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index b347a1c93536d54efaa5f7d3347bd47c20860b3e..45d9a6957d9a806ed80d810a6a5f7eb99fcc702c 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"
@@ -644,18 +645,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->transceiver)
+ return phy_power_on(priv->transceiver);
- 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->transceiver)
+ return phy_power_off(priv->transceiver);
- return regulator_disable(priv->reg_xceiver);
+ return 0;
}
static int flexcan_chip_enable(struct flexcan_priv *priv)
@@ -2086,6 +2091,7 @@ static int flexcan_probe(struct platform_device *pdev)
struct net_device *dev;
struct flexcan_priv *priv;
struct regulator *reg_xceiver;
+ struct phy *transceiver;
struct clk *clk_ipg = NULL, *clk_per = NULL;
struct flexcan_regs __iomem *regs;
struct flexcan_platform_data *pdata;
@@ -2101,6 +2107,14 @@ static int flexcan_probe(struct platform_device *pdev)
else if (IS_ERR(reg_xceiver))
return PTR_ERR(reg_xceiver);
+ transceiver = devm_phy_optional_get(&pdev->dev, NULL);
+ if (PTR_ERR(transceiver) == -EPROBE_DEFER) {
+ return -EPROBE_DEFER;
+ } else if (IS_ERR(transceiver)) {
+ dev_err(&pdev->dev, "failed to get phy\n");
+ return PTR_ERR(transceiver);
+ }
+
if (pdev->dev.of_node) {
of_property_read_u32(pdev->dev.of_node,
"clock-frequency", &clock_freq);
@@ -2198,6 +2212,10 @@ static int flexcan_probe(struct platform_device *pdev)
priv->clk_per = clk_per;
priv->clk_src = clk_src;
priv->reg_xceiver = reg_xceiver;
+ priv->transceiver = transceiver;
+
+ if (transceiver)
+ priv->can.bitrate_max = transceiver->attrs.max_link_rate;
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 2cf886618c9621166173b865f266830b3f6c1fb0..16692a2502eba26575eeeec83dfffdf35f07b034 100644
--- a/drivers/net/can/flexcan/flexcan.h
+++ b/drivers/net/can/flexcan/flexcan.h
@@ -107,6 +107,7 @@ struct flexcan_priv {
struct clk *clk_per;
struct flexcan_devtype_data devtype_data;
struct regulator *reg_xceiver;
+ struct phy *transceiver;
struct flexcan_stop_mode stm;
int irq_boff;
--
2.39.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/2] can: flexcan: add transceiver capabilities
2025-02-20 8:22 ` [PATCH v2 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
@ 2025-02-20 8:43 ` Marc Kleine-Budde
2025-02-20 15:57 ` Dimitri Fedrau
0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2025-02-20 8:43 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: 3135 bytes --]
On 20.02.2025 09:22:11, Dimitri Fedrau via B4 Relay wrote:
> From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
>
> Currently the flexcan driver does only support adding PHYs by using the
> "old" regulator bindings. Add support for CAN transceivers as a PHY. 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 | 30 ++++++++++++++++++++++++------
> drivers/net/can/flexcan/flexcan.h | 1 +
> 2 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index b347a1c93536d54efaa5f7d3347bd47c20860b3e..45d9a6957d9a806ed80d810a6a5f7eb99fcc702c 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"
>
> @@ -644,18 +645,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->transceiver)
> + return phy_power_on(priv->transceiver);
>
> - 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->transceiver)
> + return phy_power_off(priv->transceiver);
>
> - return regulator_disable(priv->reg_xceiver);
> + return 0;
> }
>
> static int flexcan_chip_enable(struct flexcan_priv *priv)
> @@ -2086,6 +2091,7 @@ static int flexcan_probe(struct platform_device *pdev)
> struct net_device *dev;
> struct flexcan_priv *priv;
> struct regulator *reg_xceiver;
> + struct phy *transceiver;
> struct clk *clk_ipg = NULL, *clk_per = NULL;
> struct flexcan_regs __iomem *regs;
> struct flexcan_platform_data *pdata;
> @@ -2101,6 +2107,14 @@ static int flexcan_probe(struct platform_device *pdev)
> else if (IS_ERR(reg_xceiver))
> return PTR_ERR(reg_xceiver);
>
> + transceiver = devm_phy_optional_get(&pdev->dev, NULL);
> + if (PTR_ERR(transceiver) == -EPROBE_DEFER) {
> + return -EPROBE_DEFER;
> + } else if (IS_ERR(transceiver)) {
> + dev_err(&pdev->dev, "failed to get phy\n");
> + return PTR_ERR(transceiver);
> + }
Please use dev_err_probe(), it will be silent in case of EPROBE_DEFER.
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] 9+ messages in thread* Re: [PATCH v2 2/2] can: flexcan: add transceiver capabilities
2025-02-20 8:43 ` Marc Kleine-Budde
@ 2025-02-20 15:57 ` Dimitri Fedrau
0 siblings, 0 replies; 9+ messages in thread
From: Dimitri Fedrau @ 2025-02-20 15:57 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
Am Thu, Feb 20, 2025 at 09:43:13AM +0100 schrieb Marc Kleine-Budde:
> On 20.02.2025 09:22:11, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> >
> > Currently the flexcan driver does only support adding PHYs by using the
> > "old" regulator bindings. Add support for CAN transceivers as a PHY. 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 | 30 ++++++++++++++++++++++++------
> > drivers/net/can/flexcan/flexcan.h | 1 +
> > 2 files changed, 25 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> > index b347a1c93536d54efaa5f7d3347bd47c20860b3e..45d9a6957d9a806ed80d810a6a5f7eb99fcc702c 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"
> >
> > @@ -644,18 +645,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->transceiver)
> > + return phy_power_on(priv->transceiver);
> >
> > - 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->transceiver)
> > + return phy_power_off(priv->transceiver);
> >
> > - return regulator_disable(priv->reg_xceiver);
> > + return 0;
> > }
> >
> > static int flexcan_chip_enable(struct flexcan_priv *priv)
> > @@ -2086,6 +2091,7 @@ static int flexcan_probe(struct platform_device *pdev)
> > struct net_device *dev;
> > struct flexcan_priv *priv;
> > struct regulator *reg_xceiver;
> > + struct phy *transceiver;
> > struct clk *clk_ipg = NULL, *clk_per = NULL;
> > struct flexcan_regs __iomem *regs;
> > struct flexcan_platform_data *pdata;
> > @@ -2101,6 +2107,14 @@ static int flexcan_probe(struct platform_device *pdev)
> > else if (IS_ERR(reg_xceiver))
> > return PTR_ERR(reg_xceiver);
> >
> > + transceiver = devm_phy_optional_get(&pdev->dev, NULL);
> > + if (PTR_ERR(transceiver) == -EPROBE_DEFER) {
> > + return -EPROBE_DEFER;
> > + } else if (IS_ERR(transceiver)) {
> > + dev_err(&pdev->dev, "failed to get phy\n");
> > + return PTR_ERR(transceiver);
> > + }
>
> Please use dev_err_probe(), it will be silent in case of EPROBE_DEFER.
Will fix it.
Best regards,
Dimitri Fedrau
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-02-20 17:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 8:22 [PATCH v2 0/2] can: flexcan: add transceiver capabilities Dimitri Fedrau via B4 Relay
2025-02-20 8:22 ` [PATCH v2 1/2] dt-bindings: can: fsl,flexcan: " Dimitri Fedrau via B4 Relay
2025-02-20 8:44 ` Marc Kleine-Budde
2025-02-20 15:56 ` Dimitri Fedrau
2025-02-20 16:02 ` Marc Kleine-Budde
2025-02-20 17:20 ` Conor Dooley
2025-02-20 8:22 ` [PATCH v2 2/2] can: flexcan: " Dimitri Fedrau via B4 Relay
2025-02-20 8:43 ` Marc Kleine-Budde
2025-02-20 15:57 ` Dimitri Fedrau
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).