Skip to content

Commit 33cf45b

Browse files
Maciej W. Rozyckiralfbaechle
authored andcommitted
[TC] TURBOchannel support for the DECstation
This is the platform-specific part of TURBOchannel bus support for the DECstation. It implements determining whether the bus is actually there, getting bus parameters, IRQ assignments for devices and protected accesses to possibly unoccupied slots that may trigger bus error exceptions. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 56a47da commit 33cf45b

5 files changed

Lines changed: 103 additions & 1 deletion

File tree

‎arch/mips/dec/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
66
kn02-irq.o kn02xa-berr.o reset.o setup.o time.o
77

88
obj-$(CONFIG_PROM_CONSOLE) += promcon.o
9+
obj-$(CONFIG_TC) += tc.o
910
obj-$(CONFIG_CPU_HAS_WB) += wbflush.o
1011

1112
EXTRA_AFLAGS := $(CFLAGS)

‎arch/mips/dec/prom/identify.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ static inline void prom_init_kn02(void)
8888
{
8989
dec_kn_slot_base = KN02_SLOT_BASE;
9090
dec_kn_slot_size = KN02_SLOT_SIZE;
91+
dec_tc_bus = 1;
9192

9293
dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + KN02_RTC);
9394
}
@@ -96,6 +97,7 @@ static inline void prom_init_kn02xa(void)
9697
{
9798
dec_kn_slot_base = KN02XA_SLOT_BASE;
9899
dec_kn_slot_size = IOASIC_SLOT_SIZE;
100+
dec_tc_bus = 1;
99101

100102
ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL);
101103
dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY);
@@ -105,6 +107,7 @@ static inline void prom_init_kn03(void)
105107
{
106108
dec_kn_slot_base = KN03_SLOT_BASE;
107109
dec_kn_slot_size = IOASIC_SLOT_SIZE;
110+
dec_tc_bus = 1;
108111

109112
ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL);
110113
dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY);

‎arch/mips/dec/setup.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ unsigned long dec_kn_slot_base, dec_kn_slot_size;
5353
EXPORT_SYMBOL(dec_kn_slot_base);
5454
EXPORT_SYMBOL(dec_kn_slot_size);
5555

56+
int dec_tc_bus;
57+
5658
spinlock_t ioasic_ssr_lock;
5759

5860
volatile u32 *ioasic_base;

‎arch/mips/dec/tc.c‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* TURBOchannel architecture calls.
3+
*
4+
* Copyright (c) Harald Koerfgen, 1998
5+
* Copyright (c) 2001, 2003, 2005, 2006 Maciej W. Rozycki
6+
* Copyright (c) 2005 James Simmons
7+
*
8+
* This file is subject to the terms and conditions of the GNU
9+
* General Public License. See the file "COPYING" in the main
10+
* directory of this archive for more details.
11+
*/
12+
#include <linux/compiler.h>
13+
#include <linux/errno.h>
14+
#include <linux/init.h>
15+
#include <linux/string.h>
16+
#include <linux/tc.h>
17+
#include <linux/types.h>
18+
19+
#include <asm/addrspace.h>
20+
#include <asm/bootinfo.h>
21+
#include <asm/paccess.h>
22+
23+
#include <asm/dec/interrupts.h>
24+
#include <asm/dec/prom.h>
25+
#include <asm/dec/system.h>
26+
27+
/*
28+
* Protected read byte from TURBOchannel slot space.
29+
*/
30+
int tc_preadb(u8 *valp, void __iomem *addr)
31+
{
32+
return get_dbe(*valp, (u8 *)addr);
33+
}
34+
35+
/*
36+
* Get TURBOchannel bus information as specified by the spec, plus
37+
* the slot space base address and the number of slots.
38+
*/
39+
int __init tc_bus_get_info(struct tc_bus *tbus)
40+
{
41+
if (!dec_tc_bus)
42+
return -ENXIO;
43+
44+
memcpy(&tbus->info, rex_gettcinfo(), sizeof(tbus->info));
45+
tbus->slot_base = CPHYSADDR((long)rex_slot_address(0));
46+
47+
switch (mips_machtype) {
48+
case MACH_DS5000_200:
49+
tbus->num_tcslots = 7;
50+
break;
51+
case MACH_DS5000_2X0:
52+
case MACH_DS5900:
53+
tbus->ext_slot_base = 0x20000000;
54+
tbus->ext_slot_size = 0x20000000;
55+
/* fall through */
56+
case MACH_DS5000_1XX:
57+
tbus->num_tcslots = 3;
58+
break;
59+
case MACH_DS5000_XX:
60+
tbus->num_tcslots = 2;
61+
default:
62+
break;
63+
}
64+
return 0;
65+
}
66+
67+
/*
68+
* Get the IRQ for the specified slot.
69+
*/
70+
void __init tc_device_get_irq(struct tc_dev *tdev)
71+
{
72+
switch (tdev->slot) {
73+
case 0:
74+
tdev->interrupt = dec_interrupt[DEC_IRQ_TC0];
75+
break;
76+
case 1:
77+
tdev->interrupt = dec_interrupt[DEC_IRQ_TC1];
78+
break;
79+
case 2:
80+
tdev->interrupt = dec_interrupt[DEC_IRQ_TC2];
81+
break;
82+
/*
83+
* Yuck! DS5000/200 onboard devices
84+
*/
85+
case 5:
86+
tdev->interrupt = dec_interrupt[DEC_IRQ_TC5];
87+
break;
88+
case 6:
89+
tdev->interrupt = dec_interrupt[DEC_IRQ_TC6];
90+
break;
91+
default:
92+
tdev->interrupt = -1;
93+
break;
94+
}
95+
}

‎include/asm-mips/dec/system.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generic DECstation/DECsystem bits.
55
*
6-
* Copyright (C) 2005 Maciej W. Rozycki
6+
* Copyright (C) 2005, 2006 Maciej W. Rozycki
77
*
88
* This program is free software; you can redistribute it and/or
99
* modify it under the terms of the GNU General Public License
@@ -14,5 +14,6 @@
1414
#define __ASM_DEC_SYSTEM_H
1515

1616
extern unsigned long dec_kn_slot_base, dec_kn_slot_size;
17+
extern int dec_tc_bus;
1718

1819
#endif /* __ASM_DEC_SYSTEM_H */

0 commit comments

Comments
 (0)