18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Support PCI IO workaround 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * (C) Copyright 2007-2008 TOSHIBA CORPORATION 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _IO_WORKAROUNDS_H 98c2ecf20Sopenharmony_ci#define _IO_WORKAROUNDS_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_IO_WORKAROUNDS 128c2ecf20Sopenharmony_ci#include <linux/io.h> 138c2ecf20Sopenharmony_ci#include <asm/pci-bridge.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* Bus info */ 168c2ecf20Sopenharmony_cistruct iowa_bus { 178c2ecf20Sopenharmony_ci struct pci_controller *phb; 188c2ecf20Sopenharmony_ci struct ppc_pci_io *ops; 198c2ecf20Sopenharmony_ci void *private; 208c2ecf20Sopenharmony_ci}; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_civoid iowa_register_bus(struct pci_controller *, struct ppc_pci_io *, 238c2ecf20Sopenharmony_ci int (*)(struct iowa_bus *, void *), void *); 248c2ecf20Sopenharmony_cistruct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR); 258c2ecf20Sopenharmony_cistruct iowa_bus *iowa_pio_find_bus(unsigned long); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciextern struct ppc_pci_io spiderpci_ops; 288c2ecf20Sopenharmony_ciextern int spiderpci_iowa_init(struct iowa_bus *, void *); 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define SPIDER_PCI_REG_BASE 0xd000 318c2ecf20Sopenharmony_ci#define SPIDER_PCI_REG_SIZE 0x1000 328c2ecf20Sopenharmony_ci#define SPIDER_PCI_VCI_CNTL_STAT 0x0110 338c2ecf20Sopenharmony_ci#define SPIDER_PCI_DUMMY_READ 0x0810 348c2ecf20Sopenharmony_ci#define SPIDER_PCI_DUMMY_READ_BASE 0x0814 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#endif 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#if defined(CONFIG_PPC_IO_WORKAROUNDS) && defined(CONFIG_PPC_INDIRECT_MMIO) 398c2ecf20Sopenharmony_ciextern bool io_workaround_inited; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistatic inline bool iowa_is_active(void) 428c2ecf20Sopenharmony_ci{ 438c2ecf20Sopenharmony_ci return unlikely(io_workaround_inited); 448c2ecf20Sopenharmony_ci} 458c2ecf20Sopenharmony_ci#else 468c2ecf20Sopenharmony_cistatic inline bool iowa_is_active(void) 478c2ecf20Sopenharmony_ci{ 488c2ecf20Sopenharmony_ci return false; 498c2ecf20Sopenharmony_ci} 508c2ecf20Sopenharmony_ci#endif 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_civoid __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, 538c2ecf20Sopenharmony_ci pgprot_t prot, void *caller); 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#endif /* _IO_WORKAROUNDS_H */ 56