diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/cpmac.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/cpmac.c')
-rw-r--r-- | drivers/net/cpmac.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index e1f6156b3710..fec939f8f65f 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
40 | #include <linux/clk.h> | 40 | #include <linux/clk.h> |
41 | #include <asm/gpio.h> | 41 | #include <linux/gpio.h> |
42 | #include <asm/atomic.h> | 42 | #include <asm/atomic.h> |
43 | 43 | ||
44 | MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>"); | 44 | MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>"); |
@@ -108,7 +108,7 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus"); | |||
108 | #define CPMAC_RX_INT_CLEAR 0x019c | 108 | #define CPMAC_RX_INT_CLEAR 0x019c |
109 | #define CPMAC_MAC_INT_ENABLE 0x01a8 | 109 | #define CPMAC_MAC_INT_ENABLE 0x01a8 |
110 | #define CPMAC_MAC_INT_CLEAR 0x01ac | 110 | #define CPMAC_MAC_INT_CLEAR 0x01ac |
111 | #define CPMAC_MAC_ADDR_LO(channel) (0x01b0 + (channel) * 4) | 111 | #define CPMAC_MAC_ADDR_LO(channel) (0x01b0 + (channel) * 4) |
112 | #define CPMAC_MAC_ADDR_MID 0x01d0 | 112 | #define CPMAC_MAC_ADDR_MID 0x01d0 |
113 | #define CPMAC_MAC_ADDR_HI 0x01d4 | 113 | #define CPMAC_MAC_ADDR_HI 0x01d4 |
114 | #define CPMAC_MAC_HASH_LO 0x01d8 | 114 | #define CPMAC_MAC_HASH_LO 0x01d8 |
@@ -227,7 +227,7 @@ static void cpmac_dump_regs(struct net_device *dev) | |||
227 | for (i = 0; i < CPMAC_REG_END; i += 4) { | 227 | for (i = 0; i < CPMAC_REG_END; i += 4) { |
228 | if (i % 16 == 0) { | 228 | if (i % 16 == 0) { |
229 | if (i) | 229 | if (i) |
230 | printk("\n"); | 230 | pr_cont("\n"); |
231 | printk(KERN_DEBUG "%s: reg[%p]:", dev->name, | 231 | printk(KERN_DEBUG "%s: reg[%p]:", dev->name, |
232 | priv->regs + i); | 232 | priv->regs + i); |
233 | } | 233 | } |
@@ -262,7 +262,7 @@ static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb) | |||
262 | for (i = 0; i < skb->len; i++) { | 262 | for (i = 0; i < skb->len; i++) { |
263 | if (i % 16 == 0) { | 263 | if (i % 16 == 0) { |
264 | if (i) | 264 | if (i) |
265 | printk("\n"); | 265 | pr_cont("\n"); |
266 | printk(KERN_DEBUG "%s: data[%p]:", dev->name, | 266 | printk(KERN_DEBUG "%s: data[%p]:", dev->name, |
267 | skb->data + i); | 267 | skb->data + i); |
268 | } | 268 | } |
@@ -391,7 +391,7 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv, | |||
391 | if (likely(skb)) { | 391 | if (likely(skb)) { |
392 | skb_put(desc->skb, desc->datalen); | 392 | skb_put(desc->skb, desc->datalen); |
393 | desc->skb->protocol = eth_type_trans(desc->skb, priv->dev); | 393 | desc->skb->protocol = eth_type_trans(desc->skb, priv->dev); |
394 | desc->skb->ip_summed = CHECKSUM_NONE; | 394 | skb_checksum_none_assert(desc->skb); |
395 | priv->dev->stats.rx_packets++; | 395 | priv->dev->stats.rx_packets++; |
396 | priv->dev->stats.rx_bytes += desc->datalen; | 396 | priv->dev->stats.rx_bytes += desc->datalen; |
397 | result = desc->skb; | 397 | result = desc->skb; |
@@ -506,7 +506,7 @@ static int cpmac_poll(struct napi_struct *napi, int budget) | |||
506 | "restart rx from a descriptor that's " | 506 | "restart rx from a descriptor that's " |
507 | "not free: %p\n", | 507 | "not free: %p\n", |
508 | priv->dev->name, restart); | 508 | priv->dev->name, restart); |
509 | goto fatal_error; | 509 | goto fatal_error; |
510 | } | 510 | } |
511 | 511 | ||
512 | cpmac_write(priv->regs, CPMAC_RX_PTR(0), restart->mapping); | 512 | cpmac_write(priv->regs, CPMAC_RX_PTR(0), restart->mapping); |
@@ -873,7 +873,8 @@ static int cpmac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
873 | return -EINVAL; | 873 | return -EINVAL; |
874 | } | 874 | } |
875 | 875 | ||
876 | static void cpmac_get_ringparam(struct net_device *dev, struct ethtool_ringparam* ring) | 876 | static void cpmac_get_ringparam(struct net_device *dev, |
877 | struct ethtool_ringparam *ring) | ||
877 | { | 878 | { |
878 | struct cpmac_priv *priv = netdev_priv(dev); | 879 | struct cpmac_priv *priv = netdev_priv(dev); |
879 | 880 | ||
@@ -888,7 +889,8 @@ static void cpmac_get_ringparam(struct net_device *dev, struct ethtool_ringparam | |||
888 | ring->tx_pending = 1; | 889 | ring->tx_pending = 1; |
889 | } | 890 | } |
890 | 891 | ||
891 | static int cpmac_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ring) | 892 | static int cpmac_set_ringparam(struct net_device *dev, |
893 | struct ethtool_ringparam *ring) | ||
892 | { | 894 | { |
893 | struct cpmac_priv *priv = netdev_priv(dev); | 895 | struct cpmac_priv *priv = netdev_priv(dev); |
894 | 896 | ||
@@ -1012,8 +1014,8 @@ static int cpmac_open(struct net_device *dev) | |||
1012 | 1014 | ||
1013 | priv->rx_head->prev->hw_next = (u32)0; | 1015 | priv->rx_head->prev->hw_next = (u32)0; |
1014 | 1016 | ||
1015 | if ((res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, | 1017 | res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, dev->name, dev); |
1016 | dev->name, dev))) { | 1018 | if (res) { |
1017 | if (netif_msg_drv(priv)) | 1019 | if (netif_msg_drv(priv)) |
1018 | printk(KERN_ERR "%s: failed to obtain irq\n", | 1020 | printk(KERN_ERR "%s: failed to obtain irq\n", |
1019 | dev->name); | 1021 | dev->name); |
@@ -1133,7 +1135,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1133 | } | 1135 | } |
1134 | 1136 | ||
1135 | if (phy_id == PHY_MAX_ADDR) { | 1137 | if (phy_id == PHY_MAX_ADDR) { |
1136 | dev_err(&pdev->dev, "no PHY present, falling back to switch on MDIO bus 0\n"); | 1138 | dev_err(&pdev->dev, "no PHY present, falling back " |
1139 | "to switch on MDIO bus 0\n"); | ||
1137 | strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ | 1140 | strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ |
1138 | phy_id = pdev->id; | 1141 | phy_id = pdev->id; |
1139 | } | 1142 | } |
@@ -1169,9 +1172,10 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1169 | priv->msg_enable = netif_msg_init(debug_level, 0xff); | 1172 | priv->msg_enable = netif_msg_init(debug_level, 0xff); |
1170 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr)); | 1173 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr)); |
1171 | 1174 | ||
1172 | snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | 1175 | snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, |
1176 | mdio_bus_id, phy_id); | ||
1173 | 1177 | ||
1174 | priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0, | 1178 | priv->phy = phy_connect(dev, priv->phy_name, cpmac_adjust_link, 0, |
1175 | PHY_INTERFACE_MODE_MII); | 1179 | PHY_INTERFACE_MODE_MII); |
1176 | 1180 | ||
1177 | if (IS_ERR(priv->phy)) { | 1181 | if (IS_ERR(priv->phy)) { |
@@ -1182,7 +1186,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1182 | goto fail; | 1186 | goto fail; |
1183 | } | 1187 | } |
1184 | 1188 | ||
1185 | if ((rc = register_netdev(dev))) { | 1189 | rc = register_netdev(dev); |
1190 | if (rc) { | ||
1186 | printk(KERN_ERR "cpmac: error %i registering device %s\n", rc, | 1191 | printk(KERN_ERR "cpmac: error %i registering device %s\n", rc, |
1187 | dev->name); | 1192 | dev->name); |
1188 | goto fail; | 1193 | goto fail; |
@@ -1248,11 +1253,13 @@ int __devinit cpmac_init(void) | |||
1248 | 1253 | ||
1249 | cpmac_mii->reset(cpmac_mii); | 1254 | cpmac_mii->reset(cpmac_mii); |
1250 | 1255 | ||
1251 | for (i = 0; i < 300; i++) | 1256 | for (i = 0; i < 300; i++) { |
1252 | if ((mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE))) | 1257 | mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE); |
1258 | if (mask) | ||
1253 | break; | 1259 | break; |
1254 | else | 1260 | else |
1255 | msleep(10); | 1261 | msleep(10); |
1262 | } | ||
1256 | 1263 | ||
1257 | mask &= 0x7fffffff; | 1264 | mask &= 0x7fffffff; |
1258 | if (mask & (mask - 1)) { | 1265 | if (mask & (mask - 1)) { |