From f97e822df47d7794f10d77e8f3f842a23844825e Mon Sep 17 00:00:00 2001 From: Yuanyuan Liu Date: Wed, 21 Sep 2016 10:31:38 -0700 Subject: [PATCH] qcacld-3.0: Use PLD API to get SOC serial number Socinfo API is not a standard system API. Hence, use PLD API to get SOC serial number instead of calling socinfo API directly to enhance driver portability. Change-Id: I1d673d2f3b0066f4e05f2f465abc8a6cad7a1f8f CRs-Fixed: 1069480 --- core/hdd/src/wlan_hdd_main.c | 3 +-- core/pld/inc/pld_common.h | 1 + core/pld/src/pld_common.c | 26 ++++++++++++++++++++++++++ core/pld/src/pld_snoc.h | 10 ++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 211603a66366..cd6a4348403e 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -80,7 +80,6 @@ #ifdef MSM_PLATFORM #include #endif -#include #include #include #include "cfg_api.h" @@ -1344,7 +1343,7 @@ static int hdd_generate_macaddr_auto(hdd_context_t *hdd_ctx) {0x00, 0x0A, 0xF5, 0x00, 0x00, 0x00} }; - serialno = socinfo_get_serial_number(); + serialno = pld_socinfo_get_serial_number(hdd_ctx->parent_dev); if (serialno == 0) return -EINVAL; diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 28760ff459f8..bcf647b0b1a4 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -378,4 +378,5 @@ int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype, void *pld_smmu_get_mapping(struct device *dev); int pld_smmu_map(struct device *dev, phys_addr_t paddr, uint32_t *iova_addr, size_t size); +unsigned int pld_socinfo_get_serial_number(struct device *dev); #endif diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index b5db8a502006..737cc389c600 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1518,3 +1518,29 @@ int pld_smmu_map(struct device *dev, phys_addr_t paddr, return ret; } + +/** + * pld_socinfo_get_serial_number() - Get SOC serial number + * @dev: device + * + * Return: SOC serial number + */ +unsigned int pld_socinfo_get_serial_number(struct device *dev) +{ + unsigned int ret = 0; + enum pld_bus_type type = pld_get_bus_type(dev); + + switch (type) { + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_socinfo_get_serial_number(dev); + break; + case PLD_BUS_TYPE_PCIE: + pr_err("Not supported on type %d\n", type); + break; + default: + pr_err("Invalid device type %d\n", type); + break; + } + + return ret; +} diff --git a/core/pld/src/pld_snoc.h b/core/pld/src/pld_snoc.h index 07a60e69cf12..9c8a53b8a889 100644 --- a/core/pld/src/pld_snoc.h +++ b/core/pld/src/pld_snoc.h @@ -130,6 +130,11 @@ static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr, { return 0; } +static inline +unsigned int pld_snoc_socinfo_get_serial_number(struct device *dev) +{ + return 0; +} #else int pld_snoc_register_driver(void); void pld_snoc_unregister_driver(void); @@ -213,5 +218,10 @@ static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr, { return icnss_smmu_map(dev, paddr, iova_addr, size); } +static inline +unsigned int pld_snoc_socinfo_get_serial_number(struct device *dev) +{ + return icnss_socinfo_get_serial_number(dev); +} #endif #endif