Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fca47cd8 authored by Sandeep Singh's avatar Sandeep Singh Committed by Gerrit - the friendly Code Review server
Browse files

qcacld-3.0: Add api to get smmu domain

Add api to get smmu domain from platform driver.

Change-Id: I71efe1a770c8c73f17ffe574555aa9c3b3595819
parent 148f8e20
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -557,7 +557,11 @@ int pld_athdiag_read(struct device *dev, uint32_t offset, uint32_t memtype,
		     uint32_t datalen, uint8_t *output);
		     uint32_t datalen, uint8_t *output);
int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype,
int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype,
		      uint32_t datalen, uint8_t *input);
		      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);
void *pld_smmu_get_mapping(struct device *dev);
#endif
int pld_smmu_map(struct device *dev, phys_addr_t paddr,
int pld_smmu_map(struct device *dev, phys_addr_t paddr,
		 uint32_t *iova_addr, size_t size);
		 uint32_t *iova_addr, size_t size);
int pld_get_user_msi_assignment(struct device *dev, char *user_name,
int pld_get_user_msi_assignment(struct device *dev, char *user_name,
+25 −0
Original line number Original line Diff line number Diff line
@@ -1253,6 +1253,30 @@ int pld_athdiag_write(struct device *dev, uint32_t offset,
	return ret;
	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
 * pld_smmu_get_mapping() - Get SMMU mapping context
 * @dev: device
 * @dev: device
@@ -1278,6 +1302,7 @@ void *pld_smmu_get_mapping(struct device *dev)


	return ptr;
	return ptr;
}
}
#endif


/**
/**
 * pld_smmu_map() - Map SMMU
 * pld_smmu_map() - Map SMMU
+20 −0
Original line number Original line Diff line number Diff line
@@ -95,10 +95,20 @@ static inline int pld_snoc_athdiag_write(struct device *dev, uint32_t offset,
{
{
	return 0;
	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)
static inline void *pld_snoc_smmu_get_mapping(struct device *dev)
{
{
	return NULL;
	return NULL;
}
}
#endif

static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
				    uint32_t *iova_addr, size_t size)
				    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);
	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)
static inline void *pld_snoc_smmu_get_mapping(struct device *dev)
{
{
	return icnss_smmu_get_mapping(dev);
	return icnss_smmu_get_mapping(dev);
}
}
#endif

static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
				    uint32_t *iova_addr, size_t size)
				    uint32_t *iova_addr, size_t size)
{
{