aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2018-01-14 12:47:43 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-15 15:09:45 -0500
commit3e14c969a4ecdb4b4a05fb5c806d4f525fe56cff (patch)
tree9b4319dd46174b9f05868cb5aeab5caab74460bf
parentd9631c7a5decd657265627cec2d27dd8ed972985 (diff)
sh_eth: gather all TSU init code in one place
The sh_eth_cpu_data::chip_reset() method always resets using ARSTR and this register is always located at the start of the TSU register region. Therefore, we can only call this method if we know TSU is there and thus simplify the probing code a bit... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7aa1c12750b3..14d5373ddc6b 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3222,7 +3222,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
3222 eth_hw_addr_random(ndev); 3222 eth_hw_addr_random(ndev);
3223 } 3223 }
3224 3224
3225 /* ioremap the TSU registers */
3226 if (mdp->cd->tsu) { 3225 if (mdp->cd->tsu) {
3227 struct resource *rtsu; 3226 struct resource *rtsu;
3228 3227
@@ -3243,6 +3242,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
3243 ret = -EBUSY; 3242 ret = -EBUSY;
3244 goto out_release; 3243 goto out_release;
3245 } 3244 }
3245 /* ioremap the TSU registers */
3246 mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start, 3246 mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,
3247 resource_size(rtsu)); 3247 resource_size(rtsu));
3248 if (!mdp->tsu_addr) { 3248 if (!mdp->tsu_addr) {
@@ -3252,14 +3252,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
3252 } 3252 }
3253 mdp->port = devno % 2; 3253 mdp->port = devno % 2;
3254 ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER; 3254 ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER;
3255 }
3256 3255
3257 /* Need to init only the first port of the two sharing a TSU */ 3256 /* Need to init only the first port of the two sharing a TSU */
3258 if (devno % 2 == 0) { 3257 if (devno % 2 == 0) {
3259 if (mdp->cd->chip_reset) 3258 if (mdp->cd->chip_reset)
3260 mdp->cd->chip_reset(ndev); 3259 mdp->cd->chip_reset(ndev);
3261 3260
3262 if (mdp->cd->tsu) {
3263 /* TSU init (Init only)*/ 3261 /* TSU init (Init only)*/
3264 sh_eth_tsu_init(mdp); 3262 sh_eth_tsu_init(mdp);
3265 } 3263 }