diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2008-07-10 11:31:36 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-07-15 13:44:35 -0400 |
commit | 22b1d707ffc99faebd86257ad19d5bb9fc624734 (patch) | |
tree | 9bd0bcd3878611d74db29e17f3c6e951f4656e61 /arch/mips/txx9/rbtx4927 | |
parent | 14476007c90005c8992b786c15a59cca31f53268 (diff) |
[MIPS] TXx9: Reorganize code
Move arch/mips/{jmr3927,tx4927,tx4938} into arch/mips/txx9/ tree.
This will help more code sharing and maintainance.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/txx9/rbtx4927')
-rw-r--r-- | arch/mips/txx9/rbtx4927/Makefile | 3 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4927/irq.c | 214 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4927/prom.c | 91 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4927/setup.c | 703 |
4 files changed, 1011 insertions, 0 deletions
diff --git a/arch/mips/txx9/rbtx4927/Makefile b/arch/mips/txx9/rbtx4927/Makefile new file mode 100644 index 000000000000..f3e1f597b4f1 --- /dev/null +++ b/arch/mips/txx9/rbtx4927/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-y += prom.o setup.o irq.o | ||
2 | |||
3 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/mips/txx9/rbtx4927/irq.c b/arch/mips/txx9/rbtx4927/irq.c new file mode 100644 index 000000000000..936e50e91d95 --- /dev/null +++ b/arch/mips/txx9/rbtx4927/irq.c | |||
@@ -0,0 +1,214 @@ | |||
1 | /* | ||
2 | * Toshiba RBTX4927 specific interrupt handlers | ||
3 | * | ||
4 | * Author: MontaVista Software, Inc. | ||
5 | * source@mvista.com | ||
6 | * | ||
7 | * Copyright 2001-2002 MontaVista Software Inc. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
19 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
20 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
22 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
23 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | /* | ||
30 | IRQ Device | ||
31 | 00 RBTX4927-ISA/00 | ||
32 | 01 RBTX4927-ISA/01 PS2/Keyboard | ||
33 | 02 RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15) | ||
34 | 03 RBTX4927-ISA/03 | ||
35 | 04 RBTX4927-ISA/04 | ||
36 | 05 RBTX4927-ISA/05 | ||
37 | 06 RBTX4927-ISA/06 | ||
38 | 07 RBTX4927-ISA/07 | ||
39 | 08 RBTX4927-ISA/08 | ||
40 | 09 RBTX4927-ISA/09 | ||
41 | 10 RBTX4927-ISA/10 | ||
42 | 11 RBTX4927-ISA/11 | ||
43 | 12 RBTX4927-ISA/12 PS2/Mouse (not supported at this time) | ||
44 | 13 RBTX4927-ISA/13 | ||
45 | 14 RBTX4927-ISA/14 IDE | ||
46 | 15 RBTX4927-ISA/15 | ||
47 | |||
48 | 16 TX4927-CP0/00 Software 0 | ||
49 | 17 TX4927-CP0/01 Software 1 | ||
50 | 18 TX4927-CP0/02 Cascade TX4927-CP0 | ||
51 | 19 TX4927-CP0/03 Multiplexed -- do not use | ||
52 | 20 TX4927-CP0/04 Multiplexed -- do not use | ||
53 | 21 TX4927-CP0/05 Multiplexed -- do not use | ||
54 | 22 TX4927-CP0/06 Multiplexed -- do not use | ||
55 | 23 TX4927-CP0/07 CPU TIMER | ||
56 | |||
57 | 24 TX4927-PIC/00 | ||
58 | 25 TX4927-PIC/01 | ||
59 | 26 TX4927-PIC/02 | ||
60 | 27 TX4927-PIC/03 Cascade RBTX4927-IOC | ||
61 | 28 TX4927-PIC/04 | ||
62 | 29 TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet | ||
63 | 30 TX4927-PIC/06 | ||
64 | 31 TX4927-PIC/07 | ||
65 | 32 TX4927-PIC/08 TX4927 SerialIO Channel 0 | ||
66 | 33 TX4927-PIC/09 TX4927 SerialIO Channel 1 | ||
67 | 34 TX4927-PIC/10 | ||
68 | 35 TX4927-PIC/11 | ||
69 | 36 TX4927-PIC/12 | ||
70 | 37 TX4927-PIC/13 | ||
71 | 38 TX4927-PIC/14 | ||
72 | 39 TX4927-PIC/15 | ||
73 | 40 TX4927-PIC/16 TX4927 PCI PCI-C | ||
74 | 41 TX4927-PIC/17 | ||
75 | 42 TX4927-PIC/18 | ||
76 | 43 TX4927-PIC/19 | ||
77 | 44 TX4927-PIC/20 | ||
78 | 45 TX4927-PIC/21 | ||
79 | 46 TX4927-PIC/22 TX4927 PCI PCI-ERR | ||
80 | 47 TX4927-PIC/23 TX4927 PCI PCI-PMA (not used) | ||
81 | 48 TX4927-PIC/24 | ||
82 | 49 TX4927-PIC/25 | ||
83 | 50 TX4927-PIC/26 | ||
84 | 51 TX4927-PIC/27 | ||
85 | 52 TX4927-PIC/28 | ||
86 | 53 TX4927-PIC/29 | ||
87 | 54 TX4927-PIC/30 | ||
88 | 55 TX4927-PIC/31 | ||
89 | |||
90 | 56 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed) [RTL-8139=PJ4] | ||
91 | 57 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed) [RTL-8139=PJ5] | ||
92 | 58 RBTX4927-IOC/02 FPCIB0 PCI-B PJ4/C PJ5/D SB/A PJ6/B PJ7/C (SouthBridge/IDE/pin=1,INTR) [RTL-8139=NotSupported] | ||
93 | 59 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4) [RTL-8139=PJ6] | ||
94 | 60 RBTX4927-IOC/04 | ||
95 | 61 RBTX4927-IOC/05 | ||
96 | 62 RBTX4927-IOC/06 | ||
97 | 63 RBTX4927-IOC/07 | ||
98 | |||
99 | NOTES: | ||
100 | SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58 | ||
101 | SouthBridge/ISA/pin=0 no pci irq used by this device | ||
102 | SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14 | ||
103 | SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59 | ||
104 | SouthBridge/PMC/pin=0 no pci irq used by this device | ||
105 | SuperIO/PS2/Keyboard, using INTR via ISA IRQ1 | ||
106 | SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported) | ||
107 | JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6 | ||
108 | */ | ||
109 | |||
110 | #include <linux/init.h> | ||
111 | #include <linux/types.h> | ||
112 | #include <linux/interrupt.h> | ||
113 | #include <asm/io.h> | ||
114 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
115 | #include <asm/i8259.h> | ||
116 | #endif | ||
117 | #include <asm/txx9/rbtx4927.h> | ||
118 | |||
119 | #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0 | ||
120 | #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_END 7 | ||
121 | |||
122 | #define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */ | ||
123 | #define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */ | ||
124 | |||
125 | #define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC | ||
126 | #define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2) | ||
127 | |||
128 | extern int tx4927_using_backplane; | ||
129 | |||
130 | static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq); | ||
131 | static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq); | ||
132 | |||
133 | #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" | ||
134 | static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { | ||
135 | .name = TOSHIBA_RBTX4927_IOC_NAME, | ||
136 | .ack = toshiba_rbtx4927_irq_ioc_disable, | ||
137 | .mask = toshiba_rbtx4927_irq_ioc_disable, | ||
138 | .mask_ack = toshiba_rbtx4927_irq_ioc_disable, | ||
139 | .unmask = toshiba_rbtx4927_irq_ioc_enable, | ||
140 | }; | ||
141 | #define TOSHIBA_RBTX4927_IOC_INTR_ENAB (void __iomem *)0xbc002000UL | ||
142 | #define TOSHIBA_RBTX4927_IOC_INTR_STAT (void __iomem *)0xbc002006UL | ||
143 | |||
144 | int toshiba_rbtx4927_irq_nested(int sw_irq) | ||
145 | { | ||
146 | u8 level3; | ||
147 | |||
148 | level3 = readb(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f; | ||
149 | if (level3) { | ||
150 | sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + fls(level3) - 1; | ||
151 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
152 | if (sw_irq == TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC && | ||
153 | tx4927_using_backplane) { | ||
154 | int irq = i8259_irq(); | ||
155 | if (irq >= 0) | ||
156 | sw_irq = irq; | ||
157 | } | ||
158 | #endif | ||
159 | } | ||
160 | return (sw_irq); | ||
161 | } | ||
162 | |||
163 | static struct irqaction toshiba_rbtx4927_irq_ioc_action = { | ||
164 | .handler = no_action, | ||
165 | .flags = IRQF_SHARED, | ||
166 | .mask = CPU_MASK_NONE, | ||
167 | .name = TOSHIBA_RBTX4927_IOC_NAME | ||
168 | }; | ||
169 | |||
170 | static void __init toshiba_rbtx4927_irq_ioc_init(void) | ||
171 | { | ||
172 | int i; | ||
173 | |||
174 | for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG; | ||
175 | i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++) | ||
176 | set_irq_chip_and_handler(i, &toshiba_rbtx4927_irq_ioc_type, | ||
177 | handle_level_irq); | ||
178 | |||
179 | setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC, | ||
180 | &toshiba_rbtx4927_irq_ioc_action); | ||
181 | } | ||
182 | |||
183 | static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq) | ||
184 | { | ||
185 | unsigned char v; | ||
186 | |||
187 | v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
188 | v |= (1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG)); | ||
189 | writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
190 | } | ||
191 | |||
192 | static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq) | ||
193 | { | ||
194 | unsigned char v; | ||
195 | |||
196 | v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
197 | v &= ~(1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG)); | ||
198 | writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
199 | mmiowb(); | ||
200 | } | ||
201 | |||
202 | void __init arch_init_irq(void) | ||
203 | { | ||
204 | extern void tx4927_irq_init(void); | ||
205 | |||
206 | tx4927_irq_init(); | ||
207 | toshiba_rbtx4927_irq_ioc_init(); | ||
208 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
209 | if (tx4927_using_backplane) | ||
210 | init_i8259_irqs(); | ||
211 | #endif | ||
212 | /* Onboard 10M Ether: High Active */ | ||
213 | set_irq_type(RBTX4927_RTL_8019_IRQ, IRQF_TRIGGER_HIGH); | ||
214 | } | ||
diff --git a/arch/mips/txx9/rbtx4927/prom.c b/arch/mips/txx9/rbtx4927/prom.c new file mode 100644 index 000000000000..0020bbee838b --- /dev/null +++ b/arch/mips/txx9/rbtx4927/prom.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * rbtx4927 specific prom routines | ||
3 | * | ||
4 | * Author: MontaVista Software, Inc. | ||
5 | * source@mvista.com | ||
6 | * | ||
7 | * Copyright 2001-2002 MontaVista Software Inc. | ||
8 | * | ||
9 | * Copyright (C) 2004 MontaVista Software Inc. | ||
10 | * Author: Manish Lachwani, mlachwani@mvista.com | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
22 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
23 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
25 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
26 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/string.h> | ||
34 | #include <asm/bootinfo.h> | ||
35 | #include <asm/cpu.h> | ||
36 | #include <asm/mipsregs.h> | ||
37 | #include <asm/txx9/tx4927.h> | ||
38 | |||
39 | void __init prom_init_cmdline(void) | ||
40 | { | ||
41 | int argc = (int) fw_arg0; | ||
42 | char **argv = (char **) fw_arg1; | ||
43 | int i; /* Always ignore the "-c" at argv[0] */ | ||
44 | |||
45 | /* ignore all built-in args if any f/w args given */ | ||
46 | if (argc > 1) { | ||
47 | *arcs_cmdline = '\0'; | ||
48 | } | ||
49 | |||
50 | for (i = 1; i < argc; i++) { | ||
51 | if (i != 1) { | ||
52 | strcat(arcs_cmdline, " "); | ||
53 | } | ||
54 | strcat(arcs_cmdline, argv[i]); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | void __init prom_init(void) | ||
59 | { | ||
60 | extern int tx4927_get_mem_size(void); | ||
61 | extern char* toshiba_name; | ||
62 | int msize; | ||
63 | |||
64 | prom_init_cmdline(); | ||
65 | |||
66 | if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) { | ||
67 | mips_machtype = MACH_TOSHIBA_RBTX4927; | ||
68 | toshiba_name = "TX4927"; | ||
69 | } else { | ||
70 | mips_machtype = MACH_TOSHIBA_RBTX4937; | ||
71 | toshiba_name = "TX4937"; | ||
72 | } | ||
73 | |||
74 | msize = tx4927_get_mem_size(); | ||
75 | add_memory_region(0, msize << 20, BOOT_MEM_RAM); | ||
76 | } | ||
77 | |||
78 | void __init prom_free_prom_memory(void) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | const char *get_system_type(void) | ||
83 | { | ||
84 | return "Toshiba RBTX4927/RBTX4937"; | ||
85 | } | ||
86 | |||
87 | char * __init prom_getcmdline(void) | ||
88 | { | ||
89 | return &(arcs_cmdline[0]); | ||
90 | } | ||
91 | |||
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c new file mode 100644 index 000000000000..df1b6e99b666 --- /dev/null +++ b/arch/mips/txx9/rbtx4927/setup.c | |||
@@ -0,0 +1,703 @@ | |||
1 | /* | ||
2 | * Toshiba rbtx4927 specific setup | ||
3 | * | ||
4 | * Author: MontaVista Software, Inc. | ||
5 | * source@mvista.com | ||
6 | * | ||
7 | * Copyright 2001-2002 MontaVista Software Inc. | ||
8 | * | ||
9 | * Copyright (C) 1996, 97, 2001, 04 Ralf Baechle (ralf@linux-mips.org) | ||
10 | * Copyright (C) 2000 RidgeRun, Inc. | ||
11 | * Author: RidgeRun, Inc. | ||
12 | * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com | ||
13 | * | ||
14 | * Copyright 2001 MontaVista Software Inc. | ||
15 | * Author: jsun@mvista.com or jsun@junsun.net | ||
16 | * | ||
17 | * Copyright 2002 MontaVista Software Inc. | ||
18 | * Author: Michael Pruznick, michael_pruznick@mvista.com | ||
19 | * | ||
20 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
21 | * | ||
22 | * Copyright (C) 2004 MontaVista Software Inc. | ||
23 | * Author: Manish Lachwani, mlachwani@mvista.com | ||
24 | * | ||
25 | * This program is free software; you can redistribute it and/or modify it | ||
26 | * under the terms of the GNU General Public License as published by the | ||
27 | * Free Software Foundation; either version 2 of the License, or (at your | ||
28 | * option) any later version. | ||
29 | * | ||
30 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
31 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
33 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
36 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
38 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
39 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
40 | * | ||
41 | * You should have received a copy of the GNU General Public License along | ||
42 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
43 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
44 | */ | ||
45 | #include <linux/init.h> | ||
46 | #include <linux/kernel.h> | ||
47 | #include <linux/types.h> | ||
48 | #include <linux/ioport.h> | ||
49 | #include <linux/interrupt.h> | ||
50 | #include <linux/pci.h> | ||
51 | #include <linux/pm.h> | ||
52 | #include <linux/platform_device.h> | ||
53 | #include <linux/clk.h> | ||
54 | |||
55 | #include <asm/bootinfo.h> | ||
56 | #include <asm/io.h> | ||
57 | #include <asm/processor.h> | ||
58 | #include <asm/reboot.h> | ||
59 | #include <asm/time.h> | ||
60 | #include <asm/txx9tmr.h> | ||
61 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
62 | #include <asm/txx9/smsc_fdc37m81x.h> | ||
63 | #endif | ||
64 | #include <asm/txx9/rbtx4927.h> | ||
65 | #ifdef CONFIG_SERIAL_TXX9 | ||
66 | #include <linux/serial_core.h> | ||
67 | #endif | ||
68 | |||
69 | /* These functions are used for rebooting or halting the machine*/ | ||
70 | extern void toshiba_rbtx4927_restart(char *command); | ||
71 | extern void toshiba_rbtx4927_halt(void); | ||
72 | extern void toshiba_rbtx4927_power_off(void); | ||
73 | |||
74 | int tx4927_using_backplane = 0; | ||
75 | |||
76 | extern void toshiba_rbtx4927_irq_setup(void); | ||
77 | |||
78 | char *prom_getcmdline(void); | ||
79 | |||
80 | #ifdef CONFIG_PCI | ||
81 | #undef TX4927_SUPPORT_COMMAND_IO | ||
82 | #undef TX4927_SUPPORT_PCI_66 | ||
83 | int tx4927_cpu_clock = 100000000; /* 100MHz */ | ||
84 | unsigned long mips_pci_io_base; | ||
85 | unsigned long mips_pci_io_size; | ||
86 | unsigned long mips_pci_mem_base; | ||
87 | unsigned long mips_pci_mem_size; | ||
88 | /* for legacy I/O, PCI I/O PCI Bus address must be 0 */ | ||
89 | unsigned long mips_pci_io_pciaddr = 0; | ||
90 | unsigned long mips_memory_upper; | ||
91 | static int tx4927_ccfg_toeon = 1; | ||
92 | static int tx4927_pcic_trdyto = 0; /* default: disabled */ | ||
93 | unsigned long tx4927_ce_base[8]; | ||
94 | int tx4927_pci66 = 0; /* 0:auto */ | ||
95 | #endif | ||
96 | |||
97 | char *toshiba_name = ""; | ||
98 | |||
99 | #ifdef CONFIG_PCI | ||
100 | extern struct pci_controller tx4927_controller; | ||
101 | |||
102 | static struct pci_dev *fake_pci_dev(struct pci_controller *hose, | ||
103 | int top_bus, int busnr, int devfn) | ||
104 | { | ||
105 | static struct pci_dev dev; | ||
106 | static struct pci_bus bus; | ||
107 | |||
108 | dev.sysdata = (void *)hose; | ||
109 | dev.devfn = devfn; | ||
110 | bus.number = busnr; | ||
111 | bus.ops = hose->pci_ops; | ||
112 | bus.parent = NULL; | ||
113 | dev.bus = &bus; | ||
114 | |||
115 | return &dev; | ||
116 | } | ||
117 | |||
118 | #define EARLY_PCI_OP(rw, size, type) \ | ||
119 | static int early_##rw##_config_##size(struct pci_controller *hose, \ | ||
120 | int top_bus, int bus, int devfn, int offset, type value) \ | ||
121 | { \ | ||
122 | return pci_##rw##_config_##size( \ | ||
123 | fake_pci_dev(hose, top_bus, bus, devfn), \ | ||
124 | offset, value); \ | ||
125 | } | ||
126 | |||
127 | EARLY_PCI_OP(read, byte, u8 *) | ||
128 | EARLY_PCI_OP(read, dword, u32 *) | ||
129 | EARLY_PCI_OP(write, byte, u8) | ||
130 | EARLY_PCI_OP(write, dword, u32) | ||
131 | |||
132 | static int __init tx4927_pcibios_init(void) | ||
133 | { | ||
134 | unsigned int id; | ||
135 | u32 pci_devfn; | ||
136 | int devfn_start = 0; | ||
137 | int devfn_stop = 0xff; | ||
138 | int busno = 0; /* One bus on the Toshiba */ | ||
139 | struct pci_controller *hose = &tx4927_controller; | ||
140 | |||
141 | for (pci_devfn = devfn_start; pci_devfn < devfn_stop; pci_devfn++) { | ||
142 | early_read_config_dword(hose, busno, busno, pci_devfn, | ||
143 | PCI_VENDOR_ID, &id); | ||
144 | |||
145 | if (id == 0xffffffff) { | ||
146 | continue; | ||
147 | } | ||
148 | |||
149 | if (id == 0x94601055) { | ||
150 | u8 v08_64; | ||
151 | u32 v32_b0; | ||
152 | u8 v08_e1; | ||
153 | |||
154 | early_read_config_byte(hose, busno, busno, | ||
155 | pci_devfn, 0x64, &v08_64); | ||
156 | early_read_config_dword(hose, busno, busno, | ||
157 | pci_devfn, 0xb0, &v32_b0); | ||
158 | early_read_config_byte(hose, busno, busno, | ||
159 | pci_devfn, 0xe1, &v08_e1); | ||
160 | |||
161 | /* serial irq control */ | ||
162 | v08_64 = 0xd0; | ||
163 | |||
164 | /* serial irq pin */ | ||
165 | v32_b0 |= 0x00010000; | ||
166 | |||
167 | /* ide irq on isa14 */ | ||
168 | v08_e1 &= 0xf0; | ||
169 | v08_e1 |= 0x0d; | ||
170 | |||
171 | early_write_config_byte(hose, busno, busno, | ||
172 | pci_devfn, 0x64, v08_64); | ||
173 | early_write_config_dword(hose, busno, busno, | ||
174 | pci_devfn, 0xb0, v32_b0); | ||
175 | early_write_config_byte(hose, busno, busno, | ||
176 | pci_devfn, 0xe1, v08_e1); | ||
177 | } | ||
178 | |||
179 | if (id == 0x91301055) { | ||
180 | u8 v08_04; | ||
181 | u8 v08_09; | ||
182 | u8 v08_41; | ||
183 | u8 v08_43; | ||
184 | u8 v08_5c; | ||
185 | |||
186 | early_read_config_byte(hose, busno, busno, | ||
187 | pci_devfn, 0x04, &v08_04); | ||
188 | early_read_config_byte(hose, busno, busno, | ||
189 | pci_devfn, 0x09, &v08_09); | ||
190 | early_read_config_byte(hose, busno, busno, | ||
191 | pci_devfn, 0x41, &v08_41); | ||
192 | early_read_config_byte(hose, busno, busno, | ||
193 | pci_devfn, 0x43, &v08_43); | ||
194 | early_read_config_byte(hose, busno, busno, | ||
195 | pci_devfn, 0x5c, &v08_5c); | ||
196 | |||
197 | /* enable ide master/io */ | ||
198 | v08_04 |= (PCI_COMMAND_MASTER | PCI_COMMAND_IO); | ||
199 | |||
200 | /* enable ide native mode */ | ||
201 | v08_09 |= 0x05; | ||
202 | |||
203 | /* enable primary ide */ | ||
204 | v08_41 |= 0x80; | ||
205 | |||
206 | /* enable secondary ide */ | ||
207 | v08_43 |= 0x80; | ||
208 | |||
209 | /* | ||
210 | * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!! | ||
211 | * | ||
212 | * This line of code is intended to provide the user with a work | ||
213 | * around solution to the anomalies cited in SMSC's anomaly sheet | ||
214 | * entitled, "SLC90E66 Functional Rev.J_0.1 Anomalies"". | ||
215 | * | ||
216 | * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!! | ||
217 | */ | ||
218 | v08_5c |= 0x01; | ||
219 | |||
220 | early_write_config_byte(hose, busno, busno, | ||
221 | pci_devfn, 0x5c, v08_5c); | ||
222 | early_write_config_byte(hose, busno, busno, | ||
223 | pci_devfn, 0x04, v08_04); | ||
224 | early_write_config_byte(hose, busno, busno, | ||
225 | pci_devfn, 0x09, v08_09); | ||
226 | early_write_config_byte(hose, busno, busno, | ||
227 | pci_devfn, 0x41, v08_41); | ||
228 | early_write_config_byte(hose, busno, busno, | ||
229 | pci_devfn, 0x43, v08_43); | ||
230 | } | ||
231 | |||
232 | } | ||
233 | |||
234 | register_pci_controller(&tx4927_controller); | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | arch_initcall(tx4927_pcibios_init); | ||
239 | |||
240 | extern struct resource pci_io_resource; | ||
241 | extern struct resource pci_mem_resource; | ||
242 | |||
243 | void __init tx4927_pci_setup(void) | ||
244 | { | ||
245 | static int called = 0; | ||
246 | extern unsigned int tx4927_get_mem_size(void); | ||
247 | |||
248 | mips_memory_upper = tx4927_get_mem_size() << 20; | ||
249 | mips_memory_upper += KSEG0; | ||
250 | mips_pci_io_base = TX4927_PCIIO; | ||
251 | mips_pci_io_size = TX4927_PCIIO_SIZE; | ||
252 | mips_pci_mem_base = TX4927_PCIMEM; | ||
253 | mips_pci_mem_size = TX4927_PCIMEM_SIZE; | ||
254 | |||
255 | if (!called) { | ||
256 | printk | ||
257 | ("%s PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", | ||
258 | toshiba_name, | ||
259 | (unsigned short) (tx4927_pcicptr->pciid >> 16), | ||
260 | (unsigned short) (tx4927_pcicptr->pciid & 0xffff), | ||
261 | (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), | ||
262 | (!(tx4927_ccfgptr-> | ||
263 | ccfg & TX4927_CCFG_PCIXARB)) ? "External" : | ||
264 | "Internal"); | ||
265 | called = 1; | ||
266 | } | ||
267 | printk("%s PCIC --%s PCICLK:", toshiba_name, | ||
268 | (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); | ||
269 | if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { | ||
270 | int pciclk = 0; | ||
271 | if (mips_machtype == MACH_TOSHIBA_RBTX4937) | ||
272 | switch ((unsigned long) tx4927_ccfgptr-> | ||
273 | ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { | ||
274 | case TX4937_CCFG_PCIDIVMODE_4: | ||
275 | pciclk = tx4927_cpu_clock / 4; | ||
276 | break; | ||
277 | case TX4937_CCFG_PCIDIVMODE_4_5: | ||
278 | pciclk = tx4927_cpu_clock * 2 / 9; | ||
279 | break; | ||
280 | case TX4937_CCFG_PCIDIVMODE_5: | ||
281 | pciclk = tx4927_cpu_clock / 5; | ||
282 | break; | ||
283 | case TX4937_CCFG_PCIDIVMODE_5_5: | ||
284 | pciclk = tx4927_cpu_clock * 2 / 11; | ||
285 | break; | ||
286 | case TX4937_CCFG_PCIDIVMODE_8: | ||
287 | pciclk = tx4927_cpu_clock / 8; | ||
288 | break; | ||
289 | case TX4937_CCFG_PCIDIVMODE_9: | ||
290 | pciclk = tx4927_cpu_clock / 9; | ||
291 | break; | ||
292 | case TX4937_CCFG_PCIDIVMODE_10: | ||
293 | pciclk = tx4927_cpu_clock / 10; | ||
294 | break; | ||
295 | case TX4937_CCFG_PCIDIVMODE_11: | ||
296 | pciclk = tx4927_cpu_clock / 11; | ||
297 | break; | ||
298 | } | ||
299 | |||
300 | else | ||
301 | switch ((unsigned long) tx4927_ccfgptr-> | ||
302 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | ||
303 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
304 | pciclk = tx4927_cpu_clock * 2 / 5; | ||
305 | break; | ||
306 | case TX4927_CCFG_PCIDIVMODE_3: | ||
307 | pciclk = tx4927_cpu_clock / 3; | ||
308 | break; | ||
309 | case TX4927_CCFG_PCIDIVMODE_5: | ||
310 | pciclk = tx4927_cpu_clock / 5; | ||
311 | break; | ||
312 | case TX4927_CCFG_PCIDIVMODE_6: | ||
313 | pciclk = tx4927_cpu_clock / 6; | ||
314 | break; | ||
315 | } | ||
316 | |||
317 | printk("Internal(%dMHz)", pciclk / 1000000); | ||
318 | } else | ||
319 | printk("External"); | ||
320 | printk("\n"); | ||
321 | |||
322 | /* GB->PCI mappings */ | ||
323 | tx4927_pcicptr->g2piomask = (mips_pci_io_size - 1) >> 4; | ||
324 | tx4927_pcicptr->g2piogbase = mips_pci_io_base | | ||
325 | #ifdef __BIG_ENDIAN | ||
326 | TX4927_PCIC_G2PIOGBASE_ECHG | ||
327 | #else | ||
328 | TX4927_PCIC_G2PIOGBASE_BSDIS | ||
329 | #endif | ||
330 | ; | ||
331 | |||
332 | tx4927_pcicptr->g2piopbase = 0; | ||
333 | |||
334 | tx4927_pcicptr->g2pmmask[0] = (mips_pci_mem_size - 1) >> 4; | ||
335 | tx4927_pcicptr->g2pmgbase[0] = mips_pci_mem_base | | ||
336 | #ifdef __BIG_ENDIAN | ||
337 | TX4927_PCIC_G2PMnGBASE_ECHG | ||
338 | #else | ||
339 | TX4927_PCIC_G2PMnGBASE_BSDIS | ||
340 | #endif | ||
341 | ; | ||
342 | tx4927_pcicptr->g2pmpbase[0] = mips_pci_mem_base; | ||
343 | |||
344 | tx4927_pcicptr->g2pmmask[1] = 0; | ||
345 | tx4927_pcicptr->g2pmgbase[1] = 0; | ||
346 | tx4927_pcicptr->g2pmpbase[1] = 0; | ||
347 | tx4927_pcicptr->g2pmmask[2] = 0; | ||
348 | tx4927_pcicptr->g2pmgbase[2] = 0; | ||
349 | tx4927_pcicptr->g2pmpbase[2] = 0; | ||
350 | |||
351 | |||
352 | /* PCI->GB mappings (I/O 256B) */ | ||
353 | tx4927_pcicptr->p2giopbase = 0; /* 256B */ | ||
354 | |||
355 | /* PCI->GB mappings (MEM 512MB) M0 gets all of memory */ | ||
356 | tx4927_pcicptr->p2gm0plbase = 0; | ||
357 | tx4927_pcicptr->p2gm0pubase = 0; | ||
358 | tx4927_pcicptr->p2gmgbase[0] = 0 | TX4927_PCIC_P2GMnGBASE_TMEMEN | | ||
359 | #ifdef __BIG_ENDIAN | ||
360 | TX4927_PCIC_P2GMnGBASE_TECHG | ||
361 | #else | ||
362 | TX4927_PCIC_P2GMnGBASE_TBSDIS | ||
363 | #endif | ||
364 | ; | ||
365 | |||
366 | /* PCI->GB mappings (MEM 16MB) -not used */ | ||
367 | tx4927_pcicptr->p2gm1plbase = 0xffffffff; | ||
368 | tx4927_pcicptr->p2gm1pubase = 0xffffffff; | ||
369 | tx4927_pcicptr->p2gmgbase[1] = 0; | ||
370 | |||
371 | /* PCI->GB mappings (MEM 1MB) -not used */ | ||
372 | tx4927_pcicptr->p2gm2pbase = 0xffffffff; | ||
373 | tx4927_pcicptr->p2gmgbase[2] = 0; | ||
374 | |||
375 | |||
376 | /* Enable Initiator Memory 0 Space, I/O Space, Config */ | ||
377 | tx4927_pcicptr->pciccfg &= TX4927_PCIC_PCICCFG_LBWC_MASK; | ||
378 | tx4927_pcicptr->pciccfg |= | ||
379 | TX4927_PCIC_PCICCFG_IMSE0 | TX4927_PCIC_PCICCFG_IISE | | ||
380 | TX4927_PCIC_PCICCFG_ICAE | TX4927_PCIC_PCICCFG_ATR; | ||
381 | |||
382 | |||
383 | /* Do not use MEMMUL, MEMINF: YMFPCI card causes M_ABORT. */ | ||
384 | tx4927_pcicptr->pcicfg1 = 0; | ||
385 | |||
386 | if (tx4927_pcic_trdyto >= 0) { | ||
387 | tx4927_pcicptr->g2ptocnt &= ~0xff; | ||
388 | tx4927_pcicptr->g2ptocnt |= (tx4927_pcic_trdyto & 0xff); | ||
389 | } | ||
390 | |||
391 | /* Clear All Local Bus Status */ | ||
392 | tx4927_pcicptr->pcicstatus = TX4927_PCIC_PCICSTATUS_ALL; | ||
393 | /* Enable All Local Bus Interrupts */ | ||
394 | tx4927_pcicptr->pcicmask = TX4927_PCIC_PCICSTATUS_ALL; | ||
395 | /* Clear All Initiator Status */ | ||
396 | tx4927_pcicptr->g2pstatus = TX4927_PCIC_G2PSTATUS_ALL; | ||
397 | /* Enable All Initiator Interrupts */ | ||
398 | tx4927_pcicptr->g2pmask = TX4927_PCIC_G2PSTATUS_ALL; | ||
399 | /* Clear All PCI Status Error */ | ||
400 | tx4927_pcicptr->pcistatus = | ||
401 | (tx4927_pcicptr->pcistatus & 0x0000ffff) | | ||
402 | (TX4927_PCIC_PCISTATUS_ALL << 16); | ||
403 | /* Enable All PCI Status Error Interrupts */ | ||
404 | tx4927_pcicptr->pcimask = TX4927_PCIC_PCISTATUS_ALL; | ||
405 | |||
406 | /* PCIC Int => IRC IRQ16 */ | ||
407 | tx4927_pcicptr->pcicfg2 = | ||
408 | (tx4927_pcicptr->pcicfg2 & 0xffffff00) | TX4927_IR_PCIC; | ||
409 | |||
410 | if (!(tx4927_ccfgptr->ccfg & TX4927_CCFG_PCIXARB)) { | ||
411 | /* XXX */ | ||
412 | } else { | ||
413 | /* Reset Bus Arbiter */ | ||
414 | tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_RPBA; | ||
415 | /* Enable Bus Arbiter */ | ||
416 | tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_PBAEN; | ||
417 | } | ||
418 | |||
419 | tx4927_pcicptr->pcistatus = PCI_COMMAND_MASTER | | ||
420 | PCI_COMMAND_MEMORY | | ||
421 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; | ||
422 | } | ||
423 | #endif /* CONFIG_PCI */ | ||
424 | |||
425 | static void __noreturn wait_forever(void) | ||
426 | { | ||
427 | while (1) | ||
428 | if (cpu_wait) | ||
429 | (*cpu_wait)(); | ||
430 | } | ||
431 | |||
432 | void toshiba_rbtx4927_restart(char *command) | ||
433 | { | ||
434 | printk(KERN_NOTICE "System Rebooting...\n"); | ||
435 | |||
436 | /* enable the s/w reset register */ | ||
437 | writeb(RBTX4927_SW_RESET_ENABLE_SET, RBTX4927_SW_RESET_ENABLE); | ||
438 | |||
439 | /* wait for enable to be seen */ | ||
440 | while ((readb(RBTX4927_SW_RESET_ENABLE) & | ||
441 | RBTX4927_SW_RESET_ENABLE_SET) == 0x00); | ||
442 | |||
443 | /* do a s/w reset */ | ||
444 | writeb(RBTX4927_SW_RESET_DO_SET, RBTX4927_SW_RESET_DO); | ||
445 | |||
446 | /* do something passive while waiting for reset */ | ||
447 | local_irq_disable(); | ||
448 | wait_forever(); | ||
449 | /* no return */ | ||
450 | } | ||
451 | |||
452 | void toshiba_rbtx4927_halt(void) | ||
453 | { | ||
454 | printk(KERN_NOTICE "System Halted\n"); | ||
455 | local_irq_disable(); | ||
456 | wait_forever(); | ||
457 | /* no return */ | ||
458 | } | ||
459 | |||
460 | void toshiba_rbtx4927_power_off(void) | ||
461 | { | ||
462 | toshiba_rbtx4927_halt(); | ||
463 | /* no return */ | ||
464 | } | ||
465 | |||
466 | void __init plat_mem_setup(void) | ||
467 | { | ||
468 | int i; | ||
469 | u32 cp0_config; | ||
470 | char *argptr; | ||
471 | |||
472 | printk("CPU is %s\n", toshiba_name); | ||
473 | |||
474 | /* f/w leaves this on at startup */ | ||
475 | clear_c0_status(ST0_ERL); | ||
476 | |||
477 | /* enable caches -- HCP5 does this, pmon does not */ | ||
478 | cp0_config = read_c0_config(); | ||
479 | cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC); | ||
480 | write_c0_config(cp0_config); | ||
481 | |||
482 | set_io_port_base(KSEG1 + TBTX4927_ISA_IO_OFFSET); | ||
483 | |||
484 | ioport_resource.end = 0xffffffff; | ||
485 | iomem_resource.end = 0xffffffff; | ||
486 | |||
487 | _machine_restart = toshiba_rbtx4927_restart; | ||
488 | _machine_halt = toshiba_rbtx4927_halt; | ||
489 | pm_power_off = toshiba_rbtx4927_power_off; | ||
490 | |||
491 | for (i = 0; i < TX4927_NR_TMR; i++) | ||
492 | txx9_tmr_init(TX4927_TMR_REG(0) & 0xfffffffffULL); | ||
493 | |||
494 | #ifdef CONFIG_PCI | ||
495 | |||
496 | /* PCIC */ | ||
497 | /* | ||
498 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. | ||
499 | * | ||
500 | * For TX4927: | ||
501 | * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). | ||
502 | * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) | ||
503 | * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) | ||
504 | * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) | ||
505 | * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) | ||
506 | * i.e. S9[3]: ON (83MHz), OFF (100MHz) | ||
507 | * | ||
508 | * For TX4937: | ||
509 | * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) | ||
510 | * PCIDIVMODE[10] is 0. | ||
511 | * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) | ||
512 | * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) | ||
513 | * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) | ||
514 | * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) | ||
515 | * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) | ||
516 | * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) | ||
517 | * | ||
518 | */ | ||
519 | if (mips_machtype == MACH_TOSHIBA_RBTX4937) | ||
520 | switch ((unsigned long)tx4927_ccfgptr-> | ||
521 | ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { | ||
522 | case TX4937_CCFG_PCIDIVMODE_8: | ||
523 | case TX4937_CCFG_PCIDIVMODE_4: | ||
524 | tx4927_cpu_clock = 266666666; /* 266MHz */ | ||
525 | break; | ||
526 | case TX4937_CCFG_PCIDIVMODE_9: | ||
527 | case TX4937_CCFG_PCIDIVMODE_4_5: | ||
528 | tx4927_cpu_clock = 300000000; /* 300MHz */ | ||
529 | break; | ||
530 | default: | ||
531 | tx4927_cpu_clock = 333333333; /* 333MHz */ | ||
532 | } | ||
533 | else | ||
534 | switch ((unsigned long)tx4927_ccfgptr-> | ||
535 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | ||
536 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
537 | case TX4927_CCFG_PCIDIVMODE_5: | ||
538 | tx4927_cpu_clock = 166666666; /* 166MHz */ | ||
539 | break; | ||
540 | default: | ||
541 | tx4927_cpu_clock = 200000000; /* 200MHz */ | ||
542 | } | ||
543 | |||
544 | /* CCFG */ | ||
545 | /* do reset on watchdog */ | ||
546 | tx4927_ccfgptr->ccfg |= TX4927_CCFG_WR; | ||
547 | /* enable Timeout BusError */ | ||
548 | if (tx4927_ccfg_toeon) | ||
549 | tx4927_ccfgptr->ccfg |= TX4927_CCFG_TOE; | ||
550 | |||
551 | tx4927_pci_setup(); | ||
552 | if (tx4927_using_backplane == 1) | ||
553 | printk("backplane board IS installed\n"); | ||
554 | else | ||
555 | printk("No Backplane \n"); | ||
556 | |||
557 | /* this is on ISA bus behind PCI bus, so need PCI up first */ | ||
558 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
559 | if (tx4927_using_backplane) { | ||
560 | smsc_fdc37m81x_init(0x3f0); | ||
561 | smsc_fdc37m81x_config_beg(); | ||
562 | smsc_fdc37m81x_config_set(SMSC_FDC37M81X_DNUM, | ||
563 | SMSC_FDC37M81X_KBD); | ||
564 | smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT, 1); | ||
565 | smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT2, 12); | ||
566 | smsc_fdc37m81x_config_set(SMSC_FDC37M81X_ACTIVE, | ||
567 | 1); | ||
568 | smsc_fdc37m81x_config_end(); | ||
569 | } | ||
570 | #endif | ||
571 | #endif /* CONFIG_PCI */ | ||
572 | |||
573 | #ifdef CONFIG_SERIAL_TXX9 | ||
574 | { | ||
575 | extern int early_serial_txx9_setup(struct uart_port *port); | ||
576 | struct uart_port req; | ||
577 | for(i = 0; i < 2; i++) { | ||
578 | memset(&req, 0, sizeof(req)); | ||
579 | req.line = i; | ||
580 | req.iotype = UPIO_MEM; | ||
581 | req.membase = (char *)(0xff1ff300 + i * 0x100); | ||
582 | req.mapbase = 0xff1ff300 + i * 0x100; | ||
583 | req.irq = TX4927_IRQ_PIC_BEG + 8 + i; | ||
584 | req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/; | ||
585 | req.uartclk = 50000000; | ||
586 | early_serial_txx9_setup(&req); | ||
587 | } | ||
588 | } | ||
589 | #ifdef CONFIG_SERIAL_TXX9_CONSOLE | ||
590 | argptr = prom_getcmdline(); | ||
591 | if (strstr(argptr, "console=") == NULL) { | ||
592 | strcat(argptr, " console=ttyS0,38400"); | ||
593 | } | ||
594 | #endif | ||
595 | #endif | ||
596 | |||
597 | #ifdef CONFIG_ROOT_NFS | ||
598 | argptr = prom_getcmdline(); | ||
599 | if (strstr(argptr, "root=") == NULL) { | ||
600 | strcat(argptr, " root=/dev/nfs rw"); | ||
601 | } | ||
602 | #endif | ||
603 | |||
604 | #ifdef CONFIG_IP_PNP | ||
605 | argptr = prom_getcmdline(); | ||
606 | if (strstr(argptr, "ip=") == NULL) { | ||
607 | strcat(argptr, " ip=any"); | ||
608 | } | ||
609 | #endif | ||
610 | } | ||
611 | |||
612 | void __init plat_time_init(void) | ||
613 | { | ||
614 | mips_hpt_frequency = tx4927_cpu_clock / 2; | ||
615 | if (tx4927_ccfgptr->ccfg & TX4927_CCFG_TINTDIS) | ||
616 | txx9_clockevent_init(TX4927_TMR_REG(0) & 0xfffffffffULL, | ||
617 | TXX9_IRQ_BASE + 17, | ||
618 | 50000000); | ||
619 | } | ||
620 | |||
621 | static int __init toshiba_rbtx4927_rtc_init(void) | ||
622 | { | ||
623 | static struct resource __initdata res = { | ||
624 | .start = 0x1c010000, | ||
625 | .end = 0x1c010000 + 0x800 - 1, | ||
626 | .flags = IORESOURCE_MEM, | ||
627 | }; | ||
628 | struct platform_device *dev = | ||
629 | platform_device_register_simple("rtc-ds1742", -1, &res, 1); | ||
630 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
631 | } | ||
632 | device_initcall(toshiba_rbtx4927_rtc_init); | ||
633 | |||
634 | static int __init rbtx4927_ne_init(void) | ||
635 | { | ||
636 | static struct resource __initdata res[] = { | ||
637 | { | ||
638 | .start = RBTX4927_RTL_8019_BASE, | ||
639 | .end = RBTX4927_RTL_8019_BASE + 0x20 - 1, | ||
640 | .flags = IORESOURCE_IO, | ||
641 | }, { | ||
642 | .start = RBTX4927_RTL_8019_IRQ, | ||
643 | .flags = IORESOURCE_IRQ, | ||
644 | } | ||
645 | }; | ||
646 | struct platform_device *dev = | ||
647 | platform_device_register_simple("ne", -1, | ||
648 | res, ARRAY_SIZE(res)); | ||
649 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
650 | } | ||
651 | device_initcall(rbtx4927_ne_init); | ||
652 | |||
653 | /* Watchdog support */ | ||
654 | |||
655 | static int __init txx9_wdt_init(unsigned long base) | ||
656 | { | ||
657 | struct resource res = { | ||
658 | .start = base, | ||
659 | .end = base + 0x100 - 1, | ||
660 | .flags = IORESOURCE_MEM, | ||
661 | }; | ||
662 | struct platform_device *dev = | ||
663 | platform_device_register_simple("txx9wdt", -1, &res, 1); | ||
664 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
665 | } | ||
666 | |||
667 | static int __init rbtx4927_wdt_init(void) | ||
668 | { | ||
669 | return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL); | ||
670 | } | ||
671 | device_initcall(rbtx4927_wdt_init); | ||
672 | |||
673 | /* Minimum CLK support */ | ||
674 | |||
675 | struct clk *clk_get(struct device *dev, const char *id) | ||
676 | { | ||
677 | if (!strcmp(id, "imbus_clk")) | ||
678 | return (struct clk *)50000000; | ||
679 | return ERR_PTR(-ENOENT); | ||
680 | } | ||
681 | EXPORT_SYMBOL(clk_get); | ||
682 | |||
683 | int clk_enable(struct clk *clk) | ||
684 | { | ||
685 | return 0; | ||
686 | } | ||
687 | EXPORT_SYMBOL(clk_enable); | ||
688 | |||
689 | void clk_disable(struct clk *clk) | ||
690 | { | ||
691 | } | ||
692 | EXPORT_SYMBOL(clk_disable); | ||
693 | |||
694 | unsigned long clk_get_rate(struct clk *clk) | ||
695 | { | ||
696 | return (unsigned long)clk; | ||
697 | } | ||
698 | EXPORT_SYMBOL(clk_get_rate); | ||
699 | |||
700 | void clk_put(struct clk *clk) | ||
701 | { | ||
702 | } | ||
703 | EXPORT_SYMBOL(clk_put); | ||