diff options
author | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-07-09 15:24:42 -0400 |
---|---|---|
committer | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-11-21 20:49:47 -0500 |
commit | 0954ed826921bcf11352e05a58d598c493e6bdfb (patch) | |
tree | 85674f9901e07b1e0152bb09cff29f94adf3b3a0 /drivers/net | |
parent | 0446c3b1e6208c6563ff9a0b22fb3b5e5e3e775c (diff) |
WAN: Simplify HD64572 status handling.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wan/hd64572.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c index 0952e228c2c3..46a99a668e41 100644 --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c | |||
@@ -51,10 +51,6 @@ | |||
51 | #define get_dmac_rx(port) (phy_node(port) ? DMAC1RX_OFFSET : DMAC0RX_OFFSET) | 51 | #define get_dmac_rx(port) (phy_node(port) ? DMAC1RX_OFFSET : DMAC0RX_OFFSET) |
52 | #define get_dmac_tx(port) (phy_node(port) ? DMAC1TX_OFFSET : DMAC0TX_OFFSET) | 52 | #define get_dmac_tx(port) (phy_node(port) ? DMAC1TX_OFFSET : DMAC0TX_OFFSET) |
53 | 53 | ||
54 | #define SCA_INTR_MSCI(node) (node ? 0x10 : 0x01) | ||
55 | #define SCA_INTR_DMAC_RX(node) (node ? 0x20 : 0x02) | ||
56 | #define SCA_INTR_DMAC_TX(node) (node ? 0x40 : 0x04) | ||
57 | |||
58 | static int sca_poll(struct napi_struct *napi, int budget); | 54 | static int sca_poll(struct napi_struct *napi, int budget); |
59 | 55 | ||
60 | static inline struct net_device *port_to_dev(port_t *port) | 56 | static inline struct net_device *port_to_dev(port_t *port) |
@@ -62,21 +58,6 @@ static inline struct net_device *port_to_dev(port_t *port) | |||
62 | return port->dev; | 58 | return port->dev; |
63 | } | 59 | } |
64 | 60 | ||
65 | static inline int sca_intr_status(card_t *card) | ||
66 | { | ||
67 | u8 result = 0; | ||
68 | u32 isr0 = sca_inl(ISR0, card); | ||
69 | |||
70 | if (isr0 & 0x00000002) result |= SCA_INTR_DMAC_RX(0); | ||
71 | if (isr0 & 0x00000020) result |= SCA_INTR_DMAC_TX(0); | ||
72 | if (isr0 & 0x00000200) result |= SCA_INTR_DMAC_RX(1); | ||
73 | if (isr0 & 0x00002000) result |= SCA_INTR_DMAC_TX(1); | ||
74 | if (isr0 & 0x00080000) result |= SCA_INTR_MSCI(0); | ||
75 | if (isr0 & 0x08000000) result |= SCA_INTR_MSCI(1); | ||
76 | |||
77 | return result; | ||
78 | } | ||
79 | |||
80 | static inline port_t* dev_to_port(struct net_device *dev) | 61 | static inline port_t* dev_to_port(struct net_device *dev) |
81 | { | 62 | { |
82 | return dev_to_hdlc(dev)->priv; | 63 | return dev_to_hdlc(dev)->priv; |
@@ -358,16 +339,16 @@ static inline void sca_tx_done(port_t *port) | |||
358 | static int sca_poll(struct napi_struct *napi, int budget) | 339 | static int sca_poll(struct napi_struct *napi, int budget) |
359 | { | 340 | { |
360 | port_t *port = container_of(napi, port_t, napi); | 341 | port_t *port = container_of(napi, port_t, napi); |
361 | u8 stat = sca_intr_status(port->card); | 342 | u32 isr0 = sca_inl(ISR0, port->card); |
362 | int received = 0; | 343 | int received = 0; |
363 | 344 | ||
364 | if (stat & SCA_INTR_MSCI(port->phy_node)) | 345 | if (isr0 & (port->phy_node ? 0x08000000 : 0x00080000)) |
365 | sca_msci_intr(port); | 346 | sca_msci_intr(port); |
366 | 347 | ||
367 | if (stat & SCA_INTR_DMAC_TX(port->phy_node)) | 348 | if (isr0 & (port->phy_node ? 0x00002000 : 0x00000020)) |
368 | sca_tx_done(port); | 349 | sca_tx_done(port); |
369 | 350 | ||
370 | if (stat & SCA_INTR_DMAC_RX(port->phy_node)) | 351 | if (isr0 & (port->phy_node ? 0x00000200 : 0x00000002)) |
371 | received = sca_rx_done(port, budget); | 352 | received = sca_rx_done(port, budget); |
372 | 353 | ||
373 | if (received < budget) { | 354 | if (received < budget) { |
@@ -378,17 +359,15 @@ static int sca_poll(struct napi_struct *napi, int budget) | |||
378 | return received; | 359 | return received; |
379 | } | 360 | } |
380 | 361 | ||
381 | static irqreturn_t sca_intr(int irq, void* dev_id) | 362 | static irqreturn_t sca_intr(int irq, void *dev_id) |
382 | { | 363 | { |
383 | card_t *card = dev_id; | 364 | card_t *card = dev_id; |
384 | int i; | 365 | u32 isr0 = sca_inl(ISR0, card); |
385 | u8 stat = sca_intr_status(card); | 366 | int i, handled = 0; |
386 | int handled = 0; | ||
387 | 367 | ||
388 | for (i = 0; i < 2; i++) { | 368 | for (i = 0; i < 2; i++) { |
389 | port_t *port = get_port(card, i); | 369 | port_t *port = get_port(card, i); |
390 | if (port && (stat & (SCA_INTR_MSCI(i) | SCA_INTR_DMAC_RX(i) | | 370 | if (port && (isr0 & (i ? 0x08002200 : 0x00080022))) { |
391 | SCA_INTR_DMAC_TX(i)))) { | ||
392 | handled = 1; | 371 | handled = 1; |
393 | disable_intr(port); | 372 | disable_intr(port); |
394 | netif_rx_schedule(port->dev, &port->napi); | 373 | netif_rx_schedule(port->dev, &port->napi); |