mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-04 19:49:42 +02:00
ramips: add rt2880_pci_get_cfgaddr helper
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17973 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
f00dfe552e
commit
1493a33c1b
@ -53,15 +53,20 @@ static void rt2880_pci_reg_write(u32 val, u32 reg)
|
|||||||
writel(val, rt2880_pci_base + reg);
|
writel(val, rt2880_pci_base + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline u32 rt2880_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
|
||||||
|
unsigned int func, unsigned int where)
|
||||||
|
{
|
||||||
|
return ((bus << 16) | (slot << 11) | (func << 8) | (where & 0xfc) |
|
||||||
|
0x80000000);
|
||||||
|
}
|
||||||
|
|
||||||
static void 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 address;
|
unsigned int address;
|
||||||
u8 func = PCI_FUNC(devfn);
|
|
||||||
|
|
||||||
address = (bus->number << 16) | (slot << 11) | (func << 8) |
|
address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
|
||||||
(where & 0xfc) | 0x80000000;
|
PCI_FUNC(devfn), where);
|
||||||
|
|
||||||
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||||
if (access_type == PCI_ACCESS_WRITE)
|
if (access_type == PCI_ACCESS_WRITE)
|
||||||
@ -157,8 +162,7 @@ static inline void read_config(unsigned long bus, unsigned long dev,
|
|||||||
unsigned long address;
|
unsigned long address;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
address = (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) |
|
address = rt2880_pci_get_cfgaddr(bus, dev, func, reg);
|
||||||
0x80000000;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&rt2880_pci_lock, flags);
|
spin_lock_irqsave(&rt2880_pci_lock, flags);
|
||||||
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||||
@ -173,8 +177,7 @@ static inline void write_config(unsigned long bus, unsigned long dev,
|
|||||||
unsigned long address;
|
unsigned long address;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
address = (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) |
|
address = rt2880_pci_get_cfgaddr(bus, dev, func, reg);
|
||||||
0x80000000;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&rt2880_pci_lock, flags);
|
spin_lock_irqsave(&rt2880_pci_lock, flags);
|
||||||
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||||
|
Loading…
Reference in New Issue
Block a user