Skip to content

Commit 94eca90

Browse files
Dilip Kotabroonie
authored andcommitted
spi: lantiq: Add support to acknowledge interrupt
On newer chipsets interrupt need to be acknowledged as they use different interrupt controller which does not acknowledge the interrupts automatically. Signed-off-by: Dilip Kota <[email protected]> Link: https://lore.kernel.org/r/608923b484d9ef239b44bb545c0b79b27030a6ae.1594957019.git.eswara.kota@linux.intel.com Signed-off-by: Mark Brown <[email protected]>
1 parent 8d19d66 commit 94eca90

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/spi/spi-lantiq-ssc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ struct lantiq_ssc_hwcfg {
160160
unsigned int irnen_t;
161161
unsigned int irncr;
162162
unsigned int irnicr;
163+
bool irq_ack;
163164
};
164165

165166
struct lantiq_ssc_spi {
@@ -622,9 +623,14 @@ static void rx_request(struct lantiq_ssc_spi *spi)
622623
static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data)
623624
{
624625
struct lantiq_ssc_spi *spi = data;
626+
const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg;
627+
u32 val = lantiq_ssc_readl(spi, hwcfg->irncr);
625628
unsigned long flags;
626629

627630
spin_lock_irqsave(&spi->lock, flags);
631+
if (hwcfg->irq_ack)
632+
lantiq_ssc_writel(spi, val, hwcfg->irncr);
633+
628634
if (spi->tx) {
629635
if (spi->rx && spi->rx_todo)
630636
rx_fifo_read_full_duplex(spi);
@@ -659,13 +665,18 @@ static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data)
659665
static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data)
660666
{
661667
struct lantiq_ssc_spi *spi = data;
668+
const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg;
662669
u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT);
670+
u32 val = lantiq_ssc_readl(spi, hwcfg->irncr);
663671
unsigned long flags;
664672

665673
if (!(stat & LTQ_SPI_STAT_ERRORS))
666674
return IRQ_NONE;
667675

668676
spin_lock_irqsave(&spi->lock, flags);
677+
if (hwcfg->irq_ack)
678+
lantiq_ssc_writel(spi, val, hwcfg->irncr);
679+
669680
if (stat & LTQ_SPI_STAT_RUE)
670681
dev_err(spi->dev, "receive underflow error\n");
671682
if (stat & LTQ_SPI_STAT_TUE)
@@ -796,13 +807,15 @@ static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = {
796807
.irnen_t = LTQ_SPI_IRNEN_T_XWAY,
797808
.irnicr = 0xF8,
798809
.irncr = 0xFC,
810+
.irq_ack = false,
799811
};
800812

801813
static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = {
802814
.irnen_r = LTQ_SPI_IRNEN_R_XRX,
803815
.irnen_t = LTQ_SPI_IRNEN_T_XRX,
804816
.irnicr = 0xF8,
805817
.irncr = 0xFC,
818+
.irq_ack = false,
806819
};
807820

808821
static const struct of_device_id lantiq_ssc_match[] = {

0 commit comments

Comments
 (0)