• Michal Tomek's avatar
    phy: rockchip-snps-pcie3: fix bifurcation on rk3588 · f8020dfb
    Michal Tomek authored
    So far all RK3588 boards use fully aggregated PCIe. CM3588 is one
    of the few boards using this feature and apparently it is broken.
    
    The PHY offers the following mapping options:
    
      port 0 lane 0 - always mapped to controller 0 (4L)
      port 0 lane 1 - to controller 0 or 2 (1L0)
      port 1 lane 0 - to controller 0 or 1 (2L)
      port 1 lane 1 - to controller 0, 1 or 3 (1L1)
    
    The data-lanes DT property maps these as follows:
    
      0 = no controller (unsupported by the HW)
      1 = 4L
      2 = 2L
      3 = 1L0
      4 = 1L1
    
    That allows the following configurations with first column being the
    mainline data-lane mapping, second column being the downstream name,
    third column being PCIE3PHY_GRF_CMN_CON0 and PHP_GRF_PCIESEL register
    values and final column being the user visible lane setup:
    
      <1 1 1 1> = AGGREG = [4 0] = x4 (aggregation)
      <1 1 2 2> = NANBNB = [0 0] = x2 x2 (no bif.)
      <1 3 2 2> = NANBBI = [1 1] = x2 x1x1 (bif. of port 0)
      <1 1 2 4> = NABINB = [2 2] = x1x1 x2 (bif. of port 1)
      <1 3 2 4> = NABIBI = [3 3] = x1x1 x1x1 (bif. of both ports)
    
    The driver currently does not program PHP_GRF_PCIESEL correctly, which
    is fixed by this patch. As a side-effect the new logic is much simpler
    than the old logic.
    
    Fixes: 2e9bffc4 ("phy: rockchip: Support PCIe v3")
    Signed-off-by: default avatarMichal Tomek <mtdev79b@gmail.com>
    Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
    Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
    Link: https://lore.kernel.org/r/20240404-rk3588-pcie-bifurcation-fixes-v1-1-9907136eeafd@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    f8020dfb
phy-rockchip-snps-pcie3.c 8.4 KB