[net-next,v2,4/6] net: mdio: scan bus based on bus capabilities for C22 and C45

Message ID 20230116-net-next-remove-probe-capabilities-v2-4-15513b05e1f4@walle.cc
State New
Headers
Series net: phy: Remove probe_capabilities |

Commit Message

Michael Walle Jan. 18, 2023, 10:01 a.m. UTC
  From: Andrew Lunn <andrew@lunn.ch>

Now that all MDIO bus drivers which set probe_capabilities to
MDIOBUS_C22_C45 have been converted to use the name API for C45
transactions, perform the scanning of the bus based on which methods
the bus provides.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
 drivers/net/phy/mdio_bus.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
  

Comments

Klaus Kudielka March 5, 2023, 6:13 p.m. UTC | #1
On Wed, 2023-01-18 at 11:01 +0100, Michael Walle wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> 
> Now that all MDIO bus drivers which set probe_capabilities to
> MDIOBUS_C22_C45 have been converted to use the name API for C45
> transactions, perform the scanning of the bus based on which methods
> the bus provides.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Michael Walle <michael@walle.cc>
> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>

Hello,

On a Turris Omnia (Armada 385, Marvell 88E6176) this commit results
in a strange boot behaviour. I see two distinct multi-second freezes
in dmesg. Usually (up to the commit before), the (monolithic) kernel
starts init after ~1.6 seconds, now it takes more than 6....

dmesg output below. Any idea, why this is happening?

Best regards, Klaus

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.2.0-rc3+ (xxxx) (arm-linux-gnueabihf-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP Sun Mar  5 16:20:57 CET 2023
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Turris Omnia
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000002fffffff]
[    0.000000]   HighMem  [mem 0x0000000030000000-0x000000003fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000003fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000003fffffff]
[    0.000000] percpu: Embedded 12 pages/cpu s19604 r8192 d21356 u49152
[    0.000000] pcpu-alloc: s19604 r8192 d21356 u49152 alloc=12*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 260416
[    0.000000] Kernel command line: console=ttyS0,115200 quiet root=PARTUUID=262ecdb3-01 mvneta.txq_number=2 mvneta.rxq_number=2
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 1022716K/1048576K available (7168K kernel code, 590K rwdata, 1776K rodata, 1024K init, 233K bss, 25860K reserved, 0K cma-reserved, 262144K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] L2C: DT/platform modifies aux control register: 0x06070000 -> 0x16070000
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 D prefetch enabled, offset 1 lines
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 Coherent cache controller enabled, 16 ways, 1024 kB
[    0.000000] L2C-310 Coherent: CACHE_ID 0x410054c9, AUX_CTRL 0x56070001
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000001] sched_clock: 64 bits at 800MHz, resolution 1ns, wraps every 4398046511103ns
[    0.000012] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0xb881274fa3, max_idle_ns: 440795210636 ns
[    0.000026] Switching to timer-based delay loop, resolution 1ns
[    0.000153] Ignoring duplicate/late registration of read_current_timer delay
[    0.000159] clocksource: armada_370_xp_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 76450417870 ns
[    0.000302] Calibrating delay loop (skipped), value calculated using timer frequency.. 1600.00 BogoMIPS (lpj=3200000)
[    0.000310] pid_max: default: 32768 minimum: 301
[    0.000396] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.000403] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.000726] CPU: Testing write buffer coherency: ok
[    0.000749] CPU0: Spectre v2: using BPIALL workaround
[    0.000864] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.001188] cblist_init_generic: Setting adjustable number of callback queues.
[    0.001192] cblist_init_generic: Setting shift to 1 and lim to 1.
[    0.001241] Setting up static identity map for 0x100000 - 0x100060
[    0.001314] mvebu-soc-id: MVEBU SoC ID=0x6820, Rev=0x4
[    0.001393] mvebu-pmsu: Initializing Power Management Service Unit
[    0.001458] rcu: Hierarchical SRCU implementation.
[    0.001460] rcu: 	Max phase no-delay instances is 1000.
[    0.001631] smp: Bringing up secondary CPUs ...
[    0.001833] Booting CPU 1
[    0.001955] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.001962] CPU1: Spectre v2: using BPIALL workaround
[    0.002016] smp: Brought up 1 node, 2 CPUs
[    0.002020] SMP: Total of 2 processors activated (3200.00 BogoMIPS).
[    0.002025] CPU: All CPU(s) started in SVC mode.
[    0.002291] devtmpfs: initialized
[    0.004089] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.004132] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.004141] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.004196] pinctrl core: initialized pinctrl subsystem
[    0.004478] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.004981] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.005337] thermal_sys: Registered thermal governor 'step_wise'
[    0.005440] mvebu-pmsu: CPU hotplug support is currently broken on Armada 38x: disabling
[    0.005445] mvebu-pmsu: CPU idle is currently broken on Armada 38x: disabling
[    0.010021] SCSI subsystem initialized
[    0.010039] libata version 3.00 loaded.
[    0.010094] usbcore: registered new interface driver usbfs
[    0.010107] usbcore: registered new interface driver hub
[    0.010123] usbcore: registered new device driver usb
[    0.010716] clocksource: Switched to clocksource arm_global_timer
[    0.011194] NET: Registered PF_INET protocol family
[    0.011303] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.012144] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.012157] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.012164] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.012201] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    0.012316] TCP: Hash tables configured (established 8192 bind 8192)
[    0.012363] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.012389] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.012498] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.013022] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.013133] Unpacking initramfs...
[    0.013356] NET: Registered PF_ALG protocol family
[    0.013390] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.013406] io scheduler bfq registered
[    0.018260] armada-38x-pinctrl f1018000.pinctrl: registered pinctrl driver
[    0.018567] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.018922] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.019318] mv_xor f1060800.xor: Marvell shared XOR driver
[    0.047355] mv_xor f1060800.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    0.047527] mv_xor f1060900.xor: Marvell shared XOR driver
[    0.075302] mv_xor f1060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    0.075544] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
[    0.076072] printk: console [ttyS0] disabled
[    0.076106] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 38, base_baud = 15625000) is a 16550A
[    0.076131] printk: console [ttyS0] enabled
[    0.076545] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 39, base_baud = 15625000) is a 16550A
[    0.077023] ahci-mvebu f10a8000.sata: AHCI 0001.0000 32 slots 2 ports 6 Gbps 0x3 impl platform mode
[    0.077035] ahci-mvebu f10a8000.sata: flags: 64bit ncq sntf led only pmp fbs pio slum part sxs 
[    0.077454] scsi host0: ahci-mvebu
[    0.077669] scsi host1: ahci-mvebu
[    0.077746] ata1: SATA max UDMA/133 mmio [mem 0xf10a8000-0xf10a9fff] port 0x100 irq 40
[    0.077752] ata2: SATA max UDMA/133 mmio [mem 0xf10a8000-0xf10a9fff] port 0x180 irq 40
[    0.078389] spi-nor spi0.0: s25fl164k (8192 Kbytes)
[    0.186266] Freeing initrd memory: 4576K
[    0.194291] 3 fixed-partitions partitions found on MTD device spi0.0
[    0.194305] Creating 3 MTD partitions on "spi0.0":
[    0.194310] 0x000000000000-0x0000000f0000 : "U-Boot"
[    0.194494] 0x000000100000-0x000000800000 : "Rescue system"
[    0.194609] 0x0000000f0000-0x000000100000 : "u-boot-env"
[    0.202428] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.392679] ata2: SATA link down (SStatus 0 SControl 300)
[    0.554721] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    0.555400] ata1.00: supports DRM functions and may not be fully accessible
[    0.555404] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
[    0.555410] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
[    0.556078] ata1.00: Features: Trust Dev-Sleep
[    0.556178] ata1.00: supports DRM functions and may not be fully accessible
[    0.556830] ata1.00: configured for UDMA/133
[    0.557003] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
[    0.557513] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
[    0.557521] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    0.557542] sd 0:0:0:0: [sda] Write Protect is off
[    0.557548] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.557582] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.557650] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
[    0.558138]  sda: sda1
[    0.558252] sd 0:0:0:0: [sda] Attached SCSI removable disk
*** FREEZE ***
[    2.779254] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
[    2.780632] mvneta f1070000.ethernet eth0: Using device tree mac address d8:58:d7:00:6f:b9
[    2.781609] mvneta f1030000.ethernet eth1: Using device tree mac address d8:58:d7:00:6f:b7
[    2.782547] mvneta f1034000.ethernet eth2: Using device tree mac address d8:58:d7:00:6f:b8
[    2.782747] orion-ehci f1058000.usb: EHCI Host Controller
[    2.782761] orion-ehci f1058000.usb: new USB bus registered, assigned bus number 1
[    2.782807] orion-ehci f1058000.usb: irq 45, io mem 0xf1058000
[    2.798726] orion-ehci f1058000.usb: USB 2.0 started, EHCI 1.00
[    2.799034] hub 1-0:1.0: USB hub found
[    2.799053] hub 1-0:1.0: 1 port detected
[    2.799415] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    2.799427] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
[    2.799475] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    2.799497] xhci-hcd f10f0000.usb3: irq 46, io mem 0xf10f0000
[    2.799506] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    2.799513] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 3
[    2.799525] xhci-hcd f10f0000.usb3: Host supports USB 3.0 SuperSpeed
[    2.799776] hub 2-0:1.0: USB hub found
[    2.799793] hub 2-0:1.0: 1 port detected
[    2.799927] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.800135] hub 3-0:1.0: USB hub found
[    2.800152] hub 3-0:1.0: 1 port detected
[    2.800329] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    2.800340] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 4
[    2.800383] xhci-hcd f10f8000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    2.800404] xhci-hcd f10f8000.usb3: irq 47, io mem 0xf10f8000
[    2.800414] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    2.800421] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 5
[    2.800431] xhci-hcd f10f8000.usb3: Host supports USB 3.0 SuperSpeed
[    2.800671] hub 4-0:1.0: USB hub found
[    2.800687] hub 4-0:1.0: 1 port detected
[    2.800824] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.801039] hub 5-0:1.0: USB hub found
[    2.801055] hub 5-0:1.0: 1 port detected
[    2.801293] usbcore: registered new interface driver uas
[    2.801337] usbcore: registered new interface driver usb-storage
[    2.801815] armada38x-rtc f10a3800.rtc: registered as rtc0
[    2.801892] armada38x-rtc f10a3800.rtc: setting system clock to 2023-03-05T16:48:56 UTC (1678034936)
[    2.803556] at24 1-0054: 8192 byte 24c64 EEPROM, writable, 1 bytes/write
[    2.803591] i2c i2c-0: Added multiplexed i2c bus 1
[    2.803627] i2c i2c-0: Added multiplexed i2c bus 2
[    2.803657] i2c i2c-0: Added multiplexed i2c bus 3
[    2.803688] i2c i2c-0: Added multiplexed i2c bus 4
[    2.803717] i2c i2c-0: Added multiplexed i2c bus 5
[    2.803796] i2c i2c-0: Added multiplexed i2c bus 6
[    2.803828] i2c i2c-0: Added multiplexed i2c bus 7
[    2.804026] pca953x 8-0071: using no AI
[    2.805622] i2c i2c-0: Added multiplexed i2c bus 8
[    2.805630] pca954x 0-0070: registered 8 multiplexed busses for I2C mux pca9547
[    2.807069] orion_wdt: Initial timeout 171 sec
[    2.807255] sdhci: Secure Digital Host Controller Interface driver
[    2.807259] sdhci: Copyright(c) Pierre Ossman
[    2.807320] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.816014] marvell-cesa f1090000.crypto: CESA device successfully registered
[    2.816451] NET: Registered PF_INET6 protocol family
[    2.817118] Segment Routing with IPv6
[    2.817146] In-situ OAM (IOAM) with IPv6
[    2.817208] NET: Registered PF_PACKET protocol family
[    2.817323] Registering SWP/SWPB emulation handler
[    2.838752] mmc0: SDHCI controller on f10d8000.sdhci [f10d8000.sdhci] using ADMA
[    2.915557] sfp sfp: Host maximum power 3.0W
[    2.919406] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    2.942956] mmc0: new high speed MMC card at address 0001
[    2.943334] mmcblk0: mmc0:0001 H8G4a\x92 7.28 GiB 
[    2.944348]  mmcblk0: p1
[    2.944624] mmcblk0boot0: mmc0:0001 H8G4a\x92 4.00 MiB 
[    2.944926] mmcblk0boot1: mmc0:0001 H8G4a\x92 4.00 MiB 
[    2.945157] mmcblk0rpmb: mmc0:0001 H8G4a\x92 4.00 MiB, chardev (250:0)
[    3.246121] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
[    3.246143] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
*** FREEZE ***
[    5.956754] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    5.958419] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    5.959693] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    5.963191] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    6.030496] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=68)
[    6.102678] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=69)
[    6.174861] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=70)
[    6.246141] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=71)
[    6.318682] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=72)
[    6.321598] device eth1 entered promiscuous mode
[    6.322472] device eth0 entered promiscuous mode
[    6.322491] DSA: tree 0 setup
[    6.323315] Freeing unused kernel image (initmem) memory: 1024K
[    6.323453] Run /init as init process
[    6.323457]   with arguments:
[    6.323459]     /init
[    6.323461]   with environment:
[    6.323463]     HOME=/
[    6.323465]     TERM=linux
  
Andrew Lunn March 5, 2023, 6:35 p.m. UTC | #2
On Sun, Mar 05, 2023 at 07:13:09PM +0100, Klaus Kudielka wrote:
> On Wed, 2023-01-18 at 11:01 +0100, Michael Walle wrote:
> > From: Andrew Lunn <andrew@lunn.ch>
> > 
> > Now that all MDIO bus drivers which set probe_capabilities to
> > MDIOBUS_C22_C45 have been converted to use the name API for C45
> > transactions, perform the scanning of the bus based on which methods
> > the bus provides.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > Signed-off-by: Michael Walle <michael@walle.cc>
> > Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> Hello,
> 
> On a Turris Omnia (Armada 385, Marvell 88E6176) this commit results
> in a strange boot behaviour. I see two distinct multi-second freezes
> in dmesg. Usually (up to the commit before), the (monolithic) kernel
> starts init after ~1.6 seconds, now it takes more than 6....
> 
> dmesg output below. Any idea, why this is happening?

The Armada 385 uses mdio-orian, also known as
drivers/net/ethernet/marvell/mvmdio.c. It comes in two variants, one
which supports only C22 and one which only supports C45, if i'm
reading orion_mdio_match[] correctly.

Please could you add a debug print in orion_mdio_smi_read() and
orion_mdio_xsmi_read_c45() and see if there is a difference before and
after this patch.

I'm assuming here the problem is with the MDIO bus associated to
mvneta, and not the mdio bus associated to the switch. That assumption
could be wrong, but the printk's should help with that as well.

      Andrew


> 
> Best regards, Klaus
> 
> [    0.000000] Booting Linux on physical CPU 0x0
> [    0.000000] Linux version 6.2.0-rc3+ (xxxx) (arm-linux-gnueabihf-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP Sun Mar  5 16:20:57 CET 2023
> [    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
> [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> [    0.000000] OF: fdt: Machine model: Turris Omnia
> [    0.000000] Memory policy: Data cache writealloc
> [    0.000000] Zone ranges:
> [    0.000000]   Normal   [mem 0x0000000000000000-0x000000002fffffff]
> [    0.000000]   HighMem  [mem 0x0000000030000000-0x000000003fffffff]
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000000000000-0x000000003fffffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000003fffffff]
> [    0.000000] percpu: Embedded 12 pages/cpu s19604 r8192 d21356 u49152
> [    0.000000] pcpu-alloc: s19604 r8192 d21356 u49152 alloc=12*4096
> [    0.000000] pcpu-alloc: [0] 0 [0] 1 
> [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 260416
> [    0.000000] Kernel command line: console=ttyS0,115200 quiet root=PARTUUID=262ecdb3-01 mvneta.txq_number=2 mvneta.rxq_number=2
> [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
> [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
> [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> [    0.000000] Memory: 1022716K/1048576K available (7168K kernel code, 590K rwdata, 1776K rodata, 1024K init, 233K bss, 25860K reserved, 0K cma-reserved, 262144K highmem)
> [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
> [    0.000000] rcu: Hierarchical RCU implementation.
> [    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
> [    0.000000] 	Tracing variant of Tasks RCU enabled.
> [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
> [    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
> [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
> [    0.000000] L2C: DT/platform modifies aux control register: 0x06070000 -> 0x16070000
> [    0.000000] L2C-310 enabling early BRESP for Cortex-A9
> [    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
> [    0.000000] L2C-310 D prefetch enabled, offset 1 lines
> [    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
> [    0.000000] L2C-310 Coherent cache controller enabled, 16 ways, 1024 kB
> [    0.000000] L2C-310 Coherent: CACHE_ID 0x410054c9, AUX_CTRL 0x56070001
> [    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
> [    0.000001] sched_clock: 64 bits at 800MHz, resolution 1ns, wraps every 4398046511103ns
> [    0.000012] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0xb881274fa3, max_idle_ns: 440795210636 ns
> [    0.000026] Switching to timer-based delay loop, resolution 1ns
> [    0.000153] Ignoring duplicate/late registration of read_current_timer delay
> [    0.000159] clocksource: armada_370_xp_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 76450417870 ns
> [    0.000302] Calibrating delay loop (skipped), value calculated using timer frequency.. 1600.00 BogoMIPS (lpj=3200000)
> [    0.000310] pid_max: default: 32768 minimum: 301
> [    0.000396] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
> [    0.000403] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
> [    0.000726] CPU: Testing write buffer coherency: ok
> [    0.000749] CPU0: Spectre v2: using BPIALL workaround
> [    0.000864] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
> [    0.001188] cblist_init_generic: Setting adjustable number of callback queues.
> [    0.001192] cblist_init_generic: Setting shift to 1 and lim to 1.
> [    0.001241] Setting up static identity map for 0x100000 - 0x100060
> [    0.001314] mvebu-soc-id: MVEBU SoC ID=0x6820, Rev=0x4
> [    0.001393] mvebu-pmsu: Initializing Power Management Service Unit
> [    0.001458] rcu: Hierarchical SRCU implementation.
> [    0.001460] rcu: 	Max phase no-delay instances is 1000.
> [    0.001631] smp: Bringing up secondary CPUs ...
> [    0.001833] Booting CPU 1
> [    0.001955] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
> [    0.001962] CPU1: Spectre v2: using BPIALL workaround
> [    0.002016] smp: Brought up 1 node, 2 CPUs
> [    0.002020] SMP: Total of 2 processors activated (3200.00 BogoMIPS).
> [    0.002025] CPU: All CPU(s) started in SVC mode.
> [    0.002291] devtmpfs: initialized
> [    0.004089] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
> [    0.004132] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
> [    0.004141] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
> [    0.004196] pinctrl core: initialized pinctrl subsystem
> [    0.004478] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> [    0.004981] DMA: preallocated 256 KiB pool for atomic coherent allocations
> [    0.005337] thermal_sys: Registered thermal governor 'step_wise'
> [    0.005440] mvebu-pmsu: CPU hotplug support is currently broken on Armada 38x: disabling
> [    0.005445] mvebu-pmsu: CPU idle is currently broken on Armada 38x: disabling
> [    0.010021] SCSI subsystem initialized
> [    0.010039] libata version 3.00 loaded.
> [    0.010094] usbcore: registered new interface driver usbfs
> [    0.010107] usbcore: registered new interface driver hub
> [    0.010123] usbcore: registered new device driver usb
> [    0.010716] clocksource: Switched to clocksource arm_global_timer
> [    0.011194] NET: Registered PF_INET protocol family
> [    0.011303] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
> [    0.012144] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
> [    0.012157] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
> [    0.012164] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
> [    0.012201] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
> [    0.012316] TCP: Hash tables configured (established 8192 bind 8192)
> [    0.012363] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
> [    0.012389] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
> [    0.012498] NET: Registered PF_UNIX/PF_LOCAL protocol family
> [    0.013022] workingset: timestamp_bits=14 max_order=18 bucket_order=4
> [    0.013133] Unpacking initramfs...
> [    0.013356] NET: Registered PF_ALG protocol family
> [    0.013390] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
> [    0.013406] io scheduler bfq registered
> [    0.018260] armada-38x-pinctrl f1018000.pinctrl: registered pinctrl driver
> [    0.018567] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [    0.018922] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [    0.019318] mv_xor f1060800.xor: Marvell shared XOR driver
> [    0.047355] mv_xor f1060800.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
> [    0.047527] mv_xor f1060900.xor: Marvell shared XOR driver
> [    0.075302] mv_xor f1060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
> [    0.075544] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
> [    0.076072] printk: console [ttyS0] disabled
> [    0.076106] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 38, base_baud = 15625000) is a 16550A
> [    0.076131] printk: console [ttyS0] enabled
> [    0.076545] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 39, base_baud = 15625000) is a 16550A
> [    0.077023] ahci-mvebu f10a8000.sata: AHCI 0001.0000 32 slots 2 ports 6 Gbps 0x3 impl platform mode
> [    0.077035] ahci-mvebu f10a8000.sata: flags: 64bit ncq sntf led only pmp fbs pio slum part sxs 
> [    0.077454] scsi host0: ahci-mvebu
> [    0.077669] scsi host1: ahci-mvebu
> [    0.077746] ata1: SATA max UDMA/133 mmio [mem 0xf10a8000-0xf10a9fff] port 0x100 irq 40
> [    0.077752] ata2: SATA max UDMA/133 mmio [mem 0xf10a8000-0xf10a9fff] port 0x180 irq 40
> [    0.078389] spi-nor spi0.0: s25fl164k (8192 Kbytes)
> [    0.186266] Freeing initrd memory: 4576K
> [    0.194291] 3 fixed-partitions partitions found on MTD device spi0.0
> [    0.194305] Creating 3 MTD partitions on "spi0.0":
> [    0.194310] 0x000000000000-0x0000000f0000 : "U-Boot"
> [    0.194494] 0x000000100000-0x000000800000 : "Rescue system"
> [    0.194609] 0x0000000f0000-0x000000100000 : "u-boot-env"
> [    0.202428] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
> [    0.392679] ata2: SATA link down (SStatus 0 SControl 300)
> [    0.554721] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> [    0.555400] ata1.00: supports DRM functions and may not be fully accessible
> [    0.555404] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
> [    0.555410] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
> [    0.556078] ata1.00: Features: Trust Dev-Sleep
> [    0.556178] ata1.00: supports DRM functions and may not be fully accessible
> [    0.556830] ata1.00: configured for UDMA/133
> [    0.557003] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
> [    0.557513] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
> [    0.557521] sd 0:0:0:0: [sda] 4096-byte physical blocks
> [    0.557542] sd 0:0:0:0: [sda] Write Protect is off
> [    0.557548] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
> [    0.557582] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [    0.557650] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
> [    0.558138]  sda: sda1
> [    0.558252] sd 0:0:0:0: [sda] Attached SCSI removable disk
> *** FREEZE ***
> [    2.779254] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
> [    2.780632] mvneta f1070000.ethernet eth0: Using device tree mac address d8:58:d7:00:6f:b9
> [    2.781609] mvneta f1030000.ethernet eth1: Using device tree mac address d8:58:d7:00:6f:b7
> [    2.782547] mvneta f1034000.ethernet eth2: Using device tree mac address d8:58:d7:00:6f:b8
> [    2.782747] orion-ehci f1058000.usb: EHCI Host Controller
> [    2.782761] orion-ehci f1058000.usb: new USB bus registered, assigned bus number 1
> [    2.782807] orion-ehci f1058000.usb: irq 45, io mem 0xf1058000
> [    2.798726] orion-ehci f1058000.usb: USB 2.0 started, EHCI 1.00
> [    2.799034] hub 1-0:1.0: USB hub found
> [    2.799053] hub 1-0:1.0: 1 port detected
> [    2.799415] xhci-hcd f10f0000.usb3: xHCI Host Controller
> [    2.799427] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
> [    2.799475] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
> [    2.799497] xhci-hcd f10f0000.usb3: irq 46, io mem 0xf10f0000
> [    2.799506] xhci-hcd f10f0000.usb3: xHCI Host Controller
> [    2.799513] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 3
> [    2.799525] xhci-hcd f10f0000.usb3: Host supports USB 3.0 SuperSpeed
> [    2.799776] hub 2-0:1.0: USB hub found
> [    2.799793] hub 2-0:1.0: 1 port detected
> [    2.799927] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
> [    2.800135] hub 3-0:1.0: USB hub found
> [    2.800152] hub 3-0:1.0: 1 port detected
> [    2.800329] xhci-hcd f10f8000.usb3: xHCI Host Controller
> [    2.800340] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 4
> [    2.800383] xhci-hcd f10f8000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
> [    2.800404] xhci-hcd f10f8000.usb3: irq 47, io mem 0xf10f8000
> [    2.800414] xhci-hcd f10f8000.usb3: xHCI Host Controller
> [    2.800421] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 5
> [    2.800431] xhci-hcd f10f8000.usb3: Host supports USB 3.0 SuperSpeed
> [    2.800671] hub 4-0:1.0: USB hub found
> [    2.800687] hub 4-0:1.0: 1 port detected
> [    2.800824] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
> [    2.801039] hub 5-0:1.0: USB hub found
> [    2.801055] hub 5-0:1.0: 1 port detected
> [    2.801293] usbcore: registered new interface driver uas
> [    2.801337] usbcore: registered new interface driver usb-storage
> [    2.801815] armada38x-rtc f10a3800.rtc: registered as rtc0
> [    2.801892] armada38x-rtc f10a3800.rtc: setting system clock to 2023-03-05T16:48:56 UTC (1678034936)
> [    2.803556] at24 1-0054: 8192 byte 24c64 EEPROM, writable, 1 bytes/write
> [    2.803591] i2c i2c-0: Added multiplexed i2c bus 1
> [    2.803627] i2c i2c-0: Added multiplexed i2c bus 2
> [    2.803657] i2c i2c-0: Added multiplexed i2c bus 3
> [    2.803688] i2c i2c-0: Added multiplexed i2c bus 4
> [    2.803717] i2c i2c-0: Added multiplexed i2c bus 5
> [    2.803796] i2c i2c-0: Added multiplexed i2c bus 6
> [    2.803828] i2c i2c-0: Added multiplexed i2c bus 7
> [    2.804026] pca953x 8-0071: using no AI
> [    2.805622] i2c i2c-0: Added multiplexed i2c bus 8
> [    2.805630] pca954x 0-0070: registered 8 multiplexed busses for I2C mux pca9547
> [    2.807069] orion_wdt: Initial timeout 171 sec
> [    2.807255] sdhci: Secure Digital Host Controller Interface driver
> [    2.807259] sdhci: Copyright(c) Pierre Ossman
> [    2.807320] sdhci-pltfm: SDHCI platform and OF driver helper
> [    2.816014] marvell-cesa f1090000.crypto: CESA device successfully registered
> [    2.816451] NET: Registered PF_INET6 protocol family
> [    2.817118] Segment Routing with IPv6
> [    2.817146] In-situ OAM (IOAM) with IPv6
> [    2.817208] NET: Registered PF_PACKET protocol family
> [    2.817323] Registering SWP/SWPB emulation handler
> [    2.838752] mmc0: SDHCI controller on f10d8000.sdhci [f10d8000.sdhci] using ADMA
> [    2.915557] sfp sfp: Host maximum power 3.0W
> [    2.919406] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
> [    2.942956] mmc0: new high speed MMC card at address 0001
> [    2.943334] mmcblk0: mmc0:0001 H8G4a\x92 7.28 GiB 
> [    2.944348]  mmcblk0: p1
> [    2.944624] mmcblk0boot0: mmc0:0001 H8G4a\x92 4.00 MiB 
> [    2.944926] mmcblk0boot1: mmc0:0001 H8G4a\x92 4.00 MiB 
> [    2.945157] mmcblk0rpmb: mmc0:0001 H8G4a\x92 4.00 MiB, chardev (250:0)
> [    3.246121] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
> [    3.246143] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
> *** FREEZE ***
> [    5.956754] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
> [    5.958419] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
> [    5.959693] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
> [    5.963191] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
> [    6.030496] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=68)
> [    6.102678] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=69)
> [    6.174861] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=70)
> [    6.246141] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=71)
> [    6.318682] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=72)
> [    6.321598] device eth1 entered promiscuous mode
> [    6.322472] device eth0 entered promiscuous mode
> [    6.322491] DSA: tree 0 setup
> [    6.323315] Freeing unused kernel image (initmem) memory: 1024K
> [    6.323453] Run /init as init process
> [    6.323457]   with arguments:
> [    6.323459]     /init
> [    6.323461]   with environment:
> [    6.323463]     HOME=/
> [    6.323465]     TERM=linux
>
  
Klaus Kudielka March 6, 2023, 6:40 p.m. UTC | #3
On Sun, 2023-03-05 at 19:35 +0100, Andrew Lunn wrote:
> On Sun, Mar 05, 2023 at 07:13:09PM +0100, Klaus Kudielka wrote:
> > On Wed, 2023-01-18 at 11:01 +0100, Michael Walle wrote:
> > > From: Andrew Lunn <andrew@lunn.ch>
> > > 
> > > Now that all MDIO bus drivers which set probe_capabilities to
> > > MDIOBUS_C22_C45 have been converted to use the name API for C45
> > > transactions, perform the scanning of the bus based on which methods
> > > the bus provides.
> > > 
> > > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > > Signed-off-by: Michael Walle <michael@walle.cc>
> > > Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> > 
> > Hello,
> > 
> > On a Turris Omnia (Armada 385, Marvell 88E6176) this commit results
> > in a strange boot behaviour. I see two distinct multi-second freezes
> > in dmesg. Usually (up to the commit before), the (monolithic) kernel
> > starts init after ~1.6 seconds, now it takes more than 6....
> > 
> > dmesg output below. Any idea, why this is happening?
> 
> The Armada 385 uses mdio-orian, also known as
> drivers/net/ethernet/marvell/mvmdio.c. It comes in two variants, one
> which supports only C22 and one which only supports C45, if i'm
> reading orion_mdio_match[] correctly.
> 
> Please could you add a debug print in orion_mdio_smi_read() and
> orion_mdio_xsmi_read_c45() and see if there is a difference before and
> after this patch.
> 
> I'm assuming here the problem is with the MDIO bus associated to
> mvneta, and not the mdio bus associated to the switch. That assumption
> could be wrong, but the printk's should help with that as well.
> 
>       Andrew


I just added

dev_warn_ratelimited(bus->parent, "<function_name> %d\n", mii_id);

at the entry point of each function. And here we go.



########
# good: [3486593374858b41ae6ef7720cb28ff39ad822f3] net: mdio: Add workaround for Micrel PHYs which are not C45 compatible

*** snip ***
[    0.194348] Creating 3 MTD partitions on "spi0.0":
[    0.194353] 0x000000000000-0x0000000f0000 : "U-Boot"
[    0.194534] 0x000000100000-0x000000800000 : "Rescue system"
[    0.194652] 0x0000000f0000-0x000000100000 : "u-boot-env"
[    0.195518] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
[    0.195592] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
[    0.202202] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202280] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202346] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202470] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202534] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.202542] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202674] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202799] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.202921] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.320192] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
*** snip ***
[    1.598893] Run /init as init process
[    1.598896]   with arguments:
[    1.598898]     /init
[    1.598900]   with environment:
[    1.598902]     HOME=/
[    1.598904]     TERM=linux
*** snip ***
[    4.628127] mv88e6085 f1072004.mdio-mii:10 lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[    4.628150] IPv6: ADDRCONF(NETDEV_CHANGE): lan3: link becomes ready
[    4.628210] br0: port 2(lan3) entered blocking state
[    4.628219] br0: port 2(lan3) entered forwarding state
[    4.629187] IPv6: ADDRCONF(NETDEV_CHANGE): br0: link becomes ready
[  283.962353] orion_mdio_smi_read: 9231 callbacks suppressed
[  283.962361] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.962492] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.962617] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.962799] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.962981] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.963162] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.963344] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.963466] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.963588] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  283.963652] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.572411] orion_mdio_smi_read: 56 callbacks suppressed
[  310.572419] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.572550] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.572675] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.572857] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.573039] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.573220] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.573402] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.573524] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.573647] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  310.573711] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.308614] orion_mdio_smi_read: 56 callbacks suppressed
[  726.308623] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.308754] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.308879] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309060] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309242] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309423] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309604] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309727] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309850] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  726.309914] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.713791] orion_mdio_smi_read: 56 callbacks suppressed
[  841.713800] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.713931] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.714056] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.714239] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.714420] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.714602] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.714783] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.714906] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.715029] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  841.715093] orion-mdio f1072004.mdio: orion_mdio_smi_read 16



#####
# first bad commit: [1a136ca2e089d91df8eec0a796a324171373ffd8] net: mdio: scan bus based on bus capabilities for C22 and C45

*** snip ***
[    0.191685] Creating 3 MTD partitions on "spi0.0":
[    0.191690] 0x000000000000-0x0000000f0000 : "U-Boot"
[    0.191871] 0x000000100000-0x000000800000 : "Rescue system"
[    0.191991] 0x0000000f0000-0x000000100000 : "u-boot-env"
[    0.192830] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
[    0.192906] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
[    0.199530] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.199610] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.199677] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.199799] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.199864] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.199871] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.199994] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.200117] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.200239] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    0.396608] ata2: SATA link down (SStatus 0 SControl 300)
[    0.554697] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    0.555370] ata1.00: supports DRM functions and may not be fully accessible
[    0.555375] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
[    0.555385] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
[    0.556058] ata1.00: Features: Trust Dev-Sleep
[    0.556158] ata1.00: supports DRM functions and may not be fully accessible
[    0.556811] ata1.00: configured for UDMA/133
[    0.556985] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
[    0.557485] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
[    0.557493] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    0.557515] sd 0:0:0:0: [sda] Write Protect is off
[    0.557520] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.557553] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.557620] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
[    0.558111]  sda: sda1
[    0.558230] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    2.741909] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
*** snip ***
[    3.213998] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
[    3.214020] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
[    5.194695] orion_mdio_smi_read: 43968 callbacks suppressed
[    5.194701] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.194767] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.194891] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195014] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195137] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195259] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195324] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195446] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195510] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    5.195633] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[    6.223184] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    6.224852] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    6.226126] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    6.229455] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    6.294120] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=68)
[    6.366663] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=69)
[    6.438843] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=70)
[    6.510122] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=71)
[    6.582302] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=72)
[    6.584680] device eth1 entered promiscuous mode
[    6.585573] device eth0 entered promiscuous mode
[    6.585593] DSA: tree 0 setup
[    6.586408] Freeing unused kernel image (initmem) memory: 1024K
[    6.586547] Run /init as init process
[    6.586551]   with arguments:
[    6.586553]     /init
[    6.586555]   with environment:
[    6.586557]     HOME=/
[    6.586559]     TERM=linux
*** snip ***
[    9.437029] mv88e6085 f1072004.mdio-mii:10 lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[    9.437052] IPv6: ADDRCONF(NETDEV_CHANGE): lan3: link becomes ready
[    9.437116] br0: port 2(lan3) entered blocking state
[    9.437125] br0: port 2(lan3) entered forwarding state
[    9.438061] IPv6: ADDRCONF(NETDEV_CHANGE): br0: link becomes ready
[    9.469466] systemd-journald[207]: Time jumped backwards, rotating.
[  414.675728] orion_mdio_smi_read: 11201 callbacks suppressed
[  414.675736] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.675869] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.675996] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.676179] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.676361] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.676543] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.676725] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.676847] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.676970] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  414.677034] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.809740] orion_mdio_smi_read: 56 callbacks suppressed
[  540.809748] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.809879] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810004] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810186] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810368] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810551] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810732] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810855] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.810978] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
[  540.811042] orion-mdio f1072004.mdio: orion_mdio_smi_read 16



"orion_mdio_smi_read: 43968 callbacks suppressed" after 5 seconds - quite impressive!


Best regards, Klaus
  
Andrew Lunn March 6, 2023, 7:02 p.m. UTC | #4
> dev_warn_ratelimited(bus->parent, "<function_name> %d\n", mii_id);
> 
> at the entry point of each function. And here we go.
> 
> 
> 
> ########
> # good: [3486593374858b41ae6ef7720cb28ff39ad822f3] net: mdio: Add workaround for Micrel PHYs which are not C45 compatible
> 
> *** snip ***
> [    0.194348] Creating 3 MTD partitions on "spi0.0":
> [    0.194353] 0x000000000000-0x0000000f0000 : "U-Boot"
> [    0.194534] 0x000000100000-0x000000800000 : "Rescue system"
> [    0.194652] 0x0000000f0000-0x000000100000 : "u-boot-env"
> [    0.195518] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
> [    0.195592] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
> [    0.202202] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202280] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202346] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202470] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202534] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
> [    0.202542] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202674] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202799] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.202921] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.320192] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled

So there are no xmdio reads for c45. That is what the commit you
pointed to is about, should it scan C22, C45 or both C45.

> *** snip ***
> [    1.598893] Run /init as init process
> [    1.598896]   with arguments:
> [    1.598898]     /init
> [    1.598900]   with environment:
> [    1.598902]     HOME=/
> [    1.598904]     TERM=linux
> *** snip ***
> [    4.628127] mv88e6085 f1072004.mdio-mii:10 lan3: Link is Up - 1Gbps/Full - flow control rx/tx
> [    4.628150] IPv6: ADDRCONF(NETDEV_CHANGE): lan3: link becomes ready
> [    4.628210] br0: port 2(lan3) entered blocking state
> [    4.628219] br0: port 2(lan3) entered forwarding state
> [    4.629187] IPv6: ADDRCONF(NETDEV_CHANGE): br0: link becomes ready
> [  283.962353] orion_mdio_smi_read: 9231 callbacks suppressed
> [  283.962361] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.962492] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.962617] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.962799] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.962981] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.963162] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.963344] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.963466] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.963588] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  283.963652] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.572411] orion_mdio_smi_read: 56 callbacks suppressed
> [  310.572419] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.572550] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.572675] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.572857] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.573039] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.573220] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.573402] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.573524] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.573647] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  310.573711] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.308614] orion_mdio_smi_read: 56 callbacks suppressed
> [  726.308623] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.308754] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.308879] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309060] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309242] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309423] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309604] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309727] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309850] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  726.309914] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.713791] orion_mdio_smi_read: 56 callbacks suppressed
> [  841.713800] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.713931] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.714056] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.714239] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.714420] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.714602] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.714783] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.714906] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.715029] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  841.715093] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> 
> 
> 
> #####
> # first bad commit: [1a136ca2e089d91df8eec0a796a324171373ffd8] net: mdio: scan bus based on bus capabilities for C22 and C45
> 
> *** snip ***
> [    0.191685] Creating 3 MTD partitions on "spi0.0":
> [    0.191690] 0x000000000000-0x0000000f0000 : "U-Boot"
> [    0.191871] 0x000000100000-0x000000800000 : "Rescue system"
> [    0.191991] 0x0000000f0000-0x000000100000 : "u-boot-env"
> [    0.192830] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
> [    0.192906] orion-mdio f1072004.mdio: orion_mdio_smi_read 1
> [    0.199530] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.199610] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.199677] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.199799] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.199864] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
> [    0.199871] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.199994] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.200117] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.200239] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    0.396608] ata2: SATA link down (SStatus 0 SControl 300)
> [    0.554697] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> [    0.555370] ata1.00: supports DRM functions and may not be fully accessible
> [    0.555375] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
> [    0.555385] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
> [    0.556058] ata1.00: Features: Trust Dev-Sleep
> [    0.556158] ata1.00: supports DRM functions and may not be fully accessible
> [    0.556811] ata1.00: configured for UDMA/133
> [    0.556985] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
> [    0.557485] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
> [    0.557493] sd 0:0:0:0: [sda] 4096-byte physical blocks
> [    0.557515] sd 0:0:0:0: [sda] Write Protect is off
> [    0.557520] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
> [    0.557553] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [    0.557620] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
> [    0.558111]  sda: sda1
> [    0.558230] sd 0:0:0:0: [sda] Attached SCSI removable disk
> [    2.741909] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
> *** snip ***
> [    3.213998] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
> [    3.214020] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
> [    5.194695] orion_mdio_smi_read: 43968 callbacks suppressed
> [    5.194701] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.194767] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.194891] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195014] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195137] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195259] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195324] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195446] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195510] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    5.195633] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [    6.223184] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
> [    6.224852] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
> [    6.226126] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
> [    6.229455] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
> [    6.294120] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=68)
> [    6.366663] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=69)
> [    6.438843] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=70)
> [    6.510122] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=71)
> [    6.582302] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=72)
> [    6.584680] device eth1 entered promiscuous mode
> [    6.585573] device eth0 entered promiscuous mode
> [    6.585593] DSA: tree 0 setup
> [    6.586408] Freeing unused kernel image (initmem) memory: 1024K
> [    6.586547] Run /init as init process
> [    6.586551]   with arguments:
> [    6.586553]     /init
> [    6.586555]   with environment:
> [    6.586557]     HOME=/
> [    6.586559]     TERM=linux
> *** snip ***
> [    9.437029] mv88e6085 f1072004.mdio-mii:10 lan3: Link is Up - 1Gbps/Full - flow control rx/tx
> [    9.437052] IPv6: ADDRCONF(NETDEV_CHANGE): lan3: link becomes ready
> [    9.437116] br0: port 2(lan3) entered blocking state
> [    9.437125] br0: port 2(lan3) entered forwarding state
> [    9.438061] IPv6: ADDRCONF(NETDEV_CHANGE): br0: link becomes ready
> [    9.469466] systemd-journald[207]: Time jumped backwards, rotating.
> [  414.675728] orion_mdio_smi_read: 11201 callbacks suppressed
> [  414.675736] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.675869] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.675996] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.676179] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.676361] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.676543] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.676725] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.676847] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.676970] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  414.677034] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.809740] orion_mdio_smi_read: 56 callbacks suppressed
> [  540.809748] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.809879] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810004] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810186] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810368] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810551] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810732] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810855] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.810978] orion-mdio f1072004.mdio: orion_mdio_smi_read 16
> [  540.811042] orion-mdio f1072004.mdio: orion_mdio_smi_read 16

> "orion_mdio_smi_read: 43968 callbacks suppressed" after 5 seconds - quite impressive!

That is probably the switch being configured. I assume it uses address
16?

But it looks like there are many more after the bad commit. So is the
return value messed up, putting the switch driver into a loop? Maybe
print the smi address, register and the return value in
orion_mdio_smi_read(). And maybe the same in the switch driver, if all
reads happen to go through one function.

      Andrew
  
Klaus Kudielka March 7, 2023, 7:48 p.m. UTC | #5
On Mon, 2023-03-06 at 20:02 +0100, Andrew Lunn wrote:
> 
> 
> > "orion_mdio_smi_read: 43968 callbacks suppressed" after 5 seconds - quite impressive!
> 
> That is probably the switch being configured. I assume it uses address
> 16?

Correct, 0x10 according to the DTS.

> But it looks like there are many more after the bad commit. So is the
> return value messed up, putting the switch driver into a loop? Maybe
> print the smi address, register and the return value in
> orion_mdio_smi_read(). And maybe the same in the switch driver, if all
> reads happen to go through one function.


New debug session - I am not trusting the rate limiter anymore, but wrote my own
(printing every 100th read in the switch driver).


PLUS: Code to see which mdiobus_scan functions are actually called



#### Debug code added ####

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 0a5d6c7bb1..04b141b063 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -54,6 +54,7 @@ static void assert_reg_lock(struct mv88e6xxx_chip *chip)
 int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val)
 {
        int err;
+       static unsigned debug = 0;
 
        assert_reg_lock(chip);
 
@@ -61,7 +62,8 @@ int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val)
        if (err)
                return err;
 
-       dev_dbg(chip->dev, "<- addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n",
+       if (debug++ % 100 == 0)
+       dev_warn(chip->dev, "<- addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n",
                addr, reg, *val);
 
        return 0;
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 5b2f48c09a..a914671707 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -712,6 +712,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
        }
 
        if (bus->read) {
+               dev_warn(&bus->dev, "*** mdiobus_scan_c22 ***\n");
                err = mdiobus_scan_bus_c22(bus);
                if (err)
                        goto error;
@@ -720,6 +721,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
        prevent_c45_scan = mdiobus_prevent_c45_scan(bus);
 
        if (!prevent_c45_scan && bus->read_c45) {
+               dev_warn(&bus->dev, "*** mdiobus_scan_c45 ***\n");
                err = mdiobus_scan_bus_c45(bus);
                if (err)
                        goto error;


#### TEST RESULTS ####

########
# good: [3486593374858b41ae6ef7720cb28ff39ad822f3] net: mdio: Add workaround for Micrel PHYs which are not C45 compatible

*** snip ***
[    0.194280] Creating 3 MTD partitions on "spi0.0":
[    0.194285] 0x000000000000-0x0000000f0000 : "U-Boot"
[    0.194466] 0x000000100000-0x000000800000 : "Rescue system"
[    0.194586] 0x0000000f0000-0x000000100000 : "u-boot-env"
[    0.195052] mdio_bus fixed-0: *** mdiobus_scan_c22 ***
[    0.195450] mdio_bus f1072004.mdio-mii: *** mdiobus_scan_c22 ***
[    0.202202] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x10 reg: 0x03 val: 0xffff
[    0.202455] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.212579] mdio_bus mv88e6xxx-0: *** mdiobus_scan_c22 ***
[    0.262165] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.290382] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x9a23
[    0.312415] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1ba3
[    0.319994] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
[    0.321373] mvneta f1070000.ethernet eth0: Using device tree mac address d8:58:d7:00:6f:b9
[    0.322348] mvneta f1030000.ethernet eth1: Using device tree mac address d8:58:d7:00:6f:b7
[    0.323303] mvneta f1034000.ethernet eth2: Using device tree mac address d8:58:d7:00:6f:b8
[    0.323480] orion-ehci f1058000.usb: EHCI Host Controller
[    0.323493] orion-ehci f1058000.usb: new USB bus registered, assigned bus number 1
[    0.323539] orion-ehci f1058000.usb: irq 45, io mem 0xf1058000
[    0.338724] orion-ehci f1058000.usb: USB 2.0 started, EHCI 1.00
[    0.339060] hub 1-0:1.0: USB hub found
[    0.339078] hub 1-0:1.0: 1 port detected
[    0.339447] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    0.339459] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
[    0.339511] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    0.339536] xhci-hcd f10f0000.usb3: irq 46, io mem 0xf10f0000
[    0.339544] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    0.339552] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 3
[    0.339563] xhci-hcd f10f0000.usb3: Host supports USB 3.0 SuperSpeed
[    0.339807] hub 2-0:1.0: USB hub found
[    0.339825] hub 2-0:1.0: 1 port detected
[    0.339953] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.340158] hub 3-0:1.0: USB hub found
[    0.340173] hub 3-0:1.0: 1 port detected
[    0.340349] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    0.340360] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 4
[    0.340404] xhci-hcd f10f8000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    0.340424] xhci-hcd f10f8000.usb3: irq 47, io mem 0xf10f8000
[    0.340432] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    0.340439] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 5
[    0.340449] xhci-hcd f10f8000.usb3: Host supports USB 3.0 SuperSpeed
[    0.340676] hub 4-0:1.0: USB hub found
[    0.340697] hub 4-0:1.0: 1 port detected
[    0.340823] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.341025] hub 5-0:1.0: USB hub found
[    0.341041] hub 5-0:1.0: 1 port detected
[    0.341271] usbcore: registered new interface driver uas
[    0.341314] usbcore: registered new interface driver usb-storage
[    0.341781] armada38x-rtc f10a3800.rtc: registered as rtc0
[    0.341858] armada38x-rtc f10a3800.rtc: setting system clock to 2023-03-07T19:16:44 UTC (1678216604)
[    0.343536] at24 1-0054: 8192 byte 24c64 EEPROM, writable, 1 bytes/write
[    0.343568] i2c i2c-0: Added multiplexed i2c bus 1
[    0.343602] i2c i2c-0: Added multiplexed i2c bus 2
[    0.343632] i2c i2c-0: Added multiplexed i2c bus 3
[    0.343659] i2c i2c-0: Added multiplexed i2c bus 4
[    0.343687] i2c i2c-0: Added multiplexed i2c bus 5
[    0.343770] i2c i2c-0: Added multiplexed i2c bus 6
[    0.343801] i2c i2c-0: Added multiplexed i2c bus 7
[    0.344002] pca953x 8-0071: using no AI
[    0.345585] i2c i2c-0: Added multiplexed i2c bus 8
[    0.345593] pca954x 0-0070: registered 8 multiplexed busses for I2C mux pca9547
[    0.347053] orion_wdt: Initial timeout 171 sec
[    0.347239] sdhci: Secure Digital Host Controller Interface driver
[    0.347243] sdhci: Copyright(c) Pierre Ossman
[    0.347301] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.356027] marvell-cesa f1090000.crypto: CESA device successfully registered
[    0.356491] NET: Registered PF_INET6 protocol family
[    0.357151] Segment Routing with IPv6
[    0.357179] In-situ OAM (IOAM) with IPv6
[    0.357242] NET: Registered PF_PACKET protocol family
[    0.357354] Registering SWP/SWPB emulation handler
[    0.374724] mmc0: SDHCI controller on f10d8000.sdhci [f10d8000.sdhci] using ADMA
[    0.394251] ata2: SATA link down (SStatus 0 SControl 300)
[    0.457112] sfp sfp: Host maximum power 3.0W
[    0.460953] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.470323] mdio_bus mv88e6xxx-1: *** mdiobus_scan_c22 ***
[    0.483424] mmc0: new high speed MMC card at address 0001
[    0.483838] mmcblk0: mmc0:0001 H8G4a\x92 7.28 GiB 
[    0.484876]  mmcblk0: p1
[    0.485154] mmcblk0boot0: mmc0:0001 H8G4a\x92 4.00 MiB 
[    0.485468] mmcblk0boot1: mmc0:0001 H8G4a\x92 4.00 MiB 
[    0.485691] mmcblk0rpmb: mmc0:0001 H8G4a\x92 4.00 MiB, chardev (250:0)
[    0.509195] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0x7949
[    0.537564] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x19c3
[    0.558707] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    0.559391] ata1.00: supports DRM functions and may not be fully accessible
[    0.559396] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
[    0.559402] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
[    0.560071] ata1.00: Features: Trust Dev-Sleep
[    0.560168] ata1.00: supports DRM functions and may not be fully accessible
[    0.560821] ata1.00: configured for UDMA/133
[    0.560999] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
[    0.561489] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
[    0.561497] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    0.561534] sd 0:0:0:0: [sda] Write Protect is off
[    0.561540] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.561596] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.561719] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
[    0.562284]  sda: sda1
[    0.562402] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    0.566452] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1b43
[    0.614624] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x0b val: 0xc000
[    0.661046] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x09 val: 0x0000
[    0.701647] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x0b val: 0xc000
[    0.744298] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x05 val: 0x3000
[    0.782001] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
[    0.782018] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
[    0.784675] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x16 reg: 0x08 val: 0x2080
[    0.822923] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x3020
[    0.858829] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x3052
[    0.894730] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x3084
[    0.930631] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x30b6
[    0.966529] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x30e8
[    1.002423] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x311a
[    1.038289] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x314c
[    1.074277] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x317e
[    1.110265] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x31b0
[    1.146260] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x31e2
[    1.190453] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x0b val: 0xc000
[    1.231278] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    1.232939] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    1.234212] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    1.237536] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    1.302662] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=68)
[    1.303520] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1813
[    1.374838] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=69)
[    1.446118] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=70)
[    1.451042] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1470
[    1.518298] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=71)
[    1.590825] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=72)
[    1.593735] device eth1 entered promiscuous mode
[    1.594611] device eth0 entered promiscuous mode
[    1.594631] DSA: tree 0 setup
[    1.595458] Freeing unused kernel image (initmem) memory: 1024K
[    1.595593] Run /init as init process
*** snip ***

Summary: 4 calls to mdio_bus_scan_c22, *0* calls to mdio_bus_scan_c45, approx. 25*100 reads by the switch driver



#####
# first bad commit: [1a136ca2e089d91df8eec0a796a324171373ffd8] net: mdio: scan bus based on bus capabilities for C22 and C45

*** snip ***
[    0.194373] Creating 3 MTD partitions on "spi0.0":
[    0.194378] 0x000000000000-0x0000000f0000 : "U-Boot"
[    0.194560] 0x000000100000-0x000000800000 : "Rescue system"
[    0.194681] 0x0000000f0000-0x000000100000 : "u-boot-env"
[    0.195153] mdio_bus fixed-0: *** mdiobus_scan_c22 ***
[    0.195553] mdio_bus f1072004.mdio-mii: *** mdiobus_scan_c22 ***
[    0.202306] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x10 reg: 0x03 val: 0xffff
[    0.202558] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.212681] mdio_bus mv88e6xxx-0: *** mdiobus_scan_c22 ***
[    0.262229] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x18a2
[    0.290246] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1a22
[    0.312443] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.316028] mdio_bus mv88e6xxx-0: *** mdiobus_scan_c45 ***
[    0.337996] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.364407] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.390654] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x00b7
[    0.392810] ata2: SATA link down (SStatus 0 SControl 300)
[    0.416887] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.445425] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x80c9
[    0.473606] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x00d3
[    0.501416] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cdc
[    0.529588] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8ce6
[    0.554726] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    0.555399] ata1.00: supports DRM functions and may not be fully accessible
[    0.555403] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
[    0.555410] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
[    0.556083] ata1.00: Features: Trust Dev-Sleep
[    0.556183] ata1.00: supports DRM functions and may not be fully accessible
[    0.556838] ata1.00: configured for UDMA/133
[    0.557012] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
[    0.557517] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
[    0.557525] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    0.557547] sd 0:0:0:0: [sda] Write Protect is off
[    0.557552] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.557585] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.557654] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
[    0.558145]  sda: sda1
[    0.558259] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    0.558422] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x00ef
[    0.584790] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x00f7
[    0.613522] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0102
[    0.642251] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x010c
[    0.670981] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0116
[    0.699709] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0121
[    0.728625] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.757356] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.786449] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8141
[    0.815176] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x814b
[    0.843908] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8155
[    0.872638] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8140
[    0.901005] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.929730] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    0.958275] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x017d
[    0.987002] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0188
[    1.015364] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d92
[    1.043910] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x019c
[    1.072277] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0da6
[    1.101000] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0db0
[    1.129548] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x81ba
[    1.157907] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0dc5
[    1.186090] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0dce
[    1.214815] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8dd8
[    1.243541] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8e03
[    1.271726] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    1.300270] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0217
[    1.328633] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    1.357357] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e2b
[    1.385900] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0235
[    1.414266] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e20
[    1.442811] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x824a
[    1.471164] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8e53
[    1.498797] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    1.526426] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e66
[    1.554598] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e70
[    1.582770] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8e79
[    1.610763] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0284
[    1.638582] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e8d
[    1.667118] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8297
[    1.694931] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    1.722921] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x02aa
[    1.751281] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0eb4
[    1.778911] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0ebd
[    1.806902] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x82c7
[    1.834711] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    1.863256] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x02da
[    1.891431] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x82e5
[    1.919249] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0eee
[    1.947785] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x82f8
[    1.975960] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0302
[    2.004138] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x030c
[    2.031189] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8314
[    2.058466] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f1d
[    2.086642] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8f27
[    2.114827] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.143003] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.171180] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.199357] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f4e
[    2.227532] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f58
[    2.255717] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f62
[    2.284250] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x836c
[    2.312433] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0376
[    2.340608] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0360
[    2.368969] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f8a
[    2.397147] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f93
[    2.425324] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.453501] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.481677] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fb1
[    2.509860] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fba
[    2.538035] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fc5
[    2.566209] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.594386] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    2.622564] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fe2
[    2.650742] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fec
[    2.678921] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0ff5
[    2.707643] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8fe0
[    2.712205] mvneta_bm f10c8000.bm: Buffer Manager for network controller enabled
[    2.713584] mvneta f1070000.ethernet eth0: Using device tree mac address d8:58:d7:00:6f:b9
[    2.714556] mvneta f1030000.ethernet eth1: Using device tree mac address d8:58:d7:00:6f:b7
[    2.715524] mvneta f1034000.ethernet eth2: Using device tree mac address d8:58:d7:00:6f:b8
[    2.715699] orion-ehci f1058000.usb: EHCI Host Controller
[    2.715713] orion-ehci f1058000.usb: new USB bus registered, assigned bus number 1
[    2.715755] orion-ehci f1058000.usb: irq 45, io mem 0xf1058000
[    2.730755] orion-ehci f1058000.usb: USB 2.0 started, EHCI 1.00
[    2.731088] hub 1-0:1.0: USB hub found
[    2.731107] hub 1-0:1.0: 1 port detected
[    2.731474] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    2.731486] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
[    2.731538] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    2.731563] xhci-hcd f10f0000.usb3: irq 46, io mem 0xf10f0000
[    2.731572] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    2.731579] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 3
[    2.731590] xhci-hcd f10f0000.usb3: Host supports USB 3.0 SuperSpeed
[    2.731833] hub 2-0:1.0: USB hub found
[    2.731851] hub 2-0:1.0: 1 port detected
[    2.731979] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.732181] hub 3-0:1.0: USB hub found
[    2.732197] hub 3-0:1.0: 1 port detected
[    2.732375] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    2.732387] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 4
[    2.732430] xhci-hcd f10f8000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    2.732449] xhci-hcd f10f8000.usb3: irq 47, io mem 0xf10f8000
[    2.732457] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    2.732464] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 5
[    2.732475] xhci-hcd f10f8000.usb3: Host supports USB 3.0 SuperSpeed
[    2.732705] hub 4-0:1.0: USB hub found
[    2.732725] hub 4-0:1.0: 1 port detected
[    2.732851] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.733062] hub 5-0:1.0: USB hub found
[    2.733078] hub 5-0:1.0: 1 port detected
[    2.733309] usbcore: registered new interface driver uas
[    2.733353] usbcore: registered new interface driver usb-storage
[    2.733820] armada38x-rtc f10a3800.rtc: registered as rtc0
[    2.733896] armada38x-rtc f10a3800.rtc: setting system clock to 2023-03-07T19:21:07 UTC (1678216867)
[    2.735580] at24 1-0054: 8192 byte 24c64 EEPROM, writable, 1 bytes/write
[    2.735611] i2c i2c-0: Added multiplexed i2c bus 1
[    2.735645] i2c i2c-0: Added multiplexed i2c bus 2
[    2.735674] i2c i2c-0: Added multiplexed i2c bus 3
[    2.735702] i2c i2c-0: Added multiplexed i2c bus 4
[    2.735730] i2c i2c-0: Added multiplexed i2c bus 5
[    2.735812] i2c i2c-0: Added multiplexed i2c bus 6
[    2.735842] i2c i2c-0: Added multiplexed i2c bus 7
[    2.736043] pca953x 8-0071: using no AI
[    2.737626] i2c i2c-0: Added multiplexed i2c bus 8
[    2.737634] pca954x 0-0070: registered 8 multiplexed busses for I2C mux pca9547
[    2.739068] orion_wdt: Initial timeout 171 sec
[    2.739255] sdhci: Secure Digital Host Controller Interface driver
[    2.739258] sdhci: Copyright(c) Pierre Ossman
[    2.739317] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.748039] marvell-cesa f1090000.crypto: CESA device successfully registered
[    2.748503] NET: Registered PF_INET6 protocol family
[    2.749168] Segment Routing with IPv6
[    2.749195] In-situ OAM (IOAM) with IPv6
[    2.749259] NET: Registered PF_PACKET protocol family
[    2.749371] Registering SWP/SWPB emulation handler
[    2.770763] mmc0: SDHCI controller on f10d8000.sdhci [f10d8000.sdhci] using ADMA
[    2.848092] sfp sfp: Host maximum power 3.0W
[    2.851931] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    2.862003] mdio_bus mv88e6xxx-1: *** mdiobus_scan_c22 ***
[    2.879502] mmc0: new high speed MMC card at address 0001
[    2.879819] mmcblk0: mmc0:0001 H8G4a\x92 7.28 GiB 
[    2.880804]  mmcblk0: p1
[    2.881033] mmcblk0boot0: mmc0:0001 H8G4a\x92 4.00 MiB 
[    2.881318] mmcblk0boot1: mmc0:0001 H8G4a\x92 4.00 MiB 
[    2.881526] mmcblk0rpmb: mmc0:0001 H8G4a\x92 4.00 MiB, chardev (250:0)
[    2.909764] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x9881
[    2.937887] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1a02
[    2.960055] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1b83
[    2.965581] mdio_bus mv88e6xxx-1: *** mdiobus_scan_c45 ***
[    2.985324] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x80a6
[    3.014234] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cb0
[    3.042420] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cba
[    3.071680] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cc5
[    3.098030] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x00cd
[    3.126945] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cd7
[    3.155490] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x00e2
[    3.182032] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
[    3.182049] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
[    3.183859] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cec
[    3.209353] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0cf3
[    3.237900] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x80fd
[    3.266266] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d07
[    3.294991] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d11
[    3.323174] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d1b
[    3.351897] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    3.380623] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8d30
[    3.408805] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    3.437345] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0144
[    3.465711] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    3.494436] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d58
[    3.522622] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d62
[    3.551344] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d6c
[    3.579530] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d76
[    3.606016] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d7e
[    3.632557] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d87
[    3.659641] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d8f
[    3.687255] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0d98
[    3.714340] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0da2
[    3.744166] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0dad
[    3.773451] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    3.801786] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    3.828936] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0dca
[    3.858228] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    3.888063] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0dc0
[    3.917895] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e0b
[    3.947548] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0216
[    3.977559] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e22
[    4.007396] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.037230] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8e38
[    4.066518] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e44
[    4.096319] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e4f
[    4.122872] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.152696] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8e63
[    4.181982] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e6d
[    4.211270] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.241094] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8e84
[    4.270384] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0e8e
[    4.300039] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0299
[    4.326272] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.355559] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0eac
[    4.385205] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x82b7
[    4.414670] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.443957] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.473788] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0ed8
[    4.503440] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x02e4
[    4.532905] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.562192] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0ef9
[    4.591835] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8305
[    4.619621] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    4.648373] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8f18
[    4.677662] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f24
[    4.707309] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x032f
[    4.736592] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0339
[    4.766058] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f45
[    4.795345] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f4f
[    4.824988] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x035a
[    4.854273] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0366
[    4.883739] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f70
[    4.913020] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f7b
[    4.943225] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0387
[    4.973238] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0f92
[    5.003082] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    5.029678] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8fa6
[    5.058974] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fb1
[    5.089165] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x03bc
[    5.116410] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x8fc6
[    5.142942] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fce
[    5.172594] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x03d9
[    5.202067] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x0fe4
[    5.232259] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x03f0
[    5.261732] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x19 val: 0xffff
[    5.310709] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x0e val: 0xffff
[    5.358659] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x05 val: 0x4000
[    5.398693] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x09 val: 0x0000
[    5.440937] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x08 val: 0x0333
[    5.481719] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x16 reg: 0x04 val: 0x3737
[    5.520185] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x301e
[    5.556120] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x3050
[    5.592051] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x3082
[    5.627992] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x30b4
[    5.663857] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x30e6
[    5.699797] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x3118
[    5.735739] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x314a
[    5.771678] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x317c
[    5.807621] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x31ae
[    5.843561] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x0b val: 0x31e0
[    5.886438] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1b reg: 0x0f val: 0xffff
[    5.930097] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    5.931759] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    5.933031] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    5.936172] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    6.002147] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=68)
[    6.002628] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1400
[    6.066866] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=69)
[    6.138146] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=70)
[    6.194112] mv88e6085 f1072004.mdio-mii:10: <- addr: 0x1c reg: 0x18 val: 0x1460
[    6.210326] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=71)
[    6.282325] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=72)
[    6.285236] device eth1 entered promiscuous mode
[    6.286112] device eth0 entered promiscuous mode
[    6.286131] DSA: tree 0 setup
[    6.286972] Freeing unused kernel image (initmem) memory: 1024K
[    6.287111] Run /init as init process
*** snip ***

Summary: Still 4 calls to mdio_bus_scan_c22, but also *2* calls to mdio_bus_scan_c45, approx. 190*100 reads by the switch driver



So, the two calls to mdio_bus_scan_c45 are *new* on the Omnia with the "bad" commit, and seem to cause quite some extra traffic (almost factor 10).



Regards, Klaus
  
Andrew Lunn March 7, 2023, 8:35 p.m. UTC | #6
> Summary: Still 4 calls to mdio_bus_scan_c22, but also *2* calls to mdio_bus_scan_c45, approx. 190*100 reads by the switch driver

Those calls to mdio_bus_scan_c45 are caused by 743a19e38d02 net: dsa:
mv88e6xxx: Separate C22 and C45 transactions.

Some families of the mv88e6xxx do support C45 bus transactions. That
includes the 6171 you have. Before, we never scanned the C45 bus, but
now we do.

But something does not add up. Doing an additional c45 scan should
only double the number of reads by the switch driver.

The only part of a c45 scan which is not linear is
mv88e6xxx_g2_smi_phy_wait() which is implemented by
mv88e6xxx_wait_mask(). That loops reading a register waiting for a bit
to change. Maybe print out the value of i, and see if it is looping
more times for C45 than C22?

     Andrew
  
Klaus Kudielka March 8, 2023, 6:34 p.m. UTC | #7
On Tue, 2023-03-07 at 21:35 +0100, Andrew Lunn wrote:
> > Summary: Still 4 calls to mdio_bus_scan_c22, but also *2* calls to mdio_bus_scan_c45, approx. 190*100 reads by the switch driver
> 
> Those calls to mdio_bus_scan_c45 are caused by 743a19e38d02 net: dsa:
> mv88e6xxx: Separate C22 and C45 transactions.

Well, yes and no. I understand orion mdio is MDIOBUS_NO_CAP
and therefore the c45 scan is *not* called until 1a136ca2e0
net: mdio: scan bus based on bus capabilities for C22 and C45.
Which is the behaviour I see.
(I needed a close look at the conditions in the if statements
that were removed then)


> The only part of a c45 scan which is not linear is
> mv88e6xxx_g2_smi_phy_wait() which is implemented by
> mv88e6xxx_wait_mask(). That loops reading a register waiting for a bit
> to change. Maybe print out the value of i, and see if it is looping
> more times for C45 than C22?

Here the debug code

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 0a5d6c7bb1..23816cad41 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -90,6 +90,7 @@ int mv88e6xxx_wait_mask(struct mv88e6xxx_chip *chip, int addr, int reg,
 	u16 data;
 	int err;
 	int i;
+	static unsigned wait_count = 0, loop_count = 0;
 
 	/* There's no bus specific operation to wait for a mask. Even
 	 * if the initial poll takes longer than 50ms, always do at
@@ -100,8 +101,13 @@ int mv88e6xxx_wait_mask(struct mv88e6xxx_chip *chip, int addr, int reg,
 		if (err)
 			return err;
 
-		if ((data & mask) == val)
+		if ((data & mask) == val) {
+			wait_count++;
+			loop_count += i;
+			if (wait_count % 10 == 0)
+				dev_warn(chip->dev, "wait_count %u, loop_count %u\n", wait_count, loop_count);
 			return 0;
+		}
 
 		if (i < 2)
 			cpu_relax();
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 5b2f48c09a..19fde21cae 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -569,6 +569,7 @@ static int mdiobus_scan_bus_c22(struct mii_bus *bus)
 {
 	int i;
 
+	dev_warn(&bus->dev, "*** mdiobus_scan_bus_c22 call ***\n");
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		if ((bus->phy_mask & BIT(i)) == 0) {
 			struct phy_device *phydev;
@@ -578,6 +579,7 @@ static int mdiobus_scan_bus_c22(struct mii_bus *bus)
 				return PTR_ERR(phydev);
 		}
 	}
+	dev_warn(&bus->dev, "*** mdiobus_scan_bus_c22 return ***\n");
 	return 0;
 }
 
@@ -585,6 +587,7 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
 {
 	int i;
 
+	dev_warn(&bus->dev, "*** mdiobus_scan_bus_c45 call ***\n");
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		if ((bus->phy_mask & BIT(i)) == 0) {
 			struct phy_device *phydev;
@@ -598,6 +601,7 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
 				return PTR_ERR(phydev);
 		}
 	}
+	dev_warn(&bus->dev, "*** mdiobus_scan_bus_c45 return ***\n");
 	return 0;
 }
 


And here the trimmed results from boot @ 1a136ca2e0, plus debug code.

It's not only the looping during the mv88e6xxx_wait_mask calls, but
also the sheer amount of mv88e6xxx_wait_mask calls during the c45 scans.
(c22: ~0.1 sec & ~150 calls, c45: 2.3-2.5 sec & ~4800 calls)


[    0.195215] mdio_bus fixed-0: *** mdiobus_scan_bus_c22 call ***
[    0.195221] mdio_bus fixed-0: *** mdiobus_scan_bus_c22 return ***
[    0.195617] mdio_bus f1072004.mdio-mii: *** mdiobus_scan_bus_c22 call ***
[    0.195623] mdio_bus f1072004.mdio-mii: *** mdiobus_scan_bus_c22 return ***
[    0.202583] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.212708] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c22 call ***
[    0.222200] mv88e6085 f1072004.mdio-mii:10: wait_count 10, loop_count 3
........
[    0.315724] mv88e6085 f1072004.mdio-mii:10: wait_count 150, loop_count 76
[    0.315908] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c22 return ***
[    0.315913] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c45 call ***
[    0.321095] mv88e6085 f1072004.mdio-mii:10: wait_count 160, loop_count 83
........
[    2.610380] mv88e6085 f1072004.mdio-mii:10: wait_count 4980, loop_count 1571
[    2.613258] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c45 return ***
[    2.755785] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    2.766047] mdio_bus mv88e6xxx-1: *** mdiobus_scan_bus_c22 call ***
[    2.766960] mv88e6085 f1072004.mdio-mii:10: wait_count 4990, loop_count 1574
........
[    2.867107] mv88e6085 f1072004.mdio-mii:10: wait_count 5130, loop_count 1645
[    2.869938] mdio_bus mv88e6xxx-1: *** mdiobus_scan_bus_c22 return ***
[    2.869943] mdio_bus mv88e6xxx-1: *** mdiobus_scan_bus_c45 call ***
[    2.871556] mv88e6085 f1072004.mdio-mii:10: wait_count 5140, loop_count 1649
........
[    5.371710] mv88e6085 f1072004.mdio-mii:10: wait_count 9970, loop_count 4282
[    5.373332] mdio_bus mv88e6xxx-1: *** mdiobus_scan_bus_c45 return ***




Best regards, Klaus
  
Andrew Lunn March 9, 2023, 4:36 p.m. UTC | #8
On Wed, Mar 08, 2023 at 07:34:40PM +0100, Klaus Kudielka wrote:
> On Tue, 2023-03-07 at 21:35 +0100, Andrew Lunn wrote:
> > > Summary: Still 4 calls to mdio_bus_scan_c22, but also *2* calls to mdio_bus_scan_c45, approx. 190*100 reads by the switch driver

I was wrong about something i said earlier. A C22 scan reads two
registers for each of the 32 possible locations of a C22 PHY on the
bus. A C45 scan is however much more expensive. It will read 30 time
two registers for each of the 32 possible locations of a C45 PHY on
the bus.

One things that could help is moving some code around a bit. Currently
mv88e6xxx_mdios_register() is called at the end of
mv88e6xxx_probe(). Try moving it to the beginning of
mv88e6xxx_setup(). The call to mv88e6xxx_mdios_unregister() then need
to move into mv88e6xxx_teardown().

	Andrew
  
Klaus Kudielka March 10, 2023, 8:22 p.m. UTC | #9
On Thu, 2023-03-09 at 17:36 +0100, Andrew Lunn wrote:
> 
> I was wrong about something i said earlier. A C22 scan reads two
> registers for each of the 32 possible locations of a C22 PHY on the
> bus. A C45 scan is however much more expensive. It will read 30 time
> two registers for each of the 32 possible locations of a C45 PHY on
> the bus.
> 
> One things that could help is moving some code around a bit. Currently
> mv88e6xxx_mdios_register() is called at the end of
> mv88e6xxx_probe(). Try moving it to the beginning of
> mv88e6xxx_setup(). The call to mv88e6xxx_mdios_unregister() then need
> to move into mv88e6xxx_teardown().
> 

Yes, that helps. Primarily, because mdiobus_scan_bus_c45 now is called only once,
and at least some things are done in parallel.

(Still, ~2s waiting for the C45 scan to complete).

[    0.382715] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c22 call ***
[    0.387571] mmc0: new high speed MMC card at address 0001
[    0.387953] mmcblk0: mmc0:0001 H8G4a\x92 7.28 GiB 
[    0.388929]  mmcblk0: p1
[    0.389197] mmcblk0boot0: mmc0:0001 H8G4a\x92 4.00 MiB 
[    0.389508] mmcblk0boot1: mmc0:0001 H8G4a\x92 4.00 MiB 
[    0.389850] mmcblk0rpmb: mmc0:0001 H8G4a\x92 4.00 MiB, chardev (250:0)
[    0.393323] ata2: SATA link down (SStatus 0 SControl 300)
[    0.486839] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c22 return ***
[    0.486850] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c45 call ***
[    0.554696] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    0.555373] ata1.00: supports DRM functions and may not be fully accessible
[    0.555378] ata1.00: ATA-10: KINGSTON SKC600MS512G, S4800105, max UDMA/133
[    0.555384] ata1.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 32)
[    0.556055] ata1.00: Features: Trust Dev-Sleep
[    0.556150] ata1.00: supports DRM functions and may not be fully accessible
[    0.556800] ata1.00: configured for UDMA/133
[    0.556981] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SKC600M 0105 PQ: 0 ANSI: 5
[    0.557506] sd 0:0:0:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
[    0.557515] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    0.557552] sd 0:0:0:0: [sda] Write Protect is off
[    0.557557] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.557613] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.557736] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
[    0.558295]  sda: sda1
[    0.558417] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    0.685992] sfp sfp: module TP-LINK          TL-SM321B        rev      sn 1403076900       dc 140401
[    0.686009] mvneta f1034000.ethernet eth2: switched to inband/1000base-x link mode
[    2.820390] mdio_bus mv88e6xxx-0: *** mdiobus_scan_bus_c45 return ***
[    3.464461] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    3.466123] mv88e6085 f1072004.mdio-mii:10: configuring for fixed/rgmii-id link mode
[    3.467397] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    3.471263] mv88e6085 f1072004.mdio-mii:10: Link is Up - 1Gbps/Full - flow control off
[    3.538112] mv88e6085 f1072004.mdio-mii:10 lan0 (uninitialized): PHY [mv88e6xxx-0:00] driver [Marvell 88E1540] (irq=68)
[    3.602833] mv88e6085 f1072004.mdio-mii:10 lan1 (uninitialized): PHY [mv88e6xxx-0:01] driver [Marvell 88E1540] (irq=69)
[    3.674111] mv88e6085 f1072004.mdio-mii:10 lan2 (uninitialized): PHY [mv88e6xxx-0:02] driver [Marvell 88E1540] (irq=70)
[    3.746290] mv88e6085 f1072004.mdio-mii:10 lan3 (uninitialized): PHY [mv88e6xxx-0:03] driver [Marvell 88E1540] (irq=71)
[    3.818291] mv88e6085 f1072004.mdio-mii:10 lan4 (uninitialized): PHY [mv88e6xxx-0:04] driver [Marvell 88E1540] (irq=72)
[    3.820845] device eth1 entered promiscuous mode
[    3.821730] device eth0 entered promiscuous mode
[    3.821749] DSA: tree 0 setup
[    3.822563] Freeing unused kernel image (initmem) memory: 1024K
[    3.822727] Run /init as init process


Regards, Klaus
  
Andrew Lunn March 10, 2023, 11:49 p.m. UTC | #10
> Yes, that helps. Primarily, because mdiobus_scan_bus_c45 now is called only once,
> and at least some things are done in parallel.

Great. Could you cook up a proper patch and submit it?

> (Still, ~2s waiting for the C45 scan to complete).

The number of times it polled for the bit is somewhat high. The silly
thing here is, you are doing MDIO over MDIO. The inner MDIO bus should
be just as fast as the outer MDIO bus, both around 2.5MHz. So i don't
see why it should need to loop more than once waiting for the inner
MDIO to complete..

     Andrew
  
Klaus Kudielka March 11, 2023, 6:49 a.m. UTC | #11
On Sat, 2023-03-11 at 00:49 +0100, Andrew Lunn wrote:
> > Yes, that helps. Primarily, because mdiobus_scan_bus_c45 now is called only once,
> > and at least some things are done in parallel.
> 
> Great. Could you cook up a proper patch and submit it?

I can give it a try. The commit message will be from my perspective,
and the change Suggested-By you.

Best regards, Klaus
  
Andrew Lunn March 11, 2023, 3:39 p.m. UTC | #12
On Sat, Mar 11, 2023 at 07:49:23AM +0100, Klaus Kudielka wrote:
> On Sat, 2023-03-11 at 00:49 +0100, Andrew Lunn wrote:
> > > Yes, that helps. Primarily, because mdiobus_scan_bus_c45 now is called only once,
> > > and at least some things are done in parallel.
> > 
> > Great. Could you cook up a proper patch and submit it?
> 
> I can give it a try. The commit message will be from my perspective,
> and the change Suggested-By you.

The commit message is fine.

I have one more idea which can speed things up. The scanning of the
MDIO bus works in two different ways depending on if there is a DT
node, describing what should be found on the bus. For mv88e6xxx, using
DT is optional. Some boards do, some don't.

If there is a DT node, only the addresses listed in DT are scanned.

If there is no DT node, by default, all 32 addresses on the bus are
scanned. However, DSA makes another assumption. There is a one to one
mapping between port number and PHY address on the MDIO bus. Port 0
uses MDIO address 0. Port 7 uses MDIO address 7 etc. If you have an 8
port switch, there is no point scanning addresses 8 to 31, they will
never be used.

The mdio bus structure has a member phy_mask. This is a bitmap. If bit
N is set, address N is not scanned. So i suggest you extend
mv88e6xxx_mdio_register() to set phy_mask based on
mv88e6xxx_num_ports(chip).

	Andrew
  
Klaus Kudielka March 11, 2023, 4:11 p.m. UTC | #13
On Sat, 2023-03-11 at 16:39 +0100, Andrew Lunn wrote:
> 
> I have one more idea which can speed things up. The scanning of the
> MDIO bus works in two different ways depending on if there is a DT
> node, describing what should be found on the bus. For mv88e6xxx, using
> DT is optional. Some boards do, some don't.
> 
> If there is a DT node, only the addresses listed in DT are scanned.

Here's the definition of the switch in the Turris Omnia device tree.

	/* Switch MV88E6176 at address 0x10 */
	switch@10 {
		pinctrl-names = "default";
		pinctrl-0 = <&swint_pins>;
		compatible = "marvell,mv88e6085";
		#address-cells = <1>;
		#size-cells = <0>;

		dsa,member = <0 0>;
		reg = <0x10>;

		interrupt-parent = <&gpio1>;
		interrupts = <13 IRQ_TYPE_LEVEL_LOW>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			ports@0 {
				reg = <0>;
				label = "lan0";
			};

			ports@1 {
				reg = <1>;
				label = "lan1";
			};

			ports@2 {
				reg = <2>;
				label = "lan2";
			};

			ports@3 {
				reg = <3>;
				label = "lan3";
			};

			ports@4 {
				reg = <4>;
				label = "lan4";
			};

			ports@5 {
				reg = <5>;
				label = "cpu";
				ethernet = <&eth1>;
				phy-mode = "rgmii-id";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};

			ports@6 {
				reg = <6>;
				label = "cpu";
				ethernet = <&eth0>;
				phy-mode = "rgmii-id";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};
		};

> 
> If there is no DT node, by default, all 32 addresses on the bus are
> scanned. However, DSA makes another assumption. There is a one to one
> mapping between port number and PHY address on the MDIO bus. Port 0
> uses MDIO address 0. Port 7 uses MDIO address 7 etc. If you have an 8
> port switch, there is no point scanning addresses 8 to 31, they will
> never be used.
> 
> The mdio bus structure has a member phy_mask. This is a bitmap. If bit
> N is set, address N is not scanned. So i suggest you extend
> mv88e6xxx_mdio_register() to set phy_mask based on
> mv88e6xxx_num_ports(chip).
> 

What you are proposing here would not show any improvement on the
Omnia, as only the 6 ports would be scanned - right? 

>         Andrew
  
Klaus Kudielka March 11, 2023, 5:32 p.m. UTC | #14
On Sat, 2023-03-11 at 17:11 +0100, Klaus Kudielka wrote:
> On Sat, 2023-03-11 at 16:39 +0100, Andrew Lunn wrote:
> 
> > If there is no DT node, by default, all 32 addresses on the bus are
> > scanned. However, DSA makes another assumption. There is a one to one
> > mapping between port number and PHY address on the MDIO bus. Port 0
> > uses MDIO address 0. Port 7 uses MDIO address 7 etc. If you have an 8
> > port switch, there is no point scanning addresses 8 to 31, they will
> > never be used.
> > 
> > The mdio bus structure has a member phy_mask. This is a bitmap. If bit
> > N is set, address N is not scanned. So i suggest you extend
> > mv88e6xxx_mdio_register() to set phy_mask based on
> > mv88e6xxx_num_ports(chip).
> > 
> 
> What you are proposing here would not show any improvement on the
> Omnia, as only the 6 ports would be scanned - right? 
> 

Well, maybe I misunderstood the argument with DT completely, so I gave it a try:

--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3797,6 +3797,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
        bus->read_c45 = mv88e6xxx_mdio_read_c45;
        bus->write_c45 = mv88e6xxx_mdio_write_c45;
        bus->parent = chip->dev;
+       bus->phy_mask = GENMASK(31, mv88e6xxx_num_ports(chip));
 
        if (!external) {
                err = mv88e6xxx_g2_irq_mdio_setup(chip, bus);

> 

Now THAT one makes a difference! With this on top, I'm back at normal boot time!
I hope this is what you had in mind?

Best regards, Klaus
  
Andrew Lunn March 11, 2023, 5:57 p.m. UTC | #15
> Well, maybe I misunderstood the argument with DT completely, so I gave it a try:
> 
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -3797,6 +3797,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
>         bus->read_c45 = mv88e6xxx_mdio_read_c45;
>         bus->write_c45 = mv88e6xxx_mdio_write_c45;
>         bus->parent = chip->dev;
> +       bus->phy_mask = GENMASK(31, mv88e6xxx_num_ports(chip));
>  
>         if (!external) {
>                 err = mv88e6xxx_g2_irq_mdio_setup(chip, bus);
> 
> > 
> 
> Now THAT one makes a difference! With this on top, I'm back at normal boot time!
> I hope this is what you had in mind?

Yep, that is what i meant. Please could you also submit a patch for this?

     Andrew
  
Andrew Lunn March 12, 2023, 2:53 a.m. UTC | #16
> Here's the definition of the switch in the Turris Omnia device tree.
> 
> 	/* Switch MV88E6176 at address 0x10 */
> 	switch@10 {
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&swint_pins>;
> 		compatible = "marvell,mv88e6085";
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
> 		dsa,member = <0 0>;
> 		reg = <0x10>;
> 
> 		interrupt-parent = <&gpio1>;
> 		interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
> 
> 		ports {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 
> 			ports@0 {
> 				reg = <0>;
> 				label = "lan0";
> 			};
> 
> 			ports@1 {
> 				reg = <1>;
> 				label = "lan1";
> 			};
> 
> 			ports@2 {
> 				reg = <2>;
> 				label = "lan2";
> 			};
> 
> 			ports@3 {
> 				reg = <3>;
> 				label = "lan3";
> 			};
> 
> 			ports@4 {
> 				reg = <4>;
> 				label = "lan4";
> 			};
> 
> 			ports@5 {
> 				reg = <5>;
> 				label = "cpu";
> 				ethernet = <&eth1>;
> 				phy-mode = "rgmii-id";
> 
> 				fixed-link {
> 					speed = <1000>;
> 					full-duplex;
> 				};
> 			};
> 
> 			ports@6 {
> 				reg = <6>;
> 				label = "cpu";
> 				ethernet = <&eth0>;
> 				phy-mode = "rgmii-id";
> 
> 				fixed-link {
> 					speed = <1000>;
> 					full-duplex;
> 				};
> 			};
> 		};
> 
> What you are proposing here would not show any improvement on the
> Omnia, as only the 6 ports would be scanned - right? 

Correct. But their also should not of been any noticeable slow down,
because there should not be any additional scanning when everything is
described in DT. And the move of the MDIO bus registration from probe
to setup should actually make it faster than before.

	  Andrew
  
Klaus Kudielka March 12, 2023, 9:04 a.m. UTC | #17
On Sun, 2023-03-12 at 03:53 +0100, Andrew Lunn wrote:
> > 
> > What you are proposing here would not show any improvement on the
> > Omnia, as only the 6 ports would be scanned - right? 
> 
> Correct. But their also should not of been any noticeable slow down,
> because there should not be any additional scanning when everything is
> described in DT. And the move of the MDIO bus registration from probe
> to setup should actually make it faster than before.
> 

But then, why *do* I see such a big difference on the Omnia?

mdiobus_scan_bus_c45() takes:
~2.7 seconds without phy_mask patch
~0.2 seconds with phy_mask patch

(It's not a big deal, but somehow strange)

Regards, Klaus


PS: There was another open question: How long does the first
unsuccessful mv88e6xxx_probe() take, when calling
mv88e6xxx_mdios_register() from mv88e6xxx_setup()?

I would say "negligible":

[    0.194414] mv88e6085 f1072004.mdio-mii:10: *** mv88e6xxx_probe call ***
[    0.194739] mv88e6085 f1072004.mdio-mii:10: switch 0x1760 detected: Marvell 88E6176, revision 1
[    0.208163] mv88e6085 f1072004.mdio-mii:10: *** mv88e6xxx_probe return -517 ***
  
Klaus Kudielka March 12, 2023, 3:15 p.m. UTC | #18
On Sun, 2023-03-12 at 10:04 +0100, Klaus Kudielka wrote:
> On Sun, 2023-03-12 at 03:53 +0100, Andrew Lunn wrote:
> > 
> > Correct. But their also should not of been any noticeable slow down,
> > because there should not be any additional scanning when everything is
> > described in DT. And the move of the MDIO bus registration from probe
> > to setup should actually make it faster than before.
> > 
> 
> But then, why *do* I see such a big difference on the Omnia?
> 
> mdiobus_scan_bus_c45() takes:
> ~2.7 seconds without phy_mask patch
> ~0.2 seconds with phy_mask patch

Following up myself, the answer is in the call path
mv88e6xxx_mdios_register()
	 -> mv88e6xxx_mdio_register()
		-> of_mdiobus_register()

A child node "mdio" would be needed for the scan to be limited by
the device tree. And this one is *not* in armada-385-turris-omnia.dts.

My (incorrect) understanding was, the child node "ports" would trigger
that behaviour.

Best regards, Klaus
  
Andrew Lunn March 12, 2023, 11:57 p.m. UTC | #19
On Sun, Mar 12, 2023 at 04:15:41PM +0100, Klaus Kudielka wrote:
> On Sun, 2023-03-12 at 10:04 +0100, Klaus Kudielka wrote:
> > On Sun, 2023-03-12 at 03:53 +0100, Andrew Lunn wrote:
> > > 
> > > Correct. But their also should not of been any noticeable slow down,
> > > because there should not be any additional scanning when everything is
> > > described in DT. And the move of the MDIO bus registration from probe
> > > to setup should actually make it faster than before.
> > > 
> > 
> > But then, why *do* I see such a big difference on the Omnia?
> > 
> > mdiobus_scan_bus_c45() takes:
> > ~2.7 seconds without phy_mask patch
> > ~0.2 seconds with phy_mask patch
> 
> Following up myself, the answer is in the call path
> mv88e6xxx_mdios_register()
> 	 -> mv88e6xxx_mdio_register()
> 		-> of_mdiobus_register()
> 
> A child node "mdio" would be needed for the scan to be limited by
> the device tree. And this one is *not* in armada-385-turris-omnia.dts.
> 
> My (incorrect) understanding was, the child node "ports" would trigger
> that behaviour.

Yes, of_mdiobus_register() calls mdiobus_register() if there is no
MDIO node in DT. And that will result in a full bus scan, limited by
phy_mask.

And for completeness, there is one additional case. When there is a DT
description, reg = <> is optional for a PHY. Most cases, it is used,
but if you have a board designs which can take different pin
compatible PHYs, the address of the PHY might not be known. After
probing PHYs which are listed in DT with reg properties, it will scan
the bus for additional PHYs and assign them to entries which do not
have reg properties.

	Andrew
  

Patch

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index a664eeb1868d..5b2f48c09a6a 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -711,9 +711,7 @@  int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 			goto error_reset_gpiod;
 	}
 
-	if (bus->probe_capabilities == MDIOBUS_NO_CAP ||
-	    bus->probe_capabilities == MDIOBUS_C22 ||
-	    bus->probe_capabilities == MDIOBUS_C22_C45) {
+	if (bus->read) {
 		err = mdiobus_scan_bus_c22(bus);
 		if (err)
 			goto error;
@@ -721,9 +719,7 @@  int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 
 	prevent_c45_scan = mdiobus_prevent_c45_scan(bus);
 
-	if (!prevent_c45_scan &&
-	    (bus->probe_capabilities == MDIOBUS_C45 ||
-	     bus->probe_capabilities == MDIOBUS_C22_C45)) {
+	if (!prevent_c45_scan && bus->read_c45) {
 		err = mdiobus_scan_bus_c45(bus);
 		if (err)
 			goto error;