Skip to content

Commit 3e14c96

Browse files
Sergei Shtylyovdavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d9631c7 commit 3e14c96

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,7 +3222,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
32223222
eth_hw_addr_random(ndev);
32233223
}
32243224

3225-
/* ioremap the TSU registers */
32263225
if (mdp->cd->tsu) {
32273226
struct resource *rtsu;
32283227

@@ -3243,6 +3242,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
32433242
ret = -EBUSY;
32443243
goto out_release;
32453244
}
3245+
/* ioremap the TSU registers */
32463246
mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,
32473247
resource_size(rtsu));
32483248
if (!mdp->tsu_addr) {
@@ -3252,14 +3252,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
32523252
}
32533253
mdp->port = devno % 2;
32543254
ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER;
3255-
}
32563255

3257-
/* Need to init only the first port of the two sharing a TSU */
3258-
if (devno % 2 == 0) {
3259-
if (mdp->cd->chip_reset)
3260-
mdp->cd->chip_reset(ndev);
3256+
/* Need to init only the first port of the two sharing a TSU */
3257+
if (devno % 2 == 0) {
3258+
if (mdp->cd->chip_reset)
3259+
mdp->cd->chip_reset(ndev);
32613260

3262-
if (mdp->cd->tsu) {
32633261
/* TSU init (Init only)*/
32643262
sh_eth_tsu_init(mdp);
32653263
}

0 commit comments

Comments
 (0)