* [PATCH] spi: rockchip: return 0 if tx_buf and rx_buf are NULL
@ 2014-08-14 0:52 Addy Ke
[not found] ` <1407977544-2989-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Addy Ke @ 2014-08-14 0:52 UTC (permalink / raw)
To: broonie, heiko, dianders, grant.likely, robh+dt
Cc: linux-kernel, linux-spi, linux-arm-kernel, devicetree, olof, hj,
kever.yang, xjq, huangtao, zyw, yzq, zhenfu.fang, cf, zhangqing,
hl, wei.luo, Addy Ke
To do so, spi communication can use an empty buf to pull up CS.
This patch merged from ChromiumOS tree.
Cros_ec use this function to turn off CS and add a delay to ensure
the rising edge doesn't come too soon after the end of the data.
Tested-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
---
drivers/spi/spi-rockchip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 72fb287..1e3bcfa 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -511,8 +511,8 @@ static int rockchip_spi_transfer_one(struct spi_master *master,
WARN_ON((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");
- return -EINVAL;
+ dev_dbg(rs->dev, "No buffer for transfer\n");
+ return 0;
}
rs->speed = xfer->speed_hz;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: rockchip: return 0 if tx_buf and rx_buf are NULL
[not found] ` <1407977544-2989-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2014-08-14 20:09 ` Dmitry Torokhov
2014-08-14 21:02 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2014-08-14 20:09 UTC (permalink / raw)
To: Addy Ke
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, heiko-4mtYJXux2i+zQB+pC5nmwQ,
dianders-F7+t8E8rja9g9hUCZPvPmw,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA, olof-nZhT3qVonbNeoWH0uzbU5w,
hj-TNX95d0MmH7DzftRWevZcw, kever.yang-TNX95d0MmH7DzftRWevZcw,
xjq-TNX95d0MmH7DzftRWevZcw, huangtao-TNX95d0MmH7DzftRWevZcw,
zyw-TNX95d0MmH7DzftRWevZcw, yzq-TNX95d0MmH7DzftRWevZcw,
zhenfu.fang-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw,
zhangqing-TNX95d0MmH7DzftRWevZcw, hl-TNX95d0MmH7DzftRWevZcw,
wei.luo-TNX95d0MmH7DzftRWevZcw
Hi Addy,
On Thu, Aug 14, 2014 at 08:52:24AM +0800, Addy Ke wrote:
> To do so, spi communication can use an empty buf to pull up CS.
>
> This patch merged from ChromiumOS tree.
> Cros_ec use this function to turn off CS and add a delay to ensure
> the rising edge doesn't come too soon after the end of the data.
>
> Tested-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Addy Ke <addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
> drivers/spi/spi-rockchip.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
> index 72fb287..1e3bcfa 100644
> --- a/drivers/spi/spi-rockchip.c
> +++ b/drivers/spi/spi-rockchip.c
> @@ -511,8 +511,8 @@ static int rockchip_spi_transfer_one(struct spi_master *master,
> WARN_ON((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");
> - return -EINVAL;
> + dev_dbg(rs->dev, "No buffer for transfer\n");
> + return 0;
> }
Maybe we should only return 0 if xfer->len is also 0, otherwise keep
complaining loudly?
if (!xfer->tx_buf && !xfer->rx_buf) {
if (xfer->len == 0)
return 0;
dev_err(rs->dev, "Missing transfer buffer\n");
return -EINVAL;
}
Thanks.
--
Dmitry
--
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
* Re: [PATCH] spi: rockchip: return 0 if tx_buf and rx_buf are NULL
[not found] ` <1407977544-2989-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-08-14 20:09 ` Dmitry Torokhov
@ 2014-08-14 21:02 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-08-14 21:02 UTC (permalink / raw)
To: Addy Ke
Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ, dianders-F7+t8E8rja9g9hUCZPvPmw,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA, olof-nZhT3qVonbNeoWH0uzbU5w,
hj-TNX95d0MmH7DzftRWevZcw, kever.yang-TNX95d0MmH7DzftRWevZcw,
xjq-TNX95d0MmH7DzftRWevZcw, huangtao-TNX95d0MmH7DzftRWevZcw,
zyw-TNX95d0MmH7DzftRWevZcw, yzq-TNX95d0MmH7DzftRWevZcw,
zhenfu.fang-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw,
zhangqing-TNX95d0MmH7DzftRWevZcw, hl-TNX95d0MmH7DzftRWevZcw,
wei.luo-TNX95d0MmH7DzftRWevZcw
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
On Thu, Aug 14, 2014 at 08:52:24AM +0800, Addy Ke wrote:
> To do so, spi communication can use an empty buf to pull up CS.
> This patch merged from ChromiumOS tree.
> Cros_ec use this function to turn off CS and add a delay to ensure
> the rising edge doesn't come too soon after the end of the data.
> if (!xfer->tx_buf && !xfer->rx_buf) {
> - dev_err(rs->dev, "No buffer for transfer\n");
> - return -EINVAL;
> + dev_dbg(rs->dev, "No buffer for transfer\n");
> + return 0;
> }
We should be implementing this in the core rather than the driver - just
not even call into the controller driver if there's nothing to do. That
way we make sure that every driver works properly. After all, the delay
itself is implemented in the core.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-14 21:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-14 0:52 [PATCH] spi: rockchip: return 0 if tx_buf and rx_buf are NULL Addy Ke
[not found] ` <1407977544-2989-1-git-send-email-addy.ke-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-08-14 20:09 ` Dmitry Torokhov
2014-08-14 21:02 ` 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).