Commit 33a2fde5 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Mark Brown

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: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20221117105249.115649-3-tudor.ambarus@microchip.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f6c911f3
...@@ -2224,6 +2224,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, ...@@ -2224,6 +2224,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
struct device_node *nc) struct device_node *nc)
{ {
u32 value; u32 value;
u16 cs_setup;
int rc; int rc;
/* Mode (clock phase/polarity/etc.) */ /* Mode (clock phase/polarity/etc.) */
...@@ -2309,6 +2310,11 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, ...@@ -2309,6 +2310,11 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
if (!of_property_read_u32(nc, "spi-max-frequency", &value)) if (!of_property_read_u32(nc, "spi-max-frequency", &value))
spi->max_speed_hz = value; spi->max_speed_hz = value;
if (!of_property_read_u16(nc, "spi-cs-setup-ns", &cs_setup)) {
spi->cs_setup.value = cs_setup;
spi->cs_setup.unit = SPI_DELAY_UNIT_NSECS;
}
return 0; return 0;
} }
......
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