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)  * arch/arm/plat-iop/i2c.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Author: Nicolas Pitre <nico@cam.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2001 MontaVista Software, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright (C) 2004 Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/major.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/serial.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/tty.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/memory.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include "hardware.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include "iop3xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include "irqs.h"
^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)  * Each of the I2C busses have corresponding GPIO lines, and the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  * need to access these directly to drive the bus low at times.
^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) struct gpiod_lookup_table iop3xx_i2c0_gpio_lookup = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	.dev_id = "IOP3xx-I2C.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		GPIO_LOOKUP("gpio-iop", 7, "scl", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		GPIO_LOOKUP("gpio-iop", 6, "sda", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	},
^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) struct gpiod_lookup_table iop3xx_i2c1_gpio_lookup = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	.dev_id = "IOP3xx-I2C.1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		GPIO_LOOKUP("gpio-iop", 5, "scl", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		GPIO_LOOKUP("gpio-iop", 4, "sda", GPIO_ACTIVE_HIGH),
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) static struct resource iop3xx_i2c0_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		.start	= 0xfffff680,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		.end	= 0xfffff697,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		.flags	= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 		.start	= IRQ_IOP32X_I2C_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 		.end	= IRQ_IOP32X_I2C_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		.flags	= IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	},
^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) struct platform_device iop3xx_i2c0_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	.name		= "IOP3xx-I2C",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	.id		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	.num_resources	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	.resource	= iop3xx_i2c0_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static struct resource iop3xx_i2c1_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		.start	= 0xfffff6a0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 		.end	= 0xfffff6b7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 		.flags	= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 		.start	= IRQ_IOP32X_I2C_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 		.end	= IRQ_IOP32X_I2C_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 		.flags	= IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct platform_device iop3xx_i2c1_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 	.name		= "IOP3xx-I2C",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 	.id		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 	.num_resources	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 	.resource	= iop3xx_i2c1_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) };