Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *  linux/arch/arm/mach-footbridge/isa.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  Copyright (C) 2004 Russell King.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/serial_8250.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/hardware/dec21285.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) static struct resource rtc_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		.start	= 0x70,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 		.end	= 0x73,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		.flags	= IORESOURCE_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 		.start	= IRQ_ISA_RTC_ALARM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		.end	= IRQ_ISA_RTC_ALARM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		.flags	= IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static struct platform_device rtc_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	.name		= "rtc_cmos",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	.id		= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	.resource	= rtc_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	.num_resources	= ARRAY_SIZE(rtc_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static struct resource serial_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		.start	= 0x3f8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		.end	= 0x3ff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		.flags	= IORESOURCE_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		.start	= 0x2f8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		.end	= 0x2ff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 		.flags	= IORESOURCE_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) static struct plat_serial8250_port serial_platform_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		.iobase		= 0x3f8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		.irq		= IRQ_ISA_UART,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		.uartclk	= 1843200,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		.regshift	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		.iotype		= UPIO_PORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		.iobase		= 0x2f8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		.irq		= IRQ_ISA_UART2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 		.uartclk	= 1843200,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 		.regshift	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		.iotype		= UPIO_PORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static struct platform_device serial_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	.name			= "serial8250",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	.id			= PLAT8250_DEV_PLATFORM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	.dev			= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 		.platform_data	= serial_platform_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	.resource		= serial_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	.num_resources		= ARRAY_SIZE(serial_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static int __init footbridge_isa_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 	if (!footbridge_cfn_mode())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 	/* Personal server doesn't have RTC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 	if (!machine_is_personal_server()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 		isa_rtc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 		err = platform_device_register(&rtc_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 		if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 			printk(KERN_ERR "Unable to register RTC device: %d\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 	err = platform_device_register(&serial_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 	if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 		printk(KERN_ERR "Unable to register serial device: %d\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) arch_initcall(footbridge_isa_init);