Mayank Rana | c295e34 | 2017-02-14 17:13:44 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _USB_BAM_H_ |
| 14 | #define _USB_BAM_H_ |
| 15 | #include <linux/msm-sps.h> |
| 16 | #include <linux/ipa.h> |
Mayank Rana | f2d0f82 | 2017-02-22 16:32:08 -0800 | [diff] [blame] | 17 | #include <linux/usb/ch9.h> |
Mayank Rana | c295e34 | 2017-02-14 17:13:44 -0800 | [diff] [blame] | 18 | |
| 19 | #define MAX_BAMS NUM_CTRL /* Bam per USB controllers */ |
| 20 | |
Mayank Rana | f2d0f82 | 2017-02-22 16:32:08 -0800 | [diff] [blame] | 21 | /* Supported USB controllers*/ |
| 22 | enum usb_ctrl { |
| 23 | DWC3_CTRL = 0, /* DWC3 controller */ |
| 24 | CI_CTRL, /* ChipIdea controller */ |
| 25 | HSIC_CTRL, /* HSIC controller */ |
| 26 | NUM_CTRL, |
| 27 | }; |
Mayank Rana | c295e34 | 2017-02-14 17:13:44 -0800 | [diff] [blame] | 28 | |
| 29 | enum usb_bam_mode { |
| 30 | USB_BAM_DEVICE = 0, |
| 31 | USB_BAM_HOST, |
| 32 | }; |
| 33 | |
| 34 | enum peer_bam { |
| 35 | QDSS_P_BAM = 0, |
| 36 | IPA_P_BAM, |
| 37 | MAX_PEER_BAMS, |
| 38 | }; |
| 39 | |
| 40 | enum usb_bam_pipe_dir { |
| 41 | USB_TO_PEER_PERIPHERAL, |
| 42 | PEER_PERIPHERAL_TO_USB, |
| 43 | }; |
| 44 | |
| 45 | enum usb_pipe_mem_type { |
| 46 | SPS_PIPE_MEM = 0, /* Default, SPS dedicated pipe memory */ |
| 47 | SYSTEM_MEM, /* System RAM, requires allocation */ |
| 48 | OCI_MEM, /* Shared memory among peripherals */ |
| 49 | }; |
| 50 | |
| 51 | enum usb_bam_event_type { |
| 52 | USB_BAM_EVENT_WAKEUP_PIPE = 0, /* Wake a pipe */ |
| 53 | USB_BAM_EVENT_WAKEUP, /* Wake a bam (first pipe waked) */ |
| 54 | USB_BAM_EVENT_INACTIVITY, /* Inactivity on all pipes */ |
| 55 | }; |
| 56 | |
| 57 | enum usb_bam_pipe_type { |
| 58 | USB_BAM_PIPE_BAM2BAM = 0, /* Connection is BAM2BAM (default) */ |
| 59 | USB_BAM_PIPE_SYS2BAM, /* Connection is SYS2BAM or BAM2SYS |
| 60 | * depending on usb_bam_pipe_dir |
| 61 | */ |
| 62 | USB_BAM_MAX_PIPE_TYPES, |
| 63 | }; |
| 64 | |
| 65 | /* |
| 66 | * struct usb_bam_connect_ipa_params: Connect Bam pipe to IPA peer information. |
| 67 | * @ src_idx: Source pipe index in usb bam pipes lists. |
| 68 | * @ dst_idx: Destination pipe index in usb bam pipes lists. |
| 69 | * @ src_pipe: The source pipe index in the sps level. |
| 70 | * @ dst_pipe: The destination pipe index in the sps level. |
| 71 | * @ keep_ipa_awake: When true, IPA will not be clock gated. |
| 72 | * @ ipa_cons_ep_idx: The pipe index on the IPA peer bam side, consumer. |
| 73 | * @ ipa_prod_ep_idx: The pipe index on the IPA peer bam side, producer. |
| 74 | * @ prod_clnt_hdl: Producer client handle returned by IPA driver |
| 75 | * @ cons_clnt_hdl: Consumer client handle returned by IPA driver |
| 76 | * @ src_client: Source IPA client type. |
| 77 | * @ dst_client: Destination IPA client type. |
| 78 | * @ ipa_ep_cfg: Configuration of IPA end-point (see struct ipa_ep_cfg) |
| 79 | * @priv: Callback cookie to the notify event. |
| 80 | * @notify: Callback on data path event by IPA (see enum ipa_dp_evt_type) |
| 81 | * This call back gets back the priv cookie. |
| 82 | * for Bam2Bam mode, this callback is in the tethering bridge. |
| 83 | * @ activity_notify: Callback to be notified on and data being pushed into the |
| 84 | * USB consumer pipe. |
| 85 | * @ inactivity_notify: Callback to be notified on inactivity of all the current |
| 86 | * open pipes between the USB bam and its peer. |
| 87 | * @ skip_ep_cfg: boolean field that determines if Apps-processor |
| 88 | * should or should not confiugre this end-point. |
| 89 | * (Please see struct teth_bridge_init_params) |
| 90 | * @ reset_pipe_after_lpm: bool to indicate if IPA should reset pipe after LPM. |
| 91 | * @ usb_connection_speed: The actual speed the USB core currently works at. |
| 92 | */ |
| 93 | struct usb_bam_connect_ipa_params { |
| 94 | u8 src_idx; |
| 95 | u8 dst_idx; |
| 96 | u32 *src_pipe; |
| 97 | u32 *dst_pipe; |
| 98 | bool keep_ipa_awake; |
| 99 | enum usb_bam_pipe_dir dir; |
| 100 | /* Parameters for Port Mapper */ |
| 101 | u32 ipa_cons_ep_idx; |
| 102 | u32 ipa_prod_ep_idx; |
| 103 | /* client handle assigned by IPA to client */ |
| 104 | u32 prod_clnt_hdl; |
| 105 | u32 cons_clnt_hdl; |
| 106 | /* params assigned by the CD */ |
| 107 | enum ipa_client_type src_client; |
| 108 | enum ipa_client_type dst_client; |
| 109 | struct ipa_ep_cfg ipa_ep_cfg; |
| 110 | void *priv; |
| 111 | void (*notify)(void *priv, enum ipa_dp_evt_type evt, |
| 112 | unsigned long data); |
| 113 | int (*activity_notify)(void *priv); |
| 114 | int (*inactivity_notify)(void *priv); |
| 115 | bool skip_ep_cfg; |
| 116 | bool reset_pipe_after_lpm; |
| 117 | enum usb_device_speed usb_connection_speed; |
| 118 | }; |
| 119 | |
| 120 | /* |
| 121 | * struct usb_bam_event_info: suspend/resume event information. |
| 122 | * @type: usb bam event type. |
| 123 | * @event: holds event data. |
| 124 | * @callback: suspend/resume callback. |
| 125 | * @param: port num (for suspend) or NULL (for resume). |
| 126 | * @event_w: holds work queue parameters. |
| 127 | */ |
| 128 | struct usb_bam_event_info { |
| 129 | enum usb_bam_event_type type; |
| 130 | struct sps_register_event event; |
| 131 | int (*callback)(void *); |
| 132 | void *param; |
| 133 | struct work_struct event_w; |
| 134 | }; |
| 135 | |
| 136 | /* |
| 137 | * struct usb_bam_pipe_connect: pipe connection information |
| 138 | * between USB/HSIC BAM and another BAM. USB/HSIC BAM can be |
| 139 | * either src BAM or dst BAM |
| 140 | * @name: pipe description. |
| 141 | * @mem_type: type of memory used for BAM FIFOs |
| 142 | * @src_phy_addr: src bam physical address. |
| 143 | * @src_pipe_index: src bam pipe index. |
| 144 | * @dst_phy_addr: dst bam physical address. |
| 145 | * @dst_pipe_index: dst bam pipe index. |
| 146 | * @data_fifo_base_offset: data fifo offset. |
| 147 | * @data_fifo_size: data fifo size. |
| 148 | * @desc_fifo_base_offset: descriptor fifo offset. |
| 149 | * @desc_fifo_size: descriptor fifo size. |
| 150 | * @data_mem_buf: data fifo buffer. |
| 151 | * @desc_mem_buf: descriptor fifo buffer. |
| 152 | * @event: event for wakeup. |
| 153 | * @enabled: true if pipe is enabled. |
| 154 | * @suspended: true if pipe is suspended. |
| 155 | * @cons_stopped: true is pipe has consumer requests stopped. |
| 156 | * @prod_stopped: true if pipe has producer requests stopped. |
| 157 | * @ipa_clnt_hdl : pipe handle to ipa api. |
| 158 | * @priv: private data to return upon activity_notify |
| 159 | * or inactivity_notify callbacks. |
| 160 | * @activity_notify: callback to invoke on activity on one of the in pipes. |
| 161 | * @inactivity_notify: callback to invoke on inactivity on all pipes. |
| 162 | * @start: callback to invoke to enqueue transfers on a pipe. |
| 163 | * @stop: callback to invoke on dequeue transfers on a pipe. |
| 164 | * @start_stop_param: param for the start/stop callbacks. |
| 165 | */ |
| 166 | struct usb_bam_pipe_connect { |
| 167 | const char *name; |
| 168 | u32 pipe_num; |
| 169 | enum usb_pipe_mem_type mem_type; |
| 170 | enum usb_bam_pipe_dir dir; |
| 171 | enum usb_ctrl bam_type; |
| 172 | enum usb_bam_mode bam_mode; |
| 173 | enum peer_bam peer_bam; |
| 174 | enum usb_bam_pipe_type pipe_type; |
| 175 | u32 src_phy_addr; |
| 176 | u32 src_pipe_index; |
| 177 | u32 dst_phy_addr; |
| 178 | u32 dst_pipe_index; |
| 179 | u32 data_fifo_base_offset; |
| 180 | u32 data_fifo_size; |
| 181 | u32 desc_fifo_base_offset; |
| 182 | u32 desc_fifo_size; |
| 183 | struct sps_mem_buffer data_mem_buf; |
| 184 | struct sps_mem_buffer desc_mem_buf; |
| 185 | struct usb_bam_event_info event; |
| 186 | bool enabled; |
| 187 | bool suspended; |
| 188 | bool cons_stopped; |
| 189 | bool prod_stopped; |
| 190 | int ipa_clnt_hdl; |
| 191 | void *priv; |
| 192 | int (*activity_notify)(void *priv); |
| 193 | int (*inactivity_notify)(void *priv); |
| 194 | void (*start)(void *, enum usb_bam_pipe_dir); |
| 195 | void (*stop)(void *, enum usb_bam_pipe_dir); |
| 196 | void *start_stop_param; |
| 197 | bool reset_pipe_after_lpm; |
| 198 | }; |
| 199 | |
| 200 | /** |
| 201 | * struct msm_usb_bam_platform_data: pipe connection information |
| 202 | * between USB/HSIC BAM and another BAM. USB/HSIC BAM can be |
| 203 | * either src BAM or dst BAM |
| 204 | * @usb_bam_num_pipes: max number of pipes to use. |
| 205 | * @active_conn_num: number of active pipe connections. |
| 206 | * @usb_bam_fifo_baseaddr: base address for bam pipe's data and descriptor |
| 207 | * fifos. This can be on chip memory (ocimem) or usb |
| 208 | * private memory. |
| 209 | * @ignore_core_reset_ack: BAM can ignore ACK from USB core during PIPE RESET |
| 210 | * @reset_on_connect: BAM must be reset before its first pipe connect |
| 211 | * @reset_on_disconnect: BAM must be reset after its last pipe disconnect |
| 212 | * @disable_clk_gating: Disable clock gating |
| 213 | * @override_threshold: Override the default threshold value for Read/Write |
| 214 | * event generation by the BAM towards another BAM. |
| 215 | * @max_mbps_highspeed: Maximum Mbits per seconds that the USB core |
| 216 | * can work at in bam2bam mode when connected to HS host. |
| 217 | * @max_mbps_superspeed: Maximum Mbits per seconds that the USB core |
| 218 | * can work at in bam2bam mode when connected to SS host. |
| 219 | * @enable_hsusb_bam_on_boot: Enable HSUSB BAM (non-NDP) on bootup itself |
| 220 | */ |
| 221 | struct msm_usb_bam_platform_data { |
| 222 | u8 max_connections; |
| 223 | int usb_bam_num_pipes; |
| 224 | phys_addr_t usb_bam_fifo_baseaddr; |
| 225 | bool ignore_core_reset_ack; |
| 226 | bool reset_on_connect; |
| 227 | bool reset_on_disconnect; |
| 228 | bool disable_clk_gating; |
| 229 | u32 override_threshold; |
| 230 | u32 max_mbps_highspeed; |
| 231 | u32 max_mbps_superspeed; |
| 232 | bool enable_hsusb_bam_on_boot; |
| 233 | enum usb_ctrl bam_type; |
| 234 | }; |
| 235 | |
| 236 | #if IS_ENABLED(CONFIG_USB_BAM) |
| 237 | /** |
| 238 | * Connect USB-to-Peripheral SPS connection. |
| 239 | * |
| 240 | * This function returns the allocated pipe number. |
| 241 | * |
| 242 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 243 | * |
| 244 | * @idx - Connection index. |
| 245 | * |
| 246 | * @bam_pipe_idx - allocated pipe index. |
| 247 | * |
| 248 | * @return 0 on success, negative value on error |
| 249 | * |
| 250 | */ |
| 251 | int usb_bam_connect(enum usb_ctrl bam_type, int idx, u32 *bam_pipe_idx); |
| 252 | |
| 253 | /** |
| 254 | * Connect USB-to-IPA SPS connection. |
| 255 | * |
| 256 | * This function returns the allocated pipes number and clnt |
| 257 | * handles. Assumes that the user first connects producer pipes |
| 258 | * and only after that consumer pipes, since that's the correct |
| 259 | * sequence for the handshake with the IPA. |
| 260 | * |
| 261 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 262 | * |
| 263 | * @ipa_params - in/out parameters |
| 264 | * |
| 265 | * @return 0 on success, negative value on error |
| 266 | */ |
| 267 | int usb_bam_connect_ipa(enum usb_ctrl bam_type, |
| 268 | struct usb_bam_connect_ipa_params *ipa_params); |
| 269 | |
| 270 | /** |
| 271 | * Disconnect USB-to-IPA SPS connection. |
| 272 | * |
| 273 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 274 | * |
| 275 | * @ipa_params - in/out parameters |
| 276 | * |
| 277 | * @return 0 on success, negative value on error |
| 278 | */ |
| 279 | int usb_bam_disconnect_ipa(enum usb_ctrl bam_type, |
| 280 | struct usb_bam_connect_ipa_params *ipa_params); |
| 281 | |
| 282 | /** |
| 283 | * Register a wakeup callback from peer BAM. |
| 284 | * |
| 285 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 286 | * |
| 287 | * @idx - Connection index. |
| 288 | * |
| 289 | * @callback - the callback function |
| 290 | * |
| 291 | * @return 0 on success, negative value on error |
| 292 | */ |
| 293 | int usb_bam_register_wake_cb(enum usb_ctrl bam_type, u8 idx, |
| 294 | int (*callback)(void *), void *param); |
| 295 | |
| 296 | /** |
| 297 | * Register callbacks for start/stop of transfers. |
| 298 | * |
| 299 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 300 | * |
| 301 | * @idx - Connection index |
| 302 | * |
| 303 | * @start - the callback function that will be called in USB |
| 304 | * driver to start transfers |
| 305 | * @stop - the callback function that will be called in USB |
| 306 | * driver to stop transfers |
| 307 | * |
| 308 | * @param - context that the caller can supply |
| 309 | * |
| 310 | * @return 0 on success, negative value on error |
| 311 | */ |
| 312 | int usb_bam_register_start_stop_cbs(enum usb_ctrl bam_type, |
| 313 | u8 idx, |
| 314 | void (*start)(void *, enum usb_bam_pipe_dir), |
| 315 | void (*stop)(void *, enum usb_bam_pipe_dir), |
| 316 | void *param); |
| 317 | |
| 318 | /** |
| 319 | * Start usb suspend sequence |
| 320 | * |
| 321 | * @ipa_params - in/out parameters |
| 322 | * |
| 323 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 324 | */ |
| 325 | void usb_bam_suspend(enum usb_ctrl bam_type, |
| 326 | struct usb_bam_connect_ipa_params *ipa_params); |
| 327 | |
| 328 | /** |
| 329 | * Start usb resume sequence |
| 330 | * |
| 331 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 332 | * |
| 333 | * @ipa_params - in/out parameters |
| 334 | */ |
| 335 | void usb_bam_resume(enum usb_ctrl bam_type, |
| 336 | struct usb_bam_connect_ipa_params *ipa_params); |
| 337 | /** |
| 338 | * Disconnect USB-to-Periperal SPS connection. |
| 339 | * |
| 340 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 341 | * |
| 342 | * @idx - Connection index. |
| 343 | * |
| 344 | * @return 0 on success, negative value on error |
| 345 | */ |
| 346 | int usb_bam_disconnect_pipe(enum usb_ctrl bam_type, u8 idx); |
| 347 | |
| 348 | /** |
| 349 | * Returns usb bam connection parameters. |
| 350 | * |
| 351 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 352 | * |
| 353 | * @idx - Connection index. |
| 354 | * |
| 355 | * @usb_bam_pipe_idx - Usb bam pipe index. |
| 356 | * |
| 357 | * @desc_fifo - Descriptor fifo parameters. |
| 358 | * |
| 359 | * @data_fifo - Data fifo parameters. |
| 360 | * |
| 361 | * @return pipe index on success, negative value on error. |
| 362 | */ |
| 363 | int get_bam2bam_connection_info(enum usb_ctrl bam_type, u8 idx, |
| 364 | u32 *usb_bam_pipe_idx, struct sps_mem_buffer *desc_fifo, |
| 365 | struct sps_mem_buffer *data_fifo, enum usb_pipe_mem_type *mem_type); |
| 366 | |
| 367 | /** |
| 368 | * Returns usb bam connection parameters for qdss pipe. |
| 369 | * @usb_bam_handle - Usb bam handle. |
| 370 | * @usb_bam_pipe_idx - Usb bam pipe index. |
| 371 | * @peer_pipe_idx - Peer pipe index. |
| 372 | * @desc_fifo - Descriptor fifo parameters. |
| 373 | * @data_fifo - Data fifo parameters. |
| 374 | * @return pipe index on success, negative value on error. |
| 375 | */ |
| 376 | int get_qdss_bam_connection_info( |
| 377 | unsigned long *usb_bam_handle, u32 *usb_bam_pipe_idx, |
| 378 | u32 *peer_pipe_idx, struct sps_mem_buffer *desc_fifo, |
| 379 | struct sps_mem_buffer *data_fifo, enum usb_pipe_mem_type *mem_type); |
| 380 | |
| 381 | /* |
| 382 | * Indicates if the client of the USB BAM is ready to start |
| 383 | * sending/receiving transfers. |
| 384 | * |
| 385 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 386 | * |
| 387 | * @client - Usb pipe peer (a2, ipa, qdss...) |
| 388 | * |
| 389 | * @dir - In (from peer to usb) or out (from usb to peer) |
| 390 | * |
| 391 | * @num - Pipe number. |
| 392 | * |
| 393 | * @return 0 on success, negative value on error |
| 394 | */ |
| 395 | int usb_bam_get_connection_idx(enum usb_ctrl bam_type, enum peer_bam client, |
| 396 | enum usb_bam_pipe_dir dir, enum usb_bam_mode bam_mode, u32 num); |
| 397 | |
| 398 | /* |
| 399 | * return the usb controller bam type used for the supplied connection index |
| 400 | * |
| 401 | * @core_name - Core name (ssusb/hsusb/hsic). |
| 402 | * |
| 403 | * @return usb control bam type |
| 404 | */ |
| 405 | int usb_bam_get_bam_type(const char *core_name); |
| 406 | |
| 407 | /* |
| 408 | * Indicates the type of connection the USB side of the connection is. |
| 409 | * |
| 410 | * @bam_type - USB BAM type - dwc3/CI/hsic |
| 411 | * |
| 412 | * @idx - Pipe number. |
| 413 | * |
| 414 | * @type - Type of connection |
| 415 | * |
| 416 | * @return 0 on success, negative value on error |
| 417 | */ |
| 418 | int usb_bam_get_pipe_type(enum usb_ctrl bam_type, |
| 419 | u8 idx, enum usb_bam_pipe_type *type); |
| 420 | |
| 421 | /* |
| 422 | * Indicates whether USB producer is granted to IPA resource manager. |
| 423 | * |
| 424 | * @return true when producer granted, false when prodcuer is released. |
| 425 | */ |
| 426 | bool usb_bam_get_prod_granted(enum usb_ctrl bam_type, u8 idx); |
| 427 | |
| 428 | /* Allocates memory for data fifo and descriptor fifos. */ |
| 429 | int usb_bam_alloc_fifos(enum usb_ctrl cur_bam, u8 idx); |
| 430 | |
| 431 | /* Frees memory for data fifo and descriptor fifos. */ |
| 432 | int usb_bam_free_fifos(enum usb_ctrl cur_bam, u8 idx); |
| 433 | |
Mayank Rana | f2d0f82 | 2017-02-22 16:32:08 -0800 | [diff] [blame] | 434 | bool msm_bam_hsic_lpm_ok(void); |
| 435 | bool msm_bam_hsic_host_pipe_empty(void); |
| 436 | bool msm_usb_bam_enable(enum usb_ctrl ctrl, bool bam_enable); |
Mayank Rana | c295e34 | 2017-02-14 17:13:44 -0800 | [diff] [blame] | 437 | #else |
| 438 | static inline int usb_bam_connect(enum usb_ctrl bam, u8 idx, u32 *bam_pipe_idx) |
| 439 | { |
| 440 | return -ENODEV; |
| 441 | } |
| 442 | |
| 443 | static inline int usb_bam_connect_ipa(enum usb_ctrl bam_type, |
| 444 | struct usb_bam_connect_ipa_params *ipa_params) |
| 445 | { |
| 446 | return -ENODEV; |
| 447 | } |
| 448 | |
| 449 | static inline int usb_bam_disconnect_ipa(enum usb_ctrl bam_type, |
| 450 | struct usb_bam_connect_ipa_params *ipa_params) |
| 451 | { |
| 452 | return -ENODEV; |
| 453 | } |
| 454 | |
| 455 | static inline void usb_bam_wait_for_cons_granted( |
| 456 | struct usb_bam_connect_ipa_params *ipa_params) |
| 457 | { } |
| 458 | |
| 459 | static inline int usb_bam_register_wake_cb(enum usb_ctrl bam_type, u8 idx, |
| 460 | int (*callback)(void *), void *param) |
| 461 | { |
| 462 | return -ENODEV; |
| 463 | } |
| 464 | |
| 465 | static inline int usb_bam_register_start_stop_cbs(enum usb_ctrl bam, u8 idx, |
| 466 | void (*start)(void *, enum usb_bam_pipe_dir), |
| 467 | void (*stop)(void *, enum usb_bam_pipe_dir), |
| 468 | void *param) |
| 469 | { |
| 470 | return -ENODEV; |
| 471 | } |
| 472 | |
| 473 | static inline void usb_bam_suspend(enum usb_ctrl bam_type, |
| 474 | struct usb_bam_connect_ipa_params *ipa_params){} |
| 475 | |
| 476 | static inline void usb_bam_resume(enum usb_ctrl bam_type, |
| 477 | struct usb_bam_connect_ipa_params *ipa_params) {} |
| 478 | |
| 479 | static inline int usb_bam_disconnect_pipe(enum usb_ctrl bam_type, u8 idx) |
| 480 | { |
| 481 | return -ENODEV; |
| 482 | } |
| 483 | |
| 484 | static inline int get_bam2bam_connection_info(enum usb_ctrl bam_type, u8 idx, |
| 485 | u32 *usb_bam_pipe_idx, struct sps_mem_buffer *desc_fifo, |
| 486 | struct sps_mem_buffer *data_fifo, enum usb_pipe_mem_type *mem_type) |
| 487 | { |
| 488 | return -ENODEV; |
| 489 | } |
| 490 | |
| 491 | static inline int get_qdss_bam_connection_info( |
| 492 | unsigned long *usb_bam_handle, u32 *usb_bam_pipe_idx, |
| 493 | u32 *peer_pipe_idx, struct sps_mem_buffer *desc_fifo, |
| 494 | struct sps_mem_buffer *data_fifo, enum usb_pipe_mem_type *mem_type) |
| 495 | { |
| 496 | return -ENODEV; |
| 497 | } |
| 498 | |
| 499 | static inline int usb_bam_get_connection_idx(enum usb_ctrl bam_type, |
| 500 | enum peer_bam client, enum usb_bam_pipe_dir dir, |
| 501 | enum usb_bam_mode bam_mode, u32 num) |
| 502 | { |
| 503 | return -ENODEV; |
| 504 | } |
| 505 | |
| 506 | static inline int usb_bam_get_bam_type(const char *core_nam) |
| 507 | { |
| 508 | return -ENODEV; |
| 509 | } |
| 510 | |
| 511 | static inline int usb_bam_get_pipe_type(enum usb_ctrl bam_type, u8 idx, |
| 512 | enum usb_bam_pipe_type *type) |
| 513 | { |
| 514 | return -ENODEV; |
| 515 | } |
| 516 | |
| 517 | static inline bool usb_bam_get_prod_granted(enum usb_ctrl bam_type, u8 idx) |
| 518 | { |
| 519 | return false; |
| 520 | } |
| 521 | |
| 522 | int usb_bam_alloc_fifos(enum usb_ctrl cur_bam, u8 idx) |
| 523 | { |
| 524 | return false; |
| 525 | } |
| 526 | |
| 527 | int usb_bam_free_fifos(enum usb_ctrl cur_bam, u8 idx) |
| 528 | { |
| 529 | return false; |
| 530 | } |
| 531 | |
Mayank Rana | f2d0f82 | 2017-02-22 16:32:08 -0800 | [diff] [blame] | 532 | static inline bool msm_bam_hsic_lpm_ok(void) { return true; } |
| 533 | static inline bool msm_bam_hsic_host_pipe_empty(void) { return true; } |
| 534 | static inline bool msm_usb_bam_enable(enum usb_ctrl ctrl, bool bam_enable) |
| 535 | { return true; } |
| 536 | |
| 537 | #endif |
| 538 | |
| 539 | #ifdef CONFIG_USB_CI13XXX_MSM |
| 540 | void msm_hw_bam_disable(bool bam_disable); |
| 541 | void msm_usb_irq_disable(bool disable); |
| 542 | #else |
| 543 | static inline void msm_hw_bam_disable(bool bam_disable) |
| 544 | { } |
| 545 | |
| 546 | static inline void msm_usb_irq_disable(bool disable) |
| 547 | { } |
| 548 | #endif |
| 549 | |
| 550 | /* CONFIG_PM */ |
| 551 | #ifdef CONFIG_PM |
| 552 | static inline int get_pm_runtime_counter(struct device *dev) |
| 553 | { |
| 554 | return atomic_read(&dev->power.usage_count); |
| 555 | } |
| 556 | #else |
| 557 | /* !CONFIG_PM */ |
| 558 | static inline int get_pm_runtime_counter(struct device *dev) |
| 559 | { return -EOPNOTSUPP; } |
Mayank Rana | c295e34 | 2017-02-14 17:13:44 -0800 | [diff] [blame] | 560 | #endif |
| 561 | #endif /* _USB_BAM_H_ */ |