blob: c3566c39c26cfa1845a32d4d13abe04e80ebc0f4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/init.h>
46#include <linux/kernel.h>
47#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#include <linux/ioport.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#include <linux/interrupt.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000050#include <linux/pm.h>
Atsushi Nemotoa0574e02007-03-01 00:40:21 +090051#include <linux/platform_device.h>
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090052#include <linux/delay.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000053
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#include <asm/bootinfo.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#include <asm/processor.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070057#include <asm/reboot.h>
58#include <asm/time.h>
Atsushi Nemoto229f7732007-10-25 01:34:09 +090059#include <asm/txx9tmr.h>
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090060#include <asm/txx9/generic.h>
61#include <asm/txx9/pci.h>
Atsushi Nemoto22b1d702008-07-11 00:31:36 +090062#include <asm/txx9/rbtx4927.h>
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090063#include <asm/txx9/tx4938.h> /* for TX4937 */
Ralf Baechle5eaf7a22005-03-04 17:24:32 +000064#ifdef CONFIG_SERIAL_TXX9
Ralf Baechle5eaf7a22005-03-04 17:24:32 +000065#include <linux/serial_core.h>
66#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Linus Torvalds1da177e2005-04-16 15:20:36 -070068/* These functions are used for rebooting or halting the machine*/
69extern void toshiba_rbtx4927_restart(char *command);
70extern void toshiba_rbtx4927_halt(void);
71extern void toshiba_rbtx4927_power_off(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072extern void toshiba_rbtx4927_irq_setup(void);
73
Sergei Shtylyov57340b22007-02-07 20:41:36 +030074char *prom_getcmdline(void);
75
Linus Torvalds1da177e2005-04-16 15:20:36 -070076static int tx4927_ccfg_toeon = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Linus Torvalds1da177e2005-04-16 15:20:36 -070078#ifdef CONFIG_PCI
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090079static void __init tx4927_pci_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080{
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090081 int extarb = !(__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCIARB);
82 struct pci_controller *c = &txx9_primary_pcic;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090084 register_pci_controller(c);
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090086 if (__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66)
87 txx9_pci_option =
88 (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) |
89 TXX9_PCI_OPT_CLK_66; /* already configured */
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090091 /* Reset PCI Bus */
92 writeb(1, rbtx4927_pcireset_addr);
93 /* Reset PCIC */
94 txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
95 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
96 TXX9_PCI_OPT_CLK_66)
97 tx4927_pciclk66_setup();
98 mdelay(10);
99 /* clear PCIC reset */
100 txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
101 writeb(0, rbtx4927_pcireset_addr);
102 iob();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900104 tx4927_report_pciclk();
105 tx4927_pcic_setup(tx4927_pcicptr, c, extarb);
106 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
107 TXX9_PCI_OPT_CLK_AUTO &&
108 txx9_pci66_check(c, 0, 0)) {
109 /* Reset PCI Bus */
110 writeb(1, rbtx4927_pcireset_addr);
111 /* Reset PCIC */
112 txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
113 tx4927_pciclk66_setup();
114 mdelay(10);
115 /* clear PCIC reset */
116 txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST);
117 writeb(0, rbtx4927_pcireset_addr);
118 iob();
119 /* Reinitialize PCIC */
120 tx4927_report_pciclk();
121 tx4927_pcic_setup(tx4927_pcicptr, c, extarb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 }
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900123}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900125static void __init tx4937_pci_setup(void)
126{
127 int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB);
128 struct pci_controller *c = &txx9_primary_pcic;
129
130 register_pci_controller(c);
131
132 if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66)
133 txx9_pci_option =
134 (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) |
135 TXX9_PCI_OPT_CLK_66; /* already configured */
136
137 /* Reset PCI Bus */
138 writeb(1, rbtx4927_pcireset_addr);
139 /* Reset PCIC */
140 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
141 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
142 TXX9_PCI_OPT_CLK_66)
143 tx4938_pciclk66_setup();
144 mdelay(10);
145 /* clear PCIC reset */
146 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
147 writeb(0, rbtx4927_pcireset_addr);
148 iob();
149
150 tx4938_report_pciclk();
151 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
152 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
153 TXX9_PCI_OPT_CLK_AUTO &&
154 txx9_pci66_check(c, 0, 0)) {
155 /* Reset PCI Bus */
156 writeb(1, rbtx4927_pcireset_addr);
157 /* Reset PCIC */
158 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
159 tx4938_pciclk66_setup();
160 mdelay(10);
161 /* clear PCIC reset */
162 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
163 writeb(0, rbtx4927_pcireset_addr);
164 iob();
165 /* Reinitialize PCIC */
166 tx4938_report_pciclk();
167 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
168 }
169}
170
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900171static void __init rbtx4927_arch_init(void)
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900172{
173 if (mips_machtype == MACH_TOSHIBA_RBTX4937)
174 tx4937_pci_setup();
175 else
176 tx4927_pci_setup();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177}
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900178#else
179#define rbtx4927_arch_init NULL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180#endif /* CONFIG_PCI */
181
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900182static void __noreturn wait_forever(void)
183{
184 while (1)
185 if (cpu_wait)
186 (*cpu_wait)();
187}
188
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189void toshiba_rbtx4927_restart(char *command)
190{
191 printk(KERN_NOTICE "System Rebooting...\n");
192
193 /* enable the s/w reset register */
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900194 writeb(RBTX4927_SW_RESET_ENABLE_SET, RBTX4927_SW_RESET_ENABLE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
196 /* wait for enable to be seen */
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900197 while ((readb(RBTX4927_SW_RESET_ENABLE) &
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 RBTX4927_SW_RESET_ENABLE_SET) == 0x00);
199
200 /* do a s/w reset */
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900201 writeb(RBTX4927_SW_RESET_DO_SET, RBTX4927_SW_RESET_DO);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202
203 /* do something passive while waiting for reset */
204 local_irq_disable();
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900205 wait_forever();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 /* no return */
207}
208
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209void toshiba_rbtx4927_halt(void)
210{
211 printk(KERN_NOTICE "System Halted\n");
212 local_irq_disable();
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900213 wait_forever();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 /* no return */
215}
216
217void toshiba_rbtx4927_power_off(void)
218{
219 toshiba_rbtx4927_halt();
220 /* no return */
221}
222
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900223static void __init rbtx4927_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224{
Atsushi Nemoto229f7732007-10-25 01:34:09 +0900225 int i;
Atsushi Nemotoa02eb8d2007-08-28 00:28:09 +0900226 u32 cp0_config;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 char *argptr;
228
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 /* f/w leaves this on at startup */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 clear_c0_status(ST0_ERL);
231
232 /* enable caches -- HCP5 does this, pmon does not */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 cp0_config = read_c0_config();
234 cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
235 write_c0_config(cp0_config);
236
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 ioport_resource.end = 0xffffffff;
238 iomem_resource.end = 0xffffffff;
239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 _machine_restart = toshiba_rbtx4927_restart;
241 _machine_halt = toshiba_rbtx4927_halt;
Ralf Baechlefcdb27a2006-01-18 17:37:07 +0000242 pm_power_off = toshiba_rbtx4927_power_off;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243
Atsushi Nemoto229f7732007-10-25 01:34:09 +0900244 for (i = 0; i < TX4927_NR_TMR; i++)
245 txx9_tmr_init(TX4927_TMR_REG(0) & 0xfffffffffULL);
246
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247#ifdef CONFIG_PCI
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900248 txx9_alloc_pci_controller(&txx9_primary_pcic,
249 RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE,
250 RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE);
251#else
252 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
253#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 /*
256 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300257 *
258 * For TX4927:
259 * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
261 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
262 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
263 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
264 * i.e. S9[3]: ON (83MHz), OFF (100MHz)
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300265 *
266 * For TX4937:
267 * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
268 * PCIDIVMODE[10] is 0.
269 * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
270 * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
271 * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
272 * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
273 * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
274 * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
275 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 */
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300277 if (mips_machtype == MACH_TOSHIBA_RBTX4937)
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900278 switch ((unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg) &
279 TX4938_CCFG_PCIDIVMODE_MASK) {
280 case TX4938_CCFG_PCIDIVMODE_8:
281 case TX4938_CCFG_PCIDIVMODE_4:
282 txx9_cpu_clock = 266666666; /* 266MHz */
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300283 break;
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900284 case TX4938_CCFG_PCIDIVMODE_9:
285 case TX4938_CCFG_PCIDIVMODE_4_5:
286 txx9_cpu_clock = 300000000; /* 300MHz */
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300287 break;
288 default:
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900289 txx9_cpu_clock = 333333333; /* 333MHz */
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300290 }
291 else
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900292 switch ((unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg) &
293 TX4927_CCFG_PCIDIVMODE_MASK) {
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300294 case TX4927_CCFG_PCIDIVMODE_2_5:
295 case TX4927_CCFG_PCIDIVMODE_5:
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900296 txx9_cpu_clock = 166666666; /* 166MHz */
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300297 break;
298 default:
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900299 txx9_cpu_clock = 200000000; /* 200MHz */
Sergei Shtylylovf09678a2006-02-04 15:11:14 +0300300 }
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900301 /* change default value to udelay/mdelay take reasonable time */
302 loops_per_jiffy = txx9_cpu_clock / HZ / 2;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303
304 /* CCFG */
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900305 /* do reset on watchdog */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900306 tx4927_ccfg_set(TX4927_CCFG_WR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 /* enable Timeout BusError */
308 if (tx4927_ccfg_toeon)
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900309 tx4927_ccfg_set(TX4927_CCFG_TOE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310
Ralf Baechle5eaf7a22005-03-04 17:24:32 +0000311#ifdef CONFIG_SERIAL_TXX9
312 {
313 extern int early_serial_txx9_setup(struct uart_port *port);
Ralf Baechle5eaf7a22005-03-04 17:24:32 +0000314 struct uart_port req;
315 for(i = 0; i < 2; i++) {
316 memset(&req, 0, sizeof(req));
317 req.line = i;
318 req.iotype = UPIO_MEM;
319 req.membase = (char *)(0xff1ff300 + i * 0x100);
320 req.mapbase = 0xff1ff300 + i * 0x100;
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900321 req.irq = TXX9_IRQ_BASE + TX4927_IR_SIO(i);
Ralf Baechle5eaf7a22005-03-04 17:24:32 +0000322 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
323 req.uartclk = 50000000;
324 early_serial_txx9_setup(&req);
325 }
326 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327#ifdef CONFIG_SERIAL_TXX9_CONSOLE
328 argptr = prom_getcmdline();
329 if (strstr(argptr, "console=") == NULL) {
330 strcat(argptr, " console=ttyS0,38400");
331 }
332#endif
Ralf Baechle5eaf7a22005-03-04 17:24:32 +0000333#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
335#ifdef CONFIG_ROOT_NFS
336 argptr = prom_getcmdline();
337 if (strstr(argptr, "root=") == NULL) {
338 strcat(argptr, " root=/dev/nfs rw");
339 }
340#endif
341
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342#ifdef CONFIG_IP_PNP
343 argptr = prom_getcmdline();
344 if (strstr(argptr, "ip=") == NULL) {
345 strcat(argptr, " ip=any");
346 }
347#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348}
349
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900350static void __init rbtx4927_time_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351{
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900352 mips_hpt_frequency = txx9_cpu_clock / 2;
353 if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_TINTDIS)
Atsushi Nemoto229f7732007-10-25 01:34:09 +0900354 txx9_clockevent_init(TX4927_TMR_REG(0) & 0xfffffffffULL,
355 TXX9_IRQ_BASE + 17,
356 50000000);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357}
358
Atsushi Nemotoa0574e02007-03-01 00:40:21 +0900359static int __init toshiba_rbtx4927_rtc_init(void)
360{
Atsushi Nemoto4614c322007-05-01 01:49:20 +0900361 static struct resource __initdata res = {
Atsushi Nemotoa0574e02007-03-01 00:40:21 +0900362 .start = 0x1c010000,
363 .end = 0x1c010000 + 0x800 - 1,
364 .flags = IORESOURCE_MEM,
365 };
366 struct platform_device *dev =
Atsushi Nemotoa95e23a2007-10-16 01:28:18 -0700367 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
Atsushi Nemotoa0574e02007-03-01 00:40:21 +0900368 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
369}
Atsushi Nemoto57e386c2007-05-01 00:27:58 +0900370
371static int __init rbtx4927_ne_init(void)
372{
373 static struct resource __initdata res[] = {
374 {
375 .start = RBTX4927_RTL_8019_BASE,
376 .end = RBTX4927_RTL_8019_BASE + 0x20 - 1,
377 .flags = IORESOURCE_IO,
378 }, {
379 .start = RBTX4927_RTL_8019_IRQ,
380 .flags = IORESOURCE_IRQ,
381 }
382 };
383 struct platform_device *dev =
384 platform_device_register_simple("ne", -1,
385 res, ARRAY_SIZE(res));
386 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
387}
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900388
389/* Watchdog support */
390
391static int __init txx9_wdt_init(unsigned long base)
392{
393 struct resource res = {
394 .start = base,
395 .end = base + 0x100 - 1,
396 .flags = IORESOURCE_MEM,
397 };
398 struct platform_device *dev =
399 platform_device_register_simple("txx9wdt", -1, &res, 1);
400 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
401}
402
403static int __init rbtx4927_wdt_init(void)
404{
405 return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
406}
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900407
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900408static void __init rbtx4927_device_init(void)
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900409{
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900410 toshiba_rbtx4927_rtc_init();
411 rbtx4927_ne_init();
412 rbtx4927_wdt_init();
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900413}
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900414
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900415struct txx9_board_vec rbtx4927_vec __initdata = {
416 .type = MACH_TOSHIBA_RBTX4927,
417 .system = "Toshiba RBTX4927",
418 .prom_init = rbtx4927_prom_init,
419 .mem_setup = rbtx4927_mem_setup,
420 .irq_setup = rbtx4927_irq_setup,
421 .time_init = rbtx4927_time_init,
422 .device_init = rbtx4927_device_init,
423 .arch_init = rbtx4927_arch_init,
424#ifdef CONFIG_PCI
425 .pci_map_irq = rbtx4927_pci_map_irq,
426#endif
427};
428struct txx9_board_vec rbtx4937_vec __initdata = {
429 .type = MACH_TOSHIBA_RBTX4937,
430 .system = "Toshiba RBTX4937",
431 .prom_init = rbtx4927_prom_init,
432 .mem_setup = rbtx4927_mem_setup,
433 .irq_setup = rbtx4927_irq_setup,
434 .time_init = rbtx4927_time_init,
435 .device_init = rbtx4927_device_init,
436 .arch_init = rbtx4927_arch_init,
437#ifdef CONFIG_PCI
438 .pci_map_irq = rbtx4927_pci_map_irq,
439#endif
440};