diff --git a/hif/src/dispatcher/ahb_api.h b/hif/src/dispatcher/ahb_api.h index 8ba0c754d2d9..2bba2ff92d8e 100644 --- a/hif/src/dispatcher/ahb_api.h +++ b/hif/src/dispatcher/ahb_api.h @@ -26,6 +26,7 @@ void hif_ahb_close(struct hif_softc *hif_ctx); void hif_ahb_disable_isr(struct hif_softc *hif_ctx); void hif_ahb_nointrs(struct hif_softc *scn); +void hif_ahb_reset_soc(struct hif_softc *hif_ctx); QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc, struct device *dev, void *bdev, const hif_bus_id *bid, diff --git a/hif/src/dispatcher/multibus_ahb.c b/hif/src/dispatcher/multibus_ahb.c index b543e8fb420b..d1bee78d6070 100644 --- a/hif/src/dispatcher/multibus_ahb.c +++ b/hif/src/dispatcher/multibus_ahb.c @@ -38,7 +38,7 @@ QDF_STATUS hif_initialize_ahb_ops(struct hif_bus_ops *bus_ops) bus_ops->hif_bus_open = &hif_ahb_open; bus_ops->hif_bus_close = &hif_ahb_close; bus_ops->hif_bus_prevent_linkdown = &hif_dummy_bus_prevent_linkdown; - bus_ops->hif_reset_soc = &hif_dummy_reset_soc; + bus_ops->hif_reset_soc = &hif_ahb_reset_soc; bus_ops->hif_bus_suspend = &hif_dummy_bus_suspend; bus_ops->hif_bus_resume = &hif_dummy_bus_resume; bus_ops->hif_target_sleep_state_adjust = diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c index dc6077841894..6f986fd14bbe 100644 --- a/hif/src/snoc/if_ahb.c +++ b/hif/src/snoc/if_ahb.c @@ -233,15 +233,29 @@ void hif_ahb_disable_bus(struct hif_softc *scn) struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); void __iomem *mem; struct platform_device *pdev = (struct platform_device *)sc->pdev; + struct resource *memres = NULL; + int mem_pa_size = 0; /*Disable WIFI clock input*/ - hif_ahb_clk_enable_disable(&pdev->dev, 0); + if (sc->mem) { + memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!memres) { + HIF_INFO("%s: Failed to get IORESOURCE_MEM\n", + __func__); + return; + } + mem_pa_size = memres->end - memres->start + 1; - hif_ahb_device_reset(scn); - mem = (void __iomem *)sc->mem; - if (mem) { - devm_iounmap(&pdev->dev, mem); - sc->mem = NULL; + hif_ahb_clk_enable_disable(&pdev->dev, 0); + + hif_ahb_device_reset(scn); + mem = (void __iomem *)sc->mem; + if (mem) { + devm_iounmap(&pdev->dev, mem); + devm_release_mem_region(&pdev->dev, scn->mem_pa, + mem_pa_size); + sc->mem = NULL; + } } scn->mem = NULL; } @@ -324,6 +338,7 @@ QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc, sc->mem = mem; ol_sc->mem = mem; ol_sc->mem_pa = memres->start; + tgt_info = hif_get_target_info_handle((struct hif_opaque_softc *)ol_sc); tgt_info->target_type = target_type; @@ -362,10 +377,9 @@ err_cleanup1: * Return: void */ /* Function to reset SoC */ -void hif_ahb_reset_soc(struct hif_opaque_softc *hif_ctx) +void hif_ahb_reset_soc(struct hif_softc *hif_ctx) { - struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx); - hif_ahb_device_reset((struct hif_softc *)sc); + hif_ahb_device_reset(hif_ctx); }