From: hramrach@gmail.com (Michal Suchanek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 05/13] spi: sun6i: update CS handling from spi-sun4i
Date: 13 Jun 2016 17:46:50 -0000 [thread overview]
Message-ID: <3bf00d7311a7ed5f5d71125b7b652175551061b6.1465490774.git.hramrach@gmail.com> (raw)
In-Reply-To: <cover.1465490774.git.hramrach@gmail.com>
While trying to merge sun4i and sun6i spi drivers I noticed
the sun4i driver seems to have more reasonable CS handling.
Update sun6i to same.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
drivers/spi/spi-sun6i.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index bc29a98..06759d0 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -145,11 +145,30 @@ static void sun6i_spi_set_cs(struct spi_device *spi, bool enable)
reg &= ~SUN6I_TFR_CTL_CS_MASK;
reg |= SUN6I_TFR_CTL_CS(spi->chip_select);
+ /* We want to control the chip select manually */
+ reg |= SUN6I_TFR_CTL_CS_MANUAL;
+
if (enable)
reg |= SUN6I_TFR_CTL_CS_LEVEL;
else
reg &= ~SUN6I_TFR_CTL_CS_LEVEL;
+ /*
+ * Even though this looks irrelevant since we are supposed to
+ * be controlling the chip select manually, this bit also
+ * controls the levels of the chip select for inactive
+ * devices.
+ *
+ * If we don't set it, the chip select level will go low by
+ * default when the device is idle, which is not really
+ * expected in the common case where the chip select is active
+ * low.
+ */
+ if (spi->mode & SPI_CS_HIGH)
+ reg &= ~SUN6I_TFR_CTL_SPOL;
+ else
+ reg |= SUN6I_TFR_CTL_SPOL;
+
sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg);
}
@@ -215,9 +234,6 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
else
reg |= SUN6I_TFR_CTL_DHB;
- /* We want to control the chip select manually */
- reg |= SUN6I_TFR_CTL_CS_MANUAL;
-
sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg);
/* Ensure that we have a parent clock fast enough */
--
2.8.1
next prev parent reply other threads:[~2016-06-13 17:46 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 17:46 [PATCH v3 00/13] sunxi spi fixes Michal Suchanek
2016-06-13 17:46 ` [PATCH v3 02/13] spi: sunxi: fix transfer timeout Michal Suchanek
2016-06-13 19:55 ` Maxime Ripard
2016-06-13 17:46 ` [PATCH v3 03/13] spi: sun4i: fix FIFO limit Michal Suchanek
2016-06-13 19:56 ` Maxime Ripard
2016-06-13 17:46 ` [PATCH v3 01/13] spi: sunxi: set maximum and minimum speed of SPI master Michal Suchanek
2016-06-13 19:55 ` Maxime Ripard
2016-06-13 17:46 ` [PATCH v3 04/13] spi: sunxi: expose maximum transfer size limit Michal Suchanek
2016-06-13 19:56 ` Maxime Ripard
2016-06-13 17:46 ` Michal Suchanek [this message]
2016-06-13 17:46 ` [PATCH v3 06/13] spi: sunxi: rename sun4i,sun6i -> sunxi Michal Suchanek
2016-06-13 17:46 ` [PATCH v3 07/13] spi: sunxi: rename constants to match between sun4i and sun6i Michal Suchanek
2016-06-13 23:31 ` [linux-sunxi] " Julian Calaby
2016-06-14 4:43 ` Michal Suchanek
2016-06-13 17:46 ` [PATCH v3 08/13] spi: sunxi: synchronize whitespace, comments, struct Michal Suchanek
2016-06-13 17:46 ` [PATCH v3 09/13] spi: sunxi: use register map Michal Suchanek
2016-06-13 17:46 ` [PATCH v3 11/13] dt: spi: sun4i: merge sun4i and sun6i binding doc Michal Suchanek
2016-06-13 23:45 ` [linux-sunxi] " Julian Calaby
2016-06-14 4:40 ` Michal Suchanek
2016-06-14 4:48 ` Julian Calaby
2016-06-13 17:46 ` [PATCH v3 10/13] spi: sunxi: merge sun4i and sun6i SPI driver Michal Suchanek
2016-06-13 23:43 ` [linux-sunxi] " Julian Calaby
2016-06-14 4:34 ` Michal Suchanek
2016-06-14 4:47 ` Julian Calaby
2016-06-14 5:28 ` Michal Suchanek
2016-06-14 5:45 ` Julian Calaby
2016-06-14 6:35 ` Michal Suchanek
2016-06-14 11:20 ` Julian Calaby
2016-06-13 17:46 ` [PATCH v3 13/13] spi: sun4i: add DMA support Michal
2016-06-13 17:46 ` [PATCH v3 12/13] spi: sunxi: remove CONFIG_SPI_SUN6I Michal Suchanek
2016-06-13 19:57 ` [PATCH v3 00/13] sunxi spi fixes Maxime Ripard
2016-06-14 4:50 ` Michal Suchanek
2016-06-17 10:34 ` Michal Suchanek
2016-07-25 7:32 ` Maxime Ripard
2016-07-25 8:03 ` Michal Suchanek
2016-07-29 20:22 ` Maxime Ripard
2016-07-30 17:32 ` Michal Suchanek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3bf00d7311a7ed5f5d71125b7b652175551061b6.1465490774.git.hramrach@gmail.com \
--to=hramrach@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).