aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2012-02-15 12:55:01 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-16 17:08:09 -0500
commit6ba88021c36516c26c11eff8c6d7d9a045faecd3 (patch)
tree488e0bb3a739f229fc832c4150f03842b8847cac /drivers/net/ethernet
parent150647fb2c313d7c5184fca3fa0829a4a7d6f7bc (diff)
net: sh_eth: modify a condition of ioremap for TSU
If the controller has TSU, the each channel needs TSU registers. This patch also fixes the iounmap condition in the sh_eth_drv_remove(). Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 5a5afbc7273b..8bd0e5897424 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1859,18 +1859,20 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
1859 /* read and set MAC address */ 1859 /* read and set MAC address */
1860 read_mac_address(ndev, pd->mac_addr); 1860 read_mac_address(ndev, pd->mac_addr);
1861 1861
1862 /* ioremap the TSU registers */
1863 if (mdp->cd->tsu) {
1864 struct resource *rtsu;
1865 rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1866 if (!rtsu) {
1867 dev_err(&pdev->dev, "Not found TSU resource\n");
1868 goto out_release;
1869 }
1870 mdp->tsu_addr = ioremap(rtsu->start,
1871 resource_size(rtsu));
1872 }
1873
1862 /* initialize first or needed device */ 1874 /* initialize first or needed device */
1863 if (!devno || pd->needs_init) { 1875 if (!devno || pd->needs_init) {
1864 if (mdp->cd->tsu) {
1865 struct resource *rtsu;
1866 rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1867 if (!rtsu) {
1868 dev_err(&pdev->dev, "Not found TSU resource\n");
1869 goto out_release;
1870 }
1871 mdp->tsu_addr = ioremap(rtsu->start,
1872 resource_size(rtsu));
1873 }
1874 if (mdp->cd->chip_reset) 1876 if (mdp->cd->chip_reset)
1875 mdp->cd->chip_reset(ndev); 1877 mdp->cd->chip_reset(ndev);
1876 1878
@@ -1919,7 +1921,8 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
1919 struct net_device *ndev = platform_get_drvdata(pdev); 1921 struct net_device *ndev = platform_get_drvdata(pdev);
1920 struct sh_eth_private *mdp = netdev_priv(ndev); 1922 struct sh_eth_private *mdp = netdev_priv(ndev);
1921 1923
1922 iounmap(mdp->tsu_addr); 1924 if (mdp->cd->tsu)
1925 iounmap(mdp->tsu_addr);
1923 sh_mdio_release(ndev); 1926 sh_mdio_release(ndev);
1924 unregister_netdev(ndev); 1927 unregister_netdev(ndev);
1925 pm_runtime_disable(&pdev->dev); 1928 pm_runtime_disable(&pdev->dev);