| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 2 | * Copyright (C) 1999, 2000, 2004, 2005  MIPS Technologies, Inc. | 
|  | 3 | *	All rights reserved. | 
|  | 4 | *	Authors: Carsten Langgaard <carstenl@mips.com> | 
|  | 5 | *		 Maciej W. Rozycki <macro@mips.com> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * | 
|  | 7 | *  This program is free software; you can distribute it and/or modify it | 
|  | 8 | *  under the terms of the GNU General Public License (Version 2) as | 
|  | 9 | *  published by the Free Software Foundation. | 
|  | 10 | * | 
|  | 11 | *  This program is distributed in the hope it will be useful, but WITHOUT | 
|  | 12 | *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|  | 13 | *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License | 
|  | 14 | *  for more details. | 
|  | 15 | * | 
|  | 16 | *  You should have received a copy of the GNU General Public License along | 
|  | 17 | *  with this program; if not, write to the Free Software Foundation, Inc., | 
|  | 18 | *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 
|  | 19 | * | 
|  | 20 | * PROM library initialisation code. | 
|  | 21 | */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/init.h> | 
|  | 23 | #include <linux/string.h> | 
|  | 24 | #include <linux/kernel.h> | 
|  | 25 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <asm/bootinfo.h> | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 27 | #include <asm/gt64120.h> | 
|  | 28 | #include <asm/io.h> | 
|  | 29 | #include <asm/system.h> | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 30 | #include <asm/cacheflush.h> | 
|  | 31 | #include <asm/traps.h> | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 32 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #include <asm/mips-boards/prom.h> | 
|  | 34 | #include <asm/mips-boards/generic.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <asm/mips-boards/bonito64.h> | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 36 | #include <asm/mips-boards/msc01_pci.h> | 
|  | 37 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | #include <asm/mips-boards/malta.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 |  | 
|  | 40 | #ifdef CONFIG_KGDB | 
|  | 41 | extern int rs_kgdb_hook(int, int); | 
|  | 42 | extern int rs_putDebugChar(char); | 
|  | 43 | extern char rs_getDebugChar(void); | 
|  | 44 | extern int saa9730_kgdb_hook(int); | 
|  | 45 | extern int saa9730_putDebugChar(char); | 
|  | 46 | extern char saa9730_getDebugChar(void); | 
|  | 47 | #endif | 
|  | 48 |  | 
|  | 49 | int prom_argc; | 
|  | 50 | int *_prom_argv, *_prom_envp; | 
|  | 51 |  | 
|  | 52 | /* | 
|  | 53 | * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer. | 
|  | 54 | * This macro take care of sign extension, if running in 64-bit mode. | 
|  | 55 | */ | 
|  | 56 | #define prom_envp(index) ((char *)(long)_prom_envp[(index)]) | 
|  | 57 |  | 
|  | 58 | int init_debug = 0; | 
|  | 59 |  | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 60 | int mips_revision_corid; | 
|  | 61 | int mips_revision_sconid; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 |  | 
|  | 63 | /* Bonito64 system controller register base. */ | 
|  | 64 | unsigned long _pcictrl_bonito; | 
|  | 65 | unsigned long _pcictrl_bonito_pcicfg; | 
|  | 66 |  | 
|  | 67 | /* GT64120 system controller register base */ | 
|  | 68 | unsigned long _pcictrl_gt64120; | 
|  | 69 |  | 
|  | 70 | /* MIPS System controller register base */ | 
|  | 71 | unsigned long _pcictrl_msc; | 
|  | 72 |  | 
|  | 73 | char *prom_getenv(char *envname) | 
|  | 74 | { | 
|  | 75 | /* | 
|  | 76 | * Return a pointer to the given environment variable. | 
|  | 77 | * In 64-bit mode: we're using 64-bit pointers, but all pointers | 
|  | 78 | * in the PROM structures are only 32-bit, so we need some | 
|  | 79 | * workarounds, if we are running in 64-bit mode. | 
|  | 80 | */ | 
|  | 81 | int i, index=0; | 
|  | 82 |  | 
|  | 83 | i = strlen(envname); | 
|  | 84 |  | 
|  | 85 | while (prom_envp(index)) { | 
|  | 86 | if(strncmp(envname, prom_envp(index), i) == 0) { | 
|  | 87 | return(prom_envp(index+1)); | 
|  | 88 | } | 
|  | 89 | index += 2; | 
|  | 90 | } | 
|  | 91 |  | 
|  | 92 | return NULL; | 
|  | 93 | } | 
|  | 94 |  | 
|  | 95 | static inline unsigned char str2hexnum(unsigned char c) | 
|  | 96 | { | 
|  | 97 | if (c >= '0' && c <= '9') | 
|  | 98 | return c - '0'; | 
|  | 99 | if (c >= 'a' && c <= 'f') | 
|  | 100 | return c - 'a' + 10; | 
|  | 101 | return 0; /* foo */ | 
|  | 102 | } | 
|  | 103 |  | 
|  | 104 | static inline void str2eaddr(unsigned char *ea, unsigned char *str) | 
|  | 105 | { | 
|  | 106 | int i; | 
|  | 107 |  | 
|  | 108 | for (i = 0; i < 6; i++) { | 
|  | 109 | unsigned char num; | 
|  | 110 |  | 
|  | 111 | if((*str == '.') || (*str == ':')) | 
|  | 112 | str++; | 
|  | 113 | num = str2hexnum(*str++) << 4; | 
|  | 114 | num |= (str2hexnum(*str++)); | 
|  | 115 | ea[i] = num; | 
|  | 116 | } | 
|  | 117 | } | 
|  | 118 |  | 
|  | 119 | int get_ethernet_addr(char *ethernet_addr) | 
|  | 120 | { | 
|  | 121 | char *ethaddr_str; | 
|  | 122 |  | 
|  | 123 | ethaddr_str = prom_getenv("ethaddr"); | 
|  | 124 | if (!ethaddr_str) { | 
|  | 125 | printk("ethaddr not set in boot prom\n"); | 
|  | 126 | return -1; | 
|  | 127 | } | 
|  | 128 | str2eaddr(ethernet_addr, ethaddr_str); | 
|  | 129 |  | 
|  | 130 | if (init_debug > 1) { | 
|  | 131 | int i; | 
|  | 132 | printk("get_ethernet_addr: "); | 
|  | 133 | for (i=0; i<5; i++) | 
|  | 134 | printk("%02x:", (unsigned char)*(ethernet_addr+i)); | 
|  | 135 | printk("%02x\n", *(ethernet_addr+i)); | 
|  | 136 | } | 
|  | 137 |  | 
|  | 138 | return 0; | 
|  | 139 | } | 
|  | 140 |  | 
|  | 141 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 
|  | 142 | static void __init console_config(void) | 
|  | 143 | { | 
|  | 144 | char console_string[40]; | 
|  | 145 | int baud = 0; | 
|  | 146 | char parity = '\0', bits = '\0', flow = '\0'; | 
|  | 147 | char *s; | 
|  | 148 |  | 
| Thiemo Seufer | 43e3c88 | 2007-03-19 00:05:06 +0000 | [diff] [blame] | 149 | if ((strstr(prom_getcmdline(), "console=")) == NULL) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | s = prom_getenv("modetty0"); | 
|  | 151 | if (s) { | 
|  | 152 | while (*s >= '0' && *s <= '9') | 
|  | 153 | baud = baud*10 + *s++ - '0'; | 
|  | 154 | if (*s == ',') s++; | 
|  | 155 | if (*s) parity = *s++; | 
|  | 156 | if (*s == ',') s++; | 
|  | 157 | if (*s) bits = *s++; | 
|  | 158 | if (*s == ',') s++; | 
|  | 159 | if (*s == 'h') flow = 'r'; | 
|  | 160 | } | 
|  | 161 | if (baud == 0) | 
|  | 162 | baud = 38400; | 
|  | 163 | if (parity != 'n' && parity != 'o' && parity != 'e') | 
|  | 164 | parity = 'n'; | 
|  | 165 | if (bits != '7' && bits != '8') | 
|  | 166 | bits = '8'; | 
|  | 167 | if (flow == '\0') | 
|  | 168 | flow = 'r'; | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 169 | sprintf(console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow); | 
|  | 170 | strcat(prom_getcmdline(), console_string); | 
| Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 171 | pr_info("Config serial console:%s\n", console_string); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | } | 
|  | 173 | } | 
|  | 174 | #endif | 
|  | 175 |  | 
|  | 176 | #ifdef CONFIG_KGDB | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 177 | void __init kgdb_config(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | { | 
|  | 179 | extern int (*generic_putDebugChar)(char); | 
|  | 180 | extern char (*generic_getDebugChar)(void); | 
|  | 181 | char *argptr; | 
|  | 182 | int line, speed; | 
|  | 183 |  | 
|  | 184 | argptr = prom_getcmdline(); | 
|  | 185 | if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { | 
|  | 186 | argptr += strlen("kgdb=ttyS"); | 
|  | 187 | if (*argptr != '0' && *argptr != '1') | 
|  | 188 | printk("KGDB: Unknown serial line /dev/ttyS%c, " | 
|  | 189 | "falling back to /dev/ttyS1\n", *argptr); | 
|  | 190 | line = *argptr == '0' ? 0 : 1; | 
|  | 191 | printk("KGDB: Using serial line /dev/ttyS%d for session\n", line); | 
|  | 192 |  | 
|  | 193 | speed = 0; | 
|  | 194 | if (*++argptr == ',') | 
|  | 195 | { | 
|  | 196 | int c; | 
|  | 197 | while ((c = *++argptr) && ('0' <= c && c <= '9')) | 
|  | 198 | speed = speed * 10 + c - '0'; | 
|  | 199 | } | 
|  | 200 | #ifdef CONFIG_MIPS_ATLAS | 
|  | 201 | if (line == 1) { | 
|  | 202 | speed = saa9730_kgdb_hook(speed); | 
|  | 203 | generic_putDebugChar = saa9730_putDebugChar; | 
|  | 204 | generic_getDebugChar = saa9730_getDebugChar; | 
|  | 205 | } | 
| Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 206 | else | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | #endif | 
|  | 208 | { | 
|  | 209 | speed = rs_kgdb_hook(line, speed); | 
|  | 210 | generic_putDebugChar = rs_putDebugChar; | 
|  | 211 | generic_getDebugChar = rs_getDebugChar; | 
|  | 212 | } | 
|  | 213 |  | 
| Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 214 | pr_info("KGDB: Using serial line /dev/ttyS%d at %d for " | 
|  | 215 | "session, please connect your debugger\n", | 
|  | 216 | line ? 1 : 0, speed); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 |  | 
|  | 218 | { | 
|  | 219 | char *s; | 
|  | 220 | for (s = "Please connect GDB to this port\r\n"; *s; ) | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 221 | generic_putDebugChar(*s++); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | } | 
|  | 223 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | /* Breakpoint is invoked after interrupts are initialised */ | 
|  | 225 | } | 
|  | 226 | } | 
|  | 227 | #endif | 
|  | 228 |  | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 229 | void __init mips_nmi_setup(void) | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 230 | { | 
|  | 231 | void *base; | 
|  | 232 | extern char except_vec_nmi; | 
|  | 233 |  | 
|  | 234 | base = cpu_has_veic ? | 
|  | 235 | (void *)(CAC_BASE + 0xa80) : | 
|  | 236 | (void *)(CAC_BASE + 0x380); | 
|  | 237 | memcpy(base, &except_vec_nmi, 0x80); | 
|  | 238 | flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); | 
|  | 239 | } | 
|  | 240 |  | 
| Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 241 | void __init mips_ejtag_setup(void) | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 242 | { | 
|  | 243 | void *base; | 
|  | 244 | extern char except_vec_ejtag_debug; | 
|  | 245 |  | 
|  | 246 | base = cpu_has_veic ? | 
|  | 247 | (void *)(CAC_BASE + 0xa00) : | 
|  | 248 | (void *)(CAC_BASE + 0x300); | 
|  | 249 | memcpy(base, &except_vec_ejtag_debug, 0x80); | 
|  | 250 | flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); | 
|  | 251 | } | 
|  | 252 |  | 
| Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 253 | extern struct plat_smp_ops msmtc_smp_ops; | 
|  | 254 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | void __init prom_init(void) | 
|  | 256 | { | 
|  | 257 | prom_argc = fw_arg0; | 
|  | 258 | _prom_argv = (int *) fw_arg1; | 
|  | 259 | _prom_envp = (int *) fw_arg2; | 
|  | 260 |  | 
|  | 261 | mips_display_message("LINUX"); | 
|  | 262 |  | 
|  | 263 | #ifdef CONFIG_MIPS_SEAD | 
|  | 264 | set_io_port_base(KSEG1); | 
|  | 265 | #else | 
|  | 266 | /* | 
|  | 267 | * early setup of _pcictrl_bonito so that we can determine | 
|  | 268 | * the system controller on a CORE_EMUL board | 
|  | 269 | */ | 
|  | 270 | _pcictrl_bonito = (unsigned long)ioremap(BONITO_REG_BASE, BONITO_REG_SIZE); | 
|  | 271 |  | 
|  | 272 | mips_revision_corid = MIPS_REVISION_CORID; | 
|  | 273 |  | 
|  | 274 | if (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL) { | 
| Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 275 | if (BONITO_PCIDID == 0x0001df53 || | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | BONITO_PCIDID == 0x0003df53) | 
|  | 277 | mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_BON; | 
|  | 278 | else | 
|  | 279 | mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_MSC; | 
|  | 280 | } | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 281 |  | 
|  | 282 | mips_revision_sconid = MIPS_REVISION_SCONID; | 
|  | 283 | if (mips_revision_sconid == MIPS_REVISION_SCON_OTHER) { | 
|  | 284 | switch (mips_revision_corid) { | 
|  | 285 | case MIPS_REVISION_CORID_QED_RM5261: | 
|  | 286 | case MIPS_REVISION_CORID_CORE_LV: | 
|  | 287 | case MIPS_REVISION_CORID_CORE_FPGA: | 
|  | 288 | case MIPS_REVISION_CORID_CORE_FPGAR2: | 
|  | 289 | mips_revision_sconid = MIPS_REVISION_SCON_GT64120; | 
|  | 290 | break; | 
|  | 291 | case MIPS_REVISION_CORID_CORE_EMUL_BON: | 
|  | 292 | case MIPS_REVISION_CORID_BONITO64: | 
|  | 293 | case MIPS_REVISION_CORID_CORE_20K: | 
|  | 294 | mips_revision_sconid = MIPS_REVISION_SCON_BONITO; | 
|  | 295 | break; | 
|  | 296 | case MIPS_REVISION_CORID_CORE_MSC: | 
|  | 297 | case MIPS_REVISION_CORID_CORE_FPGA2: | 
|  | 298 | case MIPS_REVISION_CORID_CORE_FPGA3: | 
| Chris Dearman | a11b18e | 2007-07-27 20:02:00 +0100 | [diff] [blame] | 299 | case MIPS_REVISION_CORID_CORE_FPGA4: | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 300 | case MIPS_REVISION_CORID_CORE_24K: | 
|  | 301 | case MIPS_REVISION_CORID_CORE_EMUL_MSC: | 
|  | 302 | mips_revision_sconid = MIPS_REVISION_SCON_SOCIT; | 
|  | 303 | break; | 
|  | 304 | default: | 
|  | 305 | mips_display_message("CC Error"); | 
|  | 306 | while (1);   /* We die here... */ | 
|  | 307 | } | 
|  | 308 | } | 
|  | 309 |  | 
|  | 310 | switch (mips_revision_sconid) { | 
| Ralf Baechle | f76b7ea | 2007-03-04 17:26:56 +0000 | [diff] [blame] | 311 | u32 start, map, mask, data; | 
|  | 312 |  | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 313 | case MIPS_REVISION_SCON_GT64120: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | /* | 
|  | 315 | * Setup the North bridge to do Master byte-lane swapping | 
|  | 316 | * when running in bigendian. | 
|  | 317 | */ | 
|  | 318 | _pcictrl_gt64120 = (unsigned long)ioremap(MIPS_GT_BASE, 0x2000); | 
|  | 319 |  | 
|  | 320 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 
|  | 321 | GT_WRITE(GT_PCI0_CMD_OFS, GT_PCI0_CMD_MBYTESWAP_BIT | | 
|  | 322 | GT_PCI0_CMD_SBYTESWAP_BIT); | 
|  | 323 | #else | 
|  | 324 | GT_WRITE(GT_PCI0_CMD_OFS, 0); | 
|  | 325 | #endif | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 326 | /* Fix up PCI I/O mapping if necessary (for Atlas).  */ | 
|  | 327 | start = GT_READ(GT_PCI0IOLD_OFS); | 
|  | 328 | map = GT_READ(GT_PCI0IOREMAP_OFS); | 
|  | 329 | if ((start & map) != 0) { | 
|  | 330 | map &= ~start; | 
|  | 331 | GT_WRITE(GT_PCI0IOREMAP_OFS, map); | 
|  | 332 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | set_io_port_base(MALTA_GT_PORT_BASE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | break; | 
|  | 336 |  | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 337 | case MIPS_REVISION_SCON_BONITO: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | _pcictrl_bonito_pcicfg = (unsigned long)ioremap(BONITO_PCICFG_BASE, BONITO_PCICFG_SIZE); | 
|  | 339 |  | 
|  | 340 | /* | 
|  | 341 | * Disable Bonito IOBC. | 
|  | 342 | */ | 
|  | 343 | BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG & | 
|  | 344 | ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED | | 
|  | 345 | BONITO_PCIMEMBASECFG_MEMBASE1_CACHED); | 
|  | 346 |  | 
|  | 347 | /* | 
|  | 348 | * Setup the North bridge to do Master byte-lane swapping | 
|  | 349 | * when running in bigendian. | 
|  | 350 | */ | 
|  | 351 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 
|  | 352 | BONITO_BONGENCFG = BONITO_BONGENCFG & | 
|  | 353 | ~(BONITO_BONGENCFG_MSTRBYTESWAP | | 
|  | 354 | BONITO_BONGENCFG_BYTESWAP); | 
|  | 355 | #else | 
|  | 356 | BONITO_BONGENCFG = BONITO_BONGENCFG | | 
|  | 357 | BONITO_BONGENCFG_MSTRBYTESWAP | | 
|  | 358 | BONITO_BONGENCFG_BYTESWAP; | 
|  | 359 | #endif | 
|  | 360 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | set_io_port_base(MALTA_BONITO_PORT_BASE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | break; | 
|  | 363 |  | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 364 | case MIPS_REVISION_SCON_SOCIT: | 
|  | 365 | case MIPS_REVISION_SCON_ROCIT: | 
| Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 366 | _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000); | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 367 | mips_pci_controller: | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 368 | mb(); | 
|  | 369 | MSC_READ(MSC01_PCI_CFG, data); | 
|  | 370 | MSC_WRITE(MSC01_PCI_CFG, data & ~MSC01_PCI_CFG_EN_BIT); | 
|  | 371 | wmb(); | 
|  | 372 |  | 
|  | 373 | /* Fix up lane swapping.  */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 
|  | 375 | MSC_WRITE(MSC01_PCI_SWAP, MSC01_PCI_SWAP_NOSWAP); | 
|  | 376 | #else | 
|  | 377 | MSC_WRITE(MSC01_PCI_SWAP, | 
|  | 378 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_IO_SHF | | 
|  | 379 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_MEM_SHF | | 
|  | 380 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_BAR0_SHF); | 
|  | 381 | #endif | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 382 | /* Fix up target memory mapping.  */ | 
|  | 383 | MSC_READ(MSC01_PCI_BAR0, mask); | 
|  | 384 | MSC_WRITE(MSC01_PCI_P2SCMSKL, mask & MSC01_PCI_BAR0_SIZE_MSK); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 |  | 
| Maciej W. Rozycki | aa0980b | 2005-02-01 20:18:59 +0000 | [diff] [blame] | 386 | /* Don't handle target retries indefinitely.  */ | 
|  | 387 | if ((data & MSC01_PCI_CFG_MAXRTRY_MSK) == | 
|  | 388 | MSC01_PCI_CFG_MAXRTRY_MSK) | 
|  | 389 | data = (data & ~(MSC01_PCI_CFG_MAXRTRY_MSK << | 
|  | 390 | MSC01_PCI_CFG_MAXRTRY_SHF)) | | 
|  | 391 | ((MSC01_PCI_CFG_MAXRTRY_MSK - 1) << | 
|  | 392 | MSC01_PCI_CFG_MAXRTRY_SHF); | 
|  | 393 |  | 
|  | 394 | wmb(); | 
|  | 395 | MSC_WRITE(MSC01_PCI_CFG, data); | 
|  | 396 | mb(); | 
|  | 397 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | set_io_port_base(MALTA_MSC_PORT_BASE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | break; | 
|  | 400 |  | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 401 | case MIPS_REVISION_SCON_SOCITSC: | 
|  | 402 | case MIPS_REVISION_SCON_SOCITSCP: | 
|  | 403 | _pcictrl_msc = (unsigned long)ioremap(MIPS_SOCITSC_PCI_REG_BASE, 0x2000); | 
|  | 404 | goto mips_pci_controller; | 
|  | 405 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | default: | 
| Chris Dearman | b72c052 | 2007-04-27 15:58:41 +0100 | [diff] [blame] | 407 | /* Unknown system controller */ | 
|  | 408 | mips_display_message("SC Error"); | 
|  | 409 | while (1);   /* We die here... */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | } | 
|  | 411 | #endif | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 412 | board_nmi_handler_setup = mips_nmi_setup; | 
|  | 413 | board_ejtag_handler_setup = mips_ejtag_setup; | 
|  | 414 |  | 
| Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 415 | pr_info("\nLINUX started...\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | prom_init_cmdline(); | 
|  | 417 | prom_meminit(); | 
|  | 418 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 
|  | 419 | console_config(); | 
|  | 420 | #endif | 
| Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 421 | #ifdef CONFIG_MIPS_MT_SMP | 
|  | 422 | register_smp_ops(&vsmp_smp_ops); | 
|  | 423 | #endif | 
|  | 424 | #ifdef CONFIG_MIPS_MT_SMTC | 
|  | 425 | register_smp_ops(&msmtc_smp_ops); | 
|  | 426 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | } |