diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-09-18 20:08:56 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-09-24 09:49:09 +0100 |
commit | c3ce15bf2ae5cde3392944ad043b80f123510cde (patch) | |
tree | 44413c5005d7864c6e8d62f66925a9c15350b6af /drivers/spi | |
parent | 8e45ef682cb31fda62ed4eeede5d9745a0a1b1e2 (diff) | |
download | blackbird-obmc-linux-c3ce15bf2ae5cde3392944ad043b80f123510cde.tar.gz blackbird-obmc-linux-c3ce15bf2ae5cde3392944ad043b80f123510cde.zip |
spi: dw: introduce support of loopback mode
For testing purposes it's good to have a loopback mode enabled. The patch adds
necessary bits for that.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-dw.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index e2f7c5c0f4ba..7064cd008539 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -591,6 +591,9 @@ static int dw_spi_setup(struct spi_device *spi) | (spi->mode << SPI_MODE_OFFSET) | (chip->tmode << SPI_TMOD_OFFSET); + if (spi->mode & SPI_LOOP) + chip->cr0 |= 1 << SPI_SRL_OFFSET; + if (gpio_is_valid(spi->cs_gpio)) { ret = gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); @@ -652,7 +655,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) goto err_free_master; } - master->mode_bits = SPI_CPOL | SPI_CPHA; + master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP; master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); master->bus_num = dws->bus_num; master->num_chipselect = dws->num_cs; |