blob: 77e11e9bc1ed9824538e063a9901d2c3c0789100 [file] [log] [blame]
Niel Fouriedb7241d2021-01-21 13:19:20 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2016 Keymile AG
4 * Rainer Boschung <rainer.boschung@keymile.com>
5 *
6 * Copyright 2013 Freescale Semiconductor, Inc.
7 */
8
9#include <asm/mmu.h>
Tom Rinidec7ea02024-05-20 13:35:03 -060010#include <asm/ppc.h>
Niel Fouriedb7241d2021-01-21 13:19:20 +010011
12struct fsl_e_tlb_entry tlb_table[] = {
13 /* TLB 0 - for temp stack in cache */
Tom Rini6a5dccc2022-11-16 13:10:41 -050014 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR,
15 CFG_SYS_INIT_RAM_ADDR_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010016 MAS3_SX | MAS3_SW | MAS3_SR, 0,
17 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050018 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024,
19 CFG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
Niel Fouriedb7241d2021-01-21 13:19:20 +010020 MAS3_SX | MAS3_SW | MAS3_SR, 0,
21 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050022 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 8 * 1024,
23 CFG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
Niel Fouriedb7241d2021-01-21 13:19:20 +010024 MAS3_SX | MAS3_SW | MAS3_SR, 0,
25 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050026 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 12 * 1024,
27 CFG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
Niel Fouriedb7241d2021-01-21 13:19:20 +010028 MAS3_SX | MAS3_SW | MAS3_SR, 0,
29 0, 0, BOOKE_PAGESZ_4K, 0),
30
31 /* TLB 1 */
32 /* *I*** - Covers boot page */
33 SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
34 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
35 0, 0, BOOKE_PAGESZ_4K, 1),
36
37 /* *I*G* - CCSRBAR */
Tom Rini6a5dccc2022-11-16 13:10:41 -050038 SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010039 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
40 0, 1, BOOKE_PAGESZ_16M, 1),
41
42 /* *I*G* - Flash, localbus */
43 /* This will be changed to *I*G* after relocation to RAM. */
Tom Rini6a5dccc2022-11-16 13:10:41 -050044 SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010045 MAS3_SX | MAS3_SR, MAS2_W | MAS2_G,
46 0, 2, BOOKE_PAGESZ_128M, 1),
47
48 /* *I*G* - PCI1 */
Tom Rini56af6592022-11-16 13:10:33 -050049 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010050 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
51 0, 3, BOOKE_PAGESZ_1G, 1),
52
53 /* *I*G* - PCI1 I/O */
Tom Rini56af6592022-11-16 13:10:33 -050054 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010055 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
56 0, 4, BOOKE_PAGESZ_256K, 1),
57
58 /* Bman/Qman */
Tom Rini6a5dccc2022-11-16 13:10:41 -050059 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE, CFG_SYS_BMAN_MEM_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010060 MAS3_SX | MAS3_SW | MAS3_SR, 0,
61 0, 5, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050062 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE + 0x01000000,
63 CFG_SYS_BMAN_MEM_PHYS + 0x01000000,
Niel Fouriedb7241d2021-01-21 13:19:20 +010064 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
65 0, 6, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050066 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE, CFG_SYS_QMAN_MEM_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010067 MAS3_SX | MAS3_SW | MAS3_SR, 0,
68 0, 7, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050069 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE + 0x01000000,
70 CFG_SYS_QMAN_MEM_PHYS + 0x01000000,
Niel Fouriedb7241d2021-01-21 13:19:20 +010071 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
72 0, 8, BOOKE_PAGESZ_16M, 1),
73
Tom Rini6a5dccc2022-11-16 13:10:41 -050074 SET_TLB_ENTRY(1, CFG_SYS_DCSRBAR, CFG_SYS_DCSRBAR_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010075 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
76 0, 9, BOOKE_PAGESZ_4M, 1),
77
78 /* *I*G - NAND */
Tom Rinib4213492022-11-12 17:36:51 -050079 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010080 MAS3_SX | MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
81 0, 10, BOOKE_PAGESZ_64K, 1),
82 /* QRIO */
Tom Rini6a5dccc2022-11-16 13:10:41 -050083 SET_TLB_ENTRY(1, CFG_SYS_QRIO_BASE, CFG_SYS_QRIO_BASE_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010084 MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
85 0, 11, BOOKE_PAGESZ_64K, 1),
86 /* MRAM */
Tom Rini6a5dccc2022-11-16 13:10:41 -050087 SET_TLB_ENTRY(1, CFG_SYS_MRAM_BASE, SYS_MRAM_BASE_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +010088 MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
89 0, 12, BOOKE_PAGESZ_128M, 1),
90 /* BFTIC */
91 SET_TLB_ENTRY(1, SYS_BFTIC_BASE, SYS_BFTIC_BASE_PHYS,
92 MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
93 0, 13, BOOKE_PAGESZ_128M, 1),
94 /*
95 * entry 14 and 15 has been used hard coded, they will be disabled
96 * in cpu_init_f, so do not use them here!!.
97 */
98 /* PAXE */
Tom Rini6a5dccc2022-11-16 13:10:41 -050099 SET_TLB_ENTRY(1, CFG_SYS_PAXE_BASE, SYS_PAXE_BASE_PHYS,
Niel Fouriedb7241d2021-01-21 13:19:20 +0100100 MAS3_SW | MAS3_SR, MAS2_I | MAS2_G,
101 0, 16, BOOKE_PAGESZ_128M, 1)
102};
103
104int num_tlb_entries = ARRAY_SIZE(tlb_table);