All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 1/2] can: tcan4x5x: put the device out of standby before register access
@ 2019-12-11 13:53 Sean Nyekjaer
  2019-12-11 13:54 ` Sean Nyekjaer
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Nyekjaer @ 2019-12-11 13:53 UTC (permalink / raw)
  To: mkl, dmurphy, linux-can; +Cc: Sean Nyekjaer, stable

The m_can tries to detect if Non ISO Operation is available while in
standby, this function results in the following error:

tcan4x5x spi2.0 (unnamed net_device) (uninitialized): Failed to init module
tcan4x5x spi2.0: m_can device registered (irq=84, version=32)
tcan4x5x spi2.0 can2: TCAN4X5X successfully initialized.

When the tcan device comes out of reset it comes out in standby mode.
The m_can driver tries to access the control register but fails due to
the device is in standby mode.

So this patch will put the tcan device in normal mode before the m_can
driver does the initialization.

Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Changes since v3:
 - added reset if the reset_gpio is not avaliable

Changes since v4:
 - added error handling for the SPI I/O

Changes since v5:
 - Removed braces for single statement if's

 drivers/net/can/m_can/tcan4x5x.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c
index c1b83dc26c3a..295dbb73c69e 100644
--- a/drivers/net/can/m_can/tcan4x5x.c
+++ b/drivers/net/can/m_can/tcan4x5x.c
@@ -484,6 +484,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
 	if (ret)
 		goto out_power;
 
+	ret = tcan4x5x_init(mcan_class);
+	if (ret)
+		goto out_power;
+
 	ret = m_can_class_register(mcan_class);
 	if (ret)
 		goto out_power;
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v6 1/2] can: tcan4x5x: put the device out of standby before register access
  2019-12-11 13:53 [PATCH v6 1/2] can: tcan4x5x: put the device out of standby before register access Sean Nyekjaer
@ 2019-12-11 13:54 ` Sean Nyekjaer
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Nyekjaer @ 2019-12-11 13:54 UTC (permalink / raw)
  To: mkl, dmurphy, linux-can; +Cc: stable

Skip this one :)

On 11/12/2019 14.53, Sean Nyekjaer wrote:
> The m_can tries to detect if Non ISO Operation is available while in
> standby, this function results in the following error:
> 
> tcan4x5x spi2.0 (unnamed net_device) (uninitialized): Failed to init module
> tcan4x5x spi2.0: m_can device registered (irq=84, version=32)
> tcan4x5x spi2.0 can2: TCAN4X5X successfully initialized.
> 
> When the tcan device comes out of reset it comes out in standby mode.
> The m_can driver tries to access the control register but fails due to
> the device is in standby mode.
> 
> So this patch will put the tcan device in normal mode before the m_can
> driver does the initialization.
> 
> Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> Changes since v3:
>   - added reset if the reset_gpio is not avaliable
> 
> Changes since v4:
>   - added error handling for the SPI I/O
> 
> Changes since v5:
>   - Removed braces for single statement if's
> 
>   drivers/net/can/m_can/tcan4x5x.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c
> index c1b83dc26c3a..295dbb73c69e 100644
> --- a/drivers/net/can/m_can/tcan4x5x.c
> +++ b/drivers/net/can/m_can/tcan4x5x.c
> @@ -484,6 +484,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
>   	if (ret)
>   		goto out_power;
>   
> +	ret = tcan4x5x_init(mcan_class);
> +	if (ret)
> +		goto out_power;
> +
>   	ret = m_can_class_register(mcan_class);
>   	if (ret)
>   		goto out_power;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-11 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 13:53 [PATCH v6 1/2] can: tcan4x5x: put the device out of standby before register access Sean Nyekjaer
2019-12-11 13:54 ` Sean Nyekjaer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.