qcacmn: Use pld api to get pci slot

Use pld api to get pci slot instead of getting pci slot from
domain.

Change-Id: I0a2024eba89ee98c645f613ea4aa56dbb2089537
This commit is contained in:
Nandha Kishore Easwaran
2021-04-20 10:21:30 +05:30
committed by Madan Koyyalamudi
parent f1cd24767e
commit df35f813fd
3 changed files with 6 additions and 78 deletions

View File

@@ -166,35 +166,14 @@ static inline int hif_get_pci_slot(struct hif_softc *scn)
#else #else
static inline int hif_get_pci_slot(struct hif_softc *scn) static inline int hif_get_pci_slot(struct hif_softc *scn)
{ {
uint32_t pci_id; int pci_slot = pld_get_pci_slot(scn->qdf_dev->dev);
struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
struct hif_target_info *tgt_info = hif_get_target_info_handle(hif_hdl);
uint32_t target_type = tgt_info->target_type;
struct device_node *mhi_node;
struct device_node *pcierp_node;
struct device_node *pcie_node;
switch (target_type) { if (pci_slot < 0) {
case TARGET_TYPE_QCN9000: hif_err("Invalid PCI SLOT %d", pci_slot);
case TARGET_TYPE_QCN9224: qdf_assert_always(0);
/* of_node stored in qdf_dev points to the mhi node */
mhi_node = scn->qdf_dev->dev->of_node;
/*
* pcie id is stored in the main pci node which has to be taken
* from the second parent of mhi_node.
*/
pcierp_node = mhi_node->parent;
pcie_node = pcierp_node->parent;
qal_devnode_fetch_pci_domain_id(pcie_node, &pci_id);
if (pci_id < 0 || pci_id >= WLAN_CFG_MAX_PCIE_GROUPS) {
hif_err("pci_id: %d is invalid", pci_id);
QDF_ASSERT(0);
return 0;
}
return pci_id;
default:
/* Send pci_id 0 for all other targets */
return 0; return 0;
} else {
return pci_slot;
} }
} }
#endif #endif
@@ -2931,7 +2910,6 @@ static int hif_ce_msi_configure_irq(struct hif_softc *scn)
uint32_t msi_irq_start; uint32_t msi_irq_start;
struct HIF_CE_state *ce_sc = HIF_GET_CE_STATE(scn); struct HIF_CE_state *ce_sc = HIF_GET_CE_STATE(scn);
struct CE_attr *host_ce_conf = ce_sc->host_ce_config; struct CE_attr *host_ce_conf = ce_sc->host_ce_config;
int pci_slot;
if (!scn->disable_wake_irq) { if (!scn->disable_wake_irq) {
/* do wake irq assignment */ /* do wake irq assignment */
@@ -2974,7 +2952,6 @@ static int hif_ce_msi_configure_irq(struct hif_softc *scn)
/* needs to match the ce_id -> irq data mapping /* needs to match the ce_id -> irq data mapping
* used in the srng parameter configuration * used in the srng parameter configuration
*/ */
pci_slot = hif_get_pci_slot(scn);
for (ce_id = 0; ce_id < scn->ce_count; ce_id++) { for (ce_id = 0; ce_id < scn->ce_count; ce_id++) {
if (host_ce_conf[ce_id].flags & CE_ATTR_DISABLE_INTR) if (host_ce_conf[ce_id].flags & CE_ATTR_DISABLE_INTR)
continue; continue;

View File

@@ -36,17 +36,6 @@ typedef __qdf_devnode_t qdf_devnode_t;
#ifdef ENHANCED_OS_ABSTRACTION #ifdef ENHANCED_OS_ABSTRACTION
/**
* qal_devnode_fetch_pci_domain_id() - This function will try to obtain the
* host bridge domain number
* @node: device tree node
* @domain_id: pointer to domain number
*
* Return: QDF_STATUS_SUCCESS if domain_id is in the range, error code otherwise
*/
QDF_STATUS
qal_devnode_fetch_pci_domain_id(qdf_devnode_t devnode, int *domain_id);
/** /**
* qal_devnode_read_u32_array() - Find and read an array of 32 bit integers * qal_devnode_read_u32_array() - Find and read an array of 32 bit integers
* from a property. * from a property.
@@ -72,11 +61,6 @@ QDF_STATUS
qal_devnode_read_u32(const qdf_devnode_t devnode, qal_devnode_read_u32(const qdf_devnode_t devnode,
const char *pname, uint32_t *u32_val); const char *pname, uint32_t *u32_val);
#else #else
static inline QDF_STATUS
qal_devnode_fetch_pci_domain_id(qdf_devnode_t devnode, int *domain_id)
{
return __qal_devnode_fetch_pci_domain_id(devnode, domain_id);
}
static inline QDF_STATUS static inline QDF_STATUS
qal_devnode_read_u32_array(const qdf_devnode_t devnode, qal_devnode_read_u32_array(const qdf_devnode_t devnode,

View File

@@ -34,39 +34,6 @@
typedef struct device_node *__qdf_devnode_t; typedef struct device_node *__qdf_devnode_t;
/**
* __qal_devnode_fetch_pci_domain_id() - This function will try to obtain the
* host bridge domain number
* @node: device tree node
* @domain_id: pointer to domain number
*
* Return: QDF_STATUS_SUCCESS if domain_id is in the range,
* error code otherwise
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0))
static inline QDF_STATUS
__qal_devnode_fetch_pci_domain_id(__qdf_devnode_t devnode, int *domain_id)
{
*domain_id = 0;
return QDF_STATUS_SUCCESS;
}
#else
static inline QDF_STATUS
__qal_devnode_fetch_pci_domain_id(__qdf_devnode_t devnode, int *domain_id)
{
int ret;
ret = of_get_pci_domain_nr(devnode);
if ((ret >= PCI_DOMAIN_ID_MIN) && (ret <= PCI_DOMAIN_ID_MAX)) {
*domain_id = ret;
return QDF_STATUS_SUCCESS;
}
return qdf_status_from_os_return(ret);
}
#endif
/** /**
* __qal_devnode_read_u32_array() - Find and read an array of 32 bit integers * __qal_devnode_read_u32_array() - Find and read an array of 32 bit integers
* from a property. * from a property.