diff options
| author | Yuanyuan Liu <yuanliu@codeaurora.org> | 2016-06-16 14:13:07 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-09-21 17:07:57 -0700 |
| commit | 5ef6bfef5b766275b109b200721987fd8de18b0a (patch) | |
| tree | e1c6859b1406fc9a58f84d49af60a0961459144b | |
| parent | 0c21495a3f34e40ddc802cd8f6f843f41d6ae0b3 (diff) | |
qcacld-3.0: Add PLD ATHDIAG read/write support
Add PLD wrapper for platform athdiag read/write.
HIF will call these two functions when a athdiag read/write
triggered from user space.
CRs-Fixed: 1061837
Change-Id: Ie34c634beaf1cd91e24eca1b7ce5b6444a60393e
| -rw-r--r-- | core/pld/inc/pld_common.h | 5 | ||||
| -rw-r--r-- | core/pld/src/pld_common.c | 68 | ||||
| -rw-r--r-- | core/pld/src/pld_snoc.h | 27 |
3 files changed, 100 insertions, 0 deletions
diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index d3bf8d6c3fdb..d2cfdd7ebb72 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -390,4 +390,9 @@ void pld_lock_pm_sem(struct device *dev); void pld_release_pm_sem(struct device *dev); int pld_power_on(struct device *dev); int pld_power_off(struct device *dev); +int pld_athdiag_read(struct device *dev, uint32_t offset, uint32_t memtype, + uint32_t datalen, uint8_t *output); +int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype, + uint32_t datalen, uint8_t *input); + #endif diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index d4404481bdb0..60ea7cecf88b 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1422,3 +1422,71 @@ int pld_power_off(struct device *dev) return ret; } + +/** + * pld_athdiag_read() - Read data from WLAN FW + * @dev: device + * @offset: address offset + * @memtype: memory type + * @datalen: data length + * @output: output buffer + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_athdiag_read(struct device *dev, uint32_t offset, + uint32_t memtype, uint32_t datalen, + uint8_t *output) +{ + int ret = 0; + + switch (pld_get_bus_type(dev)) { + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_athdiag_read(dev, offset, memtype, + datalen, output); + break; + case PLD_BUS_TYPE_PCIE: + case PLD_BUS_TYPE_SDIO: + case PLD_BUS_TYPE_USB: + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +/** + * pld_athdiag_write() - Write data to WLAN FW + * @dev: device + * @offset: address offset + * @memtype: memory type + * @datalen: data length + * @input: input buffer + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_athdiag_write(struct device *dev, uint32_t offset, + uint32_t memtype, uint32_t datalen, + uint8_t *input) +{ + int ret = 0; + + switch (pld_get_bus_type(dev)) { + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_athdiag_write(dev, offset, memtype, + datalen, input); + break; + case PLD_BUS_TYPE_PCIE: + case PLD_BUS_TYPE_SDIO: + case PLD_BUS_TYPE_USB: + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} diff --git a/core/pld/src/pld_snoc.h b/core/pld/src/pld_snoc.h index e047ae2c35af..b97d632b4461 100644 --- a/core/pld/src/pld_snoc.h +++ b/core/pld/src/pld_snoc.h @@ -28,6 +28,9 @@ #ifndef __PLD_SNOC_H__ #define __PLD_SNOC_H__ +#ifdef CONFIG_PLD_SNOC_ICNSS +#include <soc/qcom/icnss.h> +#endif #include "pld_internal.h" #ifndef CONFIG_PLD_SNOC_ICNSS @@ -106,6 +109,18 @@ static inline int pld_snoc_wlan_get_dfs_nol(void *info, u16 info_len) { return 0; } +static inline int pld_snoc_athdiag_read(struct device *dev, uint32_t offset, + uint32_t memtype, uint32_t datalen, + uint8_t *output) +{ + return 0; +} +static inline int pld_snoc_athdiag_write(struct device *dev, uint32_t offset, + uint32_t memtype, uint32_t datalen, + uint8_t *input) +{ + return 0; +} #else int pld_snoc_register_driver(void); void pld_snoc_unregister_driver(void); @@ -128,5 +143,17 @@ int pld_snoc_get_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 *ch_count, u16 buf_len); int pld_snoc_wlan_set_dfs_nol(const void *info, u16 info_len); int pld_snoc_wlan_get_dfs_nol(void *info, u16 info_len); +static inline int pld_snoc_athdiag_read(struct device *dev, uint32_t offset, + uint32_t memtype, uint32_t datalen, + uint8_t *output) +{ + return icnss_athdiag_read(dev, offset, memtype, datalen, output); +} +static inline int pld_snoc_athdiag_write(struct device *dev, uint32_t offset, + uint32_t memtype, uint32_t datalen, + uint8_t *input) +{ + return icnss_athdiag_write(dev, offset, memtype, datalen, input); +} #endif #endif |
