mirror of https://github.com/hak5/openwrt.git
parent
5b07caf121
commit
2739177201
|
@ -36,7 +36,7 @@ static void rt2880_pci_reg_write(u32 val, u32 reg)
|
||||||
writel(val, rt2880_pci_base + reg);
|
writel(val, rt2880_pci_base + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_access(unsigned char access_type, struct pci_bus *bus,
|
static void config_access(unsigned char access_type, struct pci_bus *bus,
|
||||||
unsigned int devfn, unsigned char where, u32 *data)
|
unsigned int devfn, unsigned char where, u32 *data)
|
||||||
{
|
{
|
||||||
unsigned int slot = PCI_SLOT(devfn);
|
unsigned int slot = PCI_SLOT(devfn);
|
||||||
|
@ -51,8 +51,6 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
|
||||||
rt2880_pci_reg_write(*data, RT2880_PCI_REG_CONFIG_DATA);
|
rt2880_pci_reg_write(*data, RT2880_PCI_REG_CONFIG_DATA);
|
||||||
else
|
else
|
||||||
*data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA);
|
*data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn,
|
static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||||
|
@ -60,8 +58,7 @@ static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||||
{
|
{
|
||||||
u32 data = 0;
|
u32 data = 0;
|
||||||
|
|
||||||
if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
|
config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
|
||||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
||||||
|
|
||||||
if (size == 1)
|
if (size == 1)
|
||||||
*val = (data >> ((where & 3) << 3)) & 0xff;
|
*val = (data >> ((where & 3) << 3)) & 0xff;
|
||||||
|
@ -81,8 +78,7 @@ static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn,
|
||||||
if (size == 4) {
|
if (size == 4) {
|
||||||
data = val;
|
data = val;
|
||||||
} else {
|
} else {
|
||||||
if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
|
config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
|
||||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
||||||
if (size == 1)
|
if (size == 1)
|
||||||
data = (data & ~(0xff << ((where & 3) << 3))) |
|
data = (data & ~(0xff << ((where & 3) << 3))) |
|
||||||
(val << ((where & 3) << 3));
|
(val << ((where & 3) << 3));
|
||||||
|
@ -91,8 +87,7 @@ static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn,
|
||||||
(val << ((where & 3) << 3));
|
(val << ((where & 3) << 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
|
config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data);
|
||||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
||||||
|
|
||||||
return PCIBIOS_SUCCESSFUL;
|
return PCIBIOS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue