31 #include <linux/pci.h>
32 #include <linux/types.h>
38 #define PCI_ACCESS_READ 0
39 #define PCI_ACCESS_WRITE 1
42 #define PCI_CFG_SET(bus, slot, func, off) \
43 (rc32434_pci->pcicfga = (0x80000000 | \
44 ((bus) << 16) | ((slot)<<11) | \
47 static inline int config_access(
unsigned char access_type,
80 *val = (data >> ((where & 3) << 3)) & 0xff;
91 *val = (data >> ((where & 3) << 3)) & 0xffff;
116 if (ret == 0xffffffff || ret == 0x00000000 ||
117 ret == 0x0000ffff || ret == 0xffff0000) {
130 write_config_byte(
struct pci_bus *bus,
unsigned int devfn,
int where,
138 data = (data & ~(0xff << ((where & 3) << 3))) |
139 (val << ((where & 3) << 3));
149 write_config_word(
struct pci_bus *bus,
unsigned int devfn,
int where,
157 data = (data & ~(0xffff << ((where & 3) << 3))) |
158 (val << ((where & 3) << 3));
169 write_config_dword(
struct pci_bus *bus,
unsigned int devfn,
int where,
178 static int pci_config_read(
struct pci_bus *bus,
unsigned int devfn,
183 return read_config_byte(bus, devfn, where, (
u8 *) val);
185 return read_config_word(bus, devfn, where, (
u16 *) val);
187 return read_config_dword(bus, devfn, where, val);
191 static int pci_config_write(
struct pci_bus *bus,
unsigned int devfn,
192 int where,
int size,
u32 val)
196 return write_config_byte(bus, devfn, where, (
u8) val);
198 return write_config_word(bus, devfn, where, (
u16) val);
200 return write_config_dword(bus, devfn, where, val);
205 .read = pci_config_read,
206 .write = pci_config_write,