xref: /OK3568_Linux_fs/kernel/arch/mips/txx9/rbtx4927/setup.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Toshiba rbtx4927 specific setup
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Author: MontaVista Software, Inc.
5*4882a593Smuzhiyun  *	   source@mvista.com
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright 2001-2002 MontaVista Software Inc.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * Copyright (C) 1996, 97, 2001, 04  Ralf Baechle (ralf@linux-mips.org)
10*4882a593Smuzhiyun  * Copyright (C) 2000 RidgeRun, Inc.
11*4882a593Smuzhiyun  * Author: RidgeRun, Inc.
12*4882a593Smuzhiyun  *   glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * Copyright 2001 MontaVista Software Inc.
15*4882a593Smuzhiyun  * Author: jsun@mvista.com or jsun@junsun.net
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * Copyright 2002 MontaVista Software Inc.
18*4882a593Smuzhiyun  * Author: Michael Pruznick, michael_pruznick@mvista.com
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  * Copyright (C) 2000-2001 Toshiba Corporation
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  * Copyright (C) 2004 MontaVista Software Inc.
23*4882a593Smuzhiyun  * Author: Manish Lachwani, mlachwani@mvista.com
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  *  This program is free software; you can redistribute it and/or modify it
26*4882a593Smuzhiyun  *  under the terms of the GNU General Public License as published by the
27*4882a593Smuzhiyun  *  Free Software Foundation; either version 2 of the License, or (at your
28*4882a593Smuzhiyun  *  option) any later version.
29*4882a593Smuzhiyun  *
30*4882a593Smuzhiyun  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
31*4882a593Smuzhiyun  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32*4882a593Smuzhiyun  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33*4882a593Smuzhiyun  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
34*4882a593Smuzhiyun  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35*4882a593Smuzhiyun  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
36*4882a593Smuzhiyun  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37*4882a593Smuzhiyun  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
38*4882a593Smuzhiyun  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
39*4882a593Smuzhiyun  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40*4882a593Smuzhiyun  *
41*4882a593Smuzhiyun  *  You should have received a copy of the GNU General Public License along
42*4882a593Smuzhiyun  *  with this program; if not, write to the Free Software Foundation, Inc.,
43*4882a593Smuzhiyun  *  675 Mass Ave, Cambridge, MA 02139, USA.
44*4882a593Smuzhiyun  */
45*4882a593Smuzhiyun #include <linux/init.h>
46*4882a593Smuzhiyun #include <linux/kernel.h>
47*4882a593Smuzhiyun #include <linux/types.h>
48*4882a593Smuzhiyun #include <linux/ioport.h>
49*4882a593Smuzhiyun #include <linux/platform_device.h>
50*4882a593Smuzhiyun #include <linux/delay.h>
51*4882a593Smuzhiyun #include <linux/gpio.h>
52*4882a593Smuzhiyun #include <linux/leds.h>
53*4882a593Smuzhiyun #include <asm/io.h>
54*4882a593Smuzhiyun #include <asm/reboot.h>
55*4882a593Smuzhiyun #include <asm/txx9pio.h>
56*4882a593Smuzhiyun #include <asm/txx9/generic.h>
57*4882a593Smuzhiyun #include <asm/txx9/pci.h>
58*4882a593Smuzhiyun #include <asm/txx9/rbtx4927.h>
59*4882a593Smuzhiyun #include <asm/txx9/tx4938.h>	/* for TX4937 */
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun #ifdef CONFIG_PCI
tx4927_pci_setup(void)62*4882a593Smuzhiyun static void __init tx4927_pci_setup(void)
63*4882a593Smuzhiyun {
64*4882a593Smuzhiyun 	int extarb = !(__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCIARB);
65*4882a593Smuzhiyun 	struct pci_controller *c = &txx9_primary_pcic;
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun 	register_pci_controller(c);
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun 	if (__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66)
70*4882a593Smuzhiyun 		txx9_pci_option =
71*4882a593Smuzhiyun 			(txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) |
72*4882a593Smuzhiyun 			TXX9_PCI_OPT_CLK_66; /* already configured */
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun 	/* Reset PCI Bus */
75*4882a593Smuzhiyun 	writeb(1, rbtx4927_pcireset_addr);
76*4882a593Smuzhiyun 	/* Reset PCIC */
77*4882a593Smuzhiyun 	txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
78*4882a593Smuzhiyun 	if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
79*4882a593Smuzhiyun 	    TXX9_PCI_OPT_CLK_66)
80*4882a593Smuzhiyun 		tx4927_pciclk66_setup();
81*4882a593Smuzhiyun 	mdelay(10);
82*4882a593Smuzhiyun 	/* clear PCIC reset */
83*4882a593Smuzhiyun 	txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
84*4882a593Smuzhiyun 	writeb(0, rbtx4927_pcireset_addr);
85*4882a593Smuzhiyun 	iob();
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun 	tx4927_report_pciclk();
88*4882a593Smuzhiyun 	tx4927_pcic_setup(tx4927_pcicptr, c, extarb);
89*4882a593Smuzhiyun 	if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
90*4882a593Smuzhiyun 	    TXX9_PCI_OPT_CLK_AUTO &&
91*4882a593Smuzhiyun 	    txx9_pci66_check(c, 0, 0)) {
92*4882a593Smuzhiyun 		/* Reset PCI Bus */
93*4882a593Smuzhiyun 		writeb(1, rbtx4927_pcireset_addr);
94*4882a593Smuzhiyun 		/* Reset PCIC */
95*4882a593Smuzhiyun 		txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
96*4882a593Smuzhiyun 		tx4927_pciclk66_setup();
97*4882a593Smuzhiyun 		mdelay(10);
98*4882a593Smuzhiyun 		/* clear PCIC reset */
99*4882a593Smuzhiyun 		txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
100*4882a593Smuzhiyun 		writeb(0, rbtx4927_pcireset_addr);
101*4882a593Smuzhiyun 		iob();
102*4882a593Smuzhiyun 		/* Reinitialize PCIC */
103*4882a593Smuzhiyun 		tx4927_report_pciclk();
104*4882a593Smuzhiyun 		tx4927_pcic_setup(tx4927_pcicptr, c, extarb);
105*4882a593Smuzhiyun 	}
106*4882a593Smuzhiyun 	tx4927_setup_pcierr_irq();
107*4882a593Smuzhiyun }
108*4882a593Smuzhiyun 
tx4937_pci_setup(void)109*4882a593Smuzhiyun static void __init tx4937_pci_setup(void)
110*4882a593Smuzhiyun {
111*4882a593Smuzhiyun 	int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB);
112*4882a593Smuzhiyun 	struct pci_controller *c = &txx9_primary_pcic;
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun 	register_pci_controller(c);
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun 	if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66)
117*4882a593Smuzhiyun 		txx9_pci_option =
118*4882a593Smuzhiyun 			(txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) |
119*4882a593Smuzhiyun 			TXX9_PCI_OPT_CLK_66; /* already configured */
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun 	/* Reset PCI Bus */
122*4882a593Smuzhiyun 	writeb(1, rbtx4927_pcireset_addr);
123*4882a593Smuzhiyun 	/* Reset PCIC */
124*4882a593Smuzhiyun 	txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
125*4882a593Smuzhiyun 	if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
126*4882a593Smuzhiyun 	    TXX9_PCI_OPT_CLK_66)
127*4882a593Smuzhiyun 		tx4938_pciclk66_setup();
128*4882a593Smuzhiyun 	mdelay(10);
129*4882a593Smuzhiyun 	/* clear PCIC reset */
130*4882a593Smuzhiyun 	txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
131*4882a593Smuzhiyun 	writeb(0, rbtx4927_pcireset_addr);
132*4882a593Smuzhiyun 	iob();
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun 	tx4938_report_pciclk();
135*4882a593Smuzhiyun 	tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
136*4882a593Smuzhiyun 	if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
137*4882a593Smuzhiyun 	    TXX9_PCI_OPT_CLK_AUTO &&
138*4882a593Smuzhiyun 	    txx9_pci66_check(c, 0, 0)) {
139*4882a593Smuzhiyun 		/* Reset PCI Bus */
140*4882a593Smuzhiyun 		writeb(1, rbtx4927_pcireset_addr);
141*4882a593Smuzhiyun 		/* Reset PCIC */
142*4882a593Smuzhiyun 		txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
143*4882a593Smuzhiyun 		tx4938_pciclk66_setup();
144*4882a593Smuzhiyun 		mdelay(10);
145*4882a593Smuzhiyun 		/* clear PCIC reset */
146*4882a593Smuzhiyun 		txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
147*4882a593Smuzhiyun 		writeb(0, rbtx4927_pcireset_addr);
148*4882a593Smuzhiyun 		iob();
149*4882a593Smuzhiyun 		/* Reinitialize PCIC */
150*4882a593Smuzhiyun 		tx4938_report_pciclk();
151*4882a593Smuzhiyun 		tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
152*4882a593Smuzhiyun 	}
153*4882a593Smuzhiyun 	tx4938_setup_pcierr_irq();
154*4882a593Smuzhiyun }
155*4882a593Smuzhiyun #else
tx4927_pci_setup(void)156*4882a593Smuzhiyun static inline void tx4927_pci_setup(void) {}
tx4937_pci_setup(void)157*4882a593Smuzhiyun static inline void tx4937_pci_setup(void) {}
158*4882a593Smuzhiyun #endif /* CONFIG_PCI */
159*4882a593Smuzhiyun 
rbtx4927_gpio_init(void)160*4882a593Smuzhiyun static void __init rbtx4927_gpio_init(void)
161*4882a593Smuzhiyun {
162*4882a593Smuzhiyun 	/* TX4927-SIO DTR on (PIO[15]) */
163*4882a593Smuzhiyun 	gpio_request(15, "sio-dtr");
164*4882a593Smuzhiyun 	gpio_direction_output(15, 1);
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun 	tx4927_sio_init(0, 0);
167*4882a593Smuzhiyun }
168*4882a593Smuzhiyun 
rbtx4927_arch_init(void)169*4882a593Smuzhiyun static void __init rbtx4927_arch_init(void)
170*4882a593Smuzhiyun {
171*4882a593Smuzhiyun 	txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
172*4882a593Smuzhiyun 
173*4882a593Smuzhiyun 	rbtx4927_gpio_init();
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun 	tx4927_pci_setup();
176*4882a593Smuzhiyun }
177*4882a593Smuzhiyun 
rbtx4937_arch_init(void)178*4882a593Smuzhiyun static void __init rbtx4937_arch_init(void)
179*4882a593Smuzhiyun {
180*4882a593Smuzhiyun 	txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
181*4882a593Smuzhiyun 
182*4882a593Smuzhiyun 	rbtx4927_gpio_init();
183*4882a593Smuzhiyun 
184*4882a593Smuzhiyun 	tx4937_pci_setup();
185*4882a593Smuzhiyun }
186*4882a593Smuzhiyun 
toshiba_rbtx4927_restart(char * command)187*4882a593Smuzhiyun static void toshiba_rbtx4927_restart(char *command)
188*4882a593Smuzhiyun {
189*4882a593Smuzhiyun 	/* enable the s/w reset register */
190*4882a593Smuzhiyun 	writeb(1, rbtx4927_softresetlock_addr);
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun 	/* wait for enable to be seen */
193*4882a593Smuzhiyun 	while (!(readb(rbtx4927_softresetlock_addr) & 1))
194*4882a593Smuzhiyun 		;
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun 	/* do a s/w reset */
197*4882a593Smuzhiyun 	writeb(1, rbtx4927_softreset_addr);
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun 	/* fallback */
200*4882a593Smuzhiyun 	(*_machine_halt)();
201*4882a593Smuzhiyun }
202*4882a593Smuzhiyun 
203*4882a593Smuzhiyun static void __init rbtx4927_clock_init(void);
204*4882a593Smuzhiyun static void __init rbtx4937_clock_init(void);
205*4882a593Smuzhiyun 
rbtx4927_mem_setup(void)206*4882a593Smuzhiyun static void __init rbtx4927_mem_setup(void)
207*4882a593Smuzhiyun {
208*4882a593Smuzhiyun 	if (TX4927_REV_PCODE() == 0x4927) {
209*4882a593Smuzhiyun 		rbtx4927_clock_init();
210*4882a593Smuzhiyun 		tx4927_setup();
211*4882a593Smuzhiyun 	} else {
212*4882a593Smuzhiyun 		rbtx4937_clock_init();
213*4882a593Smuzhiyun 		tx4938_setup();
214*4882a593Smuzhiyun 	}
215*4882a593Smuzhiyun 
216*4882a593Smuzhiyun 	_machine_restart = toshiba_rbtx4927_restart;
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun #ifdef CONFIG_PCI
219*4882a593Smuzhiyun 	txx9_alloc_pci_controller(&txx9_primary_pcic,
220*4882a593Smuzhiyun 				  RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE,
221*4882a593Smuzhiyun 				  RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE);
222*4882a593Smuzhiyun 	txx9_board_pcibios_setup = tx4927_pcibios_setup;
223*4882a593Smuzhiyun #else
224*4882a593Smuzhiyun 	set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
225*4882a593Smuzhiyun #endif
226*4882a593Smuzhiyun }
227*4882a593Smuzhiyun 
rbtx4927_clock_init(void)228*4882a593Smuzhiyun static void __init rbtx4927_clock_init(void)
229*4882a593Smuzhiyun {
230*4882a593Smuzhiyun 	/*
231*4882a593Smuzhiyun 	 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
232*4882a593Smuzhiyun 	 *
233*4882a593Smuzhiyun 	 * For TX4927:
234*4882a593Smuzhiyun 	 * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
235*4882a593Smuzhiyun 	 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
236*4882a593Smuzhiyun 	 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
237*4882a593Smuzhiyun 	 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
238*4882a593Smuzhiyun 	 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
239*4882a593Smuzhiyun 	 * i.e. S9[3]: ON (83MHz), OFF (100MHz)
240*4882a593Smuzhiyun 	 */
241*4882a593Smuzhiyun 	switch ((unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg) &
242*4882a593Smuzhiyun 		TX4927_CCFG_PCIDIVMODE_MASK) {
243*4882a593Smuzhiyun 	case TX4927_CCFG_PCIDIVMODE_2_5:
244*4882a593Smuzhiyun 	case TX4927_CCFG_PCIDIVMODE_5:
245*4882a593Smuzhiyun 		txx9_cpu_clock = 166666666;	/* 166MHz */
246*4882a593Smuzhiyun 		break;
247*4882a593Smuzhiyun 	default:
248*4882a593Smuzhiyun 		txx9_cpu_clock = 200000000;	/* 200MHz */
249*4882a593Smuzhiyun 	}
250*4882a593Smuzhiyun }
251*4882a593Smuzhiyun 
rbtx4937_clock_init(void)252*4882a593Smuzhiyun static void __init rbtx4937_clock_init(void)
253*4882a593Smuzhiyun {
254*4882a593Smuzhiyun 	/*
255*4882a593Smuzhiyun 	 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
256*4882a593Smuzhiyun 	 *
257*4882a593Smuzhiyun 	 * For TX4937:
258*4882a593Smuzhiyun 	 * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
259*4882a593Smuzhiyun 	 * PCIDIVMODE[10] is 0.
260*4882a593Smuzhiyun 	 * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
261*4882a593Smuzhiyun 	 * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
262*4882a593Smuzhiyun 	 * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
263*4882a593Smuzhiyun 	 * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
264*4882a593Smuzhiyun 	 * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
265*4882a593Smuzhiyun 	 * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
266*4882a593Smuzhiyun 	 */
267*4882a593Smuzhiyun 	switch ((unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg) &
268*4882a593Smuzhiyun 		TX4938_CCFG_PCIDIVMODE_MASK) {
269*4882a593Smuzhiyun 	case TX4938_CCFG_PCIDIVMODE_8:
270*4882a593Smuzhiyun 	case TX4938_CCFG_PCIDIVMODE_4:
271*4882a593Smuzhiyun 		txx9_cpu_clock = 266666666;	/* 266MHz */
272*4882a593Smuzhiyun 		break;
273*4882a593Smuzhiyun 	case TX4938_CCFG_PCIDIVMODE_9:
274*4882a593Smuzhiyun 	case TX4938_CCFG_PCIDIVMODE_4_5:
275*4882a593Smuzhiyun 		txx9_cpu_clock = 300000000;	/* 300MHz */
276*4882a593Smuzhiyun 		break;
277*4882a593Smuzhiyun 	default:
278*4882a593Smuzhiyun 		txx9_cpu_clock = 333333333;	/* 333MHz */
279*4882a593Smuzhiyun 	}
280*4882a593Smuzhiyun }
281*4882a593Smuzhiyun 
rbtx4927_time_init(void)282*4882a593Smuzhiyun static void __init rbtx4927_time_init(void)
283*4882a593Smuzhiyun {
284*4882a593Smuzhiyun 	tx4927_time_init(0);
285*4882a593Smuzhiyun }
286*4882a593Smuzhiyun 
toshiba_rbtx4927_rtc_init(void)287*4882a593Smuzhiyun static void __init toshiba_rbtx4927_rtc_init(void)
288*4882a593Smuzhiyun {
289*4882a593Smuzhiyun 	struct resource res = {
290*4882a593Smuzhiyun 		.start	= RBTX4927_BRAMRTC_BASE - IO_BASE,
291*4882a593Smuzhiyun 		.end	= RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1,
292*4882a593Smuzhiyun 		.flags	= IORESOURCE_MEM,
293*4882a593Smuzhiyun 	};
294*4882a593Smuzhiyun 	platform_device_register_simple("rtc-ds1742", -1, &res, 1);
295*4882a593Smuzhiyun }
296*4882a593Smuzhiyun 
rbtx4927_ne_init(void)297*4882a593Smuzhiyun static void __init rbtx4927_ne_init(void)
298*4882a593Smuzhiyun {
299*4882a593Smuzhiyun 	struct resource res[] = {
300*4882a593Smuzhiyun 		{
301*4882a593Smuzhiyun 			.start	= RBTX4927_RTL_8019_BASE,
302*4882a593Smuzhiyun 			.end	= RBTX4927_RTL_8019_BASE + 0x20 - 1,
303*4882a593Smuzhiyun 			.flags	= IORESOURCE_IO,
304*4882a593Smuzhiyun 		}, {
305*4882a593Smuzhiyun 			.start	= RBTX4927_RTL_8019_IRQ,
306*4882a593Smuzhiyun 			.flags	= IORESOURCE_IRQ,
307*4882a593Smuzhiyun 		}
308*4882a593Smuzhiyun 	};
309*4882a593Smuzhiyun 	platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
310*4882a593Smuzhiyun }
311*4882a593Smuzhiyun 
rbtx4927_mtd_init(void)312*4882a593Smuzhiyun static void __init rbtx4927_mtd_init(void)
313*4882a593Smuzhiyun {
314*4882a593Smuzhiyun 	int i;
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun 	for (i = 0; i < 2; i++)
317*4882a593Smuzhiyun 		tx4927_mtd_init(i);
318*4882a593Smuzhiyun }
319*4882a593Smuzhiyun 
rbtx4927_gpioled_init(void)320*4882a593Smuzhiyun static void __init rbtx4927_gpioled_init(void)
321*4882a593Smuzhiyun {
322*4882a593Smuzhiyun 	static const struct gpio_led leds[] = {
323*4882a593Smuzhiyun 		{ .name = "gpioled:green:0", .gpio = 0, .active_low = 1, },
324*4882a593Smuzhiyun 		{ .name = "gpioled:green:1", .gpio = 1, .active_low = 1, },
325*4882a593Smuzhiyun 	};
326*4882a593Smuzhiyun 	static struct gpio_led_platform_data pdata = {
327*4882a593Smuzhiyun 		.num_leds = ARRAY_SIZE(leds),
328*4882a593Smuzhiyun 		.leds = leds,
329*4882a593Smuzhiyun 	};
330*4882a593Smuzhiyun 	struct platform_device *pdev = platform_device_alloc("leds-gpio", 0);
331*4882a593Smuzhiyun 
332*4882a593Smuzhiyun 	if (!pdev)
333*4882a593Smuzhiyun 		return;
334*4882a593Smuzhiyun 	pdev->dev.platform_data = &pdata;
335*4882a593Smuzhiyun 	if (platform_device_add(pdev))
336*4882a593Smuzhiyun 		platform_device_put(pdev);
337*4882a593Smuzhiyun }
338*4882a593Smuzhiyun 
rbtx4927_device_init(void)339*4882a593Smuzhiyun static void __init rbtx4927_device_init(void)
340*4882a593Smuzhiyun {
341*4882a593Smuzhiyun 	toshiba_rbtx4927_rtc_init();
342*4882a593Smuzhiyun 	rbtx4927_ne_init();
343*4882a593Smuzhiyun 	tx4927_wdt_init();
344*4882a593Smuzhiyun 	rbtx4927_mtd_init();
345*4882a593Smuzhiyun 	if (TX4927_REV_PCODE() == 0x4927) {
346*4882a593Smuzhiyun 		tx4927_dmac_init(2);
347*4882a593Smuzhiyun 		tx4927_aclc_init(0, 1);
348*4882a593Smuzhiyun 	} else {
349*4882a593Smuzhiyun 		tx4938_dmac_init(0, 2);
350*4882a593Smuzhiyun 		tx4938_aclc_init();
351*4882a593Smuzhiyun 	}
352*4882a593Smuzhiyun 	platform_device_register_simple("txx9aclc-generic", -1, NULL, 0);
353*4882a593Smuzhiyun 	txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
354*4882a593Smuzhiyun 	rbtx4927_gpioled_init();
355*4882a593Smuzhiyun }
356*4882a593Smuzhiyun 
357*4882a593Smuzhiyun struct txx9_board_vec rbtx4927_vec __initdata = {
358*4882a593Smuzhiyun 	.system = "Toshiba RBTX4927",
359*4882a593Smuzhiyun 	.prom_init = rbtx4927_prom_init,
360*4882a593Smuzhiyun 	.mem_setup = rbtx4927_mem_setup,
361*4882a593Smuzhiyun 	.irq_setup = rbtx4927_irq_setup,
362*4882a593Smuzhiyun 	.time_init = rbtx4927_time_init,
363*4882a593Smuzhiyun 	.device_init = rbtx4927_device_init,
364*4882a593Smuzhiyun 	.arch_init = rbtx4927_arch_init,
365*4882a593Smuzhiyun #ifdef CONFIG_PCI
366*4882a593Smuzhiyun 	.pci_map_irq = rbtx4927_pci_map_irq,
367*4882a593Smuzhiyun #endif
368*4882a593Smuzhiyun };
369*4882a593Smuzhiyun struct txx9_board_vec rbtx4937_vec __initdata = {
370*4882a593Smuzhiyun 	.system = "Toshiba RBTX4937",
371*4882a593Smuzhiyun 	.prom_init = rbtx4927_prom_init,
372*4882a593Smuzhiyun 	.mem_setup = rbtx4927_mem_setup,
373*4882a593Smuzhiyun 	.irq_setup = rbtx4927_irq_setup,
374*4882a593Smuzhiyun 	.time_init = rbtx4927_time_init,
375*4882a593Smuzhiyun 	.device_init = rbtx4927_device_init,
376*4882a593Smuzhiyun 	.arch_init = rbtx4937_arch_init,
377*4882a593Smuzhiyun #ifdef CONFIG_PCI
378*4882a593Smuzhiyun 	.pci_map_irq = rbtx4927_pci_map_irq,
379*4882a593Smuzhiyun #endif
380*4882a593Smuzhiyun };
381