blob: 7d2c3c8438014a40158e62347915a097d7174cce [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;
Thierry Reding352af7d2013-02-11 08:46:10 +010026 void **private_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 int (*setup)(int nr, struct pci_sys_data *);
28 struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
29 void (*preinit)(void);
30 void (*postinit)(void);
31 u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
Ralf Baechled5341942011-06-10 15:30:21 +010032 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
Thomas Petazzoni029baf12013-03-26 18:14:24 +010033 resource_size_t (*align_resource)(struct pci_dev *dev,
34 const struct resource *res,
35 resource_size_t start,
36 resource_size_t size,
37 resource_size_t align);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038};
39
40/*
41 * Per-controller structure
42 */
43struct pci_sys_data {
Anton Vorontsov52882172010-04-19 13:20:49 +010044#ifdef CONFIG_PCI_DOMAINS
45 int domain;
46#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 struct list_head node;
48 int busnr; /* primary bus number */
Greg Kroah-Hartmane31dd6e2006-06-12 17:06:02 -070049 u64 mem_offset; /* bus->cpu memory mapping offset */
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 unsigned long io_offset; /* bus->cpu IO mapping offset */
51 struct pci_bus *bus; /* PCI bus */
Bjorn Helgaas37d15902011-10-28 16:26:16 -060052 struct list_head resources; /* root bus resources (apertures) */
Rob Herring3c5d1692012-07-09 21:59:03 -050053 struct resource io_res;
54 char io_res_name[12];
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 /* Bridge swizzling */
56 u8 (*swizzle)(struct pci_dev *, u8 *);
57 /* IRQ mapping */
Ralf Baechled5341942011-06-10 15:30:21 +010058 int (*map_irq)(const struct pci_dev *, u8, u8);
Thomas Petazzoni029baf12013-03-26 18:14:24 +010059 /* Resource alignement requirements */
60 resource_size_t (*align_resource)(struct pci_dev *dev,
61 const struct resource *res,
62 resource_size_t start,
63 resource_size_t size,
64 resource_size_t align);
Saeed Bishara35fe2fc2010-06-03 14:58:46 +030065 void *private_data; /* platform controller private data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070066};
67
68/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 * Call this with your hw_pci struct to initialise the PCI system.
70 */
71void pci_common_init(struct hw_pci *);
72
73/*
Rob Herringc2794432012-02-29 18:10:58 -060074 * Setup early fixed I/O mapping.
75 */
76#if defined(CONFIG_PCI)
77extern void pci_map_io_early(unsigned long pfn);
78#else
79static inline void pci_map_io_early(unsigned long pfn) {}
80#endif
81
82/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 * PCI controllers
84 */
Russell Kingc23bfc32012-03-10 12:49:16 +000085extern struct pci_ops iop3xx_ops;
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010086extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010087extern void iop3xx_pci_preinit(void);
Dan Williamsc34002c2008-03-26 19:12:38 -070088extern void iop3xx_pci_preinit_cond(void);
Lennert Buytenhek0cb015f2006-09-18 23:16:23 +010089
Russell Kingc23bfc32012-03-10 12:49:16 +000090extern struct pci_ops dc21285_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091extern int dc21285_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070092extern void dc21285_preinit(void);
93extern void dc21285_postinit(void);
94
Russell Kingc23bfc32012-03-10 12:49:16 +000095extern struct pci_ops via82c505_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int via82c505_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070097extern void via82c505_init(void *sysdata);
98
Russell Kingc23bfc32012-03-10 12:49:16 +000099extern struct pci_ops pci_v3_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100extern int pci_v3_setup(int nr, struct pci_sys_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern void pci_v3_preinit(void);
102extern void pci_v3_postinit(void);
Anton Vorontsov52882172010-04-19 13:20:49 +0100103
104#endif /* __ASM_MACH_PCI_H */