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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * License.  See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <bcm63xx_cpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) static struct resource uart0_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 		/* start & end filled at runtime */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		.flags		= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		/* start filled at runtime */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 		.flags		= IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static struct resource uart1_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		/* start & end filled at runtime */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		.flags		= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		/* start filled at runtime */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		.flags		= IORESOURCE_IRQ,
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static struct platform_device bcm63xx_uart_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		.name		= "bcm63xx_uart",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		.id		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		.num_resources	= ARRAY_SIZE(uart0_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		.resource	= uart0_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		.name		= "bcm63xx_uart",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		.id		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		.num_resources	= ARRAY_SIZE(uart1_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		.resource	= uart1_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int __init bcm63xx_uart_register(unsigned int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	if (id >= ARRAY_SIZE(bcm63xx_uart_devices))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	if (id == 1 && (!BCMCPU_IS_3368() && !BCMCPU_IS_6358() &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		!BCMCPU_IS_6368()))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	if (id == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 		uart0_resources[0].end = uart0_resources[0].start +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 			RSET_UART_SIZE - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 		uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
^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) 	if (id == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 		uart1_resources[0].end = uart1_resources[0].start +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 			RSET_UART_SIZE - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 		uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	return platform_device_register(&bcm63xx_uart_devices[id]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }