[PATCH 2/2] can: m_can: tcan4x5x: reset device before register access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's a good idea to reset a ip-block/spi device before using it,
this patch will reset the device.

Signed-off-by: Sean Nyekjaer <sean@xxxxxxxxxx>
---
 drivers/net/can/m_can/tcan4x5x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c
index 7f26c2d53f8c..dd812d40d475 100644
--- a/drivers/net/can/m_can/tcan4x5x.c
+++ b/drivers/net/can/m_can/tcan4x5x.c
@@ -361,14 +361,15 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev)
 
 		tcan4x5x_disable_wake(cdev);
 	}
-
 	tcan4x5x->reset_gpio = devm_gpiod_get_optional(cdev->dev, "reset",
-						       GPIOD_OUT_LOW);
+						       GPIOD_OUT_HIGH);
 	if (IS_ERR(tcan4x5x->reset_gpio))
 		tcan4x5x->reset_gpio = NULL;
 
 	usleep_range(700, 1000);
 
+	gpiod_set_value(tcan4x5x->reset_gpio, 0);
+
 	tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev,
 							      "device-state",
 							      GPIOD_IN);
-- 
2.24.0




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux