Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / powerpc / sysdev / cpm_gpio.c
blob40f57111e93e9927a87b43fd09eaa129d505ddfa
1 // SPDX-License-Identifier: GPL-2.0
2 /*
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.
9 */
11 #include <linux/module.h>
12 #include <linux/of.h>
13 #include <linux/platform_device.h>
15 #include <asm/cpm.h>
16 #ifdef CONFIG_8xx_GPIO
17 #include <asm/cpm1.h>
18 #endif
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);
25 if (!gp_add)
26 return -ENODEV;
28 return gp_add(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,
54 #endif
56 .compatible = "fsl,cpm2-pario-bank",
57 .data = cpm2_gpiochip_add32,
59 {},
61 MODULE_DEVICE_TABLE(of, cpm_gpio_match);
63 static struct platform_driver cpm_gpio_driver = {
64 .probe = cpm_gpio_probe,
65 .driver = {
66 .name = "cpm-gpio",
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");