-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAl/mtVwUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vyrUA//U03pKOm8jDCakFGGZlnTNOe31fAz
 inaR5a7XvGVeFhQcc7GR5Vi5a6dtuwv5hLg78SflNH8F5A29C57xsaygxmLXXzN5
 ReLMzvEgtOKS6OPkVXZAHGm6S2H+zKVLhOZB9xhTiCAFsESh8T9O8KVmdWiWz1rE
 zASlWivMIkkxQjlnsu1a4ZKRdL1zjdFwDQWlQHCVhdpuEdL0fULF49gLhwCF2dGP
 DmZ1Rd28HDjdtVYoK/EBfGVRiwp7e5Am1sK7AtcbiT+r7Q2uuWVNW09Y3TJrrIEr
 05L3liG/QxpSXxLv3KwEMb2jlJl2PQC5YMkItoibJquTCeIvnKWKOvf8rsJqgv2B
 xLT22okthFSUv60K52n0RoI49IYgcmA7PGUrffO1yfDWjLDoid17wIQ6RJ3j/NdB
 DLy6OQ1Xnk0uzGIGnZZPue+Rfhwtbc3ZkZ+fBL20BRAF/h7jyhXU+DQYan/p2CRc
 qmLey3Dm9q8gRJA5RFewqM9UMf3IuWB3VkoZxhWOPNOHaY4qPpAYNoboEjm8vHV6
 LCr2ntuTYrXGZHh04EsDyoBtt3z+fWmBxu5iNW811amD2+s4h5UxjpBoBFJjwAux
 j6qkMSkzp9n01F1WpUhAa7Mb2eAl5hz19J6bihbkS+SbUXO9F2naMA3aplDh2WRg
 RuJaEoC41d9mTuE=
 =giDR
 -----END PGP SIGNATURE-----

Merge tag 'pci-v5.11-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI fixes from Bjorn Helgaas:

 - Fix a tegra enumeration regression (Rob Herring)

 - Fix a designware-host check that warned on *success*, not failure
   (Alexander Lobakin)

* tag 'pci-v5.11-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI: dwc: Fix inverted condition of DMA mask setup warning
  PCI: tegra: Fix host link initialization
This commit is contained in:
Linus Torvalds 2020-12-25 20:17:40 -08:00
Родитель c9a3c4e637 99e629f14b
Коммит 40f78232f9
2 изменённых файлов: 31 добавлений и 32 удалений

Просмотреть файл

@ -397,12 +397,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp);
ret = dma_set_mask(pci->dev, DMA_BIT_MASK(32));
if (!ret) {
dev_warn(pci->dev,
"Failed to set DMA mask to 32-bit. "
"Devices with only 32-bit MSI support"
" may not work properly\n");
}
if (ret)
dev_warn(pci->dev, "Failed to set DMA mask to 32-bit. Devices with only 32-bit MSI support may not work properly\n");
pp->msi_data = dma_map_single_attrs(pci->dev, &pp->msi_msg,
sizeof(pp->msi_msg),

Просмотреть файл

@ -853,12 +853,14 @@ static void config_gen3_gen4_eq_presets(struct tegra_pcie_dw *pcie)
dw_pcie_writel_dbi(pci, GEN3_RELATED_OFF, val);
}
static void tegra_pcie_prepare_host(struct pcie_port *pp)
static int tegra_pcie_dw_host_init(struct pcie_port *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
u32 val;
pp->bridge->ops = &tegra_pci_ops;
if (!pcie->pcie_cap_base)
pcie->pcie_cap_base = dw_pcie_find_capability(&pcie->pci,
PCI_CAP_ID_EXP);
@ -907,10 +909,24 @@ static void tegra_pcie_prepare_host(struct pcie_port *pp)
dw_pcie_writel_dbi(pci, CFG_TIMER_CTRL_MAX_FUNC_NUM_OFF, val);
}
dw_pcie_setup_rc(pp);
clk_set_rate(pcie->core_clk, GEN4_CORE_CLK_FREQ);
return 0;
}
static int tegra_pcie_dw_start_link(struct dw_pcie *pci)
{
u32 val, offset, speed, tmp;
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
struct pcie_port *pp = &pci->pp;
bool retry = true;
if (pcie->mode == DW_PCIE_EP_TYPE) {
enable_irq(pcie->pex_rst_irq);
return 0;
}
retry_link:
/* Assert RST */
val = appl_readl(pcie, APPL_PINMUX);
val &= ~APPL_PINMUX_PEX_RST;
@ -929,19 +945,10 @@ static void tegra_pcie_prepare_host(struct pcie_port *pp)
appl_writel(pcie, val, APPL_PINMUX);
msleep(100);
}
static int tegra_pcie_dw_host_init(struct pcie_port *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
u32 val, tmp, offset, speed;
pp->bridge->ops = &tegra_pci_ops;
tegra_pcie_prepare_host(pp);
if (dw_pcie_wait_for_link(pci)) {
if (!retry)
return 0;
/*
* There are some endpoints which can't get the link up if
* root port has Data Link Feature (DLF) enabled.
@ -975,10 +982,11 @@ static int tegra_pcie_dw_host_init(struct pcie_port *pp)
val &= ~PCI_DLF_EXCHANGE_ENABLE;
dw_pcie_writel_dbi(pci, offset, val);
tegra_pcie_prepare_host(pp);
tegra_pcie_dw_host_init(pp);
dw_pcie_setup_rc(pp);
if (dw_pcie_wait_for_link(pci))
return 0;
retry = false;
goto retry_link;
}
speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) &
@ -998,15 +1006,6 @@ static int tegra_pcie_dw_link_up(struct dw_pcie *pci)
return !!(val & PCI_EXP_LNKSTA_DLLLA);
}
static int tegra_pcie_dw_start_link(struct dw_pcie *pci)
{
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
enable_irq(pcie->pex_rst_irq);
return 0;
}
static void tegra_pcie_dw_stop_link(struct dw_pcie *pci)
{
struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
@ -2215,6 +2214,10 @@ static int tegra_pcie_dw_resume_noirq(struct device *dev)
goto fail_host_init;
}
ret = tegra_pcie_dw_start_link(&pcie->pci);
if (ret < 0)
goto fail_host_init;
/* Restore MSI interrupt vector */
dw_pcie_writel_dbi(&pcie->pci, PORT_LOGIC_MSI_CTRL_INT_0_EN,
pcie->msi_ctrl_int);