qcacld-3.0: Add support of getting MAC address from platform driver

Add support of getting WLAN MAC address from ICNSS platform driver.

Change-Id: Ie31d9147e8dc4e11e14a6fdf93200122acbb4000
CRs-Fixed: 1096290
This commit is contained in:
Yuanyuan Liu
2016-12-01 10:59:29 -08:00
committed by qcabuildsw
parent f008892636
commit 7145eb2383
4 changed files with 29 additions and 12 deletions

View File

@@ -7220,15 +7220,17 @@ QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void)
#endif #endif
/** /**
* hdd_get_cnss_wlan_mac_buff() - API to query platform driver for MAC address * hdd_get_platform_wlan_mac_buff() - API to query platform driver
* for MAC address
* @dev: Device Pointer * @dev: Device Pointer
* @num: Number of Valid Mac address * @num: Number of Valid Mac address
* *
* Return: Pointer to MAC address buffer * Return: Pointer to MAC address buffer
*/ */
static uint8_t *hdd_get_cnss_wlan_mac_buff(struct device *dev, uint32_t *num) static uint8_t *hdd_get_platform_wlan_mac_buff(struct device *dev,
uint32_t *num)
{ {
return pld_common_get_wlan_mac_address(dev, num); return pld_get_wlan_mac_address(dev, num);
} }
/** /**
@@ -7264,14 +7266,14 @@ static void hdd_populate_random_mac_addr(hdd_context_t *hdd_ctx, uint32_t num)
} }
/** /**
* hdd_cnss_wlan_mac() - API to get mac addresses from cnss platform driver * hdd_platform_wlan_mac() - API to get mac addresses from platform driver
* @hdd_ctx: HDD Context * @hdd_ctx: HDD Context
* *
* API to get mac addresses from platform driver and update the driver * API to get mac addresses from platform driver and update the driver
* structures and configure FW with the base mac address. * structures and configure FW with the base mac address.
* Return: int * Return: int
*/ */
static int hdd_cnss_wlan_mac(hdd_context_t *hdd_ctx) static int hdd_platform_wlan_mac(hdd_context_t *hdd_ctx)
{ {
uint32_t no_of_mac_addr, iter; uint32_t no_of_mac_addr, iter;
uint32_t max_mac_addr = QDF_MAX_CONCURRENCY_PERSONA; uint32_t max_mac_addr = QDF_MAX_CONCURRENCY_PERSONA;
@@ -7282,7 +7284,7 @@ static int hdd_cnss_wlan_mac(hdd_context_t *hdd_ctx)
tSirMacAddr mac_addr; tSirMacAddr mac_addr;
QDF_STATUS status; QDF_STATUS status;
addr = hdd_get_cnss_wlan_mac_buff(dev, &no_of_mac_addr); addr = hdd_get_platform_wlan_mac_buff(dev, &no_of_mac_addr);
if (no_of_mac_addr == 0 || !addr) { if (no_of_mac_addr == 0 || !addr) {
hdd_warn("Platform Driver Doesn't have wlan mac addresses"); hdd_warn("Platform Driver Doesn't have wlan mac addresses");
@@ -7349,7 +7351,7 @@ static void hdd_initialize_mac_address(hdd_context_t *hdd_ctx)
QDF_STATUS status; QDF_STATUS status;
int ret; int ret;
ret = hdd_cnss_wlan_mac(hdd_ctx); ret = hdd_platform_wlan_mac(hdd_ctx);
if (ret == 0) if (ret == 0)
return; return;

View File

@@ -363,7 +363,7 @@ int pld_get_msi_irq(struct device *dev, unsigned int vector);
void pld_get_msi_address(struct device *dev, uint32_t *msi_addr_low, void pld_get_msi_address(struct device *dev, uint32_t *msi_addr_low,
uint32_t *msi_addr_high); uint32_t *msi_addr_high);
unsigned int pld_socinfo_get_serial_number(struct device *dev); unsigned int pld_socinfo_get_serial_number(struct device *dev);
uint8_t *pld_common_get_wlan_mac_address(struct device *dev, uint32_t *num); uint8_t *pld_get_wlan_mac_address(struct device *dev, uint32_t *num);
int pld_is_qmi_disable(struct device *dev); int pld_is_qmi_disable(struct device *dev);
#endif #endif

View File

@@ -1630,7 +1630,7 @@ unsigned int pld_socinfo_get_serial_number(struct device *dev)
} }
/* /*
* pld_common_get_wlan_mac_address() - API to query MAC address from Platform * pld_get_wlan_mac_address() - API to query MAC address from Platform
* Driver * Driver
* @dev: Device Structure * @dev: Device Structure
* @num: Pointer to number of MAC address supported * @num: Pointer to number of MAC address supported
@@ -1640,15 +1640,19 @@ unsigned int pld_socinfo_get_serial_number(struct device *dev)
* *
* Return: Pointer to the list of MAC address * Return: Pointer to the list of MAC address
*/ */
uint8_t *pld_common_get_wlan_mac_address(struct device *dev, uint32_t *num) uint8_t *pld_get_wlan_mac_address(struct device *dev, uint32_t *num)
{ {
switch (pld_get_bus_type(dev)) { enum pld_bus_type type = pld_get_bus_type(dev);
switch (type) {
case PLD_BUS_TYPE_PCIE: case PLD_BUS_TYPE_PCIE:
return pld_pcie_get_wlan_mac_address(dev, num); return pld_pcie_get_wlan_mac_address(dev, num);
case PLD_BUS_TYPE_SDIO: case PLD_BUS_TYPE_SDIO:
return pld_sdio_get_wlan_mac_address(dev, num); return pld_sdio_get_wlan_mac_address(dev, num);
case PLD_BUS_TYPE_USB:
case PLD_BUS_TYPE_SNOC: case PLD_BUS_TYPE_SNOC:
return pld_snoc_get_wlan_mac_address(dev, num);
case PLD_BUS_TYPE_USB:
pr_err("Not supported on type %d\n", type);
break; break;
default: default:
pr_err("Invalid device type\n"); pr_err("Invalid device type\n");

View File

@@ -139,6 +139,12 @@ static inline int pld_snoc_is_qmi_disable(void)
{ {
return 0; return 0;
} }
static inline uint8_t *pld_snoc_get_wlan_mac_address(struct device *dev,
uint32_t *num)
{
*num = 0;
return NULL;
}
#else #else
int pld_snoc_register_driver(void); int pld_snoc_register_driver(void);
void pld_snoc_unregister_driver(void); void pld_snoc_unregister_driver(void);
@@ -231,5 +237,10 @@ static inline int pld_snoc_is_qmi_disable(void)
{ {
return icnss_is_qmi_disable(); return icnss_is_qmi_disable();
} }
static inline uint8_t *pld_snoc_get_wlan_mac_address(struct device *dev,
uint32_t *num)
{
return icnss_get_wlan_mac_address(dev, num);
}
#endif #endif
#endif #endif