aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac/stmmac_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/stmmac/stmmac_main.c')
-rw-r--r--drivers/net/stmmac/stmmac_main.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index a6733612d64a..7ac6ddea989e 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -44,6 +44,7 @@
44#include <linux/phy.h> 44#include <linux/phy.h>
45#include <linux/if_vlan.h> 45#include <linux/if_vlan.h>
46#include <linux/dma-mapping.h> 46#include <linux/dma-mapping.h>
47#include <linux/slab.h>
47#include "stmmac.h" 48#include "stmmac.h"
48 49
49#define STMMAC_RESOURCE_NAME "stmmaceth" 50#define STMMAC_RESOURCE_NAME "stmmaceth"
@@ -836,7 +837,7 @@ static int stmmac_open(struct net_device *dev)
836#ifdef CONFIG_STMMAC_TIMER 837#ifdef CONFIG_STMMAC_TIMER
837 priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); 838 priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
838 if (unlikely(priv->tm == NULL)) { 839 if (unlikely(priv->tm == NULL)) {
839 pr_err("%s: ERROR: timer memory alloc failed \n", __func__); 840 pr_err("%s: ERROR: timer memory alloc failed\n", __func__);
840 return -ENOMEM; 841 return -ENOMEM;
841 } 842 }
842 priv->tm->freq = tmrate; 843 priv->tm->freq = tmrate;
@@ -1279,7 +1280,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
1279 1280
1280 priv->dev->stats.rx_packets++; 1281 priv->dev->stats.rx_packets++;
1281 priv->dev->stats.rx_bytes += frame_len; 1282 priv->dev->stats.rx_bytes += frame_len;
1282 priv->dev->last_rx = jiffies;
1283 } 1283 }
1284 entry = next_entry; 1284 entry = next_entry;
1285 p = p_next; /* use prefetched values */ 1285 p = p_next; /* use prefetched values */
@@ -1586,6 +1586,12 @@ static int stmmac_mac_device_setup(struct net_device *dev)
1586 else 1586 else
1587 device = dwmac100_setup(ioaddr); 1587 device = dwmac100_setup(ioaddr);
1588 1588
1589 if (priv->enh_desc) {
1590 device->desc = &enh_desc_ops;
1591 pr_info("\tEnhanced descriptor structure\n");
1592 } else
1593 device->desc = &ndesc_ops;
1594
1589 if (!device) 1595 if (!device)
1590 return -ENOMEM; 1596 return -ENOMEM;
1591 1597
@@ -1685,7 +1691,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1685 } 1691 }
1686 pr_info("done!\n"); 1692 pr_info("done!\n");
1687 1693
1688 if (!request_mem_region(res->start, (res->end - res->start), 1694 if (!request_mem_region(res->start, resource_size(res),
1689 pdev->name)) { 1695 pdev->name)) {
1690 pr_err("%s: ERROR: memory allocation failed" 1696 pr_err("%s: ERROR: memory allocation failed"
1691 "cannot get the I/O addr 0x%x\n", 1697 "cannot get the I/O addr 0x%x\n",
@@ -1694,9 +1700,9 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1694 goto out; 1700 goto out;
1695 } 1701 }
1696 1702
1697 addr = ioremap(res->start, (res->end - res->start)); 1703 addr = ioremap(res->start, resource_size(res));
1698 if (!addr) { 1704 if (!addr) {
1699 pr_err("%s: ERROR: memory mapping failed \n", __func__); 1705 pr_err("%s: ERROR: memory mapping failed\n", __func__);
1700 ret = -ENOMEM; 1706 ret = -ENOMEM;
1701 goto out; 1707 goto out;
1702 } 1708 }
@@ -1726,6 +1732,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1726 priv->bus_id = plat_dat->bus_id; 1732 priv->bus_id = plat_dat->bus_id;
1727 priv->pbl = plat_dat->pbl; /* TLI */ 1733 priv->pbl = plat_dat->pbl; /* TLI */
1728 priv->is_gmac = plat_dat->has_gmac; /* GMAC is on board */ 1734 priv->is_gmac = plat_dat->has_gmac; /* GMAC is on board */
1735 priv->enh_desc = plat_dat->enh_desc;
1729 1736
1730 platform_set_drvdata(pdev, ndev); 1737 platform_set_drvdata(pdev, ndev);
1731 1738
@@ -1774,7 +1781,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1774out: 1781out:
1775 if (ret < 0) { 1782 if (ret < 0) {
1776 platform_set_drvdata(pdev, NULL); 1783 platform_set_drvdata(pdev, NULL);
1777 release_mem_region(res->start, (res->end - res->start)); 1784 release_mem_region(res->start, resource_size(res));
1778 if (addr != NULL) 1785 if (addr != NULL)
1779 iounmap(addr); 1786 iounmap(addr);
1780 } 1787 }
@@ -1812,7 +1819,7 @@ static int stmmac_dvr_remove(struct platform_device *pdev)
1812 1819
1813 iounmap((void *)ndev->base_addr); 1820 iounmap((void *)ndev->base_addr);
1814 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1821 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1815 release_mem_region(res->start, (res->end - res->start)); 1822 release_mem_region(res->start, resource_size(res));
1816 1823
1817 free_netdev(ndev); 1824 free_netdev(ndev);
1818 1825