diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/vr41xx/nec-cmbvr4133 |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/mips/vr41xx/nec-cmbvr4133')
-rw-r--r-- | arch/mips/vr41xx/nec-cmbvr4133/Makefile | 8 | ||||
-rw-r--r-- | arch/mips/vr41xx/nec-cmbvr4133/init.c | 78 | ||||
-rw-r--r-- | arch/mips/vr41xx/nec-cmbvr4133/irq.c | 114 | ||||
-rw-r--r-- | arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c | 250 | ||||
-rw-r--r-- | arch/mips/vr41xx/nec-cmbvr4133/setup.c | 96 |
5 files changed, 546 insertions, 0 deletions
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/Makefile b/arch/mips/vr41xx/nec-cmbvr4133/Makefile new file mode 100644 index 000000000000..5835cae54aca --- /dev/null +++ b/arch/mips/vr41xx/nec-cmbvr4133/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for the NEC-CMBVR4133 | ||
3 | # | ||
4 | |||
5 | obj-y := init.o setup.o | ||
6 | |||
7 | obj-$(CONFIG_PCI) += m1535plus.o | ||
8 | obj-$(CONFIG_ROCKHOPPER) += irq.o | ||
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/init.c b/arch/mips/vr41xx/nec-cmbvr4133/init.c new file mode 100644 index 000000000000..87f06b3f5a9c --- /dev/null +++ b/arch/mips/vr41xx/nec-cmbvr4133/init.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * arch/mips/vr41xx/nec-cmbvr4133/init.c | ||
3 | * | ||
4 | * PROM library initialisation code for NEC CMB-VR4133 board. | ||
5 | * | ||
6 | * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and | ||
7 | * Jun Sun <jsun@mvista.com, or source@mvista.com> and | ||
8 | * Alex Sapkov <asapkov@ru.mvista.com> | ||
9 | * | ||
10 | * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
11 | * the terms of the GNU General Public License version 2. This program | ||
12 | * is licensed "as is" without any warranty of any kind, whether express | ||
13 | * or implied. | ||
14 | * | ||
15 | * Support for NEC-CMBVR4133 in 2.6 | ||
16 | * Manish Lachwani (mlachwani@mvista.com) | ||
17 | */ | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/string.h> | ||
22 | |||
23 | #include <asm/bootinfo.h> | ||
24 | |||
25 | #ifdef CONFIG_ROCKHOPPER | ||
26 | #include <asm/io.h> | ||
27 | #include <linux/pci.h> | ||
28 | |||
29 | #define PCICONFDREG 0xaf000c14 | ||
30 | #define PCICONFAREG 0xaf000c18 | ||
31 | #endif | ||
32 | |||
33 | const char *get_system_type(void) | ||
34 | { | ||
35 | return "NEC CMB-VR4133"; | ||
36 | } | ||
37 | |||
38 | #ifdef CONFIG_ROCKHOPPER | ||
39 | void disable_pcnet(void) | ||
40 | { | ||
41 | u32 data; | ||
42 | |||
43 | /* | ||
44 | * Workaround for the bug in PMON on VR4133. PMON leaves | ||
45 | * AMD PCNet controller (on Rockhopper) initialized and running in | ||
46 | * bus master mode. We have do disable it before doing any | ||
47 | * further initialization. Or we get problems with PCI bus 2 | ||
48 | * and random lockups and crashes. | ||
49 | */ | ||
50 | |||
51 | writel((2 << 16) | | ||
52 | (PCI_DEVFN(1,0) << 8) | | ||
53 | (0 & 0xfc) | | ||
54 | 1UL, | ||
55 | PCICONFAREG); | ||
56 | |||
57 | data = readl(PCICONFDREG); | ||
58 | |||
59 | writel((2 << 16) | | ||
60 | (PCI_DEVFN(1,0) << 8) | | ||
61 | (4 & 0xfc) | | ||
62 | 1UL, | ||
63 | PCICONFAREG); | ||
64 | |||
65 | data = readl(PCICONFDREG); | ||
66 | |||
67 | writel((2 << 16) | | ||
68 | (PCI_DEVFN(1,0) << 8) | | ||
69 | (4 & 0xfc) | | ||
70 | 1UL, | ||
71 | PCICONFAREG); | ||
72 | |||
73 | data &= ~4; | ||
74 | |||
75 | writel(data, PCICONFDREG); | ||
76 | } | ||
77 | #endif | ||
78 | |||
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/irq.c b/arch/mips/vr41xx/nec-cmbvr4133/irq.c new file mode 100644 index 000000000000..31db6b61a39e --- /dev/null +++ b/arch/mips/vr41xx/nec-cmbvr4133/irq.c | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * arch/mips/vr41xx/nec-cmbvr4133/irq.c | ||
3 | * | ||
4 | * Interrupt routines for the NEC CMB-VR4133 board. | ||
5 | * | ||
6 | * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and | ||
7 | * Alex Sapkov <asapkov@ru.mvista.com> | ||
8 | * | ||
9 | * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
10 | * the terms of the GNU General Public License version 2. This program | ||
11 | * is licensed "as is" without any warranty of any kind, whether express | ||
12 | * or implied. | ||
13 | * | ||
14 | * Support for NEC-CMBVR4133 in 2.6 | ||
15 | * Manish Lachwani (mlachwani@mvista.com) | ||
16 | */ | ||
17 | #include <linux/bitops.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | |||
23 | #include <asm/io.h> | ||
24 | #include <asm/vr41xx/cmbvr4133.h> | ||
25 | |||
26 | extern void enable_8259A_irq(unsigned int irq); | ||
27 | extern void disable_8259A_irq(unsigned int irq); | ||
28 | extern void mask_and_ack_8259A(unsigned int irq); | ||
29 | extern void init_8259A(int hoge); | ||
30 | |||
31 | extern int vr4133_rockhopper; | ||
32 | |||
33 | static unsigned int startup_i8259_irq(unsigned int irq) | ||
34 | { | ||
35 | enable_8259A_irq(irq - I8259_IRQ_BASE); | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | static void shutdown_i8259_irq(unsigned int irq) | ||
40 | { | ||
41 | disable_8259A_irq(irq - I8259_IRQ_BASE); | ||
42 | } | ||
43 | |||
44 | static void enable_i8259_irq(unsigned int irq) | ||
45 | { | ||
46 | enable_8259A_irq(irq - I8259_IRQ_BASE); | ||
47 | } | ||
48 | |||
49 | static void disable_i8259_irq(unsigned int irq) | ||
50 | { | ||
51 | disable_8259A_irq(irq - I8259_IRQ_BASE); | ||
52 | } | ||
53 | |||
54 | static void ack_i8259_irq(unsigned int irq) | ||
55 | { | ||
56 | mask_and_ack_8259A(irq - I8259_IRQ_BASE); | ||
57 | } | ||
58 | |||
59 | static void end_i8259_irq(unsigned int irq) | ||
60 | { | ||
61 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
62 | enable_8259A_irq(irq - I8259_IRQ_BASE); | ||
63 | } | ||
64 | |||
65 | static struct hw_interrupt_type i8259_irq_type = { | ||
66 | .typename = "XT-PIC", | ||
67 | .startup = startup_i8259_irq, | ||
68 | .shutdown = shutdown_i8259_irq, | ||
69 | .enable = enable_i8259_irq, | ||
70 | .disable = disable_i8259_irq, | ||
71 | .ack = ack_i8259_irq, | ||
72 | .end = end_i8259_irq, | ||
73 | }; | ||
74 | |||
75 | static int i8259_get_irq_number(int irq) | ||
76 | { | ||
77 | unsigned long isr; | ||
78 | |||
79 | isr = inb(0x20); | ||
80 | irq = ffz(~isr); | ||
81 | if (irq == 2) { | ||
82 | isr = inb(0xa0); | ||
83 | irq = 8 + ffz(~isr); | ||
84 | } | ||
85 | |||
86 | if (irq < 0 || irq > 15) | ||
87 | return -EINVAL; | ||
88 | |||
89 | return I8259_IRQ_BASE + irq; | ||
90 | } | ||
91 | |||
92 | static struct irqaction i8259_slave_cascade = { | ||
93 | .handler = &no_action, | ||
94 | .name = "cascade", | ||
95 | }; | ||
96 | |||
97 | void __init rockhopper_init_irq(void) | ||
98 | { | ||
99 | int i; | ||
100 | |||
101 | if(!vr4133_rockhopper) { | ||
102 | printk(KERN_ERR "Not a Rockhopper Board \n"); | ||
103 | return; | ||
104 | } | ||
105 | |||
106 | for (i = I8259_IRQ_BASE; i <= I8259_IRQ_LAST; i++) | ||
107 | irq_desc[i].handler = &i8259_irq_type; | ||
108 | |||
109 | setup_irq(I8259_SLAVE_IRQ, &i8259_slave_cascade); | ||
110 | |||
111 | vr41xx_set_irq_trigger(CMBVR41XX_INTC_PIN, TRIGGER_LEVEL, SIGNAL_THROUGH); | ||
112 | vr41xx_set_irq_level(CMBVR41XX_INTC_PIN, LEVEL_HIGH); | ||
113 | vr41xx_cascade_irq(CMBVR41XX_INTC_IRQ, i8259_get_irq_number); | ||
114 | } | ||
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c b/arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c new file mode 100644 index 000000000000..1f6b24ef8695 --- /dev/null +++ b/arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | * arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c | ||
3 | * | ||
4 | * Initialize for ALi M1535+(included M5229 and M5237). | ||
5 | * | ||
6 | * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and | ||
7 | * Alex Sapkov <asapkov@ru.mvista.com> | ||
8 | * | ||
9 | * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
10 | * the terms of the GNU General Public License version 2. This program | ||
11 | * is licensed "as is" without any warranty of any kind, whether express | ||
12 | * or implied. | ||
13 | * | ||
14 | * Support for NEC-CMBVR4133 in 2.6 | ||
15 | * Author: Manish Lachwani (mlachwani@mvista.com) | ||
16 | */ | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/serial.h> | ||
21 | |||
22 | #include <asm/vr41xx/cmbvr4133.h> | ||
23 | #include <linux/pci.h> | ||
24 | #include <asm/io.h> | ||
25 | |||
26 | #define CONFIG_PORT(port) ((port) ? 0x3f0 : 0x370) | ||
27 | #define DATA_PORT(port) ((port) ? 0x3f1 : 0x371) | ||
28 | #define INDEX_PORT(port) CONFIG_PORT(port) | ||
29 | |||
30 | #define ENTER_CONFIG_MODE(port) \ | ||
31 | do { \ | ||
32 | outb_p(0x51, CONFIG_PORT(port)); \ | ||
33 | outb_p(0x23, CONFIG_PORT(port)); \ | ||
34 | } while(0) | ||
35 | |||
36 | #define SELECT_LOGICAL_DEVICE(port, dev_no) \ | ||
37 | do { \ | ||
38 | outb_p(0x07, INDEX_PORT(port)); \ | ||
39 | outb_p((dev_no), DATA_PORT(port)); \ | ||
40 | } while(0) | ||
41 | |||
42 | #define WRITE_CONFIG_DATA(port,index,data) \ | ||
43 | do { \ | ||
44 | outb_p((index), INDEX_PORT(port)); \ | ||
45 | outb_p((data), DATA_PORT(port)); \ | ||
46 | } while(0) | ||
47 | |||
48 | #define EXIT_CONFIG_MODE(port) outb(0xbb, CONFIG_PORT(port)) | ||
49 | |||
50 | #define PCI_CONFIG_ADDR KSEG1ADDR(0x0f000c18) | ||
51 | #define PCI_CONFIG_DATA KSEG1ADDR(0x0f000c14) | ||
52 | |||
53 | #ifdef CONFIG_BLK_DEV_FD | ||
54 | |||
55 | void __devinit ali_m1535plus_fdc_init(int port) | ||
56 | { | ||
57 | ENTER_CONFIG_MODE(port); | ||
58 | SELECT_LOGICAL_DEVICE(port, 0); /* FDC */ | ||
59 | WRITE_CONFIG_DATA(port, 0x30, 0x01); /* FDC: enable */ | ||
60 | WRITE_CONFIG_DATA(port, 0x60, 0x03); /* I/O port base: 0x3f0 */ | ||
61 | WRITE_CONFIG_DATA(port, 0x61, 0xf0); | ||
62 | WRITE_CONFIG_DATA(port, 0x70, 0x06); /* IRQ: 6 */ | ||
63 | WRITE_CONFIG_DATA(port, 0x74, 0x02); /* DMA: channel 2 */ | ||
64 | WRITE_CONFIG_DATA(port, 0xf0, 0x08); | ||
65 | WRITE_CONFIG_DATA(port, 0xf1, 0x00); | ||
66 | WRITE_CONFIG_DATA(port, 0xf2, 0xff); | ||
67 | WRITE_CONFIG_DATA(port, 0xf4, 0x00); | ||
68 | EXIT_CONFIG_MODE(port); | ||
69 | } | ||
70 | |||
71 | #endif | ||
72 | |||
73 | void __devinit ali_m1535plus_parport_init(int port) | ||
74 | { | ||
75 | ENTER_CONFIG_MODE(port); | ||
76 | SELECT_LOGICAL_DEVICE(port, 3); /* Parallel Port */ | ||
77 | WRITE_CONFIG_DATA(port, 0x30, 0x01); | ||
78 | WRITE_CONFIG_DATA(port, 0x60, 0x03); /* I/O port base: 0x378 */ | ||
79 | WRITE_CONFIG_DATA(port, 0x61, 0x78); | ||
80 | WRITE_CONFIG_DATA(port, 0x70, 0x07); /* IRQ: 7 */ | ||
81 | WRITE_CONFIG_DATA(port, 0x74, 0x04); /* DMA: None */ | ||
82 | WRITE_CONFIG_DATA(port, 0xf0, 0x8c); /* IRQ polarity: Active Low */ | ||
83 | WRITE_CONFIG_DATA(port, 0xf1, 0xc5); | ||
84 | EXIT_CONFIG_MODE(port); | ||
85 | } | ||
86 | |||
87 | void __devinit ali_m1535plus_keyboard_init(int port) | ||
88 | { | ||
89 | ENTER_CONFIG_MODE(port); | ||
90 | SELECT_LOGICAL_DEVICE(port, 7); /* KEYBOARD */ | ||
91 | WRITE_CONFIG_DATA(port, 0x30, 0x01); /* KEYBOARD: eable */ | ||
92 | WRITE_CONFIG_DATA(port, 0x70, 0x01); /* IRQ: 1 */ | ||
93 | WRITE_CONFIG_DATA(port, 0x72, 0x0c); /* PS/2 Mouse IRQ: 12 */ | ||
94 | WRITE_CONFIG_DATA(port, 0xf0, 0x00); | ||
95 | EXIT_CONFIG_MODE(port); | ||
96 | } | ||
97 | |||
98 | void __devinit ali_m1535plus_hotkey_init(int port) | ||
99 | { | ||
100 | ENTER_CONFIG_MODE(port); | ||
101 | SELECT_LOGICAL_DEVICE(port, 0xc); /* HOTKEY */ | ||
102 | WRITE_CONFIG_DATA(port, 0x30, 0x00); | ||
103 | WRITE_CONFIG_DATA(port, 0xf0, 0x35); | ||
104 | WRITE_CONFIG_DATA(port, 0xf1, 0x14); | ||
105 | WRITE_CONFIG_DATA(port, 0xf2, 0x11); | ||
106 | WRITE_CONFIG_DATA(port, 0xf3, 0x71); | ||
107 | WRITE_CONFIG_DATA(port, 0xf5, 0x05); | ||
108 | EXIT_CONFIG_MODE(port); | ||
109 | } | ||
110 | |||
111 | void ali_m1535plus_init(struct pci_dev *dev) | ||
112 | { | ||
113 | pci_write_config_byte(dev, 0x40, 0x18); /* PCI Interface Control */ | ||
114 | pci_write_config_byte(dev, 0x41, 0xc0); /* PS2 keyb & mouse enable */ | ||
115 | pci_write_config_byte(dev, 0x42, 0x41); /* ISA bus cycle control */ | ||
116 | pci_write_config_byte(dev, 0x43, 0x00); /* ISA bus cycle control 2 */ | ||
117 | pci_write_config_byte(dev, 0x44, 0x5d); /* IDE enable & IRQ 14 */ | ||
118 | pci_write_config_byte(dev, 0x45, 0x0b); /* PCI int polling mode */ | ||
119 | pci_write_config_byte(dev, 0x47, 0x00); /* BIOS chip select control */ | ||
120 | |||
121 | /* IRQ routing */ | ||
122 | pci_write_config_byte(dev, 0x48, 0x03); /* INTA IRQ10, INTB disable */ | ||
123 | pci_write_config_byte(dev, 0x49, 0x00); /* INTC and INTD disable */ | ||
124 | pci_write_config_byte(dev, 0x4a, 0x00); /* INTE and INTF disable */ | ||
125 | pci_write_config_byte(dev, 0x4b, 0x90); /* Audio IRQ11, Modem disable */ | ||
126 | |||
127 | pci_write_config_word(dev, 0x50, 0x4000); /* Parity check IDE enable */ | ||
128 | pci_write_config_word(dev, 0x52, 0x0000); /* USB & RTC disable */ | ||
129 | pci_write_config_word(dev, 0x54, 0x0002); /* ??? no info */ | ||
130 | pci_write_config_word(dev, 0x56, 0x0002); /* PCS1J signal disable */ | ||
131 | |||
132 | pci_write_config_byte(dev, 0x59, 0x00); /* PCSDS */ | ||
133 | pci_write_config_byte(dev, 0x5a, 0x00); | ||
134 | pci_write_config_byte(dev, 0x5b, 0x00); | ||
135 | pci_write_config_word(dev, 0x5c, 0x0000); | ||
136 | pci_write_config_byte(dev, 0x5e, 0x00); | ||
137 | pci_write_config_byte(dev, 0x5f, 0x00); | ||
138 | pci_write_config_word(dev, 0x60, 0x0000); | ||
139 | |||
140 | pci_write_config_byte(dev, 0x6c, 0x00); | ||
141 | pci_write_config_byte(dev, 0x6d, 0x48); /* ROM address mapping */ | ||
142 | pci_write_config_byte(dev, 0x6e, 0x00); /* ??? what for? */ | ||
143 | |||
144 | pci_write_config_byte(dev, 0x70, 0x12); /* Serial IRQ control */ | ||
145 | pci_write_config_byte(dev, 0x71, 0xEF); /* DMA channel select */ | ||
146 | pci_write_config_byte(dev, 0x72, 0x03); /* USB IDSEL */ | ||
147 | pci_write_config_byte(dev, 0x73, 0x00); /* ??? no info */ | ||
148 | |||
149 | /* | ||
150 | * IRQ setup ALi M5237 USB Host Controller | ||
151 | * IRQ: 9 | ||
152 | */ | ||
153 | pci_write_config_byte(dev, 0x74, 0x01); /* USB IRQ9 */ | ||
154 | |||
155 | pci_write_config_byte(dev, 0x75, 0x1f); /* IDE2 IRQ 15 */ | ||
156 | pci_write_config_byte(dev, 0x76, 0x80); /* ACPI disable */ | ||
157 | pci_write_config_byte(dev, 0x77, 0x40); /* Modem disable */ | ||
158 | pci_write_config_dword(dev, 0x78, 0x20000000); /* Pin select 2 */ | ||
159 | pci_write_config_byte(dev, 0x7c, 0x00); /* Pin select 3 */ | ||
160 | pci_write_config_byte(dev, 0x81, 0x00); /* ID read/write control */ | ||
161 | pci_write_config_byte(dev, 0x90, 0x00); /* PCI PM block control */ | ||
162 | pci_write_config_word(dev, 0xa4, 0x0000); /* PMSCR */ | ||
163 | |||
164 | #ifdef CONFIG_BLK_DEV_FD | ||
165 | ali_m1535plus_fdc_init(1); | ||
166 | #endif | ||
167 | |||
168 | ali_m1535plus_keyboard_init(1); | ||
169 | ali_m1535plus_hotkey_init(1); | ||
170 | } | ||
171 | |||
172 | static inline void ali_config_writeb(u8 reg, u8 val, int devfn) | ||
173 | { | ||
174 | u32 data; | ||
175 | int shift; | ||
176 | |||
177 | writel((1 << 16) | (devfn << 8) | (reg & 0xfc) | 1UL, PCI_CONFIG_ADDR); | ||
178 | data = readl(PCI_CONFIG_DATA); | ||
179 | |||
180 | shift = (reg & 3) << 3; | ||
181 | data &= ~(0xff << shift); | ||
182 | data |= (((u32)val) << shift); | ||
183 | |||
184 | writel(data, PCI_CONFIG_DATA); | ||
185 | } | ||
186 | |||
187 | static inline u8 ali_config_readb(u8 reg, int devfn) | ||
188 | { | ||
189 | u32 data; | ||
190 | |||
191 | writel((1 << 16) | (devfn << 8) | (reg & 0xfc) | 1UL, PCI_CONFIG_ADDR); | ||
192 | data = readl(PCI_CONFIG_DATA); | ||
193 | |||
194 | return (u8)(data >> ((reg & 3) << 3)); | ||
195 | } | ||
196 | |||
197 | static inline u16 ali_config_readw(u8 reg, int devfn) | ||
198 | { | ||
199 | u32 data; | ||
200 | |||
201 | writel((1 << 16) | (devfn << 8) | (reg & 0xfc) | 1UL, PCI_CONFIG_ADDR); | ||
202 | data = readl(PCI_CONFIG_DATA); | ||
203 | |||
204 | return (u16)(data >> ((reg & 2) << 3)); | ||
205 | } | ||
206 | |||
207 | int vr4133_rockhopper = 0; | ||
208 | void __init ali_m5229_preinit(void) | ||
209 | { | ||
210 | if (ali_config_readw(PCI_VENDOR_ID,16) == PCI_VENDOR_ID_AL && | ||
211 | ali_config_readw(PCI_DEVICE_ID,16) == PCI_DEVICE_ID_AL_M1533) { | ||
212 | printk(KERN_INFO "Found an NEC Rockhopper \n"); | ||
213 | vr4133_rockhopper = 1; | ||
214 | /* | ||
215 | * Enable ALi M5229 IDE Controller (both channels) | ||
216 | * IDSEL: A27 | ||
217 | */ | ||
218 | ali_config_writeb(0x58, 0x4c, 16); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | void __init ali_m5229_init(struct pci_dev *dev) | ||
223 | { | ||
224 | /* | ||
225 | * Enable Primary/Secondary Channel Cable Detect 40-Pin | ||
226 | */ | ||
227 | pci_write_config_word(dev, 0x4a, 0xc023); | ||
228 | |||
229 | /* | ||
230 | * Set only the 3rd byteis for the master IDE's cycle and | ||
231 | * enable Internal IDE Function | ||
232 | */ | ||
233 | pci_write_config_byte(dev, 0x50, 0x23); /* Class code attr register */ | ||
234 | |||
235 | pci_write_config_byte(dev, 0x09, 0xff); /* Set native mode & stuff */ | ||
236 | pci_write_config_byte(dev, 0x52, 0x00); /* use timing registers */ | ||
237 | pci_write_config_byte(dev, 0x58, 0x02); /* Primary addr setup timing */ | ||
238 | pci_write_config_byte(dev, 0x59, 0x22); /* Primary cmd block timing */ | ||
239 | pci_write_config_byte(dev, 0x5a, 0x22); /* Pr drv 0 R/W timing */ | ||
240 | pci_write_config_byte(dev, 0x5b, 0x22); /* Pr drv 1 R/W timing */ | ||
241 | pci_write_config_byte(dev, 0x5c, 0x02); /* Sec addr setup timing */ | ||
242 | pci_write_config_byte(dev, 0x5d, 0x22); /* Sec cmd block timing */ | ||
243 | pci_write_config_byte(dev, 0x5e, 0x22); /* Sec drv 0 R/W timing */ | ||
244 | pci_write_config_byte(dev, 0x5f, 0x22); /* Sec drv 1 R/W timing */ | ||
245 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); | ||
246 | pci_write_config_word(dev, PCI_COMMAND, | ||
247 | PCI_COMMAND_PARITY | PCI_COMMAND_MASTER | | ||
248 | PCI_COMMAND_IO); | ||
249 | } | ||
250 | |||
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/setup.c b/arch/mips/vr41xx/nec-cmbvr4133/setup.c new file mode 100644 index 000000000000..db686ce42e85 --- /dev/null +++ b/arch/mips/vr41xx/nec-cmbvr4133/setup.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * arch/mips/vr41xx/nec-cmbvr4133/setup.c | ||
3 | * | ||
4 | * Setup for the NEC CMB-VR4133. | ||
5 | * | ||
6 | * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and | ||
7 | * Alex Sapkov <asapkov@ru.mvista.com> | ||
8 | * | ||
9 | * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
10 | * the terms of the GNU General Public License version 2. This program | ||
11 | * is licensed "as is" without any warranty of any kind, whether express | ||
12 | * or implied. | ||
13 | * | ||
14 | * Support for CMBVR4133 board in 2.6 | ||
15 | * Author: Manish Lachwani (mlachwani@mvista.com) | ||
16 | */ | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/ide.h> | ||
20 | #include <linux/ioport.h> | ||
21 | |||
22 | #include <asm/reboot.h> | ||
23 | #include <asm/time.h> | ||
24 | #include <asm/vr41xx/cmbvr4133.h> | ||
25 | #include <asm/bootinfo.h> | ||
26 | |||
27 | #ifdef CONFIG_MTD | ||
28 | #include <linux/mtd/physmap.h> | ||
29 | #include <linux/mtd/partitions.h> | ||
30 | #include <linux/mtd/mtd.h> | ||
31 | #include <linux/mtd/map.h> | ||
32 | |||
33 | static struct mtd_partition cmbvr4133_mtd_parts[] = { | ||
34 | { | ||
35 | .name = "User FS", | ||
36 | .size = 0x1be0000, | ||
37 | .offset = 0, | ||
38 | .mask_flags = 0, | ||
39 | }, | ||
40 | { | ||
41 | .name = "PMON", | ||
42 | .size = 0x140000, | ||
43 | .offset = MTDPART_OFS_APPEND, | ||
44 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
45 | }, | ||
46 | { | ||
47 | .name = "User FS2", | ||
48 | .size = MTDPART_SIZ_FULL, | ||
49 | .offset = MTDPART_OFS_APPEND, | ||
50 | .mask_flags = 0, | ||
51 | } | ||
52 | }; | ||
53 | |||
54 | #define number_partitions (sizeof(cmbvr4133_mtd_parts)/sizeof(struct mtd_partition)) | ||
55 | #endif | ||
56 | |||
57 | extern void i8259_init(void); | ||
58 | |||
59 | static int __init nec_cmbvr4133_setup(void) | ||
60 | { | ||
61 | #ifdef CONFIG_ROCKHOPPER | ||
62 | extern void disable_pcnet(void); | ||
63 | |||
64 | disable_pcnet(); | ||
65 | #endif | ||
66 | set_io_port_base(KSEG1ADDR(0x16000000)); | ||
67 | |||
68 | mips_machgroup = MACH_GROUP_NEC_VR41XX; | ||
69 | mips_machtype = MACH_NEC_CMBVR4133; | ||
70 | |||
71 | #ifdef CONFIG_PCI | ||
72 | #ifdef CONFIG_ROCKHOPPER | ||
73 | ali_m5229_preinit(); | ||
74 | #endif | ||
75 | #endif | ||
76 | |||
77 | #ifdef CONFIG_ROCKHOPPER | ||
78 | rockhopper_init_irq(); | ||
79 | #endif | ||
80 | |||
81 | #ifdef CONFIG_MTD | ||
82 | /* we use generic physmap mapping driver and we use partitions */ | ||
83 | physmap_configure(0x1C000000, 0x02000000, 4, NULL); | ||
84 | physmap_set_partitions(cmbvr4133_mtd_parts, number_partitions); | ||
85 | #endif | ||
86 | |||
87 | /* 128 MB memory support */ | ||
88 | add_memory_region(0, 0x08000000, BOOT_MEM_RAM); | ||
89 | |||
90 | #ifdef CONFIG_ROCKHOPPER | ||
91 | i8259_init(); | ||
92 | #endif | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | early_initcall(nec_cmbvr4133_setup); | ||