xref: /linux/arch/powerpc/include/asm/io-workarounds.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Support PCI IO workaround
4  *
5  * (C) Copyright 2007-2008 TOSHIBA CORPORATION
6  */
7 
8 #ifndef _IO_WORKAROUNDS_H
9 #define _IO_WORKAROUNDS_H
10 
11 #ifdef CONFIG_PPC_IO_WORKAROUNDS
12 #include <linux/io.h>
13 #include <asm/pci-bridge.h>
14 
15 /* Bus info */
16 struct iowa_bus {
17 	struct pci_controller *phb;
18 	struct ppc_pci_io *ops;
19 	void   *private;
20 };
21 
22 void iowa_register_bus(struct pci_controller *, struct ppc_pci_io *,
23 		       int (*)(struct iowa_bus *, void *), void *);
24 struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
25 struct iowa_bus *iowa_pio_find_bus(unsigned long);
26 
27 extern struct ppc_pci_io spiderpci_ops;
28 extern int spiderpci_iowa_init(struct iowa_bus *, void *);
29 
30 #define SPIDER_PCI_REG_BASE		0xd000
31 #define SPIDER_PCI_REG_SIZE		0x1000
32 #define SPIDER_PCI_VCI_CNTL_STAT	0x0110
33 #define SPIDER_PCI_DUMMY_READ		0x0810
34 #define SPIDER_PCI_DUMMY_READ_BASE	0x0814
35 
36 #endif
37 
38 #if defined(CONFIG_PPC_IO_WORKAROUNDS) && defined(CONFIG_PPC_INDIRECT_MMIO)
39 extern bool io_workaround_inited;
40 
41 static inline bool iowa_is_active(void)
42 {
43 	return unlikely(io_workaround_inited);
44 }
45 #else
46 static inline bool iowa_is_active(void)
47 {
48 	return false;
49 }
50 #endif
51 
52 void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
53 			   pgprot_t prot, void *caller);
54 
55 #endif /* _IO_WORKAROUNDS_H */
56