]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/blackfin/include/asm/cplbinit.h
Blackfin arch: remove pointless define IN_KERNEL
[linux-2.6-omap-h63xx.git] / arch / blackfin / include / asm / cplbinit.h
1 /*
2  * File:         include/asm-blackfin/cplbinit.h
3  * Based on:
4  * Author:
5  *
6  * Created:
7  * Description:
8  *
9  * Modified:
10  *               Copyright 2004-2006 Analog Devices Inc.
11  *
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  */
29
30 #ifndef __ASM_CPLBINIT_H__
31 #define __ASM_CPLBINIT_H__
32
33 #include <asm/blackfin.h>
34 #include <asm/cplb.h>
35
36 #ifdef CONFIG_MPU
37
38 #include <asm/cplb-mpu.h>
39 extern void bfin_icache_init(struct cplb_entry *icplb_tbl);
40 extern void bfin_dcache_init(struct cplb_entry *icplb_tbl);
41
42 #else
43
44 #define INITIAL_T 0x1
45 #define SWITCH_T  0x2
46 #define I_CPLB    0x4
47 #define D_CPLB    0x8
48
49 #define ASYNC_MEMORY_CPLB_COVERAGE  ((ASYNC_BANK0_SIZE + ASYNC_BANK1_SIZE + \
50                                 ASYNC_BANK2_SIZE + ASYNC_BANK3_SIZE) / SIZE_4M)
51
52 #define CPLB_MEM CONFIG_MAX_MEM_SIZE
53
54 /*
55 * Number of required data CPLB switchtable entries
56 * MEMSIZE / 4 (we mostly install 4M page size CPLBs
57 * approx 16 for smaller 1MB page size CPLBs for allignment purposes
58 * 1 for L1 Data Memory
59 * possibly 1 for L2 Data Memory
60 * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
61 * 1 for ASYNC Memory
62 */
63 #define MAX_SWITCH_D_CPLBS (((CPLB_MEM / 4) + 16 + 1 + 1 + 1 \
64                                  + ASYNC_MEMORY_CPLB_COVERAGE) * 2)
65
66 /*
67 * Number of required instruction CPLB switchtable entries
68 * MEMSIZE / 4 (we mostly install 4M page size CPLBs
69 * approx 12 for smaller 1MB page size CPLBs for allignment purposes
70 * 1 for L1 Instruction Memory
71 * possibly 1 for L2 Instruction Memory
72 * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
73 */
74 #define MAX_SWITCH_I_CPLBS (((CPLB_MEM / 4) + 12 + 1 + 1 + 1) * 2)
75
76 /* Number of CPLB table entries, used for cplb-nompu. */
77 #define CPLB_TBL_ENTRIES (16 * 4)
78
79 enum {
80         ZERO_P, L1I_MEM, L1D_MEM, L2_MEM, SDRAM_KERN, SDRAM_RAM_MTD, SDRAM_DMAZ,
81         RES_MEM, ASYNC_MEM, OCB_ROM
82 };
83
84 struct cplb_desc {
85         u32 start; /* start address */
86         u32 end; /* end address */
87         u32 psize; /* prefered size if any otherwise 1MB or 4MB*/
88         u16 attr;/* attributes */
89         u16 i_conf;/* I-CPLB DATA */
90         u16 d_conf;/* D-CPLB DATA */
91         u16 valid;/* valid */
92         const s8 name[30];/* name */
93 };
94
95 struct cplb_tab {
96   u_long *tab;
97         u16 pos;
98         u16 size;
99 };
100
101 extern u_long icplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1];
102 extern u_long dcplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1];
103
104 /* Till here we are discussing about the static memory management model.
105  * However, the operating envoronments commonly define more CPLB
106  * descriptors to cover the entire addressable memory than will fit into
107  * the available on-chip 16 CPLB MMRs. When this happens, the below table
108  * will be used which will hold all the potentially required CPLB descriptors
109  *
110  * This is how Page descriptor Table is implemented in uClinux/Blackfin.
111  */
112
113 extern u_long ipdt_tables[NR_CPUS][MAX_SWITCH_I_CPLBS+1];
114 extern u_long dpdt_tables[NR_CPUS][MAX_SWITCH_D_CPLBS+1];
115 #ifdef CONFIG_CPLB_INFO
116 extern u_long ipdt_swapcount_tables[NR_CPUS][MAX_SWITCH_I_CPLBS];
117 extern u_long dpdt_swapcount_tables[NR_CPUS][MAX_SWITCH_D_CPLBS];
118 #endif
119 extern void bfin_icache_init(u_long icplbs[]);
120 extern void bfin_dcache_init(u_long dcplbs[]);
121
122 #endif /* CONFIG_MPU */
123
124 #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
125 extern void generate_cplb_tables_cpu(unsigned int cpu);
126 #endif
127 #endif