0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/module.h>
0012 #include <linux/of_device.h>
0013
0014 #include <asm/cpm.h>
0015 #ifdef CONFIG_8xx_GPIO
0016 #include <asm/cpm1.h>
0017 #endif
0018
0019 static int cpm_gpio_probe(struct platform_device *ofdev)
0020 {
0021 struct device *dev = &ofdev->dev;
0022 int (*gp_add)(struct device *dev) = of_device_get_match_data(dev);
0023
0024 if (!gp_add)
0025 return -ENODEV;
0026
0027 return gp_add(dev);
0028 }
0029
0030 static const struct of_device_id cpm_gpio_match[] = {
0031 #ifdef CONFIG_8xx_GPIO
0032 {
0033 .compatible = "fsl,cpm1-pario-bank-a",
0034 .data = cpm1_gpiochip_add16,
0035 },
0036 {
0037 .compatible = "fsl,cpm1-pario-bank-b",
0038 .data = cpm1_gpiochip_add32,
0039 },
0040 {
0041 .compatible = "fsl,cpm1-pario-bank-c",
0042 .data = cpm1_gpiochip_add16,
0043 },
0044 {
0045 .compatible = "fsl,cpm1-pario-bank-d",
0046 .data = cpm1_gpiochip_add16,
0047 },
0048
0049 {
0050 .compatible = "fsl,cpm1-pario-bank-e",
0051 .data = cpm2_gpiochip_add32,
0052 },
0053 #endif
0054 {
0055 .compatible = "fsl,cpm2-pario-bank",
0056 .data = cpm2_gpiochip_add32,
0057 },
0058 {},
0059 };
0060 MODULE_DEVICE_TABLE(of, cpm_gpio_match);
0061
0062 static struct platform_driver cpm_gpio_driver = {
0063 .probe = cpm_gpio_probe,
0064 .driver = {
0065 .name = "cpm-gpio",
0066 .of_match_table = cpm_gpio_match,
0067 },
0068 };
0069
0070 static int __init cpm_gpio_init(void)
0071 {
0072 return platform_driver_register(&cpm_gpio_driver);
0073 }
0074 arch_initcall(cpm_gpio_init);
0075
0076 MODULE_AUTHOR("Christophe Leroy <christophe.leroy@c-s.fr>");
0077 MODULE_DESCRIPTION("Driver for CPM GPIO");
0078 MODULE_LICENSE("GPL");
0079 MODULE_ALIAS("platform:cpm-gpio");