]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/xilinx_emaclite.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / net / xilinx_emaclite.c
index ecbbb688eba08a1b337447a406284c5fd42d7fe2..cad66ce1640b97069ce25b6c8539feadd353762a 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/of_mdio.h>
+#include <linux/of_net.h>
 #include <linux/phy.h>
 
 #define DRIVER_NAME "xilinx_emaclite"
@@ -430,8 +431,8 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data)
        }
 
        /* Get the protocol type of the ethernet frame that arrived */
-       proto_type = ((in_be32(addr + XEL_HEADER_OFFSET +
-                       XEL_RXBUFF_OFFSET) >> XEL_HEADER_SHIFT) &
+       proto_type = ((ntohl(in_be32(addr + XEL_HEADER_OFFSET +
+                       XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) &
                        XEL_RPLR_LENGTH_MASK);
 
        /* Check if received ethernet frame is a raw ethernet frame
@@ -439,9 +440,9 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data)
        if (proto_type > (ETH_FRAME_LEN + ETH_FCS_LEN)) {
 
                if (proto_type == ETH_P_IP) {
-                       length = ((in_be32(addr +
+                       length = ((ntohl(in_be32(addr +
                                        XEL_HEADER_IP_LENGTH_OFFSET +
-                                       XEL_RXBUFF_OFFSET) >>
+                                       XEL_RXBUFF_OFFSET)) >>
                                        XEL_HEADER_SHIFT) &
                                        XEL_RPLR_LENGTH_MASK);
                        length += ETH_HLEN + ETH_FCS_LEN;
@@ -515,7 +516,7 @@ static void xemaclite_update_address(struct net_local *drvdata,
  */
 static int xemaclite_set_mac_address(struct net_device *dev, void *address)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
        struct sockaddr *addr = address;
 
        if (netif_running(dev))
@@ -534,7 +535,7 @@ static int xemaclite_set_mac_address(struct net_device *dev, void *address)
  */
 static void xemaclite_tx_timeout(struct net_device *dev)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
        unsigned long flags;
 
        dev_err(&lp->ndev->dev, "Exceeded transmit timeout of %lu ms\n",
@@ -578,7 +579,7 @@ static void xemaclite_tx_timeout(struct net_device *dev)
  */
 static void xemaclite_tx_handler(struct net_device *dev)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
 
        dev->stats.tx_packets++;
        if (lp->deferred_skb) {
@@ -605,7 +606,7 @@ static void xemaclite_tx_handler(struct net_device *dev)
  */
 static void xemaclite_rx_handler(struct net_device *dev)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
        struct sk_buff *skb;
        unsigned int align;
        u32 len;
@@ -641,7 +642,7 @@ static void xemaclite_rx_handler(struct net_device *dev)
        skb_put(skb, len);      /* Tell the skb how much data we got */
 
        skb->protocol = eth_type_trans(skb, dev);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        dev->stats.rx_packets++;
        dev->stats.rx_bytes += len;
@@ -661,7 +662,7 @@ static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
 {
        bool tx_complete = 0;
        struct net_device *dev = dev_id;
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
        void __iomem *base_addr = lp->base_addr;
        u32 tx_status;
 
@@ -918,7 +919,7 @@ void xemaclite_adjust_link(struct net_device *ndev)
  */
 static int xemaclite_open(struct net_device *dev)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
        int retval;
 
        /* Just to be safe, stop the device first */
@@ -987,7 +988,7 @@ static int xemaclite_open(struct net_device *dev)
  */
 static int xemaclite_close(struct net_device *dev)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
 
        netif_stop_queue(dev);
        xemaclite_disable_interrupts(lp);
@@ -1000,21 +1001,6 @@ static int xemaclite_close(struct net_device *dev)
        return 0;
 }
 
-/**
- * xemaclite_get_stats - Get the stats for the net_device
- * @dev:       Pointer to the network device
- *
- * This function returns the address of the 'net_device_stats' structure for the
- * given network device. This structure holds usage statistics for the network
- * device.
- *
- * Return:     Pointer to the net_device_stats structure.
- */
-static struct net_device_stats *xemaclite_get_stats(struct net_device *dev)
-{
-       return &dev->stats;
-}
-
 /**
  * xemaclite_send - Transmit a frame
  * @orig_skb:  Pointer to the socket buffer to be transmitted
@@ -1031,7 +1017,7 @@ static struct net_device_stats *xemaclite_get_stats(struct net_device *dev)
  */
 static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
 {
-       struct net_local *lp = (struct net_local *) netdev_priv(dev);
+       struct net_local *lp = netdev_priv(dev);
        struct sk_buff *new_skb;
        unsigned int len;
        unsigned long flags;
@@ -1068,7 +1054,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
 static void xemaclite_remove_ndev(struct net_device *ndev)
 {
        if (ndev) {
-               struct net_local *lp = (struct net_local *) netdev_priv(ndev);
+               struct net_local *lp = netdev_priv(ndev);
 
                if (lp->base_addr)
                        iounmap((void __iomem __force *) (lp->base_addr));
@@ -1245,7 +1231,7 @@ static int __devexit xemaclite_of_remove(struct platform_device *of_dev)
        struct device *dev = &of_dev->dev;
        struct net_device *ndev = dev_get_drvdata(dev);
 
-       struct net_local *lp = (struct net_local *) netdev_priv(ndev);
+       struct net_local *lp = netdev_priv(ndev);
 
        /* Un-register the mii_bus, if configured */
        if (lp->has_mdio) {
@@ -1269,13 +1255,25 @@ static int __devexit xemaclite_of_remove(struct platform_device *of_dev)
        return 0;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void
+xemaclite_poll_controller(struct net_device *ndev)
+{
+       disable_irq(ndev->irq);
+       xemaclite_interrupt(ndev->irq, ndev);
+       enable_irq(ndev->irq);
+}
+#endif
+
 static struct net_device_ops xemaclite_netdev_ops = {
        .ndo_open               = xemaclite_open,
        .ndo_stop               = xemaclite_close,
        .ndo_start_xmit         = xemaclite_send,
        .ndo_set_mac_address    = xemaclite_set_mac_address,
        .ndo_tx_timeout         = xemaclite_tx_timeout,
-       .ndo_get_stats          = xemaclite_get_stats,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller = xemaclite_poll_controller,
+#endif
 };
 
 /* Match table for OF platform binding */