netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Faiz Abbas <faiz_abbas@ti.com>
To: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linux-can@vger.kernel.org>
Cc: <catalin.marinas@arm.com>, <mark.rutland@arm.com>,
	<robh+dt@kernel.org>, <davem@davemloft.net>, <mkl@pengutronix.de>,
	<wg@grandegger.com>, <sriram.dash@samsung.com>, <dmurphy@ti.com>,
	<faiz_abbas@ti.com>, <nm@ti.com>, <t-kristo@ti.com>
Subject: [PATCH 2/3] can: m_can: m_can_platform: Add support for enabling transceiver through the STB line
Date: Wed, 22 Jan 2020 13:33:09 +0530	[thread overview]
Message-ID: <20200122080310.24653-3-faiz_abbas@ti.com> (raw)
In-Reply-To: <20200122080310.24653-1-faiz_abbas@ti.com>

CAN transceivers on some boards have an STB (standby) line which can be
toggled to enable/disable the transceiver. Add support for enabling the
transceiver using a GPIO connected to the STB line.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/net/can/m_can/m_can_platform.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/can/m_can/m_can_platform.c b/drivers/net/can/m_can/m_can_platform.c
index 38ea5e600fb8..b4e1423bd5d8 100644
--- a/drivers/net/can/m_can/m_can_platform.c
+++ b/drivers/net/can/m_can/m_can_platform.c
@@ -6,6 +6,7 @@
 // Copyright (C) 2018-19 Texas Instruments Incorporated - http://www.ti.com/
 
 #include <linux/platform_device.h>
+#include <linux/gpio/consumer.h>
 
 #include "m_can.h"
 
@@ -57,6 +58,7 @@ static int m_can_plat_probe(struct platform_device *pdev)
 {
 	struct m_can_classdev *mcan_class;
 	struct m_can_plat_priv *priv;
+	struct gpio_desc *stb;
 	struct resource *res;
 	void __iomem *addr;
 	void __iomem *mram_addr;
@@ -111,6 +113,16 @@ static int m_can_plat_probe(struct platform_device *pdev)
 
 	m_can_init_ram(mcan_class);
 
+	stb = devm_gpiod_get_optional(&pdev->dev, "stb", GPIOD_OUT_HIGH);
+	if (IS_ERR(stb)) {
+		ret = PTR_ERR(stb);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev,
+				"gpio request failed, ret %d\n", ret);
+
+		goto failed_ret;
+	}
+
 	ret = m_can_class_register(mcan_class);
 
 failed_ret:
-- 
2.19.2


  parent reply	other threads:[~2020-01-22  8:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22  8:03 [PATCH 0/3] Add Support for MCAN in AM654x-idk Faiz Abbas
2020-01-22  8:03 ` [PATCH 1/3] dt-bindings: net: can: m_can: Add Documentation for stb-gpios Faiz Abbas
2020-01-22 13:35   ` Dan Murphy
2020-01-22 14:24     ` Sekhar Nori
2020-01-22 14:34       ` Dan Murphy
2020-01-23  7:39         ` Faiz Abbas
2020-02-03 12:06           ` Rob Herring
2020-02-17 13:53             ` Faiz Abbas
2020-01-22  8:03 ` Faiz Abbas [this message]
2020-01-22 14:53   ` [PATCH 2/3] can: m_can: m_can_platform: Add support for enabling transceiver through the STB line Sriram Dash
2020-01-22  8:03 ` [PATCH 3/3] arm64: defconfig: Add Support for Bosch M_CAN controllers Faiz Abbas
2020-01-23 11:17 ` [PATCH 0/3] Add Support for MCAN in AM654x-idk Marc Kleine-Budde
2020-01-23 11:46   ` Faiz Abbas
2020-01-23 11:54     ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200122080310.24653-3-faiz_abbas@ti.com \
    --to=faiz_abbas@ti.com \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=sriram.dash@samsung.com \
    --cc=t-kristo@ti.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).