diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2013-01-22 05:26:31 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-08 07:15:36 -0500 |
commit | b833172fd8f44fb56e0b3cb810155a6baecc65dc (patch) | |
tree | c3a23b30586ad61259e6438358c20b82df0ecbbc /drivers/spi | |
parent | 7d94a50585884180a487ce17e8ddbfa37f7694b6 (diff) |
spi/pxa2xx: add support for SPI_LOOP
This is useful when testing the functionality of the controller from userspace
and there aren't any real SPI slave devices connected to the bus.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Lu Cao <lucao@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 7f8f939835fd..8a5ba0aa095a 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -846,6 +846,9 @@ static int setup(struct spi_device *spi) | |||
846 | chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0) | 846 | chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0) |
847 | | (((spi->mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0); | 847 | | (((spi->mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0); |
848 | 848 | ||
849 | if (spi->mode & SPI_LOOP) | ||
850 | chip->cr1 |= SSCR1_LBM; | ||
851 | |||
849 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ | 852 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ |
850 | if (!pxa25x_ssp_comp(drv_data)) | 853 | if (!pxa25x_ssp_comp(drv_data)) |
851 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", | 854 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", |
@@ -939,7 +942,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) | |||
939 | master->dev.parent = &pdev->dev; | 942 | master->dev.parent = &pdev->dev; |
940 | master->dev.of_node = pdev->dev.of_node; | 943 | master->dev.of_node = pdev->dev.of_node; |
941 | /* the spi->mode bits understood by this driver: */ | 944 | /* the spi->mode bits understood by this driver: */ |
942 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; | 945 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
943 | 946 | ||
944 | master->bus_num = ssp->port_id; | 947 | master->bus_num = ssp->port_id; |
945 | master->num_chipselect = platform_info->num_chipselect; | 948 | master->num_chipselect = platform_info->num_chipselect; |