Re: [PATCH v2 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 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?


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.

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