diff options
Diffstat (limited to 'arch/mips/cobalt/setup.c')
| -rw-r--r-- | arch/mips/cobalt/setup.c | 104 |
1 files changed, 72 insertions, 32 deletions
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c index 6b4737e425ed..d358a118fa31 100644 --- a/arch/mips/cobalt/setup.c +++ b/arch/mips/cobalt/setup.c | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
| 14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
| 15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/serial.h> | ||
| 17 | #include <linux/serial_core.h> | ||
| 16 | 18 | ||
| 17 | #include <asm/bootinfo.h> | 19 | #include <asm/bootinfo.h> |
| 18 | #include <asm/time.h> | 20 | #include <asm/time.h> |
| @@ -21,6 +23,7 @@ | |||
| 21 | #include <asm/processor.h> | 23 | #include <asm/processor.h> |
| 22 | #include <asm/reboot.h> | 24 | #include <asm/reboot.h> |
| 23 | #include <asm/gt64120.h> | 25 | #include <asm/gt64120.h> |
| 26 | #include <asm/serial.h> | ||
| 24 | 27 | ||
| 25 | #include <asm/cobalt/cobalt.h> | 28 | #include <asm/cobalt/cobalt.h> |
| 26 | 29 | ||
| @@ -30,45 +33,44 @@ extern void cobalt_machine_power_off(void); | |||
| 30 | 33 | ||
| 31 | int cobalt_board_id; | 34 | int cobalt_board_id; |
| 32 | 35 | ||
| 33 | static char my_cmdline[CL_SIZE] = { | ||
| 34 | "console=ttyS0,115200 " | ||
| 35 | #ifdef CONFIG_IP_PNP | ||
| 36 | "ip=on " | ||
| 37 | #endif | ||
| 38 | #ifdef CONFIG_ROOT_NFS | ||
| 39 | "root=/dev/nfs " | ||
| 40 | #else | ||
| 41 | "root=/dev/hda1 " | ||
| 42 | #endif | ||
| 43 | }; | ||
| 44 | |||
| 45 | const char *get_system_type(void) | 36 | const char *get_system_type(void) |
| 46 | { | 37 | { |
| 38 | switch (cobalt_board_id) { | ||
| 39 | case COBALT_BRD_ID_QUBE1: | ||
| 40 | return "Cobalt Qube"; | ||
| 41 | case COBALT_BRD_ID_RAQ1: | ||
| 42 | return "Cobalt RaQ"; | ||
| 43 | case COBALT_BRD_ID_QUBE2: | ||
| 44 | return "Cobalt Qube2"; | ||
| 45 | case COBALT_BRD_ID_RAQ2: | ||
| 46 | return "Cobalt RaQ2"; | ||
| 47 | } | ||
| 47 | return "MIPS Cobalt"; | 48 | return "MIPS Cobalt"; |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | static void __init cobalt_timer_setup(struct irqaction *irq) | 51 | static void __init cobalt_timer_setup(struct irqaction *irq) |
| 51 | { | 52 | { |
| 52 | /* Load timer value for 150 Hz */ | 53 | /* Load timer value for 1KHz (TCLK is 50MHz) */ |
| 53 | GALILEO_OUTL(500000, GT_TC0_OFS); | 54 | GALILEO_OUTL(50*1000*1000 / 1000, GT_TC0_OFS); |
| 54 | 55 | ||
| 55 | /* Register our timer interrupt */ | 56 | /* Enable timer */ |
| 56 | setup_irq(COBALT_TIMER_IRQ, irq); | 57 | GALILEO_OUTL(GALILEO_ENTC0 | GALILEO_SELTC0, GT_TC_CONTROL_OFS); |
| 57 | 58 | ||
| 58 | /* Enable timer ints */ | 59 | /* Register interrupt */ |
| 59 | GALILEO_OUTL((GALILEO_ENTC0 | GALILEO_SELTC0), GT_TC_CONTROL_OFS); | 60 | setup_irq(COBALT_GALILEO_IRQ, irq); |
| 60 | /* Unmask timer int */ | 61 | |
| 61 | GALILEO_OUTL(0x100, GT_INTRMASK_OFS); | 62 | /* Enable interrupt */ |
| 63 | GALILEO_OUTL(GALILEO_INTR_T0EXP | GALILEO_INL(GT_INTRMASK_OFS), GT_INTRMASK_OFS); | ||
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | extern struct pci_ops gt64111_pci_ops; | 66 | extern struct pci_ops gt64111_pci_ops; |
| 65 | 67 | ||
| 66 | static struct resource cobalt_mem_resource = { | 68 | static struct resource cobalt_mem_resource = { |
| 67 | "GT64111 PCI MEM", GT64111_IO_BASE, 0xffffffffUL, IORESOURCE_MEM | 69 | "PCI memory", GT64111_MEM_BASE, GT64111_MEM_END, IORESOURCE_MEM |
| 68 | }; | 70 | }; |
| 69 | 71 | ||
| 70 | static struct resource cobalt_io_resource = { | 72 | static struct resource cobalt_io_resource = { |
| 71 | "GT64111 IO MEM", 0x00001000UL, 0x0fffffffUL, IORESOURCE_IO | 73 | "PCI I/O", 0x1000, 0xffff, IORESOURCE_IO |
| 72 | }; | 74 | }; |
| 73 | 75 | ||
| 74 | static struct resource cobalt_io_resources[] = { | 76 | static struct resource cobalt_io_resources[] = { |
| @@ -86,11 +88,12 @@ static struct pci_controller cobalt_pci_controller = { | |||
| 86 | .mem_resource = &cobalt_mem_resource, | 88 | .mem_resource = &cobalt_mem_resource, |
| 87 | .mem_offset = 0, | 89 | .mem_offset = 0, |
| 88 | .io_resource = &cobalt_io_resource, | 90 | .io_resource = &cobalt_io_resource, |
| 89 | .io_offset = 0x00001000UL - GT64111_IO_BASE | 91 | .io_offset = 0 - GT64111_IO_BASE |
| 90 | }; | 92 | }; |
| 91 | 93 | ||
| 92 | static void __init cobalt_setup(void) | 94 | void __init plat_setup(void) |
| 93 | { | 95 | { |
| 96 | static struct uart_port uart; | ||
| 94 | unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0); | 97 | unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0); |
| 95 | int i; | 98 | int i; |
| 96 | 99 | ||
| @@ -100,7 +103,10 @@ static void __init cobalt_setup(void) | |||
| 100 | 103 | ||
| 101 | board_timer_setup = cobalt_timer_setup; | 104 | board_timer_setup = cobalt_timer_setup; |
| 102 | 105 | ||
| 103 | set_io_port_base(KSEG1ADDR(GT64111_IO_BASE)); | 106 | set_io_port_base(CKSEG1ADDR(GT64111_IO_BASE)); |
| 107 | |||
| 108 | /* I/O port resource must include UART and LCD/buttons */ | ||
| 109 | ioport_resource.end = 0x0fffffff; | ||
| 104 | 110 | ||
| 105 | /* | 111 | /* |
| 106 | * This is a prom style console. We just poke at the | 112 | * This is a prom style console. We just poke at the |
| @@ -120,27 +126,61 @@ static void __init cobalt_setup(void) | |||
| 120 | cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8); | 126 | cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8); |
| 121 | cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id); | 127 | cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id); |
| 122 | 128 | ||
| 129 | printk("Cobalt board ID: %d\n", cobalt_board_id); | ||
| 130 | |||
| 123 | #ifdef CONFIG_PCI | 131 | #ifdef CONFIG_PCI |
| 124 | register_pci_controller(&cobalt_pci_controller); | 132 | register_pci_controller(&cobalt_pci_controller); |
| 125 | #endif | 133 | #endif |
| 126 | } | ||
| 127 | 134 | ||
| 128 | early_initcall(cobalt_setup); | 135 | #ifdef CONFIG_SERIAL_8250 |
| 136 | if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { | ||
| 137 | |||
| 138 | uart.line = 0; | ||
| 139 | uart.type = PORT_UNKNOWN; | ||
| 140 | uart.uartclk = 18432000; | ||
| 141 | uart.irq = COBALT_SERIAL_IRQ; | ||
| 142 | uart.flags = STD_COM_FLAGS; | ||
| 143 | uart.iobase = 0xc800000; | ||
| 144 | uart.iotype = UPIO_PORT; | ||
| 145 | |||
| 146 | early_serial_setup(&uart); | ||
| 147 | } | ||
| 148 | #endif | ||
| 149 | } | ||
| 129 | 150 | ||
| 130 | /* | 151 | /* |
| 131 | * Prom init. We read our one and only communication with the firmware. | 152 | * Prom init. We read our one and only communication with the firmware. |
| 132 | * Grab the amount of installed memory | 153 | * Grab the amount of installed memory. |
| 154 | * Better boot loaders (CoLo) pass a command line too :-) | ||
| 133 | */ | 155 | */ |
| 134 | 156 | ||
| 135 | void __init prom_init(void) | 157 | void __init prom_init(void) |
| 136 | { | 158 | { |
| 137 | int argc = fw_arg0; | 159 | int narg, indx, posn, nchr; |
| 138 | 160 | unsigned long memsz; | |
| 139 | strcpy(arcs_cmdline, my_cmdline); | 161 | char **argv; |
| 140 | 162 | ||
| 141 | mips_machgroup = MACH_GROUP_COBALT; | 163 | mips_machgroup = MACH_GROUP_COBALT; |
| 142 | 164 | ||
| 143 | add_memory_region(0x0, argc & 0x7fffffff, BOOT_MEM_RAM); | 165 | memsz = fw_arg0 & 0x7fff0000; |
| 166 | narg = fw_arg0 & 0x0000ffff; | ||
| 167 | |||
| 168 | if (narg) { | ||
| 169 | arcs_cmdline[0] = '\0'; | ||
| 170 | argv = (char **) fw_arg1; | ||
| 171 | posn = 0; | ||
| 172 | for (indx = 1; indx < narg; ++indx) { | ||
| 173 | nchr = strlen(argv[indx]); | ||
| 174 | if (posn + 1 + nchr + 1 > sizeof(arcs_cmdline)) | ||
| 175 | break; | ||
| 176 | if (posn) | ||
| 177 | arcs_cmdline[posn++] = ' '; | ||
| 178 | strcpy(arcs_cmdline + posn, argv[indx]); | ||
| 179 | posn += nchr; | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | add_memory_region(0x0, memsz, BOOT_MEM_RAM); | ||
| 144 | } | 184 | } |
| 145 | 185 | ||
| 146 | unsigned long __init prom_free_prom_memory(void) | 186 | unsigned long __init prom_free_prom_memory(void) |
