aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cobalt
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
commitbc95f3669f5e6f63cf0b84fe4922c3c6dd4aa775 (patch)
tree427fcf2a7287c16d4b5aa6cbf494d59579a6a8b1 /arch/mips/cobalt
parent3d29cdff999c37b3876082278a8134a0642a02cd (diff)
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/usb/input/Makefile drivers/usb/input/gtco.c
Diffstat (limited to 'arch/mips/cobalt')
-rw-r--r--arch/mips/cobalt/Kconfig7
-rw-r--r--arch/mips/cobalt/Makefile4
-rw-r--r--arch/mips/cobalt/console.c39
-rw-r--r--arch/mips/cobalt/irq.c2
-rw-r--r--arch/mips/cobalt/mtd.c61
-rw-r--r--arch/mips/cobalt/pci.c47
-rw-r--r--arch/mips/cobalt/reset.c11
-rw-r--r--arch/mips/cobalt/setup.c97
8 files changed, 151 insertions, 117 deletions
diff --git a/arch/mips/cobalt/Kconfig b/arch/mips/cobalt/Kconfig
deleted file mode 100644
index 7c42b088d16c..000000000000
--- a/arch/mips/cobalt/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
1config EARLY_PRINTK
2 bool "Early console support"
3 depends on MIPS_COBALT
4 help
5 Provide early console support by direct access to the
6 on board UART. The UART must have been previously
7 initialised by the boot loader.
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
index c35ee25e5578..9565b2104dcd 100644
--- a/arch/mips/cobalt/Makefile
+++ b/arch/mips/cobalt/Makefile
@@ -4,6 +4,6 @@
4 4
5obj-y := irq.o reset.o setup.o buttons.o 5obj-y := irq.o reset.o setup.o buttons.o
6 6
7obj-$(CONFIG_PCI) += pci.o
7obj-$(CONFIG_EARLY_PRINTK) += console.o 8obj-$(CONFIG_EARLY_PRINTK) += console.o
8 9obj-$(CONFIG_MTD_PHYSMAP) += mtd.o
9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
index 46c23b66bc17..0485d51f7216 100644
--- a/arch/mips/cobalt/console.c
+++ b/arch/mips/cobalt/console.c
@@ -1,47 +1,16 @@
1/* 1/*
2 * (C) P. Horton 2006 2 * (C) P. Horton 2006
3 */ 3 */
4
5#include <linux/init.h>
6#include <linux/kernel.h>
7#include <linux/console.h>
8#include <linux/serial_reg.h> 4#include <linux/serial_reg.h>
5
9#include <asm/addrspace.h> 6#include <asm/addrspace.h>
10#include <asm/mach-cobalt/cobalt.h>
11 7
12static void putchar(int c) 8#include <cobalt.h>
13{
14 if(c == '\n')
15 putchar('\r');
16 9
10void prom_putchar(char c)
11{
17 while(!(COBALT_UART[UART_LSR] & UART_LSR_THRE)) 12 while(!(COBALT_UART[UART_LSR] & UART_LSR_THRE))
18 ; 13 ;
19 14
20 COBALT_UART[UART_TX] = c; 15 COBALT_UART[UART_TX] = c;
21} 16}
22
23static void cons_write(struct console *c, const char *s, unsigned n)
24{
25 while(n-- && *s)
26 putchar(*s++);
27}
28
29static struct console cons_info =
30{
31 .name = "uart",
32 .write = cons_write,
33 .flags = CON_PRINTBUFFER | CON_BOOT,
34 .index = -1,
35};
36
37void __init cobalt_early_console(void)
38{
39 register_console(&cons_info);
40
41 printk("Cobalt: early console registered\n");
42}
43
44void __init disable_early_printk(void)
45{
46 unregister_console(&cons_info);
47}
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
index fe93b846923b..950ad1e8be44 100644
--- a/arch/mips/cobalt/irq.c
+++ b/arch/mips/cobalt/irq.c
@@ -17,7 +17,7 @@
17#include <asm/irq_cpu.h> 17#include <asm/irq_cpu.h>
18#include <asm/gt64120.h> 18#include <asm/gt64120.h>
19 19
20#include <asm/mach-cobalt/cobalt.h> 20#include <cobalt.h>
21 21
22/* 22/*
23 * We have two types of interrupts that we handle, ones that come in through 23 * We have two types of interrupts that we handle, ones that come in through
diff --git a/arch/mips/cobalt/mtd.c b/arch/mips/cobalt/mtd.c
new file mode 100644
index 000000000000..2b088ef3839a
--- /dev/null
+++ b/arch/mips/cobalt/mtd.c
@@ -0,0 +1,61 @@
1/*
2 * Registration of Cobalt MTD device.
3 *
4 * Copyright (C) 2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/mtd/partitions.h>
23#include <linux/mtd/physmap.h>
24
25static struct mtd_partition cobalt_mtd_partitions[] = {
26 {
27 .name = "firmware",
28 .offset = 0x0,
29 .size = 0x80000,
30 },
31};
32
33static struct physmap_flash_data cobalt_flash_data = {
34 .width = 1,
35 .nr_parts = 1,
36 .parts = cobalt_mtd_partitions,
37};
38
39static struct resource cobalt_mtd_resource = {
40 .start = 0x1fc00000,
41 .end = 0x1fc7ffff,
42 .flags = IORESOURCE_MEM,
43};
44
45static struct platform_device cobalt_mtd = {
46 .name = "physmap-flash",
47 .dev = {
48 .platform_data = &cobalt_flash_data,
49 },
50 .num_resources = 1,
51 .resource = &cobalt_mtd_resource,
52};
53
54static int __init cobalt_mtd_init(void)
55{
56 platform_device_register(&cobalt_mtd);
57
58 return 0;
59}
60
61module_init(cobalt_mtd_init);
diff --git a/arch/mips/cobalt/pci.c b/arch/mips/cobalt/pci.c
new file mode 100644
index 000000000000..d91027f43de6
--- /dev/null
+++ b/arch/mips/cobalt/pci.c
@@ -0,0 +1,47 @@
1/*
2 * Register PCI controller.
3 *
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
6 * for more details.
7 *
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)
10 *
11 */
12#include <linux/init.h>
13#include <linux/pci.h>
14
15#include <asm/gt64120.h>
16
17extern struct pci_ops gt64xxx_pci0_ops;
18
19static struct resource cobalt_mem_resource = {
20 .start = GT_DEF_PCI0_MEM0_BASE,
21 .end = GT_DEF_PCI0_MEM0_BASE + GT_DEF_PCI0_MEM0_SIZE - 1,
22 .name = "PCI memory",
23 .flags = IORESOURCE_MEM,
24};
25
26static struct resource cobalt_io_resource = {
27 .start = 0x1000,
28 .end = GT_DEF_PCI0_IO_SIZE - 1,
29 .name = "PCI I/O",
30 .flags = IORESOURCE_IO,
31};
32
33static struct pci_controller cobalt_pci_controller = {
34 .pci_ops = &gt64xxx_pci0_ops,
35 .mem_resource = &cobalt_mem_resource,
36 .io_resource = &cobalt_io_resource,
37 .io_offset = 0 - GT_DEF_PCI0_IO_BASE,
38};
39
40static int __init cobalt_pci_init(void)
41{
42 register_pci_controller(&cobalt_pci_controller);
43
44 return 0;
45}
46
47arch_initcall(cobalt_pci_init);
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c
index 753dfccae6fa..43cca21fdbc0 100644
--- a/arch/mips/cobalt/reset.c
+++ b/arch/mips/cobalt/reset.c
@@ -8,15 +8,12 @@
8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle 8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle
9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) 9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv)
10 */ 10 */
11#include <linux/sched.h> 11#include <linux/jiffies.h>
12#include <linux/mm.h> 12
13#include <asm/cacheflush.h>
14#include <asm/io.h> 13#include <asm/io.h>
15#include <asm/processor.h>
16#include <asm/reboot.h> 14#include <asm/reboot.h>
17#include <asm/system.h> 15
18#include <asm/mipsregs.h> 16#include <cobalt.h>
19#include <asm/mach-cobalt/cobalt.h>
20 17
21void cobalt_machine_halt(void) 18void cobalt_machine_halt(void)
22{ 19{
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index a4b69b543bd9..d0dd81790f74 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -19,12 +19,10 @@
19#include <asm/bootinfo.h> 19#include <asm/bootinfo.h>
20#include <asm/time.h> 20#include <asm/time.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/processor.h>
24#include <asm/reboot.h> 22#include <asm/reboot.h>
25#include <asm/gt64120.h> 23#include <asm/gt64120.h>
26 24
27#include <asm/mach-cobalt/cobalt.h> 25#include <cobalt.h>
28 26
29extern void cobalt_machine_restart(char *command); 27extern void cobalt_machine_restart(char *command);
30extern void cobalt_machine_halt(void); 28extern void cobalt_machine_halt(void);
@@ -63,61 +61,38 @@ void __init plat_timer_setup(struct irqaction *irq)
63 GT_WRITE(GT_INTRMASK_OFS, GT_INTR_T0EXP_MSK | GT_READ(GT_INTRMASK_OFS)); 61 GT_WRITE(GT_INTRMASK_OFS, GT_INTR_T0EXP_MSK | GT_READ(GT_INTRMASK_OFS));
64} 62}
65 63
66extern struct pci_ops gt64111_pci_ops; 64/*
67 65 * Cobalt doesn't have PS/2 keyboard/mouse interfaces,
68static struct resource cobalt_mem_resource = { 66 * keyboard conntroller is never used.
69 .start = GT_DEF_PCI0_MEM0_BASE, 67 * Also PCI-ISA bridge DMA contoroller is never used.
70 .end = GT_DEF_PCI0_MEM0_BASE + GT_DEF_PCI0_MEM0_SIZE - 1, 68 */
71 .name = "PCI memory", 69static struct resource cobalt_reserved_resources[] = {
72 .flags = IORESOURCE_MEM 70 { /* dma1 */
73};
74
75static struct resource cobalt_io_resource = {
76 .start = 0x1000,
77 .end = 0xffff,
78 .name = "PCI I/O",
79 .flags = IORESOURCE_IO
80};
81
82static struct resource cobalt_io_resources[] = {
83 {
84 .start = 0x00, 71 .start = 0x00,
85 .end = 0x1f, 72 .end = 0x1f,
86 .name = "dma1", 73 .name = "reserved",
87 .flags = IORESOURCE_BUSY 74 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
88 }, { 75 },
89 .start = 0x40, 76 { /* keyboard */
90 .end = 0x5f,
91 .name = "timer",
92 .flags = IORESOURCE_BUSY
93 }, {
94 .start = 0x60, 77 .start = 0x60,
95 .end = 0x6f, 78 .end = 0x6f,
96 .name = "keyboard", 79 .name = "reserved",
97 .flags = IORESOURCE_BUSY 80 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
98 }, { 81 },
82 { /* dma page reg */
99 .start = 0x80, 83 .start = 0x80,
100 .end = 0x8f, 84 .end = 0x8f,
101 .name = "dma page reg", 85 .name = "reserved",
102 .flags = IORESOURCE_BUSY 86 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
103 }, { 87 },
88 { /* dma2 */
104 .start = 0xc0, 89 .start = 0xc0,
105 .end = 0xdf, 90 .end = 0xdf,
106 .name = "dma2", 91 .name = "reserved",
107 .flags = IORESOURCE_BUSY 92 .flags = IORESOURCE_BUSY | IORESOURCE_IO,
108 }, 93 },
109}; 94};
110 95
111#define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource))
112
113static struct pci_controller cobalt_pci_controller = {
114 .pci_ops = &gt64111_pci_ops,
115 .mem_resource = &cobalt_mem_resource,
116 .mem_offset = 0,
117 .io_resource = &cobalt_io_resource,
118 .io_offset = 0 - GT_DEF_PCI0_IO_BASE,
119};
120
121void __init plat_mem_setup(void) 96void __init plat_mem_setup(void)
122{ 97{
123 static struct uart_port uart; 98 static struct uart_port uart;
@@ -130,12 +105,12 @@ void __init plat_mem_setup(void)
130 105
131 set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE)); 106 set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
132 107
133 /* I/O port resource must include UART and LCD/buttons */ 108 /* I/O port resource must include LCD/buttons */
134 ioport_resource.end = 0x0fffffff; 109 ioport_resource.end = 0x0fffffff;
135 110
136 /* request I/O space for devices used on all i[345]86 PCs */ 111 /* These resources have been reserved by VIA SuperI/O chip. */
137 for (i = 0; i < COBALT_IO_RESOURCES; i++) 112 for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
138 request_resource(&ioport_resource, cobalt_io_resources + i); 113 request_resource(&ioport_resource, cobalt_reserved_resources + i);
139 114
140 /* Read the cobalt id register out of the PCI config space */ 115 /* Read the cobalt id register out of the PCI config space */
141 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3)); 116 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3));
@@ -145,28 +120,20 @@ void __init plat_mem_setup(void)
145 120
146 printk("Cobalt board ID: %d\n", cobalt_board_id); 121 printk("Cobalt board ID: %d\n", cobalt_board_id);
147 122
148#ifdef CONFIG_PCI
149 register_pci_controller(&cobalt_pci_controller);
150#endif
151
152#ifdef CONFIG_SERIAL_8250
153 if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { 123 if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
154 124#ifdef CONFIG_SERIAL_8250
155#ifdef CONFIG_EARLY_PRINTK
156 cobalt_early_console();
157#endif
158
159 uart.line = 0; 125 uart.line = 0;
160 uart.type = PORT_UNKNOWN; 126 uart.type = PORT_UNKNOWN;
161 uart.uartclk = 18432000; 127 uart.uartclk = 18432000;
162 uart.irq = COBALT_SERIAL_IRQ; 128 uart.irq = COBALT_SERIAL_IRQ;
163 uart.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 129 uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF |
164 uart.iobase = 0xc800000; 130 UPF_SKIP_TEST;
165 uart.iotype = UPIO_PORT; 131 uart.iotype = UPIO_MEM;
132 uart.mapbase = 0x1c800000;
166 133
167 early_serial_setup(&uart); 134 early_serial_setup(&uart);
168 }
169#endif 135#endif
136 }
170} 137}
171 138
172/* 139/*