1 /* 2 * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 #ifndef __PLD_USB_H__ 19 #define __PLD_USB_H__ 20 21 #include "pld_common.h" 22 23 #ifdef HIF_USB 24 int pld_usb_register_driver(void); 25 void pld_usb_unregister_driver(void); 26 int pld_usb_get_ce_id(int irq); 27 int pld_usb_wlan_enable(struct device *dev, struct pld_wlan_enable_cfg *config, 28 enum pld_driver_mode mode, const char *host_version); 29 int pld_usb_is_fw_down(struct device *dev); 30 /** 31 * pld_usb_athdiag_read() - Read data from WLAN FW through USB interface 32 * @dev: pointer of device 33 * @offset: address offset 34 * @memtype: memory type 35 * @datalen: data length 36 * @output: pointer of output buffer 37 * 38 * Return: 0 for success 39 * Non zero failure code for errors 40 */ 41 int pld_usb_athdiag_read(struct device *dev, uint32_t offset, 42 uint32_t memtype, uint32_t datalen, 43 uint8_t *output); 44 /** 45 * pld_usb_athdiag_write() - Write data to WLAN FW through USB interface 46 * @dev: pointer of device 47 * @offset: address offset 48 * @memtype: memory type 49 * @datalen: data length 50 * @output: pointer of input buffer 51 * 52 * Return: 0 for success 53 * Non zero failure code for errors 54 */ 55 int pld_usb_athdiag_write(struct device *dev, uint32_t offset, 56 uint32_t memtype, uint32_t datalen, 57 uint8_t *input); 58 59 #else 60 static inline int pld_usb_register_driver(void) 61 { 62 return 0; 63 } 64 65 static inline void pld_usb_unregister_driver(void) 66 {} 67 68 static inline int pld_usb_wlan_enable(struct device *dev, 69 struct pld_wlan_enable_cfg *config, 70 enum pld_driver_mode mode, 71 const char *host_version) 72 { 73 return 0; 74 } 75 76 static inline int pld_usb_is_fw_down(struct device *dev) 77 { 78 return 0; 79 } 80 81 static inline int pld_usb_athdiag_read(struct device *dev, uint32_t offset, 82 uint32_t memtype, uint32_t datalen, 83 uint8_t *output) 84 { 85 return 0; 86 } 87 88 static inline int pld_usb_athdiag_write(struct device *dev, uint32_t offset, 89 uint32_t memtype, uint32_t datalen, 90 uint8_t *input) 91 { 92 return 0; 93 } 94 #endif 95 96 static inline int 97 pld_usb_get_fw_files_for_target(struct pld_fw_files *pfw_files, 98 u32 target_type, u32 target_version) 99 { 100 pld_get_default_fw_files(pfw_files); 101 return 0; 102 } 103 104 #endif /*__PLD_USB_H__*/ 105