Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122088
b: refs/heads/master
c: 0954ed8
h: refs/heads/master
v: v3
  • Loading branch information
Krzysztof Hałasa committed Nov 22, 2008
1 parent 89c85b6 commit 5726df9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0446c3b1e6208c6563ff9a0b22fb3b5e5e3e775c
refs/heads/master: 0954ed826921bcf11352e05a58d598c493e6bdfb
37 changes: 8 additions & 29 deletions trunk/drivers/net/wan/hd64572.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,13 @@
#define get_dmac_rx(port) (phy_node(port) ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)
#define get_dmac_tx(port) (phy_node(port) ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)

#define SCA_INTR_MSCI(node) (node ? 0x10 : 0x01)
#define SCA_INTR_DMAC_RX(node) (node ? 0x20 : 0x02)
#define SCA_INTR_DMAC_TX(node) (node ? 0x40 : 0x04)

static int sca_poll(struct napi_struct *napi, int budget);

static inline struct net_device *port_to_dev(port_t *port)
{
return port->dev;
}

static inline int sca_intr_status(card_t *card)
{
u8 result = 0;
u32 isr0 = sca_inl(ISR0, card);

if (isr0 & 0x00000002) result |= SCA_INTR_DMAC_RX(0);
if (isr0 & 0x00000020) result |= SCA_INTR_DMAC_TX(0);
if (isr0 & 0x00000200) result |= SCA_INTR_DMAC_RX(1);
if (isr0 & 0x00002000) result |= SCA_INTR_DMAC_TX(1);
if (isr0 & 0x00080000) result |= SCA_INTR_MSCI(0);
if (isr0 & 0x08000000) result |= SCA_INTR_MSCI(1);

return result;
}

static inline port_t* dev_to_port(struct net_device *dev)
{
return dev_to_hdlc(dev)->priv;
Expand Down Expand Up @@ -358,16 +339,16 @@ static inline void sca_tx_done(port_t *port)
static int sca_poll(struct napi_struct *napi, int budget)
{
port_t *port = container_of(napi, port_t, napi);
u8 stat = sca_intr_status(port->card);
u32 isr0 = sca_inl(ISR0, port->card);
int received = 0;

if (stat & SCA_INTR_MSCI(port->phy_node))
if (isr0 & (port->phy_node ? 0x08000000 : 0x00080000))
sca_msci_intr(port);

if (stat & SCA_INTR_DMAC_TX(port->phy_node))
if (isr0 & (port->phy_node ? 0x00002000 : 0x00000020))
sca_tx_done(port);

if (stat & SCA_INTR_DMAC_RX(port->phy_node))
if (isr0 & (port->phy_node ? 0x00000200 : 0x00000002))
received = sca_rx_done(port, budget);

if (received < budget) {
Expand All @@ -378,17 +359,15 @@ static int sca_poll(struct napi_struct *napi, int budget)
return received;
}

static irqreturn_t sca_intr(int irq, void* dev_id)
static irqreturn_t sca_intr(int irq, void *dev_id)
{
card_t *card = dev_id;
int i;
u8 stat = sca_intr_status(card);
int handled = 0;
u32 isr0 = sca_inl(ISR0, card);
int i, handled = 0;

for (i = 0; i < 2; i++) {
port_t *port = get_port(card, i);
if (port && (stat & (SCA_INTR_MSCI(i) | SCA_INTR_DMAC_RX(i) |
SCA_INTR_DMAC_TX(i)))) {
if (port && (isr0 & (i ? 0x08002200 : 0x00080022))) {
handled = 1;
disable_intr(port);
netif_rx_schedule(port->dev, &port->napi);
Expand Down

0 comments on commit 5726df9

Please sign in to comment.