Message ID | 7ae28d83bff7351f34782658ae1bb69cc731693e.1715163113.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | Accepted |
Commit | d6e7ffd4820f8894eb865890c96852085d3640e1 |
Headers | show |
Series | spi: dw: Bail out early on unsupported target mode | expand |
On 5/8/24 7:20 PM, Geert Uytterhoeven wrote: > 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 > 98d75b9ef282f6b9 ("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> Looks good to me. Reviewed-by: Damien Le Moal <dlemoal@kernel.org> > --- > Commit 98d75b9ef282f6b9 is in spi/for-next (next-20240508 and later). > > Overview of all SPI controllers on K210: > > spi0 (52000000.spi): > num_cs = <4> in k210.dtsi > num_cs = <1> override in sipeed_maix*.dts and canaan_kd233.dts > DW_SPI_SER says 0xf (but value is unused) > > spi1 (53000000.spi): > num_cs = <4> in k210.dtsi > num_cs = <1> override in sipeed_maix*.dts and canaan_kd233.dts > DW_SPI_SER says 0xf (but value is unused) > > spi2 (53000000.spi): > spi-slave > no num_cs property > DW_SPI_SER says 0 > 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 > > spi3 (54000000.spi): > num_cs = <4> in k210.dtsi > DW_SPI_SER says 0x1 (but value is unused) > Used in sipeed_maix*.dts, unused in canaan_kd233.dts > > See also "[PATCH 2/2] riscv: dts: canaan: Disable I/O devices unless > used" > https://lore.kernel.org/r/f85d460efd7ad85ec59c9253c989b10a07f2ff24.1715163174.git.geert+renesas@glider.be > --- > drivers/spi/spi-dw-mmio.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c > index c56de35eca988ee4..819907e332c4b004 100644 > --- a/drivers/spi/spi-dw-mmio.c > +++ b/drivers/spi/spi-dw-mmio.c > @@ -321,6 +321,11 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) > struct dw_spi *dws; > int ret; > > + if (device_property_read_bool(&pdev->dev, "spi-slave")) { > + dev_warn(&pdev->dev, "spi-slave is not yet supported\n"); > + return -ENODEV; > + } > + > dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), > GFP_KERNEL); > if (!dwsmmio)
On Wed, 08 May 2024 12:20:27 +0200, Geert Uytterhoeven wrote: > 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 > 98d75b9ef282f6b9 ("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 > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: dw: Bail out early on unsupported target mode commit: d6e7ffd4820f8894eb865890c96852085d3640e1 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index c56de35eca988ee4..819907e332c4b004 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -321,6 +321,11 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) struct dw_spi *dws; int ret; + if (device_property_read_bool(&pdev->dev, "spi-slave")) { + dev_warn(&pdev->dev, "spi-slave is not yet supported\n"); + return -ENODEV; + } + dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), GFP_KERNEL); if (!dwsmmio)
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 98d75b9ef282f6b9 ("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> --- Commit 98d75b9ef282f6b9 is in spi/for-next (next-20240508 and later). Overview of all SPI controllers on K210: spi0 (52000000.spi): num_cs = <4> in k210.dtsi num_cs = <1> override in sipeed_maix*.dts and canaan_kd233.dts DW_SPI_SER says 0xf (but value is unused) spi1 (53000000.spi): num_cs = <4> in k210.dtsi num_cs = <1> override in sipeed_maix*.dts and canaan_kd233.dts DW_SPI_SER says 0xf (but value is unused) spi2 (53000000.spi): spi-slave no num_cs property DW_SPI_SER says 0 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 spi3 (54000000.spi): num_cs = <4> in k210.dtsi DW_SPI_SER says 0x1 (but value is unused) Used in sipeed_maix*.dts, unused in canaan_kd233.dts See also "[PATCH 2/2] riscv: dts: canaan: Disable I/O devices unless used" https://lore.kernel.org/r/f85d460efd7ad85ec59c9253c989b10a07f2ff24.1715163174.git.geert+renesas@glider.be --- drivers/spi/spi-dw-mmio.c | 5 +++++ 1 file changed, 5 insertions(+)