Beispiel #1
0
int sprd_iommu_mm_init(struct sprd_iommu_dev *dev, struct sprd_iommu_init_data *data)
{
	int err=-1;
#ifdef CONFIG_OF && CONFIG_COMMON_CLK
	struct device_node *np;

	np = dev->misc_dev.this_device->of_node;
	if(!np) {
		return -1;
	}

	dev->mmu_clock=of_clk_get(np, 0) ;
	dev->mmu_mclock=of_clk_get(np,1);
#else
	dev->mmu_mclock= clk_get(NULL,"clk_mm_i");
	dev->mmu_clock=clk_get(NULL,"clk_mmu");
	if (!dev->mmu_mclock) {
		printk ("%s, cant get dev->mmu_mclock\n", __FUNCTION__);
		return -1;
	}
#endif
	if (!dev->mmu_clock) {
		printk ("%s, cant get dev->mmu_clock\n", __FUNCTION__);
		return -1;
	}

	sprd_iommu_mm_enable(dev);
	err=sprd_iommu_init(dev,data);
	sprd_iommu_mm_disable(dev);
	return err;
}
int sprd_iommu_mm_restore(struct sprd_iommu_dev *dev)
{
	int err=-1;
	sprd_iommu_mm_enable(dev);
	err=sprd_iommu_restore(dev);
	sprd_iommu_mm_disable(dev);
	return err;
}
int sprd_iommu_mm_backup(struct sprd_iommu_dev *dev)
{
	int err=-1;
	sprd_iommu_mm_enable(dev);
	err=sprd_iommu_backup(dev);
	sprd_iommu_mm_disable(dev);
	return err;
}
int sprd_iommu_mm_iova_unmap(struct sprd_iommu_dev *dev, unsigned long iova, size_t iova_length, struct ion_buffer *handle)
{
	int err=-1;
	sprd_iommu_mm_enable(dev);
	err = sprd_iommu_iova_unmap(dev,iova,iova_length,handle);
	sprd_iommu_mm_disable(dev);
	return err;
}
int sprd_iommu_mm_init(struct sprd_iommu_dev *dev, struct sprd_iommu_init_data *data)
{
	int err=-1;
	dev->mmu_mclock= clk_get(NULL,"clk_mm_i");
	dev->mmu_clock=clk_get(NULL,"clk_mmu");
	if((NULL==dev->mmu_mclock)||(NULL==dev->mmu_clock))
		return -1;
	sprd_iommu_mm_enable(dev);
	err=sprd_iommu_init(dev,data);
	sprd_iommu_mm_disable(dev);
	return err;
}
Beispiel #6
0
int sprd_iommu_mm_iova_map(struct sprd_iommu_dev *dev, unsigned long iova, size_t iova_length, struct ion_buffer *handle)
{
	int err=-1;

	mutex_lock(&dev->mutex_clk_op);
	if (0 == dev->map_count)
		sprd_iommu_mm_enable(dev);
	dev->map_count++;
	mutex_unlock(&dev->mutex_clk_op);

	err = sprd_iommu_iova_map(dev,iova,iova_length,handle);

	return err;
}