PCI: dwc: Add macros to compare Synopsys IP core versions
Add macros to compare DWC IP core versions: dw_pcie_ver_is() dw_pcie_ver_is_ge() dw_pcie_ver_type_is() dw_pcie_ver_type_is_ge() These are along the lines of DWC3_VER_IS() and dw_spi_ver_is(). [bhelgaas: commit log] Link: https://lore.kernel.org/r/20220624143947.8991-6-Sergey.Semin@baikalelectronics.ru Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Rob Herring <robh@kernel.org>
This commit is contained in:
parent
13e9d3900c
commit
0b0a780d52
3 changed files with 20 additions and 5 deletions
|
|
@ -1233,7 +1233,7 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
|
|||
goto err_get_sync;
|
||||
}
|
||||
|
||||
if (pci->version >= DW_PCIE_VER_480A)
|
||||
if (dw_pcie_ver_is_ge(pci, 480A))
|
||||
ret = ks_pcie_am654_set_mode(dev, mode);
|
||||
else
|
||||
ret = ks_pcie_set_mode(dev);
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, u8 func_no,
|
|||
val = type | PCIE_ATU_FUNC_NUM(func_no);
|
||||
if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr))
|
||||
val |= PCIE_ATU_INCREASE_REGION_SIZE;
|
||||
if (pci->version == DW_PCIE_VER_490A)
|
||||
if (dw_pcie_ver_is(pci, 490A))
|
||||
val = dw_pcie_enable_ecrc(val);
|
||||
dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL1, val);
|
||||
dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2,
|
||||
|
|
@ -360,7 +360,7 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no,
|
|||
upper_32_bits(cpu_addr));
|
||||
dw_pcie_writel_dbi(pci, PCIE_ATU_LIMIT,
|
||||
lower_32_bits(limit_addr));
|
||||
if (pci->version >= DW_PCIE_VER_460A)
|
||||
if (dw_pcie_ver_is_ge(pci, 460A))
|
||||
dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_LIMIT,
|
||||
upper_32_bits(limit_addr));
|
||||
dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_TARGET,
|
||||
|
|
@ -369,9 +369,9 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no,
|
|||
upper_32_bits(pci_addr));
|
||||
val = type | PCIE_ATU_FUNC_NUM(func_no);
|
||||
if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr) &&
|
||||
pci->version >= DW_PCIE_VER_460A)
|
||||
dw_pcie_ver_is_ge(pci, 460A))
|
||||
val |= PCIE_ATU_INCREASE_REGION_SIZE;
|
||||
if (pci->version == DW_PCIE_VER_490A)
|
||||
if (dw_pcie_ver_is(pci, 490A))
|
||||
val = dw_pcie_enable_ecrc(val);
|
||||
dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, val);
|
||||
dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, PCIE_ATU_ENABLE);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,21 @@
|
|||
#define DW_PCIE_VER_490A 0x3439302a
|
||||
#define DW_PCIE_VER_520A 0x3532302a
|
||||
|
||||
#define __dw_pcie_ver_cmp(_pci, _ver, _op) \
|
||||
((_pci)->version _op DW_PCIE_VER_ ## _ver)
|
||||
|
||||
#define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==)
|
||||
|
||||
#define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=)
|
||||
|
||||
#define dw_pcie_ver_type_is(_pci, _ver, _type) \
|
||||
(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
|
||||
__dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==))
|
||||
|
||||
#define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \
|
||||
(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
|
||||
__dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=))
|
||||
|
||||
/* Parameters for the waiting for link up routine */
|
||||
#define LINK_WAIT_MAX_RETRIES 10
|
||||
#define LINK_WAIT_USLEEP_MIN 90000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue