1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2f15cbe6fSPaul Mundt #ifndef __ASM_SH_PCI_H
3f15cbe6fSPaul Mundt #define __ASM_SH_PCI_H
4f15cbe6fSPaul Mundt
5f15cbe6fSPaul Mundt /* Can be used to override the logic in pci_scan_bus for skipping
6f15cbe6fSPaul Mundt already-configured bus numbers - to be used for buggy BIOSes
7f15cbe6fSPaul Mundt or architectures with incomplete PCI setup by the loader */
8f15cbe6fSPaul Mundt
9f15cbe6fSPaul Mundt #define pcibios_assign_all_busses() 1
10f15cbe6fSPaul Mundt
11f15cbe6fSPaul Mundt /*
12f15cbe6fSPaul Mundt * A board can define one or more PCI channels that represent built-in (or
13f15cbe6fSPaul Mundt * external) PCI controllers.
14f15cbe6fSPaul Mundt */
15f15cbe6fSPaul Mundt struct pci_channel {
16e79066a6SPaul Mundt struct pci_channel *next;
17320e68daSPaul Mundt struct pci_bus *bus;
18e79066a6SPaul Mundt
19f15cbe6fSPaul Mundt struct pci_ops *pci_ops;
20b6c58b1dSPaul Mundt
21b6c58b1dSPaul Mundt struct resource *resources;
22b6c58b1dSPaul Mundt unsigned int nr_resources;
23e79066a6SPaul Mundt
2409cfeb13SPaul Mundt unsigned long io_offset;
2509cfeb13SPaul Mundt unsigned long mem_offset;
2609cfeb13SPaul Mundt
27e4c6a360SMagnus Damm unsigned long reg_base;
280bb34a6bSPaul Mundt unsigned long io_map_base;
29320e68daSPaul Mundt
30320e68daSPaul Mundt unsigned int index;
31320e68daSPaul Mundt unsigned int need_domain_info;
32ef407beeSPaul Mundt
33ef407beeSPaul Mundt /* Optional error handling */
34ef407beeSPaul Mundt struct timer_list err_timer, serr_timer;
35ef407beeSPaul Mundt unsigned int err_irq, serr_irq;
36f15cbe6fSPaul Mundt };
37f15cbe6fSPaul Mundt
38ef407beeSPaul Mundt /* arch/sh/drivers/pci/pci.c */
3939a90865SPaul Mundt extern raw_spinlock_t pci_config_lock;
4039a90865SPaul Mundt
41bcf39352SPaul Mundt extern int register_pci_controller(struct pci_channel *hose);
42ef407beeSPaul Mundt extern void pcibios_report_status(unsigned int status_mask, int warn);
43ef407beeSPaul Mundt
44ef407beeSPaul Mundt /* arch/sh/drivers/pci/common.c */
459ad62ec4SPaul Mundt extern int early_read_config_byte(struct pci_channel *hose, int top_bus,
469ad62ec4SPaul Mundt int bus, int devfn, int offset, u8 *value);
479ad62ec4SPaul Mundt extern int early_read_config_word(struct pci_channel *hose, int top_bus,
489ad62ec4SPaul Mundt int bus, int devfn, int offset, u16 *value);
499ad62ec4SPaul Mundt extern int early_read_config_dword(struct pci_channel *hose, int top_bus,
509ad62ec4SPaul Mundt int bus, int devfn, int offset, u32 *value);
519ad62ec4SPaul Mundt extern int early_write_config_byte(struct pci_channel *hose, int top_bus,
529ad62ec4SPaul Mundt int bus, int devfn, int offset, u8 value);
539ad62ec4SPaul Mundt extern int early_write_config_word(struct pci_channel *hose, int top_bus,
549ad62ec4SPaul Mundt int bus, int devfn, int offset, u16 value);
559ad62ec4SPaul Mundt extern int early_write_config_dword(struct pci_channel *hose, int top_bus,
569ad62ec4SPaul Mundt int bus, int devfn, int offset, u32 value);
57ef407beeSPaul Mundt extern void pcibios_enable_timers(struct pci_channel *hose);
58ef407beeSPaul Mundt extern unsigned int pcibios_handle_status_errors(unsigned long addr,
59ef407beeSPaul Mundt unsigned int status, struct pci_channel *hose);
6085b59f5bSPaul Mundt extern int pci_is_66mhz_capable(struct pci_channel *hose,
6185b59f5bSPaul Mundt int top_bus, int current_bus);
62e79066a6SPaul Mundt
63a3c0e0d0SPaul Mundt extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
64f15cbe6fSPaul Mundt
6598333851SPaul Mundt #define HAVE_PCI_MMAP
66adf7bde6SDavid Woodhouse #define ARCH_GENERIC_PCI_MMAP_RESOURCE
6711df1954SDavid Woodhouse
68f15cbe6fSPaul Mundt /* Dynamic DMA mapping stuff.
69f15cbe6fSPaul Mundt * SuperH has everything mapped statically like x86.
70f15cbe6fSPaul Mundt */
71f15cbe6fSPaul Mundt
723e98f9f1SPaul Mundt #ifdef CONFIG_PCI
73b7e2ac61SPaul Mundt /*
74b7e2ac61SPaul Mundt * None of the SH PCI controllers support MWI, it is always treated as a
75b7e2ac61SPaul Mundt * direct memory write.
76b7e2ac61SPaul Mundt */
77b7e2ac61SPaul Mundt #define PCI_DISABLE_MWI
783e98f9f1SPaul Mundt #endif
79ef339f24SMagnus Damm
80f15cbe6fSPaul Mundt /* Board-specific fixup routines. */
81d5341942SRalf Baechle int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
82f15cbe6fSPaul Mundt
83320e68daSPaul Mundt #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
84320e68daSPaul Mundt
pci_proc_domain(struct pci_bus * bus)85320e68daSPaul Mundt static inline int pci_proc_domain(struct pci_bus *bus)
86320e68daSPaul Mundt {
87320e68daSPaul Mundt struct pci_channel *hose = bus->sysdata;
88320e68daSPaul Mundt return hose->need_domain_info;
89320e68daSPaul Mundt }
90320e68daSPaul Mundt
91f15cbe6fSPaul Mundt #endif /* __ASM_SH_PCI_H */
92