Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328042
b: refs/heads/master
c: 7146b2d
h: refs/heads/master
v: v3
  • Loading branch information
Andreas Larsson authored and David S. Miller committed Sep 22, 2012
1 parent 38d3f67 commit 9e7bd01
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 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: f61bd0585dfc7d99db4936d7467de4ca8e2f7ea0
refs/heads/master: 7146b2d9f11e07848050f53b71bafa37a95ae609
31 changes: 24 additions & 7 deletions trunk/drivers/net/can/sja1000/sja1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,13 @@ static void set_normal_mode(struct net_device *dev)
}

/* set chip to normal mode */
priv->write_reg(priv, REG_MOD, 0x00);
if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
priv->write_reg(priv, REG_MOD, MOD_LOM);
else
priv->write_reg(priv, REG_MOD, 0x00);

udelay(10);

status = priv->read_reg(priv, REG_MOD);
}

Expand Down Expand Up @@ -310,7 +315,10 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb,

can_put_echo_skb(skb, dev, 0);

sja1000_write_cmdreg(priv, CMD_TR);
if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
sja1000_write_cmdreg(priv, CMD_TR | CMD_AT);
else
sja1000_write_cmdreg(priv, CMD_TR);

return NETDEV_TX_OK;
}
Expand Down Expand Up @@ -505,10 +513,18 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
netdev_warn(dev, "wakeup interrupt\n");

if (isrc & IRQ_TI) {
/* transmission complete interrupt */
stats->tx_bytes += priv->read_reg(priv, REG_FI) & 0xf;
stats->tx_packets++;
can_get_echo_skb(dev, 0);
/* transmission buffer released */
if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT &&
!(status & SR_TCS)) {
stats->tx_errors++;
can_free_echo_skb(dev, 0);
} else {
/* transmission complete */
stats->tx_bytes +=
priv->read_reg(priv, REG_FI) & 0xf;
stats->tx_packets++;
can_get_echo_skb(dev, 0);
}
netif_wake_queue(dev);
}
if (isrc & IRQ_RI) {
Expand Down Expand Up @@ -605,7 +621,8 @@ struct net_device *alloc_sja1000dev(int sizeof_priv)
priv->can.do_set_mode = sja1000_set_mode;
priv->can.do_get_berr_counter = sja1000_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
CAN_CTRLMODE_BERR_REPORTING;
CAN_CTRLMODE_BERR_REPORTING | CAN_CTRLMODE_LISTENONLY |
CAN_CTRLMODE_ONE_SHOT;

spin_lock_init(&priv->cmdreg_lock);

Expand Down

0 comments on commit 9e7bd01

Please sign in to comment.