qcacmn: Add API to support configuring external group interrupts

Added API to support configuring external group interrupts for AHB bus.

Change-Id: If65984183db808e68dea680c585692e1533e4c7a
CRs-Fixed: 2018655
This commit is contained in:
Venkateswara Swamy Bandaru
2017-04-12 12:31:59 +05:30
committed by Sandeep Puligilla
parent 0bce0449f0
commit 61824944ab
15 changed files with 94 additions and 9 deletions

View File

@@ -852,6 +852,8 @@ uint32_t hif_register_ext_group_int_handler(struct hif_opaque_softc *hif_ctx,
uint32_t numirq, uint32_t irq[], ext_intr_handler handler, uint32_t numirq, uint32_t irq[], ext_intr_handler handler,
void *context); void *context);
uint32_t hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx);
void hif_update_pipe_callback(struct hif_opaque_softc *osc, void hif_update_pipe_callback(struct hif_opaque_softc *osc,
u_int8_t pipeid, u_int8_t pipeid,
struct hif_msg_callbacks *callbacks); struct hif_msg_callbacks *callbacks);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -46,5 +46,6 @@ int hif_ahb_enable_radio(struct hif_pci_softc *sc,
struct platform_device *pdev, struct platform_device *pdev,
const struct platform_device_id *id); const struct platform_device_id *id);
int hif_ahb_configure_irq(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);
#endif #endif

View File

@@ -261,6 +261,18 @@ void hif_dummy_irq_disable(struct hif_softc *hif_sc, int irq_id)
*/ */
void hif_dummy_grp_irq_disable(struct hif_softc *hif_sc, uint32_t grp_id) void hif_dummy_grp_irq_disable(struct hif_softc *hif_sc, uint32_t grp_id)
{} {}
/**
* hif_dummy_grp_irq_configure - dummy call
* hif_ctx: hif context
*
* Return: none
*/
int hif_dummy_grp_irq_configure(struct hif_softc *hif_sc)
{
return 0;
}
/** /**
* hif_dummy_dump_registers - dummy call * hif_dummy_dump_registers - dummy call
* hif_sc: hif context * hif_sc: hif context

View File

@@ -49,6 +49,7 @@ void hif_dummy_irq_enable(struct hif_softc *hif_sc, int irq_id);
void hif_dummy_irq_disable(struct hif_softc *hif_sc, int irq_id); void hif_dummy_irq_disable(struct hif_softc *hif_sc, int irq_id);
void hif_dummy_grp_irq_enable(struct hif_softc *hif_sc, uint32_t grp_id); void hif_dummy_grp_irq_enable(struct hif_softc *hif_sc, uint32_t grp_id);
void hif_dummy_grp_irq_disable(struct hif_softc *hif_sc, uint32_t grp_id); void hif_dummy_grp_irq_disable(struct hif_softc *hif_sc, uint32_t grp_id);
int hif_dummy_grp_irq_configure(struct hif_softc *hif_sc);
int hif_dummy_dump_registers(struct hif_softc *hif_sc); int hif_dummy_dump_registers(struct hif_softc *hif_sc);
void hif_dummy_dump_target_memory(struct hif_softc *hif_sc, void *ramdump_base, void hif_dummy_dump_target_memory(struct hif_softc *hif_sc, void *ramdump_base,
uint32_t address, uint32_t size); uint32_t address, uint32_t size);

View File

@@ -67,6 +67,7 @@ static void hif_intialize_default_ops(struct hif_softc *hif_sc)
bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable; bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable;
bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable; bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable;
bus_ops->hif_map_ce_to_irq = &hif_dummy_map_ce_to_irq; bus_ops->hif_map_ce_to_irq = &hif_dummy_map_ce_to_irq;
bus_ops->hif_grp_irq_configure = &hif_dummy_grp_irq_configure;
} }
#define NUM_OPS (sizeof(struct hif_bus_ops) / sizeof(void *)) #define NUM_OPS (sizeof(struct hif_bus_ops) / sizeof(void *))
@@ -322,6 +323,11 @@ void hif_grp_irq_disable(struct hif_softc *hif_sc, uint32_t grp_id)
hif_sc->bus_ops.hif_grp_irq_disable(hif_sc, grp_id); hif_sc->bus_ops.hif_grp_irq_disable(hif_sc, grp_id);
} }
int hif_grp_irq_configure(struct hif_softc *hif_sc)
{
return hif_sc->bus_ops.hif_grp_irq_configure(hif_sc);
}
int hif_dump_registers(struct hif_opaque_softc *hif_hdl) int hif_dump_registers(struct hif_opaque_softc *hif_hdl)
{ {
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl); struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);

View File

@@ -66,6 +66,7 @@ struct hif_bus_ops {
void (*hif_grp_irq_disable)(struct hif_softc *hif_sc, uint32_t grp_id); void (*hif_grp_irq_disable)(struct hif_softc *hif_sc, uint32_t grp_id);
void (*hif_irq_enable)(struct hif_softc *hif_sc, int ce_id); void (*hif_irq_enable)(struct hif_softc *hif_sc, int ce_id);
void (*hif_grp_irq_enable)(struct hif_softc *hif_sc, uint32_t grp_id); void (*hif_grp_irq_enable)(struct hif_softc *hif_sc, uint32_t grp_id);
int (*hif_grp_irq_configure)(struct hif_softc *hif_sc);
int (*hif_dump_registers)(struct hif_softc *hif_sc); int (*hif_dump_registers)(struct hif_softc *hif_sc);
void (*hif_dump_target_memory)(struct hif_softc *hif_sc, void (*hif_dump_target_memory)(struct hif_softc *hif_sc,
void *ramdump_base, void *ramdump_base,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -68,6 +68,7 @@ QDF_STATUS hif_initialize_ahb_ops(struct hif_bus_ops *bus_ops)
&hif_dummy_disable_power_management; &hif_dummy_disable_power_management;
bus_ops->hif_grp_irq_disable = &hif_ahb_grp_irq_disable; bus_ops->hif_grp_irq_disable = &hif_ahb_grp_irq_disable;
bus_ops->hif_grp_irq_enable = &hif_ahb_grp_irq_enable; bus_ops->hif_grp_irq_enable = &hif_ahb_grp_irq_enable;
bus_ops->hif_grp_irq_configure = &hif_ahb_configure_grp_irq;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -89,6 +89,7 @@ QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc)
&hif_pci_clear_stats; &hif_pci_clear_stats;
bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable; bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable;
bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable; bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable;
bus_ops->hif_grp_irq_configure = &hif_dummy_grp_irq_configure;
/* default to legacy mapping handler; override as needed */ /* 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_map_ce_to_irq = &hif_pci_legacy_map_ce_to_irq;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -66,6 +66,7 @@ QDF_STATUS hif_initialize_sdio_ops(struct hif_softc *hif_sc)
&hif_dummy_disable_power_management; &hif_dummy_disable_power_management;
bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable; bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable;
bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable; bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable;
bus_ops->hif_grp_irq_configure = &hif_dummy_grp_irq_configure;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -84,6 +84,7 @@ QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops)
bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable; bus_ops->hif_grp_irq_disable = &hif_dummy_grp_irq_disable;
bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable; bus_ops->hif_grp_irq_enable = &hif_dummy_grp_irq_enable;
bus_ops->hif_map_ce_to_irq = &hif_snoc_map_ce_to_irq; bus_ops->hif_map_ce_to_irq = &hif_snoc_map_ce_to_irq;
bus_ops->hif_grp_irq_configure = &hif_dummy_grp_irq_configure;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -64,6 +64,7 @@ QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops)
&hif_dummy_disable_power_management; &hif_dummy_disable_power_management;
bus_ops->hif_set_bundle_mode = hif_usb_set_bundle_mode; 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_bus_reset_resume = hif_usb_bus_reset_resume;
bus_ops->hif_grp_irq_configure = &hif_dummy_grp_irq_configure;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -106,5 +106,6 @@ void hif_irq_enable(struct hif_softc *scn, int irq_id);
void hif_irq_disable(struct hif_softc *scn, int irq_id); void hif_irq_disable(struct hif_softc *scn, int irq_id);
void hif_grp_irq_enable(struct hif_softc *scn, uint32_t grp_id); void hif_grp_irq_enable(struct hif_softc *scn, uint32_t grp_id);
void hif_grp_irq_disable(struct hif_softc *scn, uint32_t grp_id); void hif_grp_irq_disable(struct hif_softc *scn, uint32_t grp_id);
int hif_grp_irq_configure(struct hif_softc *scn);
#endif /* __HIF_IO32_H__ */ #endif /* __HIF_IO32_H__ */

View File

@@ -1209,8 +1209,8 @@ uint32_t hif_register_ext_group_int_handler(struct hif_opaque_softc *hif_ctx,
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct hif_ext_group_entry *hif_ext_group; struct hif_ext_group_entry *hif_ext_group;
if (scn->hif_init_done) { if (scn->ext_grp_irq_configured) {
HIF_ERROR("%s Called after HIF initialization \n", __func__); HIF_ERROR("%s Called after ext grp irq configured\n", __func__);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
@@ -1238,6 +1238,28 @@ uint32_t hif_register_ext_group_int_handler(struct hif_opaque_softc *hif_ctx,
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
/**
* hif_configure_ext_group_interrupts() - API to configure external group
* interrpts
* @hif_ctx : HIF Context
*
* Return: status
*/
uint32_t hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
if (scn->ext_grp_irq_configured) {
HIF_ERROR("%s Called after ext grp irq configured\n", __func__);
return QDF_STATUS_E_FAILURE;
}
hif_grp_irq_configure(scn);
scn->ext_grp_irq_configured = true;
return QDF_STATUS_SUCCESS;
}
/** /**
* hif_ext_grp_tasklet() - grp tasklet * hif_ext_grp_tasklet() - grp tasklet
* data: context * data: context

View File

@@ -142,6 +142,7 @@ struct hif_softc {
qdf_device_t qdf_dev; qdf_device_t qdf_dev;
bool hif_init_done; bool hif_init_done;
bool request_irq_done; bool request_irq_done;
bool ext_grp_irq_configured;
/* Packet statistics */ /* Packet statistics */
struct hif_ce_stats pkt_stats; struct hif_ce_stats pkt_stats;
enum hif_target_status target_status; enum hif_target_status target_status;

View File

@@ -250,9 +250,8 @@ int hif_ahb_configure_irq(struct hif_pci_softc *sc)
struct hif_softc *scn = HIF_GET_SOFTC(sc); struct hif_softc *scn = HIF_GET_SOFTC(sc);
struct platform_device *pdev = (struct platform_device *)sc->pdev; struct platform_device *pdev = (struct platform_device *)sc->pdev;
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct hif_ext_group_entry *hif_ext_group;
int irq = 0; int irq = 0;
int i, j; int i;
/* configure per CE interrupts */ /* configure per CE interrupts */
for (i = 0; i < scn->ce_count; i++) { for (i = 0; i < scn->ce_count; i++) {
@@ -270,6 +269,20 @@ int hif_ahb_configure_irq(struct hif_pci_softc *sc)
hif_ahb_irq_enable(scn, i); hif_ahb_irq_enable(scn, i);
} }
end:
return ret;
}
int hif_ahb_configure_grp_irq(struct hif_softc *scn)
{
int ret = 0;
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
struct platform_device *pdev = (struct platform_device *)sc->pdev;
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct hif_ext_group_entry *hif_ext_group;
int irq = 0;
int i, j;
/* configure external interrupts */ /* configure external interrupts */
for (i = 0; i < hif_state->hif_num_extgroup; i++) { for (i = 0; i < hif_state->hif_num_extgroup; i++) {
@@ -304,6 +317,25 @@ end:
return ret; return ret;
} }
void hif_ahb_deconfigure_grp_irq(struct hif_softc *scn)
{
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct hif_ext_group_entry *hif_ext_group;
int i, j;
/* configure external interrupts */
for (i = 0; i < hif_state->hif_num_extgroup; i++) {
hif_ext_group = &hif_state->hif_ext_group[i];
if (hif_ext_group->inited == true) {
hif_ext_group->inited = false;
for (j = 0; j < hif_ext_group->numirq; j++) {
free_irq(ic_irqnum[hif_ext_group->irq[i]],
hif_ext_group);
}
}
}
}
irqreturn_t hif_ahb_interrupt_handler(int irq, void *context) irqreturn_t hif_ahb_interrupt_handler(int irq, void *context)
{ {
struct ce_tasklet_entry *tasklet_entry = context; struct ce_tasklet_entry *tasklet_entry = context;
@@ -581,6 +613,7 @@ void hif_ahb_nointrs(struct hif_softc *scn)
free_irq(ic_irqnum[HIF_IC_CE0_IRQ_OFFSET + i], free_irq(ic_irqnum[HIF_IC_CE0_IRQ_OFFSET + i],
&hif_state->tasklets[i]); &hif_state->tasklets[i]);
} }
hif_ahb_deconfigure_grp_irq(scn);
} }
} }
scn->request_irq_done = false; scn->request_irq_done = false;