分析发现eth0的carrier不是1,怀疑是交换机时钟没开启,读取
/ # cat /sys/kernel/debug/clk/clk_summary
右边是有问题的:
在gephy_gcc_tx clk打开的时候,打印调用栈:
[ 14.047107] [<81310018>] (unwind_backtrace) from [<8130b488>] (show_stack+0x10/0x14)
[ 14.051530] [<8130b488>] (show_stack) from [<81955fb8>] (dump_stack_lvl+0x40/0x4c)
[ 14.059335] [<81955fb8>] (dump_stack_lvl) from [<81690c3c>] (clk_core_prepare+0x34c/0x350)
[ 14.066716] [<81690c3c>] (clk_core_prepare) from [<81690c84>] (clk_core_prepare_enable+0x14/0x68)
[ 14.074960] [<81690c84>] (clk_core_prepare_enable) from [<81690d48>] (__clk_set_parent_before+0x70/0x8c)
[ 14.083902] [<81690d48>] (__clk_set_parent_before) from [<81692264>] (clk_change_rate+0x60/0x578)
[ 14.093450] [<81692264>] (clk_change_rate) from [<816928f4>] (clk_core_set_rate_nolock+0x178/0x244)
[ 14.102217] [<816928f4>] (clk_core_set_rate_nolock) from [<816929f0>] (clk_set_rate+0x30/0x154)
[ 14.111070] [<816929f0>] (clk_set_rate) from [<7f059a58>] (ssdk_uniphy_clock_rate_set+0x80/0xf4 [ssdk])
[ 14.119761] [<7f059a58>] (ssdk_uniphy_clock_rate_set [ssdk]) from [<7f05a9f8>] (ssdk_port_speed_clock_set+0x40/0x54 [ssdk])
[ 14.129137] [<7f05a9f8>] (ssdk_port_speed_clock_set [ssdk]) from [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set+0x60/0x7c [ssdk])
[ 14.140248] [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set [ssdk]) from [<7f002d04>] (adpt_mp_port_link_up_change_update+0xfc/0x1f8 [ssdk])
[ 14.152055] [<7f002d04>] (adpt_mp_port_link_up_change_update [ssdk]) from [<7f002f54>] (adpt_mp_port_link_up_update+0x154/0x180 [ssdk])
[ 14.164816] [<7f002f54>] (adpt_mp_port_link_up_update [ssdk]) from [<7f00314c>] (adpt_mp_port_netdev_change_notify+0x1cc/0x2f0 [ssdk])
[ 14.176708] [<7f00314c>] (adpt_mp_port_netdev_change_notify [ssdk]) from [<7f054780>] (ssdk_dev_event+0x160/0x278 [ssdk])
[ 14.188858] [<7f054780>] (ssdk_dev_event [ssdk]) from [<81345acc>] (raw_notifier_call_chain+0x34/0x68)
[ 14.199878] [<81345acc>] (raw_notifier_call_chain) from [<817d5de4>] (netdev_state_change+0x60/0x80)
[ 14.209076] [<817d5de4>] (netdev_state_change) from [<817f7214>] (linkwatch_do_dev+0x48/0x7c)
[ 14.218364] [<817f7214>] (linkwatch_do_dev) from [<817f7470>] (__linkwatch_run_queue+0xe4/0x1f4)
[ 14.226783] [<817f7470>] (__linkwatch_run_queue) from [<817f75ac>] (linkwatch_event+0x2c/0x34)
[ 14.235636] [<817f75ac>] (linkwatch_event) from [<8133e1c0>] (process_one_work+0x1dc/0x584)
[ 14.244057] [<8133e1c0>] (process_one_work) from [<8133e9f4>] (worker_thread+0x5c/0x568)
[ 14.252303] [<8133e9f4>] (worker_thread) from [<81344b14>] (kthread+0x15c/0x190)
[ 14.260635] [<81344b14>] (kthread) from [<81300130>] (ret_from_fork+0x14/0x24)
[ 14.268012] Exception stack(0x808a9fb0 to 0x808a9ff8)
[ 14.275045] 9fa0: 00000000 00000000 00000000 00000000
[ 14.280171] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 14.288330] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 14.297470] clk gephy_gcc_tx enable 0
[ 14.302909] CPU: 0 PID: 5 Comm: kworker/0:0 Tainted: G O 5.15.38+ #2
[ 14.306728] Hardware name: Generic DT based system
[ 14.314195] Workqueue: events linkwatch_event
[ 14.319058] [<81310018>] (unwind_backtrace) from [<8130b488>] (show_stack+0x10/0x14)
[ 14.323484] [<8130b488>] (show_stack) from [<81955fb8>] (dump_stack_lvl+0x40/0x4c)
[ 14.331296] [<81955fb8>] (dump_stack_lvl) from [<8169029c>] (clk_core_enable+0x364/0x368)
[ 14.338676] [<8169029c>] (clk_core_enable) from [<81690cac>] (clk_core_prepare_enable+0x3c/0x68)
[ 14.346921] [<81690cac>] (clk_core_prepare_enable) from [<81690d48>] (__clk_set_parent_before+0x70/0x8c)
[ 14.355777] [<81690d48>] (__clk_set_parent_before) from [<81692264>] (clk_change_rate+0x60/0x578)
[ 14.365238] [<81692264>] (clk_change_rate) from [<816928f4>] (clk_core_set_rate_nolock+0x178/0x244)
[ 14.374005] [<816928f4>] (clk_core_set_rate_nolock) from [<816929f0>] (clk_set_rate+0x30/0x154)
[ 14.382858] [<816929f0>] (clk_set_rate) from [<7f059a58>] (ssdk_uniphy_clock_rate_set+0x80/0xf4 [ssdk])
[ 14.391548] [<7f059a58>] (ssdk_uniphy_clock_rate_set [ssdk]) from [<7f05a9f8>] (ssdk_port_speed_clock_set+0x40/0x54 [ssdk])
[ 14.400923] [<7f05a9f8>] (ssdk_port_speed_clock_set [ssdk]) from [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set+0x60/0x7c [ssdk])
[ 14.412036] [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set [ssdk]) from [<7f002d04>] (adpt_mp_port_link_up_change_update+0xfc/0x1f8 [ssdk])
[ 14.423842] [<7f002d04>] (adpt_mp_port_link_up_change_update [ssdk]) from [<7f002f54>] (adpt_mp_port_link_up_update+0x154/0x180 [ssdk])
[ 14.436602] [<7f002f54>] (adpt_mp_port_link_up_update [ssdk]) from [<7f00314c>] (adpt_mp_port_netdev_change_notify+0x1cc/0x2f0 [ssdk])
[ 14.448494] [<7f00314c>] (adpt_mp_port_netdev_change_notify [ssdk]) from [<7f054780>] (ssdk_dev_event+0x160/0x278 [ssdk])
[ 14.460646] [<7f054780>] (ssdk_dev_event [ssdk]) from [<81345acc>] (raw_notifier_call_chain+0x34/0x68)
[ 14.471666] [<81345acc>] (raw_notifier_call_chain) from [<817d5de4>] (netdev_state_change+0x60/0x80)
[ 14.480866] [<817d5de4>] (netdev_state_change) from [<817f7214>] (linkwatch_do_dev+0x48/0x7c)
[ 14.490151] [<817f7214>] (linkwatch_do_dev) from [<817f7470>] (__linkwatch_run_queue+0xe4/0x1f4)
[ 14.498572] [<817f7470>] (__linkwatch_run_queue) from [<817f75ac>] (linkwatch_event+0x2c/0x34)
[ 14.507426] [<817f75ac>] (linkwatch_event) from [<8133e1c0>] (process_one_work+0x1dc/0x584)
[ 14.515846] [<8133e1c0>] (process_one_work) from [<8133e9f4>] (worker_thread+0x5c/0x568)
[ 14.524091] [<8133e9f4>] (worker_thread) from [<81344b14>] (kthread+0x15c/0x190)
[ 14.532424] [<81344b14>] (kthread) from [<81300130>] (ret_from_fork+0x14/0x24)
[ 14.539801] Exception stack(0x808a9fb0 to 0x808a9ff8)
[ 14.546833] 9fa0: 00000000 00000000 00000000 00000000
[ 14.551960] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 14.560118] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 14.569126] gephy_gcc_tx prepare 1
[ 14.574823] CPU: 0 PID: 5 Comm: kworker/0:0 Tainted: G O 5.15.38+ #2
[ 14.578176] Hardware name: Generic DT based system
[ 14.585727] Workqueue: events linkwatch_event
[ 14.590586] [<81310018>] (unwind_backtrace) from [<8130b488>] (show_stack+0x10/0x14)
[ 14.595013] [<8130b488>] (show_stack) from [<81955fb8>] (dump_stack_lvl+0x40/0x4c)
[ 14.602825] [<81955fb8>] (dump_stack_lvl) from [<81690c3c>] (clk_core_prepare+0x34c/0x350)
[ 14.610204] [<81690c3c>] (clk_core_prepare) from [<81690c84>] (clk_core_prepare_enable+0x14/0x68)
[ 14.618449] [<81690c84>] (clk_core_prepare_enable) from [<81690d48>] (__clk_set_parent_before+0x70/0x8c)
[ 14.627392] [<81690d48>] (__clk_set_parent_before) from [<81692264>] (clk_change_rate+0x60/0x578)
[ 14.636940] [<81692264>] (clk_change_rate) from [<816928f4>] (clk_core_set_rate_nolock+0x178/0x244)
[ 14.645706] [<816928f4>] (clk_core_set_rate_nolock) from [<816929f0>] (clk_set_rate+0x30/0x154)
[ 14.654561] [<816929f0>] (clk_set_rate) from [<7f059a58>] (ssdk_uniphy_clock_rate_set+0x80/0xf4 [ssdk])
[ 14.663250] [<7f059a58>] (ssdk_uniphy_clock_rate_set [ssdk]) from [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set+0x60/0x7c [ssdk])
[ 14.672626] [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set [ssdk]) from [<7f002d04>] (adpt_mp_port_link_up_change_update+0xfc/0x1f8 [ssdk])
[ 14.684435] [<7f002d04>] (adpt_mp_port_link_up_change_update [ssdk]) from [<7f002f54>] (adpt_mp_port_link_up_update+0x154/0x180 [ssdk])
[ 14.697280] [<7f002f54>] (adpt_mp_port_link_up_update [ssdk]) from [<7f00314c>] (adpt_mp_port_netdev_change_notify+0x1cc/0x2f0 [ssdk])
[ 14.709172] [<7f00314c>] (adpt_mp_port_netdev_change_notify [ssdk]) from [<7f054780>] (ssdk_dev_event+0x160/0x278 [ssdk])
[ 14.721323] [<7f054780>] (ssdk_dev_event [ssdk]) from [<81345acc>] (raw_notifier_call_chain+0x34/0x68)
[ 14.732343] [<81345acc>] (raw_notifier_call_chain) from [<817d5de4>] (netdev_state_change+0x60/0x80)
[ 14.741543] [<817d5de4>] (netdev_state_change) from [<817f7214>] (linkwatch_do_dev+0x48/0x7c)
[ 14.750828] [<817f7214>] (linkwatch_do_dev) from [<817f7470>] (__linkwatch_run_queue+0xe4/0x1f4)
[ 14.759249] [<817f7470>] (__linkwatch_run_queue) from [<817f75ac>] (linkwatch_event+0x2c/0x34)
[ 14.768101] [<817f75ac>] (linkwatch_event) from [<8133e1c0>] (process_one_work+0x1dc/0x584)
[ 14.776523] [<8133e1c0>] (process_one_work) from [<8133e9f4>] (worker_thread+0x5c/0x568)
[ 14.784768] [<8133e9f4>] (worker_thread) from [<81344b14>] (kthread+0x15c/0x190)
[ 14.793099] [<81344b14>] (kthread) from [<81300130>] (ret_from_fork+0x14/0x24)
[ 14.800478] Exception stack(0x808a9fb0 to 0x808a9ff8)
[ 14.807510] 9fa0: 00000000 00000000 00000000 00000000
[ 14.812637] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 14.820795] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 14.829873] clk gephy_gcc_tx enable 1
[ 14.835374] CPU: 0 PID: 5 Comm: kworker/0:0 Tainted: G O 5.15.38+ #2
[ 14.839193] Hardware name: Generic DT based system
[ 14.846658] Workqueue: events linkwatch_event
[ 14.851523] [<81310018>] (unwind_backtrace) from [<8130b488>] (show_stack+0x10/0x14)
[ 14.855949] [<8130b488>] (show_stack) from [<81955fb8>] (dump_stack_lvl+0x40/0x4c)
[ 14.863761] [<81955fb8>] (dump_stack_lvl) from [<8169029c>] (clk_core_enable+0x364/0x368)
[ 14.871141] [<8169029c>] (clk_core_enable) from [<81690cac>] (clk_core_prepare_enable+0x3c/0x68)
[ 14.879387] [<81690cac>] (clk_core_prepare_enable) from [<81690d48>] (__clk_set_parent_before+0x70/0x8c)
[ 14.888242] [<81690d48>] (__clk_set_parent_before) from [<81692264>] (clk_change_rate+0x60/0x578)
[ 14.897703] [<81692264>] (clk_change_rate) from [<816928f4>] (clk_core_set_rate_nolock+0x178/0x244)
[ 14.906470] [<816928f4>] (clk_core_set_rate_nolock) from [<816929f0>] (clk_set_rate+0x30/0x154)
[ 14.915324] [<816929f0>] (clk_set_rate) from [<7f059a58>] (ssdk_uniphy_clock_rate_set+0x80/0xf4 [ssdk])
[ 14.924013] [<7f059a58>] (ssdk_uniphy_clock_rate_set [ssdk]) from [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set+0x60/0x7c [ssdk])
[ 14.933390] [<7f00129c>] (_adpt_mp_port_gcc_speed_clock_set [ssdk]) from [<7f002d04>] (adpt_mp_port_link_up_change_update+0xfc/0x1f8 [ssdk])
[ 14.945196] [<7f002d04>] (adpt_mp_port_link_up_change_update [ssdk]) from [<7f002f54>] (adpt_mp_port_link_up_update+0x154/0x180 [ssdk])
[ 14.958042] [<7f002f54>] (adpt_mp_port_link_up_update [ssdk]) from [<7f00314c>] (adpt_mp_port_netdev_change_notify+0x1cc/0x2f0 [ssdk])
[ 14.969936] [<7f00314c>] (adpt_mp_port_netdev_change_notify [ssdk]) from [<7f054780>] (ssdk_dev_event+0x160/0x278 [ssdk])
[ 14.982087] [<7f054780>] (ssdk_dev_event [ssdk]) from [<81345acc>] (raw_notifier_call_chain+0x34/0x68)
[ 14.993107] [<81345acc>] (raw_notifier_call_chain) from [<817d5de4>] (netdev_state_change+0x60/0x80)
[ 15.002306] [<817d5de4>] (netdev_state_change) from [<817f7214>] (linkwatch_do_dev+0x48/0x7c)
[ 15.011593] [<817f7214>] (linkwatch_do_dev) from [<817f7470>] (__linkwatch_run_queue+0xe4/0x1f4)
[ 15.020012] [<817f7470>] (__linkwatch_run_queue) from [<817f75ac>] (linkwatch_event+0x2c/0x34)
[ 15.028865] [<817f75ac>] (linkwatch_event) from [<8133e1c0>] (process_one_work+0x1dc/0x584)
[ 15.037287] [<8133e1c0>] (process_one_work) from [<8133e9f4>] (worker_thread+0x5c/0x568)
[ 15.045531] [<8133e9f4>] (worker_thread) from [<81344b14>] (kthread+0x15c/0x190)
[ 15.053865] [<81344b14>] (kthread) from [<81300130>] (ret_from_fork+0x14/0x24)
测试中还发现一个问题,启动后,发现wan口port 4没有up。上面的log看,也是交换机的port up了,导致mp的port up,才会去打开gcc。所以根本原因可能还是交换机有问题。
[ 8.604469] qca_ar8327_gpio_reset[3523]:INFO:GPIO26 reset switch done
[ 8.604655] ssdk_switch_register[1751]:INFO:Chip version 0x1302
[ 8.609901] qca_link_polling_select[1348]:INFO:link-polling-required node does not exist
[ 8.414498] qca_ar8327_gpio_reset[3663]:ERROR:gpio26 request failed, ret:-517
[ 8.425255] ssdk_switch_register[1870]:INFO:Chip version 0x1302
[ 8.432313] qca_link_polling_select[1370]:INFO:link-polling-required node does not exist
发现是gpiochip的base不对。将其修改为0,后就可以了
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 8476a8a..bef2cd1 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -1248,7 +1248,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
return -EINVAL;
chip = &pctrl->chip;
- chip->base = -1;
+ chip->base = 0;
chip->ngpio = ngpio;
chip->label = dev_name(pctrl->dev);
chip->parent = pctrl->dev;
--
2.25.1
这样每次启动都会去通过gpio reset交换机。多次重启测试,不再复现问题。