can: sja1000 platform data fixes
[safe/jmp/linux-2.6] / drivers / net / ucc_geth.c
index 96bdc0b..932602d 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/qe.h>
 #include <asm/ucc.h>
 #include <asm/ucc_fast.h>
+#include <asm/machdep.h>
 
 #include "ucc_geth.h"
 #include "fsl_pq_mdio.h"
@@ -429,7 +430,7 @@ static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth,
            ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
 
        /* Ethernet frames are defined in Little Endian mode,
-       therefor to insert */
+       therefore to insert */
        /* the address to the hash (Big Endian mode), we reverse the bytes.*/
 
        set_mac_addr(&p_82xx_addr_filt->taddr.h, p_enet_addr);
@@ -1334,7 +1335,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
        struct ucc_geth __iomem *ug_regs;
        struct ucc_fast __iomem *uf_regs;
        int ret_val;
-       u32 upsmr, maccfg2, tbiBaseAddress;
+       u32 upsmr, maccfg2;
        u16 value;
 
        ugeth_vdbg("%s: IN", __func__);
@@ -1389,14 +1390,20 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
        /* Note that this depends on proper setting in utbipar register. */
        if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) ||
            (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
-               tbiBaseAddress = in_be32(&ug_regs->utbipar);
-               tbiBaseAddress &= UTBIPAR_PHY_ADDRESS_MASK;
-               tbiBaseAddress >>= UTBIPAR_PHY_ADDRESS_SHIFT;
-               value = ugeth->phydev->bus->read(ugeth->phydev->bus,
-                               (u8) tbiBaseAddress, ENET_TBI_MII_CR);
+               struct ucc_geth_info *ug_info = ugeth->ug_info;
+               struct phy_device *tbiphy;
+
+               if (!ug_info->tbi_node)
+                       ugeth_warn("TBI mode requires that the device "
+                               "tree specify a tbi-handle\n");
+
+               tbiphy = of_phy_find_device(ug_info->tbi_node);
+               if (!tbiphy)
+                       ugeth_warn("Could not get TBI device\n");
+
+               value = phy_read(tbiphy, ENET_TBI_MII_CR);
                value &= ~0x1000;       /* Turn off autonegotiation */
-               ugeth->phydev->bus->write(ugeth->phydev->bus,
-                               (u8) tbiBaseAddress, ENET_TBI_MII_CR, value);
+               phy_write(tbiphy, ENET_TBI_MII_CR, value);
        }
 
        init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2);
@@ -1992,10 +1999,9 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
 static void ucc_geth_set_multi(struct net_device *dev)
 {
        struct ucc_geth_private *ugeth;
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        struct ucc_fast __iomem *uf_regs;
        struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt;
-       int i;
 
        ugeth = netdev_priv(dev);
 
@@ -2022,19 +2028,16 @@ static void ucc_geth_set_multi(struct net_device *dev)
                        out_be32(&p_82xx_addr_filt->gaddr_h, 0x0);
                        out_be32(&p_82xx_addr_filt->gaddr_l, 0x0);
 
-                       dmi = dev->mc_list;
-
-                       for (i = 0; i < dev->mc_count; i++, dmi = dmi->next) {
-
+                       netdev_for_each_mc_addr(ha, dev) {
                                /* Only support group multicast for now.
                                 */
-                               if (!(dmi->dmi_addr[0] & 1))
+                               if (!(ha->addr[0] & 1))
                                        continue;
 
                                /* Ask CPM to run CRC and set bit in
                                 * filter mask.
                                 */
-                               hw_add_addr_in_hash(ugeth, dmi->dmi_addr);
+                               hw_add_addr_in_hash(ugeth, ha->addr);
                        }
                }
        }
@@ -3145,8 +3148,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
        /* set bd status and length */
        out_be32((u32 __iomem *)bd, bd_status);
 
-       dev->trans_start = jiffies;
-
        /* Move to next BD in the ring */
        if (!(bd_status & T_W))
                bd += sizeof(struct qe_bd);
@@ -3279,13 +3280,12 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
                /* Handle the transmitted buffer and release */
                /* the BD to be used with the current frame  */
 
-               if (bd == ugeth->txBd[txQ]) /* queue empty? */
+               skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
+               if (!skb)
                        break;
 
                dev->stats.tx_packets++;
 
-               skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
-
                if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN &&
                             skb_recycle_check(skb,
                                    ugeth->ug_info->uf_info.max_rx_buf_length +
@@ -3881,7 +3881,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
        }
 
        if (netif_msg_probe(&debug))
-               printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
+               printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d)\n",
                        ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
                        ug_info->uf_info.irq);