2 * Support for Merrifield PNW Camera Imaging ISP subsystem.
4 * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
6 * Copyright (c) 2012 Silicon Hive www.siliconhive.com.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #include "type_support.h"
24 #include "mmu/isp_mmu.h"
25 #include "memory_access/memory_access.h"
26 #include "atomisp_compat.h"
28 #define MERR_VALID_PTE_MASK 0x80000000
31 * include SH header file here
34 static unsigned int sh_phys_to_pte(struct isp_mmu *mmu,
37 return phys >> ISP_PAGE_OFFSET;
40 static phys_addr_t sh_pte_to_phys(struct isp_mmu *mmu,
43 unsigned int mask = mmu->driver->pte_valid_mask;
44 return (phys_addr_t)((pte & ~mask) << ISP_PAGE_OFFSET);
48 * set page directory base address (physical address).
52 static int sh_set_pd_base(struct isp_mmu *mmu,
55 unsigned int pte = sh_phys_to_pte(mmu, phys);
56 /*mmgr_set_base_address(HOST_ADDRESS(pte));*/
57 atomisp_css_mmu_set_page_table_base_index(HOST_ADDRESS(pte));
61 static unsigned int sh_get_pd_base(struct isp_mmu *mmu,
64 unsigned int pte = sh_phys_to_pte(mmu, phys);
65 return HOST_ADDRESS(pte);
69 * callback to flush tlb.
71 * tlb_flush_range will at least flush TLBs containing
72 * address mapping from addr to addr + size.
74 * tlb_flush_all will flush all TLBs.
76 * tlb_flush_all is must be provided. if tlb_flush_range is
77 * not valid, it will set to tlb_flush_all by default.
79 static void sh_tlb_flush(struct isp_mmu *mmu)
81 atomisp_css_mmu_invalidate_cache();
84 struct isp_mmu_client sh_mmu_mrfld = {
85 .name = "Silicon Hive ISP3000 MMU",
86 .pte_valid_mask = MERR_VALID_PTE_MASK,
87 .null_pte = ~MERR_VALID_PTE_MASK,
88 .set_pd_base = sh_set_pd_base,
89 .get_pd_base = sh_get_pd_base,
90 .tlb_flush_all = sh_tlb_flush,
91 .phys_to_pte = sh_phys_to_pte,
92 .pte_to_phys = sh_pte_to_phys,