1 /*\r
2 * eve_mmu.c\r
3 *\r
4 * This file contains the test / demo code to demonstrate the EDMA3 driver\r
5 * functionality on DSP/BIOS 6.\r
6 *\r
7 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/\r
8 *\r
9 *\r
10 * Redistribution and use in source and binary forms, with or without\r
11 * modification, are permitted provided that the following conditions\r
12 * are met:\r
13 *\r
14 * Redistributions of source code must retain the above copyright\r
15 * notice, this list of conditions and the following disclaimer.\r
16 *\r
17 * Redistributions in binary form must reproduce the above copyright\r
18 * notice, this list of conditions and the following disclaimer in the\r
19 * documentation and/or other materials provided with the\r
20 * distribution.\r
21 *\r
22 * Neither the name of Texas Instruments Incorporated nor the names of\r
23 * its contributors may be used to endorse or promote products derived\r
24 * from this software without specific prior written permission.\r
25 *\r
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
37 *\r
38 */\r
39 \r
40 /******************************************************************************\r
41 * Macro Declarations *\r
42 ******************************************************************************/\r
43 #define WR_MEM_32(addr, data) *(unsigned int*)(addr) =(unsigned int)(data)\r
44 #define RD_MEM_32(addr) *(unsigned int*)(addr)\r
45 \r
46 #define MMU_BASE 0x40081000 /* EVE's view */\r
47 /* #define MMU_BASE 0x42081000 */ /* MPU's view */\r
48 #define TESLASS_MMU__MMU_CNTL ( MMU_BASE + 0x44 )\r
49 #define TESLASS_MMU__MMU_CAM ( MMU_BASE + 0x58 )\r
50 #define TESLASS_MMU__MMU_RAM ( MMU_BASE + 0x5c )\r
51 #define TESLASS_MMU__MMU_LOCK ( MMU_BASE + 0x50 )\r
52 #define TESLASS_MMU__MMU_LD_TLB ( MMU_BASE + 0x54 )\r
53 \r
54 #define PHY_ADDR1 0x4A000000\r
55 #define VIRT_ADDR1 0x4A000000\r
56 \r
57 /*\r
58 * eve1MmuConfig() This function does EVE MMU settings. This function is\r
59 * called from Reset Module which is defined in configuration file. \r
60 */\r
61 void eveMmuConfig(void)\r
62 {\r
63 /* ------------------------------------------------------------------------------------------------------- */\r
64 WR_MEM_32(TESLASS_MMU__MMU_CAM, 0x0000000c | (VIRT_ADDR1 & 0xFFFFE000));\r
65 WR_MEM_32(TESLASS_MMU__MMU_RAM, 0x000001c0 | (PHY_ADDR1 & 0xFFFFE000));\r
66 \r
67 /* tlbEntry is bits 8:4\r
68 #define TESLASS_MMU__MMU_LOCK__CURRENTVICTIM BITFIELD(8, 4) */\r
69 WR_MEM_32(TESLASS_MMU__MMU_LOCK, ((RD_MEM_32(TESLASS_MMU__MMU_LOCK)) & 0xFFFFFE0F) | ( 11 << 4 ));\r
70 WR_MEM_32(TESLASS_MMU__MMU_LD_TLB, 1 );\r
71 /* ------------------------------------------------------------------------------------------------------- */\r
72 \r
73 /*Enable MMU*/\r
74 WR_MEM_32(TESLASS_MMU__MMU_CNTL, ((RD_MEM_32(TESLASS_MMU__MMU_CNTL)) & 0xFFFFFFFD) | 0x2);\r
75 }\r