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>
12 #include <linux/of_device.h>
15 #ifdef CONFIG_8xx_GPIO
19 static int cpm_gpio_probe(struct platform_device
*ofdev
)
21 struct device
*dev
= &ofdev
->dev
;
22 int (*gp_add
)(struct device
*dev
) = of_device_get_match_data(dev
);
30 static const struct of_device_id cpm_gpio_match
[] = {
31 #ifdef CONFIG_8xx_GPIO
33 .compatible
= "fsl,cpm1-pario-bank-a",
34 .data
= cpm1_gpiochip_add16
,
37 .compatible
= "fsl,cpm1-pario-bank-b",
38 .data
= cpm1_gpiochip_add32
,
41 .compatible
= "fsl,cpm1-pario-bank-c",
42 .data
= cpm1_gpiochip_add16
,
45 .compatible
= "fsl,cpm1-pario-bank-d",
46 .data
= cpm1_gpiochip_add16
,
48 /* Port E uses CPM2 layout */
50 .compatible
= "fsl,cpm1-pario-bank-e",
51 .data
= cpm2_gpiochip_add32
,
55 .compatible
= "fsl,cpm2-pario-bank",
56 .data
= cpm2_gpiochip_add32
,
60 MODULE_DEVICE_TABLE(of
, cpm_gpio_match
);
62 static struct platform_driver cpm_gpio_driver
= {
63 .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");