drivers/base: Convert dev->sem to mutex
[safe/jmp/linux-2.6] / drivers / net / sh_eth.c
index 161181a..586ed09 100644 (file)
@@ -31,6 +31,9 @@
 #include <linux/cache.h>
 #include <linux/io.h>
 #include <linux/pm_runtime.h>
+#include <linux/slab.h>
+#include <asm/cacheflush.h>
+
 #include "sh_eth.h"
 
 /* There is CPU dependent code */
@@ -82,6 +85,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
        .mpr            = 1,
        .tpauser        = 1,
        .hw_swap        = 1,
+       .rpadir         = 1,
+       .rpadir_value   = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */
 };
 
 #elif defined(CONFIG_CPU_SUBTYPE_SH7763)
@@ -106,7 +111,7 @@ static void sh_eth_reset(struct net_device *ndev)
                mdelay(1);
                cnt--;
        }
-       if (cnt < 0)
+       if (cnt == 0)
                printk(KERN_ERR "Device reset fail\n");
 
        /* Table Init */
@@ -173,7 +178,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
        .tpauser        = 1,
        .bculr          = 1,
        .hw_swap        = 1,
-       .rpadir         = 1,
        .no_trimd       = 1,
        .no_ade         = 1,
 };
@@ -499,6 +503,8 @@ static int sh_eth_ring_init(struct net_device *ndev)
         */
        mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ :
                          (((ndev->mtu + 26 + 7) & ~7) + 2 + 16));
+       if (mdp->cd->rpadir)
+               mdp->rx_buf_sz += NET_IP_ALIGN;
 
        /* Allocate RX and TX skb rings */
        mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE,
@@ -713,6 +719,8 @@ static int sh_eth_rx(struct net_device *ndev)
                                        pkt_len + 2);
                        skb = mdp->rx_skbuff[entry];
                        mdp->rx_skbuff[entry] = NULL;
+                       if (mdp->cd->rpadir)
+                               skb_reserve(skb, NET_IP_ALIGN);
                        skb_put(skb, pkt_len);
                        skb->protocol = eth_type_trans(skb, ndev);
                        netif_rx(skb);
@@ -1014,7 +1022,7 @@ static int sh_eth_open(struct net_device *ndev)
 
        pm_runtime_get_sync(&mdp->pdev->dev);
 
-       ret = request_irq(ndev->irq, &sh_eth_interrupt,
+       ret = request_irq(ndev->irq, sh_eth_interrupt,
 #if defined(CONFIG_CPU_SUBTYPE_SH7763) || defined(CONFIG_CPU_SUBTYPE_SH7764)
                                IRQF_SHARED,
 #else
@@ -1140,8 +1148,6 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        if (!(ctrl_inl(ndev->base_addr + EDTRR) & EDTRR_TRNS))
                ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR);
 
-       ndev->trans_start = jiffies;
-
        return NETDEV_TX_OK;
 }
 
@@ -1466,13 +1472,9 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
        if (ret)
                goto out_unregister;
 
-       /* pritnt device infomation */
-       pr_info("Base address at 0x%x, ",
-              (u32)ndev->base_addr);
-
-       for (i = 0; i < 5; i++)
-               printk("%02X:", ndev->dev_addr[i]);
-       printk("%02X, IRQ %d.\n", ndev->dev_addr[i], ndev->irq);
+       /* print device infomation */
+       pr_info("Base address at 0x%x, %pM, IRQ %d.\n",
+              (u32)ndev->base_addr, ndev->dev_addr, ndev->irq);
 
        platform_set_drvdata(pdev, ndev);