Commit 97ed465b authored by Wenyou Yang's avatar Wenyou Yang Committed by Mark Brown

spi/spi-atmel: add support transfer on CS1,2,3, not only on CS0

Signed-off-by: default avatarWenyou Yang <wenyou.yang@atmel.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d4820b74
...@@ -255,11 +255,6 @@ static bool atmel_spi_is_v2(struct atmel_spi *as) ...@@ -255,11 +255,6 @@ static bool atmel_spi_is_v2(struct atmel_spi *as)
* Master on Chip Select 0.") No workaround exists for that ... so for * Master on Chip Select 0.") No workaround exists for that ... so for
* nCS0 on that chip, we (a) don't use the GPIO, (b) can't support CS_HIGH, * nCS0 on that chip, we (a) don't use the GPIO, (b) can't support CS_HIGH,
* and (c) will trigger that first erratum in some cases. * and (c) will trigger that first erratum in some cases.
*
* TODO: Test if the atmel_spi_is_v2() branch below works on
* AT91RM9200 if we use some other register than CSR0. However, don't
* do this unconditionally since AP7000 has an errata where the BITS
* field in CSR0 overrides all other CSRs.
*/ */
static void cs_activate(struct atmel_spi *as, struct spi_device *spi) static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
...@@ -269,18 +264,22 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi) ...@@ -269,18 +264,22 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
u32 mr; u32 mr;
if (atmel_spi_is_v2(as)) { if (atmel_spi_is_v2(as)) {
/* spi_writel(as, CSR0 + 4 * spi->chip_select, asd->csr);
* Always use CSR0. This ensures that the clock /* For the low SPI version, there is a issue that PDC transfer
* switches to the correct idle polarity before we * on CS1,2,3 needs SPI_CSR0.BITS config as SPI_CSR1,2,3.BITS
* toggle the CS.
*/ */
spi_writel(as, CSR0, asd->csr); spi_writel(as, CSR0, asd->csr);
if (as->caps.has_wdrbt) { if (as->caps.has_wdrbt) {
spi_writel(as, MR, SPI_BF(PCS, 0x0e) | SPI_BIT(WDRBT) spi_writel(as, MR,
| SPI_BIT(MODFDIS) | SPI_BIT(MSTR)); SPI_BF(PCS, ~(0x01 << spi->chip_select))
| SPI_BIT(WDRBT)
| SPI_BIT(MODFDIS)
| SPI_BIT(MSTR));
} else { } else {
spi_writel(as, MR, SPI_BF(PCS, 0x0e) | SPI_BIT(MODFDIS) spi_writel(as, MR,
| SPI_BIT(MSTR)); SPI_BF(PCS, ~(0x01 << spi->chip_select))
| SPI_BIT(MODFDIS)
| SPI_BIT(MSTR));
} }
mr = spi_readl(as, MR); mr = spi_readl(as, MR);
gpio_set_value(asd->npcs_pin, active); gpio_set_value(asd->npcs_pin, active);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment