summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2026-05-20 22:13:18 -0700
committerLinus Walleij <linusw@kernel.org>2026-07-10 21:04:18 +0200
commit62067bc0a083eb45b9f588745b3846cf366e2d35 (patch)
tree235fc810a0990ead0bda9c88f3259aa6b00ee8f8
parent4c870bbaba1b011375b1f551c205a8538bf77230 (diff)
sh: pfc: attach software node to the GPIO chip
With commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") gpiolib requires that firmware nodes from the GPIO references to match firmware node in gpiochip structure. Define a software node for the pfc gpiochip so that it can be referenced by boards using static device properties. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Linus Walleij <linusw@kernel.org>
-rw-r--r--arch/sh/include/cpu-common/cpu/pfc.h3
-rw-r--r--arch/sh/kernel/cpu/pfc.c20
2 files changed, 17 insertions, 6 deletions
diff --git a/arch/sh/include/cpu-common/cpu/pfc.h b/arch/sh/include/cpu-common/cpu/pfc.h
index 879d2c9da537..d57e38c05bdb 100644
--- a/arch/sh/include/cpu-common/cpu/pfc.h
+++ b/arch/sh/include/cpu-common/cpu/pfc.h
@@ -11,6 +11,9 @@
#include <linux/types.h>
struct resource;
+struct software_node;
+
+extern const struct software_node pfc_gpiochip_node;
int sh_pfc_register(const char *name,
struct resource *resource, u32 num_resources);
diff --git a/arch/sh/kernel/cpu/pfc.c b/arch/sh/kernel/cpu/pfc.c
index 062056ede88d..5a8d804d607b 100644
--- a/arch/sh/kernel/cpu/pfc.c
+++ b/arch/sh/kernel/cpu/pfc.c
@@ -5,21 +5,29 @@
* Copyright (C) 2012 Renesas Solutions Corp.
*/
+#include <linux/err.h>
#include <linux/init.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <cpu/pfc.h>
-static struct platform_device sh_pfc_device = {
- .id = -1,
+const struct software_node pfc_gpiochip_node = {
+ .name = "sh-pfc",
};
int __init sh_pfc_register(const char *name,
struct resource *resource, u32 num_resources)
{
- sh_pfc_device.name = name;
- sh_pfc_device.num_resources = num_resources;
- sh_pfc_device.resource = resource;
+ struct platform_device_info pdev_info = {
+ .name = name,
+ .id = PLATFORM_DEVID_NONE,
+ .res = resource,
+ .num_res = num_resources,
+ .swnode = &pfc_gpiochip_node,
+ };
+ struct platform_device *pdev;
- return platform_device_register(&sh_pfc_device);
+ pdev = platform_device_register_full(&pdev_info);
+ return PTR_ERR_OR_ZERO(pdev);
}