Re: mcp251x hangs during ifup
From: Vincent MAILHOL <hidden>
Date: 2021-03-02 23:59:01
Hi Marc, On Tue. 2 Mar 2021 at 01:58, Marc Kleine-Budde [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Hello, in the armbian forum a problem with the mcp215x was reported: https://forum.armbian.com/topic/14909-orange-pi-mcp2515-ip-up-freezes/ In the last comment (Posted Saturday at 10:05 PM) Aleksey posted a mcp251x.c with a workaround. After cleanup the diff looks like this:diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index f69fb4238a65..6d5fcf5a19a2 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c@@ -1221,7 +1221,7 @@ static int mcp251x_open(struct net_device *net) INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); - ret = mcp251x_hw_wake(spi); + ret = mcp251x_hw_reset(spi); if (ret) goto out_free_wq; ret = mcp251x_setup(net, spi);Vincent, it seems the gpio support has broken the driver on some platforms. Do you have an idea?
This mcp251x_hw_wake() function was introduced in below commit:
8ce8c0abcba3 ("can: mcp251x: only reset hardware as required")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8ce8c0abcba314e1fe954a1840f6568bf5aef2ef
The GPIO support was then introduced later on in below commit:
2d52dabbef60 ("can: mcp251x: add GPIO support")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d52dabbef60da91b72617519495fe77b621e6b8
I am adding Timo to the loop. He is the author of the two commits above.
I think he will be of better support than me here :)
Is RUNTIME_PM support now mandatory? So that mcp251x_can_suspend() and mcp251x_can_resume() are now always called, does the driver break if those functions are not compiled into the kernel?