* [PATCH 0/3] SPI Fixes for spi-rockchip
@ 2014-09-03 20:44 Doug Anderson
[not found] ` <1409777067-17422-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-09-03 20:44 ` [PATCH 2/3] spi/rockchip: Don't warn if SPI is busy but disabled Doug Anderson
0 siblings, 2 replies; 3+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: Mark Brown, Addy Ke, Heiko Stuebner
Cc: Alexandru Stan, Sonny Rao,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Doug Anderson,
mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
pawel.moll-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
broonie-QSEj5FYQhm4dnm+yROfE0A,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-spi-u79uwXL29TY76Z2rM5mHXA,
galak-sgV2jX0FEOL9JmXXK+q4OQ
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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/3] spi/rockchip: Fix the wait_for_idle() timeout
[not found] ` <1409777067-17422-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-09-03 20:44 ` Doug Anderson
0 siblings, 0 replies; 3+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: Mark Brown, Addy Ke, Heiko Stuebner
Cc: Alexandru Stan, Sonny Rao,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Doug Anderson,
linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ 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
[not found] ` <1409777067-17422-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-09-03 20:44 ` Doug Anderson
1 sibling, 0 replies; 3+ messages in thread
From: Doug Anderson @ 2014-09-03 20:44 UTC (permalink / raw)
To: Mark Brown, Addy Ke, Heiko Stuebner
Cc: Alexandru Stan, Sonny Rao, linux-rockchip, linux-arm-kernel,
Doug Anderson, linux-spi, linux-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] 3+ messages in thread
end of thread, other threads:[~2014-09-03 20:44 UTC | newest]
Thread overview: 3+ 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
[not found] ` <1409777067-17422-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
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
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).