Skip to content

Commit

Permalink
sh_eth: reuse sh_eth_chip_reset()
Browse files Browse the repository at this point in the history
All the chip_reset() methods repeat the code writing to the ARSTR register
and delaying for 1 ms, so that we can reuse sh_eth_chip_reset() twice.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sergei Shtylyov authored and David S. Miller committed May 9, 2016
1 parent 7927092 commit c66b258
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,7 @@ static struct sh_eth_cpu_data r7s72100_data = {

static void sh_eth_chip_reset_r8a7740(struct net_device *ndev)
{
struct sh_eth_private *mdp = netdev_priv(ndev);

/* reset device */
sh_eth_tsu_write(mdp, ARSTR_ARST, ARSTR);
mdelay(1);
sh_eth_chip_reset(ndev);

sh_eth_select_mii(ndev);
}
Expand Down Expand Up @@ -725,7 +721,6 @@ static struct sh_eth_cpu_data sh7757_data = {
#define GIGA_MAHR(port) (SH_GIGA_ETH_BASE + 0x800 * (port) + 0x05c0)
static void sh_eth_chip_reset_giga(struct net_device *ndev)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
u32 mahr[2], malr[2];
int i;

Expand All @@ -735,9 +730,7 @@ static void sh_eth_chip_reset_giga(struct net_device *ndev)
mahr[i] = ioread32((void *)GIGA_MAHR(i));
}

/* reset device */
sh_eth_tsu_write(mdp, ARSTR_ARST, ARSTR);
mdelay(1);
sh_eth_chip_reset(ndev);

/* restore MAHR and MALR */
for (i = 0; i < 2; i++) {
Expand Down

0 comments on commit c66b258

Please sign in to comment.