2 * 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, 05 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
12 #include <linux/config.h>
13 #include <linux/interrupt.h>
14 #include <linux/pci.h>
15 #include <linux/init.h>
17 #include <linux/serial.h>
18 #include <linux/serial_core.h>
20 #include <asm/bootinfo.h>
24 #include <asm/processor.h>
25 #include <asm/reboot.h>
26 #include <asm/gt64120.h>
27 #include <asm/serial.h>
29 #include <asm/mach-cobalt/cobalt.h>
31 extern void cobalt_machine_restart(char *command
);
32 extern void cobalt_machine_halt(void);
33 extern void cobalt_machine_power_off(void);
34 extern void cobalt_early_console(void);
38 const char *get_system_type(void)
40 switch (cobalt_board_id
) {
41 case COBALT_BRD_ID_QUBE1
:
43 case COBALT_BRD_ID_RAQ1
:
45 case COBALT_BRD_ID_QUBE2
:
46 return "Cobalt Qube2";
47 case COBALT_BRD_ID_RAQ2
:
53 static void __init
cobalt_timer_setup(struct irqaction
*irq
)
55 /* Load timer value for 1KHz (TCLK is 50MHz) */
56 GALILEO_OUTL(50*1000*1000 / 1000, GT_TC0_OFS
);
59 GALILEO_OUTL(GALILEO_ENTC0
| GALILEO_SELTC0
, GT_TC_CONTROL_OFS
);
61 /* Register interrupt */
62 setup_irq(COBALT_GALILEO_IRQ
, irq
);
64 /* Enable interrupt */
65 GALILEO_OUTL(GALILEO_INTR_T0EXP
| GALILEO_INL(GT_INTRMASK_OFS
), GT_INTRMASK_OFS
);
68 extern struct pci_ops gt64111_pci_ops
;
70 static struct resource cobalt_mem_resource
= {
71 "PCI memory", GT64111_MEM_BASE
, GT64111_MEM_END
, IORESOURCE_MEM
74 static struct resource cobalt_io_resource
= {
75 "PCI I/O", 0x1000, 0xffff, IORESOURCE_IO
78 static struct resource cobalt_io_resources
[] = {
79 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY
},
80 { "timer", 0x40, 0x5f, IORESOURCE_BUSY
},
81 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY
},
82 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY
},
83 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY
},
86 #define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource))
88 static struct pci_controller cobalt_pci_controller
= {
89 .pci_ops
= >64111_pci_ops
,
90 .mem_resource
= &cobalt_mem_resource
,
92 .io_resource
= &cobalt_io_resource
,
93 .io_offset
= 0 - GT64111_IO_BASE
96 void __init
plat_setup(void)
98 static struct uart_port uart
;
99 unsigned int devfn
= PCI_DEVFN(COBALT_PCICONF_VIA
, 0);
102 _machine_restart
= cobalt_machine_restart
;
103 _machine_halt
= cobalt_machine_halt
;
104 pm_power_off
= cobalt_machine_power_off
;
106 board_timer_setup
= cobalt_timer_setup
;
108 set_io_port_base(CKSEG1ADDR(GT64111_IO_BASE
));
110 /* I/O port resource must include UART and LCD/buttons */
111 ioport_resource
.end
= 0x0fffffff;
113 /* request I/O space for devices used on all i[345]86 PCs */
114 for (i
= 0; i
< COBALT_IO_RESOURCES
; i
++)
115 request_resource(&ioport_resource
, cobalt_io_resources
+ i
);
117 /* Read the cobalt id register out of the PCI config space */
118 PCI_CFG_SET(devfn
, (VIA_COBALT_BRD_ID_REG
& ~0x3));
119 cobalt_board_id
= GALILEO_INL(GT_PCI0_CFGDATA_OFS
);
120 cobalt_board_id
>>= ((VIA_COBALT_BRD_ID_REG
& 3) * 8);
121 cobalt_board_id
= VIA_COBALT_BRD_REG_to_ID(cobalt_board_id
);
123 printk("Cobalt board ID: %d\n", cobalt_board_id
);
126 register_pci_controller(&cobalt_pci_controller
);
129 #ifdef CONFIG_SERIAL_8250
130 if (cobalt_board_id
> COBALT_BRD_ID_RAQ1
) {
132 #ifdef CONFIG_EARLY_PRINTK
133 cobalt_early_console();
137 uart
.type
= PORT_UNKNOWN
;
138 uart
.uartclk
= 18432000;
139 uart
.irq
= COBALT_SERIAL_IRQ
;
140 uart
.flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
;
141 uart
.iobase
= 0xc800000;
142 uart
.iotype
= UPIO_PORT
;
144 early_serial_setup(&uart
);
150 * Prom init. We read our one and only communication with the firmware.
151 * Grab the amount of installed memory.
152 * Better boot loaders (CoLo) pass a command line too :-)
155 void __init
prom_init(void)
157 int narg
, indx
, posn
, nchr
;
161 mips_machgroup
= MACH_GROUP_COBALT
;
163 memsz
= fw_arg0
& 0x7fff0000;
164 narg
= fw_arg0
& 0x0000ffff;
167 arcs_cmdline
[0] = '\0';
168 argv
= (char **) fw_arg1
;
170 for (indx
= 1; indx
< narg
; ++indx
) {
171 nchr
= strlen(argv
[indx
]);
172 if (posn
+ 1 + nchr
+ 1 > sizeof(arcs_cmdline
))
175 arcs_cmdline
[posn
++] = ' ';
176 strcpy(arcs_cmdline
+ posn
, argv
[indx
]);
181 add_memory_region(0x0, memsz
, BOOT_MEM_RAM
);
184 unsigned long __init
prom_free_prom_memory(void)