Commit b5596f1d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-v6.2-rc8-abi' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fix from Mark Brown:
 "One more last minute patch for v6.2 updating the parsing of the newly
  added spi-cs-setup-delay-ns.

  It's been pointed out that due to the way DT parsing works the change
  in property size is ABI visible so let's not let a release go out
  without it being fixed. The change got split from some earlier ABI
  related fixes to the property since the first version sent had a build
  error"

* tag 'spi-v6.2-rc8-abi' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: Use a 32-bit DT property for spi-cs-setup-delay-ns
parents 18902059 f276aacf
...@@ -2220,11 +2220,26 @@ void spi_flush_queue(struct spi_controller *ctlr) ...@@ -2220,11 +2220,26 @@ void spi_flush_queue(struct spi_controller *ctlr)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
static void of_spi_parse_dt_cs_delay(struct device_node *nc,
struct spi_delay *delay, const char *prop)
{
u32 value;
if (!of_property_read_u32(nc, prop, &value)) {
if (value > U16_MAX) {
delay->value = DIV_ROUND_UP(value, 1000);
delay->unit = SPI_DELAY_UNIT_USECS;
} else {
delay->value = value;
delay->unit = SPI_DELAY_UNIT_NSECS;
}
}
}
static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, 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.) */
...@@ -2310,10 +2325,8 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, ...@@ -2310,10 +2325,8 @@ 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-delay-ns", &cs_setup)) { /* Device CS delays */
spi->cs_setup.value = cs_setup; of_spi_parse_dt_cs_delay(nc, &spi->cs_setup, "spi-cs-setup-delay-ns");
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