* [PATCH RFT v2 1/6] gpio: mmio: drop the big-endian platform device variant
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
@ 2025-07-01 11:49 ` Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 2/6] gpio: mmio: get chip label and GPIO base from device properties Bartosz Golaszewski
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01 11:49 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen,
Janusz Krzysztofik, Tony Lindgren, Russell King,
Krzysztof Kozlowski, Alim Akhtar
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
There are no more users of the "basic-mmio-gpio-be" platform device ID
in the kernel. We can safely drop it.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-mmio.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index 08466e123818e958755fe6e7baf5a4e8b8d863c1..ffe6b6f6cc9b1e9341e1c42cf8fee917e0147bf3 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -831,9 +831,6 @@ static const struct platform_device_id bgpio_id_table[] = {
{
.name = "basic-mmio-gpio",
.driver_data = 0,
- }, {
- .name = "basic-mmio-gpio-be",
- .driver_data = BGPIOF_BIG_ENDIAN,
},
{ }
};
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH RFT v2 2/6] gpio: mmio: get chip label and GPIO base from device properties
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 1/6] gpio: mmio: drop the big-endian platform device variant Bartosz Golaszewski
@ 2025-07-01 11:49 ` Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 3/6] mfd: vexpress-sysreg: set-up software nodes for gpio-mmio Bartosz Golaszewski
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01 11:49 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen,
Janusz Krzysztofik, Tony Lindgren, Russell King,
Krzysztof Kozlowski, Alim Akhtar
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Ahead of removing struct bgpio_pdata support from the gpio-mmio generic
module, let's add support for getting the relevant values from generic
device properties. "label" is a semi-standardized property in some GPIO
drivers so let's go with it. There's no standard "base" property, so
let's use the name "gpio-mmio,base" to tie it to this driver
specifically. The number of GPIOs will be retrieved using
gpiochip_get_ngpios() so there's no need to look it up in the software
node.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-mmio.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index ffe6b6f6cc9b1e9341e1c42cf8fee917e0147bf3..f66137caa245b14e6e8dbd043243224bc47c9609 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -737,6 +737,9 @@ MODULE_DEVICE_TABLE(of, bgpio_of_match);
static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *flags)
{
struct bgpio_pdata *pdata;
+ const char *label;
+ unsigned int base;
+ int ret;
if (!dev_fwnode(dev))
return NULL;
@@ -753,6 +756,18 @@ static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *fla
if (device_property_read_bool(dev, "no-output"))
*flags |= BGPIOF_NO_OUTPUT;
+ ret = device_property_read_string(dev, "label", &label);
+ if (!ret)
+ pdata->label = label;
+
+ /*
+ * This property *must not* be used in device-tree sources, it's only
+ * meant to be passed to the driver from board files and MFD core.
+ */
+ ret = device_property_read_u32(dev, "gpio-mmio,base", &base);
+ if (!ret && base <= INT_MAX)
+ pdata->base = base;
+
return pdata;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH RFT v2 3/6] mfd: vexpress-sysreg: set-up software nodes for gpio-mmio
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 1/6] gpio: mmio: drop the big-endian platform device variant Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 2/6] gpio: mmio: get chip label and GPIO base from device properties Bartosz Golaszewski
@ 2025-07-01 11:49 ` Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 4/6] ARM: omap1: ams-delta: use generic device properties " Bartosz Golaszewski
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01 11:49 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen,
Janusz Krzysztofik, Tony Lindgren, Russell King,
Krzysztof Kozlowski, Alim Akhtar
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Replace struct bgpio_pdata - that we plan to remove - with software
nodes containing properties encoding the same values thatr can now be
parsed by gpio-mmio.
Acked-by: Lee Jones <lee@kernel.org>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/mfd/vexpress-sysreg.c | 46 ++++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index ef03d6cec9ff6927668d051ca459eb1d8ff7269e..fc2daffc4352cca763cefbf6e17bdd5242290198 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/stat.h>
@@ -37,22 +38,34 @@
/* The sysreg block is just a random collection of various functions... */
-static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = {
- .label = "sys_led",
- .base = -1,
- .ngpio = 8,
+static const struct property_entry vexpress_sysreg_sys_led_props[] = {
+ PROPERTY_ENTRY_STRING("label", "sys_led"),
+ PROPERTY_ENTRY_U32("ngpios", 8),
+ { }
};
-static struct bgpio_pdata vexpress_sysreg_sys_mci_pdata = {
- .label = "sys_mci",
- .base = -1,
- .ngpio = 2,
+static const struct software_node vexpress_sysreg_sys_led_swnode = {
+ .properties = vexpress_sysreg_sys_led_props,
};
-static struct bgpio_pdata vexpress_sysreg_sys_flash_pdata = {
- .label = "sys_flash",
- .base = -1,
- .ngpio = 1,
+static const struct property_entry vexpress_sysreg_sys_mci_props[] = {
+ PROPERTY_ENTRY_STRING("label", "sys_mci"),
+ PROPERTY_ENTRY_U32("ngpios", 2),
+ { }
+};
+
+static const struct software_node vexpress_sysreg_sys_mci_swnode = {
+ .properties = vexpress_sysreg_sys_mci_props,
+};
+
+static const struct property_entry vexpress_sysreg_sys_flash_props[] = {
+ PROPERTY_ENTRY_STRING("label", "sys_flash"),
+ PROPERTY_ENTRY_U32("ngpios", 1),
+ { }
+};
+
+static const struct software_node vexpress_sysreg_sys_flash_swnode = {
+ .properties = vexpress_sysreg_sys_flash_props,
};
static struct mfd_cell vexpress_sysreg_cells[] = {
@@ -61,22 +74,19 @@ static struct mfd_cell vexpress_sysreg_cells[] = {
.of_compatible = "arm,vexpress-sysreg,sys_led",
.num_resources = 1,
.resources = &DEFINE_RES_MEM_NAMED(SYS_LED, 0x4, "dat"),
- .platform_data = &vexpress_sysreg_sys_led_pdata,
- .pdata_size = sizeof(vexpress_sysreg_sys_led_pdata),
+ .swnode = &vexpress_sysreg_sys_led_swnode,
}, {
.name = "basic-mmio-gpio",
.of_compatible = "arm,vexpress-sysreg,sys_mci",
.num_resources = 1,
.resources = &DEFINE_RES_MEM_NAMED(SYS_MCI, 0x4, "dat"),
- .platform_data = &vexpress_sysreg_sys_mci_pdata,
- .pdata_size = sizeof(vexpress_sysreg_sys_mci_pdata),
+ .swnode = &vexpress_sysreg_sys_mci_swnode,
}, {
.name = "basic-mmio-gpio",
.of_compatible = "arm,vexpress-sysreg,sys_flash",
.num_resources = 1,
.resources = &DEFINE_RES_MEM_NAMED(SYS_FLASH, 0x4, "dat"),
- .platform_data = &vexpress_sysreg_sys_flash_pdata,
- .pdata_size = sizeof(vexpress_sysreg_sys_flash_pdata),
+ .swnode = &vexpress_sysreg_sys_flash_swnode,
}, {
.name = "vexpress-syscfg",
.num_resources = 1,
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH RFT v2 4/6] ARM: omap1: ams-delta: use generic device properties for gpio-mmio
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
` (2 preceding siblings ...)
2025-07-01 11:49 ` [PATCH RFT v2 3/6] mfd: vexpress-sysreg: set-up software nodes for gpio-mmio Bartosz Golaszewski
@ 2025-07-01 11:49 ` Bartosz Golaszewski
2025-07-02 17:31 ` Janusz Krzysztofik
2025-07-01 11:49 ` [PATCH RFT v2 5/6] ARM: s3c: crag6410: " Bartosz Golaszewski
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01 11:49 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen,
Janusz Krzysztofik, Tony Lindgren, Russell King,
Krzysztof Kozlowski, Alim Akhtar
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The two latch GPIO devices in ams-delta are registered with struct
bgpio_pdata passed as platform_data to the gpio-mmio driver. We want to
remove the bgpio_pdata from the kernel and the gpio-mmio driver is now
also able to get the relevant values from the software node. Set up
device properties and switch to using platform_device_info to register
the devices as platform_add_devices() doesn't allow us to pass device
properties to the driver model.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/arm/mach-omap1/board-ams-delta.c | 42 +++++++++++++++++------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 0daf6c5b5c1cbcfd5bd15203cad119d39aa95f19..16392720296cd224732450c85419c35bbab506f6 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -19,6 +19,7 @@
#include <linux/mtd/nand-gpio.h>
#include <linux/mtd/partitions.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
@@ -175,20 +176,18 @@ static struct resource latch1_resources[] = {
#define LATCH1_LABEL "latch1"
-static struct bgpio_pdata latch1_pdata = {
- .label = LATCH1_LABEL,
- .base = -1,
- .ngpio = LATCH1_NGPIO,
+static const struct property_entry latch1_gpio_props[] = {
+ PROPERTY_ENTRY_STRING("label", LATCH1_LABEL),
+ PROPERTY_ENTRY_U32("ngpios", LATCH1_NGPIO),
+ { }
};
-static struct platform_device latch1_gpio_device = {
+static const struct platform_device_info latch1_gpio_devinfo = {
.name = "basic-mmio-gpio",
.id = 0,
- .resource = latch1_resources,
- .num_resources = ARRAY_SIZE(latch1_resources),
- .dev = {
- .platform_data = &latch1_pdata,
- },
+ .res = latch1_resources,
+ .num_res = ARRAY_SIZE(latch1_resources),
+ .properties = latch1_gpio_props,
};
#define LATCH1_PIN_LED_CAMERA 0
@@ -213,20 +212,18 @@ static struct resource latch2_resources[] = {
#define LATCH2_LABEL "latch2"
-static struct bgpio_pdata latch2_pdata = {
- .label = LATCH2_LABEL,
- .base = -1,
- .ngpio = LATCH2_NGPIO,
+static const struct property_entry latch2_gpio_props[] = {
+ PROPERTY_ENTRY_STRING("label", LATCH2_LABEL),
+ PROPERTY_ENTRY_U32("ngpios", LATCH2_NGPIO),
+ { }
};
-static struct platform_device latch2_gpio_device = {
+static struct platform_device_info latch2_gpio_devinfo = {
.name = "basic-mmio-gpio",
.id = 1,
- .resource = latch2_resources,
- .num_resources = ARRAY_SIZE(latch2_resources),
- .dev = {
- .platform_data = &latch2_pdata,
- },
+ .res = latch2_resources,
+ .num_res = ARRAY_SIZE(latch2_resources),
+ .properties = latch2_gpio_props,
};
#define LATCH2_PIN_LCD_VBLEN 0
@@ -542,8 +539,6 @@ static struct gpiod_lookup_table keybrd_pwr_gpio_table = {
};
static struct platform_device *ams_delta_devices[] __initdata = {
- &latch1_gpio_device,
- &latch2_gpio_device,
&ams_delta_kp_device,
&ams_delta_audio_device,
&ams_delta_serio_device,
@@ -697,6 +692,9 @@ static void __init ams_delta_init(void)
omap1_usb_init(&ams_delta_usb_config);
platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
+ platform_device_register_full(&latch1_gpio_devinfo);
+ platform_device_register_full(&latch2_gpio_devinfo);
+
/*
* As soon as regulator consumers have been registered, assign their
* dev_names to consumer supply entries of respective regulators.
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH RFT v2 4/6] ARM: omap1: ams-delta: use generic device properties for gpio-mmio
2025-07-01 11:49 ` [PATCH RFT v2 4/6] ARM: omap1: ams-delta: use generic device properties " Bartosz Golaszewski
@ 2025-07-02 17:31 ` Janusz Krzysztofik
0 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2025-07-02 17:31 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen, Tony Lindgren,
Russell King, Krzysztof Kozlowski, Alim Akhtar,
Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski
[-- Attachment #1: Type: text/plain, Size: 3983 bytes --]
On Tuesday, 1 July 2025 13:49:38 CEST Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> The two latch GPIO devices in ams-delta are registered with struct
> bgpio_pdata passed as platform_data to the gpio-mmio driver. We want to
> remove the bgpio_pdata from the kernel and the gpio-mmio driver is now
> also able to get the relevant values from the software node. Set up
> device properties and switch to using platform_device_info to register
> the devices as platform_add_devices() doesn't allow us to pass device
> properties to the driver model.
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
> ---
> arch/arm/mach-omap1/board-ams-delta.c | 42 +++++++++++++++++------------------
> 1 file changed, 20 insertions(+), 22 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> index 0daf6c5b5c1cbcfd5bd15203cad119d39aa95f19..16392720296cd224732450c85419c35bbab506f6 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -19,6 +19,7 @@
> #include <linux/mtd/nand-gpio.h>
> #include <linux/mtd/partitions.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/regulator/consumer.h>
> #include <linux/regulator/fixed.h>
> #include <linux/regulator/machine.h>
> @@ -175,20 +176,18 @@ static struct resource latch1_resources[] = {
>
> #define LATCH1_LABEL "latch1"
>
> -static struct bgpio_pdata latch1_pdata = {
> - .label = LATCH1_LABEL,
> - .base = -1,
> - .ngpio = LATCH1_NGPIO,
> +static const struct property_entry latch1_gpio_props[] = {
> + PROPERTY_ENTRY_STRING("label", LATCH1_LABEL),
> + PROPERTY_ENTRY_U32("ngpios", LATCH1_NGPIO),
> + { }
> };
>
> -static struct platform_device latch1_gpio_device = {
> +static const struct platform_device_info latch1_gpio_devinfo = {
> .name = "basic-mmio-gpio",
> .id = 0,
> - .resource = latch1_resources,
> - .num_resources = ARRAY_SIZE(latch1_resources),
> - .dev = {
> - .platform_data = &latch1_pdata,
> - },
> + .res = latch1_resources,
> + .num_res = ARRAY_SIZE(latch1_resources),
> + .properties = latch1_gpio_props,
> };
>
> #define LATCH1_PIN_LED_CAMERA 0
> @@ -213,20 +212,18 @@ static struct resource latch2_resources[] = {
>
> #define LATCH2_LABEL "latch2"
>
> -static struct bgpio_pdata latch2_pdata = {
> - .label = LATCH2_LABEL,
> - .base = -1,
> - .ngpio = LATCH2_NGPIO,
> +static const struct property_entry latch2_gpio_props[] = {
> + PROPERTY_ENTRY_STRING("label", LATCH2_LABEL),
> + PROPERTY_ENTRY_U32("ngpios", LATCH2_NGPIO),
> + { }
> };
>
> -static struct platform_device latch2_gpio_device = {
> +static struct platform_device_info latch2_gpio_devinfo = {
> .name = "basic-mmio-gpio",
> .id = 1,
> - .resource = latch2_resources,
> - .num_resources = ARRAY_SIZE(latch2_resources),
> - .dev = {
> - .platform_data = &latch2_pdata,
> - },
> + .res = latch2_resources,
> + .num_res = ARRAY_SIZE(latch2_resources),
> + .properties = latch2_gpio_props,
> };
>
> #define LATCH2_PIN_LCD_VBLEN 0
> @@ -542,8 +539,6 @@ static struct gpiod_lookup_table keybrd_pwr_gpio_table = {
> };
>
> static struct platform_device *ams_delta_devices[] __initdata = {
> - &latch1_gpio_device,
> - &latch2_gpio_device,
> &ams_delta_kp_device,
> &ams_delta_audio_device,
> &ams_delta_serio_device,
> @@ -697,6 +692,9 @@ static void __init ams_delta_init(void)
> omap1_usb_init(&ams_delta_usb_config);
> platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
>
> + platform_device_register_full(&latch1_gpio_devinfo);
> + platform_device_register_full(&latch2_gpio_devinfo);
> +
> /*
> * As soon as regulator consumers have been registered, assign their
> * dev_names to consumer supply entries of respective regulators.
>
>
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH RFT v2 5/6] ARM: s3c: crag6410: use generic device properties for gpio-mmio
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
` (3 preceding siblings ...)
2025-07-01 11:49 ` [PATCH RFT v2 4/6] ARM: omap1: ams-delta: use generic device properties " Bartosz Golaszewski
@ 2025-07-01 11:49 ` Bartosz Golaszewski
2025-07-01 11:49 ` [PATCH RFT v2 6/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
2025-07-07 7:42 ` [PATCH RFT v2 0/6] " Bartosz Golaszewski
6 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01 11:49 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen,
Janusz Krzysztofik, Tony Lindgren, Russell King,
Krzysztof Kozlowski, Alim Akhtar
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski, Krzysztof Kozlowski,
Charles Keepax
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The GPIO device in crag6410 is registered with struct bgpio_pdata passed
as platform_data to the gpio-mmio driver. We want to remove the
bgpio_pdata from the kernel and the gpio-mmio driver is now also able to
get the relevant values from the software node. Set up device properties
and switch to using platform_device_info to register the device as
platform_add_devices() doesn't allow us to pass device properties to the
driver model.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/arm/mach-s3c/mach-crag6410.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index e5df2cb51ab27896d9dd80571f421e959db1fd1e..028169c7debf325ab6f51475d3595b92b1307189 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -252,14 +252,17 @@ static struct resource crag6410_mmgpio_resource[] = {
[0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),
};
-static struct platform_device crag6410_mmgpio = {
+static const struct property_entry crag6410_mmgpio_props[] = {
+ PROPERTY_ENTRY_U32("gpio-mmio,base", MMGPIO_GPIO_BASE),
+ { }
+};
+
+static struct platform_device_info crag6410_mmgpio_devinfo = {
.name = "basic-mmio-gpio",
.id = -1,
- .resource = crag6410_mmgpio_resource,
- .num_resources = ARRAY_SIZE(crag6410_mmgpio_resource),
- .dev.platform_data = &(struct bgpio_pdata) {
- .base = MMGPIO_GPIO_BASE,
- },
+ .res = crag6410_mmgpio_resource,
+ .num_res = ARRAY_SIZE(crag6410_mmgpio_resource),
+ .properties = crag6410_mmgpio_props,
};
static struct platform_device speyside_device = {
@@ -373,7 +376,6 @@ static struct platform_device *crag6410_devices[] __initdata = {
&crag6410_gpio_keydev,
&crag6410_dm9k_device,
&s3c64xx_device_spi0,
- &crag6410_mmgpio,
&crag6410_lcd_powerdev,
&crag6410_backlight_device,
&speyside_device,
@@ -871,6 +873,7 @@ static void __init crag6410_machine_init(void)
pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
+ platform_device_register_full(&crag6410_mmgpio_devinfo);
gpio_led_register_device(-1, &gpio_leds_pdata);
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH RFT v2 6/6] gpio: mmio: remove struct bgpio_pdata
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
` (4 preceding siblings ...)
2025-07-01 11:49 ` [PATCH RFT v2 5/6] ARM: s3c: crag6410: " Bartosz Golaszewski
@ 2025-07-01 11:49 ` Bartosz Golaszewski
2025-07-07 7:42 ` [PATCH RFT v2 0/6] " Bartosz Golaszewski
6 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-01 11:49 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Lee Jones, Liviu Dudau,
Sudeep Holla, Lorenzo Pieralisi, Aaro Koskinen,
Janusz Krzysztofik, Tony Lindgren, Russell King,
Krzysztof Kozlowski, Alim Akhtar
Cc: linux-gpio, linux-kernel, linux-arm-kernel, linux-omap, patches,
linux-samsung-soc, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
With no more users, we can now remove struct bgpio_pdata. Move the
relevant bits from bgpio_parse_fw() into bgpio_pdev_probe() while
maintaining the logical ordering (get flags before calling
bgpio_init()).
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-mmio.c | 73 ++++++++++++---------------------------------
include/linux/gpio/driver.h | 6 ----
2 files changed, 19 insertions(+), 60 deletions(-)
diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index f66137caa245b14e6e8dbd043243224bc47c9609..cf878c2ea6bf1bb6dfbd1040d64787687335132a 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -734,43 +734,6 @@ static const struct of_device_id bgpio_of_match[] = {
};
MODULE_DEVICE_TABLE(of, bgpio_of_match);
-static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *flags)
-{
- struct bgpio_pdata *pdata;
- const char *label;
- unsigned int base;
- int ret;
-
- if (!dev_fwnode(dev))
- return NULL;
-
- pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
- return ERR_PTR(-ENOMEM);
-
- pdata->base = -1;
-
- if (device_is_big_endian(dev))
- *flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;
-
- if (device_property_read_bool(dev, "no-output"))
- *flags |= BGPIOF_NO_OUTPUT;
-
- ret = device_property_read_string(dev, "label", &label);
- if (!ret)
- pdata->label = label;
-
- /*
- * This property *must not* be used in device-tree sources, it's only
- * meant to be passed to the driver from board files and MFD core.
- */
- ret = device_property_read_u32(dev, "gpio-mmio,base", &base);
- if (!ret && base <= INT_MAX)
- pdata->base = base;
-
- return pdata;
-}
-
static int bgpio_pdev_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -782,18 +745,10 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
void __iomem *dirin;
unsigned long sz;
unsigned long flags = 0;
+ unsigned int base;
int err;
struct gpio_chip *gc;
- struct bgpio_pdata *pdata;
-
- pdata = bgpio_parse_fw(dev, &flags);
- if (IS_ERR(pdata))
- return PTR_ERR(pdata);
-
- if (!pdata) {
- pdata = dev_get_platdata(dev);
- flags = pdev->id_entry->driver_data;
- }
+ const char *label;
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat");
if (!r)
@@ -825,17 +780,27 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
if (!gc)
return -ENOMEM;
+ if (device_is_big_endian(dev))
+ flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;
+
+ if (device_property_read_bool(dev, "no-output"))
+ flags |= BGPIOF_NO_OUTPUT;
+
err = bgpio_init(gc, dev, sz, dat, set, clr, dirout, dirin, flags);
if (err)
return err;
- if (pdata) {
- if (pdata->label)
- gc->label = pdata->label;
- gc->base = pdata->base;
- if (pdata->ngpio > 0)
- gc->ngpio = pdata->ngpio;
- }
+ err = device_property_read_string(dev, "label", &label);
+ if (!err)
+ gc->label = label;
+
+ /*
+ * This property *must not* be used in device-tree sources, it's only
+ * meant to be passed to the driver from board files and MFD core.
+ */
+ err = device_property_read_u32(dev, "gpio-mmio,base", &base);
+ if (!err && base <= INT_MAX)
+ gc->base = base;
platform_set_drvdata(pdev, gc);
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 97cc75623261917e9b3624e1e636d2432c0db205..4b984e8f8fcdbba5c008fc67ff0557bda11df40b 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -718,12 +718,6 @@ const unsigned long *gpiochip_query_valid_mask(const struct gpio_chip *gc);
/* get driver data */
void *gpiochip_get_data(struct gpio_chip *gc);
-struct bgpio_pdata {
- const char *label;
- int base;
- int ngpio;
-};
-
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
int gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata
2025-07-01 11:49 [PATCH RFT v2 0/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
` (5 preceding siblings ...)
2025-07-01 11:49 ` [PATCH RFT v2 6/6] gpio: mmio: remove struct bgpio_pdata Bartosz Golaszewski
@ 2025-07-07 7:42 ` Bartosz Golaszewski
6 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-07 7:42 UTC (permalink / raw)
To: Linus Walleij, Lee Jones, Liviu Dudau, Sudeep Holla,
Lorenzo Pieralisi, Aaro Koskinen, Janusz Krzysztofik,
Tony Lindgren, Russell King, Krzysztof Kozlowski, Alim Akhtar,
Bartosz Golaszewski
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, linux-arm-kernel,
linux-omap, patches, linux-samsung-soc, Krzysztof Kozlowski,
Charles Keepax
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Tue, 01 Jul 2025 13:49:34 +0200, Bartosz Golaszewski wrote:
> I'm working on removing the fields relevant only to gpio-mmio from
> struct gpio_chip. One of the bits that need addressing before we can do
> this is the removal of struct bgpio_pdata from the kernel. Fortunately
> there are only 3 users left treewide.
>
> This series adds support for parsing of generic device properties to
> gpio-mmio, converts all users to setting up software nodes containing
> relevant values in their property sets and removes struct bgpio_pdata.
>
> [...]
Applied, thanks!
[1/6] gpio: mmio: drop the big-endian platform device variant
https://git.kernel.org/brgl/linux/c/e567269e246809223fafaee7d421ae17a832fae5
[2/6] gpio: mmio: get chip label and GPIO base from device properties
https://git.kernel.org/brgl/linux/c/c4a834840596c8b9e388d430154959390f9f96e4
[3/6] mfd: vexpress-sysreg: set-up software nodes for gpio-mmio
https://git.kernel.org/brgl/linux/c/11cd2e582bf4da87b5fc0f9b07e194daaf212651
[4/6] ARM: omap1: ams-delta: use generic device properties for gpio-mmio
https://git.kernel.org/brgl/linux/c/094017efe332d411a8d6ac41fd8d0a4f81f72a99
[5/6] ARM: s3c: crag6410: use generic device properties for gpio-mmio
https://git.kernel.org/brgl/linux/c/bb9c88d5b0fabe05b0ed4b843efe78ac1c4712f0
[6/6] gpio: mmio: remove struct bgpio_pdata
https://git.kernel.org/brgl/linux/c/9bad4bec5daddbb296481af759f9d56c849ba96f
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread