diff options
author | Terry Lv <r65388@freescale.com> | 2010-02-24 18:34:13 +0800 |
---|---|---|
committer | Terry Lv <r65388@freescale.com> | 2010-03-04 14:55:00 +0800 |
commit | bd6578e46d1ba93ffe6e00147704d7d18c7e5573 (patch) | |
tree | 424b9a30a2e791ff267b2aaa27d0d52186693b8e /include/asm-arm/arch-mx51 | |
parent | 871825c1148b233fb562c09204700b59fcd28b67 (diff) | |
download | u-boot-imx-bd6578e46d1ba93ffe6e00147704d7d18c7e5573.zip u-boot-imx-bd6578e46d1ba93ffe6e00147704d7d18c7e5573.tar.gz u-boot-imx-bd6578e46d1ba93ffe6e00147704d7d18c7e5573.tar.bz2 |
ENGR00120520: Enable MMU for mx51 and mx35
MMU enable code is missed in mx51 and mx35 u-boot.
So add these codes.
Signed-off-by: Terry Lv <r65388@freescale.com>
Diffstat (limited to 'include/asm-arm/arch-mx51')
-rw-r--r-- | include/asm-arm/arch-mx51/mmu.h | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/include/asm-arm/arch-mx51/mmu.h b/include/asm-arm/arch-mx51/mmu.h index a701c72..e80cfc9 100644 --- a/include/asm-arm/arch-mx51/mmu.h +++ b/include/asm-arm/arch-mx51/mmu.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -14,6 +14,8 @@ #ifndef __ARM_ARCH_MMU_H #define __ARM_ARCH_MMU_H +#include <linux/types.h> + /* * Translation Table Base Bit Masks */ @@ -132,4 +134,82 @@ union ARM_MMU_FIRST_LEVEL_DESCRIPTOR { ARM_ACCESS_TYPE_NO_ACCESS(14) | \ ARM_ACCESS_TYPE_NO_ACCESS(15)) +#if defined(CONFIG_MX51_3DS) + +/* + * Translate the virtual address of ram space to physical address + * It is dependent on the implementation of mmu_init + */ +inline void *iomem_to_phys(unsigned long virt) +{ + if (virt < 0x08000000) + return (void *)(virt | PHYS_SDRAM_1); + + if ((virt & 0xF0000000) == PHYS_SDRAM_1) + return (void *)(virt & (~0x08000000)); + + return (void *)virt; +} + +/* + * remap the physical address of ram space to uncacheable virtual address space + * It is dependent on the implementation of hal_mmu_init + */ +void *__ioremap(unsigned long offset, size_t size, unsigned long flags) +{ + if (1 == flags) { + /* 0x98000000~0x9FFFFFFF is uncacheable meory + space which is mapped to SDRAM */ + if ((offset & 0xF0000000) == PHYS_SDRAM_1) + return (void *)(offset |= 0x08000000); + else + return NULL; + } else + return (void *)offset; +} + +#elif defined(CONFIG_MX51_BBG) + +/* + * Translate the virtual address of ram space to physical address + * It is dependent on the implementation of mmu_init + */ +inline void *iomem_to_phys(unsigned long virt) +{ + if (virt < (PHYS_SDRAM_1_SIZE - 0x100000)) + return (void *)(virt + PHYS_SDRAM_1); + + if (virt >= 0xE0000000) + return (void *)((virt - 0xE0000000) + PHYS_SDRAM_1); + + return (void *)virt; +} + +/* + * Remap the physical address of ram space to uncacheable virtual address space + * It is dependent on the implementation of hal_mmu_init + */ +void __iounmap(void *addr) +{ + return; +} + +void *__ioremap(unsigned long offset, size_t size, unsigned long flags) +{ + if (1 == flags) { + /* 0xE0000000~0xFFFFFFFF is uncacheable + meory space which is mapped to SDRAM */ + if (offset >= PHYS_SDRAM_1 && + offset < (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE)) + return (void *)(offset - PHYS_SDRAM_1) + 0xE0000000; + else + return NULL; + } else + return (void *)offset; +} + +#else + #error "No such platforms for MMU!" +#endif + #endif |