spi: Update for v6.2

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.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmPuWgoACgkQJNaLcl1U
 h9AI/gf/SEQzjI4vkoIezfwUfgzeP7Cjphna2rAmOOFc+S871FHUne7csWiNS3DI
 YGhr3x2VqKdPyxkM+YoOavH9B9SmF9MUFtiT7Q5MEp0Pb7TQzw23qjrKBrKde0yX
 r5cETkhy+21Tk6hzMs/0cC/4zRcf7IjgDT9L9+To9mKDHCYKoj3/WHoES6JgTYa8
 z8fApLvjvCx2432eLzm66CoXgSK+UnQKT2bdo2w+YcITPBqge6REhmcfnOT9MzDO
 LPOZ2hJ4lM6SPW2a4yBMX4pIouluDd6/giQ8LBt7xjesIKVmiHoW0dXRNis4+gq/
 6kVjABEsBQ/xBOFgbuq1WfGRxaVJVA==
 =qTWJ
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2023-02-16 12:01:46 -08:00
commit b5596f1d54

View file

@ -2220,11 +2220,26 @@ void spi_flush_queue(struct spi_controller *ctlr)
/*-------------------------------------------------------------------------*/
#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,
struct device_node *nc)
{
u32 value;
u16 cs_setup;
int rc;
/* Mode (clock phase/polarity/etc.) */
@ -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))
spi->max_speed_hz = value;
if (!of_property_read_u16(nc, "spi-cs-setup-delay-ns", &cs_setup)) {
spi->cs_setup.value = cs_setup;
spi->cs_setup.unit = SPI_DELAY_UNIT_NSECS;
}
/* Device CS delays */
of_spi_parse_dt_cs_delay(nc, &spi->cs_setup, "spi-cs-setup-delay-ns");
return 0;
}