Merge tag 'iio-fixes-for-4.5b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
[deliverable/linux.git] / drivers / pci / host / pcie-iproc.h
1 /*
2 * Copyright (C) 2014-2015 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14 #ifndef _PCIE_IPROC_H
15 #define _PCIE_IPROC_H
16
17 /**
18 * iProc PCIe interface type
19 *
20 * PAXB is the wrapper used in root complex that can be connected to an
21 * external endpoint device.
22 *
23 * PAXC is the wrapper used in root complex dedicated for internal emulated
24 * endpoint devices.
25 */
26 enum iproc_pcie_type {
27 IPROC_PCIE_PAXB = 0,
28 IPROC_PCIE_PAXC,
29 };
30
31 /**
32 * iProc PCIe outbound mapping
33 * @set_oarr_size: indicates the OARR size bit needs to be set
34 * @axi_offset: offset from the AXI address to the internal address used by
35 * the iProc PCIe core
36 * @window_size: outbound window size
37 */
38 struct iproc_pcie_ob {
39 bool set_oarr_size;
40 resource_size_t axi_offset;
41 resource_size_t window_size;
42 };
43
44 struct iproc_msi;
45
46 /**
47 * iProc PCIe device
48 *
49 * @dev: pointer to device data structure
50 * @type: iProc PCIe interface type
51 * @reg_offsets: register offsets
52 * @base: PCIe host controller I/O register base
53 * @base_addr: PCIe host controller register base physical address
54 * @sysdata: Per PCI controller data (ARM-specific)
55 * @root_bus: pointer to root bus
56 * @phy: optional PHY device that controls the Serdes
57 * @map_irq: function callback to map interrupts
58 * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
59 * @ob: outbound mapping parameters
60 * @msi: MSI data
61 */
62 struct iproc_pcie {
63 struct device *dev;
64 enum iproc_pcie_type type;
65 const u16 *reg_offsets;
66 void __iomem *base;
67 phys_addr_t base_addr;
68 #ifdef CONFIG_ARM
69 struct pci_sys_data sysdata;
70 #endif
71 struct pci_bus *root_bus;
72 struct phy *phy;
73 int (*map_irq)(const struct pci_dev *, u8, u8);
74 bool need_ob_cfg;
75 struct iproc_pcie_ob ob;
76 struct iproc_msi *msi;
77 };
78
79 int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
80 int iproc_pcie_remove(struct iproc_pcie *pcie);
81
82 #ifdef CONFIG_PCIE_IPROC_MSI
83 int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
84 void iproc_msi_exit(struct iproc_pcie *pcie);
85 #else
86 static inline int iproc_msi_init(struct iproc_pcie *pcie,
87 struct device_node *node)
88 {
89 return -ENODEV;
90 }
91 static inline void iproc_msi_exit(struct iproc_pcie *pcie)
92 {
93 }
94 #endif
95
96 #endif /* _PCIE_IPROC_H */
This page took 0.046015 seconds and 6 git commands to generate.