linux/drivers/staging/media/atomisp/include/mmu/isp_mmu.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Support for Medifield PNW Camera Imaging ISP subsystem.
 *
 * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
 *
 * Copyright (c) 2010 Silicon Hive www.siliconhive.com.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version
 * 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 *
 */
/*
 * ISP MMU driver for classic two-level page tables
 */
#ifndef	__ISP_MMU_H__
#define __ISP_MMU_H__

#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/slab.h>

/*
 * do not change these values, the page size for ISP must be the
 * same as kernel's page size.
 */
#define ISP_PAGE_OFFSET
#define ISP_PAGE_SIZE
#define ISP_PAGE_MASK

#define ISP_L1PT_OFFSET
#define ISP_L1PT_MASK

#define ISP_L2PT_OFFSET
#define ISP_L2PT_MASK

#define ISP_L1PT_PTES
#define ISP_L2PT_PTES

#define ISP_PTR_TO_L1_IDX(x)

#define ISP_PTR_TO_L2_IDX(x)

#define ISP_PAGE_ALIGN(x)

#define ISP_PT_TO_VIRT(l1_idx, l2_idx, offset)

#define pgnr_to_size(pgnr)
#define size_to_pgnr_ceil(size)
#define size_to_pgnr_bottom(size)

struct isp_mmu;

struct isp_mmu_client {};

struct isp_mmu {};

/* flags for PDE and PTE */
#define ISP_PTE_VALID_MASK(mmu)

#define ISP_PTE_VALID(mmu, pte)

#define NULL_PAGE
#define PAGE_VALID(page)

/*
 * init mmu with specific mmu driver.
 */
int isp_mmu_init(struct isp_mmu *mmu, struct isp_mmu_client *driver);
/*
 * cleanup all mmu related things.
 */
void isp_mmu_exit(struct isp_mmu *mmu);

/*
 * setup/remove address mapping for pgnr continuous physical pages
 * and isp_virt.
 *
 * map/unmap is mutex lock protected, and caller does not have
 * to do lock/unlock operation.
 *
 * map/unmap will not flush tlb, and caller needs to deal with
 * this itself.
 */
int isp_mmu_map(struct isp_mmu *mmu, unsigned int isp_virt,
		phys_addr_t phys, unsigned int pgnr);

void isp_mmu_unmap(struct isp_mmu *mmu, unsigned int isp_virt,
		   unsigned int pgnr);

static inline void isp_mmu_flush_tlb_all(struct isp_mmu *mmu)
{}

#define isp_mmu_flush_tlb

static inline void isp_mmu_flush_tlb_range(struct isp_mmu *mmu,
	unsigned int start, unsigned int size)
{}

#endif /* ISP_MMU_H_ */