Skip to content

Commit 69e1818

Browse files
djsazbroonie
authored andcommitted
spi: atmel: Fix CS and initialization bug
Commit 5fa5e6d ("spi: atmel: Switch to transfer_one transfer method") switched to using transfer_one and set_cs. The core doesn't call set_cs when the chip select lines are gpios. Add the SPI_MASTER_GPIO_SS flag to the driver to ensure the calls to set_cs happen since the driver programs configuration registers there. Fixes: 5fa5e6d ("spi: atmel: Switch to transfer_one transfer method") Signed-off-by: Dan Sneddon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7999d25 commit 69e1818

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/spi/spi-atmel.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,6 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
352352
}
353353

354354
mr = spi_readl(as, MR);
355-
if (spi->cs_gpiod)
356-
gpiod_set_value(spi->cs_gpiod, 1);
357355
} else {
358356
u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
359357
int i;
@@ -369,8 +367,6 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
369367

370368
mr = spi_readl(as, MR);
371369
mr = SPI_BFINS(PCS, ~(1 << chip_select), mr);
372-
if (spi->cs_gpiod)
373-
gpiod_set_value(spi->cs_gpiod, 1);
374370
spi_writel(as, MR, mr);
375371
}
376372

@@ -400,8 +396,6 @@ static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi)
400396

401397
if (!spi->cs_gpiod)
402398
spi_writel(as, CR, SPI_BIT(LASTXFER));
403-
else
404-
gpiod_set_value(spi->cs_gpiod, 0);
405399
}
406400

407401
static void atmel_spi_lock(struct atmel_spi *as) __acquires(&as->lock)
@@ -1483,7 +1477,8 @@ static int atmel_spi_probe(struct platform_device *pdev)
14831477
master->bus_num = pdev->id;
14841478
master->num_chipselect = 4;
14851479
master->setup = atmel_spi_setup;
1486-
master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX);
1480+
master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX |
1481+
SPI_MASTER_GPIO_SS);
14871482
master->transfer_one = atmel_spi_one_transfer;
14881483
master->set_cs = atmel_spi_set_cs;
14891484
master->cleanup = atmel_spi_cleanup;

0 commit comments

Comments
 (0)