[PATCH 4/5] phy: rockchip-snps-pcie3: Check more sram init status for RK3588

Alexey Charkov alchark at flipper.net
Tue Dec 1 02:47:10 PST 2026


Hi Shawn,

On Tue, Dec 1, 2026 at 1:51 PM Shawn Lin <shawn.lin at rock-chips.com> wrote:
>
> 在 2026/11/13 星期五 16:46, Alexey Charkov 写道:
> > Hi Shawn,
> >
> > On Wed, Dec 24, 2025 at 11:10 AM Shawn Lin <shawn.lin at rock-chips.com> wrote:
> >>
> >> All the lower 4 bits should be checked which shows the mpllx_state.
> >>
> >> Signed-off-by: Shawn Lin <shawn.lin at rock-chips.com>
> >> ---
> >>
> >>   drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
> >> index f5a5d0af..6cc38e3 100644
> >> --- a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
> >> +++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
> >> @@ -43,7 +43,7 @@
> >>   #define RK3588_PCIE3PHY_GRF_PHY0_LN1_CON1      0x1104
> >>   #define RK3588_PCIE3PHY_GRF_PHY1_LN0_CON1      0x2004
> >>   #define RK3588_PCIE3PHY_GRF_PHY1_LN1_CON1      0x2104
> >> -#define RK3588_SRAM_INIT_DONE(reg)             (reg & BIT(0))
> >> +#define RK3588_SRAM_INIT_DONE(reg)              ((reg & 0xf) == 0xf)
> >
> > This breaks PCIe3x4 on my Radxa ROCK 5B, which then cannot find its
> > NVMe root filesystem. Sebastian's rockchip-devel branch carries this
> > series, and kernels built from it fail with:
> >
> >    phy phy-fee80000.phy.13: lock failed 0x7, check input refclk and power supply
> >    rockchip-dw-pcie a40000000.pcie: phy lock failed
> >    rockchip-dw-pcie a40000000.pcie: probe with driver rockchip-dw-pcie
> > failed with error -110
> >
> > The RK3588 TRM (V1.0, Part 1) describes PCIe3PHY_GRF_PHY{0,1}_STATUS1
> > as follows:
> >
> >    bit 0     sram_init_done
> >    bit 1     pcs_pwr_en     (reset value 1)
> >    bit 2     pma_pwr_en     (reset value 1)
> >    bit 3     mplla_state
> >    bits 5:4  reserved
> >    bit 6     mpllb_state
> >
> > So the lower four bits are not all PLL states: bits 1 and 2 are power
> > switch enables, and the only PLL among them is MPLLA, while MPLLB is
> > bit 6.
> >
> > On this board MPLLA is off even on a working link. With this patch
> > reverted, PHY0_STATUS1 and PHY1_STATUS1 both read 0x47 once the link
> > has trained at 8 GT/s x4: SRAM initialised, MPLLB running, MPLLA off.
> > When the check fails they read 0x7, so neither PLL is running yet at
> > that point, and checking for MPLLB instead would fail too.
>
>
> Sorry for late response. mplla is for Gen1 and Gen2, and mpllb is for
> Gen3. So you observed mplla off on a working link because the link
> is in Gen3. Otherwise, in Gen1 or Gen2 link, mplla should work instead
> of mpllb. So before initializing link, mplla should be checked in
> general. Could mplla_state = 1 if we allow more timeout here, or it
> never happened?

MPLLA never sets in the calibrate window: polling PHY{0,1}_STATUS1 for
2s there reads 0x07 throughout. It comes up about 1ms after calibrate
returns, when rockchip_pcie_probe() goes on to
rockchip_pcie_clk_init() and the RC setup. During training both PLLs
are briefly on (0x4f), then MPLLA only (0x0f) for about 100 ms, then
MPLLB only (0x47) once the link reaches Gen3 x4.

The BSP kernel enables the controller clocks before phy_init() and
phy_calibrate(), while patch 1/5 calls phy_calibrate() before
rockchip_pcie_clk_init(). Is that why MPLLA is set in the vendor
kernel but not here?

Best regards,
Alexey



More information about the Linux-rockchip mailing list