]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/bfin_mac.c
net drivers: fix platform driver hotplug/coldplug
[linux-2.6-omap-h63xx.git] / drivers / net / bfin_mac.c
index f2368b71a7203b8ba2a4380b5f7639c28ba5f78c..4fec8581bfd7bb80e5c7a49ae7c548532f263cf7 100644 (file)
@@ -47,6 +47,7 @@
 MODULE_AUTHOR(DRV_AUTHOR);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION(DRV_DESC);
+MODULE_ALIAS("platform:bfin_mac");
 
 #if defined(CONFIG_BFIN_MAC_USE_L1)
 # define bfin_mac_alloc(dma_handle, size)  l1_data_sram_zalloc(size)
@@ -408,7 +409,7 @@ static int mii_probe(struct net_device *dev)
        mdc_div = ((sclk / MDC_CLK) / 2) - 1;
 
        sysctl = bfin_read_EMAC_SYSCTL();
-       sysctl |= SET_MDCDIV(mdc_div);
+       sysctl = (sysctl & ~MDCDIV) | SET_MDCDIV(mdc_div);
        bfin_write_EMAC_SYSCTL(sysctl);
 
        /* search for connect PHY device */
@@ -575,7 +576,6 @@ adjust_head:
 static int bf537mac_hard_start_xmit(struct sk_buff *skb,
                                struct net_device *dev)
 {
-       struct bf537mac_local *lp = netdev_priv(dev);
        unsigned int data;
 
        current_tx_ptr->skb = skb;
@@ -634,7 +634,6 @@ out:
 static void bf537mac_rx(struct net_device *dev)
 {
        struct sk_buff *skb, *new_skb;
-       struct bf537mac_local *lp = netdev_priv(dev);
        unsigned short len;
 
        /* allocate a new skb for next time receive */
@@ -651,6 +650,12 @@ static void bf537mac_rx(struct net_device *dev)
        current_rx_ptr->skb = new_skb;
        current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2;
 
+       /* Invidate the data cache of skb->data range when it is write back
+        * cache. It will prevent overwritting the new data from DMA
+        */
+       blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
+                                        (unsigned long)new_skb->end);
+
        len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN);
        skb_put(skb, len);
        blackfin_dcache_invalidate_range((unsigned long)skb->head,
@@ -965,7 +970,7 @@ static int __init bf537mac_probe(struct net_device *dev)
        lp->mii_bus.write = mdiobus_write;
        lp->mii_bus.reset = mdiobus_reset;
        lp->mii_bus.name = "bfin_mac_mdio";
-       lp->mii_bus.id = 0;
+       snprintf(lp->mii_bus.id, MII_BUS_ID_SIZE, "0");
        lp->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
        for (i = 0; i < PHY_MAX_ADDR; ++i)
                lp->mii_bus.irq[i] = PHY_POLL;
@@ -1085,8 +1090,9 @@ static struct platform_driver bfin_mac_driver = {
        .resume = bfin_mac_resume,
        .suspend = bfin_mac_suspend,
        .driver = {
-                  .name = DRV_NAME,
-                  },
+               .name = DRV_NAME,
+               .owner  = THIS_MODULE,
+       },
 };
 
 static int __init bfin_mac_init(void)
@@ -1102,3 +1108,4 @@ static void __exit bfin_mac_cleanup(void)
 }
 
 module_exit(bfin_mac_cleanup);
+