xref: /openbmc/linux/arch/mips/jazz/setup.c (revision f42b3800)
1 /*
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, 07 by Ralf Baechle
9  * Copyright (C) 2001 MIPS Technologies, Inc.
10  * Copyright (C) 2007 by Thomas Bogendoerfer
11  */
12 #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>
22 #include <linux/pm.h>
23 #include <linux/screen_info.h>
24 #include <linux/platform_device.h>
25 #include <linux/serial_8250.h>
26 
27 #include <asm/bootinfo.h>
28 #include <asm/irq.h>
29 #include <asm/jazz.h>
30 #include <asm/jazzdma.h>
31 #include <asm/reboot.h>
32 #include <asm/io.h>
33 #include <asm/pgtable.h>
34 #include <asm/time.h>
35 #include <asm/traps.h>
36 #include <asm/mc146818-time.h>
37 
38 extern asmlinkage void jazz_handle_int(void);
39 
40 extern void jazz_machine_restart(char *command);
41 
42 static struct resource jazz_io_resources[] = {
43 	{
44 		.start	= 0x00,
45 		.end	= 0x1f,
46 		.name	= "dma1",
47 		.flags	= IORESOURCE_BUSY
48 	}, {
49 		.start	= 0x40,
50 		.end	= 0x5f,
51 		.name	= "timer",
52 		.flags	= IORESOURCE_BUSY
53 	}, {
54 		.start	= 0x80,
55 		.end	= 0x8f,
56 		.name	= "dma page reg",
57 		.flags	= IORESOURCE_BUSY
58 	}, {
59 		.start	= 0xc0,
60 		.end	= 0xdf,
61 		.name	= "dma2",
62 		.flags	= IORESOURCE_BUSY
63 	}
64 };
65 
66 void __init plat_mem_setup(void)
67 {
68 	int i;
69 
70 	/* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
71 	add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
72 	/* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
73 	add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
74 	/* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
75 	add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
76 
77 	set_io_port_base(JAZZ_PORT_BASE);
78 #ifdef CONFIG_EISA
79 	if (mips_machtype == MACH_MIPS_MAGNUM_4000)
80 		EISA_bus = 1;
81 #endif
82 	isa_slot_offset = 0xe3000000;
83 
84 	/* request I/O space for devices used on all i[345]86 PCs */
85 	for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
86 		request_resource(&ioport_resource, jazz_io_resources + i);
87 
88 	/* The RTC is outside the port address space */
89 
90 	_machine_restart = jazz_machine_restart;
91 
92 #ifdef CONFIG_VT
93 	screen_info = (struct screen_info) {
94 		0, 0,		/* orig-x, orig-y */
95 		0,		/* unused */
96 		0,		/* orig_video_page */
97 		0,		/* orig_video_mode */
98 		160,		/* orig_video_cols */
99 		0, 0, 0,	/* unused, ega_bx, unused */
100 		64,		/* orig_video_lines */
101 		0,		/* orig_video_isVGA */
102 		16		/* orig_video_points */
103 	};
104 #endif
105 
106 	add_preferred_console("ttyS", 0, "9600");
107 }
108 
109 #ifdef CONFIG_OLIVETTI_M700
110 #define UART_CLK  1843200
111 #else
112 /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
113    exactly which ones ... XXX */
114 #define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
115 #endif
116 
117 #define MEMPORT(_base, _irq)				\
118 	{						\
119 		.mapbase	= (_base),		\
120 		.membase	= (void *)(_base),	\
121 		.irq		= (_irq),		\
122 		.uartclk	= UART_CLK,		\
123 		.iotype		= UPIO_MEM,		\
124 		.flags		= UPF_BOOT_AUTOCONF,	\
125 	}
126 
127 static struct plat_serial8250_port jazz_serial_data[] = {
128 	MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
129 	MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
130 	{ },
131 };
132 
133 static struct platform_device jazz_serial8250_device = {
134 	.name			= "serial8250",
135 	.id			= PLAT8250_DEV_PLATFORM,
136 	.dev			= {
137 		.platform_data	= jazz_serial_data,
138 	},
139 };
140 
141 static struct resource jazz_esp_rsrc[] = {
142 	{
143 		.start = JAZZ_SCSI_BASE,
144 		.end   = JAZZ_SCSI_BASE + 31,
145 		.flags = IORESOURCE_MEM
146 	},
147 	{
148 		.start = JAZZ_SCSI_DMA,
149 		.end   = JAZZ_SCSI_DMA,
150 		.flags = IORESOURCE_MEM
151 	},
152 	{
153 		.start = JAZZ_SCSI_IRQ,
154 		.end   = JAZZ_SCSI_IRQ,
155 		.flags = IORESOURCE_IRQ
156 	}
157 };
158 
159 static struct platform_device jazz_esp_pdev = {
160 	.name           = "jazz_esp",
161 	.num_resources  = ARRAY_SIZE(jazz_esp_rsrc),
162 	.resource       = jazz_esp_rsrc
163 };
164 
165 static struct resource jazz_sonic_rsrc[] = {
166 	{
167 		.start = JAZZ_ETHERNET_BASE,
168 		.end   = JAZZ_ETHERNET_BASE + 0xff,
169 		.flags = IORESOURCE_MEM
170 	},
171 	{
172 		.start = JAZZ_ETHERNET_IRQ,
173 		.end   = JAZZ_ETHERNET_IRQ,
174 		.flags = IORESOURCE_IRQ
175 	}
176 };
177 
178 static struct platform_device jazz_sonic_pdev = {
179 	.name           = "jazzsonic",
180 	.num_resources  = ARRAY_SIZE(jazz_sonic_rsrc),
181 	.resource       = jazz_sonic_rsrc
182 };
183 
184 static struct resource jazz_cmos_rsrc[] = {
185 	{
186 		.start = 0x70,
187 		.end   = 0x71,
188 		.flags = IORESOURCE_IO
189 	},
190 	{
191 		.start = 8,
192 		.end   = 8,
193 		.flags = IORESOURCE_IRQ
194 	}
195 };
196 
197 static struct platform_device jazz_cmos_pdev = {
198 	.name           = "rtc_cmos",
199 	.num_resources  = ARRAY_SIZE(jazz_cmos_rsrc),
200 	.resource       = jazz_cmos_rsrc
201 };
202 
203 static struct platform_device pcspeaker_pdev = {
204 	.name           = "pcspkr",
205 	.id		= -1,
206 };
207 
208 static int __init jazz_setup_devinit(void)
209 {
210 	platform_device_register(&jazz_serial8250_device);
211 	platform_device_register(&jazz_esp_pdev);
212 	platform_device_register(&jazz_sonic_pdev);
213 	platform_device_register(&jazz_cmos_pdev);
214 	platform_device_register(&pcspeaker_pdev);
215 
216 	return 0;
217 }
218 
219 device_initcall(jazz_setup_devinit);
220