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