diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-10-07 11:37:07 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-10-07 11:37:07 +0000 |
commit | f2470f7590607ae28cb921830d259a48bbf0364c (patch) | |
tree | 825ed3bc1701b107f23d23cee3acedad12d4a9c0 /target/linux/ramips/files | |
parent | fe360a232b70002e6cb51dc58225c74655ec7f12 (diff) | |
download | upstream-f2470f7590607ae28cb921830d259a48bbf0364c.tar.gz upstream-f2470f7590607ae28cb921830d259a48bbf0364c.tar.bz2 upstream-f2470f7590607ae28cb921830d259a48bbf0364c.zip |
ramips: add rt2880_pci_get_cfgaddr helper
SVN-Revision: 17973
Diffstat (limited to 'target/linux/ramips/files')
-rw-r--r-- | target/linux/ramips/files/arch/mips/pci/pci-rt288x.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/target/linux/ramips/files/arch/mips/pci/pci-rt288x.c b/target/linux/ramips/files/arch/mips/pci/pci-rt288x.c index 2fccd7bb73..14b7d42ba8 100644 --- a/target/linux/ramips/files/arch/mips/pci/pci-rt288x.c +++ b/target/linux/ramips/files/arch/mips/pci/pci-rt288x.c @@ -53,15 +53,20 @@ static void rt2880_pci_reg_write(u32 val, u32 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, unsigned int devfn, unsigned char where, u32 *data) { - unsigned int slot = PCI_SLOT(devfn); unsigned int address; - u8 func = PCI_FUNC(devfn); - address = (bus->number << 16) | (slot << 11) | (func << 8) | - (where & 0xfc) | 0x80000000; + address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), + PCI_FUNC(devfn), where); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); 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 flags; - address = (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | - 0x80000000; + address = rt2880_pci_get_cfgaddr(bus, dev, func, reg); spin_lock_irqsave(&rt2880_pci_lock, flags); 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 flags; - address = (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | - 0x80000000; + address = rt2880_pci_get_cfgaddr(bus, dev, func, reg); spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); |