aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-08-27 06:02:12 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 15:02:28 -0400
commit2211b732ba8050bc228e129cdc30b4fdedcbea86 (patch)
tree0822f1e1a1ef413ec0504c89837257daa99711eb /drivers
parentf6b35d66cf3284fd76cd3b7dd170630235ce304c (diff)
Staging: et131x: kill the interrupt magic define and types
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/et131x/et1310_address_map.h98
-rw-r--r--drivers/staging/et131x/et1310_jagcore.c31
-rw-r--r--drivers/staging/et131x/et131x_adapter.h4
-rw-r--r--drivers/staging/et131x/et131x_isr.c55
4 files changed, 80 insertions, 108 deletions
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 285c4a8987a0..c4b0a4f2b844 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -89,72 +89,30 @@
89#define ET_PMCSR_INIT 0x38 89#define ET_PMCSR_INIT 0x38
90 90
91/* 91/*
92 * structure for interrupt status reg in global address map 92 * Interrupt status reg at address 0x0018
93 * located at address 0x0018 93 */
94 */ 94
95typedef union _INTERRUPT_t { 95#define ET_INTR_TXDMA_ISR 0x00000008
96 u32 value; 96#define ET_INTR_TXDMA_ERR 0x00000010
97 struct { 97#define ET_INTR_RXDMA_XFR_DONE 0x00000020
98#ifdef _BIT_FIELDS_HTOL 98#define ET_INTR_RXDMA_FB_R0_LOW 0x00000040
99 u32 unused5:11; /* bits 21-31 */ 99#define ET_INTR_RXDMA_FB_R1_LOW 0x00000080
100 u32 slv_timeout:1; /* bit 20 */ 100#define ET_INTR_RXDMA_STAT_LOW 0x00000100
101 u32 mac_stat_interrupt:1; /* bit 19 */ 101#define ET_INTR_RXDMA_ERR 0x00000200
102 u32 rxmac_interrupt:1; /* bit 18 */ 102#define ET_INTR_WATCHDOG 0x00004000
103 u32 txmac_interrupt:1; /* bit 17 */ 103#define ET_INTR_WOL 0x00008000
104 u32 phy_interrupt:1; /* bit 16 */ 104#define ET_INTR_PHY 0x00010000
105 u32 wake_on_lan:1; /* bit 15 */ 105#define ET_INTR_TXMAC 0x00020000
106 u32 watchdog_interrupt:1; /* bit 14 */ 106#define ET_INTR_RXMAC 0x00040000
107 u32 unused4:4; /* bits 10-13 */ 107#define ET_INTR_MAC_STAT 0x00080000
108 u32 rxdma_err:1; /* bit 9 */ 108#define ET_INTR_SLV_TIMEOUT 0x00100000
109 u32 rxdma_pkt_stat_ring_low:1; /* bit 8 */ 109
110 u32 rxdma_fb_ring1_low:1; /* bit 7 */ 110/*
111 u32 rxdma_fb_ring0_low:1; /* bit 6 */ 111 * Interrupt mask register at address 0x001C
112 u32 rxdma_xfr_done:1; /* bit 5 */ 112 * Interrupt alias clear mask reg at address 0x0020
113 u32 txdma_err:1; /* bit 4 */ 113 * Interrupt status alias reg at address 0x0024
114 u32 txdma_isr:1; /* bit 3 */ 114 *
115 u32 unused3:1; /* bit 2 */ 115 * Same masks as above
116 u32 unused2:1; /* bit 1 */
117 u32 unused1:1; /* bit 0 */
118#else
119 u32 unused1:1; /* bit 0 */
120 u32 unused2:1; /* bit 1 */
121 u32 unused3:1; /* bit 2 */
122 u32 txdma_isr:1; /* bit 3 */
123 u32 txdma_err:1; /* bit 4 */
124 u32 rxdma_xfr_done:1; /* bit 5 */
125 u32 rxdma_fb_ring0_low:1; /* bit 6 */
126 u32 rxdma_fb_ring1_low:1; /* bit 7 */
127 u32 rxdma_pkt_stat_ring_low:1; /* bit 8 */
128 u32 rxdma_err:1; /* bit 9 */
129 u32 unused4:4; /* bits 10-13 */
130 u32 watchdog_interrupt:1; /* bit 14 */
131 u32 wake_on_lan:1; /* bit 15 */
132 u32 phy_interrupt:1; /* bit 16 */
133 u32 txmac_interrupt:1; /* bit 17 */
134 u32 rxmac_interrupt:1; /* bit 18 */
135 u32 mac_stat_interrupt:1; /* bit 19 */
136 u32 slv_timeout:1; /* bit 20 */
137 u32 unused5:11; /* bits 21-31 */
138#endif
139 } bits;
140} INTERRUPT_t, *PINTERRUPT_t;
141
142/*
143 * structure for interrupt mask reg in global address map
144 * located at address 0x001C
145 * Defined earlier (INTERRUPT_t), but 'watchdog_interrupt' is not used.
146 */
147
148/*
149 * structure for interrupt alias clear mask reg in global address map
150 * located at address 0x0020
151 * Defined earlier (INTERRUPT_t)
152 */
153
154/*
155 * structure for interrupt status alias reg in global address map
156 * located at address 0x0024
157 * Defined earlier (INTERRUPT_t)
158 */ 116 */
159 117
160/* 118/*
@@ -256,10 +214,10 @@ typedef struct _GLOBAL_t { /* Location: */
256 u32 rxq_end_addr; /* 0x000C */ 214 u32 rxq_end_addr; /* 0x000C */
257 u32 pm_csr; /* 0x0010 */ 215 u32 pm_csr; /* 0x0010 */
258 u32 unused; /* 0x0014 */ 216 u32 unused; /* 0x0014 */
259 INTERRUPT_t int_status; /* 0x0018 */ 217 u32 int_status; /* 0x0018 */
260 INTERRUPT_t int_mask; /* 0x001C */ 218 u32 int_mask; /* 0x001C */
261 INTERRUPT_t int_alias_clr_en; /* 0x0020 */ 219 u32 int_alias_clr_en; /* 0x0020 */
262 INTERRUPT_t int_status_alias; /* 0x0024 */ 220 u32 int_status_alias; /* 0x0024 */
263 SW_RESET_t sw_reset; /* 0x0028 */ 221 SW_RESET_t sw_reset; /* 0x0028 */
264 SLV_TIMER_t slv_timer; /* 0x002C */ 222 SLV_TIMER_t slv_timer; /* 0x002C */
265 MSI_CONFIG_t msi_config; /* 0x0030 */ 223 MSI_CONFIG_t msi_config; /* 0x0030 */
diff --git a/drivers/staging/et131x/et1310_jagcore.c b/drivers/staging/et131x/et1310_jagcore.c
index 47089bf59669..ff238ef97283 100644
--- a/drivers/staging/et131x/et1310_jagcore.c
+++ b/drivers/staging/et131x/et1310_jagcore.c
@@ -174,26 +174,41 @@ void ConfigMMCRegs(struct et131x_adapter *etdev)
174 DBG_LEAVE(et131x_dbginfo); 174 DBG_LEAVE(et131x_dbginfo);
175} 175}
176 176
177/**
178 * et131x_enable_interrupts - enable interrupt
179 * @adapter: et131x device
180 *
181 * Enable the appropriate interrupts on the ET131x according to our
182 * configuration
183 */
184
177void et131x_enable_interrupts(struct et131x_adapter *adapter) 185void et131x_enable_interrupts(struct et131x_adapter *adapter)
178{ 186{
179 uint32_t MaskValue; 187 u32 mask;
180 188
181 /* Enable all global interrupts */ 189 /* Enable all global interrupts */
182 if (adapter->FlowControl == TxOnly || adapter->FlowControl == Both) 190 if (adapter->FlowControl == TxOnly || adapter->FlowControl == Both)
183 MaskValue = INT_MASK_ENABLE; 191 mask = INT_MASK_ENABLE;
184 else 192 else
185 MaskValue = INT_MASK_ENABLE_NO_FLOW; 193 mask = INT_MASK_ENABLE_NO_FLOW;
186 194
187 if (adapter->DriverNoPhyAccess) 195 if (adapter->DriverNoPhyAccess)
188 MaskValue |= 0x10000; 196 mask |= ET_INTR_PHY;
189 197
190 adapter->CachedMaskValue.value = MaskValue; 198 adapter->CachedMaskValue = mask;
191 writel(MaskValue, &adapter->regs->global.int_mask.value); 199 writel(mask, &adapter->regs->global.int_mask);
192} 200}
193 201
202/**
203 * et131x_disable_interrupts - interrupt disable
204 * @adapter: et131x device
205 *
206 * Block all interrupts from the et131x device at the device itself
207 */
208
194void et131x_disable_interrupts(struct et131x_adapter *adapter) 209void et131x_disable_interrupts(struct et131x_adapter *adapter)
195{ 210{
196 /* Disable all global interrupts */ 211 /* Disable all global interrupts */
197 adapter->CachedMaskValue.value = INT_MASK_DISABLE; 212 adapter->CachedMaskValue = INT_MASK_DISABLE;
198 writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask.value); 213 writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
199} 214}
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 05388eb02bbc..4e795f0b076e 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -184,7 +184,7 @@ typedef struct _ce_stats_t {
184#endif /* CONFIG_ET131X_DEBUG */ 184#endif /* CONFIG_ET131X_DEBUG */
185 185
186 u32 SynchrounousIterations; 186 u32 SynchrounousIterations;
187 INTERRUPT_t InterruptStatus; 187 u32 InterruptStatus;
188} CE_STATS_t, *PCE_STATS_t; 188} CE_STATS_t, *PCE_STATS_t;
189 189
190/* The private adapter structure */ 190/* The private adapter structure */
@@ -260,7 +260,7 @@ struct et131x_adapter {
260 /* Minimize init-time */ 260 /* Minimize init-time */
261 struct timer_list ErrorTimer; 261 struct timer_list ErrorTimer;
262 MP_POWER_MGMT PoMgmt; 262 MP_POWER_MGMT PoMgmt;
263 INTERRUPT_t CachedMaskValue; 263 u32 CachedMaskValue;
264 264
265 /* Xcvr status at last poll */ 265 /* Xcvr status at last poll */
266 MI_BMSR_t Bmsr; 266 MI_BMSR_t Bmsr;
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 00b815ac12c7..656df12acf72 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -108,7 +108,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
108 bool handled = true; 108 bool handled = true;
109 struct net_device *netdev = (struct net_device *)dev_id; 109 struct net_device *netdev = (struct net_device *)dev_id;
110 struct et131x_adapter *adapter = NULL; 110 struct et131x_adapter *adapter = NULL;
111 INTERRUPT_t status; 111 u32 status;
112 112
113 if (netdev == NULL || !netif_device_present(netdev)) { 113 if (netdev == NULL || !netif_device_present(netdev)) {
114 DBG_WARNING(et131x_dbginfo, 114 DBG_WARNING(et131x_dbginfo,
@@ -129,17 +129,17 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
129 /* Get a copy of the value in the interrupt status register 129 /* Get a copy of the value in the interrupt status register
130 * so we can process the interrupting section 130 * so we can process the interrupting section
131 */ 131 */
132 status.value = readl(&adapter->regs->global.int_status.value); 132 status = readl(&adapter->regs->global.int_status);
133 133
134 if (adapter->FlowControl == TxOnly || 134 if (adapter->FlowControl == TxOnly ||
135 adapter->FlowControl == Both) { 135 adapter->FlowControl == Both) {
136 status.value &= ~INT_MASK_ENABLE; 136 status &= ~INT_MASK_ENABLE;
137 } else { 137 } else {
138 status.value &= ~INT_MASK_ENABLE_NO_FLOW; 138 status &= ~INT_MASK_ENABLE_NO_FLOW;
139 } 139 }
140 140
141 /* Make sure this is our interrupt */ 141 /* Make sure this is our interrupt */
142 if (!status.value) { 142 if (!status) {
143#ifdef CONFIG_ET131X_DEBUG 143#ifdef CONFIG_ET131X_DEBUG
144 adapter->Stats.UnhandledInterruptsPerSec++; 144 adapter->Stats.UnhandledInterruptsPerSec++;
145#endif 145#endif
@@ -151,32 +151,32 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
151 151
152 /* This is our interrupt, so process accordingly */ 152 /* This is our interrupt, so process accordingly */
153#ifdef CONFIG_ET131X_DEBUG 153#ifdef CONFIG_ET131X_DEBUG
154 if (status.bits.rxdma_xfr_done) 154 if (status & ET_INTR_RXDMA_XFR_DONE)
155 adapter->Stats.RxDmaInterruptsPerSec++; 155 adapter->Stats.RxDmaInterruptsPerSec++;
156 156
157 if (status.bits.txdma_isr) 157 if (status & ET_INTR_TXDMA_ISR)
158 adapter->Stats.TxDmaInterruptsPerSec++; 158 adapter->Stats.TxDmaInterruptsPerSec++;
159#endif 159#endif
160 160
161 if (status.bits.watchdog_interrupt) { 161 if (status & ET_INTR_WATCHDOG) {
162 PMP_TCB pMpTcb = adapter->TxRing.CurrSendHead; 162 PMP_TCB pMpTcb = adapter->TxRing.CurrSendHead;
163 163
164 if (pMpTcb) 164 if (pMpTcb)
165 if (++pMpTcb->PacketStaleCount > 1) 165 if (++pMpTcb->PacketStaleCount > 1)
166 status.bits.txdma_isr = 1; 166 status |= ET_INTR_TXDMA_ISR;
167 167
168 if (adapter->RxRing.UnfinishedReceives) 168 if (adapter->RxRing.UnfinishedReceives)
169 status.bits.rxdma_xfr_done = 1; 169 status |= ET_INTR_RXDMA_XFR_DONE;
170 else if (pMpTcb == NULL) 170 else if (pMpTcb == NULL)
171 writel(0, &adapter->regs->global.watchdog_timer); 171 writel(0, &adapter->regs->global.watchdog_timer);
172 172
173 status.bits.watchdog_interrupt = 0; 173 status &= ~ET_INTR_WATCHDOG;
174#ifdef CONFIG_ET131X_DEBUG 174#ifdef CONFIG_ET131X_DEBUG
175 adapter->Stats.WatchDogInterruptsPerSec++; 175 adapter->Stats.WatchDogInterruptsPerSec++;
176#endif 176#endif
177 } 177 }
178 178
179 if (status.value == 0) { 179 if (status == 0) {
180 /* This interrupt has in some way been "handled" by 180 /* This interrupt has in some way been "handled" by
181 * the ISR. Either it was a spurious Rx interrupt, or 181 * the ISR. Either it was a spurious Rx interrupt, or
182 * it was a Tx interrupt that has been filtered by 182 * it was a Tx interrupt that has been filtered by
@@ -213,7 +213,7 @@ void et131x_isr_handler(struct work_struct *work)
213{ 213{
214 struct et131x_adapter *etdev = 214 struct et131x_adapter *etdev =
215 container_of(work, struct et131x_adapter, task); 215 container_of(work, struct et131x_adapter, task);
216 INTERRUPT_t GlobStatus = etdev->Stats.InterruptStatus; 216 u32 status = etdev->Stats.InterruptStatus;
217 ADDRESS_MAP_t __iomem *iomem = etdev->regs; 217 ADDRESS_MAP_t __iomem *iomem = etdev->regs;
218 218
219 /* 219 /*
@@ -222,22 +222,22 @@ void et131x_isr_handler(struct work_struct *work)
222 * exit. 222 * exit.
223 */ 223 */
224 /* Handle all the completed Transmit interrupts */ 224 /* Handle all the completed Transmit interrupts */
225 if (GlobStatus.bits.txdma_isr) { 225 if (status & ET_INTR_TXDMA_ISR) {
226 DBG_TX(et131x_dbginfo, "TXDMA_ISR interrupt\n"); 226 DBG_TX(et131x_dbginfo, "TXDMA_ISR interrupt\n");
227 et131x_handle_send_interrupt(etdev); 227 et131x_handle_send_interrupt(etdev);
228 } 228 }
229 229
230 /* Handle all the completed Receives interrupts */ 230 /* Handle all the completed Receives interrupts */
231 if (GlobStatus.bits.rxdma_xfr_done) { 231 if (status & ET_INTR_RXDMA_XFR_DONE) {
232 DBG_RX(et131x_dbginfo, "RXDMA_XFR_DONE interrupt\n"); 232 DBG_RX(et131x_dbginfo, "RXDMA_XFR_DONE interrupt\n");
233 et131x_handle_recv_interrupt(etdev); 233 et131x_handle_recv_interrupt(etdev);
234 } 234 }
235 235
236 GlobStatus.value &= 0xffffffd7; 236 status &= 0xffffffd7;
237 237
238 if (GlobStatus.value) { 238 if (status) {
239 /* Handle the TXDMA Error interrupt */ 239 /* Handle the TXDMA Error interrupt */
240 if (GlobStatus.bits.txdma_err) { 240 if (status & ET_INTR_TXDMA_ERR) {
241 TXDMA_ERROR_t TxDmaErr; 241 TXDMA_ERROR_t TxDmaErr;
242 242
243 /* Following read also clears the register (COR) */ 243 /* Following read also clears the register (COR) */
@@ -249,8 +249,7 @@ void et131x_isr_handler(struct work_struct *work)
249 } 249 }
250 250
251 /* Handle Free Buffer Ring 0 and 1 Low interrupt */ 251 /* Handle Free Buffer Ring 0 and 1 Low interrupt */
252 if (GlobStatus.bits.rxdma_fb_ring0_low || 252 if (status & (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) {
253 GlobStatus.bits.rxdma_fb_ring1_low) {
254 /* 253 /*
255 * This indicates the number of unused buffers in 254 * This indicates the number of unused buffers in
256 * RXDMA free buffer ring 0 is <= the limit you 255 * RXDMA free buffer ring 0 is <= the limit you
@@ -292,7 +291,7 @@ void et131x_isr_handler(struct work_struct *work)
292 } 291 }
293 292
294 /* Handle Packet Status Ring Low Interrupt */ 293 /* Handle Packet Status Ring Low Interrupt */
295 if (GlobStatus.bits.rxdma_pkt_stat_ring_low) { 294 if (status & ET_INTR_RXDMA_STAT_LOW) {
296 DBG_WARNING(et131x_dbginfo, 295 DBG_WARNING(et131x_dbginfo,
297 "RXDMA_PKT_STAT_RING_LOW interrupt\n"); 296 "RXDMA_PKT_STAT_RING_LOW interrupt\n");
298 297
@@ -308,7 +307,7 @@ void et131x_isr_handler(struct work_struct *work)
308 } 307 }
309 308
310 /* Handle RXDMA Error Interrupt */ 309 /* Handle RXDMA Error Interrupt */
311 if (GlobStatus.bits.rxdma_err) { 310 if (status & ET_INTR_RXDMA_ERR) {
312 /* 311 /*
313 * The rxdma_error interrupt is sent when a time-out 312 * The rxdma_error interrupt is sent when a time-out
314 * on a request issued by the JAGCore has occurred or 313 * on a request issued by the JAGCore has occurred or
@@ -337,7 +336,7 @@ void et131x_isr_handler(struct work_struct *work)
337 } 336 }
338 337
339 /* Handle the Wake on LAN Event */ 338 /* Handle the Wake on LAN Event */
340 if (GlobStatus.bits.wake_on_lan) { 339 if (status & ET_INTR_WOL) {
341 /* 340 /*
342 * This is a secondary interrupt for wake on LAN. 341 * This is a secondary interrupt for wake on LAN.
343 * The driver should never see this, if it does, 342 * The driver should never see this, if it does,
@@ -349,7 +348,7 @@ void et131x_isr_handler(struct work_struct *work)
349 } 348 }
350 349
351 /* Handle the PHY interrupt */ 350 /* Handle the PHY interrupt */
352 if (GlobStatus.bits.phy_interrupt) { 351 if (status & ET_INTR_PHY) {
353 u32 pm_csr; 352 u32 pm_csr;
354 MI_BMSR_t BmsrInts, BmsrData; 353 MI_BMSR_t BmsrInts, BmsrData;
355 MI_ISR_t myIsr; 354 MI_ISR_t myIsr;
@@ -398,7 +397,7 @@ void et131x_isr_handler(struct work_struct *work)
398 } 397 }
399 398
400 /* Let's move on to the TxMac */ 399 /* Let's move on to the TxMac */
401 if (GlobStatus.bits.txmac_interrupt) { 400 if (status & ET_INTR_TXMAC) {
402 etdev->TxRing.TxMacErr.value = 401 etdev->TxRing.TxMacErr.value =
403 readl(&iomem->txmac.err.value); 402 readl(&iomem->txmac.err.value);
404 403
@@ -424,7 +423,7 @@ void et131x_isr_handler(struct work_struct *work)
424 } 423 }
425 424
426 /* Handle RXMAC Interrupt */ 425 /* Handle RXMAC Interrupt */
427 if (GlobStatus.bits.rxmac_interrupt) { 426 if (status & ET_INTR_RXMAC) {
428 /* 427 /*
429 * These interrupts are catastrophic to the device, 428 * These interrupts are catastrophic to the device,
430 * what we need to do is disable the interrupts and 429 * what we need to do is disable the interrupts and
@@ -452,7 +451,7 @@ void et131x_isr_handler(struct work_struct *work)
452 } 451 }
453 452
454 /* Handle MAC_STAT Interrupt */ 453 /* Handle MAC_STAT Interrupt */
455 if (GlobStatus.bits.mac_stat_interrupt) { 454 if (status & ET_INTR_MAC_STAT) {
456 /* 455 /*
457 * This means at least one of the un-masked counters 456 * This means at least one of the un-masked counters
458 * in the MAC_STAT block has rolled over. Use this 457 * in the MAC_STAT block has rolled over. Use this
@@ -464,7 +463,7 @@ void et131x_isr_handler(struct work_struct *work)
464 } 463 }
465 464
466 /* Handle SLV Timeout Interrupt */ 465 /* Handle SLV Timeout Interrupt */
467 if (GlobStatus.bits.slv_timeout) { 466 if (status & ET_INTR_SLV_TIMEOUT) {
468 /* 467 /*
469 * This means a timeout has occured on a read or 468 * This means a timeout has occured on a read or
470 * write request to one of the JAGCore registers. The 469 * write request to one of the JAGCore registers. The