qcacmn: HIF: Use PLD APIs

PLD is a interface between CLD and CNSS/ICNSS. It hides
CNSS/ICNSS APIs from CLD and provides a set of common APIs.
CLD modules should use these PLD APIs instead of calling
CNSS/ICNSS platform APIs.
Replace all CNSS/ICNSS APIs with PLD APIs in HIF.

CRs-Fixed: 1010692
Change-Id: I4018a4b7e08179f9c65a19fde61727228e876762
This commit is contained in:
Yuanyuan Liu 2016-04-25 13:59:19 -07:00 • committed by Gerrit - the friendly Code Review server
commit fd594c2455
9 changed files with 42 additions and 68 deletions

View file

@ -39,9 +39,6 @@
#include "hif_main.h"
#include "ce_api.h"
#include "qdf_trace.h"
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "hif_debug.h"
/* Track a BMI transaction that is in progress */

View file

@ -38,9 +38,6 @@
#include "hif_main.h"
#include "ce_api.h"
#include "qdf_trace.h"
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "hif_debug.h"
void

View file

@ -38,15 +38,12 @@
#include "hif_main.h"
#include "ce_api.h"
#include "qdf_trace.h"
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "pld_common.h"
#include "hif_debug.h"
#include "ce_internal.h"
#include "ce_reg.h"
#include "ce_assignment.h"
#include "ce_tasklet.h"
#include "platform_icnss.h"
#ifndef CONFIG_WIN
#include "qwlan_version.h"
#endif
@ -1942,8 +1939,8 @@ void hif_get_target_ce_config(struct CE_pipe_config **target_ce_config_ret,
*/
int hif_wlan_enable(struct hif_softc *scn)
{
struct icnss_wlan_enable_cfg cfg;
enum icnss_driver_mode mode;
struct pld_wlan_enable_cfg cfg;
enum pld_driver_mode mode;
uint32_t con_mode = hif_get_conparam(scn);
hif_get_target_ce_config((struct CE_pipe_config **)&cfg.ce_tgt_cfg,
@ -1959,16 +1956,17 @@ int hif_wlan_enable(struct hif_softc *scn)
cfg.num_shadow_reg_cfg /= sizeof(struct shadow_reg_cfg);
if (QDF_GLOBAL_FTM_MODE == con_mode)
mode = ICNSS_FTM;
mode = PLD_FTM;
else if (QDF_IS_EPPING_ENABLED(con_mode))
mode = ICNSS_EPPING;
mode = PLD_EPPING;
else
mode = ICNSS_MISSION;
mode = PLD_MISSION;
if (BYPASS_QMI)
return 0;
else
return icnss_wlan_enable(&cfg, mode, QWLAN_VERSIONSTR);
return pld_wlan_enable(scn->qdf_dev->dev, &cfg,
mode, QWLAN_VERSIONSTR);
}
#define CE_EPPING_USES_IRQ true
@ -2916,15 +2914,15 @@ irqreturn_t hif_fw_interrupt_handler(int irq, void *arg)
*/
void hif_wlan_disable(struct hif_softc *scn)
{
enum icnss_driver_mode mode;
enum pld_driver_mode mode;
uint32_t con_mode = hif_get_conparam(scn);
if (QDF_GLOBAL_FTM_MODE == con_mode)
mode = ICNSS_FTM;
mode = PLD_FTM;
else if (QDF_IS_EPPING_ENABLED(con_mode))
mode = ICNSS_EPPING;
mode = PLD_EPPING;
else
mode = ICNSS_MISSION;
mode = PLD_MISSION;
icnss_wlan_disable(mode);
pld_wlan_disable(scn->qdf_dev->dev, mode);
}

View file

@ -40,10 +40,7 @@
#include "ce_reg.h"
#include "ce_internal.h"
#include "ce_tasklet.h"
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "platform_icnss.h"
#include "pld_common.h"
#include "hif_debug.h"
#include "hif_napi.h"
@ -308,7 +305,10 @@ static bool hif_fake_aps_resume(void)
static irqreturn_t hif_snoc_interrupt_handler(int irq, void *context)
{
struct ce_tasklet_entry *tasklet_entry = context;
return ce_dispatch_interrupt(icnss_get_ce_id(irq), tasklet_entry);
struct hif_softc *scn = HIF_GET_SOFTC(tasklet_entry->hif_ce_state);
return ce_dispatch_interrupt(pld_get_ce_id(scn->qdf_dev->dev, irq),
tasklet_entry);
}
/**
@ -416,7 +416,7 @@ irqreturn_t ce_dispatch_interrupt(int ce_id,
*
* @ce_name: ce_name
*/
const char *ce_name[ICNSS_MAX_IRQ_REGISTRATIONS] = {
const char *ce_name[] = {
"WLAN_CE_0",
"WLAN_CE_1",
"WLAN_CE_2",
@ -445,20 +445,23 @@ QDF_STATUS ce_unregister_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask)
int id;
int ce_count;
int ret;
struct hif_softc *scn;
if (hif_ce_state == NULL) {
HIF_WARN("%s: hif_ce_state = NULL", __func__);
return QDF_STATUS_SUCCESS;
}
ce_count = HIF_GET_SOFTC(hif_ce_state)->ce_count;
scn = HIF_GET_SOFTC(hif_ce_state);
ce_count = scn->ce_count;
for (id = 0; id < ce_count; id++) {
if ((mask & (1 << id)) && hif_ce_state->tasklets[id].inited) {
ret = icnss_ce_free_irq(id,
ret = pld_ce_free_irq(scn->qdf_dev->dev, id,
&hif_ce_state->tasklets[id]);
if (ret < 0)
HIF_ERROR(
"%s: icnss_unregister_irq error - ce_id = %d, ret = %d",
"%s: pld_unregister_irq error - ce_id = %d, ret = %d",
__func__, id, ret);
}
}
@ -477,14 +480,17 @@ QDF_STATUS ce_unregister_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask)
QDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask)
{
int id;
int ce_count = HIF_GET_SOFTC(hif_ce_state)->ce_count;
int ce_count;
int ret;
unsigned long irqflags = IRQF_TRIGGER_RISING;
uint32_t done_mask = 0;
struct hif_softc *scn = HIF_GET_SOFTC(hif_ce_state);
ce_count = scn->ce_count;
for (id = 0; id < ce_count; id++) {
if ((mask & (1 << id)) && hif_ce_state->tasklets[id].inited) {
ret = icnss_ce_request_irq(id,
ret = pld_ce_request_irq(scn->qdf_dev->dev, id,
hif_snoc_interrupt_handler,
irqflags, ce_name[id],
&hif_ce_state->tasklets[id]);

View file

@ -41,13 +41,9 @@
#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
#include "ce_api.h"
#include "ce_tasklet.h"
#include "platform_icnss.h"
#endif
#include "qdf_trace.h"
#include "qdf_status.h"
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "hif_debug.h"
#include "mp_dev.h"

View file

@ -47,16 +47,11 @@
#include <linux/seq_file.h>
#include "qdf_status.h"
#include "qdf_atomic.h"
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#else
#include "cnss_stub.h"
#endif
#include "pld_common.h"
#include "mp_dev.h"
#include "hif_debug.h"
#include "if_pci_internal.h"
#include "icnss_stub.h"
#include "ce_tasklet.h"
#include "targaddrs.h"
@ -88,19 +83,6 @@ struct ce_irq_reg_table {
uint32_t irq_status;
};
#if !defined(QCA_WIFI_3_0_ADRASTEA)
static inline void cnss_intr_notify_q6(void)
{
}
#endif
#if !defined(QCA_WIFI_3_0_ADRASTEA)
static inline void *cnss_get_target_smem(void)
{
return NULL;
}
#endif
#ifndef QCA_WIFI_3_0_ADRASTEA
static inline void hif_pci_route_adrastea_interrupt(struct hif_pci_softc *sc)
{
@ -124,7 +106,7 @@ void hif_pci_route_adrastea_interrupt(struct hif_pci_softc *sc)
hif_write32_mb(sc->mem + Q6_ENABLE_REGISTER_1, 0);
if (scn->notice_send)
cnss_intr_notify_q6();
pld_intr_notify_q6(sc->dev);
}
}
#endif
@ -1130,7 +1112,7 @@ static void hif_pm_runtime_start(struct hif_pci_softc *sc)
HIF_INFO("%s: Enabling RUNTIME PM, Delay: %d ms", __func__,
ol_sc->hif_config.runtime_pm_delay);
cnss_runtime_init(sc->dev, ol_sc->hif_config.runtime_pm_delay);
pld_runtime_init(sc->dev, ol_sc->hif_config.runtime_pm_delay);
qdf_atomic_set(&sc->pm_state, HIF_PM_RUNTIME_STATE_ON);
hif_runtime_pm_debugfs_create(sc);
}
@ -1153,7 +1135,7 @@ static void hif_pm_runtime_stop(struct hif_pci_softc *sc)
if (mode == QDF_GLOBAL_FTM_MODE || QDF_IS_EPPING_ENABLED(mode))
return;
cnss_runtime_exit(sc->dev);
pld_runtime_exit(sc->dev);
hif_pm_runtime_resume(sc->dev);
qdf_atomic_set(&sc->pm_state, HIF_PM_RUNTIME_STATE_NONE);
@ -2496,7 +2478,7 @@ static void hif_runtime_prevent_linkdown(struct hif_softc *scn, bool flag)
}
#endif
#if defined(CONFIG_CNSS) && defined(CONFIG_PCI_MSM)
#if defined(CONFIG_PCI_MSM)
/**
* hif_bus_prevent_linkdown(): allow or permit linkdown
* @flag: true prevents linkdown, false allows
@ -2511,7 +2493,7 @@ void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag)
HIF_ERROR("wlan: %s pcie power collapse",
(flag ? "disable" : "enable"));
hif_runtime_prevent_linkdown(scn, flag);
cnss_wlan_pm_control(flag);
pld_wlan_pm_control(scn->qdf_dev->dev, flag);
}
#else
void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag)
@ -3064,7 +3046,7 @@ static int hif_log_soc_wakeup_timeout(struct hif_pci_softc *sc)
if (cbk->set_recovery_in_progress)
cbk->set_recovery_in_progress(cbk->context, true);
cnss_wlan_pci_link_down();
pld_is_pci_link_down(sc->dev);
return -EACCES;
}

View file

@ -191,7 +191,6 @@ irqreturn_t hif_pci_interrupt_handler(int irq, void *arg);
#ifdef FEATURE_RUNTIME_PM
#include <linux/pm_runtime.h>
#ifdef WLAN_OPEN_SOURCE
static inline int hif_pm_request_resume(struct device *dev)
{
return pm_request_resume(dev);
@ -215,7 +214,6 @@ static inline int hif_pm_runtime_resume(struct device *dev)
{
return pm_runtime_resume(dev);
}
#endif
#else
static inline void hif_pm_runtime_mark_last_busy(struct device *dev) { }
#endif /* FEATURE_RUNTIME_PM */

View file

@ -38,7 +38,6 @@
#include "regtable.h"
#include "ce_reg.h"
#include "qdf_atomic.h"
#include <soc/qcom/icnss.h>
#include "hif_main.h"
#include "hif_debug.h"

View file

@ -38,6 +38,7 @@
#include "ce_main.h"
#include "ce_tasklet.h"
#include "snoc_api.h"
#include "pld_common.h"
/**
* hif_disable_isr(): disable isr
@ -130,13 +131,13 @@ QDF_STATUS hif_snoc_open(struct hif_softc *hif_ctx, enum qdf_bus_type bus_type)
static QDF_STATUS hif_snoc_get_soc_info(struct hif_softc *scn)
{
int ret;
struct icnss_soc_info soc_info;
struct pld_soc_info soc_info;
qdf_mem_zero(&soc_info, sizeof(soc_info));
ret = icnss_get_soc_info(&soc_info);
ret = pld_get_soc_info(scn->qdf_dev->dev, &soc_info);
if (ret < 0) {
HIF_ERROR("%s: icnss_get_soc_info error = %d", __func__, ret);
HIF_ERROR("%s: pld_get_soc_info error = %d", __func__, ret);
return QDF_STATUS_E_FAILURE;
}
@ -192,7 +193,7 @@ static inline int hif_snoc_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)
{
/* TODO: need to use CNSS's HW version. Hard code for now */
/* TODO: need to use HW version. Hard code for now */
#ifdef QCA_WIFI_3_0_ADRASTEA
*hif_type = HIF_TYPE_ADRASTEA;
*target_type = TARGET_TYPE_ADRASTEA;