diff options
author | David S. Miller <davem@davemloft.net> | 2012-02-04 16:39:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-04 16:39:32 -0500 |
commit | dd48dc34fe7639a8b2e22d8b609672f5f81aa7cb (patch) | |
tree | f16ace0ae09edab16bf6d0be9e8280dfbb7100da /drivers/net/can | |
parent | 8d9eb069eafce49307f839783e4a4673414b1fd5 (diff) | |
parent | 5962b35c1de3254a2f03b95efd3b7854b874d7b7 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/cc770/cc770.c | 4 | ||||
-rw-r--r-- | drivers/net/can/cc770/cc770_isa.c | 16 | ||||
-rw-r--r-- | drivers/net/can/flexcan.c | 7 | ||||
-rw-r--r-- | drivers/net/can/pch_can.c | 3 | ||||
-rw-r--r-- | drivers/net/can/sja1000/peak_pci.c | 23 | ||||
-rw-r--r-- | drivers/net/can/ti_hecc.c | 3 | ||||
-rw-r--r-- | drivers/net/can/usb/ems_usb.c | 9 |
7 files changed, 37 insertions, 28 deletions
diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c index 766896747643..c30f0e6f1048 100644 --- a/drivers/net/can/cc770/cc770.c +++ b/drivers/net/can/cc770/cc770.c | |||
@@ -440,12 +440,14 @@ static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
440 | for (i = 0; i < dlc; i++) | 440 | for (i = 0; i < dlc; i++) |
441 | cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]); | 441 | cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]); |
442 | 442 | ||
443 | /* Store echo skb before starting the transfer */ | ||
444 | can_put_echo_skb(skb, dev, 0); | ||
445 | |||
443 | cc770_write_reg(priv, msgobj[mo].ctrl1, | 446 | cc770_write_reg(priv, msgobj[mo].ctrl1, |
444 | RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC); | 447 | RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC); |
445 | 448 | ||
446 | stats->tx_bytes += dlc; | 449 | stats->tx_bytes += dlc; |
447 | 450 | ||
448 | can_put_echo_skb(skb, dev, 0); | ||
449 | 451 | ||
450 | /* | 452 | /* |
451 | * HM: We had some cases of repeated IRQs so make sure the | 453 | * HM: We had some cases of repeated IRQs so make sure the |
diff --git a/drivers/net/can/cc770/cc770_isa.c b/drivers/net/can/cc770/cc770_isa.c index 4be5fe2c40a5..9f3a25ccd665 100644 --- a/drivers/net/can/cc770/cc770_isa.c +++ b/drivers/net/can/cc770/cc770_isa.c | |||
@@ -110,6 +110,11 @@ MODULE_PARM_DESC(bcr, "Bus configuration register (default=0x40 [CBY])"); | |||
110 | #define CC770_IOSIZE 0x20 | 110 | #define CC770_IOSIZE 0x20 |
111 | #define CC770_IOSIZE_INDIRECT 0x02 | 111 | #define CC770_IOSIZE_INDIRECT 0x02 |
112 | 112 | ||
113 | /* Spinlock for cc770_isa_port_write_reg_indirect | ||
114 | * and cc770_isa_port_read_reg_indirect | ||
115 | */ | ||
116 | static DEFINE_SPINLOCK(cc770_isa_port_lock); | ||
117 | |||
113 | static struct platform_device *cc770_isa_devs[MAXDEV]; | 118 | static struct platform_device *cc770_isa_devs[MAXDEV]; |
114 | 119 | ||
115 | static u8 cc770_isa_mem_read_reg(const struct cc770_priv *priv, int reg) | 120 | static u8 cc770_isa_mem_read_reg(const struct cc770_priv *priv, int reg) |
@@ -138,18 +143,27 @@ static u8 cc770_isa_port_read_reg_indirect(const struct cc770_priv *priv, | |||
138 | int reg) | 143 | int reg) |
139 | { | 144 | { |
140 | unsigned long base = (unsigned long)priv->reg_base; | 145 | unsigned long base = (unsigned long)priv->reg_base; |
146 | unsigned long flags; | ||
147 | u8 val; | ||
141 | 148 | ||
149 | spin_lock_irqsave(&cc770_isa_port_lock, flags); | ||
142 | outb(reg, base); | 150 | outb(reg, base); |
143 | return inb(base + 1); | 151 | val = inb(base + 1); |
152 | spin_unlock_irqrestore(&cc770_isa_port_lock, flags); | ||
153 | |||
154 | return val; | ||
144 | } | 155 | } |
145 | 156 | ||
146 | static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv, | 157 | static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv, |
147 | int reg, u8 val) | 158 | int reg, u8 val) |
148 | { | 159 | { |
149 | unsigned long base = (unsigned long)priv->reg_base; | 160 | unsigned long base = (unsigned long)priv->reg_base; |
161 | unsigned long flags; | ||
150 | 162 | ||
163 | spin_lock_irqsave(&cc770_isa_port_lock, flags); | ||
151 | outb(reg, base); | 164 | outb(reg, base); |
152 | outb(val, base + 1); | 165 | outb(val, base + 1); |
166 | spin_unlock_irqrestore(&cc770_isa_port_lock, flags); | ||
153 | } | 167 | } |
154 | 168 | ||
155 | static int __devinit cc770_isa_probe(struct platform_device *pdev) | 169 | static int __devinit cc770_isa_probe(struct platform_device *pdev) |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 7fd8089946fb..96d235799ec1 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -118,6 +118,9 @@ | |||
118 | (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | FLEXCAN_ESR_BOFF_INT) | 118 | (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | FLEXCAN_ESR_BOFF_INT) |
119 | #define FLEXCAN_ESR_ERR_ALL \ | 119 | #define FLEXCAN_ESR_ERR_ALL \ |
120 | (FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE) | 120 | (FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE) |
121 | #define FLEXCAN_ESR_ALL_INT \ | ||
122 | (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \ | ||
123 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) | ||
121 | 124 | ||
122 | /* FLEXCAN interrupt flag register (IFLAG) bits */ | 125 | /* FLEXCAN interrupt flag register (IFLAG) bits */ |
123 | #define FLEXCAN_TX_BUF_ID 8 | 126 | #define FLEXCAN_TX_BUF_ID 8 |
@@ -577,7 +580,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | |||
577 | 580 | ||
578 | reg_iflag1 = flexcan_read(®s->iflag1); | 581 | reg_iflag1 = flexcan_read(®s->iflag1); |
579 | reg_esr = flexcan_read(®s->esr); | 582 | reg_esr = flexcan_read(®s->esr); |
580 | flexcan_write(FLEXCAN_ESR_ERR_INT, ®s->esr); /* ACK err IRQ */ | 583 | /* ACK all bus error and state change IRQ sources */ |
584 | if (reg_esr & FLEXCAN_ESR_ALL_INT) | ||
585 | flexcan_write(reg_esr & FLEXCAN_ESR_ALL_INT, ®s->esr); | ||
581 | 586 | ||
582 | /* | 587 | /* |
583 | * schedule NAPI in case of: | 588 | * schedule NAPI in case of: |
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index d11fbb2b95ff..6edc25e0dd15 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #define PCH_IF_CREQ_BUSY BIT(15) | 66 | #define PCH_IF_CREQ_BUSY BIT(15) |
67 | 67 | ||
68 | #define PCH_STATUS_INT 0x8000 | 68 | #define PCH_STATUS_INT 0x8000 |
69 | #define PCH_RP 0x00008000 | ||
69 | #define PCH_REC 0x00007f00 | 70 | #define PCH_REC 0x00007f00 |
70 | #define PCH_TEC 0x000000ff | 71 | #define PCH_TEC 0x000000ff |
71 | 72 | ||
@@ -527,7 +528,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) | |||
527 | priv->can.can_stats.error_passive++; | 528 | priv->can.can_stats.error_passive++; |
528 | state = CAN_STATE_ERROR_PASSIVE; | 529 | state = CAN_STATE_ERROR_PASSIVE; |
529 | cf->can_id |= CAN_ERR_CRTL; | 530 | cf->can_id |= CAN_ERR_CRTL; |
530 | if (((errc & PCH_REC) >> 8) > 127) | 531 | if (errc & PCH_RP) |
531 | cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; | 532 | cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; |
532 | if ((errc & PCH_TEC) > 127) | 533 | if ((errc & PCH_TEC) > 127) |
533 | cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE; | 534 | cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE; |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 2c7f5036f570..214795945bc4 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -39,9 +39,9 @@ MODULE_LICENSE("GPL v2"); | |||
39 | #define DRV_NAME "peak_pci" | 39 | #define DRV_NAME "peak_pci" |
40 | 40 | ||
41 | struct peak_pci_chan { | 41 | struct peak_pci_chan { |
42 | void __iomem *cfg_base; /* Common for all channels */ | 42 | void __iomem *cfg_base; /* Common for all channels */ |
43 | struct net_device *next_dev; /* Chain of network devices */ | 43 | struct net_device *prev_dev; /* Chain of network devices */ |
44 | u16 icr_mask; /* Interrupt mask for fast ack */ | 44 | u16 icr_mask; /* Interrupt mask for fast ack */ |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #define PEAK_PCI_CAN_CLOCK (16000000 / 2) | 47 | #define PEAK_PCI_CAN_CLOCK (16000000 / 2) |
@@ -98,7 +98,7 @@ static int __devinit peak_pci_probe(struct pci_dev *pdev, | |||
98 | { | 98 | { |
99 | struct sja1000_priv *priv; | 99 | struct sja1000_priv *priv; |
100 | struct peak_pci_chan *chan; | 100 | struct peak_pci_chan *chan; |
101 | struct net_device *dev, *dev0 = NULL; | 101 | struct net_device *dev; |
102 | void __iomem *cfg_base, *reg_base; | 102 | void __iomem *cfg_base, *reg_base; |
103 | u16 sub_sys_id, icr; | 103 | u16 sub_sys_id, icr; |
104 | int i, err, channels; | 104 | int i, err, channels; |
@@ -196,18 +196,14 @@ static int __devinit peak_pci_probe(struct pci_dev *pdev, | |||
196 | } | 196 | } |
197 | 197 | ||
198 | /* Create chain of SJA1000 devices */ | 198 | /* Create chain of SJA1000 devices */ |
199 | if (i == 0) | 199 | chan->prev_dev = pci_get_drvdata(pdev); |
200 | dev0 = dev; | 200 | pci_set_drvdata(pdev, dev); |
201 | else | ||
202 | chan->next_dev = dev; | ||
203 | 201 | ||
204 | dev_info(&pdev->dev, | 202 | dev_info(&pdev->dev, |
205 | "%s at reg_base=0x%p cfg_base=0x%p irq=%d\n", | 203 | "%s at reg_base=0x%p cfg_base=0x%p irq=%d\n", |
206 | dev->name, priv->reg_base, chan->cfg_base, dev->irq); | 204 | dev->name, priv->reg_base, chan->cfg_base, dev->irq); |
207 | } | 205 | } |
208 | 206 | ||
209 | pci_set_drvdata(pdev, dev0); | ||
210 | |||
211 | /* Enable interrupts */ | 207 | /* Enable interrupts */ |
212 | writew(icr, cfg_base + PITA_ICR + 2); | 208 | writew(icr, cfg_base + PITA_ICR + 2); |
213 | 209 | ||
@@ -217,12 +213,11 @@ failure_remove_channels: | |||
217 | /* Disable interrupts */ | 213 | /* Disable interrupts */ |
218 | writew(0x0, cfg_base + PITA_ICR + 2); | 214 | writew(0x0, cfg_base + PITA_ICR + 2); |
219 | 215 | ||
220 | for (dev = dev0; dev; dev = chan->next_dev) { | 216 | for (dev = pci_get_drvdata(pdev); dev; dev = chan->prev_dev) { |
221 | unregister_sja1000dev(dev); | 217 | unregister_sja1000dev(dev); |
222 | free_sja1000dev(dev); | 218 | free_sja1000dev(dev); |
223 | priv = netdev_priv(dev); | 219 | priv = netdev_priv(dev); |
224 | chan = priv->priv; | 220 | chan = priv->priv; |
225 | dev = chan->next_dev; | ||
226 | } | 221 | } |
227 | 222 | ||
228 | pci_iounmap(pdev, reg_base); | 223 | pci_iounmap(pdev, reg_base); |
@@ -241,7 +236,7 @@ failure_disable_pci: | |||
241 | 236 | ||
242 | static void __devexit peak_pci_remove(struct pci_dev *pdev) | 237 | static void __devexit peak_pci_remove(struct pci_dev *pdev) |
243 | { | 238 | { |
244 | struct net_device *dev = pci_get_drvdata(pdev); /* First device */ | 239 | struct net_device *dev = pci_get_drvdata(pdev); /* Last device */ |
245 | struct sja1000_priv *priv = netdev_priv(dev); | 240 | struct sja1000_priv *priv = netdev_priv(dev); |
246 | struct peak_pci_chan *chan = priv->priv; | 241 | struct peak_pci_chan *chan = priv->priv; |
247 | void __iomem *cfg_base = chan->cfg_base; | 242 | void __iomem *cfg_base = chan->cfg_base; |
@@ -255,7 +250,7 @@ static void __devexit peak_pci_remove(struct pci_dev *pdev) | |||
255 | dev_info(&pdev->dev, "removing device %s\n", dev->name); | 250 | dev_info(&pdev->dev, "removing device %s\n", dev->name); |
256 | unregister_sja1000dev(dev); | 251 | unregister_sja1000dev(dev); |
257 | free_sja1000dev(dev); | 252 | free_sja1000dev(dev); |
258 | dev = chan->next_dev; | 253 | dev = chan->prev_dev; |
259 | if (!dev) | 254 | if (!dev) |
260 | break; | 255 | break; |
261 | priv = netdev_priv(dev); | 256 | priv = netdev_priv(dev); |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index df809e3f130e..5a2e1e3588a1 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
@@ -745,9 +745,10 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, | |||
745 | } | 745 | } |
746 | } | 746 | } |
747 | 747 | ||
748 | netif_receive_skb(skb); | 748 | netif_rx(skb); |
749 | stats->rx_packets++; | 749 | stats->rx_packets++; |
750 | stats->rx_bytes += cf->can_dlc; | 750 | stats->rx_bytes += cf->can_dlc; |
751 | |||
751 | return 0; | 752 | return 0; |
752 | } | 753 | } |
753 | 754 | ||
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 9697c14b8dc6..7dae64d44e83 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -627,9 +627,6 @@ static int ems_usb_start(struct ems_usb *dev) | |||
627 | 627 | ||
628 | err = usb_submit_urb(urb, GFP_KERNEL); | 628 | err = usb_submit_urb(urb, GFP_KERNEL); |
629 | if (err) { | 629 | if (err) { |
630 | if (err == -ENODEV) | ||
631 | netif_device_detach(dev->netdev); | ||
632 | |||
633 | usb_unanchor_urb(urb); | 630 | usb_unanchor_urb(urb); |
634 | usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, | 631 | usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, |
635 | urb->transfer_dma); | 632 | urb->transfer_dma); |
@@ -659,9 +656,6 @@ static int ems_usb_start(struct ems_usb *dev) | |||
659 | 656 | ||
660 | err = usb_submit_urb(dev->intr_urb, GFP_KERNEL); | 657 | err = usb_submit_urb(dev->intr_urb, GFP_KERNEL); |
661 | if (err) { | 658 | if (err) { |
662 | if (err == -ENODEV) | ||
663 | netif_device_detach(dev->netdev); | ||
664 | |||
665 | dev_warn(netdev->dev.parent, "intr URB submit failed: %d\n", | 659 | dev_warn(netdev->dev.parent, "intr URB submit failed: %d\n", |
666 | err); | 660 | err); |
667 | 661 | ||
@@ -692,9 +686,6 @@ static int ems_usb_start(struct ems_usb *dev) | |||
692 | return 0; | 686 | return 0; |
693 | 687 | ||
694 | failed: | 688 | failed: |
695 | if (err == -ENODEV) | ||
696 | netif_device_detach(dev->netdev); | ||
697 | |||
698 | dev_warn(netdev->dev.parent, "couldn't submit control: %d\n", err); | 689 | dev_warn(netdev->dev.parent, "couldn't submit control: %d\n", err); |
699 | 690 | ||
700 | return err; | 691 | return err; |