Move USB network drivers to drivers/net/usb.
[powerpc.git] / drivers / net / ucc_geth.c
index 1a16ab2..d7aff81 100644 (file)
@@ -46,8 +46,9 @@
 
 #undef DEBUG
 
-#define DRV_DESC "QE UCC Gigabit Ethernet Controller version:Sept 11, 2006"
+#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
 #define DRV_NAME "ucc_geth"
+#define DRV_VERSION "1.1"
 
 #define ugeth_printk(level, format, arg...)  \
         printk(level format "\n", ## arg)
@@ -1626,14 +1627,6 @@ static int init_phy(struct net_device *dev)
 }
 
 
-#ifdef CONFIG_UGETH_TX_ON_DEMOND
-static int ugeth_transmit_on_demand(struct ucc_geth_private *ugeth)
-{
-       struct ucc_fastransmit_on_demand(ugeth->uccf);
-
-       return 0;
-}
-#endif
 
 static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
 {
@@ -2141,6 +2134,8 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
        }
        for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) {
                bd = ugeth->p_tx_bd_ring[i];
+               if (!bd)
+                       continue;
                for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) {
                        if (ugeth->tx_skbuff[i][j]) {
                                dma_unmap_single(NULL,
@@ -2308,6 +2303,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
        ug_info = ugeth->ug_info;
        uf_info = &ug_info->uf_info;
 
+       /* Create CQs for hash tables */
+       INIT_LIST_HEAD(&ugeth->group_hash_q);
+       INIT_LIST_HEAD(&ugeth->ind_hash_q);
+
        if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) ||
              (uf_info->bd_mem_part == MEM_PART_MURAM))) {
                ugeth_err("%s: Bad memory partition value.", __FUNCTION__);
@@ -3140,13 +3139,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
                for (j = 0; j < NUM_OF_PADDRS; j++)
                        ugeth_82xx_filtering_clear_addr_in_paddr(ugeth, (u8) j);
 
-               /* Create CQs for hash tables */
-               if (ug_info->maxGroupAddrInHash > 0) {
-                       INIT_LIST_HEAD(&ugeth->group_hash_q);
-               }
-               if (ug_info->maxIndAddrInHash > 0) {
-                       INIT_LIST_HEAD(&ugeth->ind_hash_q);
-               }
                p_82xx_addr_filt =
                    (struct ucc_geth_82xx_address_filtering_pram *) ugeth->
                    p_rx_glbl_pram->addressfiltering;
@@ -3343,6 +3335,9 @@ static void ucc_geth_timeout(struct net_device *dev)
 static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ucc_geth_private *ugeth = netdev_priv(dev);
+#ifdef CONFIG_UGETH_TX_ON_DEMAND
+       struct ucc_fast_private *uccf;
+#endif
        u8 *bd;                 /* BD pointer */
        u32 bd_status;
        u8 txQ = 0;
@@ -3401,6 +3396,10 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
                out_be16(ugeth->p_cpucount[txQ], ugeth->cpucount[txQ]);
        }
 
+#ifdef CONFIG_UGETH_TX_ON_DEMAND
+       uccf = ugeth->uccf;
+       out_be16(uccf->p_utodr, UCC_FAST_TOD);
+#endif
        spin_unlock_irq(&ugeth->lock);
 
        return 0;
@@ -3788,7 +3787,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 
        ugeth_vdbg("%s: IN", __FUNCTION__);
 
-       prop = get_property(np, "device-id", NULL);
+       prop = of_get_property(np, "device-id", NULL);
        ucc_num = *prop - 1;
        if ((ucc_num < 0) || (ucc_num > 7))
                return -ENODEV;
@@ -3796,9 +3795,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
        ug_info = &ugeth_info[ucc_num];
        ug_info->uf_info.ucc_num = ucc_num;
 
-       prop = get_property(np, "rx-clock", NULL);
+       prop = of_get_property(np, "rx-clock", NULL);
        ug_info->uf_info.rx_clock = *prop;
-       prop = get_property(np, "tx-clock", NULL);
+       prop = of_get_property(np, "tx-clock", NULL);
        ug_info->uf_info.tx_clock = *prop;
        err = of_address_to_resource(np, 0, &res);
        if (err)
@@ -3807,23 +3806,23 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
        ug_info->uf_info.regs = res.start;
        ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
 
-       ph = get_property(np, "phy-handle", NULL);
+       ph = of_get_property(np, "phy-handle", NULL);
        phy = of_find_node_by_phandle(*ph);
 
        if (phy == NULL)
                return -ENODEV;
 
        /* set the PHY address */
-       prop = get_property(phy, "reg", NULL);
+       prop = of_get_property(phy, "reg", NULL);
        if (prop == NULL)
                return -1;
        ug_info->phy_address = *prop;
 
        /* get the phy interface type, or default to MII */
-       prop = get_property(np, "interface-type", NULL);
+       prop = of_get_property(np, "interface-type", NULL);
        if (!prop) {
                /* handle interface property present in old trees */
-               prop = get_property(phy, "interface", NULL);
+               prop = of_get_property(phy, "interface", NULL);
                if (prop != NULL)
                        phy_interface = enet_to_phy_interface[*prop];
                else
@@ -3833,10 +3832,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
        }
 
        /* get speed, or derive from interface */
-       prop = get_property(np, "max-speed", NULL);
+       prop = of_get_property(np, "max-speed", NULL);
        if (!prop) {
                /* handle interface property present in old trees */
-               prop = get_property(phy, "interface", NULL);
+               prop = of_get_property(phy, "interface", NULL);
                if (prop != NULL)
                        max_speed = enet_to_speed[*prop];
        } else {
@@ -4008,4 +4007,5 @@ module_exit(ucc_geth_exit);
 
 MODULE_AUTHOR("Freescale Semiconductor, Inc");
 MODULE_DESCRIPTION(DRV_DESC);
+MODULE_VERSION(DRV_VERSION);
 MODULE_LICENSE("GPL");