]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/hal/arm/mx27/karo/v1_0/include/plf_mmap.h
TX51 pre-release
[karo-tx-redboot.git] / packages / hal / arm / mx27 / karo / v1_0 / include / plf_mmap.h
index 95001ffbc9d8be98fdcf9a5620e085202e5b2a50..4be393a90c50dc8ad38daeb60ebe7ca62311ebf6 100644 (file)
 // Get the pagesize for a particular virtual address:
 
 // This does not depend on the vaddr.
-#define HAL_MM_PAGESIZE( vaddr, pagesize ) CYG_MACRO_START      \
-    (pagesize) = SZ_1M;                                         \
+#define HAL_MM_PAGESIZE( vaddr, pagesize ) CYG_MACRO_START     \
+       (pagesize) = SZ_1M;                                                                             \
 CYG_MACRO_END
 
 // Get the physical address from a virtual address:
 
 #define HAL_VIRT_TO_PHYS_ADDRESS( vaddr, paddr ) CYG_MACRO_START       \
-    cyg_uint32 _v_ = (cyg_uint32)(vaddr);                              \
-    if ( _v_ < 128 * SZ_1M )          /* SDRAM */                      \
-        _v_ += 0xA00u * SZ_1M;                                         \
-    else                             /* Rest of it */                  \
-        /* no change */ ;                                              \
-    (paddr) = _v_;                                                     \
+       cyg_uint32 _v_ = (cyg_uint32)(vaddr);                                                   \
+       if ( _v_ < 128 * SZ_1M )                  /* SDRAM */                                   \
+               _v_ += 0xA00u * SZ_1M;                                                                          \
+       else                                                     /* Rest of it */                               \
+               /* no change */ ;                                                                                       \
+       (paddr) = _v_;                                                                                                  \
 CYG_MACRO_END
 
+/*
+ * translate the virtual address of ram space to physical address
+ * It is dependent on the implementation of hal_mmu_init
+ */
+static unsigned long __inline__ hal_virt_to_phy(unsigned long virt)
+{
+               if(virt < 0x08000000) {
+                               return virt|0xA0000000;
+               }
+               if((virt & 0xF0000000) == 0xA0000000) {
+                               return virt&(~0x08000000);
+               }
+               return virt;
+}
+
+/*
+ * remap the physical address of ram space to uncacheable virtual address space
+ * It is dependent on the implementation of hal_mmu_init
+ */
+static unsigned long __inline__ hal_ioremap_nocache(unsigned long phy)
+{
+               /* 0xA8000000~0xA8FFFFFF is uncacheable meory space which is mapped to SDRAM*/
+               if((phy & 0xF0000000) == 0xA0000000) {
+                               phy |= 0x08000000;
+               }
+               return phy;
+}
+
 //---------------------------------------------------------------------------
 #endif // CYGONCE_HAL_BOARD_PLATFORM_PLF_MMAP_H