Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2004 Freescale Semiconductor. |
| 3 | * Jeff Brown (jeffrey@freescale.com) |
| 4 | * Srikanth Srinivasan (srikanth.srinivasan@freescale.com) |
| 5 | * |
| 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 22 | * MA 02111-1307 USA |
| 23 | */ |
| 24 | |
| 25 | #include <ppc_asm.tmpl> |
| 26 | #include <ppc_defs.h> |
| 27 | #include <asm/cache.h> |
| 28 | #include <asm/mmu.h> |
| 29 | #include <config.h> |
| 30 | #include <mpc86xx.h> |
| 31 | |
| 32 | /* |
| 33 | * LAW(Local Access Window) configuration: |
| 34 | * |
| 35 | * 0x0000_0000 0x7fff_ffff DDR 2G |
| 36 | * 0x8000_0000 0x9fff_ffff PCI1 MEM 512M |
| 37 | * 0xa000_0000 0xbfff_ffff PCI2 MEM 512M |
| 38 | * 0xc000_0000 0xdfff_ffff RapidIO 512M |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 39 | * 0xe200_0000 0xe2ff_ffff PCI1 IO 16M |
| 40 | * 0xe300_0000 0xe3ff_ffff PCI2 IO 16M |
Jon Loeliger | 20836d4 | 2006-05-19 13:22:44 -0500 | [diff] [blame^] | 41 | * 0xf800_0000 0xf80f_ffff CCSRBAR 1M |
| 42 | * 0xf810_0000 0xf81f_ffff PIXIS 1M |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 43 | * 0xfe00_0000 0xffff_ffff FLASH (boot bank) 32M |
| 44 | * |
| 45 | * Notes: |
| 46 | * CCSRBAR don't need a configured Local Access Window. |
| 47 | * If flash is 8M at default position (last 8M), no LAW needed. |
| 48 | */ |
| 49 | |
| 50 | #if !defined(CONFIG_SPD_EEPROM) |
| 51 | #define LAWBAR1 ((CFG_DDR_SDRAM_BASE>>12) & 0xffffff) |
| 52 | #define LAWAR1 (LAWAR_EN | LAWAR_TRGT_IF_DDR1 | (LAWAR_SIZE & LAWAR_SIZE_256M)) |
| 53 | #else |
| 54 | #define LAWBAR1 0 |
| 55 | #define LAWAR1 ((LAWAR_TRGT_IF_DDR1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) & ~LAWAR_EN) |
| 56 | #endif |
| 57 | |
| 58 | #define LAWBAR2 ((CFG_PCI1_MEM_BASE>>12) & 0xffffff) |
| 59 | #define LAWAR2 (LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) |
| 60 | |
| 61 | #define LAWBAR3 ((CFG_PCI2_MEM_BASE>>12) & 0xffffff) |
| 62 | /*#define LAWAR3 (LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)) */ |
| 63 | #define LAWAR3 (~LAWAR_EN & (LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M))) |
| 64 | |
| 65 | /* |
| 66 | * This is not so much the SDRAM map as it is the whole localbus map. |
| 67 | */ |
| 68 | #define LAWBAR4 ((0xf8100000>>12) & 0xffffff) |
| 69 | #define LAWAR4 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_2M)) |
| 70 | |
| 71 | #define LAWBAR5 ((CFG_PCI1_IO_BASE>>12) & 0xffffff) |
| 72 | #define LAWAR5 (LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_16M)) |
| 73 | |
| 74 | #define LAWBAR6 ((CFG_PCI2_IO_BASE>>12) & 0xffffff) |
| 75 | /*#define LAWAR6 (LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_16M)) */ |
| 76 | #define LAWAR6 (~LAWAR_EN &( LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_16M))) |
| 77 | |
Jon Loeliger | 20836d4 | 2006-05-19 13:22:44 -0500 | [diff] [blame^] | 78 | #define LAWBAR7 ((0xfe000000 >>12) & 0xffffff) |
| 79 | #define LAWAR7 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_32M)) |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 80 | |
Jon Loeliger | 20836d4 | 2006-05-19 13:22:44 -0500 | [diff] [blame^] | 81 | #if !defined(CONFIG_SPD_EEPROM) |
| 82 | #define LAWBAR8 ((CFG_DDR_SDRAM_BASE>>12) & 0xffffff) |
| 83 | #define LAWAR8 (LAWAR_EN | LAWAR_TRGT_IF_DDR2 | (LAWAR_SIZE & LAWAR_SIZE_256M)) |
| 84 | #else |
| 85 | #define LAWBAR8 0 |
| 86 | #define LAWAR8 ((LAWAR_TRGT_IF_DDR2 | (LAWAR_SIZE & LAWAR_SIZE_512M)) & ~LAWAR_EN) |
| 87 | #endif |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 88 | |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 89 | .section .bootpg, "ax" |
| 90 | .globl law_entry |
| 91 | law_entry: |
| 92 | lis r7,CFG_CCSRBAR@h |
| 93 | ori r7,r7,CFG_CCSRBAR@l |
| 94 | |
| 95 | addi r4,r7,0 |
| 96 | addi r5,r7,0 |
| 97 | |
| 98 | /* Skip LAWAR0, start at LAWAR1 */ |
| 99 | lis r6,LAWBAR1@h |
| 100 | ori r6,r6,LAWBAR1@l |
| 101 | stwu r6, 0xc28(r4) |
| 102 | |
| 103 | lis r6,LAWAR1@h |
| 104 | ori r6,r6,LAWAR1@l |
| 105 | stwu r6, 0xc30(r5) |
| 106 | |
| 107 | /* LAWBAR2, LAWAR2 */ |
| 108 | lis r6,LAWBAR2@h |
| 109 | ori r6,r6,LAWBAR2@l |
| 110 | stwu r6, 0x20(r4) |
| 111 | |
| 112 | lis r6,LAWAR2@h |
| 113 | ori r6,r6,LAWAR2@l |
| 114 | stwu r6, 0x20(r5) |
| 115 | |
| 116 | /* LAWBAR3, LAWAR3 */ |
| 117 | lis r6,LAWBAR3@h |
| 118 | ori r6,r6,LAWBAR3@l |
| 119 | stwu r6, 0x20(r4) |
| 120 | |
| 121 | lis r6,LAWAR3@h |
| 122 | ori r6,r6,LAWAR3@l |
| 123 | stwu r6, 0x20(r5) |
| 124 | |
| 125 | /* LAWBAR4, LAWAR4 */ |
| 126 | lis r6,LAWBAR4@h |
| 127 | ori r6,r6,LAWBAR4@l |
| 128 | stwu r6, 0x20(r4) |
| 129 | |
| 130 | lis r6,LAWAR4@h |
| 131 | ori r6,r6,LAWAR4@l |
| 132 | stwu r6, 0x20(r5) |
| 133 | /* LAWBAR5, LAWAR5 */ |
| 134 | lis r6,LAWBAR5@h |
| 135 | ori r6,r6,LAWBAR5@l |
| 136 | stwu r6, 0x20(r4) |
| 137 | |
| 138 | lis r6,LAWAR5@h |
| 139 | ori r6,r6,LAWAR5@l |
| 140 | stwu r6, 0x20(r5) |
| 141 | |
| 142 | /* LAWBAR6, LAWAR6 */ |
| 143 | lis r6,LAWBAR6@h |
| 144 | ori r6,r6,LAWBAR6@l |
| 145 | stwu r6, 0x20(r4) |
| 146 | |
| 147 | lis r6,LAWAR6@h |
| 148 | ori r6,r6,LAWAR6@l |
| 149 | stwu r6, 0x20(r5) |
| 150 | |
| 151 | /* LAWBAR7, LAWAR7 */ |
| 152 | lis r6,LAWBAR7@h |
| 153 | ori r6,r6,LAWBAR7@l |
| 154 | stwu r6, 0x20(r4) |
| 155 | |
| 156 | lis r6,LAWAR7@h |
| 157 | ori r6,r6,LAWAR7@l |
| 158 | stwu r6, 0x20(r5) |
| 159 | |
Jon Loeliger | 20836d4 | 2006-05-19 13:22:44 -0500 | [diff] [blame^] | 160 | /* LAWBAR8, LAWAR8 */ |
| 161 | lis r6,LAWBAR8@h |
| 162 | ori r6,r6,LAWBAR8@l |
| 163 | stwu r6, 0x20(r4) |
| 164 | |
| 165 | lis r6,LAWAR8@h |
| 166 | ori r6,r6,LAWAR8@l |
| 167 | stwu r6, 0x20(r5) |
| 168 | |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 169 | blr |
| 170 | |