blob: b59ba6b93cdd26e24cb9376e2c4a7a4c8ebbe8ff [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 *
Ralf Baechle89742e52007-10-18 13:51:15 +01008 * Copyright (C) 1996, 1997, 1998, 2001, 07 by Ralf Baechle
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/ioport.h>
15#include <linux/sched.h>
16#include <linux/interrupt.h>
17#include <linux/mm.h>
18#include <linux/console.h>
19#include <linux/fb.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000020#include <linux/pm.h>
Ralf Baechle06e80112006-10-08 19:35:00 +010021#include <linux/screen_info.h>
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020022#include <linux/platform_device.h>
23#include <linux/serial_8250.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000024
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/bootinfo.h>
26#include <asm/irq.h>
27#include <asm/jazz.h>
28#include <asm/jazzdma.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/reboot.h>
30#include <asm/io.h>
31#include <asm/pgtable.h>
32#include <asm/time.h>
33#include <asm/traps.h>
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020034#include <asm/mc146818-time.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36extern asmlinkage void jazz_handle_int(void);
37
38extern void jazz_machine_restart(char *command);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Linus Torvalds1da177e2005-04-16 15:20:36 -070040static struct resource jazz_io_resources[] = {
Ralf Baechle2cf69e72006-10-08 19:19:11 +010041 {
42 .start = 0x00,
43 .end = 0x1f,
44 .name = "dma1",
45 .flags = IORESOURCE_BUSY
46 }, {
47 .start = 0x40,
48 .end = 0x5f,
49 .name = "timer",
Alexey Dobriyan5da44ad2007-06-27 14:10:06 -070050 .flags = IORESOURCE_BUSY
Ralf Baechle2cf69e72006-10-08 19:19:11 +010051 }, {
52 .start = 0x80,
53 .end = 0x8f,
54 .name = "dma page reg",
55 .flags = IORESOURCE_BUSY
56 }, {
57 .start = 0xc0,
58 .end = 0xdf,
59 .name = "dma2",
60 .flags = IORESOURCE_BUSY
61 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070062};
63
Ralf Baechle2925aba2006-06-18 01:32:22 +010064void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070065{
66 int i;
67
68 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
Ralf Baechle49a89ef2007-10-11 23:46:15 +010069 add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
Ralf Baechle49a89ef2007-10-11 23:46:15 +010071 add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
Ralf Baechle49a89ef2007-10-11 23:46:15 +010073 add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
75 set_io_port_base(JAZZ_PORT_BASE);
76#ifdef CONFIG_EISA
Thomas Bogendoerferc66072952008-07-14 15:11:40 +020077 EISA_bus = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070078#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80 /* request I/O space for devices used on all i[345]86 PCs */
81 for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
82 request_resource(&ioport_resource, jazz_io_resources + i);
83
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 /* The RTC is outside the port address space */
85
86 _machine_restart = jazz_machine_restart;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020088#ifdef CONFIG_VT
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 screen_info = (struct screen_info) {
90 0, 0, /* orig-x, orig-y */
91 0, /* unused */
92 0, /* orig_video_page */
93 0, /* orig_video_mode */
94 160, /* orig_video_cols */
95 0, 0, 0, /* unused, ega_bx, unused */
96 64, /* orig_video_lines */
97 0, /* orig_video_isVGA */
98 16 /* orig_video_points */
99 };
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200100#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200102 add_preferred_console("ttyS", 0, "9600");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103}
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200104
105#ifdef CONFIG_OLIVETTI_M700
106#define UART_CLK 1843200
107#else
108/* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
109 exactly which ones ... XXX */
110#define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
111#endif
112
113#define MEMPORT(_base, _irq) \
114 { \
115 .mapbase = (_base), \
116 .membase = (void *)(_base), \
117 .irq = (_irq), \
118 .uartclk = UART_CLK, \
119 .iotype = UPIO_MEM, \
120 .flags = UPF_BOOT_AUTOCONF, \
121 }
122
123static struct plat_serial8250_port jazz_serial_data[] = {
124 MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
125 MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
126 { },
127};
128
129static struct platform_device jazz_serial8250_device = {
130 .name = "serial8250",
131 .id = PLAT8250_DEV_PLATFORM,
132 .dev = {
133 .platform_data = jazz_serial_data,
134 },
135};
136
137static struct resource jazz_esp_rsrc[] = {
138 {
139 .start = JAZZ_SCSI_BASE,
140 .end = JAZZ_SCSI_BASE + 31,
141 .flags = IORESOURCE_MEM
142 },
143 {
144 .start = JAZZ_SCSI_DMA,
145 .end = JAZZ_SCSI_DMA,
146 .flags = IORESOURCE_MEM
147 },
148 {
149 .start = JAZZ_SCSI_IRQ,
150 .end = JAZZ_SCSI_IRQ,
151 .flags = IORESOURCE_IRQ
152 }
153};
154
155static struct platform_device jazz_esp_pdev = {
156 .name = "jazz_esp",
157 .num_resources = ARRAY_SIZE(jazz_esp_rsrc),
158 .resource = jazz_esp_rsrc
159};
160
161static struct resource jazz_sonic_rsrc[] = {
162 {
163 .start = JAZZ_ETHERNET_BASE,
164 .end = JAZZ_ETHERNET_BASE + 0xff,
165 .flags = IORESOURCE_MEM
166 },
167 {
168 .start = JAZZ_ETHERNET_IRQ,
169 .end = JAZZ_ETHERNET_IRQ,
170 .flags = IORESOURCE_IRQ
171 }
172};
173
174static struct platform_device jazz_sonic_pdev = {
175 .name = "jazzsonic",
176 .num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
177 .resource = jazz_sonic_rsrc
178};
179
180static struct resource jazz_cmos_rsrc[] = {
181 {
182 .start = 0x70,
183 .end = 0x71,
184 .flags = IORESOURCE_IO
185 },
186 {
187 .start = 8,
188 .end = 8,
189 .flags = IORESOURCE_IRQ
190 }
191};
192
193static struct platform_device jazz_cmos_pdev = {
194 .name = "rtc_cmos",
195 .num_resources = ARRAY_SIZE(jazz_cmos_rsrc),
196 .resource = jazz_cmos_rsrc
197};
198
Ralf Baechle19388fb2008-01-29 10:14:57 +0000199static struct platform_device pcspeaker_pdev = {
200 .name = "pcspkr",
201 .id = -1,
202};
203
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200204static int __init jazz_setup_devinit(void)
205{
206 platform_device_register(&jazz_serial8250_device);
207 platform_device_register(&jazz_esp_pdev);
208 platform_device_register(&jazz_sonic_pdev);
209 platform_device_register(&jazz_cmos_pdev);
Ralf Baechle19388fb2008-01-29 10:14:57 +0000210 platform_device_register(&pcspeaker_pdev);
211
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200212 return 0;
213}
214
215device_initcall(jazz_setup_devinit);