2 * setup.c: Setup pointers to hardware dependent routines.
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006, Wind River System Inc. Rongkai.zhan <rongkai.zhan@windriver.com>
11 #include <linux/init.h>
12 #include <linux/string.h>
13 #include <linux/kernel.h>
14 #include <linux/tty.h>
15 #include <linux/serial.h>
16 #include <linux/serial_core.h>
20 #include <asm/bootinfo.h>
21 #include <asm/reboot.h>
23 #include <asm/gt64120.h>
25 unsigned long gt64120_base
= KSEG1ADDR(0x14000000);
27 #ifdef WRPPMC_EARLY_DEBUG
29 static volatile unsigned char * wrppmc_led
= \
30 (volatile unsigned char *)KSEG1ADDR(WRPPMC_LED_BASE
);
33 * PPMC LED control register:
34 * -) bit[0] controls DS1 LED (1 - OFF, 0 - ON)
35 * -) bit[1] controls DS2 LED (1 - OFF, 0 - ON)
36 * -) bit[2] controls DS4 LED (1 - OFF, 0 - ON)
38 void wrppmc_led_on(int mask
)
40 unsigned char value
= *wrppmc_led
;
42 value
&= (0xF8 | mask
);
46 /* If mask = 0, turn off all LEDs */
47 void wrppmc_led_off(int mask
)
49 unsigned char value
= *wrppmc_led
;
51 value
|= (0x7 & mask
);
56 * We assume that bootloader has initialized UART16550 correctly
58 void __init
wrppmc_early_putc(char ch
)
60 static volatile unsigned char *wrppmc_uart
= \
61 (volatile unsigned char *)KSEG1ADDR(WRPPMC_UART16550_BASE
);
64 /* Wait until Transmit-Holding-Register is empty */
66 value
= *(wrppmc_uart
+ 5);
74 void __init
wrppmc_early_printk(const char *fmt
, ...)
76 static char pbuf
[256] = {'\0', };
83 i
= vsprintf(pbuf
, fmt
, args
);
86 /* Print the string */
88 wrppmc_early_putc(*ch
);
89 /* if print '\n', also print '\r' */
91 wrppmc_early_putc('\r');
94 #endif /* WRPPMC_EARLY_DEBUG */
96 unsigned long __init
prom_free_prom_memory(void)
101 #ifdef CONFIG_SERIAL_8250
102 static void wrppmc_setup_serial(void)
106 memset(&up
, 0x00, sizeof(struct uart_port
));
109 * A note about mapbase/membase
110 * -) mapbase is the physical address of the IO port.
111 * -) membase is an 'ioremapped' cookie.
114 up
.type
= PORT_16550
;
115 up
.iotype
= UPIO_MEM
;
116 up
.mapbase
= WRPPMC_UART16550_BASE
;
117 up
.membase
= ioremap(up
.mapbase
, 8);
118 up
.irq
= WRPPMC_UART16550_IRQ
;
119 up
.uartclk
= WRPPMC_UART16550_CLOCK
;
120 up
.flags
= UPF_SKIP_TEST
/* | UPF_BOOT_AUTOCONF */;
123 early_serial_setup(&up
);
127 void __init
plat_mem_setup(void)
129 extern void wrppmc_time_init(void);
130 extern void wrppmc_machine_restart(char *command
);
131 extern void wrppmc_machine_halt(void);
132 extern void wrppmc_machine_power_off(void);
134 _machine_restart
= wrppmc_machine_restart
;
135 _machine_halt
= wrppmc_machine_halt
;
136 pm_power_off
= wrppmc_machine_power_off
;
138 /* Use MIPS Count/Compare Timer */
139 board_time_init
= wrppmc_time_init
;
141 /* This makes the operations of 'in/out[bwl]' to the
142 * physical address ( < KSEG0) can work via KSEG1
144 set_io_port_base(KSEG1
);
146 #ifdef CONFIG_SERIAL_8250
147 wrppmc_setup_serial();
151 const char *get_system_type(void)
153 return "Wind River PPMC (GT64120)";
157 * Initializes basic routines and structures pointers, memory size (as
158 * given by the bios and saves the command line.
160 void __init
prom_init(void)
162 mips_machgroup
= MACH_GROUP_GALILEO
;
163 mips_machtype
= MACH_EV64120A
;
165 add_memory_region(WRPPMC_SDRAM_SCS0_BASE
, WRPPMC_SDRAM_SCS0_SIZE
, BOOT_MEM_RAM
);
166 add_memory_region(WRPPMC_BOOTROM_BASE
, WRPPMC_BOOTROM_SIZE
, BOOT_MEM_ROM_DATA
);
168 wrppmc_early_printk("prom_init: GT64120 SDRAM Bank 0: 0x%x - 0x%08lx\n",
169 WRPPMC_SDRAM_SCS0_BASE
, (WRPPMC_SDRAM_SCS0_BASE
+ WRPPMC_SDRAM_SCS0_SIZE
));