Lines Matching +full:data +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0
3 * Generic SH7786 PCI-Express operations.
5 * Copyright (C) 2009 - 2010 Paul Mundt
12 #include "pcie-sh7786.h"
20 struct pci_bus *bus, unsigned int devfn, int where, u32 *data) in sh7786_pcie_config_access() argument
22 struct pci_channel *chan = bus->sysdata; in sh7786_pcie_config_access()
27 type = !!bus->parent; in sh7786_pcie_config_access()
30 if (bus->number > 255 || dev > 31 || func > 7) in sh7786_pcie_config_access()
34 * While each channel has its own memory-mapped extended config in sh7786_pcie_config_access()
42 * the same channel <-> device access works for any PCI_SLOT() in sh7786_pcie_config_access()
44 * space to devfn 0 in order to enable self-enumeration. In this in sh7786_pcie_config_access()
48 if (pci_is_root_bus(bus)) { in sh7786_pcie_config_access()
51 *data = pci_read_reg(chan, PCI_REG(reg)); in sh7786_pcie_config_access()
53 pci_write_reg(chan, *data, PCI_REG(reg)); in sh7786_pcie_config_access()
64 pci_write_reg(chan, (bus->number << 24) | (dev << 19) | in sh7786_pcie_config_access()
79 *data = pci_read_reg(chan, SH4A_PCIEPDR); in sh7786_pcie_config_access()
81 pci_write_reg(chan, *data, SH4A_PCIEPDR); in sh7786_pcie_config_access()
89 static int sh7786_pcie_read(struct pci_bus *bus, unsigned int devfn, in sh7786_pcie_read() argument
94 u32 data; in sh7786_pcie_read() local
102 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus, in sh7786_pcie_read()
103 devfn, where, &data); in sh7786_pcie_read()
110 *val = (data >> ((where & 3) << 3)) & 0xff; in sh7786_pcie_read()
112 *val = (data >> ((where & 2) << 3)) & 0xffff; in sh7786_pcie_read()
114 *val = data; in sh7786_pcie_read()
116 dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x " in sh7786_pcie_read()
117 "where=0x%04x size=%d val=0x%08lx\n", bus->number, in sh7786_pcie_read()
125 static int sh7786_pcie_write(struct pci_bus *bus, unsigned int devfn, in sh7786_pcie_write() argument
130 u32 data; in sh7786_pcie_write() local
138 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus, in sh7786_pcie_write()
139 devfn, where, &data); in sh7786_pcie_write()
143 dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x " in sh7786_pcie_write()
144 "where=0x%04x size=%d val=%08lx\n", bus->number, in sh7786_pcie_write()
149 data &= ~(0xff << shift); in sh7786_pcie_write()
150 data |= ((val & 0xff) << shift); in sh7786_pcie_write()
153 data &= ~(0xffff << shift); in sh7786_pcie_write()
154 data |= ((val & 0xffff) << shift); in sh7786_pcie_write()
156 data = val; in sh7786_pcie_write()
158 ret = sh7786_pcie_config_access(PCI_ACCESS_WRITE, bus, in sh7786_pcie_write()
159 devfn, where, &data); in sh7786_pcie_write()