aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/realtek/r8169.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2012-01-26 06:59:08 -0500
committerFrancois Romieu <romieu@fr.zoreil.com>2012-01-27 03:57:45 -0500
commit9085cdfa2f9f04d8678465748e2cced6e3f02e26 (patch)
tree0ca0921d509ed2959d21f94c9ac20f7567599a00 /drivers/net/ethernet/realtek/r8169.c
parent3e990ff5f119c2f9b142f3e2548dc90ca9b7dfa1 (diff)
r8169: irq mask helpers.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Hayes Wang <hayeswang@realtek.com>
Diffstat (limited to 'drivers/net/ethernet/realtek/r8169.c')
-rw-r--r--drivers/net/ethernet/realtek/r8169.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 9f9abb5d01a5..610f4b3655c7 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1184,6 +1184,29 @@ static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr)
1184 return value; 1184 return value;
1185} 1185}
1186 1186
1187static u16 rtl_get_events(struct rtl8169_private *tp)
1188{
1189 void __iomem *ioaddr = tp->mmio_addr;
1190
1191 return RTL_R16(IntrStatus);
1192}
1193
1194static void rtl_ack_events(struct rtl8169_private *tp, u16 bits)
1195{
1196 void __iomem *ioaddr = tp->mmio_addr;
1197
1198 RTL_W16(IntrStatus, bits);
1199 mmiowb();
1200}
1201
1202static void rtl_irq_disable(struct rtl8169_private *tp)
1203{
1204 void __iomem *ioaddr = tp->mmio_addr;
1205
1206 RTL_W16(IntrMask, 0);
1207 mmiowb();
1208}
1209
1187static void rtl_irq_enable(struct rtl8169_private *tp, u16 bits) 1210static void rtl_irq_enable(struct rtl8169_private *tp, u16 bits)
1188{ 1211{
1189 void __iomem *ioaddr = tp->mmio_addr; 1212 void __iomem *ioaddr = tp->mmio_addr;
@@ -1195,8 +1218,8 @@ static void rtl8169_irq_mask_and_ack(struct rtl8169_private *tp)
1195{ 1218{
1196 void __iomem *ioaddr = tp->mmio_addr; 1219 void __iomem *ioaddr = tp->mmio_addr;
1197 1220
1198 RTL_W16(IntrMask, 0x0000); 1221 rtl_irq_disable(tp);
1199 RTL_W16(IntrStatus, tp->intr_event); 1222 rtl_ack_events(tp, tp->intr_event);
1200 RTL_R8(ChipCmd); 1223 RTL_R8(ChipCmd);
1201} 1224}
1202 1225
@@ -4057,11 +4080,11 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4057 4080
4058 rtl_init_rxcfg(tp); 4081 rtl_init_rxcfg(tp);
4059 4082
4060 RTL_W16(IntrMask, 0x0000); 4083 rtl_irq_disable(tp);
4061 4084
4062 rtl_hw_reset(tp); 4085 rtl_hw_reset(tp);
4063 4086
4064 RTL_W16(IntrStatus, 0xffff); 4087 rtl_ack_events(tp, 0xffff);
4065 4088
4066 pci_set_master(pdev); 4089 pci_set_master(pdev);
4067 4090
@@ -5775,12 +5798,12 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
5775 struct rtl8169_private *tp = netdev_priv(dev); 5798 struct rtl8169_private *tp = netdev_priv(dev);
5776 void __iomem *ioaddr = tp->mmio_addr; 5799 void __iomem *ioaddr = tp->mmio_addr;
5777 int handled = 0; 5800 int handled = 0;
5778 int status; 5801 u16 status;
5779 5802
5780 /* loop handling interrupts until we have no new ones or 5803 /* loop handling interrupts until we have no new ones or
5781 * we hit a invalid/hotplug case. 5804 * we hit a invalid/hotplug case.
5782 */ 5805 */
5783 status = RTL_R16(IntrStatus); 5806 status = rtl_get_events(tp);
5784 while (status && status != 0xffff) { 5807 while (status && status != 0xffff) {
5785 status &= tp->intr_event; 5808 status &= tp->intr_event;
5786 if (!status) 5809 if (!status)
@@ -5839,7 +5862,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
5839 */ 5862 */
5840 RTL_W16(IntrStatus, 5863 RTL_W16(IntrStatus,
5841 (status & RxFIFOOver) ? (status | RxOverflow) : status); 5864 (status & RxFIFOOver) ? (status | RxOverflow) : status);
5842 status = RTL_R16(IntrStatus); 5865 status = rtl_get_events(tp);
5843 } 5866 }
5844done: 5867done:
5845 return IRQ_RETVAL(handled); 5868 return IRQ_RETVAL(handled);