aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xilinx_emaclite.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-08-06 13:13:54 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-08-06 13:13:54 -0400
commit11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (patch)
tree9e57efcb106ae912f7bec718feb3f8ec607559bb /drivers/net/xilinx_emaclite.c
parent162500b3a3ff39d941d29db49b41a16667ae44f0 (diff)
parent9b2a606d3898fcb2eedb6faded3bb37549590ac4 (diff)
Merge branches 'gemini' and 'misc' into devel
Diffstat (limited to 'drivers/net/xilinx_emaclite.c')
-rw-r--r--drivers/net/xilinx_emaclite.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 1a74594224b1..d04c5b262050 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -19,6 +19,7 @@
19#include <linux/etherdevice.h> 19#include <linux/etherdevice.h>
20#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/slab.h>
22 23
23#include <linux/of_device.h> 24#include <linux/of_device.h>
24#include <linux/of_platform.h> 25#include <linux/of_platform.h>
@@ -557,7 +558,7 @@ static void xemaclite_tx_timeout(struct net_device *dev)
557 } 558 }
558 559
559 /* To exclude tx timeout */ 560 /* To exclude tx timeout */
560 dev->trans_start = 0xffffffff - TX_TIMEOUT - TX_TIMEOUT; 561 dev->trans_start = jiffies; /* prevent tx timeout */
561 562
562 /* We're all ready to go. Start the queue */ 563 /* We're all ready to go. Start the queue */
563 netif_wake_queue(dev); 564 netif_wake_queue(dev);
@@ -589,7 +590,7 @@ static void xemaclite_tx_handler(struct net_device *dev)
589 dev->stats.tx_bytes += lp->deferred_skb->len; 590 dev->stats.tx_bytes += lp->deferred_skb->len;
590 dev_kfree_skb_irq(lp->deferred_skb); 591 dev_kfree_skb_irq(lp->deferred_skb);
591 lp->deferred_skb = NULL; 592 lp->deferred_skb = NULL;
592 dev->trans_start = jiffies; 593 dev->trans_start = jiffies; /* prevent tx timeout */
593 netif_wake_queue(dev); 594 netif_wake_queue(dev);
594 } 595 }
595 } 596 }
@@ -638,7 +639,6 @@ static void xemaclite_rx_handler(struct net_device *dev)
638 } 639 }
639 640
640 skb_put(skb, len); /* Tell the skb how much data we got */ 641 skb_put(skb, len); /* Tell the skb how much data we got */
641 skb->dev = dev; /* Fill out required meta-data */
642 642
643 skb->protocol = eth_type_trans(skb, dev); 643 skb->protocol = eth_type_trans(skb, dev);
644 skb->ip_summed = CHECKSUM_NONE; 644 skb->ip_summed = CHECKSUM_NONE;
@@ -1054,7 +1054,6 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
1054 1054
1055 dev->stats.tx_bytes += len; 1055 dev->stats.tx_bytes += len;
1056 dev_kfree_skb(new_skb); 1056 dev_kfree_skb(new_skb);
1057 dev->trans_start = jiffies;
1058 1057
1059 return 0; 1058 return 0;
1060} 1059}
@@ -1089,7 +1088,7 @@ static void xemaclite_remove_ndev(struct net_device *ndev)
1089 */ 1088 */
1090static bool get_bool(struct of_device *ofdev, const char *s) 1089static bool get_bool(struct of_device *ofdev, const char *s)
1091{ 1090{
1092 u32 *p = (u32 *)of_get_property(ofdev->node, s, NULL); 1091 u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL);
1093 1092
1094 if (p) { 1093 if (p) {
1095 return (bool)*p; 1094 return (bool)*p;
@@ -1131,14 +1130,14 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1131 dev_info(dev, "Device Tree Probing\n"); 1130 dev_info(dev, "Device Tree Probing\n");
1132 1131
1133 /* Get iospace for the device */ 1132 /* Get iospace for the device */
1134 rc = of_address_to_resource(ofdev->node, 0, &r_mem); 1133 rc = of_address_to_resource(ofdev->dev.of_node, 0, &r_mem);
1135 if (rc) { 1134 if (rc) {
1136 dev_err(dev, "invalid address\n"); 1135 dev_err(dev, "invalid address\n");
1137 return rc; 1136 return rc;
1138 } 1137 }
1139 1138
1140 /* Get IRQ for the device */ 1139 /* Get IRQ for the device */
1141 rc = of_irq_to_resource(ofdev->node, 0, &r_irq); 1140 rc = of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq);
1142 if (rc == NO_IRQ) { 1141 if (rc == NO_IRQ) {
1143 dev_err(dev, "no IRQ found\n"); 1142 dev_err(dev, "no IRQ found\n");
1144 return rc; 1143 return rc;
@@ -1171,7 +1170,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1171 } 1170 }
1172 1171
1173 /* Get the virtual base address for the device */ 1172 /* Get the virtual base address for the device */
1174 lp->base_addr = ioremap(r_mem.start, r_mem.end - r_mem.start + 1); 1173 lp->base_addr = ioremap(r_mem.start, resource_size(&r_mem));
1175 if (NULL == lp->base_addr) { 1174 if (NULL == lp->base_addr) {
1176 dev_err(dev, "EmacLite: Could not allocate iomem\n"); 1175 dev_err(dev, "EmacLite: Could not allocate iomem\n");
1177 rc = -EIO; 1176 rc = -EIO;
@@ -1183,7 +1182,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1183 lp->next_rx_buf_to_use = 0x0; 1182 lp->next_rx_buf_to_use = 0x0;
1184 lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong"); 1183 lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong");
1185 lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong"); 1184 lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
1186 mac_address = of_get_mac_address(ofdev->node); 1185 mac_address = of_get_mac_address(ofdev->dev.of_node);
1187 1186
1188 if (mac_address) 1187 if (mac_address)
1189 /* Set the MAC address. */ 1188 /* Set the MAC address. */
@@ -1198,7 +1197,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1198 /* Set the MAC address in the EmacLite device */ 1197 /* Set the MAC address in the EmacLite device */
1199 xemaclite_update_address(lp, ndev->dev_addr); 1198 xemaclite_update_address(lp, ndev->dev_addr);
1200 1199
1201 lp->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0); 1200 lp->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
1202 rc = xemaclite_mdio_setup(lp, &ofdev->dev); 1201 rc = xemaclite_mdio_setup(lp, &ofdev->dev);
1203 if (rc) 1202 if (rc)
1204 dev_warn(&ofdev->dev, "error registering MDIO bus\n"); 1203 dev_warn(&ofdev->dev, "error registering MDIO bus\n");
@@ -1224,7 +1223,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
1224 return 0; 1223 return 0;
1225 1224
1226error1: 1225error1:
1227 release_mem_region(ndev->mem_start, r_mem.end - r_mem.start + 1); 1226 release_mem_region(ndev->mem_start, resource_size(&r_mem));
1228 1227
1229error2: 1228error2:
1230 xemaclite_remove_ndev(ndev); 1229 xemaclite_remove_ndev(ndev);
@@ -1292,8 +1291,11 @@ static struct of_device_id xemaclite_of_match[] __devinitdata = {
1292MODULE_DEVICE_TABLE(of, xemaclite_of_match); 1291MODULE_DEVICE_TABLE(of, xemaclite_of_match);
1293 1292
1294static struct of_platform_driver xemaclite_of_driver = { 1293static struct of_platform_driver xemaclite_of_driver = {
1295 .name = DRIVER_NAME, 1294 .driver = {
1296 .match_table = xemaclite_of_match, 1295 .name = DRIVER_NAME,
1296 .owner = THIS_MODULE,
1297 .of_match_table = xemaclite_of_match,
1298 },
1297 .probe = xemaclite_of_probe, 1299 .probe = xemaclite_of_probe,
1298 .remove = __devexit_p(xemaclite_of_remove), 1300 .remove = __devexit_p(xemaclite_of_remove),
1299}; 1301};