aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2007-08-25 05:01:50 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-10-11 18:46:00 -0400
commitea202c632a52c4a83f1bd82d8d06bc8e04f2689a (patch)
tree1815b69d45b99d8f20d0fb33ba7b34b8319f2507
parent1f21d2bde0046e959b53756f74d96dfd040a803b (diff)
[MIPS] JAZZ fixes
- restructured irq handling - switched vdma to use memory allocated via get_free_pages - setup platform devices for serial, jazz_esp and jazzsonic - fixed cmos rtc access Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/jazz/Makefile2
-rw-r--r--arch/mips/jazz/irq.c94
-rw-r--r--arch/mips/jazz/jazz-platform.c60
-rw-r--r--arch/mips/jazz/jazzdma.c47
-rw-r--r--arch/mips/jazz/setup.c115
-rw-r--r--include/asm-mips/jazz.h40
-rw-r--r--include/asm-mips/jazzdma.h1
-rw-r--r--include/asm-mips/mach-jazz/mc146818rtc.h10
9 files changed, 182 insertions, 188 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bb3fb4018602..a8bdc084e10c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -93,6 +93,7 @@ config MACH_JAZZ
93 select ARC32 93 select ARC32
94 select ARCH_MAY_HAVE_PC_FDC 94 select ARCH_MAY_HAVE_PC_FDC
95 select GENERIC_ISA_DMA 95 select GENERIC_ISA_DMA
96 select IRQ_CPU
96 select I8259 97 select I8259
97 select ISA 98 select ISA
98 select PCSPEAKER 99 select PCSPEAKER
diff --git a/arch/mips/jazz/Makefile b/arch/mips/jazz/Makefile
index 575a9442bc82..5aee0c266d18 100644
--- a/arch/mips/jazz/Makefile
+++ b/arch/mips/jazz/Makefile
@@ -2,6 +2,6 @@
2# Makefile for the Jazz family specific parts of the kernel 2# Makefile for the Jazz family specific parts of the kernel
3# 3#
4 4
5obj-y := irq.o jazzdma.o jazz-platform.o reset.o setup.o 5obj-y := irq.o jazzdma.o reset.o setup.o
6 6
7EXTRA_CFLAGS += -Werror 7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 015cf4bb51dd..56235412cbb7 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -11,15 +11,17 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13 13
14#include <asm/irq_cpu.h>
14#include <asm/i8259.h> 15#include <asm/i8259.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/jazz.h> 17#include <asm/jazz.h>
18#include <asm/pgtable.h>
17 19
18static DEFINE_SPINLOCK(r4030_lock); 20static DEFINE_SPINLOCK(r4030_lock);
19 21
20static void enable_r4030_irq(unsigned int irq) 22static void enable_r4030_irq(unsigned int irq)
21{ 23{
22 unsigned int mask = 1 << (irq - JAZZ_PARALLEL_IRQ); 24 unsigned int mask = 1 << (irq - JAZZ_IRQ_START);
23 unsigned long flags; 25 unsigned long flags;
24 26
25 spin_lock_irqsave(&r4030_lock, flags); 27 spin_lock_irqsave(&r4030_lock, flags);
@@ -30,7 +32,7 @@ static void enable_r4030_irq(unsigned int irq)
30 32
31void disable_r4030_irq(unsigned int irq) 33void disable_r4030_irq(unsigned int irq)
32{ 34{
33 unsigned int mask = ~(1 << (irq - JAZZ_PARALLEL_IRQ)); 35 unsigned int mask = ~(1 << (irq - JAZZ_IRQ_START));
34 unsigned long flags; 36 unsigned long flags;
35 37
36 spin_lock_irqsave(&r4030_lock, flags); 38 spin_lock_irqsave(&r4030_lock, flags);
@@ -51,7 +53,7 @@ void __init init_r4030_ints(void)
51{ 53{
52 int i; 54 int i;
53 55
54 for (i = JAZZ_PARALLEL_IRQ; i <= JAZZ_TIMER_IRQ; i++) 56 for (i = JAZZ_IRQ_START; i <= JAZZ_IRQ_END; i++)
55 set_irq_chip_and_handler(i, &r4030_irq_type, handle_level_irq); 57 set_irq_chip_and_handler(i, &r4030_irq_type, handle_level_irq);
56 58
57 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0); 59 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0);
@@ -66,82 +68,40 @@ void __init init_r4030_ints(void)
66 */ 68 */
67void __init arch_init_irq(void) 69void __init arch_init_irq(void)
68{ 70{
71 /*
72 * this is a hack to get back the still needed wired mapping
73 * killed by init_mm()
74 */
75
76 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
77 add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
78 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
79 add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
80 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
81 add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
82
69 init_i8259_irqs(); /* Integrated i8259 */ 83 init_i8259_irqs(); /* Integrated i8259 */
84 mips_cpu_irq_init();
70 init_r4030_ints(); 85 init_r4030_ints();
71 86
72 change_c0_status(ST0_IM, IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1); 87 change_c0_status(ST0_IM, IE_IRQ2 | IE_IRQ1);
73}
74
75static void loc_call(unsigned int irq, unsigned int mask)
76{
77 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
78 r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) & mask);
79 do_IRQ(irq);
80 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
81 r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | mask);
82}
83
84static void ll_local_dev(void)
85{
86 switch (r4030_read_reg32(JAZZ_IO_IRQ_SOURCE)) {
87 case 0:
88 panic("Unimplemented loc_no_irq handler");
89 break;
90 case 4:
91 loc_call(JAZZ_PARALLEL_IRQ, JAZZ_IE_PARALLEL);
92 break;
93 case 8:
94 loc_call(JAZZ_PARALLEL_IRQ, JAZZ_IE_FLOPPY);
95 break;
96 case 12:
97 panic("Unimplemented loc_sound handler");
98 break;
99 case 16:
100 panic("Unimplemented loc_video handler");
101 break;
102 case 20:
103 loc_call(JAZZ_ETHERNET_IRQ, JAZZ_IE_ETHERNET);
104 break;
105 case 24:
106 loc_call(JAZZ_SCSI_IRQ, JAZZ_IE_SCSI);
107 break;
108 case 28:
109 loc_call(JAZZ_KEYBOARD_IRQ, JAZZ_IE_KEYBOARD);
110 break;
111 case 32:
112 loc_call(JAZZ_MOUSE_IRQ, JAZZ_IE_MOUSE);
113 break;
114 case 36:
115 loc_call(JAZZ_SERIAL1_IRQ, JAZZ_IE_SERIAL1);
116 break;
117 case 40:
118 loc_call(JAZZ_SERIAL2_IRQ, JAZZ_IE_SERIAL2);
119 break;
120 }
121} 88}
122 89
123asmlinkage void plat_irq_dispatch(void) 90asmlinkage void plat_irq_dispatch(void)
124{ 91{
125 unsigned int pending = read_c0_cause() & read_c0_status(); 92 unsigned int pending = read_c0_cause() & read_c0_status();
93 unsigned int irq;
126 94
127 if (pending & IE_IRQ5) 95 if (pending & IE_IRQ4) {
128 write_c0_compare(0);
129 else if (pending & IE_IRQ4) {
130 r4030_read_reg32(JAZZ_TIMER_REGISTER); 96 r4030_read_reg32(JAZZ_TIMER_REGISTER);
131 do_IRQ(JAZZ_TIMER_IRQ); 97 do_IRQ(JAZZ_TIMER_IRQ);
132 } else if (pending & IE_IRQ3) 98 } else if (pending & IE_IRQ2)
133 panic("Unimplemented ISA NMI handler");
134 else if (pending & IE_IRQ2)
135 do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK)); 99 do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK));
136 else if (pending & IE_IRQ1) { 100 else if (pending & IE_IRQ1) {
137 ll_local_dev(); 101 irq = *(volatile u8 *)JAZZ_IO_IRQ_SOURCE >> 2;
138 } else if (unlikely(pending & IE_IRQ0)) 102 if (likely(irq > 0))
139 panic("Unimplemented local_dma handler"); 103 do_IRQ(irq + JAZZ_IRQ_START - 1);
140 else if (pending & IE_SW1) { 104 else
141 clear_c0_cause(IE_SW1); 105 panic("Unimplemented loc_no_irq handler");
142 panic("Unimplemented sw1 handler");
143 } else if (pending & IE_SW0) {
144 clear_c0_cause(IE_SW0);
145 panic("Unimplemented sw0 handler");
146 } 106 }
147} 107}
diff --git a/arch/mips/jazz/jazz-platform.c b/arch/mips/jazz/jazz-platform.c
deleted file mode 100644
index fd736703eef2..000000000000
--- a/arch/mips/jazz/jazz-platform.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/init.h>
9#include <linux/module.h>
10#include <linux/serial_8250.h>
11
12#include <asm/jazz.h>
13
14/*
15 * Confusion ... It seems the original Microsoft Jazz machine used to have a
16 * 4.096MHz clock for its UART while the MIPS Magnum and Millenium systems
17 * had 8MHz. The Olivetti M700-10 and the Acer PICA have 1.8432MHz like PCs.
18 */
19#ifdef CONFIG_OLIVETTI_M700
20#define JAZZ_BASE_BAUD 1843200
21#else
22#define JAZZ_BASE_BAUD 8000000 /* 3072000 */
23#endif
24
25#define JAZZ_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
26
27#define JAZZ_PORT(base, int) \
28{ \
29 .mapbase = base, \
30 .irq = int, \
31 .uartclk = JAZZ_BASE_BAUD, \
32 .iotype = UPIO_MEM, \
33 .flags = JAZZ_UART_FLAGS, \
34 .regshift = 0, \
35}
36
37static struct plat_serial8250_port uart8250_data[] = {
38 JAZZ_PORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
39 JAZZ_PORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
40 { },
41};
42
43static struct platform_device uart8250_device = {
44 .name = "serial8250",
45 .id = PLAT8250_DEV_PLATFORM,
46 .dev = {
47 .platform_data = uart8250_data,
48 },
49};
50
51static int __init uart8250_init(void)
52{
53 return platform_device_register(&uart8250_device);
54}
55
56module_init(uart8250_init);
57
58MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
59MODULE_LICENSE("GPL");
60MODULE_DESCRIPTION("8250 UART probe driver for the Jazz family");
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
index e8e0ffb9354d..c672c08d49e5 100644
--- a/arch/mips/jazz/jazzdma.c
+++ b/arch/mips/jazz/jazzdma.c
@@ -27,7 +27,7 @@
27 */ 27 */
28#define CONF_DEBUG_VDMA 0 28#define CONF_DEBUG_VDMA 0
29 29
30static unsigned long vdma_pagetable_start; 30static VDMA_PGTBL_ENTRY *pgtbl;
31 31
32static DEFINE_SPINLOCK(vdma_lock); 32static DEFINE_SPINLOCK(vdma_lock);
33 33
@@ -46,7 +46,6 @@ static int debuglvl = 3;
46 */ 46 */
47static inline void vdma_pgtbl_init(void) 47static inline void vdma_pgtbl_init(void)
48{ 48{
49 VDMA_PGTBL_ENTRY *pgtbl = (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
50 unsigned long paddr = 0; 49 unsigned long paddr = 0;
51 int i; 50 int i;
52 51
@@ -60,31 +59,31 @@ static inline void vdma_pgtbl_init(void)
60/* 59/*
61 * Initialize the Jazz R4030 dma controller 60 * Initialize the Jazz R4030 dma controller
62 */ 61 */
63void __init vdma_init(void) 62static int __init vdma_init(void)
64{ 63{
65 /* 64 /*
66 * Allocate 32k of memory for DMA page tables. This needs to be page 65 * Allocate 32k of memory for DMA page tables. This needs to be page
67 * aligned and should be uncached to avoid cache flushing after every 66 * aligned and should be uncached to avoid cache flushing after every
68 * update. 67 * update.
69 */ 68 */
70 vdma_pagetable_start = 69 pgtbl = (VDMA_PGTBL_ENTRY *)__get_free_pages(GFP_KERNEL | GFP_DMA,
71 (unsigned long) alloc_bootmem_low_pages(VDMA_PGTBL_SIZE); 70 get_order(VDMA_PGTBL_SIZE));
72 if (!vdma_pagetable_start) 71 if (!pgtbl)
73 BUG(); 72 BUG();
74 dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE); 73 dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE);
75 vdma_pagetable_start = KSEG1ADDR(vdma_pagetable_start); 74 pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
76 75
77 /* 76 /*
78 * Clear the R4030 translation table 77 * Clear the R4030 translation table
79 */ 78 */
80 vdma_pgtbl_init(); 79 vdma_pgtbl_init();
81 80
82 r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, 81 r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, CPHYSADDR(pgtbl));
83 CPHYSADDR(vdma_pagetable_start));
84 r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE); 82 r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE);
85 r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0); 83 r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0);
86 84
87 printk("VDMA: R4030 DMA pagetables initialized.\n"); 85 printk(KERN_INFO "VDMA: R4030 DMA pagetables initialized.\n");
86 return 0;
88} 87}
89 88
90/* 89/*
@@ -92,7 +91,6 @@ void __init vdma_init(void)
92 */ 91 */
93unsigned long vdma_alloc(unsigned long paddr, unsigned long size) 92unsigned long vdma_alloc(unsigned long paddr, unsigned long size)
94{ 93{
95 VDMA_PGTBL_ENTRY *entry = (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
96 int first, last, pages, frame, i; 94 int first, last, pages, frame, i;
97 unsigned long laddr, flags; 95 unsigned long laddr, flags;
98 96
@@ -114,10 +112,10 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size)
114 /* 112 /*
115 * Find free chunk 113 * Find free chunk
116 */ 114 */
117 pages = (size + 4095) >> 12; /* no. of pages to allocate */ 115 pages = VDMA_PAGE(paddr + size) - VDMA_PAGE(paddr) + 1;
118 first = 0; 116 first = 0;
119 while (1) { 117 while (1) {
120 while (entry[first].owner != VDMA_PAGE_EMPTY && 118 while (pgtbl[first].owner != VDMA_PAGE_EMPTY &&
121 first < VDMA_PGTBL_ENTRIES) first++; 119 first < VDMA_PGTBL_ENTRIES) first++;
122 if (first + pages > VDMA_PGTBL_ENTRIES) { /* nothing free */ 120 if (first + pages > VDMA_PGTBL_ENTRIES) { /* nothing free */
123 spin_unlock_irqrestore(&vdma_lock, flags); 121 spin_unlock_irqrestore(&vdma_lock, flags);
@@ -125,12 +123,13 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size)
125 } 123 }
126 124
127 last = first + 1; 125 last = first + 1;
128 while (entry[last].owner == VDMA_PAGE_EMPTY 126 while (pgtbl[last].owner == VDMA_PAGE_EMPTY
129 && last - first < pages) 127 && last - first < pages)
130 last++; 128 last++;
131 129
132 if (last - first == pages) 130 if (last - first == pages)
133 break; /* found */ 131 break; /* found */
132 first = last + 1;
134 } 133 }
135 134
136 /* 135 /*
@@ -140,8 +139,8 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size)
140 frame = paddr & ~(VDMA_PAGESIZE - 1); 139 frame = paddr & ~(VDMA_PAGESIZE - 1);
141 140
142 for (i = first; i < last; i++) { 141 for (i = first; i < last; i++) {
143 entry[i].frame = frame; 142 pgtbl[i].frame = frame;
144 entry[i].owner = laddr; 143 pgtbl[i].owner = laddr;
145 frame += VDMA_PAGESIZE; 144 frame += VDMA_PAGESIZE;
146 } 145 }
147 146
@@ -160,10 +159,10 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size)
160 printk("%08x ", i << 12); 159 printk("%08x ", i << 12);
161 printk("\nPADDR: "); 160 printk("\nPADDR: ");
162 for (i = first; i < last; i++) 161 for (i = first; i < last; i++)
163 printk("%08x ", entry[i].frame); 162 printk("%08x ", pgtbl[i].frame);
164 printk("\nOWNER: "); 163 printk("\nOWNER: ");
165 for (i = first; i < last; i++) 164 for (i = first; i < last; i++)
166 printk("%08x ", entry[i].owner); 165 printk("%08x ", pgtbl[i].owner);
167 printk("\n"); 166 printk("\n");
168 } 167 }
169 168
@@ -181,7 +180,6 @@ EXPORT_SYMBOL(vdma_alloc);
181 */ 180 */
182int vdma_free(unsigned long laddr) 181int vdma_free(unsigned long laddr)
183{ 182{
184 VDMA_PGTBL_ENTRY *pgtbl = (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
185 int i; 183 int i;
186 184
187 i = laddr >> 12; 185 i = laddr >> 12;
@@ -213,8 +211,6 @@ EXPORT_SYMBOL(vdma_free);
213 */ 211 */
214int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size) 212int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size)
215{ 213{
216 VDMA_PGTBL_ENTRY *pgtbl =
217 (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
218 int first, pages, npages; 214 int first, pages, npages;
219 215
220 if (laddr > 0xffffff) { 216 if (laddr > 0xffffff) {
@@ -289,8 +285,6 @@ unsigned long vdma_phys2log(unsigned long paddr)
289{ 285{
290 int i; 286 int i;
291 int frame; 287 int frame;
292 VDMA_PGTBL_ENTRY *pgtbl =
293 (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
294 288
295 frame = paddr & ~(VDMA_PAGESIZE - 1); 289 frame = paddr & ~(VDMA_PAGESIZE - 1);
296 290
@@ -312,9 +306,6 @@ EXPORT_SYMBOL(vdma_phys2log);
312 */ 306 */
313unsigned long vdma_log2phys(unsigned long laddr) 307unsigned long vdma_log2phys(unsigned long laddr)
314{ 308{
315 VDMA_PGTBL_ENTRY *pgtbl =
316 (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
317
318 return pgtbl[laddr >> 12].frame + (laddr & (VDMA_PAGESIZE - 1)); 309 return pgtbl[laddr >> 12].frame + (laddr & (VDMA_PAGESIZE - 1));
319} 310}
320 311
@@ -564,3 +555,5 @@ int vdma_get_enable(int channel)
564 555
565 return enable; 556 return enable;
566} 557}
558
559arch_initcall(vdma_init);
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index 798279e06691..5c6271ab927f 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -7,6 +7,7 @@
7 * 7 *
8 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle 8 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle
9 * Copyright (C) 2001 MIPS Technologies, Inc. 9 * Copyright (C) 2001 MIPS Technologies, Inc.
10 * Copyright (C) 2007 by Thomas Bogendoerfer
10 */ 11 */
11#include <linux/eisa.h> 12#include <linux/eisa.h>
12#include <linux/hdreg.h> 13#include <linux/hdreg.h>
@@ -20,6 +21,8 @@
20#include <linux/ide.h> 21#include <linux/ide.h>
21#include <linux/pm.h> 22#include <linux/pm.h>
22#include <linux/screen_info.h> 23#include <linux/screen_info.h>
24#include <linux/platform_device.h>
25#include <linux/serial_8250.h>
23 26
24#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
25#include <asm/irq.h> 28#include <asm/irq.h>
@@ -30,6 +33,7 @@
30#include <asm/pgtable.h> 33#include <asm/pgtable.h>
31#include <asm/time.h> 34#include <asm/time.h>
32#include <asm/traps.h> 35#include <asm/traps.h>
36#include <asm/mc146818-time.h>
33 37
34extern asmlinkage void jazz_handle_int(void); 38extern asmlinkage void jazz_handle_int(void);
35 39
@@ -72,10 +76,8 @@ void __init plat_mem_setup(void)
72 76
73 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */ 77 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
74 add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K); 78 add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
75
76 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */ 79 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
77 add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M); 80 add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
78
79 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */ 81 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
80 add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M); 82 add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
81 83
@@ -94,6 +96,7 @@ void __init plat_mem_setup(void)
94 96
95 _machine_restart = jazz_machine_restart; 97 _machine_restart = jazz_machine_restart;
96 98
99#ifdef CONFIG_VT
97 screen_info = (struct screen_info) { 100 screen_info = (struct screen_info) {
98 0, 0, /* orig-x, orig-y */ 101 0, 0, /* orig-x, orig-y */
99 0, /* unused */ 102 0, /* unused */
@@ -105,6 +108,112 @@ void __init plat_mem_setup(void)
105 0, /* orig_video_isVGA */ 108 0, /* orig_video_isVGA */
106 16 /* orig_video_points */ 109 16 /* orig_video_points */
107 }; 110 };
111#endif
108 112
109 vdma_init(); 113 add_preferred_console("ttyS", 0, "9600");
110} 114}
115
116#ifdef CONFIG_OLIVETTI_M700
117#define UART_CLK 1843200
118#else
119/* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
120 exactly which ones ... XXX */
121#define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
122#endif
123
124#define MEMPORT(_base, _irq) \
125 { \
126 .mapbase = (_base), \
127 .membase = (void *)(_base), \
128 .irq = (_irq), \
129 .uartclk = UART_CLK, \
130 .iotype = UPIO_MEM, \
131 .flags = UPF_BOOT_AUTOCONF, \
132 }
133
134static struct plat_serial8250_port jazz_serial_data[] = {
135 MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
136 MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
137 { },
138};
139
140static struct platform_device jazz_serial8250_device = {
141 .name = "serial8250",
142 .id = PLAT8250_DEV_PLATFORM,
143 .dev = {
144 .platform_data = jazz_serial_data,
145 },
146};
147
148static struct resource jazz_esp_rsrc[] = {
149 {
150 .start = JAZZ_SCSI_BASE,
151 .end = JAZZ_SCSI_BASE + 31,
152 .flags = IORESOURCE_MEM
153 },
154 {
155 .start = JAZZ_SCSI_DMA,
156 .end = JAZZ_SCSI_DMA,
157 .flags = IORESOURCE_MEM
158 },
159 {
160 .start = JAZZ_SCSI_IRQ,
161 .end = JAZZ_SCSI_IRQ,
162 .flags = IORESOURCE_IRQ
163 }
164};
165
166static struct platform_device jazz_esp_pdev = {
167 .name = "jazz_esp",
168 .num_resources = ARRAY_SIZE(jazz_esp_rsrc),
169 .resource = jazz_esp_rsrc
170};
171
172static struct resource jazz_sonic_rsrc[] = {
173 {
174 .start = JAZZ_ETHERNET_BASE,
175 .end = JAZZ_ETHERNET_BASE + 0xff,
176 .flags = IORESOURCE_MEM
177 },
178 {
179 .start = JAZZ_ETHERNET_IRQ,
180 .end = JAZZ_ETHERNET_IRQ,
181 .flags = IORESOURCE_IRQ
182 }
183};
184
185static struct platform_device jazz_sonic_pdev = {
186 .name = "jazzsonic",
187 .num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
188 .resource = jazz_sonic_rsrc
189};
190
191static struct resource jazz_cmos_rsrc[] = {
192 {
193 .start = 0x70,
194 .end = 0x71,
195 .flags = IORESOURCE_IO
196 },
197 {
198 .start = 8,
199 .end = 8,
200 .flags = IORESOURCE_IRQ
201 }
202};
203
204static struct platform_device jazz_cmos_pdev = {
205 .name = "rtc_cmos",
206 .num_resources = ARRAY_SIZE(jazz_cmos_rsrc),
207 .resource = jazz_cmos_rsrc
208};
209
210static int __init jazz_setup_devinit(void)
211{
212 platform_device_register(&jazz_serial8250_device);
213 platform_device_register(&jazz_esp_pdev);
214 platform_device_register(&jazz_sonic_pdev);
215 platform_device_register(&jazz_cmos_pdev);
216 return 0;
217}
218
219device_initcall(jazz_setup_devinit);
diff --git a/include/asm-mips/jazz.h b/include/asm-mips/jazz.h
index 81cbf004fd13..83f449dec95e 100644
--- a/include/asm-mips/jazz.h
+++ b/include/asm-mips/jazz.h
@@ -185,37 +185,25 @@ typedef struct {
185#define JAZZ_IO_IRQ_ENABLE 0xe0010002 185#define JAZZ_IO_IRQ_ENABLE 0xe0010002
186 186
187/* 187/*
188 * JAZZ interrupt enable bits
189 */
190#define JAZZ_IE_PARALLEL (1 << 0)
191#define JAZZ_IE_FLOPPY (1 << 1)
192#define JAZZ_IE_SOUND (1 << 2)
193#define JAZZ_IE_VIDEO (1 << 3)
194#define JAZZ_IE_ETHERNET (1 << 4)
195#define JAZZ_IE_SCSI (1 << 5)
196#define JAZZ_IE_KEYBOARD (1 << 6)
197#define JAZZ_IE_MOUSE (1 << 7)
198#define JAZZ_IE_SERIAL1 (1 << 8)
199#define JAZZ_IE_SERIAL2 (1 << 9)
200
201/*
202 * JAZZ Interrupt Level definitions 188 * JAZZ Interrupt Level definitions
203 * 189 *
204 * This is somewhat broken. For reasons which nobody can remember anymore 190 * This is somewhat broken. For reasons which nobody can remember anymore
205 * we remap the Jazz interrupts to the usual ISA style interrupt numbers. 191 * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
206 */ 192 */
207#define JAZZ_PARALLEL_IRQ 16 193#define JAZZ_IRQ_START 24
208#define JAZZ_FLOPPY_IRQ 17 194#define JAZZ_IRQ_END (24 + 9)
209#define JAZZ_SOUND_IRQ 18 195#define JAZZ_PARALLEL_IRQ (JAZZ_IRQ_START + 0)
210#define JAZZ_VIDEO_IRQ 19 196#define JAZZ_FLOPPY_IRQ (JAZZ_IRQ_START + 1)
211#define JAZZ_ETHERNET_IRQ 20 197#define JAZZ_SOUND_IRQ (JAZZ_IRQ_START + 2)
212#define JAZZ_SCSI_IRQ 21 198#define JAZZ_VIDEO_IRQ (JAZZ_IRQ_START + 3)
213#define JAZZ_KEYBOARD_IRQ 22 199#define JAZZ_ETHERNET_IRQ (JAZZ_IRQ_START + 4)
214#define JAZZ_MOUSE_IRQ 23 200#define JAZZ_SCSI_IRQ (JAZZ_IRQ_START + 5)
215#define JAZZ_SERIAL1_IRQ 24 201#define JAZZ_KEYBOARD_IRQ (JAZZ_IRQ_START + 6)
216#define JAZZ_SERIAL2_IRQ 25 202#define JAZZ_MOUSE_IRQ (JAZZ_IRQ_START + 7)
217 203#define JAZZ_SERIAL1_IRQ (JAZZ_IRQ_START + 8)
218#define JAZZ_TIMER_IRQ 31 204#define JAZZ_SERIAL2_IRQ (JAZZ_IRQ_START + 9)
205
206#define JAZZ_TIMER_IRQ (MIPS_CPU_IRQ_BASE+6)
219 207
220 208
221/* 209/*
diff --git a/include/asm-mips/jazzdma.h b/include/asm-mips/jazzdma.h
index 0a205b77e505..8bb37bba68f0 100644
--- a/include/asm-mips/jazzdma.h
+++ b/include/asm-mips/jazzdma.h
@@ -7,7 +7,6 @@
7/* 7/*
8 * Prototypes and macros 8 * Prototypes and macros
9 */ 9 */
10extern void vdma_init(void);
11extern unsigned long vdma_alloc(unsigned long paddr, unsigned long size); 10extern unsigned long vdma_alloc(unsigned long paddr, unsigned long size);
12extern int vdma_free(unsigned long laddr); 11extern int vdma_free(unsigned long laddr);
13extern int vdma_remap(unsigned long laddr, unsigned long paddr, 12extern int vdma_remap(unsigned long laddr, unsigned long paddr,
diff --git a/include/asm-mips/mach-jazz/mc146818rtc.h b/include/asm-mips/mach-jazz/mc146818rtc.h
index f44fdba1998b..987f727afe25 100644
--- a/include/asm-mips/mach-jazz/mc146818rtc.h
+++ b/include/asm-mips/mach-jazz/mc146818rtc.h
@@ -4,12 +4,15 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle 6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 * Copyright (C) 2007 Thomas Bogendoerfer
7 * 8 *
8 * RTC routines for Jazz style attached Dallas chip. 9 * RTC routines for Jazz style attached Dallas chip.
9 */ 10 */
10#ifndef __ASM_MACH_JAZZ_MC146818RTC_H 11#ifndef __ASM_MACH_JAZZ_MC146818RTC_H
11#define __ASM_MACH_JAZZ_MC146818RTC_H 12#define __ASM_MACH_JAZZ_MC146818RTC_H
12 13
14#include <linux/delay.h>
15
13#include <asm/io.h> 16#include <asm/io.h>
14#include <asm/jazz.h> 17#include <asm/jazz.h>
15 18
@@ -19,16 +22,17 @@
19static inline unsigned char CMOS_READ(unsigned long addr) 22static inline unsigned char CMOS_READ(unsigned long addr)
20{ 23{
21 outb_p(addr, RTC_PORT(0)); 24 outb_p(addr, RTC_PORT(0));
22 25 return *(volatile char *)JAZZ_RTC_BASE;
23 return *(char *)JAZZ_RTC_BASE;
24} 26}
25 27
26static inline void CMOS_WRITE(unsigned char data, unsigned long addr) 28static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
27{ 29{
28 outb_p(addr, RTC_PORT(0)); 30 outb_p(addr, RTC_PORT(0));
29 *(char *)JAZZ_RTC_BASE = data; 31 *(volatile char *)JAZZ_RTC_BASE = data;
30} 32}
31 33
32#define RTC_ALWAYS_BCD 0 34#define RTC_ALWAYS_BCD 0
33 35
36#define mc146818_decode_year(year) ((year) + 1980)
37
34#endif /* __ASM_MACH_JAZZ_MC146818RTC_H */ 38#endif /* __ASM_MACH_JAZZ_MC146818RTC_H */