aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/pci-bridge.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
commit4c5811bf463b0ef82fabbd1708f8bb2d753aeb18 (patch)
treeff37d31217c3804ca05de21a55a9b5ca1ca818b2 /arch/powerpc/include/asm/pci-bridge.h
parentf74b9444192c60603020c61d7915b72893137edc (diff)
parent9f15444fefdb33509132ff5c9be60cb315c44cb2 (diff)
Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6: (21 commits) tty: serial: altera_jtaguart: Add device tree support tty: serial: altera_uart: Add devicetree support dt: eliminate of_platform_driver shim code dt: Eliminate of_platform_{,un}register_driver dt/serial: Eliminate users of of_platform_{,un}register_driver dt/usb: Eliminate users of of_platform_{,un}register_driver dt/video: Eliminate users of of_platform_{,un}register_driver dt/net: Eliminate users of of_platform_{,un}register_driver dt/sound: Eliminate users of of_platform_{,un}register_driver dt/spi: Eliminate users of of_platform_{,un}register_driver dt: uartlite: merge platform and of_platform driver bindings dt: xilinx_hwicap: merge platform and of_platform driver bindings ipmi: convert OF driver to platform driver leds/leds-gpio: merge platform_driver with of_platform_driver dt/sparc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: move of_bus_type infrastructure to ibmebus drivercore/dt: add a match table pointer to struct device dt: Typo fix. altera_ps2: Add devicetree support ...
Diffstat (limited to 'arch/powerpc/include/asm/pci-bridge.h')
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h27
1 files changed, 5 insertions, 22 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index edeb80fdd2c3..5e156e034fe2 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -164,13 +164,13 @@ extern void setup_indirect_pci(struct pci_controller* hose,
164 resource_size_t cfg_addr, 164 resource_size_t cfg_addr,
165 resource_size_t cfg_data, u32 flags); 165 resource_size_t cfg_data, u32 flags);
166 166
167#ifndef CONFIG_PPC64
168
169static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) 167static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
170{ 168{
171 return bus->sysdata; 169 return bus->sysdata;
172} 170}
173 171
172#ifndef CONFIG_PPC64
173
174static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) 174static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
175{ 175{
176 struct pci_controller *host; 176 struct pci_controller *host;
@@ -228,19 +228,10 @@ extern void * update_dn_pci_info(struct device_node *dn, void *data);
228 228
229/* Get a device_node from a pci_dev. This code must be fast except 229/* Get a device_node from a pci_dev. This code must be fast except
230 * in the case where the sysdata is incorrect and needs to be fixed 230 * in the case where the sysdata is incorrect and needs to be fixed
231 * up (this will only happen once). 231 * up (this will only happen once). */
232 * In this case the sysdata will have been inherited from a PCI host
233 * bridge or a PCI-PCI bridge further up the tree, so it will point
234 * to a valid struct pci_dn, just not the one we want.
235 */
236static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) 232static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
237{ 233{
238 struct device_node *dn = dev->sysdata; 234 return dev->dev.of_node ? dev->dev.of_node : fetch_dev_dn(dev);
239 struct pci_dn *pdn = dn->data;
240
241 if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
242 return dn; /* fast path. sysdata is good */
243 return fetch_dev_dn(dev);
244} 235}
245 236
246static inline int pci_device_from_OF_node(struct device_node *np, 237static inline int pci_device_from_OF_node(struct device_node *np,
@@ -258,7 +249,7 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
258 if (bus->self) 249 if (bus->self)
259 return pci_device_to_OF_node(bus->self); 250 return pci_device_to_OF_node(bus->self);
260 else 251 else
261 return bus->sysdata; /* Must be root bus (PHB) */ 252 return bus->dev.of_node; /* Must be root bus (PHB) */
262} 253}
263 254
264/** Find the bus corresponding to the indicated device node */ 255/** Find the bus corresponding to the indicated device node */
@@ -270,14 +261,6 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus);
270/** Discover new pci devices under this bus, and add them */ 261/** Discover new pci devices under this bus, and add them */
271extern void pcibios_add_pci_devices(struct pci_bus *bus); 262extern void pcibios_add_pci_devices(struct pci_bus *bus);
272 263
273static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
274{
275 struct device_node *busdn = bus->sysdata;
276
277 BUG_ON(busdn == NULL);
278 return PCI_DN(busdn)->phb;
279}
280
281 264
282extern void isa_bridge_find_early(struct pci_controller *hose); 265extern void isa_bridge_find_early(struct pci_controller *hose);
283 266