From d9dce6e18cfd8550b51ec4f9c56882d2944aacaf Mon Sep 17 00:00:00 2001 From: Nirav Shah Date: Mon, 26 Feb 2018 14:50:25 +0530 Subject: [PATCH] qcacmn: [HIF] Add support for QCA9379 on x86 platform Add support for QCA9379 chip on x86 platform for USB and SDIO attach. Change-Id: I1192e47f6ca186bbcaa6d1fb28d40cb16d6dfe0b CRs-Fixed: 2181012 --- hif/src/dispatcher/ahb_api.h | 4 +- hif/src/dispatcher/multibus.c | 7 +++ hif/src/dispatcher/multibus.h | 5 +- hif/src/dispatcher/multibus_ahb.c | 1 + hif/src/dispatcher/multibus_pci.c | 3 +- hif/src/dispatcher/multibus_sdio.c | 3 +- hif/src/dispatcher/multibus_snoc.c | 3 +- hif/src/dispatcher/multibus_usb.c | 10 ++-- hif/src/dispatcher/pci_api.h | 3 +- hif/src/dispatcher/sdio_api.h | 3 +- hif/src/dispatcher/snoc_api.h | 3 +- hif/src/dispatcher/usb_api.h | 11 +++- hif/src/hif_irq_affinity.c | 57 +------------------ hif/src/hif_main.c | 86 ++++++++++++++-------------- hif/src/hif_main.h | 13 ++++- hif/src/pcie/if_pci.c | 11 ++++ hif/src/sdio/hif_bmi_reg_access.c | 16 ++++-- hif/src/sdio/hif_diag_reg_access.c | 4 +- hif/src/sdio/hif_sdio_send.c | 4 +- hif/src/sdio/if_sdio.c | 91 ++++-------------------------- hif/src/sdio/if_sdio.h | 17 +++++- hif/src/sdio/native_sdio/src/hif.c | 65 ++++++++------------- hif/src/sdio/regtable_sdio.c | 1 + hif/src/snoc/if_ahb.c | 11 ++++ hif/src/snoc/if_snoc.c | 11 ++++ hif/src/usb/hif_usb.c | 62 ++++++++++---------- hif/src/usb/if_usb.c | 15 ++++- hif/src/usb/if_usb.h | 22 +++++++- hif/src/usb/usbdrv.c | 36 +++++------- htc/htc_send.c | 2 +- 30 files changed, 274 insertions(+), 306 deletions(-) diff --git a/hif/src/dispatcher/ahb_api.h b/hif/src/dispatcher/ahb_api.h index 20df65079b..103114b87e 100644 --- a/hif/src/dispatcher/ahb_api.h +++ b/hif/src/dispatcher/ahb_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -49,5 +49,5 @@ int hif_ahb_enable_radio(struct hif_pci_softc *sc, int hif_ahb_configure_irq(struct hif_pci_softc *sc); int hif_ahb_configure_grp_irq(struct hif_softc *scn, struct hif_exec_context *hif_ext_grp); - +bool hif_ahb_needs_bmi(struct hif_softc *scn); #endif diff --git a/hif/src/dispatcher/multibus.c b/hif/src/dispatcher/multibus.c index 5009a92e5b..dea0102b40 100644 --- a/hif/src/dispatcher/multibus.c +++ b/hif/src/dispatcher/multibus.c @@ -519,3 +519,10 @@ int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx) return 0; } + +bool hif_needs_bmi(struct hif_opaque_softc *scn) +{ + struct hif_softc *hif_sc = HIF_GET_SOFTC(scn); + + return hif_sc->bus_ops.hif_needs_bmi(hif_sc); +} diff --git a/hif/src/dispatcher/multibus.h b/hif/src/dispatcher/multibus.h index 2bbb586d2b..da72c2ee7a 100644 --- a/hif/src/dispatcher/multibus.h +++ b/hif/src/dispatcher/multibus.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -88,6 +88,7 @@ struct hif_bus_ops { int (*hif_bus_reset_resume)(struct hif_softc *hif_ctx); int (*hif_map_ce_to_irq)(struct hif_softc *hif_sc, int ce_id); int (*hif_addr_in_boundary)(struct hif_softc *scn, uint32_t offset); + bool (*hif_needs_bmi)(struct hif_softc *hif_sc); }; #ifdef HIF_SNOC @@ -183,6 +184,8 @@ static inline int hif_sdio_get_context_size(void) } #endif /* HIF_SDIO */ +int hif_grp_irq_configure(struct hif_softc *hif_sc, + struct hif_exec_context *hif_exec); #ifdef HIF_USB QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops); int hif_usb_get_context_size(void); diff --git a/hif/src/dispatcher/multibus_ahb.c b/hif/src/dispatcher/multibus_ahb.c index 49cfae7044..04bf46d7f9 100644 --- a/hif/src/dispatcher/multibus_ahb.c +++ b/hif/src/dispatcher/multibus_ahb.c @@ -68,6 +68,7 @@ QDF_STATUS hif_initialize_ahb_ops(struct hif_bus_ops *bus_ops) &hif_dummy_disable_power_management; bus_ops->hif_grp_irq_configure = &hif_ahb_configure_grp_irq; bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary; + bus_ops->hif_needs_bmi = &hif_ahb_needs_bmi; return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/multibus_pci.c b/hif/src/dispatcher/multibus_pci.c index 332e3b0472..ad6a701202 100644 --- a/hif/src/dispatcher/multibus_pci.c +++ b/hif/src/dispatcher/multibus_pci.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -92,6 +92,7 @@ QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc) /* default to legacy mapping handler; override as needed */ bus_ops->hif_map_ce_to_irq = &hif_pci_legacy_map_ce_to_irq; + bus_ops->hif_needs_bmi = &hif_pci_needs_bmi; return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/multibus_sdio.c b/hif/src/dispatcher/multibus_sdio.c index ab1641cd48..3c220be0b4 100644 --- a/hif/src/dispatcher/multibus_sdio.c +++ b/hif/src/dispatcher/multibus_sdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -65,6 +65,7 @@ QDF_STATUS hif_initialize_sdio_ops(struct hif_softc *hif_sc) bus_ops->hif_disable_power_management = &hif_dummy_disable_power_management; bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary; + bus_ops->hif_needs_bmi = &hif_sdio_needs_bmi; return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/multibus_snoc.c b/hif/src/dispatcher/multibus_snoc.c index 9c2193b9df..553adea219 100644 --- a/hif/src/dispatcher/multibus_snoc.c +++ b/hif/src/dispatcher/multibus_snoc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -83,6 +83,7 @@ QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops) &hif_snoc_clear_stats; bus_ops->hif_map_ce_to_irq = &hif_snoc_map_ce_to_irq; bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary; + bus_ops->hif_needs_bmi = &hif_snoc_needs_bmi; return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/multibus_usb.c b/hif/src/dispatcher/multibus_usb.c index 68f73bc7cd..e632a40134 100644 --- a/hif/src/dispatcher/multibus_usb.c +++ b/hif/src/dispatcher/multibus_usb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -50,7 +50,6 @@ QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops) bus_ops->hif_claim_device = &hif_dummy_claim_device; bus_ops->hif_shutdown_device = &hif_usb_shutdown_bus_device; bus_ops->hif_stop = &hif_usb_stop_device; - bus_ops->hif_bus_pkt_dl_len_set = &hif_dummy_bus_pkt_dl_len_set; bus_ops->hif_cancel_deferred_target_sleep = &hif_dummy_cancel_deferred_target_sleep; bus_ops->hif_irq_disable = &hif_usb_irq_disable; @@ -58,13 +57,16 @@ QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops) bus_ops->hif_dump_registers = &hif_dummy_dump_registers; bus_ops->hif_dump_target_memory = &hif_dummy_dump_target_memory; bus_ops->hif_ipa_get_ce_resource = &hif_dummy_ipa_get_ce_resource; + bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call; bus_ops->hif_enable_power_management = &hif_dummy_enable_power_management; bus_ops->hif_disable_power_management = &hif_dummy_disable_power_management; - bus_ops->hif_set_bundle_mode = hif_usb_set_bundle_mode; - bus_ops->hif_bus_reset_resume = hif_usb_bus_reset_resume; bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary; + bus_ops->hif_set_bundle_mode = &hif_usb_set_bundle_mode; + bus_ops->hif_bus_reset_resume = &hif_usb_bus_reset_resume; + bus_ops->hif_map_ce_to_irq = &hif_dummy_map_ce_to_irq; + bus_ops->hif_needs_bmi = &hif_usb_needs_bmi; return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/pci_api.h b/hif/src/dispatcher/pci_api.h index 5b5dbccf54..9767d87a4b 100644 --- a/hif/src/dispatcher/pci_api.h +++ b/hif/src/dispatcher/pci_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -59,4 +59,5 @@ int hif_pci_configure_grp_irq(struct hif_softc *scn, void hif_pci_display_stats(struct hif_softc *hif_ctx); void hif_pci_clear_stats(struct hif_softc *hif_ctx); int hif_pci_legacy_map_ce_to_irq(struct hif_softc *scn, int ce_id); +bool hif_pci_needs_bmi(struct hif_softc *scn); #endif /* _PCI_API_H_ */ diff --git a/hif/src/dispatcher/sdio_api.h b/hif/src/dispatcher/sdio_api.h index 77106da9c5..76ced83ea2 100644 --- a/hif/src/dispatcher/sdio_api.h +++ b/hif/src/dispatcher/sdio_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -32,3 +32,4 @@ hif_sdio_get_config_item(struct hif_softc *hif_sc, void hif_sdio_set_mailbox_swap(struct hif_softc *hif_sc); void hif_sdio_claim_device(struct hif_softc *hif_sc); void hif_sdio_mask_interrupt_call(struct hif_softc *scn); +bool hif_sdio_needs_bmi(struct hif_softc *scn); diff --git a/hif/src/dispatcher/snoc_api.h b/hif/src/dispatcher/snoc_api.h index 17177dbb23..dd623f9fc6 100644 --- a/hif/src/dispatcher/snoc_api.h +++ b/hif/src/dispatcher/snoc_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -47,4 +47,5 @@ int hif_snoc_dump_registers(struct hif_softc *scn); void hif_snoc_display_stats(struct hif_softc *hif_ctx); void hif_snoc_clear_stats(struct hif_softc *hif_ctx); int hif_snoc_map_ce_to_irq(struct hif_softc *scn, int ce_id); +bool hif_snoc_needs_bmi(struct hif_softc *scn); #endif /* _SNOC_API_H_ */ diff --git a/hif/src/dispatcher/usb_api.h b/hif/src/dispatcher/usb_api.h index 1c48791ae1..a54aa81698 100644 --- a/hif/src/dispatcher/usb_api.h +++ b/hif/src/dispatcher/usb_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -17,6 +17,7 @@ */ #ifndef _USB_API_H_ #define _USB_API_H_ +#include "if_usb.h" QDF_STATUS hif_usb_open(struct hif_softc *hif_ctx, enum qdf_bus_type bus_type); @@ -39,6 +40,10 @@ int hif_usb_bus_resume(struct hif_softc *hif_ctx); void hif_usb_stop_device(struct hif_softc *hif_sc); void hif_usb_shutdown_bus_device(struct hif_softc *scn); int hif_usb_bus_reset_resume(struct hif_softc *hif_ctx); -void hif_usb_set_bundle_mode(struct hif_opaque_softc *scn, - bool enabled, int rx_bundle_cnt); +void hif_usb_set_bundle_mode(struct hif_softc *scn, + bool enabled, int rx_bundle_cnt); +void hif_usb_reg_tbl_attach(struct hif_softc *scn); +void hif_fw_assert_ramdump_pattern(struct hif_usb_softc *sc); +void hif_usb_ramdump_handler(struct hif_opaque_softc *scn); +bool hif_usb_needs_bmi(struct hif_softc *scn); #endif /*_USB_API_H_*/ diff --git a/hif/src/hif_irq_affinity.c b/hif/src/hif_irq_affinity.c index ec878cc3ee..328c79538a 100644 --- a/hif/src/hif_irq_affinity.c +++ b/hif/src/hif_irq_affinity.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -226,62 +226,9 @@ int hif_exec_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event, NAPI_DEBUG("<--[rc=%d]", rc); return rc; } + #endif -/** - * hif_napi_correct_cpu() - correct the interrupt affinity for napi if needed - * @napi_info: pointer to qca_napi_info for the napi instance - * - * Return: true => interrupt already on correct cpu, no correction needed - * false => interrupt on wrong cpu, correction done for cpu affinity - * of the interrupt - */ -static inline -bool hif_exec_correct_cpu(struct hif_exec_context *exec_ctx) -{ - bool right_cpu = true; - int rc = 0; - cpumask_t cpumask; - int cpu; - struct hif_softc *hif_softc = HIF_GET_SOFTC(exec_ctx->hif); - struct qca_napi_data *napid; - int ind; - - napid = &hif_softc->napi_data; - - if (!(napid->flags & QCA_NAPI_FEATURE_CPU_CORRECTION)) - goto done; - - cpu = qdf_get_cpu(); - if (likely((cpu == exec_ctx->cpu) || - hif_exec_cpu_blacklist(napid, BLACKLIST_QUERY) == 0)) - goto done; - - right_cpu = false; - - NAPI_DEBUG("interrupt on wrong CPU, correcting"); - cpumask.bits[0] = (0x01 << exec_ctx->cpu); - - for (ind = 0; ind < exec_ctx->numirq; ind++) { - if (exec_ctx->os_irq[ind]) { - irq_modify_status(exec_ctx->os_irq[ind], - IRQ_NO_BALANCING, 0); - rc = irq_set_affinity_hint(exec_ctx->os_irq[ind], - &cpumask); - irq_modify_status(exec_ctx->os_irq[ind], 0, - IRQ_NO_BALANCING); - - if (rc) - HIF_ERROR("error setting irq affinity hint: %d", - rc); - else - exec_ctx->stats[cpu].cpu_corrected++; - } - } -done: - return right_cpu; -} - /** * hncm_migrate_to() - migrates a NAPI to a CPU * @napid: pointer to NAPI block diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index cf8dd45feb..eef385e2d1 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -439,6 +439,24 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode, return GET_HIF_OPAQUE_HDL(scn); } +#ifdef ADRASTEA_RRI_ON_DDR +/** + * hif_uninit_rri_on_ddr(): free consistent memory allocated for rri + * @scn: hif context + * + * Return: none + */ +void hif_uninit_rri_on_ddr(struct hif_softc *scn) +{ + if (scn->vaddr_rri_on_ddr) + qdf_mem_free_consistent(scn->qdf_dev, scn->qdf_dev->dev, + (CE_COUNT * sizeof(uint32_t)), + scn->vaddr_rri_on_ddr, + scn->paddr_rri_on_ddr, 0); + scn->vaddr_rri_on_ddr = NULL; +} +#endif + /** * hif_close(): hif_close * @hif_ctx: hif_ctx @@ -466,13 +484,8 @@ void hif_close(struct hif_opaque_softc *hif_ctx) qdf_mem_free(hw_name); } - if (scn->vaddr_rri_on_ddr) - qdf_mem_free_consistent(scn->qdf_dev, scn->qdf_dev->dev, - (CE_COUNT*sizeof(uint32_t)), - scn->vaddr_rri_on_ddr, scn->paddr_rri_on_ddr, - 0); + hif_uninit_rri_on_ddr(scn); - scn->vaddr_rri_on_ddr = NULL; hif_bus_close(scn); qdf_mem_free(scn); } @@ -820,21 +833,6 @@ end: return ret; } -/** - * hif_needs_bmi() - return true if the soc needs bmi through the driver - * @hif_ctx: hif context - * - * Return: true if the soc needs driver bmi otherwise false - */ -bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx) -{ - struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx); - - return (hif_sc->bus_type != QDF_BUS_TYPE_SNOC) && - !ce_srng_based(hif_sc); -} -qdf_export_symbol(hif_needs_bmi); - /** * hif_get_bus_type() - return the bus type * @@ -1030,6 +1028,25 @@ bool hif_is_load_or_unload_in_progress(struct hif_softc *scn) return false; } +/** + * hif_is_recovery_in_progress() - API to query upper layers if recovery in + * progress + * @scn: HIF Context + * + * Return: True/False + */ +bool hif_is_recovery_in_progress(struct hif_softc *scn) +{ + struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); + + if (cbk && cbk->is_recovery_in_progress) + return cbk->is_recovery_in_progress(cbk->context); + + return false; +} + +#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) + /** * hif_update_pipe_callback() - API to register pipe specific callbacks * @osc: Opaque softc @@ -1060,23 +1077,6 @@ void hif_update_pipe_callback(struct hif_opaque_softc *osc, } qdf_export_symbol(hif_update_pipe_callback); -/** - * hif_is_recovery_in_progress() - API to query upper layers if recovery in - * progress - * @scn: HIF Context - * - * Return: True/False - */ -bool hif_is_recovery_in_progress(struct hif_softc *scn) -{ - struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); - - if (cbk && cbk->is_recovery_in_progress) - return cbk->is_recovery_in_progress(cbk->context); - - return false; -} - /** * hif_is_target_ready() - API to query if target is in ready state * progress @@ -1093,7 +1093,7 @@ bool hif_is_target_ready(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. @@ -1209,21 +1209,17 @@ uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset) } qdf_export_symbol(hif_reg_read); -#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(); + if (hif_get_bus_type(scn) == QDF_BUS_TYPE_USB) + hif_usb_ramdump_handler(scn); } -#endif #ifdef WLAN_SUSPEND_RESUME_TEST irqreturn_t hif_wake_interrupt_handler(int irq, void *context) diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index c61ac2006f..7e3892f1da 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -272,13 +272,13 @@ int hif_target_sleep_state_adjust(struct hif_softc *scn, bool sleep_ok, bool wait_for_it); int hif_get_rx_ctx_id(int ctx_id, struct hif_opaque_softc *hif_hdl); +void hif_ramdump_handler(struct hif_opaque_softc *scn); #ifdef HIF_USB void hif_usb_get_hw_info(struct hif_softc *scn); -void hif_ramdump_handler(struct hif_opaque_softc *scn); - +void hif_usb_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) {} +static inline void hif_usb_ramdump_handler(struct hif_opaque_softc *scn) {} #endif /** @@ -299,4 +299,11 @@ bool hif_is_target_register_access_allowed(struct hif_softc *hif_sc) return true; } #endif + +#ifdef ADRASTEA_RRI_ON_DDR +void hif_uninit_rri_on_ddr(struct hif_softc *scn); +#else +static inline +void hif_uninit_rri_on_ddr(struct hif_softc *scn) {} +#endif #endif /* __HIF_MAIN_H__ */ diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 55b7f1b900..26722c39db 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -4480,3 +4480,14 @@ int hif_pci_addr_in_boundary(struct hif_softc *scn, uint32_t offset) return -EINVAL; } + +/** + * hif_pci_needs_bmi() - return true if the soc needs bmi through the driver + * @scn: hif context + * + * Return: true if soc needs driver bmi otherwise false + */ +bool hif_pci_needs_bmi(struct hif_softc *scn) +{ + return !ce_srng_based(scn); +} diff --git a/hif/src/sdio/hif_bmi_reg_access.c b/hif/src/sdio/hif_bmi_reg_access.c index 02e407b380..5bbc72e7bc 100644 --- a/hif/src/sdio/hif_bmi_reg_access.c +++ b/hif/src/sdio/hif_bmi_reg_access.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * ***Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -40,6 +40,7 @@ static bool pending_events_func_check; static uint32_t command_credits; static uint32_t *p_bmi_cmd_credits = &command_credits; + /* BMI Access routines */ /** @@ -297,8 +298,10 @@ hif_bmi_buffer_receive(struct hif_sdio_dev *device, * * Return: QDF_STATUS_SUCCESS for success. */ -QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx, - struct bmi_target_info *targ_info) { +QDF_STATUS +hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx, + struct bmi_target_info *targ_info) +{ QDF_STATUS status; uint32_t cid; struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_ctx); @@ -448,9 +451,10 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx, * Return: QDF_STATUS_SUCCESS for success. */ -static QDF_STATUS +QDF_STATUS hif_bmi_raw_write(struct hif_sdio_dev *device, char *buffer, - uint32_t length) { + uint32_t length) +{ return hif_bmi_buffer_send(device, buffer, length); } @@ -463,7 +467,7 @@ hif_bmi_raw_write(struct hif_sdio_dev *device, char *buffer, * * Return: QDF_STATUS_SUCCESS for success. */ -static QDF_STATUS +QDF_STATUS hif_bmi_raw_read(struct hif_sdio_dev *device, char *buffer, uint32_t length, bool want_timeout) { diff --git a/hif/src/sdio/hif_diag_reg_access.c b/hif/src/sdio/hif_diag_reg_access.c index 92bc5b5cbf..9eb605b868 100644 --- a/hif/src/sdio/hif_diag_reg_access.c +++ b/hif/src/sdio/hif_diag_reg_access.c @@ -318,8 +318,8 @@ static QDF_STATUS hif_ar6k_read_target_register(struct hif_sdio_dev *hif_device, * * Return: None */ -static void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device, - uint32_t *targregs) +void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device, + uint32_t *targregs) { int i; uint32_t val; diff --git a/hif/src/sdio/hif_sdio_send.c b/hif/src/sdio/hif_sdio_send.c index cd0ab2985c..a6ff611c46 100644 --- a/hif/src/sdio/hif_sdio_send.c +++ b/hif/src/sdio/hif_sdio_send.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -156,7 +156,7 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev, } else { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Allocate send context fail %d\n", - sizeof(struct hif_sendContext) + + (int) sizeof(struct hif_sendContext) + padded_length)); return QDF_STATUS_E_NOMEM; } diff --git a/hif/src/sdio/if_sdio.c b/hif/src/sdio/if_sdio.c index 622b0d5614..98828dc69e 100644 --- a/hif/src/sdio/if_sdio.c +++ b/hif/src/sdio/if_sdio.c @@ -47,15 +47,16 @@ #include #include "regtable_sdio.h" #include +#include "target_type.h" +#include "epping_main.h" +#include "pld_sdio.h" +#include "targaddrs.h" +#include "sdio_api.h" #ifndef REMOVE_PKT_LOG #include "ol_txrx_types.h" #include "pktlog_ac_api.h" #include "pktlog_ac.h" #endif -#include "target_type.h" -#include "epping_main.h" -#include "pld_sdio.h" -#include "targaddrs.h" #ifndef ATH_BUS_PM #ifdef CONFIG_PM @@ -206,27 +207,6 @@ err_alloc: return ret; } -/** - * ol_ath_sdio_configure() - configure sdio device - * @hif_sc: pointer to sdio softc structure - * @dev: pointer to net device - * @hif_handle: pointer to sdio function - * - * Return: 0 for success and non-zero for failure - */ -static int -ol_ath_sdio_configure(void *hif_sc, struct net_device *dev, - hif_handle_t *hif_hdl) -{ - struct hif_sdio_softc *sc = (struct hif_sdio_softc *)hif_sc; - int ret = 0; - - sc->aps_osdev.netdev = dev; - *hif_hdl = sc->hif_handle; - - return ret; -} - /** * hif_sdio_remove() - remove sdio device * @conext: sdio device context @@ -340,21 +320,6 @@ static int init_ath_hif_sdio(void) return 0; } -/** - * hif_targ_is_awake(): check if target is awake - * - * This function returns true if the target is awake - * - * @scn: struct hif_softc - * @mem: mapped mem base - * - * Return: bool - */ -static bool hif_targ_is_awake(struct hif_softc *scn, void *__iomem *mem) -{ - return true; -} - /** * hif_sdio_bus_suspend() - suspend the bus * @@ -401,15 +366,6 @@ void hif_enable_power_gating(void *hif_ctx) { } -/** - * hif_disable_aspm() - hif_disable_aspm - * - * Return: n/a - */ -static void hif_disable_aspm(void) -{ -} - /** * hif_sdio_close() - hif_bus_close * @@ -446,28 +402,6 @@ QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc, return status; } -/** - * hif_get_target_type() - Get the target type - * - * This function is used to query the target type. - * - * @ol_sc: ol_softc struct pointer - * @dev: device pointer - * @bdev: bus dev pointer - * @bid: bus id pointer - * @hif_type: HIF type such as HIF_TYPE_QCA6180 - * @target_type: target type such as TARGET_TYPE_QCA6180 - * - * Return: 0 for success - */ -static int hif_get_target_type(struct hif_softc *ol_sc, struct device *dev, - void *bdev, const hif_bus_id *bid, uint32_t *hif_type, - uint32_t *target_type) -{ - - return 0; -} - void hif_get_target_revision(struct hif_softc *ol_sc) { struct hif_softc *ol_sc_local = (struct hif_softc *)ol_sc; @@ -496,8 +430,8 @@ void hif_get_target_revision(struct hif_softc *ol_sc) * Return: QDF_STATUS */ QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc, - struct device *dev, void *bdev, const hif_bus_id *bid, - enum hif_enable_type type) + struct device *dev, void *bdev, const struct hif_bus_id *bid, + enum hif_enable_type type) { int ret = 0; const struct sdio_device_id *id = (const struct sdio_device_id *)bid; @@ -654,13 +588,12 @@ void hif_wlan_disable(struct hif_softc *scn) } /** - * hif_config_target() - configure hif bus - * @hif_hdl: hif handle - * @state: + * hif_sdio_needs_bmi() - return true if the soc needs bmi through the driver + * @scn: hif context * - * Return: int + * Return: true if soc needs driver bmi otherwise false */ -static int hif_config_target(void *hif_hdl) +bool hif_sdio_needs_bmi(struct hif_softc *scn) { - return 0; + return true; } diff --git a/hif/src/sdio/if_sdio.h b/hif/src/sdio/if_sdio.h index 2ad3ac4f75..76633e0d49 100644 --- a/hif/src/sdio/if_sdio.h +++ b/hif/src/sdio/if_sdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -101,4 +101,19 @@ void hif_register_tbl_attach(struct hif_softc *scn, u32 hif_type); void target_register_tbl_attach(struct hif_softc *scn, u32 target_type); +void hif_enable_power_gating(void *hif_ctx); +void hif_sdio_close(struct hif_softc *hif_sc); +QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc, + enum qdf_bus_type bus_type); +void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device, + uint32_t *targregs); +QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx, + struct bmi_target_info *targ_info); +QDF_STATUS +hif_bmi_raw_write(struct hif_sdio_dev *device, char *buffer, + uint32_t length); +QDF_STATUS +hif_bmi_raw_read(struct hif_sdio_dev *device, char *buffer, + u32 length, bool want_timeout); + #endif /* __IF_SDIO_H__ */ diff --git a/hif/src/sdio/native_sdio/src/hif.c b/hif/src/sdio/native_sdio/src/hif.c index cc68bd95bb..e21ea46904 100644 --- a/hif/src/sdio/native_sdio/src/hif.c +++ b/hif/src/sdio/native_sdio/src/hif.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -144,9 +144,6 @@ MODULE_PARM_DESC(modstrength, "Adjust internal driver strength"); #define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) #define to_sdio_driver(d) container_of(d, struct sdio_driver, drv) -static int hif_device_inserted(struct sdio_func *func, - const struct sdio_device_id *id); -static void hif_device_removed(struct sdio_func *func); static struct hif_sdio_dev *add_hif_device(struct sdio_func *func); static struct hif_sdio_dev *get_hif_device(struct sdio_func *func); static void del_hif_device(struct hif_sdio_dev *device); @@ -231,23 +228,6 @@ static const struct sdio_device_id ar6k_id_table[] = { { /* null */ }, }; -#ifndef CONFIG_CNSS_SDIO -MODULE_DEVICE_TABLE(sdio, ar6k_id_table); - -static struct sdio_driver ar6k_driver = { - .name = "ar6k_wlan", - .id_table = ar6k_id_table, - .probe = hif_device_inserted, - .remove = hif_device_removed, -}; - -static const struct dev_pm_ops ar6k_device_pm_ops = { - .suspend = hif_device_suspend, - .resume = hif_device_resume, -}; - -#endif - /* make sure we only unregister when registered. */ static int registered; @@ -980,8 +960,9 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable) enable ? SDIO_IRQ_MODE_ASYNC_4BIT_IRQ_AR6003 : 0); - } else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE - || manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) { + } else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE || + manufacturer_id == MANUFACTURER_ID_QCA9377_BASE || + manufacturer_id == MANUFACTURER_ID_QCA9379_BASE) { unsigned char data = 0; setAsyncIRQ = 1; @@ -1196,6 +1177,7 @@ static void set_extended_mbox_window_info(uint16_t manf_id, break; } case MANUFACTURER_ID_QCA9377_BASE: + case MANUFACTURER_ID_QCA9379_BASE: pinfo->mbox_prop[0].extended_address = HIF_MBOX0_EXTENDED_BASE_ADDR_AR6320; pinfo->mbox_prop[0].extended_size = @@ -1601,6 +1583,21 @@ static void write_cccr(struct sdio_func *func) } } +#ifdef SDIO_BUS_WIDTH_8BIT +static int hif_cmd52_write_byte_8bit(struct sdio_func *func) +{ + return func0_cmd52_write_byte(func->card, SDIO_CCCR_IF, + SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_8BIT); +} +#else +static int hif_cmd52_write_byte_8bit(struct sdio_func *func) +{ + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("%s: 8BIT Bus Width not supported\n", __func__)); + return QDF_STATUS_E_FAILURE; +} +#endif + /** * hif_device_inserted() - hif-sdio driver probe handler * @func: pointer to sdio_func @@ -1750,12 +1747,7 @@ static int hif_device_inserted(struct sdio_func *func, } else if (mmcbuswidth == 8 && (device->host-> caps & MMC_CAP_8_BIT_DATA)) { - ret = - func0_cmd52_write_byte(func->card, - SDIO_CCCR_IF, - SDIO_BUS_CD_DISABLE - | - SDIO_BUS_WIDTH_8BIT); + ret = hif_cmd52_write_byte_8bit(func); if (ret) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: CMD52 to bus width failed: %d\n", @@ -2061,8 +2053,9 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device, func0_cmd52_write_byte(func->card, CCCR_SDIO_IRQ_MODE_REG_AR6003, SDIO_IRQ_MODE_ASYNC_4BIT_IRQ_AR6003); - } else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE - || manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) { + } else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE || + manufacturer_id == MANUFACTURER_ID_QCA9377_BASE || + manufacturer_id == MANUFACTURER_ID_QCA9379_BASE) { unsigned char data = 0; setAsyncIRQ = 1; @@ -2607,14 +2600,6 @@ static void reset_all_cards(void) { } -static void hif_release_device(struct hif_opaque_softc *hif_ctx) -{ - struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_ctx); - struct hif_sdio_dev *hif_device = scn->hif_handle; - - hif_device->claimed_ctx = NULL; -} - QDF_STATUS hif_attach_htc(struct hif_sdio_dev *device, struct htc_callbacks *callbacks) { @@ -2730,7 +2715,6 @@ void hif_dump_cccr(struct hif_sdio_dev *hif_device) AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("\n")); } -#ifdef CONFIG_CNSS_SDIO int hif_sdio_device_inserted(struct device *dev, const struct sdio_device_id *id) { @@ -2743,4 +2727,3 @@ void hif_sdio_device_removed(struct sdio_func *func) { hif_device_removed(func); } -#endif diff --git a/hif/src/sdio/regtable_sdio.c b/hif/src/sdio/regtable_sdio.c index 6798b1a11f..bffb0abf71 100644 --- a/hif/src/sdio/regtable_sdio.c +++ b/hif/src/sdio/regtable_sdio.c @@ -25,6 +25,7 @@ * to the Linux Foundation. */ +#include "bmi_msg.h" #include "target_type.h" #include "cepci.h" diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c index f04cc1364b..fc13902bf3 100644 --- a/hif/src/snoc/if_ahb.c +++ b/hif/src/snoc/if_ahb.c @@ -28,6 +28,7 @@ #include "hif_debug.h" #include "hif_io32.h" #include "ce_main.h" +#include "ce_api.h" #include "ce_tasklet.h" #include "if_ahb.h" #include "if_pci.h" @@ -712,3 +713,13 @@ void hif_ahb_exec_grp_irq_enable(struct hif_exec_context *hif_ext_group) qdf_spin_unlock_irqrestore(&hif_ext_group->irq_lock); } +/** + * hif_ahb_needs_bmi() - return true if the soc needs bmi through the driver + * @scn: hif context + * + * Return: true if soc needs driver bmi otherwise false + */ +bool hif_ahb_needs_bmi(struct hif_softc *scn) +{ + return !ce_srng_based(scn); +} diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c index c30b24e9ac..be95940351 100644 --- a/hif/src/snoc/if_snoc.c +++ b/hif/src/snoc/if_snoc.c @@ -480,3 +480,14 @@ bool hif_is_target_register_access_allowed(struct hif_softc *scn) else return true; } + +/** + * hif_snoc_needs_bmi() - return true if the soc needs bmi through the driver + * @scn: hif context + * + * Return: true if soc needs driver bmi otherwise false + */ +bool hif_snoc_needs_bmi(struct hif_softc *scn) +{ + return false; +} diff --git a/hif/src/usb/hif_usb.c b/hif/src/usb/hif_usb.c index fd7279e20a..c96b73e136 100644 --- a/hif/src/usb/hif_usb.c +++ b/hif/src/usb/hif_usb.c @@ -38,6 +38,9 @@ #define ATH_MODULE_NAME hif #include #include "qdf_module.h" +#include "hif_usb_internal.h" +#include "if_usb.h" +#include "usb_api.h" #if defined(WLAN_DEBUG) || defined(DEBUG) static ATH_DEBUG_MASK_DESCRIPTION g_hif_debug_description[] = { @@ -74,9 +77,10 @@ unsigned int hif_usb_disable_rxdata2 = 1; */ static void usb_hif_usb_transmit_complete(struct urb *urb) { - HIF_URB_CONTEXT *urb_context = (HIF_URB_CONTEXT *) urb->context; + struct HIF_URB_CONTEXT *urb_context = + (struct HIF_URB_CONTEXT *)urb->context; qdf_nbuf_t buf; - HIF_USB_PIPE *pipe = urb_context->pipe; + struct HIF_USB_PIPE *pipe = urb_context->pipe; struct hif_usb_send_context *send_context; HIF_DBG("+%s: pipe: %d, stat:%d, len:%d", __func__, @@ -103,7 +107,7 @@ static void usb_hif_usb_transmit_complete(struct urb *urb) /* note: queue implements a lock */ skb_queue_tail(&pipe->io_comp_queue, buf); - HIF_USB_SCHEDULE_WORK(pipe) + HIF_USB_SCHEDULE_WORK(pipe); HIF_DBG("-%s", __func__); } @@ -118,15 +122,15 @@ static void usb_hif_usb_transmit_complete(struct urb *urb) * * Return: QDF_STATUS_SUCCESS on success and error QDF status on failure */ -static QDF_STATUS hif_send_internal(HIF_DEVICE_USB *hif_usb_device, +static QDF_STATUS hif_send_internal(struct HIF_DEVICE_USB *hif_usb_device, uint8_t pipe_id, qdf_nbuf_t hdr_buf, qdf_nbuf_t buf, unsigned int nbytes) { QDF_STATUS status = QDF_STATUS_SUCCESS; - HIF_DEVICE_USB *device = hif_usb_device; - HIF_USB_PIPE *pipe = &device->pipes[pipe_id]; - HIF_URB_CONTEXT *urb_context; + struct HIF_DEVICE_USB *device = hif_usb_device; + struct HIF_USB_PIPE *pipe = &device->pipes[pipe_id]; + struct HIF_URB_CONTEXT *urb_context; uint8_t *data; uint32_t len; struct urb *urb; @@ -285,7 +289,7 @@ QDF_STATUS hif_send_head(struct hif_opaque_softc *scn, uint8_t pipe_id, qdf_nbuf_t wbuf, uint32_t data_attr) { QDF_STATUS status = QDF_STATUS_SUCCESS; - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); HIF_TRACE("+%s", __func__); status = hif_send_internal(device, pipe_id, NULL, wbuf, nbytes); @@ -303,7 +307,7 @@ QDF_STATUS hif_send_head(struct hif_opaque_softc *scn, uint8_t pipe_id, uint16_t hif_get_free_queue_number(struct hif_opaque_softc *scn, uint8_t pipe_id) { - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); return device->pipes[pipe_id].urb_cnt; } @@ -319,7 +323,7 @@ uint16_t hif_get_free_queue_number(struct hif_opaque_softc *scn, void hif_post_init(struct hif_opaque_softc *scn, void *target, struct hif_msg_callbacks *callbacks) { - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); qdf_mem_copy(&device->htc_callbacks, callbacks, sizeof(device->htc_callbacks)); @@ -333,7 +337,7 @@ void hif_post_init(struct hif_opaque_softc *scn, void *target, */ void hif_detach_htc(struct hif_opaque_softc *scn) { - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); usb_hif_flush_all(device); qdf_mem_zero(&device->htc_callbacks, sizeof(device->htc_callbacks)); @@ -347,7 +351,7 @@ void hif_detach_htc(struct hif_opaque_softc *scn) */ void hif_usb_device_deinit(struct hif_usb_softc *sc) { - HIF_DEVICE_USB *device = &sc->hif_hdl; + struct HIF_DEVICE_USB *device = &sc->hif_hdl; HIF_TRACE("+%s", __func__); @@ -373,11 +377,11 @@ void hif_usb_device_deinit(struct hif_usb_softc *sc) QDF_STATUS hif_usb_device_init(struct hif_usb_softc *sc) { int i; - HIF_DEVICE_USB *device = &sc->hif_hdl; + struct HIF_DEVICE_USB *device = &sc->hif_hdl; struct usb_interface *interface = sc->interface; struct usb_device *dev = interface_to_usbdev(interface); QDF_STATUS status = QDF_STATUS_SUCCESS; - HIF_USB_PIPE *pipe; + struct HIF_USB_PIPE *pipe; HIF_TRACE("+%s", __func__); @@ -435,7 +439,7 @@ QDF_STATUS hif_usb_device_init(struct hif_usb_softc *sc) */ QDF_STATUS hif_start(struct hif_opaque_softc *scn) { - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); int i; HIF_TRACE("+%s", __func__); @@ -459,7 +463,7 @@ QDF_STATUS hif_start(struct hif_opaque_softc *scn) */ void hif_usb_stop_device(struct hif_softc *hif_sc) { - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(hif_sc); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(hif_sc); HIF_TRACE("+%s", __func__); @@ -625,13 +629,13 @@ int hif_map_service_to_pipe(struct hif_opaque_softc *scn, uint16_t svc_id, * * Return: QDF_STATUS_SUCCESS if success else an appropriate QDF_STATUS error */ -static QDF_STATUS hif_ctrl_msg_exchange(HIF_DEVICE_USB *macp, - uint8_t send_req_val, - uint8_t *send_msg, - uint32_t len, - uint8_t response_req_val, - uint8_t *response_msg, - uint32_t *response_len) +static QDF_STATUS hif_ctrl_msg_exchange(struct HIF_DEVICE_USB *macp, + uint8_t send_req_val, + uint8_t *send_msg, + uint32_t len, + uint8_t response_req_val, + uint8_t *response_msg, + uint32_t *response_len) { QDF_STATUS status; @@ -681,7 +685,7 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *scn, uint32_t *bmi_response_lengthp, uint32_t timeout_ms) { - HIF_DEVICE_USB *macp = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *macp = HIF_GET_USB_DEVICE(scn); return hif_ctrl_msg_exchange(macp, USB_CONTROL_REQ_SEND_BMI_CMD, @@ -702,7 +706,7 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *scn, QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *scn, uint32_t address, uint32_t *data) { - HIF_DEVICE_USB *macp = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *macp = HIF_GET_USB_DEVICE(scn); QDF_STATUS status; USB_CTRL_DIAG_CMD_READ *cmd; uint32_t respLength; @@ -745,7 +749,7 @@ QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *scn, uint32_t address, uint32_t data) { - HIF_DEVICE_USB *macp = HIF_GET_USB_DEVICE(scn); + struct HIF_DEVICE_USB *macp = HIF_GET_USB_DEVICE(scn); USB_CTRL_DIAG_CMD_WRITE *cmd; cmd = (USB_CTRL_DIAG_CMD_WRITE *) macp->diag_cmd_buffer; @@ -769,8 +773,8 @@ QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *scn, */ void hif_dump_info(struct hif_opaque_softc *scn) { - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); - HIF_USB_PIPE *pipe = NULL; + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); + struct HIF_USB_PIPE *pipe = NULL; struct usb_host_interface *iface_desc = NULL; struct usb_endpoint_descriptor *ep_desc; uint8_t i = 0; @@ -918,7 +922,7 @@ void hif_suspend_wow(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); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn); device->is_bundle_enabled = enabled; device->rx_bundle_cnt = rx_bundle_cnt; diff --git a/hif/src/usb/if_usb.c b/hif/src/usb/if_usb.c index 6bd64857e2..1d6f03f3ae 100644 --- a/hif/src/usb/if_usb.c +++ b/hif/src/usb/if_usb.c @@ -36,6 +36,7 @@ #include "epping_main.h" #include "hif_main.h" #include "qwlan_version.h" +#include "usb_api.h" #define DELAY_FOR_TARGET_READY 200 /* 200ms */ @@ -327,7 +328,7 @@ void hif_usb_disable_bus(struct hif_softc *hif_ctx) int hif_usb_bus_suspend(struct hif_softc *hif_ctx) { struct hif_usb_softc *sc = HIF_GET_USB_SOFTC(hif_ctx); - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(hif_ctx); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(hif_ctx); HIF_ENTER(); sc->suspend_state = 1; @@ -348,7 +349,7 @@ int hif_usb_bus_suspend(struct hif_softc *hif_ctx) int hif_usb_bus_resume(struct hif_softc *hif_ctx) { struct hif_usb_softc *sc = HIF_GET_USB_SOFTC(hif_ctx); - HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(hif_ctx); + struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(hif_ctx); HIF_ENTER(); sc->suspend_state = 0; @@ -723,3 +724,13 @@ int hif_check_fw_reg(struct hif_opaque_softc *scn) } #endif +/** + * hif_usb_needs_bmi() - return true if the soc needs bmi through the driver + * @scn: hif context + * + * Return: true if soc needs driver bmi otherwise false + */ +bool hif_usb_needs_bmi(struct hif_softc *scn) +{ + return true; +} diff --git a/hif/src/usb/if_usb.h b/hif/src/usb/if_usb.h index 7d05c567df..b60b642bc4 100644 --- a/hif/src/usb/if_usb.h +++ b/hif/src/usb/if_usb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -108,7 +108,7 @@ struct HIF_USB_PIPE { uint32_t flags; uint8_t ep_address; uint8_t logical_pipe_num; - struct _HIF_DEVICE_USB *device; + struct HIF_DEVICE_USB *device; uint16_t max_packet_size; #ifdef HIF_USB_TASKLET struct tasklet_struct io_complete_tasklet; @@ -138,7 +138,7 @@ struct HIF_DEVICE_USB { }; struct hif_usb_softc { - struct _HIF_DEVICE_USB hif_hdl; + struct HIF_DEVICE_USB hif_hdl; /* For efficiency, should be first in struct */ struct device *dev; struct usb_dev *pdev; @@ -159,4 +159,20 @@ struct hif_usb_softc { /* enable FW self-recovery for Rome USB */ bool enable_self_recovery; }; + +/** + * hif_dump_info() - dump info about all HIF pipes and endpoints + * @scn: pointer to hif_opaque_softc + * + * Return: none + */ +void hif_dump_info(struct hif_opaque_softc *scn); + +/** + * hif_suspend_wow() - Send wow suspend command + * @scn: pointer to hif_opaque_softc + * + * Return: none + */ +void hif_suspend_wow(struct hif_opaque_softc *scn); #endif /* __ATH_USB_H__ */ diff --git a/hif/src/usb/usbdrv.c b/hif/src/usb/usbdrv.c index e2d0935ee5..c19322c4e5 100644 --- a/hif/src/usb/usbdrv.c +++ b/hif/src/usb/usbdrv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -245,7 +245,7 @@ static void usb_hif_free_pipe_resources(struct HIF_USB_PIPE *pipe) * Return: uint8_t pipe number corresponding to ep_address */ static uint8_t usb_hif_get_logical_pipe_num - (HIF_DEVICE_USB *device, + (struct HIF_DEVICE_USB *device, uint8_t ep_address, int *urb_count) { @@ -298,7 +298,7 @@ static uint8_t usb_hif_get_logical_pipe_num * * Return: QDF_STATUS_SUCCESS if success else an appropriate QDF_STATUS error */ -QDF_STATUS usb_hif_setup_pipe_resources(HIF_DEVICE_USB *device) +QDF_STATUS usb_hif_setup_pipe_resources(struct HIF_DEVICE_USB *device) { struct usb_interface *interface = device->interface; struct usb_host_interface *iface_desc = interface->cur_altsetting; @@ -409,7 +409,7 @@ QDF_STATUS usb_hif_setup_pipe_resources(HIF_DEVICE_USB *device) * * Return: none */ -void usb_hif_cleanup_pipe_resources(HIF_DEVICE_USB *device) +void usb_hif_cleanup_pipe_resources(struct HIF_DEVICE_USB *device) { int i; @@ -453,7 +453,7 @@ static void usb_hif_flush_pending_transfers(struct HIF_USB_PIPE *pipe) * * Return: none */ -void usb_hif_flush_all(HIF_DEVICE_USB *device) +void usb_hif_flush_all(struct HIF_DEVICE_USB *device) { int i; struct HIF_USB_PIPE *pipe; @@ -1011,7 +1011,7 @@ static void usb_hif_post_recv_bundle_transfers(struct HIF_USB_PIPE *recv_pipe, * * Return: none */ -void usb_hif_prestart_recv_pipes(HIF_DEVICE_USB *device) +void usb_hif_prestart_recv_pipes(struct HIF_DEVICE_USB *device) { struct HIF_USB_PIPE *pipe = &device->pipes[HIF_RX_DATA_PIPE]; @@ -1032,7 +1032,7 @@ void usb_hif_prestart_recv_pipes(HIF_DEVICE_USB *device) * * Return: none */ -void usb_hif_start_recv_pipes(HIF_DEVICE_USB *device) +void usb_hif_start_recv_pipes(struct HIF_DEVICE_USB *device) { struct HIF_USB_PIPE *pipe; uint32_t buf_len; @@ -1076,12 +1076,9 @@ void usb_hif_start_recv_pipes(HIF_DEVICE_USB *device) * * Return: QDF_STATUS_SUCCESS if success else an appropriate QDF_STATUS error */ -QDF_STATUS usb_hif_submit_ctrl_out(HIF_DEVICE_USB *device, - uint8_t req, - uint16_t value, - uint16_t index, - void *data, - uint32_t size) +QDF_STATUS usb_hif_submit_ctrl_out(struct HIF_DEVICE_USB *device, + uint8_t req, uint16_t value, uint16_t index, + void *data, uint32_t size) { int32_t result = 0; QDF_STATUS ret = QDF_STATUS_SUCCESS; @@ -1132,12 +1129,9 @@ QDF_STATUS usb_hif_submit_ctrl_out(HIF_DEVICE_USB *device, * * Return: QDF_STATUS_SUCCESS if success else an appropriate QDF_STATUS error */ -QDF_STATUS usb_hif_submit_ctrl_in(HIF_DEVICE_USB *device, - uint8_t req, - uint16_t value, - uint16_t index, - void *data, - uint32_t size) +QDF_STATUS usb_hif_submit_ctrl_in(struct HIF_DEVICE_USB *device, + uint8_t req, uint16_t value, uint16_t index, + void *data, uint32_t size) { int32_t result = 0; QDF_STATUS ret = QDF_STATUS_SUCCESS; @@ -1185,10 +1179,10 @@ QDF_STATUS usb_hif_submit_ctrl_in(HIF_DEVICE_USB *device, * * Return: none */ -void usb_hif_io_complete(struct HIF_USB_PIPE *pipe) +static void usb_hif_io_complete(struct HIF_USB_PIPE *pipe) { qdf_nbuf_t buf; - HIF_DEVICE_USB *device; + struct HIF_DEVICE_USB *device; HTC_FRAME_HDR *HtcHdr; uint8_t *data; uint32_t len; diff --git a/htc/htc_send.c b/htc/htc_send.c index 376454a188..16ad4ac293 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -1633,7 +1633,7 @@ QDF_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket, QDF_NBUF_UPDATE_TX_PKT_COUNT(netbuf, QDF_NBUF_TX_PKT_HTC); DPTRACE(qdf_dp_trace(netbuf, QDF_DP_TRACE_HTC_PACKET_PTR_RECORD, - qdf_nbuf_data_addr(netbuf), + QDF_TRACE_DEFAULT_PDEV_ID, qdf_nbuf_data_addr(netbuf), sizeof(qdf_nbuf_data(netbuf)), QDF_TX)); } else { LOCK_HTC_TX(target);