aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-mxs.c
diff options
context:
space:
mode:
authorTrent Piepho <tpiepho@gmail.com>2013-10-01 16:14:32 -0400
committerMark Brown <broonie@linaro.org>2013-10-17 20:00:29 -0400
commitf5bc7384dc4e9bf3bcf976ef0c1ac9704fa1ad43 (patch)
tree58021494a152ff4dc5d9f502f9a4badb7c2d4807 /drivers/spi/spi-mxs.c
parent58f46e41c1925236a1c34873caa5d1247f846005 (diff)
spi: spi-mxs: Remove mxs_spi_enable and mxs_spi_disable
These functions consist of nothing but one single writel call and are only called once. And the names really aren't accurate or clear, since they don't enable or disble SPI. Rather they set the bit that controls the state of CS at the end of transfer. It easier to follow the code to just set this bit with a writel() along with all the other bits being set in the same function. Signed-off-by: Trent Piepho <tpiepho@gmail.com> Cc: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-mxs.c')
-rw-r--r--drivers/spi/spi-mxs.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index e6172aedf859..991ee01731b2 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -145,22 +145,6 @@ static void mxs_spi_set_cs(struct mxs_spi *spi, unsigned cs)
145 writel(select, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); 145 writel(select, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
146} 146}
147 147
148static inline void mxs_spi_enable(struct mxs_spi *spi)
149{
150 struct mxs_ssp *ssp = &spi->ssp;
151
152 writel(BM_SSP_CTRL0_IGNORE_CRC,
153 ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR);
154}
155
156static inline void mxs_spi_disable(struct mxs_spi *spi)
157{
158 struct mxs_ssp *ssp = &spi->ssp;
159
160 writel(BM_SSP_CTRL0_IGNORE_CRC,
161 ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
162}
163
164static int mxs_ssp_wait(struct mxs_spi *spi, int offset, int mask, bool set) 148static int mxs_ssp_wait(struct mxs_spi *spi, int offset, int mask, bool set)
165{ 149{
166 const unsigned long timeout = jiffies + msecs_to_jiffies(SSP_TIMEOUT); 150 const unsigned long timeout = jiffies + msecs_to_jiffies(SSP_TIMEOUT);
@@ -335,13 +319,15 @@ static int mxs_spi_txrx_pio(struct mxs_spi *spi, int cs,
335 struct mxs_ssp *ssp = &spi->ssp; 319 struct mxs_ssp *ssp = &spi->ssp;
336 320
337 if (*first) 321 if (*first)
338 mxs_spi_enable(spi); 322 writel(BM_SSP_CTRL0_IGNORE_CRC,
323 ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR);
339 324
340 mxs_spi_set_cs(spi, cs); 325 mxs_spi_set_cs(spi, cs);
341 326
342 while (len--) { 327 while (len--) {
343 if (*last && len == 0) 328 if (*last && len == 0)
344 mxs_spi_disable(spi); 329 writel(BM_SSP_CTRL0_IGNORE_CRC,
330 ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
345 331
346 if (ssp->devid == IMX23_SSP) { 332 if (ssp->devid == IMX23_SSP) {
347 writel(BM_SSP_CTRL0_XFER_COUNT, 333 writel(BM_SSP_CTRL0_XFER_COUNT,