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> --- 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); + } usleep_range(700, 1000); -- 2.24.0