linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] spi: pca2xx: Prepare for and enable MSI support
@ 2017-01-21  9:06 Jan Kiszka
  2017-01-21  9:06 ` [PATCH v3 1/2] spi: pxa2xx: Prepare for edge-triggered interrupts Jan Kiszka
  2017-01-21  9:06 ` [PATCH v3 2/2] spi: pca2xx-pci: Allow MSI Jan Kiszka
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2017-01-21  9:06 UTC (permalink / raw)
  To: linux-arm-kernel

This enhances the pca2xx driver's interrupt handler with support for
edge-triggered interrupts and makes use of that for PCI-hosted variants,
like the Intel Quark SoC.

Changes in v3:
- removed already applied patch "Factor out handle_bad_msg"
- avoid inner looping by making the hardware retrigger on "forgotten"
  IRQ sources
- added acked/reviewed tags

Changes in v2:
- factored out handle_bad_msg (Andy)
- reordered code in patch 3, avoiding unneeded pci_free_irq_vectors (Andy)

Jan

Jan Kiszka (2):
  spi: pxa2xx: Prepare for edge-triggered interrupts
  spi: pca2xx-pci: Allow MSI

 drivers/spi/spi-pxa2xx-pci.c | 8 +++++++-
 drivers/spi/spi-pxa2xx.c     | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

-- 
2.1.4

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

* [PATCH v3 1/2] spi: pxa2xx: Prepare for edge-triggered interrupts
  2017-01-21  9:06 [PATCH v3 0/2] spi: pca2xx: Prepare for and enable MSI support Jan Kiszka
@ 2017-01-21  9:06 ` Jan Kiszka
  2017-01-21  9:06 ` [PATCH v3 2/2] spi: pca2xx-pci: Allow MSI Jan Kiszka
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2017-01-21  9:06 UTC (permalink / raw)
  To: linux-arm-kernel

When using the a device with edge-triggered interrupts, such as MSIs,
the interrupt handler has to ensure that there is a point in time during
its execution where all interrupts sources are silent so that a new
event can trigger a new interrupt again.

This is achieved here by disabling all interrupt sources for a moment
before processing them according to the status register. If a new
interrupt should have arrived after we read the status, it will now
re-trigger the interrupt, even in edge mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/spi/spi-pxa2xx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index bd843df..47b65d7 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -785,6 +785,9 @@ static irqreturn_t ssp_int(int irq, void *dev_id)
 	if (!(status & mask))
 		return IRQ_NONE;
 
+	pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg & ~drv_data->int_cr1);
+	pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg);
+
 	if (!drv_data->master->cur_msg) {
 		handle_bad_msg(drv_data);
 		/* Never fail */
-- 
2.1.4

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

* [PATCH v3 2/2] spi: pca2xx-pci: Allow MSI
  2017-01-21  9:06 [PATCH v3 0/2] spi: pca2xx: Prepare for and enable MSI support Jan Kiszka
  2017-01-21  9:06 ` [PATCH v3 1/2] spi: pxa2xx: Prepare for edge-triggered interrupts Jan Kiszka
@ 2017-01-21  9:06 ` Jan Kiszka
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2017-01-21  9:06 UTC (permalink / raw)
  To: linux-arm-kernel

Now that the core is ready for edge-triggered interrupts, we can safely
allow the PCI versions that provide this to enable the feature and,
thus, have less shared interrupts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/spi/spi-pxa2xx-pci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 868452d..869f188 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -227,10 +227,16 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
 	ssp = &spi_pdata.ssp;
 	ssp->phys_base = pci_resource_start(dev, 0);
 	ssp->mmio_base = pcim_iomap_table(dev)[0];
-	ssp->irq = dev->irq;
 	ssp->port_id = (c->port_id >= 0) ? c->port_id : dev->devfn;
 	ssp->type = c->type;
 
+	pci_set_master(dev);
+
+	ret = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
+	if (ret < 0)
+		return ret;
+	ssp->irq = pci_irq_vector(dev, 0);
+
 	snprintf(buf, sizeof(buf), "pxa2xx-spi.%d", ssp->port_id);
 	ssp->clk = clk_register_fixed_rate(&dev->dev, buf , NULL, 0,
 					   c->max_clk_rate);
-- 
2.1.4

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

end of thread, other threads:[~2017-01-21  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-21  9:06 [PATCH v3 0/2] spi: pca2xx: Prepare for and enable MSI support Jan Kiszka
2017-01-21  9:06 ` [PATCH v3 1/2] spi: pxa2xx: Prepare for edge-triggered interrupts Jan Kiszka
2017-01-21  9:06 ` [PATCH v3 2/2] spi: pca2xx-pci: Allow MSI Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).