Linux Audio

Check our new training course

Loading...
v3.5.6
 
  1/*
  2 *  linux/arch/arm/mach-rpc/riscpc.c
  3 *
  4 *  Copyright (C) 1998-2001 Russell King
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License version 2 as
  8 * published by the Free Software Foundation.
  9 *
 10 *  Architecture specific fixups.
 11 */
 12#include <linux/kernel.h>
 13#include <linux/tty.h>
 14#include <linux/delay.h>
 15#include <linux/pm.h>
 16#include <linux/init.h>
 17#include <linux/sched.h>
 18#include <linux/device.h>
 19#include <linux/serial_8250.h>
 20#include <linux/ata_platform.h>
 21#include <linux/io.h>
 22#include <linux/i2c.h>
 
 23
 24#include <asm/elf.h>
 25#include <asm/mach-types.h>
 26#include <mach/hardware.h>
 27#include <asm/hardware/iomd.h>
 28#include <asm/page.h>
 29#include <asm/domain.h>
 30#include <asm/setup.h>
 31#include <asm/system_misc.h>
 32
 33#include <asm/mach/map.h>
 34#include <asm/mach/arch.h>
 35#include <asm/mach/time.h>
 36
 37extern void rpc_init_irq(void);
 38
 39unsigned int vram_size;
 40unsigned int memc_ctrl_reg;
 41unsigned int number_mfm_drives;
 42
 43static int __init parse_tag_acorn(const struct tag *tag)
 44{
 45	memc_ctrl_reg = tag->u.acorn.memc_control_reg;
 46	number_mfm_drives = tag->u.acorn.adfsdrives;
 47
 48	switch (tag->u.acorn.vram_pages) {
 49	case 512:
 50		vram_size += PAGE_SIZE * 256;
 
 51	case 256:
 52		vram_size += PAGE_SIZE * 256;
 53	default:
 54		break;
 55	}
 56#if 0
 57	if (vram_size) {
 58		desc->video_start = 0x02000000;
 59		desc->video_end   = 0x02000000 + vram_size;
 60	}
 61#endif
 62	return 0;
 63}
 64
 65__tagtable(ATAG_ACORN, parse_tag_acorn);
 66
 67static struct map_desc rpc_io_desc[] __initdata = {
 68 	{	/* VRAM		*/
 69		.virtual	=  SCREEN_BASE,
 70		.pfn		= __phys_to_pfn(SCREEN_START),
 71		.length		= 	2*1048576,
 72		.type		= MT_DEVICE
 73	}, {	/* IO space	*/
 74		.virtual	=  (u32)IO_BASE,
 75		.pfn		= __phys_to_pfn(IO_START),
 76		.length		= 	IO_SIZE	 ,
 77		.type		= MT_DEVICE
 78	}, {	/* EASI space	*/
 79		.virtual	= (unsigned long)EASI_BASE,
 80		.pfn		= __phys_to_pfn(EASI_START),
 81		.length		= EASI_SIZE,
 82		.type		= MT_DEVICE
 83	}
 84};
 85
 86static void __init rpc_map_io(void)
 87{
 88	iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
 89
 90	/*
 91	 * Turn off floppy.
 92	 */
 93	writeb(0xc, PCIO_BASE + (0x3f2 << 2));
 94
 95	/*
 96	 * RiscPC can't handle half-word loads and stores
 97	 */
 98	elf_hwcap &= ~HWCAP_HALF;
 99}
100
101static struct resource acornfb_resources[] = {
102	/* VIDC */
103	DEFINE_RES_MEM(0x03400000, 0x00200000),
104	DEFINE_RES_IRQ(IRQ_VSYNCPULSE),
105};
106
107static struct platform_device acornfb_device = {
108	.name			= "acornfb",
109	.id			= -1,
110	.dev			= {
111		.coherent_dma_mask = 0xffffffff,
112	},
113	.num_resources		= ARRAY_SIZE(acornfb_resources),
114	.resource		= acornfb_resources,
115};
116
117static struct resource iomd_resources[] = {
118	DEFINE_RES_MEM(0x03200000, 0x10000),
119};
120
121static struct platform_device iomd_device = {
122	.name			= "iomd",
123	.id			= -1,
124	.num_resources		= ARRAY_SIZE(iomd_resources),
125	.resource		= iomd_resources,
126};
127
128static struct resource iomd_kart_resources[] = {
129	DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
130	DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
131};
132
133static struct platform_device kbd_device = {
134	.name			= "kart",
135	.id			= -1,
136	.dev			= {
137		.parent 	= &iomd_device.dev,
138	},
139	.num_resources		= ARRAY_SIZE(iomd_kart_resources),
140	.resource		= iomd_kart_resources,
141};
142
143static struct plat_serial8250_port serial_platform_data[] = {
144	{
145		.mapbase	= 0x03010fe0,
146		.irq		= IRQ_SERIALPORT,
147		.uartclk	= 1843200,
148		.regshift	= 2,
149		.iotype		= UPIO_MEM,
150		.flags		= UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
151	},
152	{ },
153};
154
155static struct platform_device serial_device = {
156	.name			= "serial8250",
157	.id			= PLAT8250_DEV_PLATFORM,
158	.dev			= {
159		.platform_data	= serial_platform_data,
160	},
161};
162
163static struct pata_platform_info pata_platform_data = {
164	.ioport_shift		= 2,
165};
166
167static struct resource pata_resources[] = {
168	DEFINE_RES_MEM(0x030107c0, 0x20),
169	DEFINE_RES_MEM(0x03010fd8, 0x04),
170	DEFINE_RES_IRQ(IRQ_HARDDISK),
171};
172
173static struct platform_device pata_device = {
174	.name			= "pata_platform",
175	.id			= -1,
176	.num_resources		= ARRAY_SIZE(pata_resources),
177	.resource		= pata_resources,
178	.dev			= {
179		.platform_data	= &pata_platform_data,
180		.coherent_dma_mask = ~0,	/* grumble */
181	},
182};
183
184static struct platform_device *devs[] __initdata = {
185	&iomd_device,
186	&kbd_device,
187	&serial_device,
188	&acornfb_device,
189	&pata_device,
190};
191
192static struct i2c_board_info i2c_rtc = {
193	I2C_BOARD_INFO("pcf8583", 0x50)
194};
195
196static int __init rpc_init(void)
197{
198	i2c_register_board_info(0, &i2c_rtc, 1);
199	return platform_add_devices(devs, ARRAY_SIZE(devs));
200}
201
202arch_initcall(rpc_init);
203
204static void rpc_restart(char mode, const char *cmd)
205{
206	iomd_writeb(0, IOMD_ROMCR0);
207
208	/*
209	 * Jump into the ROM
210	 */
211	soft_restart(0);
212}
213
214extern struct sys_timer ioc_timer;
215
216MACHINE_START(RISCPC, "Acorn-RiscPC")
217	/* Maintainer: Russell King */
218	.atag_offset	= 0x100,
219	.reserve_lp0	= 1,
220	.reserve_lp1	= 1,
221	.map_io		= rpc_map_io,
222	.init_irq	= rpc_init_irq,
223	.timer		= &ioc_timer,
224	.restart	= rpc_restart,
225MACHINE_END
v5.9
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 *  linux/arch/arm/mach-rpc/riscpc.c
  4 *
  5 *  Copyright (C) 1998-2001 Russell King
  6 *
 
 
 
 
  7 *  Architecture specific fixups.
  8 */
  9#include <linux/kernel.h>
 10#include <linux/tty.h>
 11#include <linux/delay.h>
 12#include <linux/pm.h>
 13#include <linux/init.h>
 14#include <linux/sched.h>
 15#include <linux/device.h>
 16#include <linux/serial_8250.h>
 17#include <linux/ata_platform.h>
 18#include <linux/io.h>
 19#include <linux/i2c.h>
 20#include <linux/reboot.h>
 21
 22#include <asm/elf.h>
 23#include <asm/mach-types.h>
 24#include <mach/hardware.h>
 25#include <asm/hardware/iomd.h>
 26#include <asm/page.h>
 27#include <asm/domain.h>
 28#include <asm/setup.h>
 29#include <asm/system_misc.h>
 30
 31#include <asm/mach/map.h>
 32#include <asm/mach/arch.h>
 33#include <asm/mach/time.h>
 34
 35extern void rpc_init_irq(void);
 36
 37unsigned int vram_size;
 38unsigned int memc_ctrl_reg;
 39unsigned int number_mfm_drives;
 40
 41static int __init parse_tag_acorn(const struct tag *tag)
 42{
 43	memc_ctrl_reg = tag->u.acorn.memc_control_reg;
 44	number_mfm_drives = tag->u.acorn.adfsdrives;
 45
 46	switch (tag->u.acorn.vram_pages) {
 47	case 512:
 48		vram_size += PAGE_SIZE * 256;
 49		fallthrough;	/* ??? */
 50	case 256:
 51		vram_size += PAGE_SIZE * 256;
 52	default:
 53		break;
 54	}
 55#if 0
 56	if (vram_size) {
 57		desc->video_start = 0x02000000;
 58		desc->video_end   = 0x02000000 + vram_size;
 59	}
 60#endif
 61	return 0;
 62}
 63
 64__tagtable(ATAG_ACORN, parse_tag_acorn);
 65
 66static struct map_desc rpc_io_desc[] __initdata = {
 67 	{	/* VRAM		*/
 68		.virtual	=  SCREEN_BASE,
 69		.pfn		= __phys_to_pfn(SCREEN_START),
 70		.length		= 	2*1048576,
 71		.type		= MT_DEVICE
 72	}, {	/* IO space	*/
 73		.virtual	=  (u32)IO_BASE,
 74		.pfn		= __phys_to_pfn(IO_START),
 75		.length		= 	IO_SIZE	 ,
 76		.type		= MT_DEVICE
 77	}, {	/* EASI space	*/
 78		.virtual	= (unsigned long)EASI_BASE,
 79		.pfn		= __phys_to_pfn(EASI_START),
 80		.length		= EASI_SIZE,
 81		.type		= MT_DEVICE
 82	}
 83};
 84
 85static void __init rpc_map_io(void)
 86{
 87	iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
 88
 89	/*
 90	 * Turn off floppy.
 91	 */
 92	writeb(0xc, PCIO_BASE + (0x3f2 << 2));
 93
 94	/*
 95	 * RiscPC can't handle half-word loads and stores
 96	 */
 97	elf_hwcap &= ~HWCAP_HALF;
 98}
 99
100static struct resource acornfb_resources[] = {
101	/* VIDC */
102	DEFINE_RES_MEM(0x03400000, 0x00200000),
103	DEFINE_RES_IRQ(IRQ_VSYNCPULSE),
104};
105
106static struct platform_device acornfb_device = {
107	.name			= "acornfb",
108	.id			= -1,
109	.dev			= {
110		.coherent_dma_mask = 0xffffffff,
111	},
112	.num_resources		= ARRAY_SIZE(acornfb_resources),
113	.resource		= acornfb_resources,
114};
115
116static struct resource iomd_resources[] = {
117	DEFINE_RES_MEM(0x03200000, 0x10000),
118};
119
120static struct platform_device iomd_device = {
121	.name			= "iomd",
122	.id			= -1,
123	.num_resources		= ARRAY_SIZE(iomd_resources),
124	.resource		= iomd_resources,
125};
126
127static struct resource iomd_kart_resources[] = {
128	DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
129	DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
130};
131
132static struct platform_device kbd_device = {
133	.name			= "kart",
134	.id			= -1,
135	.dev			= {
136		.parent 	= &iomd_device.dev,
137	},
138	.num_resources		= ARRAY_SIZE(iomd_kart_resources),
139	.resource		= iomd_kart_resources,
140};
141
142static struct plat_serial8250_port serial_platform_data[] = {
143	{
144		.mapbase	= 0x03010fe0,
145		.irq		= IRQ_SERIALPORT,
146		.uartclk	= 1843200,
147		.regshift	= 2,
148		.iotype		= UPIO_MEM,
149		.flags		= UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
150	},
151	{ },
152};
153
154static struct platform_device serial_device = {
155	.name			= "serial8250",
156	.id			= PLAT8250_DEV_PLATFORM,
157	.dev			= {
158		.platform_data	= serial_platform_data,
159	},
160};
161
162static struct pata_platform_info pata_platform_data = {
163	.ioport_shift		= 2,
164};
165
166static struct resource pata_resources[] = {
167	DEFINE_RES_MEM(0x030107c0, 0x20),
168	DEFINE_RES_MEM(0x03010fd8, 0x04),
169	DEFINE_RES_IRQ(IRQ_HARDDISK),
170};
171
172static struct platform_device pata_device = {
173	.name			= "pata_platform",
174	.id			= -1,
175	.num_resources		= ARRAY_SIZE(pata_resources),
176	.resource		= pata_resources,
177	.dev			= {
178		.platform_data	= &pata_platform_data,
179		.coherent_dma_mask = ~0,	/* grumble */
180	},
181};
182
183static struct platform_device *devs[] __initdata = {
184	&iomd_device,
185	&kbd_device,
186	&serial_device,
187	&acornfb_device,
188	&pata_device,
189};
190
191static struct i2c_board_info i2c_rtc = {
192	I2C_BOARD_INFO("pcf8583", 0x50)
193};
194
195static int __init rpc_init(void)
196{
197	i2c_register_board_info(0, &i2c_rtc, 1);
198	return platform_add_devices(devs, ARRAY_SIZE(devs));
199}
200
201arch_initcall(rpc_init);
202
203static void rpc_restart(enum reboot_mode mode, const char *cmd)
204{
205	iomd_writeb(0, IOMD_ROMCR0);
206
207	/*
208	 * Jump into the ROM
209	 */
210	soft_restart(0);
211}
212
213void ioc_timer_init(void);
214
215MACHINE_START(RISCPC, "Acorn-RiscPC")
216	/* Maintainer: Russell King */
217	.atag_offset	= 0x100,
218	.reserve_lp0	= 1,
219	.reserve_lp1	= 1,
220	.map_io		= rpc_map_io,
221	.init_irq	= rpc_init_irq,
222	.init_time	= ioc_timer_init,
223	.restart	= rpc_restart,
224MACHINE_END