1c59e1b4dSTimur Tabi /* 2c59e1b4dSTimur Tabi * Copyright 2010 Freescale Semiconductor, Inc. 3c59e1b4dSTimur Tabi * Authors: Srikanth Srinivasan <srikanth.srinivasan@freescale.com> 4c59e1b4dSTimur Tabi * Timur Tabi <timur@freescale.com> 5c59e1b4dSTimur Tabi * 61a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 7c59e1b4dSTimur Tabi */ 8c59e1b4dSTimur Tabi 9c59e1b4dSTimur Tabi #include <common.h> 10c59e1b4dSTimur Tabi #include <asm/mmu.h> 11c59e1b4dSTimur Tabi 12c59e1b4dSTimur Tabi struct fsl_e_tlb_entry tlb_table[] = { 13c59e1b4dSTimur Tabi /* TLB 0 - for temp stack in cache */ 14c59e1b4dSTimur Tabi SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR, 15c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, 0, 16c59e1b4dSTimur Tabi 0, 0, BOOKE_PAGESZ_4K, 0), 17c59e1b4dSTimur Tabi SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024, 18c59e1b4dSTimur Tabi CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024, 19c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, 0, 20c59e1b4dSTimur Tabi 0, 0, BOOKE_PAGESZ_4K, 0), 21c59e1b4dSTimur Tabi SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024, 22c59e1b4dSTimur Tabi CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024, 23c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, 0, 24c59e1b4dSTimur Tabi 0, 0, BOOKE_PAGESZ_4K, 0), 25c59e1b4dSTimur Tabi SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024, 26c59e1b4dSTimur Tabi CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024, 27c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, 0, 28c59e1b4dSTimur Tabi 0, 0, BOOKE_PAGESZ_4K, 0), 29c59e1b4dSTimur Tabi 30c59e1b4dSTimur Tabi /* TLB 1 */ 31c59e1b4dSTimur Tabi /* *I*** - Covers boot page */ 32c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000, 33c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I, 34c59e1b4dSTimur Tabi 0, 0, BOOKE_PAGESZ_4K, 1), 35c59e1b4dSTimur Tabi 36c59e1b4dSTimur Tabi /* *I*G* - CCSRBAR */ 37c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS, 38c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 39c59e1b4dSTimur Tabi 0, 1, BOOKE_PAGESZ_1M, 1), 40c59e1b4dSTimur Tabi 41f45210d6SMatthew McClintock #ifndef CONFIG_SPL_BUILD 42c59e1b4dSTimur Tabi /* W**G* - Flash/promjet, localbus */ 43c59e1b4dSTimur Tabi /* This will be changed to *I*G* after relocation to RAM. */ 44c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS, 45c59e1b4dSTimur Tabi MAS3_SX|MAS3_SR, MAS2_W|MAS2_G, 46c59e1b4dSTimur Tabi 0, 2, BOOKE_PAGESZ_256M, 1), 47c59e1b4dSTimur Tabi 48c59e1b4dSTimur Tabi /* *I*G* - PCI */ 49c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT, CONFIG_SYS_PCIE3_MEM_PHYS, 50c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 51c59e1b4dSTimur Tabi 0, 3, BOOKE_PAGESZ_1G, 1), 52c59e1b4dSTimur Tabi 53c59e1b4dSTimur Tabi /* *I*G* - PCI */ 54c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x40000000, 55c59e1b4dSTimur Tabi CONFIG_SYS_PCIE3_MEM_PHYS + 0x40000000, 56c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 57c59e1b4dSTimur Tabi 0, 4, BOOKE_PAGESZ_256M, 1), 58c59e1b4dSTimur Tabi 59c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x50000000, 60c59e1b4dSTimur Tabi CONFIG_SYS_PCIE3_MEM_PHYS + 0x50000000, 61c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 62c59e1b4dSTimur Tabi 0, 5, BOOKE_PAGESZ_256M, 1), 63c59e1b4dSTimur Tabi 64c59e1b4dSTimur Tabi /* *I*G* - PCI I/O */ 65c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS, 66c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 67c59e1b4dSTimur Tabi 0, 6, BOOKE_PAGESZ_256K, 1), 68f45210d6SMatthew McClintock #endif 69c59e1b4dSTimur Tabi 70c59e1b4dSTimur Tabi SET_TLB_ENTRY(1, PIXIS_BASE, PIXIS_BASE_PHYS, 71c59e1b4dSTimur Tabi MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 72c59e1b4dSTimur Tabi 0, 7, BOOKE_PAGESZ_4K, 1), 73af253608SMatthew McClintock 74*7c8eea59SYing Zhang #if defined(CONFIG_SYS_RAMBOOT) || \ 75*7c8eea59SYing Zhang (defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR)) 76f45210d6SMatthew McClintock /* **** - eSDHC/eSPI/NAND boot */ 77af253608SMatthew McClintock SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE, 78af253608SMatthew McClintock MAS3_SX|MAS3_SW|MAS3_SR, 0, 79af253608SMatthew McClintock 0, 8, BOOKE_PAGESZ_1G, 1), 80f45210d6SMatthew McClintock /* **** - eSDHC/eSPI/NAND boot - second 1GB of memory */ 81af253608SMatthew McClintock SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000, 82af253608SMatthew McClintock CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000, 83f45210d6SMatthew McClintock MAS3_SX|MAS3_SW|MAS3_SR, 0, 84af253608SMatthew McClintock 0, 9, BOOKE_PAGESZ_1G, 1), 85af253608SMatthew McClintock #endif 86f45210d6SMatthew McClintock 87f45210d6SMatthew McClintock #ifdef CONFIG_SYS_NAND_BASE 88f45210d6SMatthew McClintock /* *I*G - NAND */ 89f45210d6SMatthew McClintock SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS, 90f45210d6SMatthew McClintock MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 91f45210d6SMatthew McClintock 0, 10, BOOKE_PAGESZ_16K, 1), 92f45210d6SMatthew McClintock #endif 93f45210d6SMatthew McClintock 94*7c8eea59SYing Zhang #ifdef CONFIG_SYS_INIT_L2_ADDR 95*7c8eea59SYing Zhang /* *I*G - L2SRAM */ 96*7c8eea59SYing Zhang SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS, 97*7c8eea59SYing Zhang MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G, 98*7c8eea59SYing Zhang 0, 11, BOOKE_PAGESZ_256K, 1) 99*7c8eea59SYing Zhang #endif 100c59e1b4dSTimur Tabi }; 101c59e1b4dSTimur Tabi 102c59e1b4dSTimur Tabi int num_tlb_entries = ARRAY_SIZE(tlb_table); 103