Skip to content

Commit 33a2fde

Browse files
ambarusbroonie
authored andcommitted
spi: Introduce spi-cs-setup-ns property
SPI NOR flashes have specific cs-setup time requirements without which they can't work at frequencies close to their maximum supported frequency, as they miss the first bits of the instruction command. Unrecognized commands are ignored, thus the flash will be unresponsive. Introduce the spi-cs-setup-ns property to allow spi devices to specify their cs setup time. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20221117105249.115649-3-tudor.ambarus@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f6c911f commit 33a2fde

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/spi/spi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,6 +2224,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
22242224
struct device_node *nc)
22252225
{
22262226
u32 value;
2227+
u16 cs_setup;
22272228
int rc;
22282229

22292230
/* Mode (clock phase/polarity/etc.) */
@@ -2309,6 +2310,11 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
23092310
if (!of_property_read_u32(nc, "spi-max-frequency", &value))
23102311
spi->max_speed_hz = value;
23112312

2313+
if (!of_property_read_u16(nc, "spi-cs-setup-ns", &cs_setup)) {
2314+
spi->cs_setup.value = cs_setup;
2315+
spi->cs_setup.unit = SPI_DELAY_UNIT_NSECS;
2316+
}
2317+
23122318
return 0;
23132319
}
23142320

0 commit comments

Comments
 (0)