Linux-2.6.12-rc2
[linux-2.6] / arch / mips / vr41xx / nec-cmbvr4133 / init.c
1 /*
2  * arch/mips/vr41xx/nec-cmbvr4133/init.c
3  *
4  * PROM library initialisation code for NEC CMB-VR4133 board.
5  *
6  * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7  *         Jun Sun <jsun@mvista.com, or source@mvista.com> and
8  *         Alex Sapkov <asapkov@ru.mvista.com>
9  *
10  * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11  * the terms of the GNU General Public License version 2. This program
12  * is licensed "as is" without any warranty of any kind, whether express
13  * or implied.
14  *
15  * Support for NEC-CMBVR4133 in 2.6
16  * Manish Lachwani (mlachwani@mvista.com)
17  */
18 #include <linux/config.h>
19 #include <linux/init.h>
20 #include <linux/kernel.h>
21 #include <linux/string.h>
22
23 #include <asm/bootinfo.h>
24
25 #ifdef CONFIG_ROCKHOPPER
26 #include <asm/io.h>
27 #include <linux/pci.h>
28
29 #define PCICONFDREG     0xaf000c14
30 #define PCICONFAREG     0xaf000c18
31 #endif
32
33 const char *get_system_type(void)
34 {
35         return "NEC CMB-VR4133";
36 }
37
38 #ifdef CONFIG_ROCKHOPPER
39 void disable_pcnet(void)
40 {
41         u32 data;
42
43         /*
44          * Workaround for the bug in PMON on VR4133. PMON leaves
45          * AMD PCNet controller (on Rockhopper) initialized and running in
46          * bus master mode. We have do disable it before doing any
47          * further initialization. Or we get problems with PCI bus 2
48          * and random lockups and crashes.
49          */
50
51         writel((2 << 16)                |
52                (PCI_DEVFN(1,0) << 8)    |
53                (0 & 0xfc)               |
54                1UL,
55                PCICONFAREG);
56
57         data = readl(PCICONFDREG);
58
59         writel((2 << 16)                |
60                (PCI_DEVFN(1,0) << 8)    |
61                (4 & 0xfc)               |
62                1UL,
63                PCICONFAREG);
64
65         data = readl(PCICONFDREG);
66
67         writel((2 << 16)                |
68                (PCI_DEVFN(1,0) << 8)    |
69                (4 & 0xfc)               |
70                1UL,
71                PCICONFAREG);
72
73         data &= ~4;
74
75         writel(data, PCICONFDREG);
76 }
77 #endif
78