cregit-Linux how code gets into the kernel

Release 4.11 drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h

/*
 * Copyright (C) 2015 Samsung Electronics Co.Ltd
 * Authors: Marek Szyprowski <m.szyprowski@samsung.com>
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

#ifndef S5P_MFC_IOMMU_H_

#define S5P_MFC_IOMMU_H_


#define S5P_MFC_IOMMU_DMA_BASE	0x20000000lu

#define S5P_MFC_IOMMU_DMA_SIZE	SZ_256M

#if defined(CONFIG_EXYNOS_IOMMU) && defined(CONFIG_ARM_DMA_USE_IOMMU)

#include <asm/dma-iommu.h>


static inline bool exynos_is_iommu_available(struct device *dev) { return dev->archdata.iommu != NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski21100.00%1100.00%
Total21100.00%1100.00%


static inline void exynos_unconfigure_iommu(struct device *dev) { struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); arm_iommu_detach_device(dev); arm_iommu_release_mapping(mapping); }

Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski32100.00%1100.00%
Total32100.00%1100.00%


static inline int exynos_configure_iommu(struct device *dev, unsigned int base, unsigned int size) { struct dma_iommu_mapping *mapping = NULL; int ret; /* Disable the default mapping created by device core */ if (to_dma_iommu_mapping(dev)) exynos_unconfigure_iommu(dev); mapping = arm_iommu_create_mapping(dev->bus, base, size); if (IS_ERR(mapping)) { pr_warn("Failed to create IOMMU mapping for device %s\n", dev_name(dev)); return PTR_ERR(mapping); } ret = arm_iommu_attach_device(dev, mapping); if (ret) { pr_warn("Failed to attached device %s to IOMMU_mapping\n", dev_name(dev)); arm_iommu_release_mapping(mapping); return ret; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski117100.00%1100.00%
Total117100.00%1100.00%

#else
static inline bool exynos_is_iommu_available(struct device *dev) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski15100.00%1100.00%
Total15100.00%1100.00%


static inline int exynos_configure_iommu(struct device *dev, unsigned int base, unsigned int size) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski24100.00%1100.00%
Total24100.00%1100.00%


static inline void exynos_unconfigure_iommu(struct device *dev) { }

Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski11100.00%1100.00%
Total11100.00%1100.00%

#endif #endif /* S5P_MFC_IOMMU_H_ */

Overall Contributors

PersonTokensPropCommitsCommitProp
Marek Szyprowski256100.00%2100.00%
Total256100.00%2100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.