* [PATCH 0/3] SPI Fixes for spi-rockchip
@ 2014-09-03 20:44 Doug Anderson
2014-09-03 20:44 ` [PATCH 1/3] spi/rockchip: Fix the wait_for_idle() timeout Doug Anderson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: linux-arm-kernel
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(-)
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] spi/rockchip: Fix the wait_for_idle() timeout
2014-09-03 20:44 [PATCH 0/3] SPI Fixes for spi-rockchip Doug Anderson
@ 2014-09-03 20:44 ` Doug Anderson
2014-09-03 20:44 ` [PATCH 2/3] spi/rockchip: Don't warn if SPI is busy but disabled Doug Anderson
2014-09-03 20:44 ` [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional Doug Anderson
2 siblings, 0 replies; 5+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: linux-arm-kernel
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;
>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.
Signed-off-by: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-rockchip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index cd0e08b0..84dbb86 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -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");
}
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] spi/rockchip: Don't warn if SPI is busy but disabled
2014-09-03 20:44 [PATCH 0/3] SPI Fixes for spi-rockchip Doug Anderson
2014-09-03 20:44 ` [PATCH 1/3] spi/rockchip: Fix the wait_for_idle() timeout Doug Anderson
@ 2014-09-03 20:44 ` Doug Anderson
2014-09-03 20:44 ` [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional Doug Anderson
2 siblings, 0 replies; 5+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: linux-arm-kernel
The 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.
Signed-off-by: Doug Anderson <dianders@chromium.org>
---
drivers/spi/spi-rockchip.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 84dbb86..3afc266 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -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");
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional
2014-09-03 20:44 [PATCH 0/3] SPI Fixes for spi-rockchip Doug Anderson
2014-09-03 20:44 ` [PATCH 1/3] spi/rockchip: Fix the wait_for_idle() timeout Doug Anderson
2014-09-03 20:44 ` [PATCH 2/3] spi/rockchip: Don't warn if SPI is busy but disabled Doug Anderson
@ 2014-09-03 20:44 ` Doug Anderson
2014-09-04 22:54 ` Mark Brown
2 siblings, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: linux-arm-kernel
The 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.
Signed-off-by: Doug Anderson <dianders@chromium.org>
---
Documentation/devicetree/bindings/spi/spi-rockchip.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
index 7bab355..467dec4 100644
--- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt
+++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
@@ -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:
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional
2014-09-03 20:44 ` [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional Doug Anderson
@ 2014-09-04 22:54 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-09-04 22:54 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Sep 03, 2014 at 01:44:27PM -0700, Doug Anderson wrote:
> 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>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-04 22:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 20:44 [PATCH 0/3] SPI Fixes for spi-rockchip Doug Anderson
2014-09-03 20:44 ` [PATCH 1/3] spi/rockchip: Fix the wait_for_idle() timeout Doug Anderson
2014-09-03 20:44 ` [PATCH 2/3] spi/rockchip: Don't warn if SPI is busy but disabled Doug Anderson
2014-09-03 20:44 ` [PATCH 3/3] dt-bindings: spi/rockchip: Mark DMA as optional Doug Anderson
2014-09-04 22:54 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).