Skip to content

Commit

Permalink
net: ti: icssg_prueth: use 10M half duplex as default
Browse files Browse the repository at this point in the history
Half duplex operation requires the INBAND mode to be configured
before the link is up. So make this 10M half duplex as default
so that INBAND mode is configured while link is down.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
  • Loading branch information
Murali Karicheri committed Nov 6, 2019
1 parent 612d0d5 commit 68d0db8
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions drivers/net/ethernet/ti/icssg_prueth.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,16 @@ static void prueth_emac_stop(struct prueth_emac *emac)
rproc_shutdown(prueth->pru[slice]);
}

static void emac_set_default_mii_config(struct prueth_emac *emac)
{
struct prueth *prueth = emac->prueth;
int slice = prueth_emac_slice(emac);

icssg_update_rgmii_cfg(prueth->miig_rt, SPEED_10,
false, slice);
icssg_update_mii_rt_cfg(prueth->mii_rt, SPEED_10, slice);
}

/* called back by PHY layer if there is change in link state of hw port*/
static void emac_adjust_link(struct net_device *ndev)
{
Expand Down Expand Up @@ -964,8 +974,8 @@ static void emac_adjust_link(struct net_device *ndev)
new_state = true;
emac->link = 0;
/* defaults for no link */
emac->speed = SPEED_1000;
emac->duplex = DUPLEX_FULL;
emac->speed = SPEED_10;
emac->duplex = DUPLEX_HALF;
}

if (new_state) {
Expand Down Expand Up @@ -996,10 +1006,7 @@ static void emac_adjust_link(struct net_device *ndev)
icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed,
slice);
} else {
icssg_update_rgmii_cfg(prueth->miig_rt, emac->speed,
true, slice);
icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed,
slice);
emac_set_default_mii_config(emac);
}
}

Expand Down Expand Up @@ -1138,6 +1145,8 @@ static int emac_ndo_open(struct net_device *ndev)
if (ret)
goto free_rx_mgm_irq;

emac_set_default_mii_config(emac);

/* start PHY */
phy_start(emac->phydev);

Expand Down

0 comments on commit 68d0db8

Please sign in to comment.