blob: 5c6271ab927fc9e9e0d8738760bf32000234d6d5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Setup pointers to hardware-dependent routines.
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, 1998, 2001 by Ralf Baechle
9 * Copyright (C) 2001 MIPS Technologies, Inc.
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020010 * Copyright (C) 2007 by Thomas Bogendoerfer
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/eisa.h>
13#include <linux/hdreg.h>
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h>
18#include <linux/mm.h>
19#include <linux/console.h>
20#include <linux/fb.h>
21#include <linux/ide.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000022#include <linux/pm.h>
Ralf Baechle06e80112006-10-08 19:35:00 +010023#include <linux/screen_info.h>
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020024#include <linux/platform_device.h>
25#include <linux/serial_8250.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000026
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <asm/bootinfo.h>
28#include <asm/irq.h>
29#include <asm/jazz.h>
30#include <asm/jazzdma.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/reboot.h>
32#include <asm/io.h>
33#include <asm/pgtable.h>
34#include <asm/time.h>
35#include <asm/traps.h>
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020036#include <asm/mc146818-time.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38extern asmlinkage void jazz_handle_int(void);
39
40extern void jazz_machine_restart(char *command);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Yoichi Yuasaea574282006-10-10 16:56:11 +090042void __init plat_timer_setup(struct irqaction *irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -070043{
44 /* set the clock to 100 Hz */
45 r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
46 setup_irq(JAZZ_TIMER_IRQ, irq);
47}
48
49static struct resource jazz_io_resources[] = {
Ralf Baechle2cf69e72006-10-08 19:19:11 +010050 {
51 .start = 0x00,
52 .end = 0x1f,
53 .name = "dma1",
54 .flags = IORESOURCE_BUSY
55 }, {
56 .start = 0x40,
57 .end = 0x5f,
58 .name = "timer",
Alexey Dobriyan5da44ad2007-06-27 14:10:06 -070059 .flags = IORESOURCE_BUSY
Ralf Baechle2cf69e72006-10-08 19:19:11 +010060 }, {
61 .start = 0x80,
62 .end = 0x8f,
63 .name = "dma page reg",
64 .flags = IORESOURCE_BUSY
65 }, {
66 .start = 0xc0,
67 .end = 0xdf,
68 .name = "dma2",
69 .flags = IORESOURCE_BUSY
70 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070071};
72
Ralf Baechle2925aba2006-06-18 01:32:22 +010073void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070074{
75 int i;
76
77 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
78 add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
80 add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
82 add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
83
84 set_io_port_base(JAZZ_PORT_BASE);
85#ifdef CONFIG_EISA
86 if (mips_machtype == MACH_MIPS_MAGNUM_4000)
87 EISA_bus = 1;
88#endif
89 isa_slot_offset = 0xe3000000;
90
91 /* request I/O space for devices used on all i[345]86 PCs */
92 for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
93 request_resource(&ioport_resource, jazz_io_resources + i);
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 /* The RTC is outside the port address space */
96
97 _machine_restart = jazz_machine_restart;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020099#ifdef CONFIG_VT
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 screen_info = (struct screen_info) {
101 0, 0, /* orig-x, orig-y */
102 0, /* unused */
103 0, /* orig_video_page */
104 0, /* orig_video_mode */
105 160, /* orig_video_cols */
106 0, 0, 0, /* unused, ega_bx, unused */
107 64, /* orig_video_lines */
108 0, /* orig_video_isVGA */
109 16 /* orig_video_points */
110 };
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200111#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200113 add_preferred_console("ttyS", 0, "9600");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114}
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200115
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);