diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:36:56 -0400 |
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:36:56 -0400 |
| commit | cf9b59e9d3e008591d1f54830f570982bb307a0d (patch) | |
| tree | 113478ce8fd8c832ba726ffdf59b82cb46356476 /drivers/net/can | |
| parent | 44504b2bebf8b5823c59484e73096a7d6574471d (diff) | |
| parent | f4b87dee923342505e1ddba8d34ce9de33e75050 (diff) | |
Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and
build failures in vio.c after merge.
Conflicts:
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-mpc.c
drivers/net/gianfar.c
Also fixed up one line in arch/powerpc/kernel/vio.c to use the
correct node pointer.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/net/can')
| -rw-r--r-- | drivers/net/can/at91_can.c | 4 | ||||
| -rw-r--r-- | drivers/net/can/bfin_can.c | 3 | ||||
| -rw-r--r-- | drivers/net/can/mcp251x.c | 16 | ||||
| -rw-r--r-- | drivers/net/can/mscan/mpc5xxx_can.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/mscan/mscan.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/Kconfig | 4 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/ems_pci.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/kvaser_pci.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/plx_pci.c | 154 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/sja1000.c | 23 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/sja1000.h | 1 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/sja1000_isa.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/sja1000_of_platform.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/sja1000/sja1000_platform.c | 48 | ||||
| -rw-r--r-- | drivers/net/can/ti_hecc.c | 1 | ||||
| -rw-r--r-- | drivers/net/can/usb/ems_usb.c | 30 |
16 files changed, 231 insertions, 59 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index a2f29a38798a..2d8bd86bc5e2 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include <linux/string.h> | 35 | #include <linux/string.h> |
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | 37 | ||
| 38 | #include <linux/can.h> | ||
| 39 | #include <linux/can/dev.h> | 38 | #include <linux/can/dev.h> |
| 40 | #include <linux/can/error.h> | 39 | #include <linux/can/error.h> |
| 41 | 40 | ||
| @@ -376,7 +375,6 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 376 | at91_write(priv, AT91_MCR(mb), reg_mcr); | 375 | at91_write(priv, AT91_MCR(mb), reg_mcr); |
| 377 | 376 | ||
| 378 | stats->tx_bytes += cf->can_dlc; | 377 | stats->tx_bytes += cf->can_dlc; |
| 379 | dev->trans_start = jiffies; | ||
| 380 | 378 | ||
| 381 | /* _NOTE_: substract AT91_MB_TX_FIRST offset from mb! */ | 379 | /* _NOTE_: substract AT91_MB_TX_FIRST offset from mb! */ |
| 382 | can_put_echo_skb(skb, dev, mb - AT91_MB_TX_FIRST); | 380 | can_put_echo_skb(skb, dev, mb - AT91_MB_TX_FIRST); |
| @@ -662,7 +660,6 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr) | |||
| 662 | at91_poll_err_frame(dev, cf, reg_sr); | 660 | at91_poll_err_frame(dev, cf, reg_sr); |
| 663 | netif_receive_skb(skb); | 661 | netif_receive_skb(skb); |
| 664 | 662 | ||
| 665 | dev->last_rx = jiffies; | ||
| 666 | dev->stats.rx_packets++; | 663 | dev->stats.rx_packets++; |
| 667 | dev->stats.rx_bytes += cf->can_dlc; | 664 | dev->stats.rx_bytes += cf->can_dlc; |
| 668 | 665 | ||
| @@ -899,7 +896,6 @@ static void at91_irq_err(struct net_device *dev) | |||
| 899 | at91_irq_err_state(dev, cf, new_state); | 896 | at91_irq_err_state(dev, cf, new_state); |
| 900 | netif_rx(skb); | 897 | netif_rx(skb); |
| 901 | 898 | ||
| 902 | dev->last_rx = jiffies; | ||
| 903 | dev->stats.rx_packets++; | 899 | dev->stats.rx_packets++; |
| 904 | dev->stats.rx_bytes += cf->can_dlc; | 900 | dev->stats.rx_bytes += cf->can_dlc; |
| 905 | 901 | ||
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c index 03489864376d..b6e890d28366 100644 --- a/drivers/net/can/bfin_can.c +++ b/drivers/net/can/bfin_can.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
| 19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 20 | 20 | ||
| 21 | #include <linux/can.h> | ||
| 22 | #include <linux/can/dev.h> | 21 | #include <linux/can/dev.h> |
| 23 | #include <linux/can/error.h> | 22 | #include <linux/can/error.h> |
| 24 | 23 | ||
| @@ -270,8 +269,6 @@ static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 270 | /* fill data length code */ | 269 | /* fill data length code */ |
| 271 | bfin_write16(®->chl[TRANSMIT_CHL].dlc, dlc); | 270 | bfin_write16(®->chl[TRANSMIT_CHL].dlc, dlc); |
| 272 | 271 | ||
| 273 | dev->trans_start = jiffies; | ||
| 274 | |||
| 275 | can_put_echo_skb(skb, dev, 0); | 272 | can_put_echo_skb(skb, dev, 0); |
| 276 | 273 | ||
| 277 | /* set transmit request */ | 274 | /* set transmit request */ |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index b39b108318b4..b11a0cb5ed81 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | * | 58 | * |
| 59 | */ | 59 | */ |
| 60 | 60 | ||
| 61 | #include <linux/can.h> | ||
| 62 | #include <linux/can/core.h> | 61 | #include <linux/can/core.h> |
| 63 | #include <linux/can/dev.h> | 62 | #include <linux/can/dev.h> |
| 64 | #include <linux/can/platform/mcp251x.h> | 63 | #include <linux/can/platform/mcp251x.h> |
| @@ -476,7 +475,6 @@ static netdev_tx_t mcp251x_hard_start_xmit(struct sk_buff *skb, | |||
| 476 | 475 | ||
| 477 | netif_stop_queue(net); | 476 | netif_stop_queue(net); |
| 478 | priv->tx_skb = skb; | 477 | priv->tx_skb = skb; |
| 479 | net->trans_start = jiffies; | ||
| 480 | queue_work(priv->wq, &priv->tx_work); | 478 | queue_work(priv->wq, &priv->tx_work); |
| 481 | 479 | ||
| 482 | return NETDEV_TX_OK; | 480 | return NETDEV_TX_OK; |
| @@ -923,12 +921,16 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi) | |||
| 923 | struct net_device *net; | 921 | struct net_device *net; |
| 924 | struct mcp251x_priv *priv; | 922 | struct mcp251x_priv *priv; |
| 925 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; | 923 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; |
| 924 | int model = spi_get_device_id(spi)->driver_data; | ||
| 926 | int ret = -ENODEV; | 925 | int ret = -ENODEV; |
| 927 | 926 | ||
| 928 | if (!pdata) | 927 | if (!pdata) |
| 929 | /* Platform data is required for osc freq */ | 928 | /* Platform data is required for osc freq */ |
| 930 | goto error_out; | 929 | goto error_out; |
| 931 | 930 | ||
| 931 | if (model) | ||
| 932 | pdata->model = model; | ||
| 933 | |||
| 932 | /* Allocate can/net device */ | 934 | /* Allocate can/net device */ |
| 933 | net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX); | 935 | net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX); |
| 934 | if (!net) { | 936 | if (!net) { |
| @@ -1118,6 +1120,15 @@ static int mcp251x_can_resume(struct spi_device *spi) | |||
| 1118 | #define mcp251x_can_resume NULL | 1120 | #define mcp251x_can_resume NULL |
| 1119 | #endif | 1121 | #endif |
| 1120 | 1122 | ||
| 1123 | static struct spi_device_id mcp251x_id_table[] = { | ||
| 1124 | { "mcp251x", 0 /* Use pdata.model */ }, | ||
| 1125 | { "mcp2510", CAN_MCP251X_MCP2510 }, | ||
| 1126 | { "mcp2515", CAN_MCP251X_MCP2515 }, | ||
| 1127 | { }, | ||
| 1128 | }; | ||
| 1129 | |||
| 1130 | MODULE_DEVICE_TABLE(spi, mcp251x_id_table); | ||
| 1131 | |||
| 1121 | static struct spi_driver mcp251x_can_driver = { | 1132 | static struct spi_driver mcp251x_can_driver = { |
| 1122 | .driver = { | 1133 | .driver = { |
| 1123 | .name = DEVICE_NAME, | 1134 | .name = DEVICE_NAME, |
| @@ -1125,6 +1136,7 @@ static struct spi_driver mcp251x_can_driver = { | |||
| 1125 | .owner = THIS_MODULE, | 1136 | .owner = THIS_MODULE, |
| 1126 | }, | 1137 | }, |
| 1127 | 1138 | ||
| 1139 | .id_table = mcp251x_id_table, | ||
| 1128 | .probe = mcp251x_can_probe, | 1140 | .probe = mcp251x_can_probe, |
| 1129 | .remove = __devexit_p(mcp251x_can_remove), | 1141 | .remove = __devexit_p(mcp251x_can_remove), |
| 1130 | .suspend = mcp251x_can_suspend, | 1142 | .suspend = mcp251x_can_suspend, |
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 2120784f8db4..8af8442c694a 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/netdevice.h> | 27 | #include <linux/netdevice.h> |
| 28 | #include <linux/can.h> | ||
| 29 | #include <linux/can/dev.h> | 28 | #include <linux/can/dev.h> |
| 30 | #include <linux/of_platform.h> | 29 | #include <linux/of_platform.h> |
| 31 | #include <sysdev/fsl_soc.h> | 30 | #include <sysdev/fsl_soc.h> |
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index 6b7dd578d417..64c378cd0c34 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | #include <linux/if_arp.h> | 28 | #include <linux/if_arp.h> |
| 29 | #include <linux/if_ether.h> | 29 | #include <linux/if_ether.h> |
| 30 | #include <linux/list.h> | 30 | #include <linux/list.h> |
| 31 | #include <linux/can.h> | ||
| 32 | #include <linux/can/dev.h> | 31 | #include <linux/can/dev.h> |
| 33 | #include <linux/can/error.h> | 32 | #include <linux/can/error.h> |
| 34 | #include <linux/io.h> | 33 | #include <linux/io.h> |
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig index 9e277d64a318..ae3505afd682 100644 --- a/drivers/net/can/sja1000/Kconfig +++ b/drivers/net/can/sja1000/Kconfig | |||
| @@ -53,7 +53,9 @@ config CAN_PLX_PCI | |||
| 53 | Driver supports now: | 53 | Driver supports now: |
| 54 | - Adlink PCI-7841/cPCI-7841 card (http://www.adlinktech.com/) | 54 | - Adlink PCI-7841/cPCI-7841 card (http://www.adlinktech.com/) |
| 55 | - Adlink PCI-7841/cPCI-7841 SE card | 55 | - Adlink PCI-7841/cPCI-7841 SE card |
| 56 | - esd CAN-PCI/CPCI/PCI104/200 (http://www.esd.eu/) | ||
| 57 | - esd CAN-PCI/PMC/266 | ||
| 58 | - esd CAN-PCIe/2000 | ||
| 56 | - Marathon CAN-bus-PCI card (http://www.marathon.ru/) | 59 | - Marathon CAN-bus-PCI card (http://www.marathon.ru/) |
| 57 | - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/) | 60 | - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/) |
| 58 | |||
| 59 | endif | 61 | endif |
diff --git a/drivers/net/can/sja1000/ems_pci.c b/drivers/net/can/sja1000/ems_pci.c index 5f53da0bc40c..36f4f9780c30 100644 --- a/drivers/net/can/sja1000/ems_pci.c +++ b/drivers/net/can/sja1000/ems_pci.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
| 27 | #include <linux/can.h> | ||
| 28 | #include <linux/can/dev.h> | 27 | #include <linux/can/dev.h> |
| 29 | #include <linux/io.h> | 28 | #include <linux/io.h> |
| 30 | 29 | ||
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c index 441e776a7f59..ed004cebd31f 100644 --- a/drivers/net/can/sja1000/kvaser_pci.c +++ b/drivers/net/can/sja1000/kvaser_pci.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | #include <linux/netdevice.h> | 36 | #include <linux/netdevice.h> |
| 37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
| 38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
| 39 | #include <linux/can.h> | ||
| 40 | #include <linux/can/dev.h> | 39 | #include <linux/can/dev.h> |
| 41 | #include <linux/io.h> | 40 | #include <linux/io.h> |
| 42 | 41 | ||
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c index 4aff4070db96..437b5c716a24 100644 --- a/drivers/net/can/sja1000/plx_pci.c +++ b/drivers/net/can/sja1000/plx_pci.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
| 30 | #include <linux/can.h> | ||
| 31 | #include <linux/can/dev.h> | 30 | #include <linux/can/dev.h> |
| 32 | #include <linux/io.h> | 31 | #include <linux/io.h> |
| 33 | 32 | ||
| @@ -41,7 +40,10 @@ MODULE_DESCRIPTION("Socket-CAN driver for PLX90xx PCI-bridge cards with " | |||
| 41 | MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, " | 40 | MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, " |
| 42 | "Adlink PCI-7841/cPCI-7841 SE, " | 41 | "Adlink PCI-7841/cPCI-7841 SE, " |
| 43 | "Marathon CAN-bus-PCI, " | 42 | "Marathon CAN-bus-PCI, " |
| 44 | "TEWS TECHNOLOGIES TPMC810"); | 43 | "TEWS TECHNOLOGIES TPMC810, " |
| 44 | "esd CAN-PCI/CPCI/PCI104/200, " | ||
| 45 | "esd CAN-PCI/PMC/266, " | ||
| 46 | "esd CAN-PCIe/2000") | ||
| 45 | MODULE_LICENSE("GPL v2"); | 47 | MODULE_LICENSE("GPL v2"); |
| 46 | 48 | ||
| 47 | #define PLX_PCI_MAX_CHAN 2 | 49 | #define PLX_PCI_MAX_CHAN 2 |
| @@ -50,11 +52,14 @@ struct plx_pci_card { | |||
| 50 | int channels; /* detected channels count */ | 52 | int channels; /* detected channels count */ |
| 51 | struct net_device *net_dev[PLX_PCI_MAX_CHAN]; | 53 | struct net_device *net_dev[PLX_PCI_MAX_CHAN]; |
| 52 | void __iomem *conf_addr; | 54 | void __iomem *conf_addr; |
| 55 | |||
| 56 | /* Pointer to device-dependent reset function */ | ||
| 57 | void (*reset_func)(struct pci_dev *pdev); | ||
| 53 | }; | 58 | }; |
| 54 | 59 | ||
| 55 | #define PLX_PCI_CAN_CLOCK (16000000 / 2) | 60 | #define PLX_PCI_CAN_CLOCK (16000000 / 2) |
| 56 | 61 | ||
| 57 | /* PLX90xx registers */ | 62 | /* PLX9030/9050/9052 registers */ |
| 58 | #define PLX_INTCSR 0x4c /* Interrupt Control/Status */ | 63 | #define PLX_INTCSR 0x4c /* Interrupt Control/Status */ |
| 59 | #define PLX_CNTRL 0x50 /* User I/O, Direct Slave Response, | 64 | #define PLX_CNTRL 0x50 /* User I/O, Direct Slave Response, |
| 60 | * Serial EEPROM, and Initialization | 65 | * Serial EEPROM, and Initialization |
| @@ -66,6 +71,14 @@ struct plx_pci_card { | |||
| 66 | #define PLX_PCI_INT_EN (1 << 6) /* PCI Interrupt Enable */ | 71 | #define PLX_PCI_INT_EN (1 << 6) /* PCI Interrupt Enable */ |
| 67 | #define PLX_PCI_RESET (1 << 30) /* PCI Adapter Software Reset */ | 72 | #define PLX_PCI_RESET (1 << 30) /* PCI Adapter Software Reset */ |
| 68 | 73 | ||
| 74 | /* PLX9056 registers */ | ||
| 75 | #define PLX9056_INTCSR 0x68 /* Interrupt Control/Status */ | ||
| 76 | #define PLX9056_CNTRL 0x6c /* Control / Software Reset */ | ||
| 77 | |||
| 78 | #define PLX9056_LINTI (1 << 11) | ||
| 79 | #define PLX9056_PCI_INT_EN (1 << 8) | ||
| 80 | #define PLX9056_PCI_RCR (1 << 29) /* Read Configuration Registers */ | ||
| 81 | |||
| 69 | /* | 82 | /* |
| 70 | * The board configuration is probably following: | 83 | * The board configuration is probably following: |
| 71 | * RX1 is connected to ground. | 84 | * RX1 is connected to ground. |
| @@ -101,6 +114,13 @@ struct plx_pci_card { | |||
| 101 | #define ADLINK_PCI_VENDOR_ID 0x144A | 114 | #define ADLINK_PCI_VENDOR_ID 0x144A |
| 102 | #define ADLINK_PCI_DEVICE_ID 0x7841 | 115 | #define ADLINK_PCI_DEVICE_ID 0x7841 |
| 103 | 116 | ||
| 117 | #define ESD_PCI_SUB_SYS_ID_PCI200 0x0004 | ||
| 118 | #define ESD_PCI_SUB_SYS_ID_PCI266 0x0009 | ||
| 119 | #define ESD_PCI_SUB_SYS_ID_PMC266 0x000e | ||
| 120 | #define ESD_PCI_SUB_SYS_ID_CPCI200 0x010b | ||
| 121 | #define ESD_PCI_SUB_SYS_ID_PCIE2000 0x0200 | ||
| 122 | #define ESD_PCI_SUB_SYS_ID_PCI104200 0x0501 | ||
| 123 | |||
| 104 | #define MARATHON_PCI_DEVICE_ID 0x2715 | 124 | #define MARATHON_PCI_DEVICE_ID 0x2715 |
| 105 | 125 | ||
| 106 | #define TEWS_PCI_VENDOR_ID 0x1498 | 126 | #define TEWS_PCI_VENDOR_ID 0x1498 |
| @@ -108,6 +128,7 @@ struct plx_pci_card { | |||
| 108 | 128 | ||
| 109 | static void plx_pci_reset_common(struct pci_dev *pdev); | 129 | static void plx_pci_reset_common(struct pci_dev *pdev); |
| 110 | static void plx_pci_reset_marathon(struct pci_dev *pdev); | 130 | static void plx_pci_reset_marathon(struct pci_dev *pdev); |
| 131 | static void plx9056_pci_reset_common(struct pci_dev *pdev); | ||
| 111 | 132 | ||
| 112 | struct plx_pci_channel_map { | 133 | struct plx_pci_channel_map { |
| 113 | u32 bar; | 134 | u32 bar; |
| @@ -148,6 +169,30 @@ static struct plx_pci_card_info plx_pci_card_info_adlink_se __devinitdata = { | |||
| 148 | /* based on PLX9052 */ | 169 | /* based on PLX9052 */ |
| 149 | }; | 170 | }; |
| 150 | 171 | ||
| 172 | static struct plx_pci_card_info plx_pci_card_info_esd200 __devinitdata = { | ||
| 173 | "esd CAN-PCI/CPCI/PCI104/200", 2, | ||
| 174 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, | ||
| 175 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x100, 0x80} }, | ||
| 176 | &plx_pci_reset_common | ||
| 177 | /* based on PLX9030/9050 */ | ||
| 178 | }; | ||
| 179 | |||
| 180 | static struct plx_pci_card_info plx_pci_card_info_esd266 __devinitdata = { | ||
| 181 | "esd CAN-PCI/PMC/266", 2, | ||
| 182 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, | ||
| 183 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x100, 0x80} }, | ||
| 184 | &plx9056_pci_reset_common | ||
| 185 | /* based on PLX9056 */ | ||
| 186 | }; | ||
| 187 | |||
| 188 | static struct plx_pci_card_info plx_pci_card_info_esd2000 __devinitdata = { | ||
| 189 | "esd CAN-PCIe/2000", 2, | ||
| 190 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, | ||
| 191 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x100, 0x80} }, | ||
| 192 | &plx9056_pci_reset_common | ||
| 193 | /* based on PEX8311 */ | ||
| 194 | }; | ||
| 195 | |||
| 151 | static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = { | 196 | static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = { |
| 152 | "Marathon CAN-bus-PCI", 2, | 197 | "Marathon CAN-bus-PCI", 2, |
| 153 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, | 198 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| @@ -180,6 +225,48 @@ static DEFINE_PCI_DEVICE_TABLE(plx_pci_tbl) = { | |||
| 180 | (kernel_ulong_t)&plx_pci_card_info_adlink_se | 225 | (kernel_ulong_t)&plx_pci_card_info_adlink_se |
| 181 | }, | 226 | }, |
| 182 | { | 227 | { |
| 228 | /* esd CAN-PCI/200 */ | ||
| 229 | PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | ||
| 230 | PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI200, | ||
| 231 | 0, 0, | ||
| 232 | (kernel_ulong_t)&plx_pci_card_info_esd200 | ||
| 233 | }, | ||
| 234 | { | ||
| 235 | /* esd CAN-CPCI/200 */ | ||
| 236 | PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030, | ||
| 237 | PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_CPCI200, | ||
| 238 | 0, 0, | ||
| 239 | (kernel_ulong_t)&plx_pci_card_info_esd200 | ||
| 240 | }, | ||
| 241 | { | ||
| 242 | /* esd CAN-PCI104/200 */ | ||
| 243 | PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030, | ||
| 244 | PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI104200, | ||
| 245 | 0, 0, | ||
| 246 | (kernel_ulong_t)&plx_pci_card_info_esd200 | ||
| 247 | }, | ||
| 248 | { | ||
| 249 | /* esd CAN-PCI/266 */ | ||
| 250 | PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056, | ||
| 251 | PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI266, | ||
| 252 | 0, 0, | ||
| 253 | (kernel_ulong_t)&plx_pci_card_info_esd266 | ||
| 254 | }, | ||
| 255 | { | ||
| 256 | /* esd CAN-PMC/266 */ | ||
| 257 | PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056, | ||
| 258 | PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PMC266, | ||
| 259 | 0, 0, | ||
| 260 | (kernel_ulong_t)&plx_pci_card_info_esd266 | ||
| 261 | }, | ||
| 262 | { | ||
| 263 | /* esd CAN-PCIE/2000 */ | ||
| 264 | PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056, | ||
| 265 | PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCIE2000, | ||
| 266 | 0, 0, | ||
| 267 | (kernel_ulong_t)&plx_pci_card_info_esd2000 | ||
| 268 | }, | ||
| 269 | { | ||
| 183 | /* Marathon CAN-bus-PCI card */ | 270 | /* Marathon CAN-bus-PCI card */ |
| 184 | PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID, | 271 | PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID, |
| 185 | PCI_ANY_ID, PCI_ANY_ID, | 272 | PCI_ANY_ID, PCI_ANY_ID, |
| @@ -242,7 +329,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
| 242 | } | 329 | } |
| 243 | 330 | ||
| 244 | /* | 331 | /* |
| 245 | * PLX90xx software reset | 332 | * PLX9030/50/52 software reset |
| 246 | * Also LRESET# asserts and brings to reset device on the Local Bus (if wired). | 333 | * Also LRESET# asserts and brings to reset device on the Local Bus (if wired). |
| 247 | * For most cards it's enough for reset the SJA1000 chips. | 334 | * For most cards it's enough for reset the SJA1000 chips. |
| 248 | */ | 335 | */ |
| @@ -259,6 +346,38 @@ static void plx_pci_reset_common(struct pci_dev *pdev) | |||
| 259 | iowrite32(cntrl, card->conf_addr + PLX_CNTRL); | 346 | iowrite32(cntrl, card->conf_addr + PLX_CNTRL); |
| 260 | }; | 347 | }; |
| 261 | 348 | ||
| 349 | /* | ||
| 350 | * PLX9056 software reset | ||
| 351 | * Assert LRESET# and reset device(s) on the Local Bus (if wired). | ||
| 352 | */ | ||
| 353 | static void plx9056_pci_reset_common(struct pci_dev *pdev) | ||
| 354 | { | ||
| 355 | struct plx_pci_card *card = pci_get_drvdata(pdev); | ||
| 356 | u32 cntrl; | ||
| 357 | |||
| 358 | /* issue a local bus reset */ | ||
| 359 | cntrl = ioread32(card->conf_addr + PLX9056_CNTRL); | ||
| 360 | cntrl |= PLX_PCI_RESET; | ||
| 361 | iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL); | ||
| 362 | udelay(100); | ||
| 363 | cntrl ^= PLX_PCI_RESET; | ||
| 364 | iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL); | ||
| 365 | |||
| 366 | /* reload local configuration from EEPROM */ | ||
| 367 | cntrl |= PLX9056_PCI_RCR; | ||
| 368 | iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL); | ||
| 369 | |||
| 370 | /* | ||
| 371 | * There is no safe way to poll for the end | ||
| 372 | * of reconfiguration process. Waiting for 10ms | ||
| 373 | * is safe. | ||
| 374 | */ | ||
| 375 | mdelay(10); | ||
| 376 | |||
| 377 | cntrl ^= PLX9056_PCI_RCR; | ||
| 378 | iowrite32(cntrl, card->conf_addr + PLX9056_CNTRL); | ||
| 379 | }; | ||
| 380 | |||
| 262 | /* Special reset function for Marathon card */ | 381 | /* Special reset function for Marathon card */ |
| 263 | static void plx_pci_reset_marathon(struct pci_dev *pdev) | 382 | static void plx_pci_reset_marathon(struct pci_dev *pdev) |
| 264 | { | 383 | { |
| @@ -302,13 +421,16 @@ static void plx_pci_del_card(struct pci_dev *pdev) | |||
| 302 | free_sja1000dev(dev); | 421 | free_sja1000dev(dev); |
| 303 | } | 422 | } |
| 304 | 423 | ||
| 305 | plx_pci_reset_common(pdev); | 424 | card->reset_func(pdev); |
| 306 | 425 | ||
| 307 | /* | 426 | /* |
| 308 | * Disable interrupts from PCI-card (PLX90xx) and disable Local_1, | 427 | * Disable interrupts from PCI-card and disable local |
| 309 | * Local_2 interrupts | 428 | * interrupts |
| 310 | */ | 429 | */ |
| 311 | iowrite32(0x0, card->conf_addr + PLX_INTCSR); | 430 | if (pdev->device != PCI_DEVICE_ID_PLX_9056) |
| 431 | iowrite32(0x0, card->conf_addr + PLX_INTCSR); | ||
| 432 | else | ||
| 433 | iowrite32(0x0, card->conf_addr + PLX9056_INTCSR); | ||
| 312 | 434 | ||
| 313 | if (card->conf_addr) | 435 | if (card->conf_addr) |
| 314 | pci_iounmap(pdev, card->conf_addr); | 436 | pci_iounmap(pdev, card->conf_addr); |
| @@ -367,6 +489,7 @@ static int __devinit plx_pci_add_card(struct pci_dev *pdev, | |||
| 367 | card->conf_addr = addr + ci->conf_map.offset; | 489 | card->conf_addr = addr + ci->conf_map.offset; |
| 368 | 490 | ||
| 369 | ci->reset_func(pdev); | 491 | ci->reset_func(pdev); |
| 492 | card->reset_func = ci->reset_func; | ||
| 370 | 493 | ||
| 371 | /* Detect available channels */ | 494 | /* Detect available channels */ |
| 372 | for (i = 0; i < ci->channel_count; i++) { | 495 | for (i = 0; i < ci->channel_count; i++) { |
| @@ -438,10 +561,17 @@ static int __devinit plx_pci_add_card(struct pci_dev *pdev, | |||
| 438 | * Enable interrupts from PCI-card (PLX90xx) and enable Local_1, | 561 | * Enable interrupts from PCI-card (PLX90xx) and enable Local_1, |
| 439 | * Local_2 interrupts from the SJA1000 chips | 562 | * Local_2 interrupts from the SJA1000 chips |
| 440 | */ | 563 | */ |
| 441 | val = ioread32(card->conf_addr + PLX_INTCSR); | 564 | if (pdev->device != PCI_DEVICE_ID_PLX_9056) { |
| 442 | val |= PLX_LINT1_EN | PLX_LINT2_EN | PLX_PCI_INT_EN; | 565 | val = ioread32(card->conf_addr + PLX_INTCSR); |
| 443 | iowrite32(val, card->conf_addr + PLX_INTCSR); | 566 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_ESDGMBH) |
| 444 | 567 | val |= PLX_LINT1_EN | PLX_PCI_INT_EN; | |
| 568 | else | ||
| 569 | val |= PLX_LINT1_EN | PLX_LINT2_EN | PLX_PCI_INT_EN; | ||
| 570 | iowrite32(val, card->conf_addr + PLX_INTCSR); | ||
| 571 | } else { | ||
| 572 | iowrite32(PLX9056_LINTI | PLX9056_PCI_INT_EN, | ||
| 573 | card->conf_addr + PLX9056_INTCSR); | ||
| 574 | } | ||
| 445 | return 0; | 575 | return 0; |
| 446 | 576 | ||
| 447 | failure_cleanup: | 577 | failure_cleanup: |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 145b1a731a53..85f7cbfe8e5f 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
| @@ -60,7 +60,6 @@ | |||
| 60 | #include <linux/skbuff.h> | 60 | #include <linux/skbuff.h> |
| 61 | #include <linux/delay.h> | 61 | #include <linux/delay.h> |
| 62 | 62 | ||
| 63 | #include <linux/can.h> | ||
| 64 | #include <linux/can/dev.h> | 63 | #include <linux/can/dev.h> |
| 65 | #include <linux/can/error.h> | 64 | #include <linux/can/error.h> |
| 66 | 65 | ||
| @@ -84,6 +83,20 @@ static struct can_bittiming_const sja1000_bittiming_const = { | |||
| 84 | .brp_inc = 1, | 83 | .brp_inc = 1, |
| 85 | }; | 84 | }; |
| 86 | 85 | ||
| 86 | static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val) | ||
| 87 | { | ||
| 88 | unsigned long flags; | ||
| 89 | |||
| 90 | /* | ||
| 91 | * The command register needs some locking and time to settle | ||
| 92 | * the write_reg() operation - especially on SMP systems. | ||
| 93 | */ | ||
| 94 | spin_lock_irqsave(&priv->cmdreg_lock, flags); | ||
| 95 | priv->write_reg(priv, REG_CMR, val); | ||
| 96 | priv->read_reg(priv, REG_SR); | ||
| 97 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); | ||
| 98 | } | ||
| 99 | |||
| 87 | static int sja1000_probe_chip(struct net_device *dev) | 100 | static int sja1000_probe_chip(struct net_device *dev) |
| 88 | { | 101 | { |
| 89 | struct sja1000_priv *priv = netdev_priv(dev); | 102 | struct sja1000_priv *priv = netdev_priv(dev); |
| @@ -293,11 +306,9 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, | |||
| 293 | for (i = 0; i < dlc; i++) | 306 | for (i = 0; i < dlc; i++) |
| 294 | priv->write_reg(priv, dreg++, cf->data[i]); | 307 | priv->write_reg(priv, dreg++, cf->data[i]); |
| 295 | 308 | ||
| 296 | dev->trans_start = jiffies; | ||
| 297 | |||
| 298 | can_put_echo_skb(skb, dev, 0); | 309 | can_put_echo_skb(skb, dev, 0); |
| 299 | 310 | ||
| 300 | priv->write_reg(priv, REG_CMR, CMD_TR); | 311 | sja1000_write_cmdreg(priv, CMD_TR); |
| 301 | 312 | ||
| 302 | return NETDEV_TX_OK; | 313 | return NETDEV_TX_OK; |
| 303 | } | 314 | } |
| @@ -346,7 +357,7 @@ static void sja1000_rx(struct net_device *dev) | |||
| 346 | cf->can_id = id; | 357 | cf->can_id = id; |
| 347 | 358 | ||
| 348 | /* release receive buffer */ | 359 | /* release receive buffer */ |
| 349 | priv->write_reg(priv, REG_CMR, CMD_RRB); | 360 | sja1000_write_cmdreg(priv, CMD_RRB); |
| 350 | 361 | ||
| 351 | netif_rx(skb); | 362 | netif_rx(skb); |
| 352 | 363 | ||
| @@ -374,7 +385,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) | |||
| 374 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | 385 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; |
| 375 | stats->rx_over_errors++; | 386 | stats->rx_over_errors++; |
| 376 | stats->rx_errors++; | 387 | stats->rx_errors++; |
| 377 | priv->write_reg(priv, REG_CMR, CMD_CDO); /* clear bit */ | 388 | sja1000_write_cmdreg(priv, CMD_CDO); /* clear bit */ |
| 378 | } | 389 | } |
| 379 | 390 | ||
| 380 | if (isrc & IRQ_EI) { | 391 | if (isrc & IRQ_EI) { |
diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h index 97a622b9302f..de8e778f6832 100644 --- a/drivers/net/can/sja1000/sja1000.h +++ b/drivers/net/can/sja1000/sja1000.h | |||
| @@ -167,6 +167,7 @@ struct sja1000_priv { | |||
| 167 | 167 | ||
| 168 | void __iomem *reg_base; /* ioremap'ed address to registers */ | 168 | void __iomem *reg_base; /* ioremap'ed address to registers */ |
| 169 | unsigned long irq_flags; /* for request_irq() */ | 169 | unsigned long irq_flags; /* for request_irq() */ |
| 170 | spinlock_t cmdreg_lock; /* lock for concurrent cmd register writes */ | ||
| 170 | 171 | ||
| 171 | u16 flags; /* custom mode flags */ | 172 | u16 flags; /* custom mode flags */ |
| 172 | u8 ocr; /* output control register */ | 173 | u8 ocr; /* output control register */ |
diff --git a/drivers/net/can/sja1000/sja1000_isa.c b/drivers/net/can/sja1000/sja1000_isa.c index a6a51f155962..496223e9e2fc 100644 --- a/drivers/net/can/sja1000/sja1000_isa.c +++ b/drivers/net/can/sja1000/sja1000_isa.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
| 26 | #include <linux/can.h> | ||
| 27 | #include <linux/can/dev.h> | 26 | #include <linux/can/dev.h> |
| 28 | #include <linux/can/platform/sja1000.h> | 27 | #include <linux/can/platform/sja1000.h> |
| 29 | 28 | ||
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c index 158b76ebf3ea..ac1a83d7c204 100644 --- a/drivers/net/can/sja1000/sja1000_of_platform.c +++ b/drivers/net/can/sja1000/sja1000_of_platform.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
| 39 | #include <linux/netdevice.h> | 39 | #include <linux/netdevice.h> |
| 40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
| 41 | #include <linux/can.h> | ||
| 42 | #include <linux/can/dev.h> | 41 | #include <linux/can/dev.h> |
| 43 | 42 | ||
| 44 | #include <linux/of_platform.h> | 43 | #include <linux/of_platform.h> |
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c index 628374c2a05f..d9fadc489b32 100644 --- a/drivers/net/can/sja1000/sja1000_platform.c +++ b/drivers/net/can/sja1000/sja1000_platform.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
| 25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
| 27 | #include <linux/can.h> | ||
| 28 | #include <linux/can/dev.h> | 27 | #include <linux/can/dev.h> |
| 29 | #include <linux/can/platform/sja1000.h> | 28 | #include <linux/can/platform/sja1000.h> |
| 30 | #include <linux/io.h> | 29 | #include <linux/io.h> |
| @@ -37,16 +36,36 @@ MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); | |||
| 37 | MODULE_DESCRIPTION("Socket-CAN driver for SJA1000 on the platform bus"); | 36 | MODULE_DESCRIPTION("Socket-CAN driver for SJA1000 on the platform bus"); |
| 38 | MODULE_LICENSE("GPL v2"); | 37 | MODULE_LICENSE("GPL v2"); |
| 39 | 38 | ||
| 40 | static u8 sp_read_reg(const struct sja1000_priv *priv, int reg) | 39 | static u8 sp_read_reg8(const struct sja1000_priv *priv, int reg) |
| 41 | { | 40 | { |
| 42 | return ioread8(priv->reg_base + reg); | 41 | return ioread8(priv->reg_base + reg); |
| 43 | } | 42 | } |
| 44 | 43 | ||
| 45 | static void sp_write_reg(const struct sja1000_priv *priv, int reg, u8 val) | 44 | static void sp_write_reg8(const struct sja1000_priv *priv, int reg, u8 val) |
| 46 | { | 45 | { |
| 47 | iowrite8(val, priv->reg_base + reg); | 46 | iowrite8(val, priv->reg_base + reg); |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 49 | static u8 sp_read_reg16(const struct sja1000_priv *priv, int reg) | ||
| 50 | { | ||
| 51 | return ioread8(priv->reg_base + reg * 2); | ||
| 52 | } | ||
| 53 | |||
| 54 | static void sp_write_reg16(const struct sja1000_priv *priv, int reg, u8 val) | ||
| 55 | { | ||
| 56 | iowrite8(val, priv->reg_base + reg * 2); | ||
| 57 | } | ||
| 58 | |||
| 59 | static u8 sp_read_reg32(const struct sja1000_priv *priv, int reg) | ||
| 60 | { | ||
| 61 | return ioread8(priv->reg_base + reg * 4); | ||
| 62 | } | ||
| 63 | |||
| 64 | static void sp_write_reg32(const struct sja1000_priv *priv, int reg, u8 val) | ||
| 65 | { | ||
| 66 | iowrite8(val, priv->reg_base + reg * 4); | ||
| 67 | } | ||
| 68 | |||
| 50 | static int sp_probe(struct platform_device *pdev) | 69 | static int sp_probe(struct platform_device *pdev) |
| 51 | { | 70 | { |
| 52 | int err; | 71 | int err; |
| @@ -90,14 +109,29 @@ static int sp_probe(struct platform_device *pdev) | |||
| 90 | priv = netdev_priv(dev); | 109 | priv = netdev_priv(dev); |
| 91 | 110 | ||
| 92 | dev->irq = res_irq->start; | 111 | dev->irq = res_irq->start; |
| 93 | priv->irq_flags = res_irq->flags & IRQF_TRIGGER_MASK; | 112 | priv->irq_flags = res_irq->flags & (IRQF_TRIGGER_MASK | IRQF_SHARED); |
| 94 | priv->reg_base = addr; | 113 | priv->reg_base = addr; |
| 95 | priv->read_reg = sp_read_reg; | 114 | /* The CAN clock frequency is half the oscillator clock frequency */ |
| 96 | priv->write_reg = sp_write_reg; | 115 | priv->can.clock.freq = pdata->osc_freq / 2; |
| 97 | priv->can.clock.freq = pdata->clock; | ||
| 98 | priv->ocr = pdata->ocr; | 116 | priv->ocr = pdata->ocr; |
| 99 | priv->cdr = pdata->cdr; | 117 | priv->cdr = pdata->cdr; |
| 100 | 118 | ||
| 119 | switch (res_mem->flags & IORESOURCE_MEM_TYPE_MASK) { | ||
| 120 | case IORESOURCE_MEM_32BIT: | ||
| 121 | priv->read_reg = sp_read_reg32; | ||
| 122 | priv->write_reg = sp_write_reg32; | ||
| 123 | break; | ||
| 124 | case IORESOURCE_MEM_16BIT: | ||
| 125 | priv->read_reg = sp_read_reg16; | ||
| 126 | priv->write_reg = sp_write_reg16; | ||
| 127 | break; | ||
| 128 | case IORESOURCE_MEM_8BIT: | ||
| 129 | default: | ||
| 130 | priv->read_reg = sp_read_reg8; | ||
| 131 | priv->write_reg = sp_write_reg8; | ||
| 132 | break; | ||
| 133 | } | ||
| 134 | |||
| 101 | dev_set_drvdata(&pdev->dev, dev); | 135 | dev_set_drvdata(&pdev->dev, dev); |
| 102 | SET_NETDEV_DEV(dev, &pdev->dev); | 136 | SET_NETDEV_DEV(dev, &pdev->dev); |
| 103 | 137 | ||
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index 0c3d2ba0d178..4d07f1ee7168 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
| @@ -47,7 +47,6 @@ | |||
| 47 | #include <linux/platform_device.h> | 47 | #include <linux/platform_device.h> |
| 48 | #include <linux/clk.h> | 48 | #include <linux/clk.h> |
| 49 | 49 | ||
| 50 | #include <linux/can.h> | ||
| 51 | #include <linux/can/dev.h> | 50 | #include <linux/can/dev.h> |
| 52 | #include <linux/can/error.h> | 51 | #include <linux/can/error.h> |
| 53 | #include <linux/can/platform/ti_hecc.h> | 52 | #include <linux/can/platform/ti_hecc.h> |
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 33451092b8e8..1fc0871d2ef7 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
| @@ -300,8 +300,6 @@ static void ems_usb_read_interrupt_callback(struct urb *urb) | |||
| 300 | else if (err) | 300 | else if (err) |
| 301 | dev_err(netdev->dev.parent, | 301 | dev_err(netdev->dev.parent, |
| 302 | "failed resubmitting intr urb: %d\n", err); | 302 | "failed resubmitting intr urb: %d\n", err); |
| 303 | |||
| 304 | return; | ||
| 305 | } | 303 | } |
| 306 | 304 | ||
| 307 | static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) | 305 | static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) |
| @@ -497,8 +495,6 @@ resubmit_urb: | |||
| 497 | else if (retval) | 495 | else if (retval) |
| 498 | dev_err(netdev->dev.parent, | 496 | dev_err(netdev->dev.parent, |
| 499 | "failed resubmitting read bulk urb: %d\n", retval); | 497 | "failed resubmitting read bulk urb: %d\n", retval); |
| 500 | |||
| 501 | return; | ||
| 502 | } | 498 | } |
| 503 | 499 | ||
| 504 | /* | 500 | /* |
| @@ -516,8 +512,8 @@ static void ems_usb_write_bulk_callback(struct urb *urb) | |||
| 516 | netdev = dev->netdev; | 512 | netdev = dev->netdev; |
| 517 | 513 | ||
| 518 | /* free up our allocated buffer */ | 514 | /* free up our allocated buffer */ |
| 519 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 515 | usb_free_coherent(urb->dev, urb->transfer_buffer_length, |
| 520 | urb->transfer_buffer, urb->transfer_dma); | 516 | urb->transfer_buffer, urb->transfer_dma); |
| 521 | 517 | ||
| 522 | atomic_dec(&dev->active_tx_urbs); | 518 | atomic_dec(&dev->active_tx_urbs); |
| 523 | 519 | ||
| @@ -614,8 +610,8 @@ static int ems_usb_start(struct ems_usb *dev) | |||
| 614 | return -ENOMEM; | 610 | return -ENOMEM; |
| 615 | } | 611 | } |
| 616 | 612 | ||
| 617 | buf = usb_buffer_alloc(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, | 613 | buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, |
| 618 | &urb->transfer_dma); | 614 | &urb->transfer_dma); |
| 619 | if (!buf) { | 615 | if (!buf) { |
| 620 | dev_err(netdev->dev.parent, | 616 | dev_err(netdev->dev.parent, |
| 621 | "No memory left for USB buffer\n"); | 617 | "No memory left for USB buffer\n"); |
| @@ -635,8 +631,8 @@ static int ems_usb_start(struct ems_usb *dev) | |||
| 635 | netif_device_detach(dev->netdev); | 631 | netif_device_detach(dev->netdev); |
| 636 | 632 | ||
| 637 | usb_unanchor_urb(urb); | 633 | usb_unanchor_urb(urb); |
| 638 | usb_buffer_free(dev->udev, RX_BUFFER_SIZE, buf, | 634 | usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, |
| 639 | urb->transfer_dma); | 635 | urb->transfer_dma); |
| 640 | break; | 636 | break; |
| 641 | } | 637 | } |
| 642 | 638 | ||
| @@ -777,7 +773,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne | |||
| 777 | goto nomem; | 773 | goto nomem; |
| 778 | } | 774 | } |
| 779 | 775 | ||
| 780 | buf = usb_buffer_alloc(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma); | 776 | buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma); |
| 781 | if (!buf) { | 777 | if (!buf) { |
| 782 | dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); | 778 | dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); |
| 783 | usb_free_urb(urb); | 779 | usb_free_urb(urb); |
| @@ -820,7 +816,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne | |||
| 820 | */ | 816 | */ |
| 821 | if (!context) { | 817 | if (!context) { |
| 822 | usb_unanchor_urb(urb); | 818 | usb_unanchor_urb(urb); |
| 823 | usb_buffer_free(dev->udev, size, buf, urb->transfer_dma); | 819 | usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); |
| 824 | 820 | ||
| 825 | dev_warn(netdev->dev.parent, "couldn't find free context\n"); | 821 | dev_warn(netdev->dev.parent, "couldn't find free context\n"); |
| 826 | 822 | ||
| @@ -845,7 +841,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne | |||
| 845 | can_free_echo_skb(netdev, context->echo_index); | 841 | can_free_echo_skb(netdev, context->echo_index); |
| 846 | 842 | ||
| 847 | usb_unanchor_urb(urb); | 843 | usb_unanchor_urb(urb); |
| 848 | usb_buffer_free(dev->udev, size, buf, urb->transfer_dma); | 844 | usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); |
| 849 | dev_kfree_skb(skb); | 845 | dev_kfree_skb(skb); |
| 850 | 846 | ||
| 851 | atomic_dec(&dev->active_tx_urbs); | 847 | atomic_dec(&dev->active_tx_urbs); |
| @@ -1006,7 +1002,7 @@ static int ems_usb_probe(struct usb_interface *intf, | |||
| 1006 | 1002 | ||
| 1007 | netdev = alloc_candev(sizeof(struct ems_usb), MAX_TX_URBS); | 1003 | netdev = alloc_candev(sizeof(struct ems_usb), MAX_TX_URBS); |
| 1008 | if (!netdev) { | 1004 | if (!netdev) { |
| 1009 | dev_err(netdev->dev.parent, "Couldn't alloc candev\n"); | 1005 | dev_err(&intf->dev, "ems_usb: Couldn't alloc candev\n"); |
| 1010 | return -ENOMEM; | 1006 | return -ENOMEM; |
| 1011 | } | 1007 | } |
| 1012 | 1008 | ||
| @@ -1036,20 +1032,20 @@ static int ems_usb_probe(struct usb_interface *intf, | |||
| 1036 | 1032 | ||
| 1037 | dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL); | 1033 | dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL); |
| 1038 | if (!dev->intr_urb) { | 1034 | if (!dev->intr_urb) { |
| 1039 | dev_err(netdev->dev.parent, "Couldn't alloc intr URB\n"); | 1035 | dev_err(&intf->dev, "Couldn't alloc intr URB\n"); |
| 1040 | goto cleanup_candev; | 1036 | goto cleanup_candev; |
| 1041 | } | 1037 | } |
| 1042 | 1038 | ||
| 1043 | dev->intr_in_buffer = kzalloc(INTR_IN_BUFFER_SIZE, GFP_KERNEL); | 1039 | dev->intr_in_buffer = kzalloc(INTR_IN_BUFFER_SIZE, GFP_KERNEL); |
| 1044 | if (!dev->intr_in_buffer) { | 1040 | if (!dev->intr_in_buffer) { |
| 1045 | dev_err(netdev->dev.parent, "Couldn't alloc Intr buffer\n"); | 1041 | dev_err(&intf->dev, "Couldn't alloc Intr buffer\n"); |
| 1046 | goto cleanup_intr_urb; | 1042 | goto cleanup_intr_urb; |
| 1047 | } | 1043 | } |
| 1048 | 1044 | ||
| 1049 | dev->tx_msg_buffer = kzalloc(CPC_HEADER_SIZE + | 1045 | dev->tx_msg_buffer = kzalloc(CPC_HEADER_SIZE + |
| 1050 | sizeof(struct ems_cpc_msg), GFP_KERNEL); | 1046 | sizeof(struct ems_cpc_msg), GFP_KERNEL); |
| 1051 | if (!dev->tx_msg_buffer) { | 1047 | if (!dev->tx_msg_buffer) { |
| 1052 | dev_err(netdev->dev.parent, "Couldn't alloc Tx buffer\n"); | 1048 | dev_err(&intf->dev, "Couldn't alloc Tx buffer\n"); |
| 1053 | goto cleanup_intr_in_buffer; | 1049 | goto cleanup_intr_in_buffer; |
| 1054 | } | 1050 | } |
| 1055 | 1051 | ||
