summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch
diff options
context:
space:
mode:
authorHarunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>2018-04-27 14:30:40 +0900
committerHarunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>2018-04-27 14:30:40 +0900
commitf8fb4a95d6f0ca9a92d3b9155e54ac1f3695a20d (patch)
tree7f5a50447e8a940b274c53581dc8af01e2fe0db6 /meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch
parent2e1a7e39e012ea4436c819f46cfcac05fb161184 (diff)
parentf4fad8b9a0d29946c39bb760b76bc9c16448555a (diff)
Merge remote-tracking branch 'cogent/v2.23.1' into sandbox/kingfisher_v2.23.1.20180427
Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com> Conflicts: meta-rcar-gen3-adas/conf/layer.conf meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend Change-Id: Ib0345634b8bec6a85357152138355d8f932bafc0
Diffstat (limited to 'meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch')
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch
new file mode 100644
index 0000000..646aa0c
--- /dev/null
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0108-can-mcp251x-add-reset-gpio-support.patch
@@ -0,0 +1,72 @@
+From b69e3fdc91fbc88cc32eb6794872e1f058681b04 Mon Sep 17 00:00:00 2001
+From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+Date: Mon, 26 Mar 2018 13:51:49 +0300
+Subject: [PATCH] can: mcp251x: add reset gpio support
+
+Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+---
+ drivers/net/can/spi/mcp251x.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
+index f3f05fe..ac78ce3 100644
+--- a/drivers/net/can/spi/mcp251x.c
++++ b/drivers/net/can/spi/mcp251x.c
+@@ -71,6 +71,7 @@
+ #include <linux/netdevice.h>
+ #include <linux/of.h>
+ #include <linux/of_device.h>
++#include <linux/of_gpio.h>
+ #include <linux/platform_device.h>
+ #include <linux/slab.h>
+ #include <linux/spi/spi.h>
+@@ -270,6 +271,7 @@ struct mcp251x_priv {
+ struct regulator *power;
+ struct regulator *transceiver;
+ struct clk *clk;
++ struct gpio_desc *rst;
+ };
+
+ #define MCP251X_IS(_model) \
+@@ -1031,9 +1033,21 @@ static int mcp251x_can_probe(struct spi_device *spi)
+ struct mcp251x_platform_data *pdata = dev_get_platdata(&spi->dev);
+ struct net_device *net;
+ struct mcp251x_priv *priv;
++ struct gpio_desc *reset_gpio;
+ struct clk *clk;
+ int freq, ret;
+
++ reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH);
++ if (IS_ERR(reset_gpio)) {
++ if (PTR_ERR(reset_gpio) == -EPROBE_DEFER)
++ return -EPROBE_DEFER;
++ dev_err(&spi->dev, "cannot get reset-gpios %ld\n",
++ PTR_ERR(reset_gpio));
++ reset_gpio = NULL;
++ } else {
++ gpiod_set_value_cansleep(reset_gpio, 1);
++ }
++
+ clk = devm_clk_get(&spi->dev, NULL);
+ if (IS_ERR(clk)) {
+ if (pdata)
+@@ -1074,6 +1088,7 @@ static int mcp251x_can_probe(struct spi_device *spi)
+ priv->model = spi_get_device_id(spi)->driver_data;
+ priv->net = net;
+ priv->clk = clk;
++ priv->rst = reset_gpio;
+
+ spi_set_drvdata(spi, priv);
+
+@@ -1185,6 +1200,8 @@ static int mcp251x_can_remove(struct spi_device *spi)
+
+ mcp251x_power_enable(priv->power, 0);
+
++ gpiod_set_value_cansleep(priv->rst, 0);
++
+ if (!IS_ERR(priv->clk))
+ clk_disable_unprepare(priv->clk);
+
+--
+1.9.1
+