Subject: Beaglebone Ethernet Probe Failure In 6.8+

From: Colin Foster <[email-masked]>
Date: Wed, 17 Apr 2024 10:42:02 -0500

Hello,

I'm chasing down an issue in recent kernels. My setup is slightly
unconventional: a BBB with ETH0 as a CPU port to a DSA switch that is
controlled by SPI. I'll have hardware next week, but think it is worth
getting a discussion going.

The commit in question is commit df16c1c51d81 ("net: phy: mdio_device:
Reset device only when necessary"). This seems to cause a probe error of
the MDIO device. A dump_stack was added where the reset is skipped.

SMSC LAN8710/LAN8720: probe of 4a101000.mdio:00 failed with error -5

(actual dmesg is below)

Because this failure happens much earlier than DSA, I suspect is isn't
isolated to me and my setup - but I'm not positive at the moment.

I suspect one of the following:

1. There's an issue with my setup / configuration.

2. This is an issue for every BBB device, but probe failures don't
actually break functionality.

Depending on which of those is the case, I'll either need to:

A. revert the patch because it is causing probe failures

B. determine why the probe is failing in the MDIO driver and try to fix
that

C. Introduce an API to force resets, regardless of the previous state,
and apply that to the failure cases.

I assume the path forward is option B... but if the issue is more
widespread, options A or C might be the correct path.

I'll be able to test on hardware again next week if there's more
information needed.

[    1.539656] mdio_bus 4a101000.mdio:00: using DT '/ocp/interconnect@4a000000/segment@0/target-module@100000/switch@0/mdio@1000/ethernet-phy@0' for 'reset' GPIO lookup
[    1.539911] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/ocp/interconnect@4a000000/segment@0/target-module@100000/switch@0/mdio@1000/ethernet-phy@0[0]' - status (0)
[    1.540193] gpio gpiochip0: Persistence not supported for GPIO 8
[    1.548962] CPU: 0 PID: 25 Comm: kworker/u2:2 Not tainted 6.7.0-rc3-00667-gdf16c1c51d81-dirty #1407
[    1.548991] Hardware name: Generic AM33XX (Flattened Device Tree)
[    1.549004] Workqueue: events_unbound deferred_probe_work_func
[    1.549044] Backtrace: 
[    1.549055]  dump_backtrace from show_stack+0x20/0x24
[    1.549098]  show_stack from dump_stack_lvl+0x60/0x78
[    1.549127]  dump_stack_lvl from dump_stack+0x18/0x1c
[    1.549156]  dump_stack from mdio_device_reset+0xc4/0xfc
[    1.549183]  mdio_device_reset from phy_probe+0x6c/0x488
[    1.549209]  phy_probe from really_probe+0xd8/0x2e8
[    1.549243]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.549266]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.549291]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.549317]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.549356]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.549384]  __device_attach from device_initial_probe+0x1c/0x20
[    1.549408]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.549422]  bus_probe_device from device_add+0x5a8/0x778
[    1.549450]  device_add from phy_device_register+0x50/0x90
[    1.549485]  phy_device_register from fwnode_mdiobus_phy_device_register+0xd0/0x114
[    1.549511]  fwnode_mdiobus_phy_device_register from fwnode_mdiobus_register_phy+0x16c/0x1c0
[    1.549539]  fwnode_mdiobus_register_phy from __of_mdiobus_register+0x150/0x38c
[    1.549568]  __of_mdiobus_register from davinci_mdio_probe+0x2ac/0x474
[    1.549613]  davinci_mdio_probe from platform_probe+0x6c/0xcc
[    1.549646]  platform_probe from really_probe+0xd8/0x2e8
[    1.549671]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.549695]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.549720]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.549745]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.549774]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.549802]  __device_attach from device_initial_probe+0x1c/0x20
[    1.549825]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.549839]  bus_probe_device from device_add+0x5a8/0x778
[    1.549867]  device_add from of_device_add+0x44/0x4c
[    1.549909]  of_device_add from of_platform_device_create_pdata+0xa0/0xd0
[    1.549927]  of_platform_device_create_pdata from of_platform_bus_create+0x1b4/0x384
[    1.549956]  of_platform_bus_create from of_platform_populate+0x80/0xe4
[    1.549991]  of_platform_populate from devm_of_platform_populate+0x60/0xa8
[    1.550026]  devm_of_platform_populate from cpsw_probe+0x214/0xd2c
[    1.550060]  cpsw_probe from platform_probe+0x6c/0xcc
[    1.550096]  platform_probe from really_probe+0xd8/0x2e8
[    1.550121]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.550145]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.550170]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.550196]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.550224]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.550252]  __device_attach from device_initial_probe+0x1c/0x20
[    1.550274]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.550288]  bus_probe_device from device_add+0x5a8/0x778
[    1.550316]  device_add from of_device_add+0x44/0x4c
[    1.550353]  of_device_add from of_platform_device_create_pdata+0xa0/0xd0
[    1.550369]  of_platform_device_create_pdata from of_platform_bus_create+0x1b4/0x384
[    1.550398]  of_platform_bus_create from of_platform_populate+0x80/0xe4
[    1.550433]  of_platform_populate from sysc_probe+0xff0/0x148c
[    1.550479]  sysc_probe from platform_probe+0x6c/0xcc
[    1.550516]  platform_probe from really_probe+0xd8/0x2e8
[    1.550541]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.550565]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.550589]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.550615]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.550644]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.550673]  __device_attach from device_initial_probe+0x1c/0x20
[    1.550696]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.550709]  bus_probe_device from device_add+0x5a8/0x778
[    1.550738]  device_add from of_device_add+0x44/0x4c
[    1.550773]  of_device_add from of_platform_device_create_pdata+0xa0/0xd0
[    1.550790]  of_platform_device_create_pdata from of_platform_bus_create+0x1b4/0x384
[    1.550819]  of_platform_bus_create from of_platform_populate+0x80/0xe4
[    1.550854]  of_platform_populate from simple_pm_bus_probe+0xd8/0xfc
[    1.550890]  simple_pm_bus_probe from platform_probe+0x6c/0xcc
[    1.550919]  platform_probe from really_probe+0xd8/0x2e8
[    1.550944]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.550968]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.550992]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.551019]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.551047]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.551075]  __device_attach from device_initial_probe+0x1c/0x20
[    1.551098]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.551111]  bus_probe_device from device_add+0x5a8/0x778
[    1.551139]  device_add from of_device_add+0x44/0x4c
[    1.551175]  of_device_add from of_platform_device_create_pdata+0xa0/0xd0
[    1.551192]  of_platform_device_create_pdata from of_platform_bus_create+0x1b4/0x384
[    1.551220]  of_platform_bus_create from of_platform_populate+0x80/0xe4
[    1.551255]  of_platform_populate from simple_pm_bus_probe+0xd8/0xfc
[    1.551291]  simple_pm_bus_probe from platform_probe+0x6c/0xcc
[    1.551320]  platform_probe from really_probe+0xd8/0x2e8
[    1.551345]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.551369]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.551394]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.551419]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.551448]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.551476]  __device_attach from device_initial_probe+0x1c/0x20
[    1.551499]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.551513]  bus_probe_device from device_add+0x5a8/0x778
[    1.551541]  device_add from of_device_add+0x44/0x4c
[    1.551577]  of_device_add from of_platform_device_create_pdata+0xa0/0xd0
[    1.551593]  of_platform_device_create_pdata from of_platform_bus_create+0x1b4/0x384
[    1.551622]  of_platform_bus_create from of_platform_populate+0x80/0xe4
[    1.551657]  of_platform_populate from simple_pm_bus_probe+0xd8/0xfc
[    1.551693]  simple_pm_bus_probe from platform_probe+0x6c/0xcc
[    1.551722]  platform_probe from really_probe+0xd8/0x2e8
[    1.551747]  really_probe from __driver_probe_device+0x98/0x1b0
[    1.551770]  __driver_probe_device from driver_probe_device+0x40/0x114
[    1.551795]  driver_probe_device from __device_attach_driver+0xa4/0x10c
[    1.551821]  __device_attach_driver from bus_for_each_drv+0x94/0xec
[    1.551850]  bus_for_each_drv from __device_attach+0xbc/0x1e0
[    1.551878]  __device_attach from device_initial_probe+0x1c/0x20
[    1.551901]  device_initial_probe from bus_probe_device+0x98/0x9c
[    1.551915]  bus_probe_device from deferred_probe_work_func+0x88/0xb4
[    1.551940]  deferred_probe_work_func from process_one_work+0x170/0x43c
[    1.551971]  process_one_work from worker_thread+0x2c4/0x4ec
[    1.552006]  worker_thread from kthread+0x114/0x148
[    1.552040]  kthread from ret_from_fork+0x14/0x28
[    1.552056] Exception stack(0xe006dfb0 to 0xe006dff8)
[    1.552069] dfa0:                                     00000000 00000000 00000000 00000000
[    1.552081] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.552091] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.552103]  r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c037b070 r4:c21d6140
[    1.553623] SMSC LAN8710/LAN8720: probe of 4a101000.mdio:00 failed with error -5
[    1.553762] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    1.554978] cpsw-switch 4a100000.switch: initialized cpsw ale version 1.4
[    1.555011] cpsw-switch 4a100000.switch: ALE Table size 1024
[    1.555210] cpsw-switch 4a100000.switch: cpts: overflow check period 500 (jiffies)
[    1.555234] cpsw-switch 4a100000.switch: CPTS: ref_clk_freq:250000000 calc_mult:2147483648 calc_shift:29 error:0 nsec/sec
[    1.555343] cpsw-switch 4a100000.switch: Detected MACID = 24:76:25:76:35:37
[    1.558098] cpsw-switch 4a100000.switch: initialized (regs 0x4a100000, pool size 256) hw_ver:0019010C 1.12 (0)
[    1.600301] debugfs: Directory '49000000.dma' with parent 'dmaengine' already present!
[    1.600356] edma 49000000.dma: TI EDMA DMA engine driver