xref: /kernel/linux/linux-5.10/arch/mips/jazz/setup.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Setup pointers to hardware-dependent routines.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
58c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
68c2ecf20Sopenharmony_ci * for more details.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 1996, 1997, 1998, 2001, 07, 08 by Ralf Baechle
98c2ecf20Sopenharmony_ci * Copyright (C) 2001 MIPS Technologies, Inc.
108c2ecf20Sopenharmony_ci * Copyright (C) 2007 by Thomas Bogendoerfer
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci#include <linux/eisa.h>
138c2ecf20Sopenharmony_ci#include <linux/init.h>
148c2ecf20Sopenharmony_ci#include <linux/ioport.h>
158c2ecf20Sopenharmony_ci#include <linux/console.h>
168c2ecf20Sopenharmony_ci#include <linux/screen_info.h>
178c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
188c2ecf20Sopenharmony_ci#include <linux/serial_8250.h>
198c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h>
208c2ecf20Sopenharmony_ci#include <linux/pgtable.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include <asm/jazz.h>
238c2ecf20Sopenharmony_ci#include <asm/jazzdma.h>
248c2ecf20Sopenharmony_ci#include <asm/reboot.h>
258c2ecf20Sopenharmony_ci#include <asm/tlbmisc.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciextern asmlinkage void jazz_handle_int(void);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciextern void jazz_machine_restart(char *command);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistatic struct resource jazz_io_resources[] = {
328c2ecf20Sopenharmony_ci	{
338c2ecf20Sopenharmony_ci		.start	= 0x00,
348c2ecf20Sopenharmony_ci		.end	= 0x1f,
358c2ecf20Sopenharmony_ci		.name	= "dma1",
368c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
378c2ecf20Sopenharmony_ci	}, {
388c2ecf20Sopenharmony_ci		.start	= 0x40,
398c2ecf20Sopenharmony_ci		.end	= 0x5f,
408c2ecf20Sopenharmony_ci		.name	= "timer",
418c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
428c2ecf20Sopenharmony_ci	}, {
438c2ecf20Sopenharmony_ci		.start	= 0x80,
448c2ecf20Sopenharmony_ci		.end	= 0x8f,
458c2ecf20Sopenharmony_ci		.name	= "dma page reg",
468c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
478c2ecf20Sopenharmony_ci	}, {
488c2ecf20Sopenharmony_ci		.start	= 0xc0,
498c2ecf20Sopenharmony_ci		.end	= 0xdf,
508c2ecf20Sopenharmony_ci		.name	= "dma2",
518c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
528c2ecf20Sopenharmony_ci	}
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_civoid __init plat_mem_setup(void)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	int i;
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	/* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
608c2ecf20Sopenharmony_ci	add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
618c2ecf20Sopenharmony_ci	/* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
628c2ecf20Sopenharmony_ci	add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
638c2ecf20Sopenharmony_ci	/* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
648c2ecf20Sopenharmony_ci	add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	set_io_port_base(JAZZ_PORT_BASE);
678c2ecf20Sopenharmony_ci#ifdef CONFIG_EISA
688c2ecf20Sopenharmony_ci	EISA_bus = 1;
698c2ecf20Sopenharmony_ci#endif
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci	/* request I/O space for devices used on all i[345]86 PCs */
728c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
738c2ecf20Sopenharmony_ci		request_resource(&ioport_resource, jazz_io_resources + i);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	/* The RTC is outside the port address space */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	_machine_restart = jazz_machine_restart;
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#ifdef CONFIG_VT
808c2ecf20Sopenharmony_ci	screen_info = (struct screen_info) {
818c2ecf20Sopenharmony_ci		.orig_video_cols	= 160,
828c2ecf20Sopenharmony_ci		.orig_video_lines	= 64,
838c2ecf20Sopenharmony_ci		.orig_video_points	= 16,
848c2ecf20Sopenharmony_ci	};
858c2ecf20Sopenharmony_ci#endif
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	add_preferred_console("ttyS", 0, "9600");
888c2ecf20Sopenharmony_ci}
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#ifdef CONFIG_OLIVETTI_M700
918c2ecf20Sopenharmony_ci#define UART_CLK  1843200
928c2ecf20Sopenharmony_ci#else
938c2ecf20Sopenharmony_ci/* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
948c2ecf20Sopenharmony_ci   exactly which ones ... XXX */
958c2ecf20Sopenharmony_ci#define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
968c2ecf20Sopenharmony_ci#endif
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define MEMPORT(_base, _irq)				\
998c2ecf20Sopenharmony_ci	{						\
1008c2ecf20Sopenharmony_ci		.mapbase	= (_base),		\
1018c2ecf20Sopenharmony_ci		.membase	= (void *)(_base),	\
1028c2ecf20Sopenharmony_ci		.irq		= (_irq),		\
1038c2ecf20Sopenharmony_ci		.uartclk	= UART_CLK,		\
1048c2ecf20Sopenharmony_ci		.iotype		= UPIO_MEM,		\
1058c2ecf20Sopenharmony_ci		.flags		= UPF_BOOT_AUTOCONF,	\
1068c2ecf20Sopenharmony_ci	}
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_cistatic struct plat_serial8250_port jazz_serial_data[] = {
1098c2ecf20Sopenharmony_ci	MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
1108c2ecf20Sopenharmony_ci	MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
1118c2ecf20Sopenharmony_ci	{ },
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cistatic struct platform_device jazz_serial8250_device = {
1158c2ecf20Sopenharmony_ci	.name			= "serial8250",
1168c2ecf20Sopenharmony_ci	.id			= PLAT8250_DEV_PLATFORM,
1178c2ecf20Sopenharmony_ci	.dev			= {
1188c2ecf20Sopenharmony_ci		.platform_data	= jazz_serial_data,
1198c2ecf20Sopenharmony_ci	},
1208c2ecf20Sopenharmony_ci};
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_cistatic struct resource jazz_esp_rsrc[] = {
1238c2ecf20Sopenharmony_ci	{
1248c2ecf20Sopenharmony_ci		.start = JAZZ_SCSI_BASE,
1258c2ecf20Sopenharmony_ci		.end   = JAZZ_SCSI_BASE + 31,
1268c2ecf20Sopenharmony_ci		.flags = IORESOURCE_MEM
1278c2ecf20Sopenharmony_ci	},
1288c2ecf20Sopenharmony_ci	{
1298c2ecf20Sopenharmony_ci		.start = JAZZ_SCSI_DMA,
1308c2ecf20Sopenharmony_ci		.end   = JAZZ_SCSI_DMA,
1318c2ecf20Sopenharmony_ci		.flags = IORESOURCE_MEM
1328c2ecf20Sopenharmony_ci	},
1338c2ecf20Sopenharmony_ci	{
1348c2ecf20Sopenharmony_ci		.start = JAZZ_SCSI_IRQ,
1358c2ecf20Sopenharmony_ci		.end   = JAZZ_SCSI_IRQ,
1368c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IRQ
1378c2ecf20Sopenharmony_ci	}
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistatic u64 jazz_esp_dma_mask = DMA_BIT_MASK(32);
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cistatic struct platform_device jazz_esp_pdev = {
1438c2ecf20Sopenharmony_ci	.name		= "jazz_esp",
1448c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(jazz_esp_rsrc),
1458c2ecf20Sopenharmony_ci	.resource	= jazz_esp_rsrc,
1468c2ecf20Sopenharmony_ci	.dev = {
1478c2ecf20Sopenharmony_ci		.dma_mask	   = &jazz_esp_dma_mask,
1488c2ecf20Sopenharmony_ci		.coherent_dma_mask = DMA_BIT_MASK(32),
1498c2ecf20Sopenharmony_ci	}
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistatic struct resource jazz_sonic_rsrc[] = {
1538c2ecf20Sopenharmony_ci	{
1548c2ecf20Sopenharmony_ci		.start = JAZZ_ETHERNET_BASE,
1558c2ecf20Sopenharmony_ci		.end   = JAZZ_ETHERNET_BASE + 0xff,
1568c2ecf20Sopenharmony_ci		.flags = IORESOURCE_MEM
1578c2ecf20Sopenharmony_ci	},
1588c2ecf20Sopenharmony_ci	{
1598c2ecf20Sopenharmony_ci		.start = JAZZ_ETHERNET_IRQ,
1608c2ecf20Sopenharmony_ci		.end   = JAZZ_ETHERNET_IRQ,
1618c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IRQ
1628c2ecf20Sopenharmony_ci	}
1638c2ecf20Sopenharmony_ci};
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_cistatic u64 jazz_sonic_dma_mask = DMA_BIT_MASK(32);
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_cistatic struct platform_device jazz_sonic_pdev = {
1688c2ecf20Sopenharmony_ci	.name		= "jazzsonic",
1698c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(jazz_sonic_rsrc),
1708c2ecf20Sopenharmony_ci	.resource	= jazz_sonic_rsrc,
1718c2ecf20Sopenharmony_ci	.dev = {
1728c2ecf20Sopenharmony_ci		.dma_mask	   = &jazz_sonic_dma_mask,
1738c2ecf20Sopenharmony_ci		.coherent_dma_mask = DMA_BIT_MASK(32),
1748c2ecf20Sopenharmony_ci	}
1758c2ecf20Sopenharmony_ci};
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_cistatic struct resource jazz_cmos_rsrc[] = {
1788c2ecf20Sopenharmony_ci	{
1798c2ecf20Sopenharmony_ci		.start = 0x70,
1808c2ecf20Sopenharmony_ci		.end   = 0x71,
1818c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IO
1828c2ecf20Sopenharmony_ci	},
1838c2ecf20Sopenharmony_ci	{
1848c2ecf20Sopenharmony_ci		.start = 8,
1858c2ecf20Sopenharmony_ci		.end   = 8,
1868c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IRQ
1878c2ecf20Sopenharmony_ci	}
1888c2ecf20Sopenharmony_ci};
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_cistatic struct platform_device jazz_cmos_pdev = {
1918c2ecf20Sopenharmony_ci	.name		= "rtc_cmos",
1928c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(jazz_cmos_rsrc),
1938c2ecf20Sopenharmony_ci	.resource	= jazz_cmos_rsrc
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistatic struct platform_device pcspeaker_pdev = {
1978c2ecf20Sopenharmony_ci	.name		= "pcspkr",
1988c2ecf20Sopenharmony_ci	.id		= -1,
1998c2ecf20Sopenharmony_ci};
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_cistatic int __init jazz_setup_devinit(void)
2028c2ecf20Sopenharmony_ci{
2038c2ecf20Sopenharmony_ci	platform_device_register(&jazz_serial8250_device);
2048c2ecf20Sopenharmony_ci	platform_device_register(&jazz_esp_pdev);
2058c2ecf20Sopenharmony_ci	platform_device_register(&jazz_sonic_pdev);
2068c2ecf20Sopenharmony_ci	platform_device_register(&jazz_cmos_pdev);
2078c2ecf20Sopenharmony_ci	platform_device_register(&pcspeaker_pdev);
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	return 0;
2108c2ecf20Sopenharmony_ci}
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_cidevice_initcall(jazz_setup_devinit);
213