aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
authorDaniel Axtens <dja@axtens.net>2015-03-31 01:00:56 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-04-11 06:49:18 -0400
commit467efc2e4fdc44e6cd4be7dd4adf01c14b3d148e (patch)
treed8702b30db2eedb190e82beb802ac30275af6ea7 /arch/powerpc/include/asm
parent9c1368fc50e78ff862a05d1a0995ce44413c49e2 (diff)
powerpc: Remove shims for pci_controller_ops operations
Remove shims, patch callsites to use pci_controller_ops versions instead. Also move back the probe mode defines, as explained in the patch for pci_probe_mode. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/machdep.h14
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h84
-rw-r--r--arch/powerpc/include/asm/pci.h5
3 files changed, 5 insertions, 98 deletions
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index e29f058c0903..5c19ac527a8e 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -103,9 +103,6 @@ struct machdep_calls {
103#endif 103#endif
104#endif /* CONFIG_PPC64 */ 104#endif /* CONFIG_PPC64 */
105 105
106 void (*pci_dma_dev_setup)(struct pci_dev *dev);
107 void (*pci_dma_bus_setup)(struct pci_bus *bus);
108
109 /* Platform set_dma_mask and dma_get_required_mask overrides */ 106 /* Platform set_dma_mask and dma_get_required_mask overrides */
110 int (*dma_set_mask)(struct device *dev, u64 dma_mask); 107 int (*dma_set_mask)(struct device *dev, u64 dma_mask);
111 u64 (*dma_get_required_mask)(struct device *dev); 108 u64 (*dma_get_required_mask)(struct device *dev);
@@ -127,7 +124,6 @@ struct machdep_calls {
127 /* PCI stuff */ 124 /* PCI stuff */
128 /* Called after allocating resources */ 125 /* Called after allocating resources */
129 void (*pcibios_fixup)(void); 126 void (*pcibios_fixup)(void);
130 int (*pci_probe_mode)(struct pci_bus *);
131 void (*pci_irq_fixup)(struct pci_dev *dev); 127 void (*pci_irq_fixup)(struct pci_dev *dev);
132 int (*pcibios_root_bridge_prepare)(struct pci_host_bridge 128 int (*pcibios_root_bridge_prepare)(struct pci_host_bridge
133 *bridge); 129 *bridge);
@@ -237,19 +233,9 @@ struct machdep_calls {
237 /* Called for each PCI bus in the system when it's probed */ 233 /* Called for each PCI bus in the system when it's probed */
238 void (*pcibios_fixup_bus)(struct pci_bus *); 234 void (*pcibios_fixup_bus)(struct pci_bus *);
239 235
240 /* Called when pci_enable_device() is called. Returns true to
241 * allow assignment/enabling of the device. */
242 bool (*pcibios_enable_device_hook)(struct pci_dev *);
243
244 /* Called after scan and before resource survey */ 236 /* Called after scan and before resource survey */
245 void (*pcibios_fixup_phb)(struct pci_controller *hose); 237 void (*pcibios_fixup_phb)(struct pci_controller *hose);
246 238
247 /* Called during PCI resource reassignment */
248 resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type);
249
250 /* Reset the secondary bus of bridge */
251 void (*pcibios_reset_secondary_bus)(struct pci_dev *dev);
252
253 /* Called to shutdown machine specific hardware not already controlled 239 /* Called to shutdown machine specific hardware not already controlled
254 * by other drivers. 240 * by other drivers.
255 */ 241 */
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index bb34b1eebfbe..7d972bc85638 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -12,11 +12,6 @@
12#include <linux/ioport.h> 12#include <linux/ioport.h>
13#include <asm-generic/pci-bridge.h> 13#include <asm-generic/pci-bridge.h>
14 14
15/* Return values for pci_controller_ops.probe_mode function */
16#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
17#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
18#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
19
20struct device_node; 15struct device_node;
21 16
22/* 17/*
@@ -284,84 +279,5 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
284} 279}
285#endif /* CONFIG_PCI */ 280#endif /* CONFIG_PCI */
286 281
287/*
288 * Shims to prefer pci_controller version over ppc_md where available.
289 */
290static inline void pci_dma_dev_setup(struct pci_dev *dev)
291{
292 struct pci_controller *phb = pci_bus_to_host(dev->bus);
293
294 if (phb->controller_ops.dma_dev_setup)
295 phb->controller_ops.dma_dev_setup(dev);
296 else if (ppc_md.pci_dma_dev_setup)
297 ppc_md.pci_dma_dev_setup(dev);
298}
299
300static inline void pci_dma_bus_setup(struct pci_bus *bus)
301{
302 struct pci_controller *phb = pci_bus_to_host(bus);
303
304 if (phb->controller_ops.dma_bus_setup)
305 phb->controller_ops.dma_bus_setup(bus);
306 else if (ppc_md.pci_dma_bus_setup)
307 ppc_md.pci_dma_bus_setup(bus);
308}
309
310static inline int pci_probe_mode(struct pci_bus *bus)
311{
312 struct pci_controller *phb = pci_bus_to_host(bus);
313
314 if (phb->controller_ops.probe_mode)
315 return phb->controller_ops.probe_mode(bus);
316 if (ppc_md.pci_probe_mode)
317 return ppc_md.pci_probe_mode(bus);
318 return PCI_PROBE_NORMAL;
319}
320
321static inline bool pcibios_enable_device_hook(struct pci_dev *dev)
322{
323 struct pci_controller *phb = pci_bus_to_host(dev->bus);
324
325 if (phb->controller_ops.enable_device_hook)
326 return phb->controller_ops.enable_device_hook(dev);
327 if (ppc_md.pcibios_enable_device_hook)
328 return ppc_md.pcibios_enable_device_hook(dev);
329 return true;
330}
331
332static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
333 unsigned long type)
334{
335 struct pci_controller *phb = pci_bus_to_host(bus);
336
337 if (phb->controller_ops.window_alignment)
338 return phb->controller_ops.window_alignment(bus, type);
339 if (ppc_md.pcibios_window_alignment)
340 return ppc_md.pcibios_window_alignment(bus, type);
341
342 /*
343 * PCI core will figure out the default
344 * alignment: 4KiB for I/O and 1MiB for
345 * memory window.
346 */
347 return 1;
348}
349
350static inline void pcibios_reset_secondary_bus_shim(struct pci_dev *dev)
351{
352 struct pci_controller *phb = pci_bus_to_host(dev->bus);
353
354 if (phb->controller_ops.reset_secondary_bus)
355 phb->controller_ops.reset_secondary_bus(dev);
356 else if (ppc_md.pcibios_reset_secondary_bus)
357 ppc_md.pcibios_reset_secondary_bus(dev);
358 else
359 /*
360 * Fallback to the generic function if no
361 * platform-specific one is provided
362 */
363 pci_reset_secondary_bus(dev);
364}
365
366#endif /* __KERNEL__ */ 282#endif /* __KERNEL__ */
367#endif /* _ASM_POWERPC_PCI_BRIDGE_H */ 283#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 8745067ac702..4aef8d660999 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -22,6 +22,11 @@
22 22
23#include <asm-generic/pci-dma-compat.h> 23#include <asm-generic/pci-dma-compat.h>
24 24
25/* Return values for pci_controller_ops.probe_mode function */
26#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
27#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
28#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
29
25#define PCIBIOS_MIN_IO 0x1000 30#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM 0x10000000 31#define PCIBIOS_MIN_MEM 0x10000000
27 32