aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/celleb/scc_epci.c
diff options
context:
space:
mode:
authorIshizaki Kou <kou.ishizaki@toshiba.co.jp>2008-04-24 05:24:13 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-24 07:08:13 -0400
commit6ec859e1b21ab42bfc36bb3b51db275480165c8a (patch)
tree299d0729340598d795559084a11c2fdfc61ce199 /arch/powerpc/platforms/celleb/scc_epci.c
parent7cfb62a2e820b6032c08835dbd996d8518af14a3 (diff)
[POWERPC] celleb: Consolidate io-workarounds code
Now, we can use generic io-workarounds mechanism and the workaround code for spider-pci. This changes Celleb PCI code to use spider-pci code. Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/celleb/scc_epci.c')
-rw-r--r--arch/powerpc/platforms/celleb/scc_epci.c59
1 files changed, 9 insertions, 50 deletions
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c
index a999b393f6f..b126739834a 100644
--- a/arch/powerpc/platforms/celleb/scc_epci.c
+++ b/arch/powerpc/platforms/celleb/scc_epci.c
@@ -43,10 +43,6 @@
43 43
44#define iob() __asm__ __volatile__("eieio; sync":::"memory") 44#define iob() __asm__ __volatile__("eieio; sync":::"memory")
45 45
46struct epci_private {
47 dma_addr_t dummy_page_da;
48};
49
50static inline PCI_IO_ADDR celleb_epci_get_epci_base( 46static inline PCI_IO_ADDR celleb_epci_get_epci_base(
51 struct pci_controller *hose) 47 struct pci_controller *hose)
52{ 48{
@@ -71,42 +67,6 @@ static inline PCI_IO_ADDR celleb_epci_get_epci_cfg(
71 return hose->cfg_data; 67 return hose->cfg_data;
72} 68}
73 69
74static void scc_epci_dummy_read(struct pci_controller *hose)
75{
76 PCI_IO_ADDR epci_base;
77 u32 val;
78
79 epci_base = celleb_epci_get_epci_base(hose);
80
81 val = in_be32(epci_base + SCC_EPCI_WATRP);
82 iosync();
83
84 return;
85}
86
87void __init epci_workaround_init(struct pci_controller *hose)
88{
89 PCI_IO_ADDR epci_base;
90 PCI_IO_ADDR reg;
91 struct epci_private *private = hose->private_data;
92
93 BUG_ON(!private);
94
95 private->dummy_page_da = dma_map_single(hose->parent,
96 celleb_dummy_page_va, PAGE_SIZE, DMA_FROM_DEVICE);
97 if (private->dummy_page_da == DMA_ERROR_CODE) {
98 printk(KERN_ERR "EPCI: dummy read disabled. "
99 "Map dummy page failed.\n");
100 return;
101 }
102
103 celleb_pci_add_one(hose, scc_epci_dummy_read);
104 epci_base = celleb_epci_get_epci_base(hose);
105
106 reg = epci_base + SCC_EPCI_DUMYRADR;
107 out_be32(reg, private->dummy_page_da);
108}
109
110static inline void clear_and_disable_master_abort_interrupt( 70static inline void clear_and_disable_master_abort_interrupt(
111 struct pci_controller *hose) 71 struct pci_controller *hose)
112{ 72{
@@ -425,8 +385,8 @@ static int __init celleb_epci_init(struct pci_controller *hose)
425 return 0; 385 return 0;
426} 386}
427 387
428int __init celleb_setup_epci(struct device_node *node, 388static int __init celleb_setup_epci(struct device_node *node,
429 struct pci_controller *hose) 389 struct pci_controller *hose)
430{ 390{
431 struct resource r; 391 struct resource r;
432 392
@@ -462,20 +422,12 @@ int __init celleb_setup_epci(struct device_node *node,
462 r.start, (unsigned long)hose->cfg_data, 422 r.start, (unsigned long)hose->cfg_data,
463 (r.end - r.start + 1)); 423 (r.end - r.start + 1));
464 424
465 hose->private_data = kzalloc(sizeof(struct epci_private), GFP_KERNEL);
466 if (hose->private_data == NULL) {
467 printk(KERN_ERR "EPCI: no memory for private data.\n");
468 goto error;
469 }
470
471 hose->ops = &celleb_epci_ops; 425 hose->ops = &celleb_epci_ops;
472 celleb_epci_init(hose); 426 celleb_epci_init(hose);
473 427
474 return 0; 428 return 0;
475 429
476error: 430error:
477 kfree(hose->private_data);
478
479 if (hose->cfg_addr) 431 if (hose->cfg_addr)
480 iounmap(hose->cfg_addr); 432 iounmap(hose->cfg_addr);
481 433
@@ -483,3 +435,10 @@ error:
483 iounmap(hose->cfg_data); 435 iounmap(hose->cfg_data);
484 return 1; 436 return 1;
485} 437}
438
439struct celleb_phb_spec celleb_epci_spec __initdata = {
440 .setup = celleb_setup_epci,
441 .ops = &spiderpci_ops,
442 .iowa_init = &spiderpci_iowa_init,
443 .iowa_data = (void *)0,
444};