18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/include/asm/mach/pci.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2000 Russell King 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_PCI_H 98c2ecf20Sopenharmony_ci#define __ASM_MACH_PCI_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/ioport.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct pci_sys_data; 148c2ecf20Sopenharmony_cistruct pci_ops; 158c2ecf20Sopenharmony_cistruct pci_bus; 168c2ecf20Sopenharmony_cistruct pci_host_bridge; 178c2ecf20Sopenharmony_cistruct device; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistruct hw_pci { 208c2ecf20Sopenharmony_ci struct pci_ops *ops; 218c2ecf20Sopenharmony_ci int nr_controllers; 228c2ecf20Sopenharmony_ci void **private_data; 238c2ecf20Sopenharmony_ci int (*setup)(int nr, struct pci_sys_data *); 248c2ecf20Sopenharmony_ci int (*scan)(int nr, struct pci_host_bridge *); 258c2ecf20Sopenharmony_ci void (*preinit)(void); 268c2ecf20Sopenharmony_ci void (*postinit)(void); 278c2ecf20Sopenharmony_ci u8 (*swizzle)(struct pci_dev *dev, u8 *pin); 288c2ecf20Sopenharmony_ci int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/* 328c2ecf20Sopenharmony_ci * Per-controller structure 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_cistruct pci_sys_data { 358c2ecf20Sopenharmony_ci struct list_head node; 368c2ecf20Sopenharmony_ci int busnr; /* primary bus number */ 378c2ecf20Sopenharmony_ci u64 mem_offset; /* bus->cpu memory mapping offset */ 388c2ecf20Sopenharmony_ci unsigned long io_offset; /* bus->cpu IO mapping offset */ 398c2ecf20Sopenharmony_ci struct pci_bus *bus; /* PCI bus */ 408c2ecf20Sopenharmony_ci struct list_head resources; /* root bus resources (apertures) */ 418c2ecf20Sopenharmony_ci struct resource io_res; 428c2ecf20Sopenharmony_ci char io_res_name[12]; 438c2ecf20Sopenharmony_ci /* Bridge swizzling */ 448c2ecf20Sopenharmony_ci u8 (*swizzle)(struct pci_dev *, u8 *); 458c2ecf20Sopenharmony_ci /* IRQ mapping */ 468c2ecf20Sopenharmony_ci int (*map_irq)(const struct pci_dev *, u8, u8); 478c2ecf20Sopenharmony_ci void *private_data; /* platform controller private data */ 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/* 518c2ecf20Sopenharmony_ci * Call this with your hw_pci struct to initialise the PCI system. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_civoid pci_common_init_dev(struct device *, struct hw_pci *); 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* 568c2ecf20Sopenharmony_ci * Compatibility wrapper for older platforms that do not care about 578c2ecf20Sopenharmony_ci * passing the parent device. 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_cistatic inline void pci_common_init(struct hw_pci *hw) 608c2ecf20Sopenharmony_ci{ 618c2ecf20Sopenharmony_ci pci_common_init_dev(NULL, hw); 628c2ecf20Sopenharmony_ci} 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * Setup early fixed I/O mapping. 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI) 688c2ecf20Sopenharmony_ciextern void pci_map_io_early(unsigned long pfn); 698c2ecf20Sopenharmony_ci#else 708c2ecf20Sopenharmony_cistatic inline void pci_map_io_early(unsigned long pfn) {} 718c2ecf20Sopenharmony_ci#endif 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* 748c2ecf20Sopenharmony_ci * PCI controllers 758c2ecf20Sopenharmony_ci */ 768c2ecf20Sopenharmony_ciextern struct pci_ops iop3xx_ops; 778c2ecf20Sopenharmony_ciextern int iop3xx_pci_setup(int nr, struct pci_sys_data *); 788c2ecf20Sopenharmony_ciextern void iop3xx_pci_preinit(void); 798c2ecf20Sopenharmony_ciextern void iop3xx_pci_preinit_cond(void); 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ciextern struct pci_ops dc21285_ops; 828c2ecf20Sopenharmony_ciextern int dc21285_setup(int nr, struct pci_sys_data *); 838c2ecf20Sopenharmony_ciextern void dc21285_preinit(void); 848c2ecf20Sopenharmony_ciextern void dc21285_postinit(void); 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_PCI_H */ 87