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
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Common CPM GPIO wrapper for the CPM GPIO ports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Author: Christophe Leroy <christophe.leroy@c-s.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright 2017 CS Systemes d'Information.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/cpm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifdef CONFIG_8xx_GPIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/cpm1.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static int cpm_gpio_probe(struct platform_device *ofdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	struct device *dev = &ofdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	int (*gp_add)(struct device *dev) = of_device_get_match_data(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	if (!gp_add)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	return gp_add(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static const struct of_device_id cpm_gpio_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #ifdef CONFIG_8xx_GPIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		.compatible = "fsl,cpm1-pario-bank-a",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		.data = cpm1_gpiochip_add16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		.compatible = "fsl,cpm1-pario-bank-b",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		.data = cpm1_gpiochip_add32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		.compatible = "fsl,cpm1-pario-bank-c",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		.data = cpm1_gpiochip_add16,
^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) 		.compatible = "fsl,cpm1-pario-bank-d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		.data = cpm1_gpiochip_add16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	/* Port E uses CPM2 layout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		.compatible = "fsl,cpm1-pario-bank-e",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		.data = cpm2_gpiochip_add32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		.compatible = "fsl,cpm2-pario-bank",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		.data = cpm2_gpiochip_add32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) MODULE_DEVICE_TABLE(of, cpm_gpio_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static struct platform_driver cpm_gpio_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	.probe		= cpm_gpio_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	.driver		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 		.name	= "cpm-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 		.of_match_table	= cpm_gpio_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static int __init cpm_gpio_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	return platform_driver_register(&cpm_gpio_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) arch_initcall(cpm_gpio_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) MODULE_AUTHOR("Christophe Leroy <christophe.leroy@c-s.fr>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) MODULE_DESCRIPTION("Driver for CPM GPIO");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) MODULE_ALIAS("platform:cpm-gpio");