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 outbound mapping
19 * @set_oarr_size: indicates the OARR size bit needs to be set
20 * @axi_offset: offset from the AXI address to the internal address used by
21 * the iProc PCIe core
22 * @window_size: outbound window size
23 */
24struct iproc_pcie_ob {
25	bool set_oarr_size;
26	resource_size_t axi_offset;
27	resource_size_t window_size;
28};
29
30/**
31 * iProc PCIe device
32 * @dev: pointer to device data structure
33 * @base: PCIe host controller I/O register base
34 * @sysdata: Per PCI controller data (ARM-specific)
35 * @root_bus: pointer to root bus
36 * @phy: optional PHY device that controls the Serdes
37 * @irqs: interrupt IDs
38 * @map_irq: function callback to map interrupts
39 * @need_ob_cfg: indidates SW needs to configure the outbound mapping window
40 * @ob: outbound mapping parameters
41 */
42struct iproc_pcie {
43	struct device *dev;
44	void __iomem *base;
45#ifdef CONFIG_ARM
46	struct pci_sys_data sysdata;
47#endif
48	struct pci_bus *root_bus;
49	struct phy *phy;
50	int (*map_irq)(const struct pci_dev *, u8, u8);
51	bool need_ob_cfg;
52	struct iproc_pcie_ob ob;
53};
54
55int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
56int iproc_pcie_remove(struct iproc_pcie *pcie);
57
58#endif /* _PCIE_IPROC_H */
59