diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-29 15:19:15 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-29 15:19:15 -0400 |
| commit | e9d52234e35b27ea4ea5f2ab64ca47b1a0c740ab (patch) | |
| tree | 318d37a7d55c79e6f7d86163fb28e0eccbb0fe83 /drivers/tc/tc.c | |
| parent | 955c5038823748e529a49f0e33ab635d92843500 (diff) | |
| parent | 09af7b443c257460d45cb6c1896d29f173fef35b (diff) | |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
Diffstat (limited to 'drivers/tc/tc.c')
| -rw-r--r-- | drivers/tc/tc.c | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c index a89ef4df80c3..a0e5af638e0e 100644 --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c | |||
| @@ -8,33 +8,31 @@ | |||
| 8 | * for more details. | 8 | * for more details. |
| 9 | * | 9 | * |
| 10 | * Copyright (c) Harald Koerfgen, 1998 | 10 | * Copyright (c) Harald Koerfgen, 1998 |
| 11 | * Copyright (c) 2001, 2003 Maciej W. Rozycki | 11 | * Copyright (c) 2001, 2003, 2005 Maciej W. Rozycki |
| 12 | */ | 12 | */ |
| 13 | #include <linux/string.h> | ||
| 14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 15 | #include <linux/ioport.h> | ||
| 16 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 17 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/string.h> | ||
| 17 | #include <linux/types.h> | ||
| 18 | 18 | ||
| 19 | #include <asm/addrspace.h> | 19 | #include <asm/addrspace.h> |
| 20 | #include <asm/bug.h> | ||
| 20 | #include <asm/errno.h> | 21 | #include <asm/errno.h> |
| 22 | #include <asm/io.h> | ||
| 23 | #include <asm/paccess.h> | ||
| 24 | |||
| 21 | #include <asm/dec/machtype.h> | 25 | #include <asm/dec/machtype.h> |
| 22 | #include <asm/dec/prom.h> | 26 | #include <asm/dec/prom.h> |
| 23 | #include <asm/dec/tcinfo.h> | 27 | #include <asm/dec/tcinfo.h> |
| 24 | #include <asm/dec/tcmodule.h> | 28 | #include <asm/dec/tcmodule.h> |
| 25 | #include <asm/dec/interrupts.h> | 29 | #include <asm/dec/interrupts.h> |
| 26 | #include <asm/paccess.h> | ||
| 27 | #include <asm/ptrace.h> | ||
| 28 | |||
| 29 | #define TC_DEBUG | ||
| 30 | 30 | ||
| 31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 32 | slot_info tc_bus[MAX_SLOT]; | 32 | slot_info tc_bus[MAX_SLOT]; |
| 33 | static int num_tcslots; | 33 | static int num_tcslots; |
| 34 | static tcinfo *info; | 34 | static tcinfo *info; |
| 35 | 35 | ||
| 36 | unsigned long system_base; | ||
| 37 | |||
| 38 | /* | 36 | /* |
| 39 | * Interface to the world. Read comment in include/asm-mips/tc.h. | 37 | * Interface to the world. Read comment in include/asm-mips/tc.h. |
| 40 | */ | 38 | */ |
| @@ -97,13 +95,16 @@ unsigned long get_tc_speed(void) | |||
| 97 | static void __init tc_probe(unsigned long startaddr, unsigned long size, | 95 | static void __init tc_probe(unsigned long startaddr, unsigned long size, |
| 98 | int slots) | 96 | int slots) |
| 99 | { | 97 | { |
| 98 | unsigned long slotaddr; | ||
| 100 | int i, slot, err; | 99 | int i, slot, err; |
| 101 | long offset; | 100 | long offset; |
| 102 | unsigned char pattern[4]; | 101 | u8 pattern[4]; |
| 103 | unsigned char *module; | 102 | volatile u8 *module; |
| 104 | 103 | ||
| 105 | for (slot = 0; slot < slots; slot++) { | 104 | for (slot = 0; slot < slots; slot++) { |
| 106 | module = (char *)(startaddr + slot * size); | 105 | slotaddr = startaddr + slot * size; |
| 106 | module = ioremap_nocache(slotaddr, size); | ||
| 107 | BUG_ON(!module); | ||
| 107 | 108 | ||
| 108 | offset = OLDCARD; | 109 | offset = OLDCARD; |
| 109 | 110 | ||
| @@ -112,8 +113,10 @@ static void __init tc_probe(unsigned long startaddr, unsigned long size, | |||
| 112 | err |= get_dbe(pattern[1], module + OLDCARD + TC_PATTERN1); | 113 | err |= get_dbe(pattern[1], module + OLDCARD + TC_PATTERN1); |
| 113 | err |= get_dbe(pattern[2], module + OLDCARD + TC_PATTERN2); | 114 | err |= get_dbe(pattern[2], module + OLDCARD + TC_PATTERN2); |
| 114 | err |= get_dbe(pattern[3], module + OLDCARD + TC_PATTERN3); | 115 | err |= get_dbe(pattern[3], module + OLDCARD + TC_PATTERN3); |
| 115 | if (err) | 116 | if (err) { |
| 117 | iounmap(module); | ||
| 116 | continue; | 118 | continue; |
| 119 | } | ||
| 117 | 120 | ||
| 118 | if (pattern[0] != 0x55 || pattern[1] != 0x00 || | 121 | if (pattern[0] != 0x55 || pattern[1] != 0x00 || |
| 119 | pattern[2] != 0xaa || pattern[3] != 0xff) { | 122 | pattern[2] != 0xaa || pattern[3] != 0xff) { |
| @@ -124,16 +127,20 @@ static void __init tc_probe(unsigned long startaddr, unsigned long size, | |||
| 124 | err |= get_dbe(pattern[1], module + TC_PATTERN1); | 127 | err |= get_dbe(pattern[1], module + TC_PATTERN1); |
| 125 | err |= get_dbe(pattern[2], module + TC_PATTERN2); | 128 | err |= get_dbe(pattern[2], module + TC_PATTERN2); |
| 126 | err |= get_dbe(pattern[3], module + TC_PATTERN3); | 129 | err |= get_dbe(pattern[3], module + TC_PATTERN3); |
| 127 | if (err) | 130 | if (err) { |
| 131 | iounmap(module); | ||
| 128 | continue; | 132 | continue; |
| 133 | } | ||
| 129 | } | 134 | } |
| 130 | 135 | ||
| 131 | if (pattern[0] != 0x55 || pattern[1] != 0x00 || | 136 | if (pattern[0] != 0x55 || pattern[1] != 0x00 || |
| 132 | pattern[2] != 0xaa || pattern[3] != 0xff) | 137 | pattern[2] != 0xaa || pattern[3] != 0xff) { |
| 138 | iounmap(module); | ||
| 133 | continue; | 139 | continue; |
| 140 | } | ||
| 134 | 141 | ||
| 135 | tc_bus[slot].base_addr = (unsigned long)module; | 142 | tc_bus[slot].base_addr = slotaddr; |
| 136 | for(i = 0; i < 8; i++) { | 143 | for (i = 0; i < 8; i++) { |
| 137 | tc_bus[slot].firmware[i] = | 144 | tc_bus[slot].firmware[i] = |
| 138 | module[TC_FIRM_VER + offset + 4 * i]; | 145 | module[TC_FIRM_VER + offset + 4 * i]; |
| 139 | tc_bus[slot].vendor[i] = | 146 | tc_bus[slot].vendor[i] = |
| @@ -171,13 +178,15 @@ static void __init tc_probe(unsigned long startaddr, unsigned long size, | |||
| 171 | tc_bus[slot].interrupt = -1; | 178 | tc_bus[slot].interrupt = -1; |
| 172 | break; | 179 | break; |
| 173 | } | 180 | } |
| 181 | |||
| 182 | iounmap(module); | ||
| 174 | } | 183 | } |
| 175 | } | 184 | } |
| 176 | 185 | ||
| 177 | /* | 186 | /* |
| 178 | * the main entry | 187 | * the main entry |
| 179 | */ | 188 | */ |
| 180 | void __init tc_init(void) | 189 | static int __init tc_init(void) |
| 181 | { | 190 | { |
| 182 | int tc_clock; | 191 | int tc_clock; |
| 183 | int i; | 192 | int i; |
| @@ -185,7 +194,7 @@ void __init tc_init(void) | |||
| 185 | unsigned long slot_size; | 194 | unsigned long slot_size; |
| 186 | 195 | ||
| 187 | if (!TURBOCHANNEL) | 196 | if (!TURBOCHANNEL) |
| 188 | return; | 197 | return 0; |
| 189 | 198 | ||
| 190 | for (i = 0; i < MAX_SLOT; i++) { | 199 | for (i = 0; i < MAX_SLOT; i++) { |
| 191 | tc_bus[i].base_addr = 0; | 200 | tc_bus[i].base_addr = 0; |
| @@ -196,8 +205,8 @@ void __init tc_init(void) | |||
| 196 | tc_bus[i].flags = FREE; | 205 | tc_bus[i].flags = FREE; |
| 197 | } | 206 | } |
| 198 | 207 | ||
| 199 | info = (tcinfo *) rex_gettcinfo(); | 208 | info = rex_gettcinfo(); |
| 200 | slot0addr = (unsigned long)KSEG1ADDR(rex_slot_address(0)); | 209 | slot0addr = CPHYSADDR((long)rex_slot_address(0)); |
| 201 | 210 | ||
| 202 | switch (mips_machtype) { | 211 | switch (mips_machtype) { |
| 203 | case MACH_DS5000_200: | 212 | case MACH_DS5000_200: |
| @@ -216,37 +225,24 @@ void __init tc_init(void) | |||
| 216 | 225 | ||
| 217 | tc_clock = 10000 / info->clk_period; | 226 | tc_clock = 10000 / info->clk_period; |
| 218 | 227 | ||
| 219 | if (TURBOCHANNEL && info->slot_size && slot0addr) { | 228 | if (info->slot_size && slot0addr) { |
| 220 | printk("TURBOchannel rev. %1d at %2d.%1d MHz ", info->revision, | 229 | pr_info("TURBOchannel rev. %d at %d.%d MHz (with%s parity)\n", |
| 221 | tc_clock / 10, tc_clock % 10); | 230 | info->revision, tc_clock / 10, tc_clock % 10, |
| 222 | printk("(with%s parity)\n", info->parity ? "" : "out"); | 231 | info->parity ? "" : "out"); |
| 223 | 232 | ||
| 224 | slot_size = info->slot_size << 20; | 233 | slot_size = info->slot_size << 20; |
| 225 | 234 | ||
| 226 | tc_probe(slot0addr, slot_size, num_tcslots); | 235 | tc_probe(slot0addr, slot_size, num_tcslots); |
| 227 | 236 | ||
| 228 | /* | 237 | for (i = 0; i < num_tcslots; i++) { |
| 229 | * All TURBOchannel DECstations have the onboard devices | 238 | if (!tc_bus[i].base_addr) |
| 230 | * where the (num_tcslots + 0 or 1 on DS5k/xx) Option Module | 239 | continue; |
| 231 | * would be. | 240 | pr_info(" slot %d: %s %s %s\n", i, tc_bus[i].vendor, |
| 232 | */ | 241 | tc_bus[i].name, tc_bus[i].firmware); |
| 233 | if(mips_machtype == MACH_DS5000_XX) | 242 | } |
| 234 | i = 1; | ||
| 235 | else | ||
| 236 | i = 0; | ||
| 237 | |||
| 238 | system_base = slot0addr + slot_size * (num_tcslots + i); | ||
| 239 | |||
| 240 | #ifdef TC_DEBUG | ||
| 241 | for (i = 0; i < num_tcslots; i++) | ||
| 242 | if (tc_bus[i].base_addr) { | ||
| 243 | printk(" slot %d: ", i); | ||
| 244 | printk("%s %s %s\n", tc_bus[i].vendor, | ||
| 245 | tc_bus[i].name, tc_bus[i].firmware); | ||
| 246 | } | ||
| 247 | #endif | ||
| 248 | ioport_resource.end = KSEG2 - 1; | ||
| 249 | } | 243 | } |
| 244 | |||
| 245 | return 0; | ||
| 250 | } | 246 | } |
| 251 | 247 | ||
| 252 | subsys_initcall(tc_init); | 248 | subsys_initcall(tc_init); |
| @@ -257,4 +253,3 @@ EXPORT_SYMBOL(release_tc_card); | |||
| 257 | EXPORT_SYMBOL(get_tc_base_addr); | 253 | EXPORT_SYMBOL(get_tc_base_addr); |
| 258 | EXPORT_SYMBOL(get_tc_irq_nr); | 254 | EXPORT_SYMBOL(get_tc_irq_nr); |
| 259 | EXPORT_SYMBOL(get_tc_speed); | 255 | EXPORT_SYMBOL(get_tc_speed); |
| 260 | EXPORT_SYMBOL(system_base); | ||
