blob: 0d0f054a02f4bfc309ad3b7290b83a90dae26cfd [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 Baechle89ef3e82008-07-31 13:08:14 +01008 * Copyright (C) 1996, 1997, 1998, 2001, 07, 08 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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/console.h>
Ralf Baechle06e80112006-10-08 19:35:00 +010016#include <linux/screen_info.h>
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020017#include <linux/platform_device.h>
18#include <linux/serial_8250.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000019
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/jazz.h>
21#include <asm/jazzdma.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <asm/reboot.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25extern asmlinkage void jazz_handle_int(void);
26
27extern void jazz_machine_restart(char *command);
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029static struct resource jazz_io_resources[] = {
Ralf Baechle2cf69e72006-10-08 19:19:11 +010030 {
31 .start = 0x00,
32 .end = 0x1f,
33 .name = "dma1",
34 .flags = IORESOURCE_BUSY
35 }, {
36 .start = 0x40,
37 .end = 0x5f,
38 .name = "timer",
Alexey Dobriyan5da44ad2007-06-27 14:10:06 -070039 .flags = IORESOURCE_BUSY
Ralf Baechle2cf69e72006-10-08 19:19:11 +010040 }, {
41 .start = 0x80,
42 .end = 0x8f,
43 .name = "dma page reg",
44 .flags = IORESOURCE_BUSY
45 }, {
46 .start = 0xc0,
47 .end = 0xdf,
48 .name = "dma2",
49 .flags = IORESOURCE_BUSY
50 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
Ralf Baechle2925aba2006-06-18 01:32:22 +010053void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070054{
55 int i;
56
57 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
Ralf Baechle49a89ef2007-10-11 23:46:15 +010058 add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
Ralf Baechle49a89ef2007-10-11 23:46:15 +010060 add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
Ralf Baechle49a89ef2007-10-11 23:46:15 +010062 add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64 set_io_port_base(JAZZ_PORT_BASE);
65#ifdef CONFIG_EISA
Thomas Bogendoerferc66072952008-07-14 15:11:40 +020066 EISA_bus = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69 /* request I/O space for devices used on all i[345]86 PCs */
70 for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
71 request_resource(&ioport_resource, jazz_io_resources + i);
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 /* The RTC is outside the port address space */
74
75 _machine_restart = jazz_machine_restart;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020077#ifdef CONFIG_VT
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 screen_info = (struct screen_info) {
Sebastian Andrzej Siewiorb20947a2010-04-21 22:36:47 +020079 .orig_video_cols = 160,
80 .orig_video_lines = 64,
81 .orig_video_points = 16,
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 };
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020083#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020085 add_preferred_console("ttyS", 0, "9600");
Linus Torvalds1da177e2005-04-16 15:20:36 -070086}
Thomas Bogendoerferea202c62007-08-25 11:01:50 +020087
88#ifdef CONFIG_OLIVETTI_M700
89#define UART_CLK 1843200
90#else
91/* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
92 exactly which ones ... XXX */
93#define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
94#endif
95
96#define MEMPORT(_base, _irq) \
97 { \
98 .mapbase = (_base), \
99 .membase = (void *)(_base), \
100 .irq = (_irq), \
101 .uartclk = UART_CLK, \
102 .iotype = UPIO_MEM, \
103 .flags = UPF_BOOT_AUTOCONF, \
104 }
105
106static struct plat_serial8250_port jazz_serial_data[] = {
107 MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
108 MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
109 { },
110};
111
112static struct platform_device jazz_serial8250_device = {
113 .name = "serial8250",
114 .id = PLAT8250_DEV_PLATFORM,
115 .dev = {
116 .platform_data = jazz_serial_data,
117 },
118};
119
120static struct resource jazz_esp_rsrc[] = {
121 {
122 .start = JAZZ_SCSI_BASE,
123 .end = JAZZ_SCSI_BASE + 31,
124 .flags = IORESOURCE_MEM
125 },
126 {
127 .start = JAZZ_SCSI_DMA,
128 .end = JAZZ_SCSI_DMA,
129 .flags = IORESOURCE_MEM
130 },
131 {
132 .start = JAZZ_SCSI_IRQ,
133 .end = JAZZ_SCSI_IRQ,
134 .flags = IORESOURCE_IRQ
135 }
136};
137
138static struct platform_device jazz_esp_pdev = {
139 .name = "jazz_esp",
140 .num_resources = ARRAY_SIZE(jazz_esp_rsrc),
141 .resource = jazz_esp_rsrc
142};
143
144static struct resource jazz_sonic_rsrc[] = {
145 {
146 .start = JAZZ_ETHERNET_BASE,
147 .end = JAZZ_ETHERNET_BASE + 0xff,
148 .flags = IORESOURCE_MEM
149 },
150 {
151 .start = JAZZ_ETHERNET_IRQ,
152 .end = JAZZ_ETHERNET_IRQ,
153 .flags = IORESOURCE_IRQ
154 }
155};
156
157static struct platform_device jazz_sonic_pdev = {
158 .name = "jazzsonic",
159 .num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
160 .resource = jazz_sonic_rsrc
161};
162
163static struct resource jazz_cmos_rsrc[] = {
164 {
165 .start = 0x70,
166 .end = 0x71,
167 .flags = IORESOURCE_IO
168 },
169 {
170 .start = 8,
171 .end = 8,
172 .flags = IORESOURCE_IRQ
173 }
174};
175
176static struct platform_device jazz_cmos_pdev = {
177 .name = "rtc_cmos",
178 .num_resources = ARRAY_SIZE(jazz_cmos_rsrc),
179 .resource = jazz_cmos_rsrc
180};
181
Ralf Baechle19388fb2008-01-29 10:14:57 +0000182static struct platform_device pcspeaker_pdev = {
183 .name = "pcspkr",
184 .id = -1,
185};
186
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200187static int __init jazz_setup_devinit(void)
188{
189 platform_device_register(&jazz_serial8250_device);
190 platform_device_register(&jazz_esp_pdev);
191 platform_device_register(&jazz_sonic_pdev);
192 platform_device_register(&jazz_cmos_pdev);
Ralf Baechle19388fb2008-01-29 10:14:57 +0000193 platform_device_register(&pcspeaker_pdev);
194
Thomas Bogendoerferea202c62007-08-25 11:01:50 +0200195 return 0;
196}
197
198device_initcall(jazz_setup_devinit);