* [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property
@ 2021-01-07 20:59 Fabio Estevam
2021-01-07 20:59 ` [PATCH 2/2] can: flexcan: allow the control of the STB CAN transceiver pin Fabio Estevam
2021-01-13 3:23 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property Rob Herring
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2021-01-07 20:59 UTC (permalink / raw)
To: mkl; +Cc: linux-can, qiangqing.zhang, robh+dt, devicetree, Fabio Estevam
It is very common to have an STB pin in CAN transceivers, which allows
putting the transceiver in standby or normal operation mode.
Add a new optional 'stb-gpios' property to describe this.
Signed-off-by: Fabio Estevam <festevam@gmail.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 0d2df30f19db..64f904c4b3d5 100644
--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
+++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
@@ -66,6 +66,9 @@ properties:
xceiver-supply:
description: Regulator that powers the CAN transceiver.
+ stb-gpios:
+ description: GPIO that controls the STB CAN transceiver pin.
+
big-endian:
$ref: /schemas/types.yaml#/definitions/flag
description: |
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] can: flexcan: allow the control of the STB CAN transceiver pin
2021-01-07 20:59 [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property Fabio Estevam
@ 2021-01-07 20:59 ` Fabio Estevam
2021-01-13 3:23 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property Rob Herring
1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2021-01-07 20:59 UTC (permalink / raw)
To: mkl; +Cc: linux-can, qiangqing.zhang, robh+dt, devicetree, Fabio Estevam
It is very common to have an STB pin in CAN transceivers, which allows
putting the transceiver in standby or normal operation mode.
Add support for handling the STB pin.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/net/can/flexcan.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 038fe1036df2..094050b4b461 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -17,6 +17,7 @@
#include <linux/can/rx-offload.h>
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
@@ -358,6 +359,8 @@ struct flexcan_priv {
struct regulator *reg_xceiver;
struct flexcan_stop_mode stm;
+ struct gpio_desc *stb;
+
/* Read and Write APIs */
u32 (*read)(void __iomem *addr);
void (*write)(u32 val, void __iomem *addr);
@@ -617,6 +620,8 @@ static void flexcan_clks_disable(const struct flexcan_priv *priv)
static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv)
{
+ gpiod_set_value_cansleep(priv->stb, 0);
+
if (!priv->reg_xceiver)
return 0;
@@ -625,6 +630,8 @@ static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv)
static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv)
{
+ gpiod_set_value_cansleep(priv->stb, 1);
+
if (!priv->reg_xceiver)
return 0;
@@ -2044,6 +2051,10 @@ static int flexcan_probe(struct platform_device *pdev)
priv->can.bittiming_const = &flexcan_bittiming_const;
}
+ priv->stb = devm_gpiod_get_optional(&pdev->dev, "stb", GPIOD_OUT_HIGH);
+ if (IS_ERR(priv->stb))
+ return PTR_ERR(priv->stb);
+
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property
2021-01-07 20:59 [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property Fabio Estevam
2021-01-07 20:59 ` [PATCH 2/2] can: flexcan: allow the control of the STB CAN transceiver pin Fabio Estevam
@ 2021-01-13 3:23 ` Rob Herring
1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2021-01-13 3:23 UTC (permalink / raw)
To: Fabio Estevam; +Cc: mkl, linux-can, qiangqing.zhang, devicetree
On Thu, Jan 07, 2021 at 05:59:14PM -0300, Fabio Estevam wrote:
> It is very common to have an STB pin in CAN transceivers, which allows
> putting the transceiver in standby or normal operation mode.
>
> Add a new optional 'stb-gpios' property to describe this.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.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 0d2df30f19db..64f904c4b3d5 100644
> --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> @@ -66,6 +66,9 @@ properties:
> xceiver-supply:
> description: Regulator that powers the CAN transceiver.
>
> + stb-gpios:
> + description: GPIO that controls the STB CAN transceiver pin.
maxItems: 1
> +
> big-endian:
> $ref: /schemas/types.yaml#/definitions/flag
> description: |
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-13 3:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-07 20:59 [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property Fabio Estevam
2021-01-07 20:59 ` [PATCH 2/2] can: flexcan: allow the control of the STB CAN transceiver pin Fabio Estevam
2021-01-13 3:23 ` [PATCH 1/2] dt-bindings: can: fsl,flexcan.yaml: introduce the stb-gpios property Rob Herring
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).