Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d6e7ffd

Browse files
geertubroonie
authored andcommitted
spi: dw: Bail out early on unsupported target mode
Currently, the DesignWare SPI controller driver supports only host mode. However, spi2 on the Kendryte K210 SoC supports only target mode, triggering an error message on e.g. SiPEED MAiXBiT since commit 98d75b9 ("spi: dw: Drop default number of CS setting"): dw_spi_mmio 50240000.spi: error -22: problem registering spi host dw_spi_mmio 50240000.spi: probe with driver dw_spi_mmio failed with error -22 As spi2 rightfully has no "num-cs" property, num_chipselect is now zero, causing spi_alloc_host() to fail to register the controller. Before, the driver silently registered an SPI host controller with 4 chip selects. Reject target mode early on and warn the user, getting rid of the error message. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/7ae28d83bff7351f34782658ae1bb69cc731693e.1715163113.git.geert+renesas@glider.be Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8cc3bad commit d6e7ffd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/spi/spi-dw-mmio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
321321
struct dw_spi *dws;
322322
int ret;
323323

324+
if (device_property_read_bool(&pdev->dev, "spi-slave")) {
325+
dev_warn(&pdev->dev, "spi-slave is not yet supported\n");
326+
return -ENODEV;
327+
}
328+
324329
dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio),
325330
GFP_KERNEL);
326331
if (!dwsmmio)

0 commit comments

Comments
 (0)