xref: /openbmc/linux/arch/mips/cobalt/setup.c (revision d0034a7a4ac7fae708146ac0059b9c47a1543f0d)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Setup pointers to hardware dependent routines.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * This file is subject to the terms and conditions of the GNU General Public
51da177e4SLinus Torvalds  * License.  See the file "COPYING" in the main directory of this archive
61da177e4SLinus Torvalds  * for more details.
71da177e4SLinus Torvalds  *
8fcdb27adSRalf Baechle  * Copyright (C) 1996, 1997, 2004, 05 by Ralf Baechle (ralf@linux-mips.org)
91da177e4SLinus Torvalds  * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
101da177e4SLinus Torvalds  *
111da177e4SLinus Torvalds  */
121da177e4SLinus Torvalds #include <linux/init.h>
131097c6acSYoichi Yuasa #include <linux/interrupt.h>
141097c6acSYoichi Yuasa #include <linux/io.h>
151097c6acSYoichi Yuasa #include <linux/ioport.h>
16*e7ae8d17SThomas Bogendoerfer #include <linux/memblock.h>
17fcdb27adSRalf Baechle #include <linux/pm.h>
181da177e4SLinus Torvalds 
191da177e4SLinus Torvalds #include <asm/bootinfo.h>
201da177e4SLinus Torvalds #include <asm/reboot.h>
218a8594a7SYoichi Yuasa #include <asm/setup.h>
221da177e4SLinus Torvalds #include <asm/gt64120.h>
231da177e4SLinus Torvalds 
24cc50b67dSYoichi Yuasa #include <cobalt.h>
251da177e4SLinus Torvalds 
261da177e4SLinus Torvalds extern void cobalt_machine_restart(char *command);
271da177e4SLinus Torvalds extern void cobalt_machine_halt(void);
281da177e4SLinus Torvalds 
get_system_type(void)291da177e4SLinus Torvalds const char *get_system_type(void)
301da177e4SLinus Torvalds {
31c4ed38a0SRalf Baechle 	switch (cobalt_board_id) {
32c4ed38a0SRalf Baechle 		case COBALT_BRD_ID_QUBE1:
33c4ed38a0SRalf Baechle 			return "Cobalt Qube";
34c4ed38a0SRalf Baechle 		case COBALT_BRD_ID_RAQ1:
35c4ed38a0SRalf Baechle 			return "Cobalt RaQ";
36c4ed38a0SRalf Baechle 		case COBALT_BRD_ID_QUBE2:
37c4ed38a0SRalf Baechle 			return "Cobalt Qube2";
38c4ed38a0SRalf Baechle 		case COBALT_BRD_ID_RAQ2:
39c4ed38a0SRalf Baechle 			return "Cobalt RaQ2";
40c4ed38a0SRalf Baechle 	}
411da177e4SLinus Torvalds 	return "MIPS Cobalt";
421da177e4SLinus Torvalds }
431da177e4SLinus Torvalds 
4447d7c44bSYoichi Yuasa /*
4547d7c44bSYoichi Yuasa  * Cobalt doesn't have PS/2 keyboard/mouse interfaces,
46b73989dbSAndrea Gelmini  * keyboard controller is never used.
47b73989dbSAndrea Gelmini  * Also PCI-ISA bridge DMA controller is never used.
4847d7c44bSYoichi Yuasa  */
4947d7c44bSYoichi Yuasa static struct resource cobalt_reserved_resources[] = {
5047d7c44bSYoichi Yuasa 	{	/* dma1 */
515e46c3aeSRalf Baechle 		.start	= 0x00,
525e46c3aeSRalf Baechle 		.end	= 0x1f,
5347d7c44bSYoichi Yuasa 		.name	= "reserved",
5447d7c44bSYoichi Yuasa 		.flags	= IORESOURCE_BUSY | IORESOURCE_IO,
5547d7c44bSYoichi Yuasa 	},
5647d7c44bSYoichi Yuasa 	{	/* keyboard */
575e46c3aeSRalf Baechle 		.start	= 0x60,
585e46c3aeSRalf Baechle 		.end	= 0x6f,
5947d7c44bSYoichi Yuasa 		.name	= "reserved",
6047d7c44bSYoichi Yuasa 		.flags	= IORESOURCE_BUSY | IORESOURCE_IO,
6147d7c44bSYoichi Yuasa 	},
6247d7c44bSYoichi Yuasa 	{	/* dma page reg */
635e46c3aeSRalf Baechle 		.start	= 0x80,
645e46c3aeSRalf Baechle 		.end	= 0x8f,
6547d7c44bSYoichi Yuasa 		.name	= "reserved",
6647d7c44bSYoichi Yuasa 		.flags	= IORESOURCE_BUSY | IORESOURCE_IO,
6747d7c44bSYoichi Yuasa 	},
6847d7c44bSYoichi Yuasa 	{	/* dma2 */
695e46c3aeSRalf Baechle 		.start	= 0xc0,
705e46c3aeSRalf Baechle 		.end	= 0xdf,
7147d7c44bSYoichi Yuasa 		.name	= "reserved",
7247d7c44bSYoichi Yuasa 		.flags	= IORESOURCE_BUSY | IORESOURCE_IO,
735e46c3aeSRalf Baechle 	},
741da177e4SLinus Torvalds };
751da177e4SLinus Torvalds 
plat_mem_setup(void)762925aba4SRalf Baechle void __init plat_mem_setup(void)
771da177e4SLinus Torvalds {
781da177e4SLinus Torvalds 	int i;
791da177e4SLinus Torvalds 
801da177e4SLinus Torvalds 	_machine_restart = cobalt_machine_restart;
811da177e4SLinus Torvalds 	_machine_halt = cobalt_machine_halt;
82f13558c2SYoichi Yuasa 	pm_power_off = cobalt_machine_halt;
831da177e4SLinus Torvalds 
8456ae5833SYoichi Yuasa 	set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
85c4ed38a0SRalf Baechle 
86b5d5acccSYoichi Yuasa 	/* I/O port resource */
87b5d5acccSYoichi Yuasa 	ioport_resource.end = 0x01ffffff;
881da177e4SLinus Torvalds 
8947d7c44bSYoichi Yuasa 	/* These resources have been reserved by VIA SuperI/O chip. */
9047d7c44bSYoichi Yuasa 	for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
9147d7c44bSYoichi Yuasa 		request_resource(&ioport_resource, cobalt_reserved_resources + i);
920cfd5267SYoichi Yuasa }
931da177e4SLinus Torvalds 
941da177e4SLinus Torvalds /*
951da177e4SLinus Torvalds  * Prom init. We read our one and only communication with the firmware.
96c4ed38a0SRalf Baechle  * Grab the amount of installed memory.
97c4ed38a0SRalf Baechle  * Better boot loaders (CoLo) pass a command line too :-)
981da177e4SLinus Torvalds  */
991da177e4SLinus Torvalds 
prom_init(void)1001da177e4SLinus Torvalds void __init prom_init(void)
1011da177e4SLinus Torvalds {
102c4ed38a0SRalf Baechle 	unsigned long memsz;
1030833c76bSYoichi Yuasa 	int argc, i;
104c4ed38a0SRalf Baechle 	char **argv;
1051da177e4SLinus Torvalds 
106c4ed38a0SRalf Baechle 	memsz = fw_arg0 & 0x7fff0000;
1070833c76bSYoichi Yuasa 	argc = fw_arg0 & 0x0000ffff;
108c4ed38a0SRalf Baechle 	argv = (char **)fw_arg1;
1090833c76bSYoichi Yuasa 
1100833c76bSYoichi Yuasa 	for (i = 1; i < argc; i++) {
1110833c76bSYoichi Yuasa 		strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
1120833c76bSYoichi Yuasa 		if (i < (argc - 1))
1130833c76bSYoichi Yuasa 			strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
114c4ed38a0SRalf Baechle 	}
115c4ed38a0SRalf Baechle 
116*e7ae8d17SThomas Bogendoerfer 	memblock_add(0, memsz);
1178a8594a7SYoichi Yuasa 
1188a8594a7SYoichi Yuasa 	setup_8250_early_printk_port(CKSEG1ADDR(0x1c800000), 0, 0);
1191da177e4SLinus Torvalds }
120