Skip to content

Commit 52e7877

Browse files
nxpfranklibroonie
authored andcommitted
spi: fsl-dspi: use common proptery 'spi-cs-setup(hold)-delay-ns'
Use SPI common DT binding properties 'spi-cs-setup-delay-ns' and 'spi-cs-hold-delay-ns'. If these properties do not exist, fall back to legacy 'fsl,spi-cs-sck-delay' and 'fsl,spi-sck-cs-delay'. Signed-off-by: Frank Li <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 89c2657 commit 52e7877

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,7 @@ static int dspi_setup(struct spi_device *spi)
10061006
struct chip_data *chip;
10071007
unsigned long clkrate;
10081008
bool cs = true;
1009+
int val;
10091010

10101011
/* Only alloc on first setup */
10111012
chip = spi_get_ctldata(spi);
@@ -1018,11 +1019,19 @@ static int dspi_setup(struct spi_device *spi)
10181019
pdata = dev_get_platdata(&dspi->pdev->dev);
10191020

10201021
if (!pdata) {
1021-
of_property_read_u32(spi->dev.of_node, "fsl,spi-cs-sck-delay",
1022-
&cs_sck_delay);
1023-
1024-
of_property_read_u32(spi->dev.of_node, "fsl,spi-sck-cs-delay",
1025-
&sck_cs_delay);
1022+
val = spi_delay_to_ns(&spi->cs_setup, NULL);
1023+
cs_sck_delay = val >= 0 ? val : 0;
1024+
if (!cs_sck_delay)
1025+
of_property_read_u32(spi->dev.of_node,
1026+
"fsl,spi-cs-sck-delay",
1027+
&cs_sck_delay);
1028+
1029+
val = spi_delay_to_ns(&spi->cs_hold, NULL);
1030+
sck_cs_delay = val >= 0 ? val : 0;
1031+
if (!sck_cs_delay)
1032+
of_property_read_u32(spi->dev.of_node,
1033+
"fsl,spi-sck-cs-delay",
1034+
&sck_cs_delay);
10261035
} else {
10271036
cs_sck_delay = pdata->cs_sck_delay;
10281037
sck_cs_delay = pdata->sck_cs_delay;

0 commit comments

Comments
 (0)