qcacld-3.0: Add api to get smmu domain

Add api to get smmu domain from platform driver.

Change-Id: I71efe1a770c8c73f17ffe574555aa9c3b3595819
This commit is contained in:
Sandeep Singh 2019-05-15 18:56:34 +05:30 committed by nshrivas
parent 65bdb19143
commit 75d4b7d4cd
3 changed files with 49 additions and 0 deletions

View File

@ -616,7 +616,11 @@ int pld_athdiag_read(struct device *dev, uint32_t offset, uint32_t memtype,
uint32_t datalen, uint8_t *output);
int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype,
uint32_t datalen, uint8_t *input);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
void *pld_smmu_get_domain(struct device *dev);
#else
void *pld_smmu_get_mapping(struct device *dev);
#endif
int pld_smmu_map(struct device *dev, phys_addr_t paddr,
uint32_t *iova_addr, size_t size);
int pld_get_user_msi_assignment(struct device *dev, char *user_name,

View File

@ -1398,6 +1398,30 @@ int pld_athdiag_write(struct device *dev, uint32_t offset,
return ret;
}
/**
* pld_smmu_get_domain() - Get SMMU domain
* @dev: device
*
* Return: Pointer to the domain
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
void *pld_smmu_get_domain(struct device *dev)
{
void *ptr = NULL;
enum pld_bus_type type = pld_get_bus_type(dev);
switch (type) {
case PLD_BUS_TYPE_SNOC:
ptr = pld_snoc_smmu_get_domain(dev);
break;
default:
pr_err("Invalid device type %d\n", type);
break;
}
return ptr;
}
#else
/**
* pld_smmu_get_mapping() - Get SMMU mapping context
* @dev: device
@ -1423,6 +1447,7 @@ void *pld_smmu_get_mapping(struct device *dev)
return ptr;
}
#endif
/**
* pld_smmu_map() - Map SMMU

View File

@ -95,10 +95,20 @@ static inline int pld_snoc_athdiag_write(struct device *dev, uint32_t offset,
{
return 0;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
static inline void *pld_snoc_smmu_get_domain(struct device *dev)
{
return NULL;
}
#else
static inline void *pld_snoc_smmu_get_mapping(struct device *dev)
{
return NULL;
}
#endif
static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
uint32_t *iova_addr, size_t size)
{
@ -218,10 +228,20 @@ static inline int pld_snoc_athdiag_write(struct device *dev, uint32_t offset,
{
return icnss_athdiag_write(dev, offset, memtype, datalen, input);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
static inline void *pld_snoc_smmu_get_domain(struct device *dev)
{
return icnss_smmu_get_domain(dev);
}
#else
static inline void *pld_snoc_smmu_get_mapping(struct device *dev)
{
return icnss_smmu_get_mapping(dev);
}
#endif
static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
uint32_t *iova_addr, size_t size)
{