Lines Matching +full:semi +full:- +full:static

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2006 PA Semi, Inc
5 * Authors: Kip Walker, PA Semi
6 * Olof Johansson, PA Semi
18 #include <asm/pci-bridge.h>
19 #include <asm/isa-bridge.h>
22 #include <asm/ppc-pci.h>
28 static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset) in pa_pxp_offset_valid()
31 * well, so allow larger offset. It's really a two-function device but the in pa_pxp_offset_valid()
40 static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose, in pa_pxp_cfg_addr()
43 return hose->cfg_data + PA_PXP_CFA(bus, devfn, offset); in pa_pxp_cfg_addr()
46 static inline int is_root_port(int busno, int devfn) in is_root_port()
52 static inline int is_5945_reg(int reg) in is_5945_reg()
58 static int workaround_5945(struct pci_bus *bus, unsigned int devfn, in workaround_5945()
66 if (!is_root_port(bus->number, devfn) || !is_5945_reg(offset)) in workaround_5945()
71 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset & ~0x3); in workaround_5945()
75 * and write back what we read. We must read/write the full 32-bit in workaround_5945()
78 dummy = pa_pxp_cfg_addr(hose, bus->number, devfn, 0x10); in workaround_5945()
106 static void sb600_set_flag(int bus) in sb600_set_flag()
108 static void __iomem *iob_mapbase = NULL; in sb600_set_flag()
114 dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob"); in sb600_set_flag()
136 * This is the SB600's bus, tell the PCI-e root port in sb600_set_flag()
137 * to allow non-zero devices to enumerate. in sb600_set_flag()
151 static void sb600_set_flag(int bus) in sb600_set_flag()
156 static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, in pa_pxp_read_config()
166 if (!pa_pxp_offset_valid(bus->number, devfn, offset)) in pa_pxp_read_config()
172 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); in pa_pxp_read_config()
174 sb600_set_flag(bus->number); in pa_pxp_read_config()
195 static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn, in pa_pxp_write_config()
205 if (!pa_pxp_offset_valid(bus->number, devfn, offset)) in pa_pxp_write_config()
208 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); in pa_pxp_write_config()
210 sb600_set_flag(bus->number); in pa_pxp_write_config()
230 static struct pci_ops pa_pxp_ops = {
235 static void __init setup_pa_pxp(struct pci_controller *hose) in setup_pa_pxp()
237 hose->ops = &pa_pxp_ops; in setup_pa_pxp()
238 hose->cfg_data = ioremap(0xe0000000, 0x10000000); in setup_pa_pxp()
241 static int __init pas_add_bridge(struct device_node *dev) in pas_add_bridge()
249 return -ENOMEM; in pas_add_bridge()
251 hose->first_busno = 0; in pas_add_bridge()
252 hose->last_busno = 0xff; in pas_add_bridge()
253 hose->controller_ops = pasemi_pci_controller_ops; in pas_add_bridge()
257 pr_info("Found PA-PXP PCI host bridge.\n"); in pas_add_bridge()
291 hose = pci_bus_to_host(dev->bus); in pasemi_pci_getcfgaddr()
293 return (void __iomem *)pa_pxp_cfg_addr(hose, dev->bus->number, dev->devfn, offset); in pasemi_pci_getcfgaddr()