/*
- * linux/arch/arm/mach-omap2/mmu.c
+ * linux/arch/arm/mach-omap1/mmu.c
*
* Support for non-MPU OMAP1 MMUs.
*
schedule_work(&mmu->irq_work);
}
+static pgprot_t omap1_mmu_pte_get_attr(struct omap_mmu_tlb_entry *entry)
+{
+ /* 4KB AP position as default */
+ u32 attr = entry->ap >> 4;
+ attr <<= ((entry->pgsz == OMAP_MMU_CAM_PAGESIZE_1MB) ? 6:0);
+ return attr;
+}
+
struct omap_mmu_ops omap1_mmu_ops = {
.startup = omap1_mmu_startup,
.shutdown = omap1_mmu_shutdown,
.cam_ram_alloc = omap1_mmu_cam_ram_alloc,
.cam_ram_valid = omap1_mmu_cam_ram_valid,
.interrupt = omap1_mmu_interrupt,
+ .pte_get_attr = omap1_mmu_pte_get_attr,
};
EXPORT_SYMBOL_GPL(omap1_mmu_ops);
struct omap_mmu_tlb_entry *entry)
{
int ret = -1;
- if ((!entry->prsvd) && (mmu->ops->pte_get_attr)) {
- /*XXX use PG_flag for prsvd */
- ret = omap_mmu_load_pte(mmu, entry);
- if (ret)
- return ret;
- }
+ /*XXX use PG_flag for prsvd */
+ ret = omap_mmu_load_pte(mmu, entry);
+ if (ret)
+ return ret;
if (entry->tlb)
ret = omap_mmu_load_tlb_entry(mmu, entry);
return ret;
int ret = omap_mmu_clear_tlb_entry(mmu, vadr);
if (ret)
return ret;
- if (mmu->ops->pte_get_attr)
- omap_mmu_clear_pte(mmu, vadr);
+ omap_mmu_clear_pte(mmu, vadr);
return ret;
}
EXPORT_SYMBOL_GPL(omap_mmu_clear_pte_entry);
void omap_mmu_enable(struct omap_mmu *mmu, int reset)
{
- u32 val = OMAP_MMU_CNTL_MMU_EN;
+ u32 val = OMAP_MMU_CNTL_MMU_EN | MMU_CNTL_TWLENABLE;
if (likely(reset))
omap_mmu_reset(mmu);
#if defined(CONFIG_ARCH_OMAP2) /* FIXME */
- if (mmu->ops->pte_get_attr) {
- omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd),
- OMAP_MMU_TTB);
- val |= MMU_CNTL_TWLENABLE;
- }
+ omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd),
+ OMAP_MMU_TTB);
#else
+ omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd) & 0xffff,
+ OMAP_MMU_TTB_L);
+ omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd) >> 16,
+ OMAP_MMU_TTB_H);
val |= OMAP_MMU_CNTL_RESET_SW;
#endif
omap_mmu_write_reg(mmu, val, OMAP_MMU_CNTL);
if (!mmu->exmap_tbl)
return -ENOMEM;
- if (mmu->ops->pte_get_attr) {
- struct mm_struct *mm = mm_alloc();
- if (!mm) {
- ret = -ENOMEM;
- goto err_mm_alloc;
- }
- mmu->twl_mm = mm;
+ mmu->twl_mm = mm_alloc();
+ if (!mmu->twl_mm) {
+ ret = -ENOMEM;
+ goto err_mm_alloc;
}
ret = device_register(&mmu->dev);
kfree(mmu->exmap_tbl);
mmu->exmap_tbl = NULL;
- if (mmu->ops->pte_get_attr) {
- if (mmu->twl_mm) {
- __mmdrop(mmu->twl_mm);
- mmu->twl_mm = NULL;
- }
+ if (mmu->twl_mm) {
+ __mmdrop(mmu->twl_mm);
+ mmu->twl_mm = NULL;
}
device_unregister(&mmu->dev);