spi: pca2xx: Prepare for and enable MSI support
Subsystems (3)
v3 cover spi: pca2xx: Prepare for and enable MSI support
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(-)
Signature · 1 line
2.1.4
PATCH v3 1/2 spi: pxa2xx: Prepare for edge-triggered interrupts
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.
--- drivers/spi/spi-pxa2xx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-pxa2xx.c +3 -0
@@ -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 */
Signature · 1 line
2.1.4
PATCH v3 2/2 spi: pca2xx-pci: Allow MSI
In reply to Jan KiszkaNow 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.
--- drivers/spi/spi-pxa2xx-pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx-pci.c +7 -1
@@ -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);
Signature · 1 line
2.1.4