From 440c5295c2b5acf5ddfc98e07e665510f26410c1 Mon Sep 17 00:00:00 2001 From: Mohit Khanna Date: Thu, 12 May 2016 11:05:06 -0700 Subject: [PATCH] qcacmn: Add USB bus support (HIF Common) Add module specific changes for USB bus support. Change-Id: I98ca380567c279d3206aa4afc7a28c2feeb65993 CRs-Fixed: 1023663 --- hif/inc/hif.h | 18 +++++++++++++++--- hif/inc/regtable.h | 6 ++++++ hif/src/ar6320def.h | 2 ++ hif/src/ar6320v2def.h | 2 ++ hif/src/ar9888def.h | 2 ++ hif/src/hif_debug.h | 2 +- hif/src/hif_main.c | 28 +++++++++++++++++++++++++--- hif/src/hif_main.h | 10 ++++++++++ hif/src/sdio/hif_sdio.c | 13 ------------- hif/src/usb/hif_usb.c | 4 ++-- hif/src/usb/if_usb.c | 9 ++++----- 11 files changed, 69 insertions(+), 27 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index d30de2d75e..5b24ef8a64 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -40,7 +40,9 @@ extern "C" { #ifdef HIF_PCI #include #endif /* HIF_PCI */ - +#ifdef HIF_USB +#include +#endif /* HIF_USB */ #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1 typedef struct htc_callbacks HTC_CALLBACKS; @@ -363,7 +365,7 @@ typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t); #ifdef WLAN_FEATURE_FASTPATH void hif_enable_fastpath(struct hif_opaque_softc *hif_ctx); bool hif_is_fastpath_mode_enabled(struct hif_opaque_softc *hif_ctx); -void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int); +void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret); int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx, fastpath_msg_handler handler, void *context); #else @@ -373,6 +375,11 @@ static inline int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx, { return QDF_STATUS_E_FAILURE; } +static inline void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret) +{ + return NULL; +} + #endif /* @@ -613,7 +620,11 @@ struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc, uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc, uint32_t pipe_num); int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc); -#endif +#endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */ + +void hif_set_bundle_mode(struct hif_opaque_softc *scn, bool enabled, + int rx_bundle_cnt); +int hif_bus_reset_resume(struct hif_opaque_softc *scn); #ifdef WLAN_SUSPEND_RESUME_TEST typedef void (*hdd_fake_resume_callback)(uint32_t val); @@ -623,4 +634,5 @@ void hif_fake_apps_suspend(hdd_fake_resume_callback callback); #ifdef __cplusplus } #endif + #endif /* _HIF_H_ */ diff --git a/hif/inc/regtable.h b/hif/inc/regtable.h index 1453b5fcd7..fe46049902 100644 --- a/hif/inc/regtable.h +++ b/hif/inc/regtable.h @@ -31,8 +31,14 @@ #ifdef HIF_SDIO #include "regtable_sdio.h" #endif + #if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) #include "reg_struct.h" #include "regtable_pcie.h" #endif + +#if defined(HIF_USB) +#include "regtable_usb.h" +#endif + #endif diff --git a/hif/src/ar6320def.h b/hif/src/ar6320def.h index 2241387220..f03a07caa0 100644 --- a/hif/src/ar6320def.h +++ b/hif/src/ar6320def.h @@ -460,8 +460,10 @@ struct targetdef_s ar6320_targetdef = { .d_DRAM_BASE_ADDRESS = AR6320_DRAM_BASE_ADDRESS, .d_SOC_CORE_BASE_ADDRESS = AR6320_SOC_CORE_BASE_ADDRESS, .d_CORE_CTRL_ADDRESS = AR6320_CORE_CTRL_ADDRESS, +#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) .d_MSI_NUM_REQUEST = MSI_NUM_REQUEST, .d_MSI_ASSIGN_FW = MSI_ASSIGN_FW, +#endif .d_CORE_CTRL_CPU_INTR_MASK = AR6320_CORE_CTRL_CPU_INTR_MASK, .d_SR_WR_INDEX_ADDRESS = AR6320_SR_WR_INDEX_ADDRESS, .d_DST_WATERMARK_ADDRESS = AR6320_DST_WATERMARK_ADDRESS, diff --git a/hif/src/ar6320v2def.h b/hif/src/ar6320v2def.h index 0058d44755..7a27909cf6 100644 --- a/hif/src/ar6320v2def.h +++ b/hif/src/ar6320v2def.h @@ -464,8 +464,10 @@ struct targetdef_s ar6320v2_targetdef = { .d_DRAM_BASE_ADDRESS = AR6320V2_DRAM_BASE_ADDRESS, .d_SOC_CORE_BASE_ADDRESS = AR6320V2_SOC_CORE_BASE_ADDRESS, .d_CORE_CTRL_ADDRESS = AR6320V2_CORE_CTRL_ADDRESS, +#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) .d_MSI_NUM_REQUEST = MSI_NUM_REQUEST, .d_MSI_ASSIGN_FW = MSI_ASSIGN_FW, +#endif .d_CORE_CTRL_CPU_INTR_MASK = AR6320V2_CORE_CTRL_CPU_INTR_MASK, .d_SR_WR_INDEX_ADDRESS = AR6320V2_SR_WR_INDEX_ADDRESS, .d_DST_WATERMARK_ADDRESS = AR6320V2_DST_WATERMARK_ADDRESS, diff --git a/hif/src/ar9888def.h b/hif/src/ar9888def.h index 5a7fc331d9..9e291cc407 100644 --- a/hif/src/ar9888def.h +++ b/hif/src/ar9888def.h @@ -367,8 +367,10 @@ struct targetdef_s ar9888_targetdef = { .d_DRAM_BASE_ADDRESS = AR9888_DRAM_BASE_ADDRESS, .d_SOC_CORE_BASE_ADDRESS = AR9888_SOC_CORE_BASE_ADDRESS, .d_CORE_CTRL_ADDRESS = AR9888_CORE_CTRL_ADDRESS, +#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) .d_MSI_NUM_REQUEST = MSI_NUM_REQUEST, .d_MSI_ASSIGN_FW = MSI_ASSIGN_FW, +#endif .d_CORE_CTRL_CPU_INTR_MASK = AR9888_CORE_CTRL_CPU_INTR_MASK, .d_SR_WR_INDEX_ADDRESS = AR9888_SR_WR_INDEX_ADDRESS, .d_DST_WATERMARK_ADDRESS = AR9888_DST_WATERMARK_ADDRESS, diff --git a/hif/src/hif_debug.h b/hif/src/hif_debug.h index ff5f6c793f..a51437bebf 100644 --- a/hif/src/hif_debug.h +++ b/hif/src/hif_debug.h @@ -36,7 +36,7 @@ #define HIF_INFO_LO(args ...) \ QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO_LOW, ## args) #define HIF_TRACE(args ...) \ - QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR, ## args) + QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO, ## args) #define HIF_DBG(args ...) \ QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_DEBUG, ## args) diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 885462d8dd..abdb158645 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -39,13 +39,13 @@ #include "hif_main.h" #include "hif_hw_version.h" #if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) -#include "ce_api.h" #include "ce_tasklet.h" #endif #include "qdf_trace.h" #include "qdf_status.h" #include "hif_debug.h" #include "mp_dev.h" +#include "ce_api.h" void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t cmd_id, bool start) { @@ -324,6 +324,11 @@ void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision, const char **target_name) { struct hif_target_info *info = hif_get_target_info_handle(scn); + struct hif_softc *sc = HIF_GET_SOFTC(scn); + + if (sc->bus_type == QDF_BUS_TYPE_USB) + hif_usb_get_hw_info(sc); + *version = info->target_version; *revision = info->target_revision; *target_name = hif_get_hw_name(info); @@ -455,7 +460,7 @@ QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev, scn->hif_init_done = true; - HIF_TRACE("%s: X OK", __func__); + HIF_TRACE("%s: OK", __func__); return QDF_STATUS_SUCCESS; } @@ -888,7 +893,7 @@ bool hif_is_recovery_in_progress(struct hif_softc *scn) return false; } - +#if defined(HIF_PCI) || defined(SNOC) || defined(HIF_AHB) /** * hif_batch_send() - API to access hif specific function * ce_batch_send. @@ -958,6 +963,7 @@ int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf, return ce_send_fast((struct CE_handle *)ce_tx_hdl, nbuf, transfer_id, download_len); } +#endif /** * hif_reg_write() - API to access hif specific function @@ -990,3 +996,19 @@ uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset) struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); return hif_read32_mb(scn->mem + offset); } + +#if defined(HIF_USB) +/** + * hif_ramdump_handler(): generic ramdump handler + * @scn: struct hif_opaque_softc + * + * Return: None + */ + +void hif_ramdump_handler(struct hif_opaque_softc *scn) + +{ + if (hif_get_bus_type == QDF_BUS_TYPE_USB) + hif_usb_ramdump_handler(); +} +#endif diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index 371f99fd02..8a44e95ee2 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -95,6 +95,8 @@ #define HIF_GET_PCI_SOFTC(scn) ((struct hif_pci_softc *)scn) #define HIF_GET_CE_STATE(scn) ((struct HIF_CE_state *)scn) #define HIF_GET_SDIO_SOFTC(scn) ((struct hif_sdio_softc *)scn) +#define HIF_GET_USB_SOFTC(scn) ((struct hif_usb_softc *)scn) +#define HIF_GET_USB_DEVICE(scn) ((HIF_DEVICE_USB *)scn) #define HIF_GET_SOFTC(scn) ((struct hif_softc *)scn) #define GET_HIF_OPAQUE_HDL(scn) ((struct hif_opaque_softc *)scn) @@ -203,4 +205,12 @@ void hif_wlan_disable(struct hif_softc *scn); int hif_target_sleep_state_adjust(struct hif_softc *scn, bool sleep_ok, bool wait_for_it); +#ifdef HIF_USB +void hif_usb_get_hw_info(struct hif_softc *scn); +void hif_ramdump_handler(struct hif_opaque_softc *scn); + +#else +static inline void hif_usb_get_hw_info(struct hif_softc *scn) {} +static inline void hif_ramdump_handler(struct hif_opaque_softc *scn) {} +#endif #endif /* __HIF_MAIN_H__ */ diff --git a/hif/src/sdio/hif_sdio.c b/hif/src/sdio/hif_sdio.c index 83ef92248b..77b699336e 100644 --- a/hif/src/sdio/hif_sdio.c +++ b/hif/src/sdio/hif_sdio.c @@ -226,16 +226,3 @@ void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t pipe, } -/** - * hif_set_bundle_mode() - set bundling mode. - * @hif_ctx: HIF context - * @enabled: enable/disable bundling - * @rx_bundle_cnt: bundling count - * - * Return: none - */ -void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled, - uint64_t rx_bundle_cnt) -{ - -} diff --git a/hif/src/usb/hif_usb.c b/hif/src/usb/hif_usb.c index e0682f6fd2..8c1a3e4628 100644 --- a/hif/src/usb/hif_usb.c +++ b/hif/src/usb/hif_usb.c @@ -893,14 +893,14 @@ void hif_suspend_wow(struct hif_opaque_softc *scn) } /** - * hif_set_bundle_mode() - enable bundling and set default rx bundle cnt + * hif_usb_set_bundle_mode() - enable bundling and set default rx bundle cnt * @scn: pointer to hif_opaque_softc structure * @enabled: flag to enable/disable bundling * @rx_bundle_cnt: bundle count to be used for RX * * Return: none */ -void hif_set_bundle_mode(struct hif_opaque_softc *scn, +void hif_usb_set_bundle_mode(struct hif_softc *scn, bool enabled, int rx_bundle_cnt) { HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); diff --git a/hif/src/usb/if_usb.c b/hif/src/usb/if_usb.c index ff056eaeb1..7b6cc54d9b 100644 --- a/hif/src/usb/if_usb.c +++ b/hif/src/usb/if_usb.c @@ -361,7 +361,7 @@ int hif_usb_bus_resume(struct hif_softc *hif_ctx) } /** - * hif_bus_reset_resume() - resume the bus after reset + * hif_usb_bus_reset_resume() - resume the bus after reset * @scn: struct hif_opaque_softc * * This function is called to tell the driver that USB device has been resumed @@ -370,10 +370,9 @@ int hif_usb_bus_resume(struct hif_softc *hif_ctx) * * Return: int 0 for success, non zero for failure */ -int hif_bus_reset_resume(struct hif_opaque_softc *scn) +int hif_usb_bus_reset_resume(struct hif_softc *hif_ctx) { int ret = 0; - struct hif_softc *hif_ctx = HIF_GET_SOFTC(scn); HIF_ENTER(); if (hif_usb_diag_write_cold_reset(hif_ctx) != QDF_STATUS_SUCCESS) ret = 1; @@ -621,7 +620,7 @@ void hif_fw_assert_ramdump_pattern(struct hif_usb_softc *sc) } /** - * hif_ramdump_handler(): dump bus debug registers + * hif_usb_ramdump_handler(): dump bus debug registers * @scn: struct hif_opaque_softc * * This function is to receive information of firmware crash dump, and @@ -641,7 +640,7 @@ void hif_fw_assert_ramdump_pattern(struct hif_usb_softc *sc) * Return: 0 for success or error code */ -void hif_ramdump_handler(struct hif_opaque_softc *scn) +void hif_usb_ramdump_handler(struct hif_opaque_softc *scn) { uint32_t *reg, pattern, i, start_addr = 0; uint32_t len;