[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190415202501.941196-2-arnd@arndb.de>
Date: Mon, 15 Apr 2019 22:24:14 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Greg Ungerer <gerg@...inux.org>
Cc: Linus Walleij <linus.walleij@...aro.org>, arm@...nel.org,
Arnd Bergmann <arnd@...db.de>,
"David S. Miller" <davem@...emloft.net>,
YueHaibing <yuehaibing@...wei.com>,
Yang Wei <yang.wei9@....com.cn>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq
Rather than poking the registers manually, better use the exported
interfaces for it.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/net/ethernet/micrel/ks8695net.c | 30 ++-----------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c
index 6006d47707cb..3b6375adff08 100644
--- a/drivers/net/ethernet/micrel/ks8695net.c
+++ b/drivers/net/ethernet/micrel/ks8695net.c
@@ -402,25 +402,6 @@ ks8695_tx_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
-/**
- * ks8695_get_rx_enable_bit - Get rx interrupt enable/status bit
- * @ksp: Private data for the KS8695 Ethernet
- *
- * For KS8695 document:
- * Interrupt Enable Register (offset 0xE204)
- * Bit29 : WAN MAC Receive Interrupt Enable
- * Bit16 : LAN MAC Receive Interrupt Enable
- * Interrupt Status Register (Offset 0xF208)
- * Bit29: WAN MAC Receive Status
- * Bit16: LAN MAC Receive Status
- * So, this Rx interrupt enable/status bit number is equal
- * as Rx IRQ number.
- */
-static inline u32 ks8695_get_rx_enable_bit(struct ks8695_priv *ksp)
-{
- return ksp->rx_irq;
-}
-
/**
* ks8695_rx_irq - Receive IRQ handler
* @irq: The IRQ which went off (ignored)
@@ -438,11 +419,7 @@ ks8695_rx_irq(int irq, void *dev_id)
spin_lock(&ksp->rx_lock);
if (napi_schedule_prep(&ksp->napi)) {
- unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
- unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
- /*disable rx interrupt*/
- status &= ~mask_bit;
- writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+ disable_irq(ksp->rx_irq);
__napi_schedule(&ksp->napi);
}
@@ -561,8 +538,6 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
static int ks8695_poll(struct napi_struct *napi, int budget)
{
struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi);
- unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN);
- unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
int work_done;
work_done = ks8695_rx(ksp, budget);
@@ -571,8 +546,7 @@ static int ks8695_poll(struct napi_struct *napi, int budget)
unsigned long flags;
spin_lock_irqsave(&ksp->rx_lock, flags);
- /* enable rx interrupt */
- writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
+ enable_irq(ksp->rx_irq);
spin_unlock_irqrestore(&ksp->rx_lock, flags);
}
return work_done;
--
2.20.0
Powered by blists - more mailing lists