phy: marvell: phy-mvebu-cp110-comphy: link failure and lockup built as module (=M)
Subsystems (2)
Hi all, please excuse my cross-posting phy topic to clk list, after debugging it seems the more appropriate place.
The subject is drivers/clk/mvebu/cp110-system-controller.c:
I need some advice how to deal with below requirement:
IF a pci controller clock was active at the time of bootloader to Linux handover, then the clock must not be stopped before the pci driver has completed probe. In particular deferred probe must not allow the clock to stop intermittently.
Motivation:
There appears to be a situation on CN9130 SoC (and likely Armada 8040, too) where clock framework stopping the pci clock before the pci driver has bound to it causes pci to malfunction, and the system to lock up.
Note this is despite the pci driver starting the clock again!
On Armada 8040/CN9130 the bootloader handles pci configuration and link-up. Later Linux pcie-armada8k driver just takes over the existing link.
On systems with all drivers builtin the pci driver probed early enough to take ownership of the relevant clock before it could be turned off due to lack of users.
However once the comphy driver is set as module, which causes pci probe delay till after rootfs is mounted, the pci clocks are stopped - and then later started again on pci probe.
Am 25.10.25 um 14:45 schrieb Josua Mayer:
Quoted 30 lines
Dear Maintainers,
I came across a bug srelating to cp110 comphy driver.
On a board with CN9130 SoC + 2 external CPs Debian 13 freezes during boot, at some point after initramfs and kernel module loading has started.
This occurs only when a pci card is present and had link-up from u-boot, e.g.:
PCIE-0: Link up (Gen3-x4, Bus0)
PCIE-12: Link up (Gen3-x1, Bus12)The issue is reproducible with a generic rootfs, kernel built with arm64 defconfig, no initramfs, but a single kernel configuration change:
CONFIG_PHY_MVEBU_CP110_COMPHY=y-> mi.e. building the comphy driver as a module.
The problem shows up usually by the console freezing during boot, before eventually the system watchdog hard resets SoC.
[1] below shows the pci kernel messages during probe of the x4 port on my board, with the comphy driver builtin. After this log I reach login prompt and the system works as intended.
[2] shows the pci messages for same port with comphy as a module. After the final line the systemd hard reset once watchdog expired.
Both logs were captured on v6.12.48, but I did reproduce the problem with v6.18-rc1 too. For reference I am attaching full console logs as files to this mail.
Quoted 2 lines
Most notably in the error case we get "Phy link never came up". Perhaps when comphy is a module some clock is stopped before pci probe starts ...
I added printk to drivers/clk/mvebu/cp110-system-controller.c on specifically disabling an enabled clock - and compared results between good and bad case.
When comphy was a module, the following clock disable events were logged, that do not occur with comphy builtin (network clocks filtered out):
[ 2.981292] cp110-clk: disabling enabled clock "f6440000-pcie_x4" [ 3.014288] cp110-clk: disabling enabled clock "f6440000-sata-usb" [ 3.020502] cp110-clk: disabling enabled clock "f6440000-sata" [ 3.026364] cp110-clk: disabling enabled clock "f6440000-pcie_x11" [ 3.032576] cp110-clk: disabling enabled clock "f6440000-pcie_x10" [ 3.141640] cp110-clk: disabling enabled clock "f2440000-pcie_x4"
The last line with "f2440000-pcie_x4" affects the x4 port on CP0 that I have a card connected.
Later just before pci controller probe the respective is re-enabled:
[ 7.830286] cp110-clk: enabling disabled clock "f2440000-pcie_x4"
but no link detected - and shortly after, the system freezes.
Inspired by this I hacked the clock driver further, to disarm disable function for pci clocks only.
And - the system works perfectly again with comphy driver as a module (v6.18-rc1).
Adding in CC maintainers of cp110 clock driver for further advice ... (hope that is okay).
Quoted 45 lines
and after pci probe function completes it locks up the controller that actually had a link, even though kernel driver did not detect.
[1]
[ 1.995477] armada8k-pcie f2600000.pcie:armada8k_pcie_probestart
[ 2.104941] armada8k-pcie f2600000.pcie: host bridge /cp0/pcie@f2600000 ranges:
[ 2.112319] armada8k-pcie f2600000.pcie: MEM 0x00c0000000..0x00dfefffff ->0x00c0000000[ 2.120841] armada8k-pcie f2600000.pcie: iATU: unroll F, 8 ob, 8 ib, align 64K, limit 4G [ 2.232055] armada8k-pcie f2600000.pcie: PCIe Gen.3 x4 link up
[ 2.238103] armada8k-pcie f2600000.pcie: PCI host bridge to bus 0000:00
[ 2.244760]pci_bus0000:00: root bus resource [bus 00-ff]
[ 2.250282]pci_bus0000:00: root bus resource [mem 0xc0000000-0xdfefffff]
[ 2.257213] pci 0000:00:00.0: [11ab:0110] type 01 class0x060400PCIe Root Port [ 2.264559] pci 0000:00:00.0: BAR 0 [mem 0x00000000-0x000fffff]
[ 2.270516] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[ 2.275773] pci 0000:00:00.0: bridge window [mem 0xc0000000-0xc00fffff]
[ 2.282643] pci 0000:00:00.0: supports D1 D2
[ 2.286937] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[ 2.294292] pci 0000:01:00.0: [144d:a804] type 00 class0x010802PCIe Endpoint [ 2.301669] pci 0000:01:00.0: BAR 0 [mem 0xc0000000-0xc0003fff 64bit]
[ 2.316143] pci 0000:00:00.0: BAR 0 [mem 0xc0000000-0xc00fffff]: assigned
[ 2.322972] pci 0000:00:00.0: bridge window [mem 0xc0100000-0xc01fffff]: assigned [ 2.330495] pci 0000:01:00.0: BAR 0 [mem 0xc0100000-0xc0103fff 64bit]: assigned [ 2.337887] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[ 2.343142] pci 0000:00:00.0: bridge window [mem 0xc0100000-0xc01fffff]
[ 2.349968]pci_bus0000:00: resource 4 [mem 0xc0000000-0xdfefffff]
[ 2.356267]pci_bus0000:01: resource 1 [mem 0xc0100000-0xc01fffff]
[ 2.362778] pcieport 0000:00:00.0: PME: Signaling with IRQ 62
[ 2.368745] pcieport 0000:00:00.0: AER: enabled with IRQ 62
[ 2.374447] armada8k-pcie f2600000.pcie:armada8k_pcie_probeend[2]
[ 17.356469] armada8k-pcie f2600000.pcie:armada8k_pcie_probestart
[ 17.444656] armada8k-pcie f2600000.pcie: host bridge /cp0/pcie@f2600000 ranges:
[ 17.452042] armada8k-pcie f2600000.pcie: MEM 0x00c0000000..0x00dfefffff ->0x00c0000000[ 17.460572] armada8k-pcie f2600000.pcie: iATU: unroll F, 8 ob, 8 ib, align 64K, limit 4G [ 18.427718] armada8k-pcie f2600000.pcie: Phy link never came up
[ 18.433776] armada8k-pcie f2600000.pcie: PCI host bridge to bus 0006:00
[ 18.440445]pci_bus0006:00: root bus resource [bus 00-ff]
[ 18.445968]pci_bus0006:00: root bus resource [mem 0xc0000000-0xdfefffff]I am a bit lost here in how to further debug this - kindly share some ideas if you have any.
sincerely
Josua Mayer
Quoted 15 lines · Josua Mayer
Dear Maintainers,
I came across a bug srelating to cp110 comphy driver.
On a board with CN9130 SoC + 2 external CPs Debian 13 freezes during boot, at some point after initramfs and kernel module loading has started.
This occurs only when a pci card is present and had link-up from u-boot, e.g.:
PCIE-0: Link up (Gen3-x4, Bus0)
PCIE-12: Link up (Gen3-x1, Bus12)The issue is reproducible with a generic rootfs, kernel built with arm64 defconfig, no initramfs, but a single kernel configuration change:
Quoted 6 lines
CONFIG_PHY_MVEBU_CP110_COMPHY=y-> mi.e. building the comphy driver as a module.
The problem shows up usually by the console freezing during boot, before eventually the system watchdog hard resets SoC.
Do you know at what point the comphy driver module is loaded?
Do you get the same behaviour if the comphy module is not built/not available?
I _guess_ that there is some missing EPROBE_DEFER code. It could be when the PCIE code tries to get the PHY and fails, it just keeps going, when in fact it needs to return EPROBE_DEFER, so that the core will try again later, once the module has been loaded.
Actually
static int armada8k_pcie_setup_phys(struct armada8k_pcie *pcie)
{
struct dw_pcie *pci = pcie->pci;
struct device *dev = pci->dev;
struct device_node *node = dev->of_node;
int ret = 0;
int i;
for (i = 0; i < ARMADA8K_PCIE_MAX_LANES; i++) {
pcie->phy[i] = devm_of_phy_get_by_index(dev, node, i);
if (IS_ERR(pcie->phy[i])) {
if (PTR_ERR(pcie->phy[i]) != -ENODEV)
return PTR_ERR(pcie->phy[i]);
pcie->phy[i] = NULL;
continue;
}
pcie->phy_count++;
}Do you see devm_of_phy_get_by_index() return -ENODEV? If i'm reading this code correctly, it will just continue without the PHY.
Andrew
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Am 27.10.25 um 03:06 schrieb Andrew Lunn:
Quoted 16 lines · Josua Mayer
Quoted 15 lines
Dear Maintainers,
I came across a bug srelating to cp110 comphy driver.
On a board with CN9130 SoC + 2 external CPs Debian 13 freezes during boot, at some point after initramfs and kernel module loading has started.
This occurs only when a pci card is present and had link-up from u-boot, e.g.:
PCIE-0: Link up (Gen3-x4, Bus0)
PCIE-12: Link up (Gen3-x1, Bus12)The issue is reproducible with a generic rootfs, kernel built with arm64 defconfig, no initramfs, but a single kernel configuration change:
Quoted 7 lines
Quoted 6 lines
CONFIG_PHY_MVEBU_CP110_COMPHY=y-> mi.e. building the comphy driver as a module.
The problem shows up usually by the console freezing during boot, before eventually the system watchdog hard resets SoC.
Do you know at what point the comphy driver module is loaded?
By making it a module, loading is delayed till after rootfs mount in my case. That is after udev has started.
Quoted 3 lines
Do you get the same behaviour if the comphy module is not built/not available?
In this case the system does not lock up, but pci is not functional either.
With CONFIG_DEBUG_DRIVER=y I can see that pci probe is pending, waiting for the phys.
Quoted 29 lines
I _guess_ that there is some missing
EPROBE_DEFERcode. It could be when the PCIE code tries to get the PHY and fails, it just keeps going, when in fact it needs to returnEPROBE_DEFER, so that the core will try again later, once the module has been loaded.Actually
static int
armada8k_pcie_setup_phys(struct armada8k_pcie *pcie){ struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; struct device_node *node = dev->of_node; int ret = 0; int i; for (i = 0; i < ARMADA8K_PCIE_MAX_LANES; i++) { pcie->phy[i] = devm_of_phy_get_by_index(dev, node, i); if (IS_ERR(pcie->phy[i])) { if (PTR_ERR(pcie->phy[i]) != -ENODEV) return PTR_ERR(pcie->phy[i]); pcie->phy[i] = NULL; continue; } pcie->phy_count++; }
Quoted 2 lines
Do you see
devm_of_phy_get_by_index()return-ENODEV? If i'm reading this code correctly, it will just continue without the PHY.
This code will return from probe with any error except ENODEV. So if get_phy returned EDEFER, probe should return EDEFER.
From new boot-log with DEBUG_DRIVER=y, this is the first invocation of pci driver probe:
[ 23.091031] platform f2600000.pcie: bus: 'platform': __driver_probe_device: matched device with driver armada8k-pcie [ 23.101921] platform f2600000.pcie: error -EPROBE_DEFER: wait for supplier /cp0-bus/bus@f2000000/phy@120000/phy@3 [ 23.112436] platform f2600000.pcie: Added to deferred list
And it defers because of fourth lane phy. Actually that was before the clock driver probed ...
[ 24.491274] marvell-cp110-clock f2440000.system-controller:clock: bus: 'platform': really_probe: bound device to driver marvell-cp110-clock
The pci clock is only disabled much later:
[ 40.676931] cp110-clk: disabling enabled clock "f2440000-pcie_x4"
At that point pci probe had been deferred 5 times in total.
sincerely
Josua Mayer
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Am 28.10.25 um 19:09 schrieb Josua Mayer:
Quoted 75 lines
Am 27.10.25 um 03:06 schrieb Andrew Lunn:
Quoted 16 lines · Josua Mayer
Quoted 15 lines
Dear Maintainers,
I came across a bug srelating to cp110 comphy driver.
On a board with CN9130 SoC + 2 external CPs Debian 13 freezes during boot, at some point after initramfs and kernel module loading has started.
This occurs only when a pci card is present and had link-up from u-boot, e.g.:
PCIE-0: Link up (Gen3-x4, Bus0)
PCIE-12: Link up (Gen3-x1, Bus12)The issue is reproducible with a generic rootfs, kernel built with arm64 defconfig, no initramfs, but a single kernel configuration change:
Quoted 7 lines
Quoted 6 lines
CONFIG_PHY_MVEBU_CP110_COMPHY=y-> mi.e. building the comphy driver as a module.
The problem shows up usually by the console freezing during boot, before eventually the system watchdog hard resets SoC.
Do you know at what point the comphy driver module is loaded?
By making it a module, loading is delayed till after rootfs mount in my case. That is after udev has started.
Quoted 2 lines
Do you get the same behaviour if the comphy module is not built/not available?
In this case the system does not lock up, but pci is not functional either.
With
CONFIG_DEBUG_DRIVER=yI can see that pci probe is pending, waiting for the phys.Quoted 28 lines
I _guess_ that there is some missing
EPROBE_DEFERcode. It could be when the PCIE code tries to get the PHY and fails, it just keeps going, when in fact it needs to returnEPROBE_DEFER, so that the core will try again later, once the module has been loaded.Actually
static int
armada8k_pcie_setup_phys(struct armada8k_pcie *pcie){ struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; struct device_node *node = dev->of_node; int ret = 0; int i; for (i = 0; i < ARMADA8K_PCIE_MAX_LANES; i++) { pcie->phy[i] = devm_of_phy_get_by_index(dev, node, i); if (IS_ERR(pcie->phy[i])) { if (PTR_ERR(pcie->phy[i]) != -ENODEV) return PTR_ERR(pcie->phy[i]); pcie->phy[i] = NULL; continue; } pcie->phy_count++; }Quoted 2 lines
Do you see
devm_of_phy_get_by_index()return-ENODEV? If i'm reading this code correctly, it will just continue without the PHY.This code will return from probe with any error except ENODEV. So if
get_phyreturned EDEFER, probe should return EDEFER.From new boot-log with DEBUG_DRIVER=y, this is the first invocation of pci driver probe:
[ 23.091031] platform f2600000.pcie: bus: 'platform':
__driver_probe_device: matched device with driver armada8k-pcie [ 23.101921] platform f2600000.pcie: error -EPROBE_DEFER: wait for supplier /cp0-bus/bus@f2000000/phy@120000/phy@3 [ 23.112436] platform f2600000.pcie: Added to deferred listAnd it defers because of fourth lane phy. Actually that was before the clock driver probed ...
Quoted 7 lines
[ 24.491274] marvell-cp110-clock f2440000.system-controller:clock: bus: 'platform':
really_probe: bound device to driver marvell-cp110-clockThe pci clock is only disabled much later:
[ 40.676931] cp110-clk: disabling enabled clock "f2440000-pcie_x4"
At that point pci probe had been deferred 5 times in total.
As a workaround I have successfully used clk_ignore_unused boot option ... I believe that confirms common code stops the clock before pci driver can complete probe.
Is there any guidance how to deal with this situation?
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Dear Maintainers,
I came across a bug srelating to cp110 comphy driver.
On a board with CN9130 SoC + 2 external CPs Debian 13 freezes during boot, at some point after initramfs and kernel module loading has started.
This occurs only when a pci card is present and had link-up from u-boot, e.g.:
PCIE-0: Link up (Gen3-x4, Bus0)
PCIE-12: Link up (Gen3-x1, Bus12)
The issue is reproducible with a generic rootfs, kernel built with arm64 defconfig, no initramfs, but a single kernel configuration change:
CONFIG_PHY_MVEBU_CP110_COMPHY=y -> m
i.e. building the comphy driver as a module.
The problem shows up usually by the console freezing during boot, before eventually the system watchdog hard resets SoC.
[1] below shows the pci kernel messages during probe of the x4 port on my board, with the comphy driver builtin. After this log I reach login prompt and the system works as intended.
[2] shows the pci messages for same port with comphy as a module. After the final line the systemd hard reset once watchdog expired.
Both logs were captured on v6.12.48, but I did reproduce the problem with v6.18-rc1 too. For reference I am attaching full console logs as files to this mail.
Most notably in the error case we get "Phy link never came up".
Perhaps when comphy is a module some clock is stopped before pci probe starts ... and after pci probe function completes it locks up the controller that actually had a link, even though kernel driver did not detect.
[1]
[ 1.995477] armada8k-pcie f2600000.pcie: armada8k_pcie_probe start
[ 2.104941] armada8k-pcie f2600000.pcie: host bridge /cp0/pcie@f2600000 ranges:
[ 2.112319] armada8k-pcie f2600000.pcie: MEM 0x00c0000000..0x00dfefffff -> 0x00c0000000 [ 2.120841] armada8k-pcie f2600000.pcie: iATU: unroll F, 8 ob, 8 ib, align 64K, limit 4G [ 2.232055] armada8k-pcie f2600000.pcie: PCIe Gen.3 x4 link up
[ 2.238103] armada8k-pcie f2600000.pcie: PCI host bridge to bus 0000:00
[ 2.244760] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 2.250282] pci_bus 0000:00: root bus resource [mem 0xc0000000-0xdfefffff]
[ 2.257213] pci 0000:00:00.0: [11ab:0110] type 01 class 0x060400 PCIe Root Port [ 2.264559] pci 0000:00:00.0: BAR 0 [mem 0x00000000-0x000fffff]
[ 2.270516] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[ 2.275773] pci 0000:00:00.0: bridge window [mem 0xc0000000-0xc00fffff]
[ 2.282643] pci 0000:00:00.0: supports D1 D2
[ 2.286937] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[ 2.294292] pci 0000:01:00.0: [144d:a804] type 00 class 0x010802 PCIe Endpoint [ 2.301669] pci 0000:01:00.0: BAR 0 [mem 0xc0000000-0xc0003fff 64bit]
[ 2.316143] pci 0000:00:00.0: BAR 0 [mem 0xc0000000-0xc00fffff]: assigned
[ 2.322972] pci 0000:00:00.0: bridge window [mem 0xc0100000-0xc01fffff]: assigned [ 2.330495] pci 0000:01:00.0: BAR 0 [mem 0xc0100000-0xc0103fff 64bit]: assigned [ 2.337887] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[ 2.343142] pci 0000:00:00.0: bridge window [mem 0xc0100000-0xc01fffff]
[ 2.349968] pci_bus 0000:00: resource 4 [mem 0xc0000000-0xdfefffff]
[ 2.356267] pci_bus 0000:01: resource 1 [mem 0xc0100000-0xc01fffff]
[ 2.362778] pcieport 0000:00:00.0: PME: Signaling with IRQ 62
[ 2.368745] pcieport 0000:00:00.0: AER: enabled with IRQ 62
[ 2.374447] armada8k-pcie f2600000.pcie: armada8k_pcie_probe end
[2]
[ 17.356469] armada8k-pcie f2600000.pcie: armada8k_pcie_probe start
[ 17.444656] armada8k-pcie f2600000.pcie: host bridge /cp0/pcie@f2600000 ranges:
[ 17.452042] armada8k-pcie f2600000.pcie: MEM 0x00c0000000..0x00dfefffff -> 0x00c0000000 [ 17.460572] armada8k-pcie f2600000.pcie: iATU: unroll F, 8 ob, 8 ib, align 64K, limit 4G [ 18.427718] armada8k-pcie f2600000.pcie: Phy link never came up
[ 18.433776] armada8k-pcie f2600000.pcie: PCI host bridge to bus 0006:00
[ 18.440445] pci_bus 0006:00: root bus resource [bus 00-ff]
[ 18.445968] pci_bus 0006:00: root bus resource [mem 0xc0000000-0xdfefffff]
I am a bit lost here in how to further debug this - kindly share some ideas if you have any.
sincerely
Josua Mayer
BootROM - 2.03
Starting CP-0 IOROM 1.07
Booting from SD 0 (0x29)
Found valid image at boot postion 0x002
lNOTICE: Starting binary extension NOTICE: Change the base address of AP0-CP1 to f4000000 NOTICE: Change the base address of AP0-CP2 to f6000000 NOTICE: SVC: DEV ID: CN913x, FREQ Mode: 0xd NOTICE: SVC: AVS work point changed from 0x2e9 to 0x2df NOTICE: Found valid DDR SPD mv_ddr: devel-gff64cb5 (Oct 25 2025 - 11:54:09)
SSCG_EN
Synopsys DDR43 PHY Firmware version: A-2017.11
SNPS DDR: 1D training passed
SNPS DDR: 2D training passed
SNPS DDR: training completedmv_ddr: scrubbing memory...
dma memcmp passmv_ddr: completed successfully
NOTICE: Cold boot