Commit b50b2db2 authored by Kishon Vijay Abraham I's avatar Kishon Vijay Abraham I Committed by Bjorn Helgaas

PCI: dwc: all: Modify dbi accessors to take dbi_base as argument

dwc has 2 dbi address space labeled dbics and dbics2. The existing helper
to access dbi address space can access only dbics. However dbics2 has to
be accessed for programming the BAR registers in the case of EP mode. This
is in preparation for adding EP mode support to dwc driver.
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>
parent 62c5549f
...@@ -521,23 +521,25 @@ static void exynos_pcie_enable_interrupts(struct exynos_pcie *ep) ...@@ -521,23 +521,25 @@ static void exynos_pcie_enable_interrupts(struct exynos_pcie *ep)
exynos_pcie_msi_init(ep); exynos_pcie_msi_init(ep);
} }
static u32 exynos_pcie_readl_dbi(struct dw_pcie *pci, u32 reg) static u32 exynos_pcie_readl_dbi(struct dw_pcie *pci, void __iomem *base,
u32 reg)
{ {
struct exynos_pcie *ep = to_exynos_pcie(pci); struct exynos_pcie *ep = to_exynos_pcie(pci);
u32 val; u32 val;
exynos_pcie_sideband_dbi_r_mode(ep, true); exynos_pcie_sideband_dbi_r_mode(ep, true);
val = readl(pci->dbi_base + reg); val = readl(base + reg);
exynos_pcie_sideband_dbi_r_mode(ep, false); exynos_pcie_sideband_dbi_r_mode(ep, false);
return val; return val;
} }
static void exynos_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val) static void exynos_pcie_writel_dbi(struct dw_pcie *pci, void __iomem *base,
u32 reg, u32 val)
{ {
struct exynos_pcie *ep = to_exynos_pcie(pci); struct exynos_pcie *ep = to_exynos_pcie(pci);
exynos_pcie_sideband_dbi_w_mode(ep, true); exynos_pcie_sideband_dbi_w_mode(ep, true);
writel(val, pci->dbi_base + reg); writel(val, base + reg);
exynos_pcie_sideband_dbi_w_mode(ep, false); exynos_pcie_sideband_dbi_w_mode(ep, false);
} }
......
...@@ -61,20 +61,21 @@ int dw_pcie_write(void __iomem *addr, int size, u32 val) ...@@ -61,20 +61,21 @@ int dw_pcie_write(void __iomem *addr, int size, u32 val)
return PCIBIOS_SUCCESSFUL; return PCIBIOS_SUCCESSFUL;
} }
u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg) u32 __dw_pcie_readl_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg)
{ {
if (pci->ops->readl_dbi) if (pci->ops->readl_dbi)
return pci->ops->readl_dbi(pci, reg); return pci->ops->readl_dbi(pci, base, reg);
return readl(pci->dbi_base + reg); return readl(base + reg);
} }
void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val) void __dw_pcie_writel_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
u32 val)
{ {
if (pci->ops->writel_dbi) if (pci->ops->writel_dbi)
pci->ops->writel_dbi(pci, reg, val); pci->ops->writel_dbi(pci, base, reg, val);
else else
writel(val, pci->dbi_base + reg); writel(val, base + reg);
} }
static u32 dw_pcie_readl_unroll(struct dw_pcie *pci, u32 index, u32 reg) static u32 dw_pcie_readl_unroll(struct dw_pcie *pci, u32 index, u32 reg)
......
...@@ -144,8 +144,9 @@ struct pcie_port { ...@@ -144,8 +144,9 @@ struct pcie_port {
struct dw_pcie_ops { struct dw_pcie_ops {
u64 (*cpu_addr_fixup)(u64 cpu_addr); u64 (*cpu_addr_fixup)(u64 cpu_addr);
u32 (*readl_dbi)(struct dw_pcie *pcie, u32 reg); u32 (*readl_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg);
void (*writel_dbi)(struct dw_pcie *pcie, u32 reg, u32 val); void (*writel_dbi)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
u32 val);
int (*link_up)(struct dw_pcie *pcie); int (*link_up)(struct dw_pcie *pcie);
}; };
...@@ -163,8 +164,9 @@ struct dw_pcie { ...@@ -163,8 +164,9 @@ struct dw_pcie {
int dw_pcie_read(void __iomem *addr, int size, u32 *val); int dw_pcie_read(void __iomem *addr, int size, u32 *val);
int dw_pcie_write(void __iomem *addr, int size, u32 val); int dw_pcie_write(void __iomem *addr, int size, u32 val);
u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg); u32 __dw_pcie_readl_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg);
void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val); void __dw_pcie_writel_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
u32 val);
int dw_pcie_link_up(struct dw_pcie *pci); int dw_pcie_link_up(struct dw_pcie *pci);
int dw_pcie_wait_for_link(struct dw_pcie *pci); int dw_pcie_wait_for_link(struct dw_pcie *pci);
void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index,
...@@ -172,6 +174,16 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, ...@@ -172,6 +174,16 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index,
u32 size); u32 size);
void dw_pcie_setup(struct dw_pcie *pci); void dw_pcie_setup(struct dw_pcie *pci);
static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
{
__dw_pcie_writel_dbi(pci, pci->dbi_base, reg, val);
}
static inline u32 dw_pcie_readl_dbi(struct dw_pcie *pci, u32 reg)
{
return __dw_pcie_readl_dbi(pci, pci->dbi_base, reg);
}
#ifdef CONFIG_PCIE_DW_HOST #ifdef CONFIG_PCIE_DW_HOST
irqreturn_t dw_handle_msi_irq(struct pcie_port *pp); irqreturn_t dw_handle_msi_irq(struct pcie_port *pp);
void dw_pcie_msi_init(struct pcie_port *pp); void dw_pcie_msi_init(struct pcie_port *pp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment