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