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/tx4927 | |
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/tx4927')
-rw-r--r-- | arch/mips/tx4927/Kconfig | 3 | ||||
-rw-r--r-- | arch/mips/tx4927/common/Makefile | 10 | ||||
-rw-r--r-- | arch/mips/tx4927/common/smsc_fdc37m81x.c | 172 | ||||
-rw-r--r-- | arch/mips/tx4927/common/tx4927_dbgio.c | 43 | ||||
-rw-r--r-- | arch/mips/tx4927/common/tx4927_irq.c | 65 | ||||
-rw-r--r-- | arch/mips/tx4927/common/tx4927_prom.c | 142 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/Makefile | 5 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c | 216 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c | 91 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | 703 |
10 files changed, 0 insertions, 1450 deletions
diff --git a/arch/mips/tx4927/Kconfig b/arch/mips/tx4927/Kconfig deleted file mode 100644 index 5fbbe12e0fc1..000000000000 --- a/arch/mips/tx4927/Kconfig +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | config TOSHIBA_FPCIB0 | ||
2 | bool "FPCIB0 Backplane Support" | ||
3 | depends on TOSHIBA_RBTX4927 | ||
diff --git a/arch/mips/tx4927/common/Makefile b/arch/mips/tx4927/common/Makefile deleted file mode 100644 index a7fe76a64964..000000000000 --- a/arch/mips/tx4927/common/Makefile +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for common code for Toshiba TX4927 based systems | ||
3 | # | ||
4 | |||
5 | obj-y += tx4927_prom.o tx4927_irq.o | ||
6 | |||
7 | obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o | ||
8 | obj-$(CONFIG_KGDB) += tx4927_dbgio.o | ||
9 | |||
10 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/mips/tx4927/common/smsc_fdc37m81x.c b/arch/mips/tx4927/common/smsc_fdc37m81x.c deleted file mode 100644 index 33f517bc9a08..000000000000 --- a/arch/mips/tx4927/common/smsc_fdc37m81x.c +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | * Interface for smsc fdc48m81x Super IO chip | ||
3 | * | ||
4 | * Author: MontaVista Software, Inc. source@mvista.com | ||
5 | * | ||
6 | * 2001-2003 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | * | ||
11 | * Copyright 2004 (c) MontaVista Software, Inc. | ||
12 | */ | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <asm/io.h> | ||
16 | #include <asm/tx4927/smsc_fdc37m81x.h> | ||
17 | |||
18 | #define DEBUG | ||
19 | |||
20 | /* Common Registers */ | ||
21 | #define SMSC_FDC37M81X_CONFIG_INDEX 0x00 | ||
22 | #define SMSC_FDC37M81X_CONFIG_DATA 0x01 | ||
23 | #define SMSC_FDC37M81X_CONF 0x02 | ||
24 | #define SMSC_FDC37M81X_INDEX 0x03 | ||
25 | #define SMSC_FDC37M81X_DNUM 0x07 | ||
26 | #define SMSC_FDC37M81X_DID 0x20 | ||
27 | #define SMSC_FDC37M81X_DREV 0x21 | ||
28 | #define SMSC_FDC37M81X_PCNT 0x22 | ||
29 | #define SMSC_FDC37M81X_PMGT 0x23 | ||
30 | #define SMSC_FDC37M81X_OSC 0x24 | ||
31 | #define SMSC_FDC37M81X_CONFPA0 0x26 | ||
32 | #define SMSC_FDC37M81X_CONFPA1 0x27 | ||
33 | #define SMSC_FDC37M81X_TEST4 0x2B | ||
34 | #define SMSC_FDC37M81X_TEST5 0x2C | ||
35 | #define SMSC_FDC37M81X_TEST1 0x2D | ||
36 | #define SMSC_FDC37M81X_TEST2 0x2E | ||
37 | #define SMSC_FDC37M81X_TEST3 0x2F | ||
38 | |||
39 | /* Logical device numbers */ | ||
40 | #define SMSC_FDC37M81X_FDD 0x00 | ||
41 | #define SMSC_FDC37M81X_SERIAL1 0x04 | ||
42 | #define SMSC_FDC37M81X_SERIAL2 0x05 | ||
43 | #define SMSC_FDC37M81X_KBD 0x07 | ||
44 | |||
45 | /* Logical device Config Registers */ | ||
46 | #define SMSC_FDC37M81X_ACTIVE 0x30 | ||
47 | #define SMSC_FDC37M81X_BASEADDR0 0x60 | ||
48 | #define SMSC_FDC37M81X_BASEADDR1 0x61 | ||
49 | #define SMSC_FDC37M81X_INT 0x70 | ||
50 | #define SMSC_FDC37M81X_INT2 0x72 | ||
51 | #define SMSC_FDC37M81X_MODE 0xF0 | ||
52 | |||
53 | /* Chip Config Values */ | ||
54 | #define SMSC_FDC37M81X_CONFIG_ENTER 0x55 | ||
55 | #define SMSC_FDC37M81X_CONFIG_EXIT 0xaa | ||
56 | #define SMSC_FDC37M81X_CHIP_ID 0x4d | ||
57 | |||
58 | static unsigned long g_smsc_fdc37m81x_base = 0; | ||
59 | |||
60 | static inline unsigned char smsc_fdc37m81x_rd(unsigned char index) | ||
61 | { | ||
62 | outb(index, g_smsc_fdc37m81x_base + SMSC_FDC37M81X_CONFIG_INDEX); | ||
63 | |||
64 | return inb(g_smsc_fdc37m81x_base + SMSC_FDC37M81X_CONFIG_DATA); | ||
65 | } | ||
66 | |||
67 | static inline void smsc_dc37m81x_wr(unsigned char index, unsigned char data) | ||
68 | { | ||
69 | outb(index, g_smsc_fdc37m81x_base + SMSC_FDC37M81X_CONFIG_INDEX); | ||
70 | outb(data, g_smsc_fdc37m81x_base + SMSC_FDC37M81X_CONFIG_DATA); | ||
71 | } | ||
72 | |||
73 | void smsc_fdc37m81x_config_beg(void) | ||
74 | { | ||
75 | if (g_smsc_fdc37m81x_base) { | ||
76 | outb(SMSC_FDC37M81X_CONFIG_ENTER, | ||
77 | g_smsc_fdc37m81x_base + SMSC_FDC37M81X_CONFIG_INDEX); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | void smsc_fdc37m81x_config_end(void) | ||
82 | { | ||
83 | if (g_smsc_fdc37m81x_base) | ||
84 | outb(SMSC_FDC37M81X_CONFIG_EXIT, | ||
85 | g_smsc_fdc37m81x_base + SMSC_FDC37M81X_CONFIG_INDEX); | ||
86 | } | ||
87 | |||
88 | u8 smsc_fdc37m81x_config_get(u8 reg) | ||
89 | { | ||
90 | u8 val = 0; | ||
91 | |||
92 | if (g_smsc_fdc37m81x_base) | ||
93 | val = smsc_fdc37m81x_rd(reg); | ||
94 | |||
95 | return val; | ||
96 | } | ||
97 | |||
98 | void smsc_fdc37m81x_config_set(u8 reg, u8 val) | ||
99 | { | ||
100 | if (g_smsc_fdc37m81x_base) | ||
101 | smsc_dc37m81x_wr(reg, val); | ||
102 | } | ||
103 | |||
104 | unsigned long __init smsc_fdc37m81x_init(unsigned long port) | ||
105 | { | ||
106 | const int field = sizeof(unsigned long) * 2; | ||
107 | u8 chip_id; | ||
108 | |||
109 | if (g_smsc_fdc37m81x_base) | ||
110 | printk("smsc_fdc37m81x_init() stepping on old base=0x%0*lx\n", | ||
111 | field, g_smsc_fdc37m81x_base); | ||
112 | |||
113 | g_smsc_fdc37m81x_base = port; | ||
114 | |||
115 | smsc_fdc37m81x_config_beg(); | ||
116 | |||
117 | chip_id = smsc_fdc37m81x_rd(SMSC_FDC37M81X_DID); | ||
118 | if (chip_id == SMSC_FDC37M81X_CHIP_ID) | ||
119 | smsc_fdc37m81x_config_end(); | ||
120 | else { | ||
121 | printk("smsc_fdc37m81x_init() unknow chip id 0x%02x\n", | ||
122 | chip_id); | ||
123 | g_smsc_fdc37m81x_base = 0; | ||
124 | } | ||
125 | |||
126 | return g_smsc_fdc37m81x_base; | ||
127 | } | ||
128 | |||
129 | #ifdef DEBUG | ||
130 | void smsc_fdc37m81x_config_dump_one(char *key, u8 dev, u8 reg) | ||
131 | { | ||
132 | printk("%s: dev=0x%02x reg=0x%02x val=0x%02x\n", key, dev, reg, | ||
133 | smsc_fdc37m81x_rd(reg)); | ||
134 | } | ||
135 | |||
136 | void smsc_fdc37m81x_config_dump(void) | ||
137 | { | ||
138 | u8 orig; | ||
139 | char *fname = "smsc_fdc37m81x_config_dump()"; | ||
140 | |||
141 | smsc_fdc37m81x_config_beg(); | ||
142 | |||
143 | orig = smsc_fdc37m81x_rd(SMSC_FDC37M81X_DNUM); | ||
144 | |||
145 | printk("%s: common\n", fname); | ||
146 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, | ||
147 | SMSC_FDC37M81X_DNUM); | ||
148 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, | ||
149 | SMSC_FDC37M81X_DID); | ||
150 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, | ||
151 | SMSC_FDC37M81X_DREV); | ||
152 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, | ||
153 | SMSC_FDC37M81X_PCNT); | ||
154 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, | ||
155 | SMSC_FDC37M81X_PMGT); | ||
156 | |||
157 | printk("%s: keyboard\n", fname); | ||
158 | smsc_dc37m81x_wr(SMSC_FDC37M81X_DNUM, SMSC_FDC37M81X_KBD); | ||
159 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD, | ||
160 | SMSC_FDC37M81X_ACTIVE); | ||
161 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD, | ||
162 | SMSC_FDC37M81X_INT); | ||
163 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD, | ||
164 | SMSC_FDC37M81X_INT2); | ||
165 | smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD, | ||
166 | SMSC_FDC37M81X_LDCR_F0); | ||
167 | |||
168 | smsc_dc37m81x_wr(SMSC_FDC37M81X_DNUM, orig); | ||
169 | |||
170 | smsc_fdc37m81x_config_end(); | ||
171 | } | ||
172 | #endif | ||
diff --git a/arch/mips/tx4927/common/tx4927_dbgio.c b/arch/mips/tx4927/common/tx4927_dbgio.c deleted file mode 100644 index ea1ff23f4b72..000000000000 --- a/arch/mips/tx4927/common/tx4927_dbgio.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/mips/tx4927/common/tx4927_dbgio.c | ||
3 | * | ||
4 | * kgdb interface for gdb | ||
5 | * | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * source@mvista.com | ||
8 | * | ||
9 | * Copyright 2001-2002 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
24 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
25 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | * You should have received a copy of the GNU General Public License along | ||
28 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
29 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
30 | */ | ||
31 | #include <linux/types.h> | ||
32 | |||
33 | u8 getDebugChar(void) | ||
34 | { | ||
35 | extern u8 txx9_sio_kdbg_rd(void); | ||
36 | return (txx9_sio_kdbg_rd()); | ||
37 | } | ||
38 | |||
39 | int putDebugChar(u8 byte) | ||
40 | { | ||
41 | extern int txx9_sio_kdbg_wr( u8 ch ); | ||
42 | return (txx9_sio_kdbg_wr(byte)); | ||
43 | } | ||
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c deleted file mode 100644 index 0aabd57fdad2..000000000000 --- a/arch/mips/tx4927/common/tx4927_irq.c +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* | ||
2 | * Common tx4927 irq handler | ||
3 | * | ||
4 | * Author: MontaVista Software, Inc. | ||
5 | * source@mvista.com | ||
6 | * | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
12 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
13 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
14 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
15 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
16 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
17 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
18 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
19 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
20 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License along | ||
23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
24 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <asm/irq_cpu.h> | ||
29 | #include <asm/mipsregs.h> | ||
30 | #include <asm/tx4927/tx4927.h> | ||
31 | #ifdef CONFIG_TOSHIBA_RBTX4927 | ||
32 | #include <asm/tx4927/toshiba_rbtx4927.h> | ||
33 | #endif | ||
34 | |||
35 | void __init tx4927_irq_init(void) | ||
36 | { | ||
37 | mips_cpu_irq_init(); | ||
38 | txx9_irq_init(TX4927_IRC_REG); | ||
39 | set_irq_chained_handler(TX4927_IRQ_NEST_PIC_ON_CP0, handle_simple_irq); | ||
40 | } | ||
41 | |||
42 | asmlinkage void plat_irq_dispatch(void) | ||
43 | { | ||
44 | unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; | ||
45 | |||
46 | if (pending & STATUSF_IP7) /* cpu timer */ | ||
47 | do_IRQ(TX4927_IRQ_CPU_TIMER); | ||
48 | else if (pending & STATUSF_IP2) { /* tx4927 pic */ | ||
49 | int irq = txx9_irq(); | ||
50 | #ifdef CONFIG_TOSHIBA_RBTX4927 | ||
51 | if (irq == TX4927_IRQ_NEST_EXT_ON_PIC) | ||
52 | irq = toshiba_rbtx4927_irq_nested(irq); | ||
53 | #endif | ||
54 | if (unlikely(irq < 0)) { | ||
55 | spurious_interrupt(); | ||
56 | return; | ||
57 | } | ||
58 | do_IRQ(irq); | ||
59 | } else if (pending & STATUSF_IP0) /* user line 0 */ | ||
60 | do_IRQ(TX4927_IRQ_USER0); | ||
61 | else if (pending & STATUSF_IP1) /* user line 1 */ | ||
62 | do_IRQ(TX4927_IRQ_USER1); | ||
63 | else | ||
64 | spurious_interrupt(); | ||
65 | } | ||
diff --git a/arch/mips/tx4927/common/tx4927_prom.c b/arch/mips/tx4927/common/tx4927_prom.c deleted file mode 100644 index cc2aa9d63e82..000000000000 --- a/arch/mips/tx4927/common/tx4927_prom.c +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/mips/tx4927/common/tx4927_prom.c | ||
3 | * | ||
4 | * common tx4927 memory interface | ||
5 | * | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * source@mvista.com | ||
8 | * | ||
9 | * Copyright 2001-2002 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
24 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
25 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | * You should have received a copy of the GNU General Public License along | ||
28 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
29 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
30 | */ | ||
31 | |||
32 | #include <linux/init.h> | ||
33 | #include <linux/types.h> | ||
34 | #include <linux/io.h> | ||
35 | #include <asm/tx4927/tx4927.h> | ||
36 | |||
37 | static unsigned int __init tx4927_process_sdccr(unsigned long addr) | ||
38 | { | ||
39 | u64 val; | ||
40 | unsigned int sdccr_ce; | ||
41 | unsigned int sdccr_bs; | ||
42 | unsigned int sdccr_rs; | ||
43 | unsigned int sdccr_cs; | ||
44 | unsigned int sdccr_mw; | ||
45 | unsigned int bs = 0; | ||
46 | unsigned int rs = 0; | ||
47 | unsigned int cs = 0; | ||
48 | unsigned int mw = 0; | ||
49 | unsigned int msize = 0; | ||
50 | |||
51 | val = __raw_readq((void __iomem *)addr); | ||
52 | |||
53 | /* MVMCP -- need #defs for these bits masks */ | ||
54 | sdccr_ce = ((val & (1 << 10)) >> 10); | ||
55 | sdccr_bs = ((val & (1 << 8)) >> 8); | ||
56 | sdccr_rs = ((val & (3 << 5)) >> 5); | ||
57 | sdccr_cs = ((val & (3 << 2)) >> 2); | ||
58 | sdccr_mw = ((val & (1 << 0)) >> 0); | ||
59 | |||
60 | if (sdccr_ce) { | ||
61 | switch (sdccr_bs) { | ||
62 | case 0:{ | ||
63 | bs = 2; | ||
64 | break; | ||
65 | } | ||
66 | case 1:{ | ||
67 | bs = 4; | ||
68 | break; | ||
69 | } | ||
70 | } | ||
71 | switch (sdccr_rs) { | ||
72 | case 0:{ | ||
73 | rs = 2048; | ||
74 | break; | ||
75 | } | ||
76 | case 1:{ | ||
77 | rs = 4096; | ||
78 | break; | ||
79 | } | ||
80 | case 2:{ | ||
81 | rs = 8192; | ||
82 | break; | ||
83 | } | ||
84 | case 3:{ | ||
85 | rs = 0; | ||
86 | break; | ||
87 | } | ||
88 | } | ||
89 | switch (sdccr_cs) { | ||
90 | case 0:{ | ||
91 | cs = 256; | ||
92 | break; | ||
93 | } | ||
94 | case 1:{ | ||
95 | cs = 512; | ||
96 | break; | ||
97 | } | ||
98 | case 2:{ | ||
99 | cs = 1024; | ||
100 | break; | ||
101 | } | ||
102 | case 3:{ | ||
103 | cs = 2048; | ||
104 | break; | ||
105 | } | ||
106 | } | ||
107 | switch (sdccr_mw) { | ||
108 | case 0:{ | ||
109 | mw = 8; | ||
110 | break; | ||
111 | } /* 8 bytes = 64 bits */ | ||
112 | case 1:{ | ||
113 | mw = 4; | ||
114 | break; | ||
115 | } /* 4 bytes = 32 bits */ | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /* bytes per chip MB per chip num chips */ | ||
120 | msize = (((rs * cs * mw) / (1024 * 1024)) * bs); | ||
121 | |||
122 | return (msize); | ||
123 | } | ||
124 | |||
125 | |||
126 | unsigned int __init tx4927_get_mem_size(void) | ||
127 | { | ||
128 | unsigned int c0; | ||
129 | unsigned int c1; | ||
130 | unsigned int c2; | ||
131 | unsigned int c3; | ||
132 | unsigned int total; | ||
133 | |||
134 | /* MVMCP -- need #defs for these registers */ | ||
135 | c0 = tx4927_process_sdccr(0xff1f8000); | ||
136 | c1 = tx4927_process_sdccr(0xff1f8008); | ||
137 | c2 = tx4927_process_sdccr(0xff1f8010); | ||
138 | c3 = tx4927_process_sdccr(0xff1f8018); | ||
139 | total = c0 + c1 + c2 + c3; | ||
140 | |||
141 | return (total); | ||
142 | } | ||
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/Makefile b/arch/mips/tx4927/toshiba_rbtx4927/Makefile deleted file mode 100644 index 13f96725d772..000000000000 --- a/arch/mips/tx4927/toshiba_rbtx4927/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | obj-y += toshiba_rbtx4927_prom.o | ||
2 | obj-y += toshiba_rbtx4927_setup.o | ||
3 | obj-y += toshiba_rbtx4927_irq.o | ||
4 | |||
5 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c deleted file mode 100644 index c18901a75cc4..000000000000 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c +++ /dev/null | |||
@@ -1,216 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c | ||
3 | * | ||
4 | * Toshiba RBTX4927 specific interrupt handlers | ||
5 | * | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * source@mvista.com | ||
8 | * | ||
9 | * Copyright 2001-2002 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
24 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
25 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | * You should have received a copy of the GNU General Public License along | ||
28 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
29 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
30 | */ | ||
31 | /* | ||
32 | IRQ Device | ||
33 | 00 RBTX4927-ISA/00 | ||
34 | 01 RBTX4927-ISA/01 PS2/Keyboard | ||
35 | 02 RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15) | ||
36 | 03 RBTX4927-ISA/03 | ||
37 | 04 RBTX4927-ISA/04 | ||
38 | 05 RBTX4927-ISA/05 | ||
39 | 06 RBTX4927-ISA/06 | ||
40 | 07 RBTX4927-ISA/07 | ||
41 | 08 RBTX4927-ISA/08 | ||
42 | 09 RBTX4927-ISA/09 | ||
43 | 10 RBTX4927-ISA/10 | ||
44 | 11 RBTX4927-ISA/11 | ||
45 | 12 RBTX4927-ISA/12 PS2/Mouse (not supported at this time) | ||
46 | 13 RBTX4927-ISA/13 | ||
47 | 14 RBTX4927-ISA/14 IDE | ||
48 | 15 RBTX4927-ISA/15 | ||
49 | |||
50 | 16 TX4927-CP0/00 Software 0 | ||
51 | 17 TX4927-CP0/01 Software 1 | ||
52 | 18 TX4927-CP0/02 Cascade TX4927-CP0 | ||
53 | 19 TX4927-CP0/03 Multiplexed -- do not use | ||
54 | 20 TX4927-CP0/04 Multiplexed -- do not use | ||
55 | 21 TX4927-CP0/05 Multiplexed -- do not use | ||
56 | 22 TX4927-CP0/06 Multiplexed -- do not use | ||
57 | 23 TX4927-CP0/07 CPU TIMER | ||
58 | |||
59 | 24 TX4927-PIC/00 | ||
60 | 25 TX4927-PIC/01 | ||
61 | 26 TX4927-PIC/02 | ||
62 | 27 TX4927-PIC/03 Cascade RBTX4927-IOC | ||
63 | 28 TX4927-PIC/04 | ||
64 | 29 TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet | ||
65 | 30 TX4927-PIC/06 | ||
66 | 31 TX4927-PIC/07 | ||
67 | 32 TX4927-PIC/08 TX4927 SerialIO Channel 0 | ||
68 | 33 TX4927-PIC/09 TX4927 SerialIO Channel 1 | ||
69 | 34 TX4927-PIC/10 | ||
70 | 35 TX4927-PIC/11 | ||
71 | 36 TX4927-PIC/12 | ||
72 | 37 TX4927-PIC/13 | ||
73 | 38 TX4927-PIC/14 | ||
74 | 39 TX4927-PIC/15 | ||
75 | 40 TX4927-PIC/16 TX4927 PCI PCI-C | ||
76 | 41 TX4927-PIC/17 | ||
77 | 42 TX4927-PIC/18 | ||
78 | 43 TX4927-PIC/19 | ||
79 | 44 TX4927-PIC/20 | ||
80 | 45 TX4927-PIC/21 | ||
81 | 46 TX4927-PIC/22 TX4927 PCI PCI-ERR | ||
82 | 47 TX4927-PIC/23 TX4927 PCI PCI-PMA (not used) | ||
83 | 48 TX4927-PIC/24 | ||
84 | 49 TX4927-PIC/25 | ||
85 | 50 TX4927-PIC/26 | ||
86 | 51 TX4927-PIC/27 | ||
87 | 52 TX4927-PIC/28 | ||
88 | 53 TX4927-PIC/29 | ||
89 | 54 TX4927-PIC/30 | ||
90 | 55 TX4927-PIC/31 | ||
91 | |||
92 | 56 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed) [RTL-8139=PJ4] | ||
93 | 57 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed) [RTL-8139=PJ5] | ||
94 | 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] | ||
95 | 59 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4) [RTL-8139=PJ6] | ||
96 | 60 RBTX4927-IOC/04 | ||
97 | 61 RBTX4927-IOC/05 | ||
98 | 62 RBTX4927-IOC/06 | ||
99 | 63 RBTX4927-IOC/07 | ||
100 | |||
101 | NOTES: | ||
102 | SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58 | ||
103 | SouthBridge/ISA/pin=0 no pci irq used by this device | ||
104 | SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14 | ||
105 | SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59 | ||
106 | SouthBridge/PMC/pin=0 no pci irq used by this device | ||
107 | SuperIO/PS2/Keyboard, using INTR via ISA IRQ1 | ||
108 | SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported) | ||
109 | JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6 | ||
110 | */ | ||
111 | |||
112 | #include <linux/init.h> | ||
113 | #include <linux/types.h> | ||
114 | #include <linux/interrupt.h> | ||
115 | #include <asm/io.h> | ||
116 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
117 | #include <asm/i8259.h> | ||
118 | #endif | ||
119 | #include <asm/tx4927/toshiba_rbtx4927.h> | ||
120 | |||
121 | #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0 | ||
122 | #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_END 7 | ||
123 | |||
124 | #define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */ | ||
125 | #define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */ | ||
126 | |||
127 | #define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC | ||
128 | #define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2) | ||
129 | |||
130 | extern int tx4927_using_backplane; | ||
131 | |||
132 | static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq); | ||
133 | static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq); | ||
134 | |||
135 | #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" | ||
136 | static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { | ||
137 | .name = TOSHIBA_RBTX4927_IOC_NAME, | ||
138 | .ack = toshiba_rbtx4927_irq_ioc_disable, | ||
139 | .mask = toshiba_rbtx4927_irq_ioc_disable, | ||
140 | .mask_ack = toshiba_rbtx4927_irq_ioc_disable, | ||
141 | .unmask = toshiba_rbtx4927_irq_ioc_enable, | ||
142 | }; | ||
143 | #define TOSHIBA_RBTX4927_IOC_INTR_ENAB (void __iomem *)0xbc002000UL | ||
144 | #define TOSHIBA_RBTX4927_IOC_INTR_STAT (void __iomem *)0xbc002006UL | ||
145 | |||
146 | int toshiba_rbtx4927_irq_nested(int sw_irq) | ||
147 | { | ||
148 | u8 level3; | ||
149 | |||
150 | level3 = readb(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f; | ||
151 | if (level3) { | ||
152 | sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + fls(level3) - 1; | ||
153 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
154 | if (sw_irq == TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC && | ||
155 | tx4927_using_backplane) { | ||
156 | int irq = i8259_irq(); | ||
157 | if (irq >= 0) | ||
158 | sw_irq = irq; | ||
159 | } | ||
160 | #endif | ||
161 | } | ||
162 | return (sw_irq); | ||
163 | } | ||
164 | |||
165 | static struct irqaction toshiba_rbtx4927_irq_ioc_action = { | ||
166 | .handler = no_action, | ||
167 | .flags = IRQF_SHARED, | ||
168 | .mask = CPU_MASK_NONE, | ||
169 | .name = TOSHIBA_RBTX4927_IOC_NAME | ||
170 | }; | ||
171 | |||
172 | static void __init toshiba_rbtx4927_irq_ioc_init(void) | ||
173 | { | ||
174 | int i; | ||
175 | |||
176 | for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG; | ||
177 | i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++) | ||
178 | set_irq_chip_and_handler(i, &toshiba_rbtx4927_irq_ioc_type, | ||
179 | handle_level_irq); | ||
180 | |||
181 | setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC, | ||
182 | &toshiba_rbtx4927_irq_ioc_action); | ||
183 | } | ||
184 | |||
185 | static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq) | ||
186 | { | ||
187 | unsigned char v; | ||
188 | |||
189 | v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
190 | v |= (1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG)); | ||
191 | writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
192 | } | ||
193 | |||
194 | static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq) | ||
195 | { | ||
196 | unsigned char v; | ||
197 | |||
198 | v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
199 | v &= ~(1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG)); | ||
200 | writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB); | ||
201 | mmiowb(); | ||
202 | } | ||
203 | |||
204 | void __init arch_init_irq(void) | ||
205 | { | ||
206 | extern void tx4927_irq_init(void); | ||
207 | |||
208 | tx4927_irq_init(); | ||
209 | toshiba_rbtx4927_irq_ioc_init(); | ||
210 | #ifdef CONFIG_TOSHIBA_FPCIB0 | ||
211 | if (tx4927_using_backplane) | ||
212 | init_i8259_irqs(); | ||
213 | #endif | ||
214 | /* Onboard 10M Ether: High Active */ | ||
215 | set_irq_type(RBTX4927_RTL_8019_IRQ, IRQF_TRIGGER_HIGH); | ||
216 | } | ||
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c deleted file mode 100644 index fdbad4bc6021..000000000000 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
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/tx4927/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/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c deleted file mode 100644 index 185f303c0e2a..000000000000 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c +++ /dev/null | |||
@@ -1,703 +0,0 @@ | |||
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/tx4927/smsc_fdc37m81x.h> | ||
63 | #endif | ||
64 | #include <asm/tx4927/toshiba_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); | ||