Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 420f17b6 authored by Niranjana Vishwanathapura's avatar Niranjana Vishwanathapura Committed by Gerrit - the friendly Code Review server
Browse files

msm: emac: Use interrupt clear-on-read feature



Update the interrupt routine to make use of interrupt
clear-on-read feature. Interrupt status bits gets cleared
when the interrupt status register is read and there
is no need to write to status register to clear the bits.

Change-Id: I18483853a81070ff6d368f1153d19340017442f6
Signed-off-by: default avatarNiranjana Vishwanathapura <nvishwan@codeaurora.org>
parent b8eac8bf
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -827,26 +827,21 @@ static irqreturn_t emac_interrupt(int irq, void *data)
	int max_ints = EMAC_MAX_HANDLED_INTRS;
	u32 isr, status;

	/* disable the interrupt */
	emac_reg_w32(hw, EMAC, irq_info->mask_reg, 0);
	wmb();

	do {
		isr = emac_reg_r32(hw, EMAC, irq_info->status_reg);
		status = isr & irq_info->mask;

		if (status == 0) {
			emac_reg_w32(hw, EMAC, irq_info->status_reg, 0);
			wmb();
			if (max_ints != EMAC_MAX_HANDLED_INTRS)
				return IRQ_HANDLED;
			return IRQ_NONE;
		}
		if (status == 0)
			break;

		/* ack PHY interrupt */
		if (status & ISR_GPHY_LINK)
			emac_hw_ack_phy_intr(hw);

		/* Ack MAC interrupt and disable the interrupt */
		emac_reg_w32(hw, EMAC, irq_info->status_reg, status | DIS_INT);
		wmb();

		if (status & ISR_ERROR) {
			emac_warn(adpt, intr, "isr error status 0x%x\n",
				  status & ISR_ERROR);
@@ -861,8 +856,6 @@ static irqreturn_t emac_interrupt(int irq, void *data)
		if ((status & irq_info->rxque->intr)) {
			if (napi_schedule_prep(&irq_info->rxque->napi)) {
				irq_info->mask &= ~irq_info->rxque->intr;
				emac_reg_w32(hw, EMAC, irq_info->mask_reg,
					     irq_info->mask);
				__napi_schedule(&irq_info->rxque->napi);
			}
		}
@@ -892,7 +885,7 @@ static irqreturn_t emac_interrupt(int irq, void *data)
	} while (--max_ints > 0);

	/* enable the interrupt */
	emac_reg_w32(hw, EMAC, irq_info->status_reg, 0);
	emac_reg_w32(hw, EMAC, irq_info->mask_reg, irq_info->mask);
	wmb();
	return IRQ_HANDLED;
}