* [PATCH v2 1/2] spi/xilinx: Support for spi mode LSB_FIRST
@ 2015-01-22 19:36 Ricardo Ribalda Delgado
2015-01-22 19:36 ` [PATCH v2 2/2] spi/xilinx: Support for spi mode LOOP Ricardo Ribalda Delgado
0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-01-22 19:36 UTC (permalink / raw)
To: Mark Brown, Michal Simek, soren.brinkmann, linux-spi,
linux-arm-kernel, linux-kernel
Cc: Ricardo Ribalda Delgado
Hardware supports LSB_FIRST mode. Support it also in the driver.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
v2:
-add mode_bits
drivers/spi/spi-xilinx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 79bd84f..d4edeee 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -34,7 +34,8 @@
#define XSPI_CR_MASTER_MODE 0x04
#define XSPI_CR_CPOL 0x08
#define XSPI_CR_CPHA 0x10
-#define XSPI_CR_MODE_MASK (XSPI_CR_CPHA | XSPI_CR_CPOL)
+#define XSPI_CR_MODE_MASK (XSPI_CR_CPHA | XSPI_CR_CPOL | \
+ XSPI_CR_LSB_FIRST)
#define XSPI_CR_TXFIFO_RESET 0x20
#define XSPI_CR_RXFIFO_RESET 0x40
#define XSPI_CR_MANUAL_SSELECT 0x80
@@ -194,6 +195,8 @@ static void xilinx_spi_chipselect(struct spi_device *spi, int is_on)
cr |= XSPI_CR_CPHA;
if (spi->mode & SPI_CPOL)
cr |= XSPI_CR_CPOL;
+ if (spi->mode & SPI_LSB_FIRST)
+ cr |= XSPI_CR_LSB_FIRST;
xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
/* We do not check spi->max_speed_hz here as the SPI clock
@@ -353,7 +356,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
return -ENODEV;
/* the spi->mode bits understood by this driver: */
- master->mode_bits = SPI_CPOL | SPI_CPHA;
+ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
xspi = spi_master_get_devdata(master);
xspi->bitbang.master = master;
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 2/2] spi/xilinx: Support for spi mode LOOP
2015-01-22 19:36 [PATCH v2 1/2] spi/xilinx: Support for spi mode LSB_FIRST Ricardo Ribalda Delgado
@ 2015-01-22 19:36 ` Ricardo Ribalda Delgado
0 siblings, 0 replies; 2+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-01-22 19:36 UTC (permalink / raw)
To: Mark Brown, Michal Simek, soren.brinkmann, linux-spi,
linux-arm-kernel, linux-kernel
Cc: Ricardo Ribalda Delgado
Hardware supports LOOP mode. Support it also in the driver.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
v2:
-add mode_bits
drivers/spi/spi-xilinx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index d4edeee..e1d9a20 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -35,7 +35,7 @@
#define XSPI_CR_CPOL 0x08
#define XSPI_CR_CPHA 0x10
#define XSPI_CR_MODE_MASK (XSPI_CR_CPHA | XSPI_CR_CPOL | \
- XSPI_CR_LSB_FIRST)
+ XSPI_CR_LSB_FIRST | XSPI_CR_LOOP)
#define XSPI_CR_TXFIFO_RESET 0x20
#define XSPI_CR_RXFIFO_RESET 0x40
#define XSPI_CR_MANUAL_SSELECT 0x80
@@ -197,6 +197,8 @@ static void xilinx_spi_chipselect(struct spi_device *spi, int is_on)
cr |= XSPI_CR_CPOL;
if (spi->mode & SPI_LSB_FIRST)
cr |= XSPI_CR_LSB_FIRST;
+ if (spi->mode & SPI_LOOP)
+ cr |= XSPI_CR_LOOP;
xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
/* We do not check spi->max_speed_hz here as the SPI clock
@@ -356,7 +358,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
return -ENODEV;
/* the spi->mode bits understood by this driver: */
- master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
+ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP;
xspi = spi_master_get_devdata(master);
xspi->bitbang.master = master;
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-22 19:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 19:36 [PATCH v2 1/2] spi/xilinx: Support for spi mode LSB_FIRST Ricardo Ribalda Delgado
2015-01-22 19:36 ` [PATCH v2 2/2] spi/xilinx: Support for spi mode LOOP Ricardo Ribalda Delgado
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®