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

PCI: dwc: histb: 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 HiSilicon histb driver to use the standard pci_ops
for root bus config accesses.

Link: https://lore.kernel.org/r/20200821035420.380495-12-robh@kernel.orgSigned-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
parent 08d2209e
...@@ -122,32 +122,37 @@ static void histb_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, ...@@ -122,32 +122,37 @@ static void histb_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base,
histb_pcie_dbi_w_mode(&pci->pp, false); histb_pcie_dbi_w_mode(&pci->pp, false);
} }
static int histb_pcie_rd_own_conf(struct pcie_port *pp, int where, static int histb_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devfn,
int size, u32 *val) int where, int size, u32 *val)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata);
int ret;
histb_pcie_dbi_r_mode(pp, true); if (PCI_SLOT(devfn)) {
ret = dw_pcie_read(pci->dbi_base + where, size, val); *val = ~0;
histb_pcie_dbi_r_mode(pp, false); return PCIBIOS_DEVICE_NOT_FOUND;
}
return ret; *val = dw_pcie_read_dbi(pci, where, size);
return PCIBIOS_SUCCESSFUL;
} }
static int histb_pcie_wr_own_conf(struct pcie_port *pp, int where, static int histb_pcie_wr_own_conf(struct pci_bus *bus, unsigned int devfn,
int size, u32 val) int where, int size, u32 val)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata);
int ret;
histb_pcie_dbi_w_mode(pp, true); if (PCI_SLOT(devfn))
ret = dw_pcie_write(pci->dbi_base + where, size, val); return PCIBIOS_DEVICE_NOT_FOUND;
histb_pcie_dbi_w_mode(pp, false);
return ret; dw_pcie_write_dbi(pci, where, size, val);
return PCIBIOS_SUCCESSFUL;
} }
static struct pci_ops histb_pci_ops = {
.read = histb_pcie_rd_own_conf,
.write = histb_pcie_wr_own_conf,
};
static int histb_pcie_link_up(struct dw_pcie *pci) static int histb_pcie_link_up(struct dw_pcie *pci)
{ {
struct histb_pcie *hipcie = to_histb_pcie(pci); struct histb_pcie *hipcie = to_histb_pcie(pci);
...@@ -194,6 +199,8 @@ static int histb_pcie_establish_link(struct pcie_port *pp) ...@@ -194,6 +199,8 @@ static int histb_pcie_establish_link(struct pcie_port *pp)
static int histb_pcie_host_init(struct pcie_port *pp) static int histb_pcie_host_init(struct pcie_port *pp)
{ {
pp->bridge->ops = &histb_pci_ops;
histb_pcie_establish_link(pp); histb_pcie_establish_link(pp);
if (IS_ENABLED(CONFIG_PCI_MSI)) if (IS_ENABLED(CONFIG_PCI_MSI))
...@@ -203,8 +210,6 @@ static int histb_pcie_host_init(struct pcie_port *pp) ...@@ -203,8 +210,6 @@ static int histb_pcie_host_init(struct pcie_port *pp)
} }
static const struct dw_pcie_host_ops histb_pcie_host_ops = { static const struct dw_pcie_host_ops histb_pcie_host_ops = {
.rd_own_conf = histb_pcie_rd_own_conf,
.wr_own_conf = histb_pcie_wr_own_conf,
.host_init = histb_pcie_host_init, .host_init = histb_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