Commit f46bfb1d authored by Hans Zhang's avatar Hans Zhang Committed by Manivannan Sadhasivam
Browse files

PCI: dwc: Return bool from link up check



PCIe link status check is supposed to return a boolean to indicate whether
the link is up or not. So, modify the link_up callbacks and
dw_pcie_link_up() function to return bool instead of int.

Signed-off-by: default avatarHans Zhang <18255117159@163.com>
[mani: commit message reword]
Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20250510160710.392122-2-18255117159@163.com
parent 286ed198
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -118,12 +118,12 @@ static u64 dra7xx_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
	return cpu_addr & DRA7XX_CPU_TO_BUS_ADDR;
}

static int dra7xx_pcie_link_up(struct dw_pcie *pci)
static bool dra7xx_pcie_link_up(struct dw_pcie *pci)
{
	struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
	u32 reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS);

	return !!(reg & LINK_UP);
	return reg & LINK_UP;
}

static void dra7xx_pcie_stop_link(struct dw_pcie *pci)
+2 −2
Original line number Diff line number Diff line
@@ -209,12 +209,12 @@ static struct pci_ops exynos_pci_ops = {
	.write = exynos_pcie_wr_own_conf,
};

static int exynos_pcie_link_up(struct dw_pcie *pci)
static bool exynos_pcie_link_up(struct dw_pcie *pci)
{
	struct exynos_pcie *ep = to_exynos_pcie(pci);
	u32 val = exynos_pcie_readl(ep->elbi_base, PCIE_ELBI_RDLH_LINKUP);

	return (val & PCIE_ELBI_XMLH_LINKUP);
	return val & PCIE_ELBI_XMLH_LINKUP;
}

static int exynos_pcie_host_init(struct dw_pcie_rp *pp)
+2 −3
Original line number Diff line number Diff line
@@ -492,13 +492,12 @@ static struct pci_ops ks_pcie_ops = {
 * @pci: A pointer to the dw_pcie structure which holds the DesignWare PCIe host
 *	 controller driver information.
 */
static int ks_pcie_link_up(struct dw_pcie *pci)
static bool ks_pcie_link_up(struct dw_pcie *pci)
{
	u32 val;

	val = dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0);
	val &= PORT_LOGIC_LTSSM_STATE_MASK;
	return (val == PORT_LOGIC_LTSSM_STATE_L0);
	return (val & PORT_LOGIC_LTSSM_STATE_MASK) == PORT_LOGIC_LTSSM_STATE_L0;
}

static void ks_pcie_stop_link(struct dw_pcie *pci)
+3 −3
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ static struct pci_ops meson_pci_ops = {
	.write = pci_generic_config_write,
};

static int meson_pcie_link_up(struct dw_pcie *pci)
static bool meson_pcie_link_up(struct dw_pcie *pci)
{
	struct meson_pcie *mp = to_meson_pcie(pci);
	struct device *dev = pci->dev;
@@ -363,7 +363,7 @@ static int meson_pcie_link_up(struct dw_pcie *pci)
			dev_dbg(dev, "speed_okay\n");

		if (smlh_up && rdlh_up && ltssm_up && speed_okay)
			return 1;
			return true;

		cnt++;

@@ -371,7 +371,7 @@ static int meson_pcie_link_up(struct dw_pcie *pci)
	} while (cnt < WAIT_LINKUP_TIMEOUT);

	dev_err(dev, "error: wait linkup timeout\n");
	return 0;
	return false;
}

static int meson_pcie_host_init(struct dw_pcie_rp *pp)
+3 −3
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ static int armada8k_pcie_setup_phys(struct armada8k_pcie *pcie)
	return ret;
}

static int armada8k_pcie_link_up(struct dw_pcie *pci)
static bool armada8k_pcie_link_up(struct dw_pcie *pci)
{
	u32 reg;
	u32 mask = PCIE_GLB_STS_RDLH_LINK_UP | PCIE_GLB_STS_PHY_LINK_UP;
@@ -147,10 +147,10 @@ static int armada8k_pcie_link_up(struct dw_pcie *pci)
	reg = dw_pcie_readl_dbi(pci, PCIE_GLOBAL_STATUS_REG);

	if ((reg & mask) == mask)
		return 1;
		return true;

	dev_dbg(pci->dev, "No link detected (Global-Status: 0x%08x).\n", reg);
	return 0;
	return false;
}

static int armada8k_pcie_start_link(struct dw_pcie *pci)
Loading