]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/include/asm/mmu.h
net/memac_phy: reuse driver for little endian SoCs
[karo-tx-uboot.git] / arch / powerpc / include / asm / mmu.h
index ef5076b24de0daa6b0b3c98cccd27d8c9f7a4c85..5aa916f2e279e4ce54664eb317cf8d712686b8ca 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef _PPC_MMU_H_
 #define _PPC_MMU_H_
 
-#include <linux/config.h>
-
 #ifndef __ASSEMBLY__
 /* Hardware Page Table Entry */
 typedef struct _PTE {
@@ -392,17 +390,17 @@ extern void print_bats(void);
  */
 
 #define MAS0_TLBSEL_MSK        0x30000000
-#define MAS0_TLBSEL(x) ((x << 28) & MAS0_TLBSEL_MSK)
+#define MAS0_TLBSEL(x) (((x) << 28) & MAS0_TLBSEL_MSK)
 #define MAS0_ESEL_MSK  0x0FFF0000
-#define MAS0_ESEL(x)   ((x << 16) & MAS0_ESEL_MSK)
+#define MAS0_ESEL(x)   (((x) << 16) & MAS0_ESEL_MSK)
 #define MAS0_NV(x)     ((x) & 0x00000FFF)
 
 #define MAS1_VALID     0x80000000
 #define MAS1_IPROT     0x40000000
-#define MAS1_TID(x)    ((x << 16) & 0x3FFF0000)
+#define MAS1_TID(x)    (((x) << 16) & 0x3FFF0000)
 #define MAS1_TS                0x00001000
-#define MAS1_TSIZE(x)  ((x << 8) & 0x00000F00)
-#define TSIZE_TO_BYTES(x) ((phys_addr_t)(1UL << ((tsize * 2) + 10)))
+#define MAS1_TSIZE(x)  (((x) << 7) & 0x00000F80)
+#define TSIZE_TO_BYTES(x) (1ULL << ((x) + 10))
 
 #define MAS2_EPN       0xFFFFF000
 #define MAS2_X0                0x00000040
@@ -458,22 +456,42 @@ extern void print_bats(void);
 #define FSL_BOOKE_MAS7(rpn) \
                (((u64)(rpn)) >> 32)
 
-#define BOOKE_PAGESZ_1K         0
-#define BOOKE_PAGESZ_4K         1
-#define BOOKE_PAGESZ_16K        2
-#define BOOKE_PAGESZ_64K        3
-#define BOOKE_PAGESZ_256K       4
-#define BOOKE_PAGESZ_1M         5
-#define BOOKE_PAGESZ_4M         6
-#define BOOKE_PAGESZ_16M        7
-#define BOOKE_PAGESZ_64M        8
-#define BOOKE_PAGESZ_256M       9
-#define BOOKE_PAGESZ_1G                10
-#define BOOKE_PAGESZ_4G                11
-#define BOOKE_PAGESZ_16GB      12
-#define BOOKE_PAGESZ_64GB      13
-#define BOOKE_PAGESZ_256GB     14
-#define BOOKE_PAGESZ_1TB       15
+#define BOOKE_PAGESZ_1K                0
+#define BOOKE_PAGESZ_2K                1
+#define BOOKE_PAGESZ_4K                2
+#define BOOKE_PAGESZ_8K                3
+#define BOOKE_PAGESZ_16K       4
+#define BOOKE_PAGESZ_32K       5
+#define BOOKE_PAGESZ_64K       6
+#define BOOKE_PAGESZ_128K      7
+#define BOOKE_PAGESZ_256K      8
+#define BOOKE_PAGESZ_512K      9
+#define BOOKE_PAGESZ_1M                10
+#define BOOKE_PAGESZ_2M                11
+#define BOOKE_PAGESZ_4M                12
+#define BOOKE_PAGESZ_8M                13
+#define BOOKE_PAGESZ_16M       14
+#define BOOKE_PAGESZ_32M       15
+#define BOOKE_PAGESZ_64M       16
+#define BOOKE_PAGESZ_128M      17
+#define BOOKE_PAGESZ_256M      18
+#define BOOKE_PAGESZ_512M      19
+#define BOOKE_PAGESZ_1G                20
+#define BOOKE_PAGESZ_2G                21
+#define BOOKE_PAGESZ_4G                22
+#define BOOKE_PAGESZ_8G                23
+#define BOOKE_PAGESZ_16GB      24
+#define BOOKE_PAGESZ_32GB      25
+#define BOOKE_PAGESZ_64GB      26
+#define BOOKE_PAGESZ_128GB     27
+#define BOOKE_PAGESZ_256GB     28
+#define BOOKE_PAGESZ_512GB     29
+#define BOOKE_PAGESZ_1TB       30
+#define BOOKE_PAGESZ_2TB       31
+
+#define TLBIVAX_ALL            4
+#define TLBIVAX_TLB0           0
+#define TLBIVAX_TLB1           8
 
 #ifdef CONFIG_E500
 #ifndef __ASSEMBLY__
@@ -491,6 +509,14 @@ extern void print_tlbcam(void);
 extern unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg);
 extern void clear_ddr_tlbs(unsigned int memsize_in_meg);
 
+enum tlb_map_type {
+       TLB_MAP_RAM,
+       TLB_MAP_IO,
+};
+
+extern uint64_t tlb_map_range(ulong v_addr, phys_addr_t p_addr, uint64_t size,
+                             enum tlb_map_type map_type);
+
 extern void write_tlb(u32 _mas0, u32 _mas1, u32 _mas2, u32 _mas3, u32 _mas7);
 
 #define SET_TLB_ENTRY(_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \