1 /*******************************************************************************
3 Intel SmartPHY DSL PCIe Endpoint/ACA Linux driver
4 Copyright(c) 2016 Intel Corporation.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
22 *******************************************************************************/
27 #include <net/dc_ep.h>
31 #define DC_EP_MAX_NUM (DC_EP_MAX_PEER + 1)
32 #define DC_EP_BAR_NUM 0
34 /* Maximum 8, if PCIe switch attached, 4 is used. 8 is also default one */
35 #ifdef CONFIG_VRX518_PCIE_SWITCH_BONDING
36 #define DC_PCIE_SWITCH_ATTACH 1
38 #define DC_PCIE_SWITCH_ATTACH 0
39 #endif /* CONFIG_VRX518_PCIE_SWITCH_BONDING */
41 #define DC_EP_DEFAULT_MSI_VECTOR 4
43 #define DC_EP_MAX_REFCNT DC_EP_INT_MAX
45 #define MS(_v, _f) (((_v) & (_f)) >> _f##_S)
46 #define SM(_v, _f) (((_v) << _f##_S) & (_f))
54 /* Structure used to extract attached EP detailed information for
55 * PPE/DSL_MEI driver/Bonding
60 u32 ep_idx
; /*!< EP logical index, the first found one will be 0
61 regardless of RC physical index
63 u32 irq_base
; /*!< The first MSI interrupt number */
64 u32 irq_num
; /*!< How many MSI interrupt supported */
65 enum dc_ep_msi_mode msi_mode
;
66 u8 __iomem
*mem
; /*!< The EP inbound memory base address
67 derived from BAR0, SoC virtual address
68 for PPE/DSL_MEI driver
70 u32 phymem
; /*!< The EP inbound memory base address
71 derived from BAR0, physical address for
74 size_t memsize
; /*!< The EP inbound memory window size */
75 u32 peer_num
; /*!< Bonding peer number available */
76 /*!< The bonding peer EP inbound memory base address derived from
77 * its BAR0, SoC virtual address for PPE/DSL_MEI driver
80 u8 __iomem
*peer_mem
[DC_EP_MAX_PEER
];
82 /*!< The bonding peer EP inbound memory base address derived from
83 * its BAR0, physical address for PPE FW
85 u32 peer_phymem
[DC_EP_MAX_PEER
];
87 /*!< The bonding peer inbound memory window size */
88 size_t peer_memsize
[DC_EP_MAX_PEER
];
89 atomic_t refcnt
; /*!< The EP mapping driver referenced times
92 u16 device_id
; /* Potential usage for different EP */
100 struct dc_ep_priv pcie_ep
[DC_EP_MAX_NUM
];
103 static inline struct dc_aca
*to_aca(struct dc_ep_priv
*priv
)
108 void dc_aca_shutdown(struct dc_ep_priv
*priv
);
109 void dc_aca_info_init(struct dc_ep_priv
*priv
);
110 int dc_aca_start(struct dc_ep_priv
*priv
, u32 func
, int start
);
111 int dc_aca_stop(struct dc_ep_priv
*priv
, u32
*func
, int reset
);
112 int dc_aca_init(struct dc_ep_priv
*priv
, struct aca_param
*aca
,
113 struct aca_modem_param
*mdm
);
114 void dc_aca_event_addr_get(struct dc_ep_priv
*priv
,
115 struct aca_event_reg_addr
*regs
);
116 void dc_aca_txin_sub_ack(struct dc_ep_priv
*priv
, u32 val
);
117 u32
aca_umt_msg_addr(struct dc_ep_priv
*priv
, u32 endian
, u32 type
);
118 u32
dc_aca_txin_hd_cnt(struct dc_ep_priv
*priv
);
119 void dc_aca_free_fw_file(struct dc_ep_priv
*priv
);
121 /* Card specific private data structure */
122 struct pcie_ep_adapter
{
123 struct platform_device
*mei_dev
; /* the mei driver */