stmmac: get the descriptor structure from platform
[safe/jmp/linux-2.6] / drivers / net / stmmac / stmmac_main.c
index 92bef30..7ac6dde 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/phy.h>
 #include <linux/if_vlan.h>
 #include <linux/dma-mapping.h>
+#include <linux/slab.h>
 #include "stmmac.h"
 
 #define STMMAC_RESOURCE_NAME   "stmmaceth"
@@ -836,7 +837,7 @@ static int stmmac_open(struct net_device *dev)
 #ifdef CONFIG_STMMAC_TIMER
        priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
        if (unlikely(priv->tm == NULL)) {
-               pr_err("%s: ERROR: timer memory alloc failed \n", __func__);
+               pr_err("%s: ERROR: timer memory alloc failed\n", __func__);
                return -ENOMEM;
        }
        priv->tm->freq = tmrate;
@@ -1279,7 +1280,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
 
                        priv->dev->stats.rx_packets++;
                        priv->dev->stats.rx_bytes += frame_len;
-                       priv->dev->last_rx = jiffies;
                }
                entry = next_entry;
                p = p_next;     /* use prefetched values */
@@ -1586,6 +1586,12 @@ static int stmmac_mac_device_setup(struct net_device *dev)
        else
                device = dwmac100_setup(ioaddr);
 
+       if (priv->enh_desc) {
+               device->desc = &enh_desc_ops;
+               pr_info("\tEnhanced descriptor structure\n");
+       } else
+               device->desc = &ndesc_ops;
+
        if (!device)
                return -ENOMEM;
 
@@ -1685,7 +1691,8 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
        }
        pr_info("done!\n");
 
-       if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
+       if (!request_mem_region(res->start, resource_size(res),
+                               pdev->name)) {
                pr_err("%s: ERROR: memory allocation failed"
                       "cannot get the I/O addr 0x%x\n",
                       __func__, (unsigned int)res->start);
@@ -1725,6 +1732,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
        priv->bus_id = plat_dat->bus_id;
        priv->pbl = plat_dat->pbl;      /* TLI */
        priv->is_gmac = plat_dat->has_gmac;     /* GMAC is on board */
+       priv->enh_desc = plat_dat->enh_desc;
 
        platform_set_drvdata(pdev, ndev);