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

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

 



Sean

On 12/9/19 2:48 AM, Sean Nyekjaer wrote:
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);

I was looking to add a common function to properly do the reset with the delay.

This way if resets are needed in other calls then the proper reset sequence is available.

Also this call  and the sleep assumes that the reset GPIO is available but they are optional.

Dan




[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