linux/drivers/pci/host/pcie-iproc.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Copyright (C) 2014-2015 Broadcom Corporation
   4 */
   5
   6#ifndef _PCIE_IPROC_H
   7#define _PCIE_IPROC_H
   8
   9/**
  10 * iProc PCIe interface type
  11 *
  12 * PAXB is the wrapper used in root complex that can be connected to an
  13 * external endpoint device.
  14 *
  15 * PAXC is the wrapper used in root complex dedicated for internal emulated
  16 * endpoint devices.
  17 */
  18enum iproc_pcie_type {
  19        IPROC_PCIE_PAXB_BCMA = 0,
  20        IPROC_PCIE_PAXB,
  21        IPROC_PCIE_PAXB_V2,
  22        IPROC_PCIE_PAXC,
  23        IPROC_PCIE_PAXC_V2,
  24};
  25
  26/**
  27 * iProc PCIe outbound mapping
  28 * @axi_offset: offset from the AXI address to the internal address used by
  29 * the iProc PCIe core
  30 * @nr_windows: total number of supported outbound mapping windows
  31 */
  32struct iproc_pcie_ob {
  33        resource_size_t axi_offset;
  34        unsigned int nr_windows;
  35};
  36
  37/**
  38 * iProc PCIe inbound mapping
  39 * @nr_regions: total number of supported inbound mapping regions
  40 */
  41struct iproc_pcie_ib {
  42        unsigned int nr_regions;
  43};
  44
  45struct iproc_pcie_ob_map;
  46struct iproc_pcie_ib_map;
  47struct iproc_msi;
  48
  49/**
  50 * iProc PCIe device
  51 *
  52 * @dev: pointer to device data structure
  53 * @type: iProc PCIe interface type
  54 * @reg_offsets: register offsets
  55 * @base: PCIe host controller I/O register base
  56 * @base_addr: PCIe host controller register base physical address
  57 * @sysdata: Per PCI controller data (ARM-specific)
  58 * @root_bus: pointer to root bus
  59 * @phy: optional PHY device that controls the Serdes
  60 * @map_irq: function callback to map interrupts
  61 * @ep_is_internal: indicates an internal emulated endpoint device is connected
  62 * @has_apb_err_disable: indicates the controller can be configured to prevent
  63 * unsupported request from being forwarded as an APB bus error
  64 *
  65 * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
  66 * @ob: outbound mapping related parameters
  67 * @ob_map: outbound mapping related parameters specific to the controller
  68 *
  69 * @need_ib_cfg: indicates SW needs to configure the inbound mapping window
  70 * @ib: inbound mapping related parameters
  71 * @ib_map: outbound mapping region related parameters
  72 *
  73 * @need_msi_steer: indicates additional configuration of the iProc PCIe
  74 * controller is required to steer MSI writes to external interrupt controller
  75 * @msi: MSI data
  76 */
  77struct iproc_pcie {
  78        struct device *dev;
  79        enum iproc_pcie_type type;
  80        u16 *reg_offsets;
  81        void __iomem *base;
  82        phys_addr_t base_addr;
  83#ifdef CONFIG_ARM
  84        struct pci_sys_data sysdata;
  85#endif
  86        struct resource mem;
  87        struct pci_bus *root_bus;
  88        struct phy *phy;
  89        int (*map_irq)(const struct pci_dev *, u8, u8);
  90        bool ep_is_internal;
  91        bool has_apb_err_disable;
  92
  93        bool need_ob_cfg;
  94        struct iproc_pcie_ob ob;
  95        const struct iproc_pcie_ob_map *ob_map;
  96
  97        bool need_ib_cfg;
  98        struct iproc_pcie_ib ib;
  99        const struct iproc_pcie_ib_map *ib_map;
 100
 101        bool need_msi_steer;
 102        struct iproc_msi *msi;
 103};
 104
 105int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
 106int iproc_pcie_remove(struct iproc_pcie *pcie);
 107int iproc_pcie_shutdown(struct iproc_pcie *pcie);
 108
 109#ifdef CONFIG_PCIE_IPROC_MSI
 110int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
 111void iproc_msi_exit(struct iproc_pcie *pcie);
 112#else
 113static inline int iproc_msi_init(struct iproc_pcie *pcie,
 114                                 struct device_node *node)
 115{
 116        return -ENODEV;
 117}
 118static inline void iproc_msi_exit(struct iproc_pcie *pcie)
 119{
 120}
 121#endif
 122
 123#endif /* _PCIE_IPROC_H */
 124