All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: xilinx: add force_irq for QSPI mode
@ 2023-02-09 21:13 Vadim Fedorenko
  2023-02-14 13:27 ` Mark Brown
  2023-02-14 21:34 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2023-02-09 21:13 UTC (permalink / raw)
  To: Mark Brown, Ricardo Ribalda, Michal Simek, Jonathan Lemon
  Cc: Vadim Fedorenko, linux-spi, Vadim Fedorenko

Xilinx PG158 page 80 [1] states that master transaction inhibit bit must
be set to properly setup the transaction in QSPI mode. Add the force_irq
flag to follow this sequence.

[1] https://docs.xilinx.com/r/en-US/pg153-axi-quad-spi/Dual/Quad-SPI-Mode-Transactions

Signed-off-by: Vadim Fedorenko <vadfed@meta.com>

---
This is a follow up on the work started by Jonathan Lemon 2 years ago
and ended up nowhere.
https://lore.kernel.org/linux-spi/20210507215319.3882138-1-jonathan.lemon@gmail.com/
We still have an issue with our hardware and it would be great to fix it
in upstream driver. According to the out-of-tree driver supported by
Xilinx it's the only to work with QSPI:
https://github.com/Xilinx/linux-xlnx/blob/master/drivers/spi/spi-xilinx.c#L397

 drivers/spi/spi-xilinx.c       | 9 +++++++--
 include/linux/spi/xilinx_spi.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 523edfdf5dcd..9e37f3534f3f 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -83,7 +83,7 @@ struct xilinx_spi {
 	void __iomem	*regs;	/* virt. address of the control registers */
 
 	int		irq;
-
+	bool force_irq;		/* force irq to setup master inhibit */
 	u8 *rx_ptr;		/* pointer in the Tx buffer */
 	const u8 *tx_ptr;	/* pointer in the Rx buffer */
 	u8 bytes_per_word;
@@ -248,7 +248,8 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
 	xspi->rx_ptr = t->rx_buf;
 	remaining_words = t->len / xspi->bytes_per_word;
 
-	if (xspi->irq >= 0 &&  remaining_words > xspi->buffer_size) {
+	if (xspi->irq >= 0 &&
+	    (xspi->force_irq || remaining_words > xspi->buffer_size)) {
 		u32 isr;
 		use_irq = true;
 		/* Inhibit irq to avoid spurious irqs on tx_empty*/
@@ -393,6 +394,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 	struct resource *res;
 	int ret, num_cs = 0, bits_per_word;
 	struct spi_master *master;
+	bool force_irq = false;
 	u32 tmp;
 	u8 i;
 
@@ -400,6 +402,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 	if (pdata) {
 		num_cs = pdata->num_chipselect;
 		bits_per_word = pdata->bits_per_word;
+		force_irq = pdata->force_irq;
 	} else {
 		of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
 					  &num_cs);
@@ -480,6 +483,8 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 				dev_name(&pdev->dev), xspi);
 		if (ret)
 			goto put_master;
+
+		xspi->force_irq = force_irq;
 	}
 
 	/* SPI controller initializations */
diff --git a/include/linux/spi/xilinx_spi.h b/include/linux/spi/xilinx_spi.h
index c15d69d28e68..3934ce789d87 100644
--- a/include/linux/spi/xilinx_spi.h
+++ b/include/linux/spi/xilinx_spi.h
@@ -15,6 +15,7 @@ struct xspi_platform_data {
 	u8 bits_per_word;
 	struct spi_board_info *devices;
 	u8 num_devices;
+	bool force_irq;
 };
 
 #endif /* __LINUX_SPI_XILINX_SPI_H */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: xilinx: add force_irq for QSPI mode
  2023-02-09 21:13 [PATCH] spi: xilinx: add force_irq for QSPI mode Vadim Fedorenko
@ 2023-02-14 13:27 ` Mark Brown
  2023-02-14 13:55   ` Vadim Fedorenko
  2023-02-14 21:34 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-02-14 13:27 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: Ricardo Ribalda, Michal Simek, Jonathan Lemon, linux-spi,
	Vadim Fedorenko

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

On Thu, Feb 09, 2023 at 01:13:21PM -0800, Vadim Fedorenko wrote:
> Xilinx PG158 page 80 [1] states that master transaction inhibit bit must
> be set to properly setup the transaction in QSPI mode. Add the force_irq
> flag to follow this sequence.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: xilinx: add force_irq for QSPI mode
  2023-02-14 13:27 ` Mark Brown
@ 2023-02-14 13:55   ` Vadim Fedorenko
  0 siblings, 0 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2023-02-14 13:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi

On 14/02/2023 13:27, Mark Brown wrote:
> On Thu, Feb 09, 2023 at 01:13:21PM -0800, Vadim Fedorenko wrote:
>> Xilinx PG158 page 80 [1] states that master transaction inhibit bit must
>> be set to properly setup the transaction in QSPI mode. Add the force_irq
>> flag to follow this sequence.
> 
> This doesn't apply against current code, please check and resend.

Oh, yep, it has some overlap with devm_spi_alloc_master() commit. V2 is 
on the way.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: xilinx: add force_irq for QSPI mode
  2023-02-09 21:13 [PATCH] spi: xilinx: add force_irq for QSPI mode Vadim Fedorenko
  2023-02-14 13:27 ` Mark Brown
@ 2023-02-14 21:34 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-02-14 21:34 UTC (permalink / raw)
  To: Ricardo Ribalda, Michal Simek, Jonathan Lemon, Vadim Fedorenko
  Cc: linux-spi, Vadim Fedorenko

On Thu, 09 Feb 2023 13:13:21 -0800, Vadim Fedorenko wrote:
> Xilinx PG158 page 80 [1] states that master transaction inhibit bit must
> be set to properly setup the transaction in QSPI mode. Add the force_irq
> flag to follow this sequence.
> 
> [1] https://docs.xilinx.com/r/en-US/pg153-axi-quad-spi/Dual/Quad-SPI-Mode-Transactions
> 
> 
> [...]

Applied to

   broonie/spi.git for-next

Thanks!

[1/1] spi: xilinx: add force_irq for QSPI mode
      commit: 1dd46599f83ac5323a175d32955b1270e95cd11b

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] 4+ messages in thread

end of thread, other threads:[~2023-02-14 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 21:13 [PATCH] spi: xilinx: add force_irq for QSPI mode Vadim Fedorenko
2023-02-14 13:27 ` Mark Brown
2023-02-14 13:55   ` Vadim Fedorenko
2023-02-14 21:34 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.