]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/pci/host/pcie-iproc.h
Merge remote-tracking branches 'asoc/topic/adsp', 'asoc/topic/ak4613', 'asoc/topic...
[mirror_ubuntu-bionic-kernel.git] / drivers / pci / host / pcie-iproc.h
CommitLineData
1fb37a81
RJ
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
943ebae7
RJ
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 */
26enum iproc_pcie_type {
404349c5
RJ
27 IPROC_PCIE_PAXB_BCMA = 0,
28 IPROC_PCIE_PAXB,
c7c44527 29 IPROC_PCIE_PAXB_V2,
943ebae7 30 IPROC_PCIE_PAXC,
787b3c4f 31 IPROC_PCIE_PAXC_V2,
943ebae7
RJ
32};
33
e99a187b
RJ
34/**
35 * iProc PCIe outbound mapping
e99a187b
RJ
36 * @axi_offset: offset from the AXI address to the internal address used by
37 * the iProc PCIe core
4213e15c 38 * @nr_windows: total number of supported outbound mapping windows
e99a187b
RJ
39 */
40struct iproc_pcie_ob {
e99a187b 41 resource_size_t axi_offset;
4213e15c 42 unsigned int nr_windows;
e99a187b
RJ
43};
44
dd9d4e74
RJ
45/**
46 * iProc PCIe inbound mapping
47 * @nr_regions: total number of supported inbound mapping regions
48 */
49struct iproc_pcie_ib {
50 unsigned int nr_regions;
51};
52
4213e15c 53struct iproc_pcie_ob_map;
dd9d4e74 54struct iproc_pcie_ib_map;
3bc2b234
RJ
55struct iproc_msi;
56
1fb37a81
RJ
57/**
58 * iProc PCIe device
943ebae7 59 *
1fb37a81 60 * @dev: pointer to device data structure
943ebae7
RJ
61 * @type: iProc PCIe interface type
62 * @reg_offsets: register offsets
1fb37a81 63 * @base: PCIe host controller I/O register base
3bc2b234 64 * @base_addr: PCIe host controller register base physical address
8d9bfe37 65 * @sysdata: Per PCI controller data (ARM-specific)
1fb37a81
RJ
66 * @root_bus: pointer to root bus
67 * @phy: optional PHY device that controls the Serdes
5d92f41c 68 * @map_irq: function callback to map interrupts
06324ede 69 * @ep_is_internal: indicates an internal emulated endpoint device is connected
538928fd
RJ
70 * @has_apb_err_disable: indicates the controller can be configured to prevent
71 * unsupported request from being forwarded as an APB bus error
4213e15c 72 *
3bc2b234 73 * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
4213e15c
RJ
74 * @ob: outbound mapping related parameters
75 * @ob_map: outbound mapping related parameters specific to the controller
76 *
dd9d4e74
RJ
77 * @ib: inbound mapping related parameters
78 * @ib_map: outbound mapping region related parameters
79 *
787b3c4f
RJ
80 * @need_msi_steer: indicates additional configuration of the iProc PCIe
81 * controller is required to steer MSI writes to external interrupt controller
3bc2b234 82 * @msi: MSI data
1fb37a81
RJ
83 */
84struct iproc_pcie {
85 struct device *dev;
943ebae7 86 enum iproc_pcie_type type;
06324ede 87 u16 *reg_offsets;
1fb37a81 88 void __iomem *base;
3bc2b234 89 phys_addr_t base_addr;
8d9bfe37 90#ifdef CONFIG_ARM
1fb37a81 91 struct pci_sys_data sysdata;
8d9bfe37 92#endif
6e347b5e 93 struct resource mem;
1fb37a81
RJ
94 struct pci_bus *root_bus;
95 struct phy *phy;
c1e02cea 96 int (*map_irq)(const struct pci_dev *, u8, u8);
06324ede 97 bool ep_is_internal;
538928fd 98 bool has_apb_err_disable;
4213e15c 99
e99a187b
RJ
100 bool need_ob_cfg;
101 struct iproc_pcie_ob ob;
4213e15c
RJ
102 const struct iproc_pcie_ob_map *ob_map;
103
dd9d4e74
RJ
104 struct iproc_pcie_ib ib;
105 const struct iproc_pcie_ib_map *ib_map;
106
787b3c4f 107 bool need_msi_steer;
3bc2b234 108 struct iproc_msi *msi;
1fb37a81
RJ
109};
110
18c4342a 111int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
1fb37a81
RJ
112int iproc_pcie_remove(struct iproc_pcie *pcie);
113
3bc2b234
RJ
114#ifdef CONFIG_PCIE_IPROC_MSI
115int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
116void iproc_msi_exit(struct iproc_pcie *pcie);
117#else
118static inline int iproc_msi_init(struct iproc_pcie *pcie,
119 struct device_node *node)
120{
121 return -ENODEV;
122}
123static inline void iproc_msi_exit(struct iproc_pcie *pcie)
124{
125}
126#endif
127
1fb37a81 128#endif /* _PCIE_IPROC_H */