xref: /rk3399_rockchip-uboot/board/freescale/mpc8555cds/tlb.c (revision 326ea986ac150acdc7656d57fca647db80b50158)
10db37dc2SKumar Gala /*
20db37dc2SKumar Gala  * Copyright 2008 Freescale Semiconductor, Inc.
30db37dc2SKumar Gala  *
40db37dc2SKumar Gala  * (C) Copyright 2000
50db37dc2SKumar Gala  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
60db37dc2SKumar Gala  *
7*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
80db37dc2SKumar Gala  */
90db37dc2SKumar Gala 
100db37dc2SKumar Gala #include <common.h>
110db37dc2SKumar Gala #include <asm/mmu.h>
120db37dc2SKumar Gala 
130db37dc2SKumar Gala struct fsl_e_tlb_entry tlb_table[] = {
140db37dc2SKumar Gala 	/* TLB 0 - for temp stack in cache */
156d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR,
160db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
170db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
186d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
190db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
200db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
216d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
220db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
230db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
246d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
250db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
260db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
270db37dc2SKumar Gala 
280db37dc2SKumar Gala 	/*
290db37dc2SKumar Gala 	 * TLB 0:	16M	Non-cacheable, guarded
300db37dc2SKumar Gala 	 * 0xff000000	16M	FLASH
310db37dc2SKumar Gala 	 * Out of reset this entry is only 4K.
320db37dc2SKumar Gala 	 */
336d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE,
340db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
350db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_16M, 1),
360db37dc2SKumar Gala 
370db37dc2SKumar Gala 	/*
380db37dc2SKumar Gala 	 * TLB 1:	256M	Non-cacheable, guarded
390db37dc2SKumar Gala 	 * 0x80000000	256M	PCI1 MEM First half
400db37dc2SKumar Gala 	 */
415af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCI1_MEM_VIRT, CONFIG_SYS_PCI1_MEM_PHYS,
420db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
430db37dc2SKumar Gala 		      0, 1, BOOKE_PAGESZ_256M, 1),
440db37dc2SKumar Gala 
450db37dc2SKumar Gala 	/*
460db37dc2SKumar Gala 	 * TLB 2:	256M	Non-cacheable, guarded
470db37dc2SKumar Gala 	 * 0x90000000	256M	PCI1 MEM Second half
480db37dc2SKumar Gala 	 */
495af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCI1_MEM_VIRT + 0x10000000, CONFIG_SYS_PCI1_MEM_PHYS + 0x10000000,
500db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
510db37dc2SKumar Gala 		      0, 2, BOOKE_PAGESZ_256M, 1),
520db37dc2SKumar Gala 
530db37dc2SKumar Gala 	/*
540db37dc2SKumar Gala 	 * TLB 3:	256M	Non-cacheable, guarded
550db37dc2SKumar Gala 	 * 0xa0000000	256M	PCI2 MEM First half
560db37dc2SKumar Gala 	 */
575af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCI2_MEM_VIRT, CONFIG_SYS_PCI2_MEM_PHYS,
580db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
590db37dc2SKumar Gala 		      0, 3, BOOKE_PAGESZ_256M, 1),
600db37dc2SKumar Gala 
610db37dc2SKumar Gala 	/*
620db37dc2SKumar Gala 	 * TLB 4:	256M	Non-cacheable, guarded
630db37dc2SKumar Gala 	 * 0xb0000000	256M	PCI2 MEM Second half
640db37dc2SKumar Gala 	 */
655af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCI2_MEM_VIRT + 0x10000000, CONFIG_SYS_PCI2_MEM_PHYS + 0x10000000,
660db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
670db37dc2SKumar Gala 		      0, 4, BOOKE_PAGESZ_256M, 1),
680db37dc2SKumar Gala 
690db37dc2SKumar Gala 	/*
700db37dc2SKumar Gala 	 * TLB 5:	64M	Non-cacheable, guarded
710db37dc2SKumar Gala 	 * 0xe000_0000	1M	CCSRBAR
720db37dc2SKumar Gala 	 * 0xe200_0000	16M	PCI1 IO
730db37dc2SKumar Gala 	 * 0xe300_0000	16M	PCI2 IO
740db37dc2SKumar Gala 	 */
756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
760db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
770db37dc2SKumar Gala 		      0, 5, BOOKE_PAGESZ_64M, 1),
780db37dc2SKumar Gala 
790db37dc2SKumar Gala 	/*
800db37dc2SKumar Gala 	 * TLB 6:	64M	Cacheable, non-guarded
810db37dc2SKumar Gala 	 * 0xf000_0000	64M	LBC SDRAM
820db37dc2SKumar Gala 	 */
836d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(1, CONFIG_SYS_LBC_SDRAM_BASE, CONFIG_SYS_LBC_SDRAM_BASE,
840db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
850db37dc2SKumar Gala 		      0, 6, BOOKE_PAGESZ_64M, 1),
860db37dc2SKumar Gala 
870db37dc2SKumar Gala 	/*
880db37dc2SKumar Gala 	 * TLB 7:	1M	Non-cacheable, guarded
890db37dc2SKumar Gala 	 * 0xf8000000	1M	CADMUS registers
900db37dc2SKumar Gala 	 */
910db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CADMUS_BASE_ADDR, CADMUS_BASE_ADDR,
920db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
930db37dc2SKumar Gala 		      0, 7, BOOKE_PAGESZ_1M, 1),
940db37dc2SKumar Gala };
950db37dc2SKumar Gala 
960db37dc2SKumar Gala int num_tlb_entries = ARRAY_SIZE(tlb_table);
97