SPI Fixes for spi-rockchip
Subsystems (3)
cover SPI Fixes for spi-rockchip
These three patches are random SPI fixes for spi-rockchip. They are unrelated and can be applied / NAKed separately. They've been tested in PIO mode on an rk3288 board (since SPI DMA isn't currently working for some unknown reason).
Doug Anderson (3):
spi/rockchip: Fix the wait_for_idle() timeout spi/rockchip: Don't warn if SPI is busy but disabled
dt-bindings: spi/rockchip: Mark DMA as optional
Documentation/devicetree/bindings/spi/spi-rockchip.txt | 8 ++++++-- drivers/spi/spi-rockchip.c | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 1/3 spi/rockchip: Fix the wait_for_idle() timeout
The wait_for_idle() could get unlucky and timeout too quickly. Specifically, the old calculation was effectively:
timeout = jiffies + 1;
if (jiffies >= timeout) print warning;
Quoted 1 line
From the above it should be obvious that if jiffies ticks in just the
wrong place then we'll have an effective timeout of 0.
Fix this by effectively changing the above ">=" to a ">". That gives us an extra jiffy to finish.
--- drivers/spi/spi-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-rockchip.c +1 -1
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs)do {if (!(readl_relaxed (rs->regs +ROCKCHIP_SPI_SR ) &SR_BUSY ))return ; - }while (time_before (jiffies, timeout)); + }while (!time_after (jiffies, timeout));dev_warn (rs->dev,"spi controller is in busy state!\n" ); }
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 2/3 spi/rockchip: Don't warn if SPI is busy but disabled
In reply to Doug AndersonThe reference manual from Rockchip claims this about the BSF (SPI Busy Flag):
* 0 - SPI is idle or disabled
* 1 - SPI is actively transferring data
The above doesn't quite appear to be true. Specifically I found the busy bit set when SPI was disabled. Let's change the WARN_ON() so we only check the busy bit if the controller was enabled.
--- drivers/spi/spi-rockchip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-rockchip.c +2 -1
@@ -529,7 +529,8 @@ static int rockchip_spi_transfer_one(int ret =0 ;struct rockchip_spi *rs =spi_master_get_devdata (master); -WARN_ON ((readl_relaxed (rs->regs +ROCKCHIP_SPI_SR ) &SR_BUSY )); +WARN_ON (readl_relaxed (rs->regs +ROCKCHIP_SPI_SSIENR ) && + (readl_relaxed (rs->regs +ROCKCHIP_SPI_SR ) &SR_BUSY ));if (!xfer->tx_buf && !xfer->rx_buf) {dev_err (rs->dev,"No buffer for transfer\n" );
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 3/3 dt-bindings: spi/rockchip: Mark DMA as optional
In reply to Doug AndersonThe Rockchip SPI controller works fine without DMA (aside from a few warnings). The DMA property even implies this, saying:
DMA request names should include "tx" and "rx" if present.
Officially mark the properties as optional.
--- Documentation/devicetree/bindings/spi/spi-rockchip.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/spi/spi-rockchip.txt +6 -2
@@ -16,11 +16,15 @@ Required Properties: - clocks: Must contain an entry for each entry in clock-names. - clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for the peripheral clock. +- #address-cells: should be 1. +- #size-cells: should be 0. + +Optional Properties: + - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, Documentation/devicetree/bindings/dma/dma.txt - dma-names: DMA request names should include "tx" and "rx" if present. -- #address-cells: should be 1. -- #size-cells: should be 0. + Example:
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Mark Brown
maintainerRe: [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional
Quoted 2 lines · Doug Anderson
The Rockchip SPI controller works fine without DMA (aside from a few warnings). The DMA property even implies this, saying:
Applied all, thanks. Please use subject bindings matching the style for
the subsystem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140904/43fd0c4f/attachment.sig>