xref: /openbmc/linux/arch/mips/jazz/setup.c (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Setup pointers to hardware-dependent routines.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * This file is subject to the terms and conditions of the GNU General Public
51da177e4SLinus Torvalds  * License.  See the file "COPYING" in the main directory of this archive
61da177e4SLinus Torvalds  * for more details.
71da177e4SLinus Torvalds  *
889ef3e85SRalf Baechle  * Copyright (C) 1996, 1997, 1998, 2001, 07, 08 by Ralf Baechle
91da177e4SLinus Torvalds  * Copyright (C) 2001 MIPS Technologies, Inc.
10ea202c63SThomas Bogendoerfer  * Copyright (C) 2007 by Thomas Bogendoerfer
111da177e4SLinus Torvalds  */
121da177e4SLinus Torvalds #include <linux/eisa.h>
131da177e4SLinus Torvalds #include <linux/init.h>
141da177e4SLinus Torvalds #include <linux/ioport.h>
151da177e4SLinus Torvalds #include <linux/console.h>
1606e80113SRalf Baechle #include <linux/screen_info.h>
17ea202c63SThomas Bogendoerfer #include <linux/platform_device.h>
18ea202c63SThomas Bogendoerfer #include <linux/serial_8250.h>
19b5d69129SThomas Bogendoerfer #include <linux/dma-mapping.h>
20*65fddcfcSMike Rapoport #include <linux/pgtable.h>
21fcdb27adSRalf Baechle 
221da177e4SLinus Torvalds #include <asm/jazz.h>
231da177e4SLinus Torvalds #include <asm/jazzdma.h>
241da177e4SLinus Torvalds #include <asm/reboot.h>
253d18c983SRalf Baechle #include <asm/tlbmisc.h>
261da177e4SLinus Torvalds 
271da177e4SLinus Torvalds extern asmlinkage void jazz_handle_int(void);
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds extern void jazz_machine_restart(char *command);
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds static struct resource jazz_io_resources[] = {
322cf69e76SRalf Baechle 	{
332cf69e76SRalf Baechle 		.start	= 0x00,
342cf69e76SRalf Baechle 		.end	= 0x1f,
352cf69e76SRalf Baechle 		.name	= "dma1",
36ead1505aSBjorn Helgaas 		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
372cf69e76SRalf Baechle 	}, {
382cf69e76SRalf Baechle 		.start	= 0x40,
392cf69e76SRalf Baechle 		.end	= 0x5f,
402cf69e76SRalf Baechle 		.name	= "timer",
41ead1505aSBjorn Helgaas 		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
422cf69e76SRalf Baechle 	}, {
432cf69e76SRalf Baechle 		.start	= 0x80,
442cf69e76SRalf Baechle 		.end	= 0x8f,
452cf69e76SRalf Baechle 		.name	= "dma page reg",
46ead1505aSBjorn Helgaas 		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
472cf69e76SRalf Baechle 	}, {
482cf69e76SRalf Baechle 		.start	= 0xc0,
492cf69e76SRalf Baechle 		.end	= 0xdf,
502cf69e76SRalf Baechle 		.name	= "dma2",
51ead1505aSBjorn Helgaas 		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
522cf69e76SRalf Baechle 	}
531da177e4SLinus Torvalds };
541da177e4SLinus Torvalds 
plat_mem_setup(void)552925aba4SRalf Baechle void __init plat_mem_setup(void)
561da177e4SLinus Torvalds {
571da177e4SLinus Torvalds 	int i;
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds 	/* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
601da177e4SLinus Torvalds 	add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
611da177e4SLinus Torvalds 	/* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
621da177e4SLinus Torvalds 	add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
631da177e4SLinus Torvalds 	/* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
641da177e4SLinus Torvalds 	add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds 	set_io_port_base(JAZZ_PORT_BASE);
671da177e4SLinus Torvalds #ifdef CONFIG_EISA
681da177e4SLinus Torvalds 	EISA_bus = 1;
691da177e4SLinus Torvalds #endif
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds 	/* request I/O space for devices used on all i[345]86 PCs */
721da177e4SLinus Torvalds 	for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
731da177e4SLinus Torvalds 		request_resource(&ioport_resource, jazz_io_resources + i);
741da177e4SLinus Torvalds 
751da177e4SLinus Torvalds 	/* The RTC is outside the port address space */
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds 	_machine_restart = jazz_machine_restart;
781da177e4SLinus Torvalds 
79ea202c63SThomas Bogendoerfer #ifdef CONFIG_VT
801da177e4SLinus Torvalds 	screen_info = (struct screen_info) {
81b20947aaSSebastian Andrzej Siewior 		.orig_video_cols	= 160,
82b20947aaSSebastian Andrzej Siewior 		.orig_video_lines	= 64,
83b20947aaSSebastian Andrzej Siewior 		.orig_video_points	= 16,
841da177e4SLinus Torvalds 	};
85ea202c63SThomas Bogendoerfer #endif
861da177e4SLinus Torvalds 
87ea202c63SThomas Bogendoerfer 	add_preferred_console("ttyS", 0, "9600");
881da177e4SLinus Torvalds }
89ea202c63SThomas Bogendoerfer 
90ea202c63SThomas Bogendoerfer #ifdef CONFIG_OLIVETTI_M700
91ea202c63SThomas Bogendoerfer #define UART_CLK  1843200
92ea202c63SThomas Bogendoerfer #else
93ea202c63SThomas Bogendoerfer /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
94ea202c63SThomas Bogendoerfer    exactly which ones ... XXX */
95ea202c63SThomas Bogendoerfer #define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
96ea202c63SThomas Bogendoerfer #endif
97ea202c63SThomas Bogendoerfer 
98ea202c63SThomas Bogendoerfer #define MEMPORT(_base, _irq)				\
99ea202c63SThomas Bogendoerfer 	{						\
100ea202c63SThomas Bogendoerfer 		.mapbase	= (_base),		\
101ea202c63SThomas Bogendoerfer 		.membase	= (void *)(_base),	\
102ea202c63SThomas Bogendoerfer 		.irq		= (_irq),		\
103ea202c63SThomas Bogendoerfer 		.uartclk	= UART_CLK,		\
104ea202c63SThomas Bogendoerfer 		.iotype		= UPIO_MEM,		\
105ea202c63SThomas Bogendoerfer 		.flags		= UPF_BOOT_AUTOCONF,	\
106ea202c63SThomas Bogendoerfer 	}
107ea202c63SThomas Bogendoerfer 
108ea202c63SThomas Bogendoerfer static struct plat_serial8250_port jazz_serial_data[] = {
109ea202c63SThomas Bogendoerfer 	MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
110ea202c63SThomas Bogendoerfer 	MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
111ea202c63SThomas Bogendoerfer 	{ },
112ea202c63SThomas Bogendoerfer };
113ea202c63SThomas Bogendoerfer 
114ea202c63SThomas Bogendoerfer static struct platform_device jazz_serial8250_device = {
115ea202c63SThomas Bogendoerfer 	.name			= "serial8250",
116ea202c63SThomas Bogendoerfer 	.id			= PLAT8250_DEV_PLATFORM,
117ea202c63SThomas Bogendoerfer 	.dev			= {
118ea202c63SThomas Bogendoerfer 		.platform_data	= jazz_serial_data,
119ea202c63SThomas Bogendoerfer 	},
120ea202c63SThomas Bogendoerfer };
121ea202c63SThomas Bogendoerfer 
122ea202c63SThomas Bogendoerfer static struct resource jazz_esp_rsrc[] = {
123ea202c63SThomas Bogendoerfer 	{
124ea202c63SThomas Bogendoerfer 		.start = JAZZ_SCSI_BASE,
125ea202c63SThomas Bogendoerfer 		.end   = JAZZ_SCSI_BASE + 31,
126ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_MEM
127ea202c63SThomas Bogendoerfer 	},
128ea202c63SThomas Bogendoerfer 	{
129ea202c63SThomas Bogendoerfer 		.start = JAZZ_SCSI_DMA,
130ea202c63SThomas Bogendoerfer 		.end   = JAZZ_SCSI_DMA,
131ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_MEM
132ea202c63SThomas Bogendoerfer 	},
133ea202c63SThomas Bogendoerfer 	{
134ea202c63SThomas Bogendoerfer 		.start = JAZZ_SCSI_IRQ,
135ea202c63SThomas Bogendoerfer 		.end   = JAZZ_SCSI_IRQ,
136ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_IRQ
137ea202c63SThomas Bogendoerfer 	}
138ea202c63SThomas Bogendoerfer };
139ea202c63SThomas Bogendoerfer 
140b5d69129SThomas Bogendoerfer static u64 jazz_esp_dma_mask = DMA_BIT_MASK(32);
141b5d69129SThomas Bogendoerfer 
142ea202c63SThomas Bogendoerfer static struct platform_device jazz_esp_pdev = {
143ea202c63SThomas Bogendoerfer 	.name		= "jazz_esp",
144ea202c63SThomas Bogendoerfer 	.num_resources	= ARRAY_SIZE(jazz_esp_rsrc),
145b5d69129SThomas Bogendoerfer 	.resource	= jazz_esp_rsrc,
146b5d69129SThomas Bogendoerfer 	.dev = {
147b5d69129SThomas Bogendoerfer 		.dma_mask	   = &jazz_esp_dma_mask,
148b5d69129SThomas Bogendoerfer 		.coherent_dma_mask = DMA_BIT_MASK(32),
149b5d69129SThomas Bogendoerfer 	}
150ea202c63SThomas Bogendoerfer };
151ea202c63SThomas Bogendoerfer 
152ea202c63SThomas Bogendoerfer static struct resource jazz_sonic_rsrc[] = {
153ea202c63SThomas Bogendoerfer 	{
154ea202c63SThomas Bogendoerfer 		.start = JAZZ_ETHERNET_BASE,
155ea202c63SThomas Bogendoerfer 		.end   = JAZZ_ETHERNET_BASE + 0xff,
156ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_MEM
157ea202c63SThomas Bogendoerfer 	},
158ea202c63SThomas Bogendoerfer 	{
159ea202c63SThomas Bogendoerfer 		.start = JAZZ_ETHERNET_IRQ,
160ea202c63SThomas Bogendoerfer 		.end   = JAZZ_ETHERNET_IRQ,
161ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_IRQ
162ea202c63SThomas Bogendoerfer 	}
163ea202c63SThomas Bogendoerfer };
164ea202c63SThomas Bogendoerfer 
165b5d69129SThomas Bogendoerfer static u64 jazz_sonic_dma_mask = DMA_BIT_MASK(32);
166b5d69129SThomas Bogendoerfer 
167ea202c63SThomas Bogendoerfer static struct platform_device jazz_sonic_pdev = {
168ea202c63SThomas Bogendoerfer 	.name		= "jazzsonic",
169ea202c63SThomas Bogendoerfer 	.num_resources	= ARRAY_SIZE(jazz_sonic_rsrc),
170b5d69129SThomas Bogendoerfer 	.resource	= jazz_sonic_rsrc,
171b5d69129SThomas Bogendoerfer 	.dev = {
172b5d69129SThomas Bogendoerfer 		.dma_mask	   = &jazz_sonic_dma_mask,
173b5d69129SThomas Bogendoerfer 		.coherent_dma_mask = DMA_BIT_MASK(32),
174b5d69129SThomas Bogendoerfer 	}
175ea202c63SThomas Bogendoerfer };
176ea202c63SThomas Bogendoerfer 
177ea202c63SThomas Bogendoerfer static struct resource jazz_cmos_rsrc[] = {
178ea202c63SThomas Bogendoerfer 	{
179ea202c63SThomas Bogendoerfer 		.start = 0x70,
180ea202c63SThomas Bogendoerfer 		.end   = 0x71,
181ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_IO
182ea202c63SThomas Bogendoerfer 	},
183ea202c63SThomas Bogendoerfer 	{
184ea202c63SThomas Bogendoerfer 		.start = 8,
185ea202c63SThomas Bogendoerfer 		.end   = 8,
186ea202c63SThomas Bogendoerfer 		.flags = IORESOURCE_IRQ
187ea202c63SThomas Bogendoerfer 	}
188ea202c63SThomas Bogendoerfer };
189ea202c63SThomas Bogendoerfer 
190ea202c63SThomas Bogendoerfer static struct platform_device jazz_cmos_pdev = {
191ea202c63SThomas Bogendoerfer 	.name		= "rtc_cmos",
192ea202c63SThomas Bogendoerfer 	.num_resources	= ARRAY_SIZE(jazz_cmos_rsrc),
193ea202c63SThomas Bogendoerfer 	.resource	= jazz_cmos_rsrc
194ea202c63SThomas Bogendoerfer };
195ea202c63SThomas Bogendoerfer 
19619388fb0SRalf Baechle static struct platform_device pcspeaker_pdev = {
19719388fb0SRalf Baechle 	.name		= "pcspkr",
19819388fb0SRalf Baechle 	.id		= -1,
19919388fb0SRalf Baechle };
20019388fb0SRalf Baechle 
jazz_setup_devinit(void)201ea202c63SThomas Bogendoerfer static int __init jazz_setup_devinit(void)
202ea202c63SThomas Bogendoerfer {
203ea202c63SThomas Bogendoerfer 	platform_device_register(&jazz_serial8250_device);
204ea202c63SThomas Bogendoerfer 	platform_device_register(&jazz_esp_pdev);
205ea202c63SThomas Bogendoerfer 	platform_device_register(&jazz_sonic_pdev);
206ea202c63SThomas Bogendoerfer 	platform_device_register(&jazz_cmos_pdev);
20719388fb0SRalf Baechle 	platform_device_register(&pcspeaker_pdev);
20819388fb0SRalf Baechle 
209ea202c63SThomas Bogendoerfer 	return 0;
210ea202c63SThomas Bogendoerfer }
211ea202c63SThomas Bogendoerfer 
212ea202c63SThomas Bogendoerfer device_initcall(jazz_setup_devinit);
213