linux/drivers/iommu/sprd-iommu.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Unisoc IOMMU driver
 *
 * Copyright (C) 2020 Unisoc, Inc.
 * Author: Chunyan Zhang <[email protected]>
 */

#include <linux/clk.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/errno.h>
#include <linux/iommu.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>

#define SPRD_IOMMU_PAGE_SHIFT
#define SPRD_IOMMU_PAGE_SIZE

#define SPRD_EX_CFG
#define SPRD_IOMMU_VAOR_BYPASS
#define SPRD_IOMMU_GATE_EN
#define SPRD_IOMMU_EN
#define SPRD_EX_UPDATE
#define SPRD_EX_FIRST_VPN
#define SPRD_EX_VPN_RANGE
#define SPRD_EX_FIRST_PPN
#define SPRD_EX_DEFAULT_PPN

#define SPRD_IOMMU_VERSION
#define SPRD_VERSION_MASK
#define SPRD_VERSION_SHIFT
#define SPRD_VAU_CFG
#define SPRD_VAU_UPDATE
#define SPRD_VAU_AUTH_CFG
#define SPRD_VAU_FIRST_PPN
#define SPRD_VAU_DEFAULT_PPN_RD
#define SPRD_VAU_DEFAULT_PPN_WR
#define SPRD_VAU_FIRST_VPN
#define SPRD_VAU_VPN_RANGE

enum sprd_iommu_version {};

/*
 * struct sprd_iommu_device - high-level sprd IOMMU device representation,
 * including hardware information and configuration, also driver data, etc
 *
 * @ver: sprd IOMMU IP version
 * @prot_page_va: protect page base virtual address
 * @prot_page_pa: protect page base physical address, data would be
 *		  written to here while translation fault
 * @base: mapped base address for accessing registers
 * @dev: pointer to basic device structure
 * @iommu: IOMMU core representation
 * @group: IOMMU group
 * @eb: gate clock which controls IOMMU access
 */
struct sprd_iommu_device {};

struct sprd_iommu_domain {};

static const struct iommu_ops sprd_iommu_ops;

static struct sprd_iommu_domain *to_sprd_domain(struct iommu_domain *dom)
{}

static inline void
sprd_iommu_write(struct sprd_iommu_device *sdev, unsigned int reg, u32 val)
{}

static inline u32
sprd_iommu_read(struct sprd_iommu_device *sdev, unsigned int reg)
{}

static inline void
sprd_iommu_update_bits(struct sprd_iommu_device *sdev, unsigned int reg,
		  u32 mask, u32 shift, u32 val)
{}

static inline int
sprd_iommu_get_version(struct sprd_iommu_device *sdev)
{}

static size_t
sprd_iommu_pgt_size(struct iommu_domain *domain)
{}

static struct iommu_domain *sprd_iommu_domain_alloc_paging(struct device *dev)
{}

static void sprd_iommu_first_vpn(struct sprd_iommu_domain *dom)
{}

static void sprd_iommu_vpn_range(struct sprd_iommu_domain *dom)
{}

static void sprd_iommu_first_ppn(struct sprd_iommu_domain *dom)
{}

static void sprd_iommu_default_ppn(struct sprd_iommu_device *sdev)
{}

static void sprd_iommu_hw_en(struct sprd_iommu_device *sdev, bool en)
{}

static void sprd_iommu_cleanup(struct sprd_iommu_domain *dom)
{}

static void sprd_iommu_domain_free(struct iommu_domain *domain)
{}

static int sprd_iommu_attach_device(struct iommu_domain *domain,
				    struct device *dev)
{}

static int sprd_iommu_map(struct iommu_domain *domain, unsigned long iova,
			  phys_addr_t paddr, size_t pgsize, size_t pgcount,
			  int prot, gfp_t gfp, size_t *mapped)
{}

static size_t sprd_iommu_unmap(struct iommu_domain *domain, unsigned long iova,
			       size_t pgsize, size_t pgcount,
			       struct iommu_iotlb_gather *iotlb_gather)
{}

static int sprd_iommu_sync_map(struct iommu_domain *domain,
			       unsigned long iova, size_t size)
{}

static void sprd_iommu_sync(struct iommu_domain *domain,
			    struct iommu_iotlb_gather *iotlb_gather)
{}

static phys_addr_t sprd_iommu_iova_to_phys(struct iommu_domain *domain,
					   dma_addr_t iova)
{}

static struct iommu_device *sprd_iommu_probe_device(struct device *dev)
{}

static int sprd_iommu_of_xlate(struct device *dev,
			       const struct of_phandle_args *args)
{}


static const struct iommu_ops sprd_iommu_ops =;

static const struct of_device_id sprd_iommu_of_match[] =;
MODULE_DEVICE_TABLE(of, sprd_iommu_of_match);

/*
 * Clock is not required, access to some of IOMMUs is controlled by gate
 * clk, enabled clocks for that kind of IOMMUs before accessing.
 * Return 0 for success or no clocks found.
 */
static int sprd_iommu_clk_enable(struct sprd_iommu_device *sdev)
{}

static void sprd_iommu_clk_disable(struct sprd_iommu_device *sdev)
{}

static int sprd_iommu_probe(struct platform_device *pdev)
{}

static void sprd_iommu_remove(struct platform_device *pdev)
{}

static struct platform_driver sprd_iommu_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_ALIAS();
MODULE_LICENSE();