Commit e0ceb8f9 authored by Rob Herring's avatar Rob Herring Committed by Lorenzo Pieralisi

PCI: dwc: meson: Use pci_ops for root config space accessors

Now that DWC drivers can setup their own pci_ops for the root and child
buses, convert the Amlogic meson driver to use the standard pci_ops for
root bus config accesses.

Link: https://lore.kernel.org/r/20200821035420.380495-9-robh@kernel.orgSigned-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Yue Wang <yue.wang@Amlogic.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: linux-amlogic@lists.infradead.org
parent 692ccce7
...@@ -383,13 +383,12 @@ static void meson_pcie_enable_interrupts(struct meson_pcie *mp) ...@@ -383,13 +383,12 @@ static void meson_pcie_enable_interrupts(struct meson_pcie *mp)
dw_pcie_msi_init(&mp->pci.pp); dw_pcie_msi_init(&mp->pci.pp);
} }
static int meson_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, static int meson_pcie_rd_own_conf(struct pci_bus *bus, u32 devfn,
u32 *val) int where, int size, u32 *val)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
int ret; int ret;
ret = dw_pcie_read(pci->dbi_base + where, size, val); ret = pci_generic_config_read(bus, devfn, where, size, val);
if (ret != PCIBIOS_SUCCESSFUL) if (ret != PCIBIOS_SUCCESSFUL)
return ret; return ret;
...@@ -410,13 +409,11 @@ static int meson_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, ...@@ -410,13 +409,11 @@ static int meson_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
return PCIBIOS_SUCCESSFUL; return PCIBIOS_SUCCESSFUL;
} }
static int meson_pcie_wr_own_conf(struct pcie_port *pp, int where, static struct pci_ops meson_pci_ops = {
int size, u32 val) .map_bus = dw_pcie_own_conf_map_bus,
{ .read = meson_pcie_rd_own_conf,
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); .write = pci_generic_config_write,
};
return dw_pcie_write(pci->dbi_base + where, size, val);
}
static int meson_pcie_link_up(struct dw_pcie *pci) static int meson_pcie_link_up(struct dw_pcie *pci)
{ {
...@@ -463,6 +460,8 @@ static int meson_pcie_host_init(struct pcie_port *pp) ...@@ -463,6 +460,8 @@ static int meson_pcie_host_init(struct pcie_port *pp)
struct meson_pcie *mp = to_meson_pcie(pci); struct meson_pcie *mp = to_meson_pcie(pci);
int ret; int ret;
pp->bridge->ops = &meson_pci_ops;
ret = meson_pcie_establish_link(mp); ret = meson_pcie_establish_link(mp);
if (ret) if (ret)
return ret; return ret;
...@@ -473,8 +472,6 @@ static int meson_pcie_host_init(struct pcie_port *pp) ...@@ -473,8 +472,6 @@ static int meson_pcie_host_init(struct pcie_port *pp)
} }
static const struct dw_pcie_host_ops meson_pcie_host_ops = { static const struct dw_pcie_host_ops meson_pcie_host_ops = {
.rd_own_conf = meson_pcie_rd_own_conf,
.wr_own_conf = meson_pcie_wr_own_conf,
.host_init = meson_pcie_host_init, .host_init = meson_pcie_host_init,
}; };
......
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