![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 0003 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 0004 * Copyright (C) 2018-2020 Linaro Ltd. 0005 */ 0006 #ifndef _IPA_H_ 0007 #define _IPA_H_ 0008 0009 #include <linux/types.h> 0010 #include <linux/device.h> 0011 #include <linux/notifier.h> 0012 #include <linux/pm_wakeup.h> 0013 0014 #include "ipa_version.h" 0015 #include "gsi.h" 0016 #include "ipa_mem.h" 0017 #include "ipa_qmi.h" 0018 #include "ipa_endpoint.h" 0019 #include "ipa_interrupt.h" 0020 0021 struct clk; 0022 struct icc_path; 0023 struct net_device; 0024 struct platform_device; 0025 0026 struct ipa_power; 0027 struct ipa_smp2p; 0028 struct ipa_interrupt; 0029 0030 /** 0031 * struct ipa - IPA information 0032 * @gsi: Embedded GSI structure 0033 * @version: IPA hardware version 0034 * @pdev: Platform device 0035 * @completion: Used to signal pipeline clear transfer complete 0036 * @nb: Notifier block used for remoteproc SSR 0037 * @notifier: Remoteproc SSR notifier 0038 * @smp2p: SMP2P information 0039 * @power: IPA power information 0040 * @table_addr: DMA address of filter/route table content 0041 * @table_virt: Virtual address of filter/route table content 0042 * @interrupt: IPA Interrupt information 0043 * @uc_powered: true if power is active by proxy for microcontroller 0044 * @uc_loaded: true after microcontroller has reported it's ready 0045 * @reg_addr: DMA address used for IPA register access 0046 * @reg_virt: Virtual address used for IPA register access 0047 * @mem_addr: DMA address of IPA-local memory space 0048 * @mem_virt: Virtual address of IPA-local memory space 0049 * @mem_offset: Offset from @mem_virt used for access to IPA memory 0050 * @mem_size: Total size (bytes) of memory at @mem_virt 0051 * @mem_count: Number of entries in the mem array 0052 * @mem: Array of IPA-local memory region descriptors 0053 * @imem_iova: I/O virtual address of IPA region in IMEM 0054 * @imem_size: Size of IMEM region 0055 * @smem_iova: I/O virtual address of IPA region in SMEM 0056 * @smem_size: Size of SMEM region 0057 * @zero_addr: DMA address of preallocated zero-filled memory 0058 * @zero_virt: Virtual address of preallocated zero-filled memory 0059 * @zero_size: Size (bytes) of preallocated zero-filled memory 0060 * @available: Bit mask indicating endpoints hardware supports 0061 * @filter_map: Bit mask indicating endpoints that support filtering 0062 * @initialized: Bit mask indicating endpoints initialized 0063 * @set_up: Bit mask indicating endpoints set up 0064 * @enabled: Bit mask indicating endpoints enabled 0065 * @modem_tx_count: Number of defined modem TX endoints 0066 * @endpoint: Array of endpoint information 0067 * @channel_map: Mapping of GSI channel to IPA endpoint 0068 * @name_map: Mapping of IPA endpoint name to IPA endpoint 0069 * @setup_complete: Flag indicating whether setup stage has completed 0070 * @modem_state: State of modem (stopped, running) 0071 * @modem_netdev: Network device structure used for modem 0072 * @qmi: QMI information 0073 */ 0074 struct ipa { 0075 struct gsi gsi; 0076 enum ipa_version version; 0077 struct platform_device *pdev; 0078 struct completion completion; 0079 struct notifier_block nb; 0080 void *notifier; 0081 struct ipa_smp2p *smp2p; 0082 struct ipa_power *power; 0083 0084 dma_addr_t table_addr; 0085 __le64 *table_virt; 0086 0087 struct ipa_interrupt *interrupt; 0088 bool uc_powered; 0089 bool uc_loaded; 0090 0091 dma_addr_t reg_addr; 0092 void __iomem *reg_virt; 0093 0094 dma_addr_t mem_addr; 0095 void *mem_virt; 0096 u32 mem_offset; 0097 u32 mem_size; 0098 u32 mem_count; 0099 const struct ipa_mem *mem; 0100 0101 unsigned long imem_iova; 0102 size_t imem_size; 0103 0104 unsigned long smem_iova; 0105 size_t smem_size; 0106 0107 dma_addr_t zero_addr; 0108 void *zero_virt; 0109 size_t zero_size; 0110 0111 /* Bit masks indicating endpoint state */ 0112 u32 available; /* supported by hardware */ 0113 u32 filter_map; 0114 u32 initialized; 0115 u32 set_up; 0116 u32 enabled; 0117 0118 u32 modem_tx_count; 0119 struct ipa_endpoint endpoint[IPA_ENDPOINT_MAX]; 0120 struct ipa_endpoint *channel_map[GSI_CHANNEL_COUNT_MAX]; 0121 struct ipa_endpoint *name_map[IPA_ENDPOINT_COUNT]; 0122 0123 bool setup_complete; 0124 0125 atomic_t modem_state; /* enum ipa_modem_state */ 0126 struct net_device *modem_netdev; 0127 struct ipa_qmi qmi; 0128 }; 0129 0130 /** 0131 * ipa_setup() - Perform IPA setup 0132 * @ipa: IPA pointer 0133 * 0134 * IPA initialization is broken into stages: init; config; and setup. 0135 * (These have inverses exit, deconfig, and teardown.) 0136 * 0137 * Activities performed at the init stage can be done without requiring 0138 * any access to IPA hardware. Activities performed at the config stage 0139 * require IPA power, because they involve access to IPA registers. 0140 * The setup stage is performed only after the GSI hardware is ready 0141 * (more on this below). The setup stage allows the AP to perform 0142 * more complex initialization by issuing "immediate commands" using 0143 * a special interface to the IPA. 0144 * 0145 * This function, @ipa_setup(), starts the setup stage. 0146 * 0147 * In order for the GSI hardware to be functional it needs firmware to be 0148 * loaded (in addition to some other low-level initialization). This early 0149 * GSI initialization can be done either by Trust Zone on the AP or by the 0150 * modem. 0151 * 0152 * If it's done by Trust Zone, the AP loads the GSI firmware and supplies 0153 * it to Trust Zone to verify and install. When this completes, if 0154 * verification was successful, the GSI layer is ready and ipa_setup() 0155 * implements the setup phase of initialization. 0156 * 0157 * If the modem performs early GSI initialization, the AP needs to know 0158 * when this has occurred. An SMP2P interrupt is used for this purpose, 0159 * and receipt of that interrupt triggers the call to ipa_setup(). 0160 */ 0161 int ipa_setup(struct ipa *ipa); 0162 0163 #endif /* _IPA_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |