~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/powerpc/include/asm/pci-bridge.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
         * Used for variants of PCI indirect handling and possible quirks:
107
107
         *  SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
108
108
         *  EXT_REG - provides access to PCI-e extended registers
109
 
         *  SURPRESS_PRIMARY_BUS - we surpress the setting of PCI_PRIMARY_BUS
 
109
         *  SURPRESS_PRIMARY_BUS - we suppress the setting of PCI_PRIMARY_BUS
110
110
         *   on Freescale PCI-e controllers since they used the PCI_PRIMARY_BUS
111
111
         *   to determine which bus number to match on when generating type0
112
112
         *   config cycles
164
164
                               resource_size_t cfg_addr,
165
165
                               resource_size_t cfg_data, u32 flags);
166
166
 
 
167
static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
 
168
{
 
169
        return bus->sysdata;
 
170
}
 
171
 
167
172
#ifndef CONFIG_PPC64
168
173
 
169
 
static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
 
174
static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
170
175
{
171
 
        return bus->sysdata;
 
176
        struct pci_controller *host;
 
177
 
 
178
        if (bus->self)
 
179
                return pci_device_to_OF_node(bus->self);
 
180
        host = pci_bus_to_host(bus);
 
181
        return host ? host->dn : NULL;
172
182
}
173
183
 
174
184
static inline int isa_vaddr_is_ioport(void __iomem *address)
218
228
 
219
229
/* Get a device_node from a pci_dev.  This code must be fast except
220
230
 * in the case where the sysdata is incorrect and needs to be fixed
221
 
 * up (this will only happen once).
222
 
 * In this case the sysdata will have been inherited from a PCI host
223
 
 * bridge or a PCI-PCI bridge further up the tree, so it will point
224
 
 * to a valid struct pci_dn, just not the one we want.
225
 
 */
 
231
 * up (this will only happen once). */
226
232
static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
227
233
{
228
 
        struct device_node *dn = dev->sysdata;
229
 
        struct pci_dn *pdn = dn->data;
230
 
 
231
 
        if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
232
 
                return dn;      /* fast path.  sysdata is good */
233
 
        return fetch_dev_dn(dev);
 
234
        return dev->dev.of_node ? dev->dev.of_node : fetch_dev_dn(dev);
234
235
}
235
236
 
236
237
static inline int pci_device_from_OF_node(struct device_node *np,
248
249
        if (bus->self)
249
250
                return pci_device_to_OF_node(bus->self);
250
251
        else
251
 
                return bus->sysdata; /* Must be root bus (PHB) */
 
252
                return bus->dev.of_node; /* Must be root bus (PHB) */
252
253
}
253
254
 
254
255
/** Find the bus corresponding to the indicated device node */
260
261
/** Discover new pci devices under this bus, and add them */
261
262
extern void pcibios_add_pci_devices(struct pci_bus *bus);
262
263
 
263
 
static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
264
 
{
265
 
        struct device_node *busdn = bus->sysdata;
266
 
 
267
 
        BUG_ON(busdn == NULL);
268
 
        return PCI_DN(busdn)->phb;
269
 
}
270
 
 
271
264
 
272
265
extern void isa_bridge_find_early(struct pci_controller *hose);
273
266