Re: [PATCH v2 1/2] can: m_can: tcan4x5x: put the device out of standby before register access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/9/19 8:24 PM, Sean Nyekjaer wrote:
> The m_can tries to detect of niso (canfd) 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@xxxxxxxxxxxxxxx
> Signed-off-by: Sean Nyekjaer <sean@xxxxxxxxxx>
> ---
> tcan4x5x_init will now be called from probe and the m_can call.
> Would it be better to move the mode switch only to the probe function?
> 
>  drivers/net/can/m_can/tcan4x5x.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c
> index 4e1789ea2bc3..3c30209ca84c 100644
> --- a/drivers/net/can/m_can/tcan4x5x.c
> +++ b/drivers/net/can/m_can/tcan4x5x.c
> @@ -455,6 +455,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
>  	if (ret)
>  		goto out_clk;
>  
> +	tcan4x5x_init(mcan_class);

add error handling

> +
>  	tcan4x5x_power_enable(priv->power, 1);
>  
>  	ret = m_can_class_register(mcan_class);
> 

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: OpenPGP digital signature


[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