2 * linux/arch/mips/jz4740/common/setup.c
4 * JZ4740 common setup routines.
6 * Copyright (C) 2006 Ingenic Semiconductor Inc.
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 #include <linux/init.h>
23 #include <linux/string.h>
24 #include <linux/kernel.h>
26 #include <linux/ioport.h>
27 #include <linux/tty.h>
28 #include <linux/serial.h>
29 #include <linux/serial_core.h>
30 #include <linux/serial_8250.h>
33 #include <asm/bootinfo.h>
35 #include <asm/mipsregs.h>
36 #include <asm/reboot.h>
37 #include <asm/pgtable.h>
39 #include <asm/mach-jz4740/jz4740.h>
40 #include <asm/mach-jz4740/regs.h>
41 #include <asm/mach-jz4740/clock.h>
42 #include <asm/mach-jz4740/serial.h>
44 extern char *__init prom_getcmdline(void);
45 extern void __init jz_board_setup(void);
46 extern void jz_restart(char *);
47 extern void jz_halt(void);
48 extern void jz_power_off(void);
49 extern void jz_time_init(void);
51 static void __init soc_cpm_setup(void)
53 /* Enable CKO to external memory */
56 /* CPU enters IDLE mode when executing 'wait' instruction */
61 static void __init jz_serial_setup(void)
63 #ifdef CONFIG_SERIAL_8250
65 REG8(UART0_FCR) |= UARTFCR_UUE; /* enable UART module */
66 memset(&s, 0, sizeof(s));
67 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
68 s.iotype = SERIAL_IO_MEM;
73 s.membase = (u8 *)UART0_BASE;
75 if (early_serial_setup(&s) != 0) {
76 printk(KERN_ERR "Serial ttyS0 setup failed!\n");
80 s.membase = (u8 *)UART1_BASE;
82 if (early_serial_setup(&s) != 0) {
83 printk(KERN_ERR "Serial ttyS1 setup failed!\n");
88 void __init plat_mem_setup(void)
92 argptr = prom_getcmdline();
94 /* IO/MEM resources. Which will be the addtion value in `inX' and
95 * `outX' macros defined in asm/io.h */
97 ioport_resource.start = 0x00000000;
98 ioport_resource.end = 0xffffffff;
99 iomem_resource.start = 0x00000000;
100 iomem_resource.end = 0xffffffff;
102 _machine_restart = jz_restart;
103 _machine_halt = jz_halt;
104 pm_power_off = jz_power_off;