diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c index d0557adc46c8..449645d2b94e 100644 --- a/hif/src/ce/ce_tasklet.c +++ b/hif/src/ce/ce_tasklet.c @@ -220,7 +220,7 @@ static void ce_tasklet(unsigned long data) } if (scn->target_status != OL_TRGET_STATUS_RESET) - ce_irq_enable(scn, tasklet_entry->ce_id); + hif_irq_enable(scn, tasklet_entry->ce_id); hif_record_ce_desc_event(scn, tasklet_entry->ce_id, HIF_CE_TASKLET_EXIT, NULL, NULL, 0); @@ -297,7 +297,7 @@ static irqreturn_t ce_irq_handler(int irq, void *context) #ifndef HIF_PCI disable_irq_nosync(irq); #endif - ce_irq_disable(scn, ce_id); + hif_irq_disable(scn, ce_id); ce_irq_status(scn, ce_id, &host_status); qdf_atomic_inc(&scn->active_tasklet_cnt); hif_record_ce_desc_event(scn, ce_id, HIF_IRQ_EVENT, NULL, NULL, 0); diff --git a/hif/src/dispatcher/multibus.c b/hif/src/dispatcher/multibus.c index 601f45ca7f86..7ab537e9d4a1 100644 --- a/hif/src/dispatcher/multibus.c +++ b/hif/src/dispatcher/multibus.c @@ -158,3 +158,41 @@ int hif_target_sleep_state_adjust(struct hif_softc *hif_sc, return hif_sc->bus_ops.hif_target_sleep_state_adjust(hif_sc, sleep_ok, wait_for_it); } + +void hif_disable_isr(struct hif_opaque_softc *hif_hdl) +{ + struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl); + hif_sc->bus_ops.hif_disable_isr(hif_sc); +} + +void hif_nointrs(struct hif_softc *hif_sc) +{ + hif_sc->bus_ops.hif_nointrs(hif_sc); +} + +QDF_STATUS hif_enable_bus(struct hif_softc *hif_sc, struct device *dev, + void *bdev, const hif_bus_id *bid, + enum hif_enable_type type) +{ + return hif_sc->bus_ops.hif_enable_bus(hif_sc, dev, bdev, bid, type); +} + +void hif_disable_bus(struct hif_softc *hif_sc) +{ + hif_sc->bus_ops.hif_disable_bus(hif_sc); +} + +int hif_bus_configure(struct hif_softc *hif_sc) +{ + return hif_sc->bus_ops.hif_bus_configure(hif_sc); +} + +void hif_irq_enable(struct hif_softc *hif_sc, int irq_id) +{ + hif_sc->bus_ops.hif_irq_enable(hif_sc, irq_id); +} + +void hif_irq_disable(struct hif_softc *hif_sc, int irq_id) +{ + hif_sc->bus_ops.hif_irq_disable(hif_sc, irq_id); +} diff --git a/hif/src/dispatcher/multibus.h b/hif/src/dispatcher/multibus.h index d9083a0cfafd..2af5494aa00d 100644 --- a/hif/src/dispatcher/multibus.h +++ b/hif/src/dispatcher/multibus.h @@ -43,7 +43,16 @@ struct hif_bus_ops { int (*hif_bus_suspend)(struct hif_softc *hif_ctx); int (*hif_bus_resume)(struct hif_softc *hif_ctx); int (*hif_target_sleep_state_adjust)(struct hif_softc *scn, - bool sleep_ok, bool wait_for_it); + bool sleep_ok, bool wait_for_it); + void (*hif_disable_isr)(struct hif_softc *hif_sc); + void (*hif_nointrs)(struct hif_softc *hif_sc); + QDF_STATUS (*hif_enable_bus)(struct hif_softc *hif_sc, + struct device *dev, void *bdev, const hif_bus_id *bid, + enum hif_enable_type type); + void (*hif_disable_bus)(struct hif_softc *hif_sc); + int (*hif_bus_configure)(struct hif_softc *hif_sc); + void (*hif_irq_disable)(struct hif_softc *hif_sc, int ce_id); + void (*hif_irq_enable)(struct hif_softc *hif_sc, int ce_id); }; #ifdef HIF_SNOC diff --git a/hif/src/dispatcher/multibus_pci.c b/hif/src/dispatcher/multibus_pci.c index 5bd9601307e6..571014ef18ee 100644 --- a/hif/src/dispatcher/multibus_pci.c +++ b/hif/src/dispatcher/multibus_pci.c @@ -59,5 +59,13 @@ QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc) bus_ops->hif_target_sleep_state_adjust = &hif_dummy_target_sleep_state_adjust; + bus_ops->hif_disable_isr = &hif_pci_disable_isr; + bus_ops->hif_nointrs = &hif_pci_nointrs; + bus_ops->hif_enable_bus = &hif_pci_enable_bus; + bus_ops->hif_disable_bus = &hif_pci_disable_bus; + bus_ops->hif_bus_configure = &hif_pci_bus_configure; + bus_ops->hif_irq_disable = &hif_pci_irq_disable; + bus_ops->hif_irq_enable = &hif_pci_irq_enable; + return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/multibus_snoc.c b/hif/src/dispatcher/multibus_snoc.c index 3b9fd18aeb4f..b5bb3dde098c 100644 --- a/hif/src/dispatcher/multibus_snoc.c +++ b/hif/src/dispatcher/multibus_snoc.c @@ -25,9 +25,9 @@ * to the Linux Foundation. */ -#include "multibus.h" #include "hif.h" #include "hif_main.h" +#include "multibus.h" #include "snoc_api.h" #include "dummy.h" @@ -48,5 +48,13 @@ QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops) bus_ops->hif_target_sleep_state_adjust = &hif_dummy_target_sleep_state_adjust; + bus_ops->hif_disable_isr = &hif_snoc_disable_isr; + bus_ops->hif_nointrs = &hif_snoc_nointrs; + bus_ops->hif_enable_bus = &hif_snoc_enable_bus; + bus_ops->hif_disable_bus = &hif_snoc_disable_bus; + bus_ops->hif_bus_configure = &hif_snoc_bus_configure; + bus_ops->hif_irq_disable = &hif_snoc_irq_disable; + bus_ops->hif_irq_enable = &hif_snoc_irq_enable; + return QDF_STATUS_SUCCESS; } diff --git a/hif/src/dispatcher/pci_api.h b/hif/src/dispatcher/pci_api.h index 4f6b8e7cd666..fcf426cbaa7c 100644 --- a/hif/src/dispatcher/pci_api.h +++ b/hif/src/dispatcher/pci_api.h @@ -33,4 +33,15 @@ void hif_pci_reset_soc(struct hif_softc *ol_sc); int hif_pci_bus_suspend(struct hif_softc *scn); int hif_pci_bus_resume(struct hif_softc *scn); int hif_pci_target_sleep_state_adjust(struct hif_softc *scn, - bool sleep_ok, bool wait_for_it); + bool sleep_ok, bool wait_for_it); + +void hif_pci_disable_isr(struct hif_softc *scn); +void hif_pci_nointrs(struct hif_softc *scn); +QDF_STATUS hif_pci_enable_bus(struct hif_softc *scn, + struct device *dev, void *bdev, + const hif_bus_id *bid, + enum hif_enable_type type); +void hif_pci_disable_bus(struct hif_softc *scn); +int hif_pci_bus_configure(struct hif_softc *scn); +void hif_pci_irq_disable(struct hif_softc *scn, int ce_id); +void hif_pci_irq_enable(struct hif_softc *scn, int ce_id); diff --git a/hif/src/dispatcher/snoc_api.h b/hif/src/dispatcher/snoc_api.h index ff4dfd70b419..2ff3f7664fa1 100644 --- a/hif/src/dispatcher/snoc_api.h +++ b/hif/src/dispatcher/snoc_api.h @@ -28,3 +28,15 @@ QDF_STATUS hif_snoc_open(struct hif_softc *hif_ctx, enum qdf_bus_type bus_type); void hif_snoc_close(struct hif_softc *hif_ctx); + + +void hif_snoc_disable_isr(struct hif_softc *hif_ctx); +void hif_snoc_nointrs(struct hif_softc *scn); +QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc, + struct device *dev, void *bdev, + const hif_bus_id *bid, + enum hif_enable_type type); +void hif_snoc_disable_bus(struct hif_softc *scn); +int hif_snoc_bus_configure(struct hif_softc *scn); +void hif_snoc_irq_disable(struct hif_softc *scn, int ce_id); +void hif_snoc_irq_enable(struct hif_softc *scn, int ce_id); diff --git a/hif/src/hif_io32.h b/hif/src/hif_io32.h index a1596321fd26..747b6e428288 100644 --- a/hif/src/hif_io32.h +++ b/hif/src/hif_io32.h @@ -103,5 +103,8 @@ void hif_target_write_checked(struct hif_softc *scn, uint32_t offset, hif_write32_mb((scn->mem) + (offset), value) #endif +void hif_irq_enable(struct hif_softc *scn, int irq_id); +void hif_irq_disable(struct hif_softc *scn, int irq_id); + #endif /* __HIF_IO32_H__ */ diff --git a/hif/src/hif_napi.c b/hif/src/hif_napi.c index 58635cba9a87..6e8492766a53 100644 --- a/hif/src/hif_napi.c +++ b/hif/src/hif_napi.c @@ -362,7 +362,7 @@ inline void hif_napi_enable_irq(struct hif_opaque_softc *hif, int id) { struct hif_softc *scn = HIF_GET_SOFTC(hif); - ce_irq_enable(scn, NAPI_ID2PIPE(id)); + hif_irq_enable(scn, NAPI_ID2PIPE(id)); } diff --git a/hif/src/pcie/hif_io32_pci.h b/hif/src/pcie/hif_io32_pci.h index 3df0e6f817d2..ce2c22faa246 100644 --- a/hif/src/pcie/hif_io32_pci.h +++ b/hif/src/pcie/hif_io32_pci.h @@ -73,58 +73,5 @@ #define CONFIG_PCIE_ENABLE_AXI_CLK_GATE 0 irqreturn_t hif_fw_interrupt_handler(int irq, void *arg); - -/** - * ce_irq_enable() - ce_irq_enable - * @scn: hif_softc - * @ce_id: ce_id - * - * Return: void - */ -static inline void ce_irq_enable(struct hif_softc *scn, int ce_id) -{ - uint32_t tmp = 1 << ce_id; - struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); - - qdf_spin_lock_irqsave(&sc->irq_lock); - scn->ce_irq_summary &= ~tmp; - if (scn->ce_irq_summary == 0) { - /* Enable Legacy PCI line interrupts */ - if (LEGACY_INTERRUPTS(sc) && - (scn->target_status != OL_TRGET_STATUS_RESET) && - (!qdf_atomic_read(&scn->link_suspended))) { - - hif_write32_mb(scn->mem + - (SOC_CORE_BASE_ADDRESS | - PCIE_INTR_ENABLE_ADDRESS), - HOST_GROUP0_MASK); - - hif_read32_mb(scn->mem + - (SOC_CORE_BASE_ADDRESS | - PCIE_INTR_ENABLE_ADDRESS)); - } - } - if (scn->hif_init_done == true) - Q_TARGET_ACCESS_END(scn); - - qdf_spin_unlock_irqrestore(&sc->irq_lock); - - /* check for missed firmware crash */ - hif_fw_interrupt_handler(0, scn); -} -/** - * ce_irq_disable() - ce_irq_disable - * @scn: hif_softc - * @ce_id: ce_id - * - * Return: void - */ -static inline void ce_irq_disable(struct hif_softc *scn, int ce_id) -{ - /* For Rome only need to wake up target */ - /* target access is maintained untill interrupts are re-enabled */ - Q_TARGET_ACCESS_BEGIN(scn); - -} #endif /* HIF_PCI */ #endif /* __HIF_IO32_PCI_H__ */ diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 040762727e6a..c0b589c7300c 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -1693,7 +1693,7 @@ done: * * return: 0 for success. nonzero for failure. */ -int hif_bus_configure(struct hif_softc *hif_sc) +int hif_pci_bus_configure(struct hif_softc *hif_sc) { int status = 0; struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(hif_sc); @@ -2156,7 +2156,7 @@ end: * * Return: none */ -void hif_nointrs(struct hif_softc *scn) +void hif_pci_nointrs(struct hif_softc *scn) { int i; struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); @@ -2187,7 +2187,7 @@ void hif_nointrs(struct hif_softc *scn) * * Return: none */ -void hif_disable_bus(struct hif_softc *scn) +void hif_pci_disable_bus(struct hif_softc *scn) { struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); struct pci_dev *pdev = sc->pdev; @@ -2727,9 +2727,8 @@ static void hif_free_msi_ctx(struct hif_softc *scn) } #endif -void hif_disable_isr(struct hif_opaque_softc *ol_sc) +void hif_pci_disable_isr(struct hif_softc *scn) { - struct hif_softc *scn = HIF_GET_SOFTC(ol_sc); struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); hif_nointrs(scn); @@ -3169,7 +3168,7 @@ void hif_target_sync(struct hif_softc *scn) * type: enum hif_enable_type such as HIF_ENABLE_TYPE_PROBE * Return: QDF_STATUS */ -QDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, +QDF_STATUS hif_pci_enable_bus(struct hif_softc *ol_sc, struct device *dev, void *bdev, const hif_bus_id *bid, enum hif_enable_type type) @@ -3298,6 +3297,57 @@ int hif_get_target_type(struct hif_softc *ol_sc, struct device *dev, hif_type, target_type); } +/** + * hif_pci_irq_enable() - ce_irq_enable + * @scn: hif_softc + * @ce_id: ce_id + * + * Return: void + */ +void hif_pci_irq_enable(struct hif_softc *scn, int ce_id) +{ + uint32_t tmp = 1 << ce_id; + struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); + + qdf_spin_lock_irqsave(&sc->irq_lock); + scn->ce_irq_summary &= ~tmp; + if (scn->ce_irq_summary == 0) { + /* Enable Legacy PCI line interrupts */ + if (LEGACY_INTERRUPTS(sc) && + (scn->target_status != OL_TRGET_STATUS_RESET) && + (!qdf_atomic_read(&scn->link_suspended))) { + + hif_write32_mb(scn->mem + + (SOC_CORE_BASE_ADDRESS | + PCIE_INTR_ENABLE_ADDRESS), + HOST_GROUP0_MASK); + + hif_read32_mb(scn->mem + + (SOC_CORE_BASE_ADDRESS | + PCIE_INTR_ENABLE_ADDRESS)); + } + } + if (scn->hif_init_done == true) + Q_TARGET_ACCESS_END(scn); + qdf_spin_unlock_irqrestore(&sc->irq_lock); + + /* check for missed firmware crash */ + hif_fw_interrupt_handler(0, scn); +} +/** + * hif_pci_irq_disable() - ce_irq_disable + * @scn: hif_softc + * @ce_id: ce_id + * + * Return: void + */ +void hif_pci_irq_disable(struct hif_softc *scn, int ce_id) +{ + /* For Rome only need to wake up target */ + /* target access is maintained untill interrupts are re-enabled */ + Q_TARGET_ACCESS_BEGIN(scn); +} + #ifdef FEATURE_RUNTIME_PM void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx) diff --git a/hif/src/snoc/hif_io32_snoc.h b/hif/src/snoc/hif_io32_snoc.h index 0769b4ab99bb..ac4383a4d7ee 100644 --- a/hif/src/snoc/hif_io32_snoc.h +++ b/hif/src/snoc/hif_io32_snoc.h @@ -126,33 +126,4 @@ static inline void ce_disable_irq_in_group_reg(struct hif_softc *scn, mask = hif_read32_mb(scn->mem + ADRASTEA_CE_INTR_ENABLES); } - -/** - * ce_irq_enable() - enable copy engine IRQ - * @scn: struct hif_softc - * @ce_id: ce_id - * - * Return: N/A - */ -static inline void ce_irq_enable(struct hif_softc *scn, - int ce_id) -{ - icnss_enable_irq(ce_id); - ce_enable_irq_in_individual_register(scn, ce_id); - ce_enable_irq_in_group_reg(scn, 1<active_tasklet_cnt, 0); @@ -155,7 +154,7 @@ static QDF_STATUS hif_snoc_get_soc_info(struct hif_softc *scn) * * return: 0 for success. nonzero for failure. */ -int hif_bus_configure(struct hif_softc *scn) +int hif_snoc_bus_configure(struct hif_softc *scn) { int ret; @@ -216,7 +215,7 @@ int hif_get_target_type(struct hif_softc *ol_sc, struct device *dev, * * Return: QDF_STATUS */ -QDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, +QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc, struct device *dev, void *bdev, const hif_bus_id *bid, enum hif_enable_type type) @@ -261,7 +260,7 @@ QDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, * * Return: none */ -void hif_disable_bus(struct hif_softc *scn) +void hif_snoc_disable_bus(struct hif_softc *scn) { } @@ -274,7 +273,7 @@ void hif_disable_bus(struct hif_softc *scn) * * Return: none */ -void hif_nointrs(struct hif_softc *scn) +void hif_snoc_nointrs(struct hif_softc *scn) { struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); if (scn->request_irq_done) { @@ -282,3 +281,32 @@ void hif_nointrs(struct hif_softc *scn) scn->request_irq_done = false; } } + +/** + * ce_irq_enable() - enable copy engine IRQ + * @scn: struct hif_softc + * @ce_id: ce_id + * + * Return: N/A + */ +void hif_snoc_irq_enable(struct hif_softc *scn, + int ce_id) +{ + icnss_enable_irq(ce_id); + ce_enable_irq_in_individual_register(scn, ce_id); + ce_enable_irq_in_group_reg(scn, 1<