diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2005-07-01 12:10:40 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2005-10-29 14:31:35 -0400 |
commit | a5fc9c0bbee8b91025993a49a9176a88380aef3c (patch) | |
tree | e68ee45e852028ddde712abb18531777dba6e468 /drivers | |
parent | 7d7ee221213609319401d1b9d6dc4bf22ab928ea (diff) |
Use physical addresses at the interface level, letting drivers remap
them as appropriate.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tc/tc.c | 80 | ||||
-rw-r--r-- | drivers/tc/zs.c | 20 |
2 files changed, 43 insertions, 57 deletions
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c index d742c3a90b23..a0e5af638e0e 100644 --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c | |||
@@ -10,31 +10,29 @@ | |||
10 | * Copyright (c) Harald Koerfgen, 1998 | 10 | * Copyright (c) Harald Koerfgen, 1998 |
11 | * Copyright (c) 2001, 2003, 2005 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,6 +178,8 @@ 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 | ||
@@ -196,8 +205,8 @@ static int __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)CKSEG1ADDR(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,35 +225,21 @@ static int __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 | } | 243 | } |
249 | 244 | ||
250 | return 0; | 245 | return 0; |
@@ -258,4 +253,3 @@ EXPORT_SYMBOL(release_tc_card); | |||
258 | EXPORT_SYMBOL(get_tc_base_addr); | 253 | EXPORT_SYMBOL(get_tc_base_addr); |
259 | EXPORT_SYMBOL(get_tc_irq_nr); | 254 | EXPORT_SYMBOL(get_tc_irq_nr); |
260 | EXPORT_SYMBOL(get_tc_speed); | 255 | EXPORT_SYMBOL(get_tc_speed); |
261 | EXPORT_SYMBOL(system_base); | ||
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index 0e302ae5924c..c52af73a251b 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c | |||
@@ -65,14 +65,14 @@ | |||
65 | #include <asm/system.h> | 65 | #include <asm/system.h> |
66 | #include <asm/uaccess.h> | 66 | #include <asm/uaccess.h> |
67 | #include <asm/bootinfo.h> | 67 | #include <asm/bootinfo.h> |
68 | #include <asm/dec/serial.h> | ||
69 | 68 | ||
70 | #ifdef CONFIG_MACH_DECSTATION | ||
71 | #include <asm/dec/interrupts.h> | 69 | #include <asm/dec/interrupts.h> |
70 | #include <asm/dec/ioasic_addrs.h> | ||
72 | #include <asm/dec/machtype.h> | 71 | #include <asm/dec/machtype.h> |
72 | #include <asm/dec/serial.h> | ||
73 | #include <asm/dec/system.h> | ||
73 | #include <asm/dec/tc.h> | 74 | #include <asm/dec/tc.h> |
74 | #include <asm/dec/ioasic_addrs.h> | 75 | |
75 | #endif | ||
76 | #ifdef CONFIG_KGDB | 76 | #ifdef CONFIG_KGDB |
77 | #include <asm/kgdb.h> | 77 | #include <asm/kgdb.h> |
78 | #endif | 78 | #endif |
@@ -1616,30 +1616,22 @@ static void __init probe_sccs(void) | |||
1616 | return; | 1616 | return; |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | /* | ||
1620 | * When serial console is activated, tc_init has not been called yet | ||
1621 | * and system_base is undefined. Unfortunately we have to hardcode | ||
1622 | * system_base for this case :-(. HK | ||
1623 | */ | ||
1624 | switch(mips_machtype) { | 1619 | switch(mips_machtype) { |
1625 | #ifdef CONFIG_MACH_DECSTATION | 1620 | #ifdef CONFIG_MACH_DECSTATION |
1626 | case MACH_DS5000_2X0: | 1621 | case MACH_DS5000_2X0: |
1627 | case MACH_DS5900: | 1622 | case MACH_DS5900: |
1628 | system_base = CKSEG1ADDR(0x1f800000); | ||
1629 | n_chips = 2; | 1623 | n_chips = 2; |
1630 | zs_parms = &ds_parms; | 1624 | zs_parms = &ds_parms; |
1631 | zs_parms->irq0 = dec_interrupt[DEC_IRQ_SCC0]; | 1625 | zs_parms->irq0 = dec_interrupt[DEC_IRQ_SCC0]; |
1632 | zs_parms->irq1 = dec_interrupt[DEC_IRQ_SCC1]; | 1626 | zs_parms->irq1 = dec_interrupt[DEC_IRQ_SCC1]; |
1633 | break; | 1627 | break; |
1634 | case MACH_DS5000_1XX: | 1628 | case MACH_DS5000_1XX: |
1635 | system_base = CKSEG1ADDR(0x1c000000); | ||
1636 | n_chips = 2; | 1629 | n_chips = 2; |
1637 | zs_parms = &ds_parms; | 1630 | zs_parms = &ds_parms; |
1638 | zs_parms->irq0 = dec_interrupt[DEC_IRQ_SCC0]; | 1631 | zs_parms->irq0 = dec_interrupt[DEC_IRQ_SCC0]; |
1639 | zs_parms->irq1 = dec_interrupt[DEC_IRQ_SCC1]; | 1632 | zs_parms->irq1 = dec_interrupt[DEC_IRQ_SCC1]; |
1640 | break; | 1633 | break; |
1641 | case MACH_DS5000_XX: | 1634 | case MACH_DS5000_XX: |
1642 | system_base = CKSEG1ADDR(0x1c000000); | ||
1643 | n_chips = 1; | 1635 | n_chips = 1; |
1644 | zs_parms = &ds_parms; | 1636 | zs_parms = &ds_parms; |
1645 | zs_parms->irq0 = dec_interrupt[DEC_IRQ_SCC0]; | 1637 | zs_parms->irq0 = dec_interrupt[DEC_IRQ_SCC0]; |
@@ -1661,10 +1653,10 @@ static void __init probe_sccs(void) | |||
1661 | * The sccs reside on the high byte of the 16 bit IOBUS | 1653 | * The sccs reside on the high byte of the 16 bit IOBUS |
1662 | */ | 1654 | */ |
1663 | zs_channels[n_channels].control = | 1655 | zs_channels[n_channels].control = |
1664 | (volatile unsigned char *)system_base + | 1656 | (volatile void *)CKSEG1ADDR(dec_kn_slot_base + |
1665 | (0 == chip ? zs_parms->scc0 : zs_parms->scc1) + | 1657 | (0 == chip ? zs_parms->scc0 : zs_parms->scc1) + |
1666 | (0 == channel ? zs_parms->channel_a_offset : | 1658 | (0 == channel ? zs_parms->channel_a_offset : |
1667 | zs_parms->channel_b_offset); | 1659 | zs_parms->channel_b_offset)); |
1668 | zs_channels[n_channels].data = | 1660 | zs_channels[n_channels].data = |
1669 | zs_channels[n_channels].control + 4; | 1661 | zs_channels[n_channels].control + 4; |
1670 | 1662 | ||