On 09/12/2019 22.27, Dan Murphy wrote:
Sean
On 12/9/19 1:24 PM, Sean Nyekjaer wrote:
It's a good idea to reset a ip-block/spi device before using it,
this patch will reset the device.
$subject says 2/2 where is 1/2?
Here?
https://www.spinics.net/lists/linux-can/msg03020.html
I have them in a thread, in thunderbird...
Signed-off-by: Sean Nyekjaer <sean@xxxxxxxxxx>
---
Changes since v1:
- Added toggle of reset pin with required delay
- Only toggle reset pin if it exist
drivers/net/can/m_can/tcan4x5x.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/m_can/tcan4x5x.c
b/drivers/net/can/m_can/tcan4x5x.c
index 3c30209ca84c..5b26e494a7db 100644
--- a/drivers/net/can/m_can/tcan4x5x.c
+++ b/drivers/net/can/m_can/tcan4x5x.c
@@ -363,8 +363,15 @@ static int tcan4x5x_parse_config(struct
m_can_classdev *cdev)
tcan4x5x->reset_gpio = devm_gpiod_get_optional(cdev->dev, "reset",
GPIOD_OUT_LOW);
- if (IS_ERR(tcan4x5x->reset_gpio))
+ if (IS_ERR(tcan4x5x->reset_gpio)) {
tcan4x5x->reset_gpio = NULL;
+ } else {
+ gpiod_set_value(tcan4x5x->reset_gpio, 1);
+
+ /* tpulse_width minimum 30us */
+ usleep_range(30, 100);
+ gpiod_set_value(tcan4x5x->reset_gpio, 0);
I would still prefer a function that can be called.
I will post a V3 with a function :)
/Sean