aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/dart_iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/dart_iommu.c')
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 572b7846cc77..ac784bb57289 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -289,24 +289,15 @@ static void iommu_table_dart_setup(void)
289 set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); 289 set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map);
290} 290}
291 291
292static void iommu_dev_setup_dart(struct pci_dev *dev) 292static void pci_dma_dev_setup_dart(struct pci_dev *dev)
293{ 293{
294 struct device_node *dn;
295
296 /* We only have one iommu table on the mac for now, which makes 294 /* We only have one iommu table on the mac for now, which makes
297 * things simple. Setup all PCI devices to point to this table 295 * things simple. Setup all PCI devices to point to this table
298 *
299 * We must use pci_device_to_OF_node() to make sure that
300 * we get the real "final" pointer to the device in the
301 * pci_dev sysdata and not the temporary PHB one
302 */ 296 */
303 dn = pci_device_to_OF_node(dev); 297 dev->dev.archdata.dma_data = &iommu_table_dart;
304
305 if (dn)
306 PCI_DN(dn)->iommu_table = &iommu_table_dart;
307} 298}
308 299
309static void iommu_bus_setup_dart(struct pci_bus *bus) 300static void pci_dma_bus_setup_dart(struct pci_bus *bus)
310{ 301{
311 struct device_node *dn; 302 struct device_node *dn;
312 303
@@ -321,9 +312,6 @@ static void iommu_bus_setup_dart(struct pci_bus *bus)
321 PCI_DN(dn)->iommu_table = &iommu_table_dart; 312 PCI_DN(dn)->iommu_table = &iommu_table_dart;
322} 313}
323 314
324static void iommu_dev_setup_null(struct pci_dev *dev) { }
325static void iommu_bus_setup_null(struct pci_bus *bus) { }
326
327void iommu_init_early_dart(void) 315void iommu_init_early_dart(void)
328{ 316{
329 struct device_node *dn; 317 struct device_node *dn;
@@ -344,22 +332,21 @@ void iommu_init_early_dart(void)
344 332
345 /* Initialize the DART HW */ 333 /* Initialize the DART HW */
346 if (dart_init(dn) == 0) { 334 if (dart_init(dn) == 0) {
347 ppc_md.iommu_dev_setup = iommu_dev_setup_dart; 335 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart;
348 ppc_md.iommu_bus_setup = iommu_bus_setup_dart; 336 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
349 337
350 /* Setup pci_dma ops */ 338 /* Setup pci_dma ops */
351 pci_iommu_init(); 339 pci_dma_ops = &dma_iommu_ops;
352
353 return; 340 return;
354 } 341 }
355 342
356 bail: 343 bail:
357 /* If init failed, use direct iommu and null setup functions */ 344 /* If init failed, use direct iommu and null setup functions */
358 ppc_md.iommu_dev_setup = iommu_dev_setup_null; 345 ppc_md.pci_dma_dev_setup = NULL;
359 ppc_md.iommu_bus_setup = iommu_bus_setup_null; 346 ppc_md.pci_dma_bus_setup = NULL;
360 347
361 /* Setup pci_dma ops */ 348 /* Setup pci_dma ops */
362 pci_direct_iommu_init(); 349 pci_dma_ops = &dma_direct_ops;
363} 350}
364 351
365 352