diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-09-04 19:01:23 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-09-04 19:02:48 +0200 |
commit | 662394fb30fdbcc89ec387918714aebee6868a9f (patch) | |
tree | c308c5f1a650abf9d9ccbb2a1747469a0d8570c0 /target/linux/brcm2708/patches-4.19/950-0726-can-mcp251x-Allow-more-time-after-a-reset.patch | |
parent | 99a5e285887c4a10aaf06d8e01fae0707995da00 (diff) | |
download | upstream-662394fb30fdbcc89ec387918714aebee6868a9f.tar.gz upstream-662394fb30fdbcc89ec387918714aebee6868a9f.tar.bz2 upstream-662394fb30fdbcc89ec387918714aebee6868a9f.zip |
brcm2708: update to latest patches from RPi foundation
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0726-can-mcp251x-Allow-more-time-after-a-reset.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.19/950-0726-can-mcp251x-Allow-more-time-after-a-reset.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.19/950-0726-can-mcp251x-Allow-more-time-after-a-reset.patch b/target/linux/brcm2708/patches-4.19/950-0726-can-mcp251x-Allow-more-time-after-a-reset.patch new file mode 100644 index 0000000000..51acc637be --- /dev/null +++ b/target/linux/brcm2708/patches-4.19/950-0726-can-mcp251x-Allow-more-time-after-a-reset.patch @@ -0,0 +1,47 @@ +From c3fc29179a4dbbd9efa90fb462ef5aac7507ec1a Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Thu, 1 Aug 2019 08:58:48 +0100 +Subject: [PATCH 726/782] can: mcp251x: Allow more time after a reset + +Some boards take longer than 5ms to power up after a reset, so allow +a few retry attempts before giving up. + +See: https://github.com/raspberrypi/linux/issues/2767 + +Signed-off-by: Phil Elwell <phil@raspberrypi.org> +--- + drivers/net/can/spi/mcp251x.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/net/can/spi/mcp251x.c ++++ b/drivers/net/can/spi/mcp251x.c +@@ -628,6 +628,7 @@ static int mcp251x_hw_reset(struct spi_d + struct mcp251x_priv *priv = spi_get_drvdata(spi); + u8 reg; + int ret; ++ int retries = 10; + + /* Wait for oscillator startup timer after power up */ + mdelay(MCP251X_OST_DELAY_MS); +@@ -637,10 +638,18 @@ static int mcp251x_hw_reset(struct spi_d + if (ret) + return ret; + +- /* Wait for oscillator startup timer after reset */ +- mdelay(MCP251X_OST_DELAY_MS); ++ /* ++ * Wait for oscillator startup timer after reset ++ * ++ * Some devices can take longer than the expected 5ms to wake ++ * up, so allow a few retries. ++ */ ++ ++ do { ++ mdelay(MCP251X_OST_DELAY_MS); ++ reg = mcp251x_read_reg(spi, CANSTAT); ++ } while (!reg && retries--); + +- reg = mcp251x_read_reg(spi, CANSTAT); + if ((reg & CANCTRL_REQOP_MASK) != CANCTRL_REQOP_CONF) + return -ENODEV; + |