* [PATCH] spi: dw: Fix spi registration for controllers overriding CS
@ 2020-11-20 21:34 Lars Povlsen
2020-11-25 12:39 ` Serge Semin
2020-11-25 13:58 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Lars Povlsen @ 2020-11-20 21:34 UTC (permalink / raw)
To: Serge Semin, Mark Brown, linux-spi; +Cc: Lars Povlsen, linux-kernel
When SPI DW memory ops support was introduced, there was a check for
excluding controllers which supplied their own CS function. Even so,
the mem_ops pointer is *always* presented to the SPI core.
This causes the SPI core sanity check in spi_controller_check_ops() to
refuse registration, since a mem_ops pointer is being supplied without
an exec_op member function.
The end result is failure of the SPI DW driver on sparx5 and similar
platforms.
The fix in the core SPI DW driver is to avoid presenting the mem_ops
pointer if the exec_op function is not set.
Fixes: 6423207e57ea (spi: dw: Add memory operations support)
Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
---
drivers/spi/spi-dw-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c
index 2e50cc0a9291..a0794eac2094 100644
--- a/drivers/spi/spi-dw-core.c
+++ b/drivers/spi/spi-dw-core.c
@@ -875,7 +875,8 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
master->set_cs = dw_spi_set_cs;
master->transfer_one = dw_spi_transfer_one;
master->handle_err = dw_spi_handle_err;
- master->mem_ops = &dws->mem_ops;
+ if (dws->mem_ops.exec_op)
+ master->mem_ops = &dws->mem_ops;
master->max_speed_hz = dws->max_freq;
master->dev.of_node = dev->of_node;
master->dev.fwnode = dev->fwnode;
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: dw: Fix spi registration for controllers overriding CS
2020-11-20 21:34 [PATCH] spi: dw: Fix spi registration for controllers overriding CS Lars Povlsen
@ 2020-11-25 12:39 ` Serge Semin
2020-11-25 13:58 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Serge Semin @ 2020-11-25 12:39 UTC (permalink / raw)
To: Lars Povlsen; +Cc: Mark Brown, linux-spi, linux-kernel
Hello Lars
On Fri, Nov 20, 2020 at 10:34:14PM +0100, Lars Povlsen wrote:
> When SPI DW memory ops support was introduced, there was a check for
> excluding controllers which supplied their own CS function. Even so,
> the mem_ops pointer is *always* presented to the SPI core.
>
> This causes the SPI core sanity check in spi_controller_check_ops() to
> refuse registration, since a mem_ops pointer is being supplied without
> an exec_op member function.
>
> The end result is failure of the SPI DW driver on sparx5 and similar
> platforms.
>
> The fix in the core SPI DW driver is to avoid presenting the mem_ops
> pointer if the exec_op function is not set.
Thanks for sending the patch fixing the regression.
Acked-by: Serge Semin <fancer.lancer@gmail.com>
>
> Fixes: 6423207e57ea (spi: dw: Add memory operations support)
> Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
> ---
> drivers/spi/spi-dw-core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c
> index 2e50cc0a9291..a0794eac2094 100644
> --- a/drivers/spi/spi-dw-core.c
> +++ b/drivers/spi/spi-dw-core.c
> @@ -875,7 +875,8 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
> master->set_cs = dw_spi_set_cs;
> master->transfer_one = dw_spi_transfer_one;
> master->handle_err = dw_spi_handle_err;
> - master->mem_ops = &dws->mem_ops;
> + if (dws->mem_ops.exec_op)
> + master->mem_ops = &dws->mem_ops;
> master->max_speed_hz = dws->max_freq;
> master->dev.of_node = dev->of_node;
> master->dev.fwnode = dev->fwnode;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: dw: Fix spi registration for controllers overriding CS
2020-11-20 21:34 [PATCH] spi: dw: Fix spi registration for controllers overriding CS Lars Povlsen
2020-11-25 12:39 ` Serge Semin
@ 2020-11-25 13:58 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-11-25 13:58 UTC (permalink / raw)
To: Serge Semin, Lars Povlsen, linux-spi; +Cc: linux-kernel
On Fri, 20 Nov 2020 22:34:14 +0100, Lars Povlsen wrote:
> When SPI DW memory ops support was introduced, there was a check for
> excluding controllers which supplied their own CS function. Even so,
> the mem_ops pointer is *always* presented to the SPI core.
>
> This causes the SPI core sanity check in spi_controller_check_ops() to
> refuse registration, since a mem_ops pointer is being supplied without
> an exec_op member function.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: dw: Fix spi registration for controllers overriding CS
commit: 0abdb0fba07322ce960d32a92a64847b3009b2e2
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-25 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 21:34 [PATCH] spi: dw: Fix spi registration for controllers overriding CS Lars Povlsen
2020-11-25 12:39 ` Serge Semin
2020-11-25 13:58 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®