blob: 80fa7a36e6942e75d6fc49fa2915688f00debb16 [file] [log] [blame]
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -07001/*
2 * Agere Systems Inc.
3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
4 *
Alan Cox64f93032009-06-10 17:30:41 +01005 * Copyright © 2005 Agere Systems Inc.
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -07006 * All rights reserved.
7 * http://www.agere.com
8 *
9 *------------------------------------------------------------------------------
10 *
11 * et131x_isr.c - File which contains the ISR, ISR handler, and related routines
12 * for processing interrupts from the device.
13 *
14 *------------------------------------------------------------------------------
15 *
16 * SOFTWARE LICENSE
17 *
18 * This software is provided subject to the following terms and conditions,
19 * which you should read carefully before using the software. Using this
20 * software indicates your acceptance of these terms and conditions. If you do
21 * not agree with these terms and conditions, do not use the software.
22 *
Alan Cox64f93032009-06-10 17:30:41 +010023 * Copyright © 2005 Agere Systems Inc.
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -070024 * All rights reserved.
25 *
26 * Redistribution and use in source or binary forms, with or without
27 * modifications, are permitted provided that the following conditions are met:
28 *
29 * . Redistributions of source code must retain the above copyright notice, this
30 * list of conditions and the following Disclaimer as comments in the code as
31 * well as in the documentation and/or other materials provided with the
32 * distribution.
33 *
34 * . Redistributions in binary form must reproduce the above copyright notice,
35 * this list of conditions and the following Disclaimer in the documentation
36 * and/or other materials provided with the distribution.
37 *
38 * . Neither the name of Agere Systems Inc. nor the names of the contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
41 *
42 * Disclaimer
43 *
Alan Cox64f93032009-06-10 17:30:41 +010044 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -070045 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
46 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
47 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
48 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
49 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
50 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
52 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
54 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
55 * DAMAGE.
56 *
57 */
58
59#include "et131x_version.h"
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -070060#include "et131x_defs.h"
61
62#include <linux/init.h>
63#include <linux/module.h>
64#include <linux/types.h>
65#include <linux/kernel.h>
66
67#include <linux/sched.h>
68#include <linux/ptrace.h>
69#include <linux/slab.h>
70#include <linux/ctype.h>
71#include <linux/string.h>
72#include <linux/timer.h>
73#include <linux/interrupt.h>
74#include <linux/in.h>
75#include <linux/delay.h>
Alan Cox64f93032009-06-10 17:30:41 +010076#include <linux/io.h>
77#include <linux/bitops.h>
Alan Cox15700032009-08-27 11:03:09 +010078#include <linux/pci.h>
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -070079#include <asm/system.h>
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -070080
81#include <linux/netdevice.h>
82#include <linux/etherdevice.h>
83#include <linux/skbuff.h>
84#include <linux/if_arp.h>
85#include <linux/ioport.h>
86
87#include "et1310_phy.h"
88#include "et1310_pm.h"
89#include "et1310_jagcore.h"
90#include "et1310_mac.h"
91
92#include "et131x_adapter.h"
93
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -070094/**
Alan Coxb8c4cc42009-08-27 11:02:25 +010095 * et131x_enable_interrupts - enable interrupt
96 * @adapter: et131x device
97 *
98 * Enable the appropriate interrupts on the ET131x according to our
99 * configuration
100 */
101
102void et131x_enable_interrupts(struct et131x_adapter *adapter)
103{
104 u32 mask;
105
106 /* Enable all global interrupts */
107 if (adapter->FlowControl == TxOnly || adapter->FlowControl == Both)
108 mask = INT_MASK_ENABLE;
109 else
110 mask = INT_MASK_ENABLE_NO_FLOW;
111
Alan Coxb8c4cc42009-08-27 11:02:25 +0100112 adapter->CachedMaskValue = mask;
113 writel(mask, &adapter->regs->global.int_mask);
114}
115
116/**
117 * et131x_disable_interrupts - interrupt disable
118 * @adapter: et131x device
119 *
120 * Block all interrupts from the et131x device at the device itself
121 */
122
123void et131x_disable_interrupts(struct et131x_adapter *adapter)
124{
125 /* Disable all global interrupts */
126 adapter->CachedMaskValue = INT_MASK_DISABLE;
127 writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
128}
129
130
131/**
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700132 * et131x_isr - The Interrupt Service Routine for the driver.
133 * @irq: the IRQ on which the interrupt was received.
134 * @dev_id: device-specific info (here a pointer to a net_device struct)
135 *
136 * Returns a value indicating if the interrupt was handled.
137 */
Alan Coxb8c4cc42009-08-27 11:02:25 +0100138
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700139irqreturn_t et131x_isr(int irq, void *dev_id)
140{
141 bool handled = true;
142 struct net_device *netdev = (struct net_device *)dev_id;
143 struct et131x_adapter *adapter = NULL;
Alan Cox2211b732009-08-27 11:02:12 +0100144 u32 status;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700145
Alan Cox15700032009-08-27 11:03:09 +0100146 if (!netif_device_present(netdev)) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700147 handled = false;
148 goto out;
149 }
150
151 adapter = netdev_priv(netdev);
152
153 /* If the adapter is in low power state, then it should not
154 * recognize any interrupt
155 */
156
157 /* Disable Device Interrupts */
158 et131x_disable_interrupts(adapter);
159
160 /* Get a copy of the value in the interrupt status register
161 * so we can process the interrupting section
162 */
Alan Cox2211b732009-08-27 11:02:12 +0100163 status = readl(&adapter->regs->global.int_status);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700164
165 if (adapter->FlowControl == TxOnly ||
166 adapter->FlowControl == Both) {
Alan Cox2211b732009-08-27 11:02:12 +0100167 status &= ~INT_MASK_ENABLE;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700168 } else {
Alan Cox2211b732009-08-27 11:02:12 +0100169 status &= ~INT_MASK_ENABLE_NO_FLOW;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700170 }
171
172 /* Make sure this is our interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100173 if (!status) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700174 handled = false;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700175 et131x_enable_interrupts(adapter);
176 goto out;
177 }
178
179 /* This is our interrupt, so process accordingly */
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700180
Alan Cox2211b732009-08-27 11:02:12 +0100181 if (status & ET_INTR_WATCHDOG) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700182 PMP_TCB pMpTcb = adapter->TxRing.CurrSendHead;
183
Alan Cox64f93032009-06-10 17:30:41 +0100184 if (pMpTcb)
185 if (++pMpTcb->PacketStaleCount > 1)
Alan Cox2211b732009-08-27 11:02:12 +0100186 status |= ET_INTR_TXDMA_ISR;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700187
Alan Cox64f93032009-06-10 17:30:41 +0100188 if (adapter->RxRing.UnfinishedReceives)
Alan Cox2211b732009-08-27 11:02:12 +0100189 status |= ET_INTR_RXDMA_XFR_DONE;
Alan Cox64f93032009-06-10 17:30:41 +0100190 else if (pMpTcb == NULL)
Alan Coxf3f415a2009-08-27 10:59:30 +0100191 writel(0, &adapter->regs->global.watchdog_timer);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700192
Alan Cox2211b732009-08-27 11:02:12 +0100193 status &= ~ET_INTR_WATCHDOG;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700194 }
195
Alan Cox2211b732009-08-27 11:02:12 +0100196 if (status == 0) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700197 /* This interrupt has in some way been "handled" by
198 * the ISR. Either it was a spurious Rx interrupt, or
199 * it was a Tx interrupt that has been filtered by
200 * the ISR.
201 */
202 et131x_enable_interrupts(adapter);
203 goto out;
204 }
205
206 /* We need to save the interrupt status value for use in our
207 * DPC. We will clear the software copy of that in that
208 * routine.
209 */
210 adapter->Stats.InterruptStatus = status;
211
212 /* Schedule the ISR handler as a bottom-half task in the
213 * kernel's tq_immediate queue, and mark the queue for
214 * execution
215 */
216 schedule_work(&adapter->task);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700217out:
218 return IRQ_RETVAL(handled);
219}
220
221/**
222 * et131x_isr_handler - The ISR handler
223 * @p_adapter, a pointer to the device's private adapter structure
224 *
225 * scheduled to run in a deferred context by the ISR. This is where the ISR's
226 * work actually gets done.
227 */
228void et131x_isr_handler(struct work_struct *work)
229{
Alan Cox25ad00b2009-08-19 18:21:44 +0100230 struct et131x_adapter *etdev =
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700231 container_of(work, struct et131x_adapter, task);
Alan Cox2211b732009-08-27 11:02:12 +0100232 u32 status = etdev->Stats.InterruptStatus;
Alan Coxf3f415a2009-08-27 10:59:30 +0100233 ADDRESS_MAP_t __iomem *iomem = etdev->regs;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700234
235 /*
236 * These first two are by far the most common. Once handled, we clear
237 * their two bits in the status word. If the word is now zero, we
238 * exit.
239 */
240 /* Handle all the completed Transmit interrupts */
Alan Cox2211b732009-08-27 11:02:12 +0100241 if (status & ET_INTR_TXDMA_ISR) {
Alan Cox25ad00b2009-08-19 18:21:44 +0100242 et131x_handle_send_interrupt(etdev);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700243 }
244
245 /* Handle all the completed Receives interrupts */
Alan Cox2211b732009-08-27 11:02:12 +0100246 if (status & ET_INTR_RXDMA_XFR_DONE) {
Alan Cox25ad00b2009-08-19 18:21:44 +0100247 et131x_handle_recv_interrupt(etdev);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700248 }
249
Alan Cox2211b732009-08-27 11:02:12 +0100250 status &= 0xffffffd7;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700251
Alan Cox2211b732009-08-27 11:02:12 +0100252 if (status) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700253 /* Handle the TXDMA Error interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100254 if (status & ET_INTR_TXDMA_ERR) {
Alan Coxfba84162009-08-27 11:03:29 +0100255 u32 txdma_err;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700256
257 /* Following read also clears the register (COR) */
Alan Coxfba84162009-08-27 11:03:29 +0100258 txdma_err = readl(&iomem->txdma.TxDmaError);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700259
Alan Cox15700032009-08-27 11:03:09 +0100260 dev_warn(&etdev->pdev->dev,
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700261 "TXDMA_ERR interrupt, error = %d\n",
Alan Coxfba84162009-08-27 11:03:29 +0100262 txdma_err);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700263 }
264
265 /* Handle Free Buffer Ring 0 and 1 Low interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100266 if (status & (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700267 /*
268 * This indicates the number of unused buffers in
269 * RXDMA free buffer ring 0 is <= the limit you
270 * programmed. Free buffer resources need to be
271 * returned. Free buffers are consumed as packets
272 * are passed from the network to the host. The host
273 * becomes aware of the packets from the contents of
274 * the packet status ring. This ring is queried when
275 * the packet done interrupt occurs. Packets are then
276 * passed to the OS. When the OS is done with the
277 * packets the resources can be returned to the
278 * ET1310 for re-use. This interrupt is one method of
279 * returning resources.
280 */
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700281
282 /* If the user has flow control on, then we will
283 * send a pause packet, otherwise just exit
284 */
Alan Cox25ad00b2009-08-19 18:21:44 +0100285 if (etdev->FlowControl == TxOnly ||
286 etdev->FlowControl == Both) {
Alan Coxf2c98d22009-08-27 11:01:49 +0100287 u32 pm_csr;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700288
289 /* Tell the device to send a pause packet via
290 * the back pressure register
291 */
Alan Coxf2c98d22009-08-27 11:01:49 +0100292 pm_csr = readl(&iomem->global.pm_csr);
293 if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700294 TXMAC_BP_CTRL_t bp_ctrl = { 0 };
295
296 bp_ctrl.bits.bp_req = 1;
297 bp_ctrl.bits.bp_xonxoff = 1;
298 writel(bp_ctrl.value,
299 &iomem->txmac.bp_ctrl.value);
300 }
301 }
302 }
303
304 /* Handle Packet Status Ring Low Interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100305 if (status & ET_INTR_RXDMA_STAT_LOW) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700306
307 /*
308 * Same idea as with the two Free Buffer Rings.
309 * Packets going from the network to the host each
310 * consume a free buffer resource and a packet status
311 * resource. These resoures are passed to the OS.
312 * When the OS is done with the resources, they need
313 * to be returned to the ET1310. This is one method
314 * of returning the resources.
315 */
316 }
317
318 /* Handle RXDMA Error Interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100319 if (status & ET_INTR_RXDMA_ERR) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700320 /*
321 * The rxdma_error interrupt is sent when a time-out
322 * on a request issued by the JAGCore has occurred or
323 * a completion is returned with an un-successful
324 * status. In both cases the request is considered
325 * complete. The JAGCore will automatically re-try the
326 * request in question. Normally information on events
327 * like these are sent to the host using the "Advanced
328 * Error Reporting" capability. This interrupt is
329 * another way of getting similar information. The
330 * only thing required is to clear the interrupt by
331 * reading the ISR in the global resources. The
332 * JAGCore will do a re-try on the request. Normally
333 * you should never see this interrupt. If you start
334 * to see this interrupt occurring frequently then
335 * something bad has occurred. A reset might be the
336 * thing to do.
337 */
Alan Cox64f93032009-06-10 17:30:41 +0100338 /* TRAP();*/
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700339
Alan Cox25ad00b2009-08-19 18:21:44 +0100340 etdev->TxMacTest.value =
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700341 readl(&iomem->txmac.tx_test.value);
Alan Cox15700032009-08-27 11:03:09 +0100342 dev_warn(&etdev->pdev->dev,
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700343 "RxDMA_ERR interrupt, error %x\n",
Alan Cox25ad00b2009-08-19 18:21:44 +0100344 etdev->TxMacTest.value);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700345 }
346
347 /* Handle the Wake on LAN Event */
Alan Cox2211b732009-08-27 11:02:12 +0100348 if (status & ET_INTR_WOL) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700349 /*
350 * This is a secondary interrupt for wake on LAN.
351 * The driver should never see this, if it does,
352 * something serious is wrong. We will TRAP the
353 * message when we are in DBG mode, otherwise we
354 * will ignore it.
355 */
Alan Cox15700032009-08-27 11:03:09 +0100356 dev_err(&etdev->pdev->dev, "WAKE_ON_LAN interrupt\n");
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700357 }
358
359 /* Handle the PHY interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100360 if (status & ET_INTR_PHY) {
Alan Coxf2c98d22009-08-27 11:01:49 +0100361 u32 pm_csr;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700362 MI_BMSR_t BmsrInts, BmsrData;
363 MI_ISR_t myIsr;
364
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700365 /* If we are in coma mode when we get this interrupt,
366 * we need to disable it.
367 */
Alan Coxf2c98d22009-08-27 11:01:49 +0100368 pm_csr = readl(&iomem->global.pm_csr);
369 if (pm_csr & ET_PM_PHY_SW_COMA) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700370 /*
371 * Check to see if we are in coma mode and if
372 * so, disable it because we will not be able
373 * to read PHY values until we are out.
374 */
Alan Cox25ad00b2009-08-19 18:21:44 +0100375 DisablePhyComa(etdev);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700376 }
377
378 /* Read the PHY ISR to clear the reason for the
379 * interrupt.
380 */
Alan Cox25ad00b2009-08-19 18:21:44 +0100381 MiRead(etdev, (uint8_t) offsetof(MI_REGS_t, isr),
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700382 &myIsr.value);
383
Alan Cox25ad00b2009-08-19 18:21:44 +0100384 if (!etdev->ReplicaPhyLoopbk) {
385 MiRead(etdev,
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700386 (uint8_t) offsetof(MI_REGS_t, bmsr),
387 &BmsrData.value);
388
389 BmsrInts.value =
Alan Cox25ad00b2009-08-19 18:21:44 +0100390 etdev->Bmsr.value ^ BmsrData.value;
391 etdev->Bmsr.value = BmsrData.value;
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700392
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700393 /* Do all the cable in / cable out stuff */
Alan Cox25ad00b2009-08-19 18:21:44 +0100394 et131x_Mii_check(etdev, BmsrData, BmsrInts);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700395 }
396 }
397
398 /* Let's move on to the TxMac */
Alan Cox2211b732009-08-27 11:02:12 +0100399 if (status & ET_INTR_TXMAC) {
Alan Cox25ad00b2009-08-19 18:21:44 +0100400 etdev->TxRing.TxMacErr.value =
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700401 readl(&iomem->txmac.err.value);
402
403 /*
404 * When any of the errors occur and TXMAC generates
405 * an interrupt to report these errors, it usually
406 * means that TXMAC has detected an error in the data
407 * stream retrieved from the on-chip Tx Q. All of
408 * these errors are catastrophic and TXMAC won't be
409 * able to recover data when these errors occur. In
410 * a nutshell, the whole Tx path will have to be reset
411 * and re-configured afterwards.
412 */
Alan Cox15700032009-08-27 11:03:09 +0100413 dev_warn(&etdev->pdev->dev,
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700414 "TXMAC interrupt, error 0x%08x\n",
Alan Cox25ad00b2009-08-19 18:21:44 +0100415 etdev->TxRing.TxMacErr.value);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700416
417 /* If we are debugging, we want to see this error,
418 * otherwise we just want the device to be reset and
419 * continue
420 */
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700421 }
422
423 /* Handle RXMAC Interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100424 if (status & ET_INTR_RXMAC) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700425 /*
426 * These interrupts are catastrophic to the device,
427 * what we need to do is disable the interrupts and
428 * set the flag to cause us to reset so we can solve
429 * this issue.
430 */
Alan Cox25ad00b2009-08-19 18:21:44 +0100431 /* MP_SET_FLAG( etdev,
Alan Cox64f93032009-06-10 17:30:41 +0100432 fMP_ADAPTER_HARDWARE_ERROR); */
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700433
Alan Cox15700032009-08-27 11:03:09 +0100434 dev_warn(&etdev->pdev->dev,
Alan Cox64f93032009-06-10 17:30:41 +0100435 "RXMAC interrupt, error 0x%08x. Requesting reset\n",
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700436 readl(&iomem->rxmac.err_reg.value));
437
Alan Cox15700032009-08-27 11:03:09 +0100438 dev_warn(&etdev->pdev->dev,
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700439 "Enable 0x%08x, Diag 0x%08x\n",
440 readl(&iomem->rxmac.ctrl.value),
441 readl(&iomem->rxmac.rxq_diag.value));
442
443 /*
444 * If we are debugging, we want to see this error,
445 * otherwise we just want the device to be reset and
446 * continue
447 */
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700448 }
449
450 /* Handle MAC_STAT Interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100451 if (status & ET_INTR_MAC_STAT) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700452 /*
453 * This means at least one of the un-masked counters
454 * in the MAC_STAT block has rolled over. Use this
455 * to maintain the top, software managed bits of the
456 * counter(s).
457 */
Alan Cox25ad00b2009-08-19 18:21:44 +0100458 HandleMacStatInterrupt(etdev);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700459 }
460
461 /* Handle SLV Timeout Interrupt */
Alan Cox2211b732009-08-27 11:02:12 +0100462 if (status & ET_INTR_SLV_TIMEOUT) {
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700463 /*
464 * This means a timeout has occured on a read or
465 * write request to one of the JAGCore registers. The
466 * Global Resources block has terminated the request
467 * and on a read request, returned a "fake" value.
468 * The most likely reasons are: Bad Address or the
469 * addressed module is in a power-down state and
470 * can't respond.
471 */
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700472 }
473 }
Alan Cox20dedd32009-08-19 18:21:56 +0100474 et131x_enable_interrupts(etdev);
Greg Kroah-Hartmancfb739b2008-04-03 17:30:53 -0700475}