• Manivannan Sadhasivam's avatar
    PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk from host · 869bc525
    Manivannan Sadhasivam authored
    The DWC glue drivers requiring an active reference clock from the PCIe host
    for initializing their PCIe EP core, set a flag called 'core_init_notifier'
    to let DWC driver know that these drivers need a special attention during
    initialization. In these drivers, access to the hw registers (like DBI)
    before receiving the active refclk from host will result in access failure
    and also could cause a whole system hang.
    
    But the current DWC EP driver doesn't honor the requirements of the drivers
    setting 'core_init_notifier' flag and tries to access the DBI registers
    during dw_pcie_ep_init(). This causes the system hang for glue drivers such
    as Tegra194 and Qcom EP as they depend on refclk from host and have set the
    above mentioned flag.
    
    To workaround this issue, users of the affected platforms have to maintain
    the dependency with the PCIe host by booting the PCIe EP after host boot.
    But this won't provide a good user experience, since PCIe EP is _one_ of
    the features of those platforms and it doesn't make sense to delay the
    whole platform booting due to PCIe requiring active refclk.
    
    So to fix this issue, let's move all the DBI access from
    dw_pcie_ep_init() in the DWC EP driver to the dw_pcie_ep_init_complete()
    API. This API will only be called by the drivers setting
    'core_init_notifier' flag once refclk is received from host. For the rest
    of the drivers that gets the refclk locally, this API will be called
    within dw_pcie_ep_init().
    
    Link: https://lore.kernel.org/linux-pci/20240327-pci-dbi-rework-v12-1-082625472414@linaro.org
    Fixes: e966f739 ("PCI: dwc: Refactor core initialization code for EP mode")
    Co-developed-by: default avatarVidya Sagar <vidyas@nvidia.com>
    Signed-off-by: default avatarVidya Sagar <vidyas@nvidia.com>
    Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Signed-off-by: default avatarKrzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
    Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
    869bc525
pcie-designware-ep.c 20.4 KB