Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: include/asm-blackfin/cplb.h |
| 3 | * Based on: include/asm-blackfin/mach-bf537/bf537.h |
| 4 | * Author: Robin Getz <rgetz@blackfin.uclinux.org> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | * |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 6 | * Created: 2000 |
| 7 | * Description: Common CPLB definitions for CPLB init |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 8 | * |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 9 | * Modified: |
| 10 | * Copyright 2004-2007 Analog Devices Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 11 | * |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 12 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License as published by |
| 16 | * the Free Software Foundation; either version 2 of the License, or |
| 17 | * (at your option) any later version. |
| 18 | * |
| 19 | * This program is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | * GNU General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License |
| 25 | * along with this program; if not, see the file COPYING, or write |
| 26 | * to the Free Software Foundation, Inc., |
| 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 29 | |
| 30 | #ifndef _CPLB_H |
| 31 | #define _CPLB_H |
| 32 | |
Robin Getz | 2296fb7 | 2007-09-13 11:49:33 +0800 | [diff] [blame] | 33 | #include <asm/blackfin.h> |
| 34 | #include <asm/mach/anomaly.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 35 | |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 36 | #define SDRAM_IGENERIC (CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID | CPLB_PORTPRIO) |
| 37 | #define SDRAM_IKERNEL (SDRAM_IGENERIC | CPLB_LOCK) |
| 38 | #define L1_IMEMORY ( CPLB_USER_RD | CPLB_VALID | CPLB_LOCK) |
| 39 | #define SDRAM_INON_CHBL ( CPLB_USER_RD | CPLB_VALID) |
| 40 | |
| 41 | /*Use the menuconfig cache policy here - CONFIG_BFIN_WT/CONFIG_BFIN_WB*/ |
| 42 | |
| 43 | #if ANOMALY_05000158 |
| 44 | #define ANOMALY_05000158_WORKAROUND 0x200 |
| 45 | #else |
| 46 | #define ANOMALY_05000158_WORKAROUND 0x0 |
| 47 | #endif |
| 48 | |
| 49 | #define CPLB_COMMON (CPLB_DIRTY | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND) |
| 50 | |
| 51 | #ifdef CONFIG_BFIN_WB /*Write Back Policy */ |
| 52 | #define SDRAM_DGENERIC (CPLB_L1_CHBL | CPLB_COMMON) |
| 53 | #else /*Write Through */ |
| 54 | #define SDRAM_DGENERIC (CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW | CPLB_COMMON) |
| 55 | #endif |
| 56 | |
| 57 | #define L1_DMEMORY (CPLB_LOCK | CPLB_COMMON) |
Robin Getz | 2296fb7 | 2007-09-13 11:49:33 +0800 | [diff] [blame] | 58 | #define L2_MEMORY (CPLB_COMMON) |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 59 | #define SDRAM_DNON_CHBL (CPLB_COMMON) |
| 60 | #define SDRAM_EBIU (CPLB_COMMON) |
| 61 | #define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY) |
| 62 | |
| 63 | #define SIZE_1K 0x00000400 /* 1K */ |
| 64 | #define SIZE_4K 0x00001000 /* 4K */ |
| 65 | #define SIZE_1M 0x00100000 /* 1M */ |
| 66 | #define SIZE_4M 0x00400000 /* 4M */ |
| 67 | |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 68 | #ifdef CONFIG_MPU |
| 69 | #define MAX_CPLBS 16 |
| 70 | #else |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 71 | #define MAX_CPLBS (16 * 2) |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 72 | #endif |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 73 | |
Michael Hennerich | 07bdda0 | 2007-08-27 15:29:35 +0800 | [diff] [blame] | 74 | #define ASYNC_MEMORY_CPLB_COVERAGE ((ASYNC_BANK0_SIZE + ASYNC_BANK1_SIZE + \ |
| 75 | ASYNC_BANK2_SIZE + ASYNC_BANK3_SIZE) / SIZE_4M) |
| 76 | |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 77 | /* |
| 78 | * Number of required data CPLB switchtable entries |
| 79 | * MEMSIZE / 4 (we mostly install 4M page size CPLBs |
| 80 | * approx 16 for smaller 1MB page size CPLBs for allignment purposes |
| 81 | * 1 for L1 Data Memory |
Michael Hennerich | 07bdda0 | 2007-08-27 15:29:35 +0800 | [diff] [blame] | 82 | * possibly 1 for L2 Data Memory |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 83 | * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO |
| 84 | * 1 for ASYNC Memory |
| 85 | */ |
| 86 | |
| 87 | |
Michael Hennerich | 07bdda0 | 2007-08-27 15:29:35 +0800 | [diff] [blame] | 88 | #define MAX_SWITCH_D_CPLBS (((CONFIG_MEM_SIZE / 4) + 16 + 1 + 1 + 1 \ |
| 89 | + ASYNC_MEMORY_CPLB_COVERAGE) * 2) |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 90 | |
| 91 | /* |
| 92 | * Number of required instruction CPLB switchtable entries |
| 93 | * MEMSIZE / 4 (we mostly install 4M page size CPLBs |
| 94 | * approx 12 for smaller 1MB page size CPLBs for allignment purposes |
| 95 | * 1 for L1 Instruction Memory |
Michael Hennerich | 07bdda0 | 2007-08-27 15:29:35 +0800 | [diff] [blame] | 96 | * possibly 1 for L2 Instruction Memory |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 97 | * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO |
| 98 | */ |
| 99 | |
Michael Hennerich | 07bdda0 | 2007-08-27 15:29:35 +0800 | [diff] [blame] | 100 | #define MAX_SWITCH_I_CPLBS (((CONFIG_MEM_SIZE / 4) + 12 + 1 + 1 + 1) * 2) |
Robin Getz | 3bebca2 | 2007-10-10 23:55:26 +0800 | [diff] [blame] | 101 | |
| 102 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 103 | #define CPLB_ENABLE_ICACHE_P 0 |
| 104 | #define CPLB_ENABLE_DCACHE_P 1 |
| 105 | #define CPLB_ENABLE_DCACHE2_P 2 |
| 106 | #define CPLB_ENABLE_CPLBS_P 3 /* Deprecated! */ |
| 107 | #define CPLB_ENABLE_ICPLBS_P 4 |
| 108 | #define CPLB_ENABLE_DCPLBS_P 5 |
| 109 | |
| 110 | #define CPLB_ENABLE_ICACHE (1<<CPLB_ENABLE_ICACHE_P) |
| 111 | #define CPLB_ENABLE_DCACHE (1<<CPLB_ENABLE_DCACHE_P) |
| 112 | #define CPLB_ENABLE_DCACHE2 (1<<CPLB_ENABLE_DCACHE2_P) |
| 113 | #define CPLB_ENABLE_CPLBS (1<<CPLB_ENABLE_CPLBS_P) |
| 114 | #define CPLB_ENABLE_ICPLBS (1<<CPLB_ENABLE_ICPLBS_P) |
| 115 | #define CPLB_ENABLE_DCPLBS (1<<CPLB_ENABLE_DCPLBS_P) |
| 116 | #define CPLB_ENABLE_ANY_CPLBS CPLB_ENABLE_CPLBS | \ |
| 117 | CPLB_ENABLE_ICPLBS | \ |
| 118 | CPLB_ENABLE_DCPLBS |
| 119 | |
| 120 | #define CPLB_RELOADED 0x0000 |
| 121 | #define CPLB_NO_UNLOCKED 0x0001 |
| 122 | #define CPLB_NO_ADDR_MATCH 0x0002 |
| 123 | #define CPLB_PROT_VIOL 0x0003 |
| 124 | #define CPLB_UNKNOWN_ERR 0x0004 |
| 125 | |
| 126 | #define CPLB_DEF_CACHE CPLB_L1_CHBL | CPLB_WT |
| 127 | #define CPLB_CACHE_ENABLED CPLB_L1_CHBL | CPLB_DIRTY |
| 128 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 129 | #define CPLB_I_PAGE_MGMT CPLB_LOCK | CPLB_VALID |
| 130 | #define CPLB_D_PAGE_MGMT CPLB_LOCK | CPLB_ALL_ACCESS | CPLB_VALID |
| 131 | #define CPLB_DNOCACHE CPLB_ALL_ACCESS | CPLB_VALID |
| 132 | #define CPLB_DDOCACHE CPLB_DNOCACHE | CPLB_DEF_CACHE |
| 133 | #define CPLB_INOCACHE CPLB_USER_RD | CPLB_VALID |
| 134 | #define CPLB_IDOCACHE CPLB_INOCACHE | CPLB_L1_CHBL |
| 135 | |
| 136 | #endif /* _CPLB_H */ |