Skip to content

Commit 12e5572

Browse files
committed
net: add some debug to find issue in eth-mux
1 parent 8761383 commit 12e5572

3 files changed

Lines changed: 24 additions & 56 deletions

File tree

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4928,6 +4928,7 @@ static void mux_poll(struct work_struct *work)
49284928
unsigned int new_channel;
49294929
int sfp_present;
49304930

4931+
//dev_info(eth->dev, "ethernet mux: %s:%d\n",__func__,__LINE__);
49314932
if (IS_ERR(mux->mod_def0_gpio) || IS_ERR(mux->chan_sel_gpio))
49324933
goto reschedule;
49334934

@@ -4937,6 +4938,7 @@ static void mux_poll(struct work_struct *work)
49374938
if (mux->channel == new_channel || !netif_running(dev))
49384939
goto reschedule;
49394940

4941+
dev_info(eth->dev, "ethernet mux: line:%d new channel:%d,sfp:%d\n",__LINE__, new_channel,sfp_present);
49404942
rtnl_lock();
49414943

49424944
mtk_stop(dev);
@@ -4948,6 +4950,8 @@ static void mux_poll(struct work_struct *work)
49484950

49494951
gpiod_set_value_cansleep(mux->chan_sel_gpio, new_channel);
49504952

4953+
usleep_range(100000,200000);
4954+
49514955
mtk_open(dev);
49524956

49534957
rtnl_unlock();
@@ -5000,6 +5004,7 @@ static int mtk_add_mux_channel(struct mtk_mux *mux, struct device_node *np)
50005004
goto err_free_data;
50015005
}
50025006

5007+
dev_info(eth->dev, "ethernet mux: line:%d added new channel:%d\n",__LINE__,id);
50035008
data->of_node = np;
50045009
data->phylink = phylink;
50055010
mux->data[id] = data;
@@ -5072,7 +5077,7 @@ static int mtk_add_mux(struct mtk_eth *eth, struct device_node *np)
50725077

50735078
eth->mux[id] = mux;
50745079
mux->mac = eth->mac[id];
5075-
mux->channel = 0;
5080+
mux->channel = 0;//more than channels, just to make current channel invalid for switching the first time the gpio is read
50765081

50775082
mux->mod_def0_gpio = fwnode_gpiod_get_index(of_fwnode_handle(np),
50785083
"mod-def0", 0, GPIOD_IN |
@@ -5103,8 +5108,12 @@ static int mtk_add_mux(struct mtk_eth *eth, struct device_node *np)
51035108
of_node_put(child);
51045109
goto err_put_chan_sel;
51055110
}
5111+
//should set initial mux->channel be set if ! mux->sfp_present_channel?
51065112
}
51075113

5114+
gpiod_set_value_cansleep(mux->chan_sel_gpio, mux->sfp_present_channel ? 0 : 1);
5115+
5116+
dev_info(eth->dev, "ethernet mux: line:%d added new mux\n",__LINE__);
51085117
INIT_DELAYED_WORK(&mux->poll, mux_poll);
51095118
mod_delayed_work(system_wq, &mux->poll, msecs_to_jiffies(3000));
51105119

drivers/net/pcs/Kconfig.orig

Lines changed: 0 additions & 55 deletions
This file was deleted.

drivers/net/phy/phylink.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,14 +2651,18 @@ void phylink_start(struct phylink *pl)
26512651
*/
26522652
phylink_mac_initial_config(pl, true);
26532653

2654+
phylink_info(pl, "DBG %s:%d\n",__func__,__LINE__);
2655+
26542656
pl->pcs_state = PCS_STATE_STARTED;
26552657

26562658
/* link available PCS to phylink struct */
26572659
list_for_each_entry(pcs, &pl->pcs_list, list)
26582660
pcs->phylink = pl;
26592661

2662+
phylink_info(pl, "DBG %s:%d\n",__func__,__LINE__);
26602663
phylink_enable_and_run_resolve(pl, PHYLINK_DISABLE_STOPPED);
26612664

2665+
phylink_info(pl, "DBG %s:%d\n",__func__,__LINE__);
26622666
if (pl->cfg_link_an_mode == MLO_AN_FIXED && pl->link_gpio) {
26632667
int irq = gpiod_to_irq(pl->link_gpio);
26642668

@@ -2675,15 +2679,25 @@ void phylink_start(struct phylink *pl)
26752679
poll = true;
26762680
}
26772681

2682+
phylink_info(pl, "DBG %s:%d\n",__func__,__LINE__);
26782683
if (pl->cfg_link_an_mode == MLO_AN_FIXED)
2684+
{
2685+
phylink_info(pl, "DBG FXD %s:%d\n",__func__,__LINE__);
26792686
poll |= pl->config->poll_fixed_state;
2687+
}
26802688

26812689
if (poll)
26822690
mod_timer(&pl->link_poll, jiffies + HZ);
26832691
if (pl->phydev)
2692+
{
2693+
phylink_info(pl, "DBG PHY %s:%d\n",__func__,__LINE__);
26842694
phy_start(pl->phydev);
2695+
}
26852696
if (pl->sfp_bus)
2697+
{
2698+
phylink_info(pl, "DBG SFP %s:%d\n",__func__,__LINE__);
26862699
sfp_upstream_start(pl->sfp_bus);
2700+
}
26872701
}
26882702
EXPORT_SYMBOL_GPL(phylink_start);
26892703

0 commit comments

Comments
 (0)