blob: db9fedb57f2c4284d2d456ee0eef29270580579c [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 Herring3c5d1692012-07-09 21:59:03 -050014#include <linux/ioport.h>
Rob Herringc2794432012-02-29 18:10:58 -060015
Linus Torvalds1da177e2005-04-16 15:20:36 -070016struct pci_sys_data;
Russell Kingc23bfc32012-03-10 12:49:16 +000017struct pci_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070018struct pci_bus;
19
20struct hw_pci {
Anton Vorontsov52882172010-04-19 13:20:49 +010021#ifdef CONFIG_PCI_DOMAINS
22 int domain;
23#endif
Russell Kingc23bfc32012-03-10 12:49:16 +000024 struct pci_ops *ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 int nr_controllers;
26 int (*setup)(int nr, struct pci_sys_data *);
27 struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
28 void (*preinit)(void);
29 void (*postinit)(void);
30 u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
Ralf Baechled5341942011-06-10 15:30:21 +010031 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
Linus Torvalds1da177e2005-04-16 15:20:36 -070032};
33
34/*
35 * Per-controller structure
36 */
37struct pci_sys_data {
Anton Vorontsov52882172010-04-19 13:20:49 +010038#ifdef CONFIG_PCI_DOMAINS
39 int domain;
40#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 struct list_head node;
42 int busnr; /* primary bus number */
Greg Kroah-Hartmane31dd6e2006-06-12 17:06:02 -070043 u64 mem_offset; /* bus->cpu memory mapping offset */
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 unsigned long io_offset; /* bus->cpu IO mapping offset */
45 struct pci_bus *bus; /* PCI bus */
Bjorn Helgaas37d15902011-10-28 16:26:16 -060046 struct list_head resources; /* root bus resources (apertures) */
Rob Herring3c5d1692012-07-09 21:59:03 -050047 struct resource io_res;
48 char io_res_name[12];
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 /* Bridge swizzling */
50 u8 (*swizzle)(struct pci_dev *, u8 *);
51 /* IRQ mapping */
Ralf Baechled5341942011-06-10 15:30:21 +010052 int (*map_irq)(const struct pci_dev *, u8, u8);
Saeed Bishara35fe2fc2010-06-03 14:58:46 +030053 void *private_data; /* platform controller private data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070054};
55
56/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 * Call this with your hw_pci struct to initialise the PCI system.
58 */
59void pci_common_init(struct hw_pci *);
60
61/*
Rob Herringc2794432012-02-29 18:10:58 -060062 * Setup early fixed I/O mapping.
63 */
64#if defined(CONFIG_PCI)
65extern void pci_map_io_early(unsigned long pfn);
66#else
67static inline void pci_map_io_early(unsigned long pfn) {}
68#endif
69
70/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 * PCI controllers
72 */
Russell Kingc23bfc32012-03-10 12:49:16 +000073extern struct pci_ops iop3xx_ops;
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010074extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010075extern void iop3xx_pci_preinit(void);
Dan Williamsc34002c2008-03-26 19:12:38 -070076extern void iop3xx_pci_preinit_cond(void);
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010077
Russell Kingc23bfc32012-03-10 12:49:16 +000078extern struct pci_ops dc21285_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070079extern int dc21285_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080extern void dc21285_preinit(void);
81extern void dc21285_postinit(void);
82
Russell Kingc23bfc32012-03-10 12:49:16 +000083extern struct pci_ops via82c505_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084extern int via82c505_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070085extern void via82c505_init(void *sysdata);
86
Russell Kingc23bfc32012-03-10 12:49:16 +000087extern struct pci_ops pci_v3_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070088extern int pci_v3_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070089extern void pci_v3_preinit(void);
90extern void pci_v3_postinit(void);
Anton Vorontsov52882172010-04-19 13:20:49 +010091
92#endif /* __ASM_MACH_PCI_H */