sh: pfc: attach software node to the GPIO chip

With commit e5d527be7e ("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>
This commit is contained in:
Dmitry Torokhov
2026-05-20 22:13:18 -07:00
committed by Linus Walleij
parent 4c870bbaba
commit 62067bc0a0
2 changed files with 17 additions and 6 deletions

View File

@@ -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);

View File

@@ -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);
}