blob: df818876fa311e93451be4636980eefbfe9eb0af [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Russell King4baa9922008-08-02 10:55:55 +01002 * arch/arm/include/asm/mach/pci.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
Anton Vorontsov52882172010-04-19 13:20:49 +010011#ifndef __ASM_MACH_PCI_H
12#define __ASM_MACH_PCI_H
13
Rob Herringc2794432012-02-29 18:10:58 -060014
Linus Torvalds1da177e2005-04-16 15:20:36 -070015struct pci_sys_data;
Russell Kingc23bfc32012-03-10 12:49:16 +000016struct pci_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070017struct pci_bus;
18
19struct hw_pci {
Anton Vorontsov52882172010-04-19 13:20:49 +010020#ifdef CONFIG_PCI_DOMAINS
21 int domain;
22#endif
Russell Kingc23bfc32012-03-10 12:49:16 +000023 struct pci_ops *ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 int nr_controllers;
25 int (*setup)(int nr, struct pci_sys_data *);
26 struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
27 void (*preinit)(void);
28 void (*postinit)(void);
29 u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
Ralf Baechled5341942011-06-10 15:30:21 +010030 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031};
32
33/*
34 * Per-controller structure
35 */
36struct pci_sys_data {
Anton Vorontsov52882172010-04-19 13:20:49 +010037#ifdef CONFIG_PCI_DOMAINS
38 int domain;
39#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 struct list_head node;
41 int busnr; /* primary bus number */
Greg Kroah-Hartmane31dd6e2006-06-12 17:06:02 -070042 u64 mem_offset; /* bus->cpu memory mapping offset */
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 unsigned long io_offset; /* bus->cpu IO mapping offset */
44 struct pci_bus *bus; /* PCI bus */
Bjorn Helgaas37d15902011-10-28 16:26:16 -060045 struct list_head resources; /* root bus resources (apertures) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 /* Bridge swizzling */
47 u8 (*swizzle)(struct pci_dev *, u8 *);
48 /* IRQ mapping */
Ralf Baechled5341942011-06-10 15:30:21 +010049 int (*map_irq)(const struct pci_dev *, u8, u8);
Saeed Bishara35fe2fc2010-06-03 14:58:46 +030050 void *private_data; /* platform controller private data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
53/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 * Call this with your hw_pci struct to initialise the PCI system.
55 */
56void pci_common_init(struct hw_pci *);
57
58/*
Rob Herringc2794432012-02-29 18:10:58 -060059 * Setup early fixed I/O mapping.
60 */
61#if defined(CONFIG_PCI)
62extern void pci_map_io_early(unsigned long pfn);
63#else
64static inline void pci_map_io_early(unsigned long pfn) {}
65#endif
66
67/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 * PCI controllers
69 */
Russell Kingc23bfc32012-03-10 12:49:16 +000070extern struct pci_ops iop3xx_ops;
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010071extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010072extern void iop3xx_pci_preinit(void);
Dan Williamsc34002c2008-03-26 19:12:38 -070073extern void iop3xx_pci_preinit_cond(void);
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010074
Russell Kingc23bfc32012-03-10 12:49:16 +000075extern struct pci_ops dc21285_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076extern int dc21285_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077extern void dc21285_preinit(void);
78extern void dc21285_postinit(void);
79
Russell Kingc23bfc32012-03-10 12:49:16 +000080extern struct pci_ops via82c505_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081extern int via82c505_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082extern void via82c505_init(void *sysdata);
83
Russell Kingc23bfc32012-03-10 12:49:16 +000084extern struct pci_ops pci_v3_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070085extern int pci_v3_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070086extern void pci_v3_preinit(void);
87extern void pci_v3_postinit(void);
Anton Vorontsov52882172010-04-19 13:20:49 +010088
89#endif /* __ASM_MACH_PCI_H */