1 // SPDX-License-Identifier: GPL-2.0
3 * Common CPM GPIO wrapper for the CPM GPIO ports
5 * Author: Christophe Leroy <christophe.leroy@c-s.fr>
7 * Copyright 2017 CS Systemes d'Information.
11 #include <linux/module.h>
13 #include <linux/platform_device.h>
16 #ifdef CONFIG_8xx_GPIO
20 static int cpm_gpio_probe(struct platform_device *ofdev)
22 struct device *dev = &ofdev->dev;
23 int (*gp_add)(struct device *dev) = of_device_get_match_data(dev);
31 static const struct of_device_id cpm_gpio_match[] = {
32 #ifdef CONFIG_8xx_GPIO
34 .compatible = "fsl,cpm1-pario-bank-a",
35 .data = cpm1_gpiochip_add16,
38 .compatible = "fsl,cpm1-pario-bank-b",
39 .data = cpm1_gpiochip_add32,
42 .compatible = "fsl,cpm1-pario-bank-c",
43 .data = cpm1_gpiochip_add16,
46 .compatible = "fsl,cpm1-pario-bank-d",
47 .data = cpm1_gpiochip_add16,
49 /* Port E uses CPM2 layout */
51 .compatible = "fsl,cpm1-pario-bank-e",
52 .data = cpm2_gpiochip_add32,
56 .compatible = "fsl,cpm2-pario-bank",
57 .data = cpm2_gpiochip_add32,
61 MODULE_DEVICE_TABLE(of, cpm_gpio_match);
63 static struct platform_driver cpm_gpio_driver = {
64 .probe = cpm_gpio_probe,
67 .of_match_table = cpm_gpio_match,
71 static int __init cpm_gpio_init(void)
73 return platform_driver_register(&cpm_gpio_driver);
75 arch_initcall(cpm_gpio_init);
77 MODULE_AUTHOR("Christophe Leroy <christophe.leroy@c-s.fr>");
78 MODULE_DESCRIPTION("Driver for CPM GPIO");
79 MODULE_LICENSE("GPL");
80 MODULE_ALIAS("platform:cpm-gpio");