Skip to content

Commit

Permalink
spi: spi-fsl-dspi: Make bus-num property optional
Browse files Browse the repository at this point in the history
The SPI bus number is completely optional to Linux, so make the
corresponding device tree property optional as well.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20200305115546.31814-1-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Sascha Hauer authored and Mark Brown committed Mar 5, 2020
1 parent c7a1a20 commit 29d2daf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Required properties:
- pinctrl-0: pin control group to be used for this controller.
- pinctrl-names: must contain a "default" entry.
- spi-num-chipselects : the number of the chipselect signals.
- bus-num : the slave chip chipselect signal number.

Optional property:
- big-endian: If present the dspi device's registers are implemented
in big endian mode.
- bus-num : the slave chip chipselect signal number.

Optional SPI slave node properties:
- fsl,spi-cs-sck-delay: a delay in nanoseconds between activating chip
Expand Down
8 changes: 2 additions & 6 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ static int dspi_probe(struct platform_device *pdev)
const struct regmap_config *regmap_config;
struct fsl_dspi_platform_data *pdata;
struct spi_controller *ctlr;
int ret, cs_num, bus_num;
int ret, cs_num, bus_num = -1;
struct fsl_dspi *dspi;
struct resource *res;
void __iomem *base;
Expand Down Expand Up @@ -1145,11 +1145,7 @@ static int dspi_probe(struct platform_device *pdev)
}
ctlr->num_chipselect = cs_num;

ret = of_property_read_u32(np, "bus-num", &bus_num);
if (ret < 0) {
dev_err(&pdev->dev, "can't get bus-num\n");
goto out_ctlr_put;
}
of_property_read_u32(np, "bus-num", &bus_num);
ctlr->bus_num = bus_num;

if (of_property_read_bool(np, "spi-slave"))
Expand Down

0 comments on commit 29d2daf

Please sign in to comment.