* [PATCH 1/3] mfd: timberdale: set up a software node for the GPIO cell
2026-03-13 10:04 [PATCH 0/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
@ 2026-03-13 10:04 ` Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 2/3] gpio: timberdale: use device properties Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 3/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
2 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2026-03-13 10:04 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Andy Shevchenko, Bartosz Golaszewski
Cc: linux-kernel, linux-gpio, Bartosz Golaszewski
Create a software node with device properties for the GPIO cell and
attach it to all the GPIO cells.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/mfd/timberdale.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
index a4d9c070d481a182890a58e4b8c850c4c29f7f17..2d76b6b58f9fa9a6f8b1b96d143d6724f3cd503d 100644
--- a/drivers/mfd/timberdale.c
+++ b/drivers/mfd/timberdale.c
@@ -181,6 +181,18 @@ static struct timbgpio_platform_data
.irq_base = 200,
};
+static const struct property_entry timberdale_gpio_properties[] = {
+ PROPERTY_ENTRY_U32("ngpios", GPIO_NR_PINS),
+ PROPERTY_ENTRY_U32("intel,gpio-base", 0),
+ PROPERTY_ENTRY_U32("intel,irq-base", 200),
+ { }
+};
+
+static const struct software_node timberdale_gpio_swnode = {
+ .name = "timb-gpio",
+ .properties = timberdale_gpio_properties,
+};
+
static const struct resource timberdale_gpio_resources[] = {
{
.start = GPIOOFFSET,
@@ -392,6 +404,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg0[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-video",
@@ -454,6 +467,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg1[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-mlogicore",
@@ -516,6 +530,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg2[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-video",
@@ -566,6 +581,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg3[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-video",
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/3] gpio: timberdale: use device properties
2026-03-13 10:04 [PATCH 0/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 1/3] mfd: timberdale: set up a software node for the GPIO cell Bartosz Golaszewski
@ 2026-03-13 10:04 ` Bartosz Golaszewski
2026-03-13 10:21 ` Andy Shevchenko
2026-03-16 13:58 ` Linus Walleij
2026-03-13 10:04 ` [PATCH 3/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
2 siblings, 2 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2026-03-13 10:04 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Andy Shevchenko, Bartosz Golaszewski
Cc: linux-kernel, linux-gpio, Bartosz Golaszewski
The top-level MFD driver now passes the device properties to the GPIO
cell via the software node. Use generic device property accessors and
stop using platform data. We can ignore the "ngpios" property here now
as it will be retrieved internally by GPIO core.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/gpio/gpio-timberdale.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index f488939dd00a8a7f332d3af27962a38a3b7e6ecf..7c34ea8a0ececf9432dbb16881eb53ee95d58441 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -14,7 +14,6 @@
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/io.h>
-#include <linux/timb_gpio.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
@@ -225,19 +224,21 @@ static int timbgpio_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct gpio_chip *gc;
struct timbgpio *tgpio;
- struct timbgpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
int irq = platform_get_irq(pdev, 0);
- if (!pdata || pdata->nr_pins > 32) {
- dev_err(dev, "Invalid platform data\n");
- return -EINVAL;
- }
-
tgpio = devm_kzalloc(dev, sizeof(*tgpio), GFP_KERNEL);
if (!tgpio)
return -EINVAL;
- tgpio->irq_base = pdata->irq_base;
+ gc = &tgpio->gpio;
+
+ err = device_property_read_u32(dev, "intel,irq-base", &tgpio->irq_base);
+ if (err)
+ return err;
+
+ err = device_property_read_u32(dev, "intel,gpio-base", &gc->base);
+ if (err)
+ return err;
spin_lock_init(&tgpio->lock);
@@ -245,8 +246,6 @@ static int timbgpio_probe(struct platform_device *pdev)
if (IS_ERR(tgpio->membase))
return PTR_ERR(tgpio->membase);
- gc = &tgpio->gpio;
-
gc->label = dev_name(&pdev->dev);
gc->owner = THIS_MODULE;
gc->parent = &pdev->dev;
@@ -256,21 +255,22 @@ static int timbgpio_probe(struct platform_device *pdev)
gc->set = timbgpio_gpio_set;
gc->to_irq = (irq >= 0 && tgpio->irq_base > 0) ? timbgpio_to_irq : NULL;
gc->dbg_show = NULL;
- gc->base = pdata->gpio_base;
- gc->ngpio = pdata->nr_pins;
gc->can_sleep = false;
err = devm_gpiochip_add_data(&pdev->dev, gc, tgpio);
if (err)
return err;
+ if (gc->ngpio > 32)
+ return dev_err_probe(dev, -EINVAL, "Invalid number of pins\n");
+
/* make sure to disable interrupts */
iowrite32(0x0, tgpio->membase + TGPIO_IER);
if (irq < 0 || tgpio->irq_base <= 0)
return 0;
- for (i = 0; i < pdata->nr_pins; i++) {
+ for (i = 0; i < gc->ngpio; i++) {
irq_set_chip_and_handler(tgpio->irq_base + i,
&timbgpio_irqchip, handle_simple_irq);
irq_set_chip_data(tgpio->irq_base + i, tgpio);
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 2/3] gpio: timberdale: use device properties
2026-03-13 10:04 ` [PATCH 2/3] gpio: timberdale: use device properties Bartosz Golaszewski
@ 2026-03-13 10:21 ` Andy Shevchenko
2026-03-13 10:24 ` Andy Shevchenko
2026-03-13 13:27 ` Bartosz Golaszewski
2026-03-16 13:58 ` Linus Walleij
1 sibling, 2 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-03-13 10:21 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lee Jones, Linus Walleij, Bartosz Golaszewski, linux-kernel,
linux-gpio
On Fri, Mar 13, 2026 at 11:04:49AM +0100, Bartosz Golaszewski wrote:
> The top-level MFD driver now passes the device properties to the GPIO
> cell via the software node. Use generic device property accessors and
> stop using platform data. We can ignore the "ngpios" property here now
> as it will be retrieved internally by GPIO core.
...
> + err = device_property_read_u32(dev, "intel,gpio-base", &gc->base);
In drivers/mfd/intel_quark_i2c_gpio.c we use 'gpio-base' and I prefer to have
it common since it's Linux only property for now. Alternatively patch that to
have a snps prefix.
> + if (err)
> + return err;
...
> err = devm_gpiochip_add_data(&pdev->dev, gc, tgpio);
> if (err)
> return err;
>
> + if (gc->ngpio > 32)
> + return dev_err_probe(dev, -EINVAL, "Invalid number of pins\n");
> +
> /* make sure to disable interrupts */
> iowrite32(0x0, tgpio->membase + TGPIO_IER);
>
> if (irq < 0 || tgpio->irq_base <= 0)
> return 0;
>
> - for (i = 0; i < pdata->nr_pins; i++) {
> + for (i = 0; i < gc->ngpio; i++) {
> irq_set_chip_and_handler(tgpio->irq_base + i,
> &timbgpio_irqchip, handle_simple_irq);
> irq_set_chip_data(tgpio->irq_base + i, tgpio);
Shouldn't this be done in the respective callbacks before the
devm_gpiochip_add_data() finishes? (Yes, it's not related to this
patch, but it is related to seems racy driver initialisation.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/3] gpio: timberdale: use device properties
2026-03-13 10:21 ` Andy Shevchenko
@ 2026-03-13 10:24 ` Andy Shevchenko
2026-03-13 13:27 ` Bartosz Golaszewski
1 sibling, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-03-13 10:24 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lee Jones, Linus Walleij, Bartosz Golaszewski, linux-kernel,
linux-gpio
On Fri, Mar 13, 2026 at 12:21:54PM +0200, Andy Shevchenko wrote:
> On Fri, Mar 13, 2026 at 11:04:49AM +0100, Bartosz Golaszewski wrote:
...
> Shouldn't this be done in the respective callbacks before the
> devm_gpiochip_add_data() finishes? (Yes, it's not related to this
> patch, but it is related to seems racy driver initialisation.
And with that being said, wouldn't be better to move the driver to one
of the generic library (gpio-regmap / gpio-mmio)?
Also it mentions FPGA in the header, I am wondering what that FPGA is.
Perhaps we have already similar driver in the kernel from the FPGA vendor?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] gpio: timberdale: use device properties
2026-03-13 10:21 ` Andy Shevchenko
2026-03-13 10:24 ` Andy Shevchenko
@ 2026-03-13 13:27 ` Bartosz Golaszewski
2026-03-13 14:08 ` Andy Shevchenko
1 sibling, 1 reply; 10+ messages in thread
From: Bartosz Golaszewski @ 2026-03-13 13:27 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Lee Jones, Linus Walleij, linux-kernel,
linux-gpio
On Fri, Mar 13, 2026 at 11:21 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Mar 13, 2026 at 11:04:49AM +0100, Bartosz Golaszewski wrote:
> > The top-level MFD driver now passes the device properties to the GPIO
> > cell via the software node. Use generic device property accessors and
> > stop using platform data. We can ignore the "ngpios" property here now
> > as it will be retrieved internally by GPIO core.
>
> ...
>
> > + err = device_property_read_u32(dev, "intel,gpio-base", &gc->base);
>
> In drivers/mfd/intel_quark_i2c_gpio.c we use 'gpio-base' and I prefer to have
> it common since it's Linux only property for now. Alternatively patch that to
> have a snps prefix.
>
So "gpio-base" and "snps,irq-base" for the properties?
> > + if (err)
> > + return err;
>
> ...
>
> > err = devm_gpiochip_add_data(&pdev->dev, gc, tgpio);
> > if (err)
> > return err;
> >
> > + if (gc->ngpio > 32)
> > + return dev_err_probe(dev, -EINVAL, "Invalid number of pins\n");
> > +
> > /* make sure to disable interrupts */
> > iowrite32(0x0, tgpio->membase + TGPIO_IER);
> >
> > if (irq < 0 || tgpio->irq_base <= 0)
> > return 0;
> >
> > - for (i = 0; i < pdata->nr_pins; i++) {
> > + for (i = 0; i < gc->ngpio; i++) {
> > irq_set_chip_and_handler(tgpio->irq_base + i,
> > &timbgpio_irqchip, handle_simple_irq);
> > irq_set_chip_data(tgpio->irq_base + i, tgpio);
>
> Shouldn't this be done in the respective callbacks before the
> devm_gpiochip_add_data() finishes? (Yes, it's not related to this
> patch, but it is related to seems racy driver initialisation.
>
Sure, let's not it but I'm not going to do this as part of this
series, let me clean up all the headers first.
Bart
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/3] gpio: timberdale: use device properties
2026-03-13 13:27 ` Bartosz Golaszewski
@ 2026-03-13 14:08 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-03-13 14:08 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Bartosz Golaszewski, Lee Jones, Linus Walleij, linux-kernel,
linux-gpio
On Fri, Mar 13, 2026 at 02:27:36PM +0100, Bartosz Golaszewski wrote:
> On Fri, Mar 13, 2026 at 11:21 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Fri, Mar 13, 2026 at 11:04:49AM +0100, Bartosz Golaszewski wrote:
...
> > > + err = device_property_read_u32(dev, "intel,gpio-base", &gc->base);
> >
> > In drivers/mfd/intel_quark_i2c_gpio.c we use 'gpio-base' and I prefer to have
> > it common since it's Linux only property for now. Alternatively patch that to
> > have a snps prefix.
>
> So "gpio-base" and "snps,irq-base" for the properties?
Either 'gpio-base' in all drivers that use it only as Linux property
(currently 2 + potentially this one), OR fixing _there_ (in two drivers)
by having 'snps,gpio-base' _there_, not in this driver.
And if you choose the former (dropping the vendor prefix here), the 'irq-base'
with it (vendor prefix) will look inconsistent.
> > > + if (err)
> > > + return err;
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] gpio: timberdale: use device properties
2026-03-13 10:04 ` [PATCH 2/3] gpio: timberdale: use device properties Bartosz Golaszewski
2026-03-13 10:21 ` Andy Shevchenko
@ 2026-03-16 13:58 ` Linus Walleij
1 sibling, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2026-03-16 13:58 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lee Jones, Andy Shevchenko, Bartosz Golaszewski, linux-kernel,
linux-gpio
Hi Bartosz,
On Fri, Mar 13, 2026 at 11:05 AM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
> + err = device_property_read_u32(dev, "intel,gpio-base", &gc->base);
I guess there is some background to why we do this crazy thing,
like legacy.
I guess if I want to change the world away from this I need to
send a separate patch to set gc->base to -1 and see what happens...
Otherwise the patch looks good to me!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] gpio: timberdale: remove platform data header
2026-03-13 10:04 [PATCH 0/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 1/3] mfd: timberdale: set up a software node for the GPIO cell Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 2/3] gpio: timberdale: use device properties Bartosz Golaszewski
@ 2026-03-13 10:04 ` Bartosz Golaszewski
2026-03-13 10:24 ` Andy Shevchenko
2 siblings, 1 reply; 10+ messages in thread
From: Bartosz Golaszewski @ 2026-03-13 10:04 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Andy Shevchenko, Bartosz Golaszewski
Cc: linux-kernel, linux-gpio, Bartosz Golaszewski
With no more users, we can remove timb_gpio.h.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/mfd/timberdale.c | 17 -----------------
include/linux/timb_gpio.h | 25 -------------------------
2 files changed, 42 deletions(-)
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
index 2d76b6b58f9fa9a6f8b1b96d143d6724f3cd503d..9ea12dce384d75e5f77f72d23a78c56d64d5ebd4 100644
--- a/drivers/mfd/timberdale.c
+++ b/drivers/mfd/timberdale.c
@@ -15,8 +15,6 @@
#include <linux/property.h>
#include <linux/slab.h>
-#include <linux/timb_gpio.h>
-
#include <linux/i2c.h>
#include <linux/platform_data/i2c-ocores.h>
#include <linux/platform_data/i2c-xiic.h>
@@ -174,13 +172,6 @@ static const struct resource timberdale_eth_resources[] = {
},
};
-static struct timbgpio_platform_data
- timberdale_gpio_platform_data = {
- .gpio_base = 0,
- .nr_pins = GPIO_NR_PINS,
- .irq_base = 200,
-};
-
static const struct property_entry timberdale_gpio_properties[] = {
PROPERTY_ENTRY_U32("ngpios", GPIO_NR_PINS),
PROPERTY_ENTRY_U32("intel,gpio-base", 0),
@@ -402,8 +393,6 @@ static const struct mfd_cell timberdale_cells_bar0_cfg0[] = {
.name = "timb-gpio",
.num_resources = ARRAY_SIZE(timberdale_gpio_resources),
.resources = timberdale_gpio_resources,
- .platform_data = &timberdale_gpio_platform_data,
- .pdata_size = sizeof(timberdale_gpio_platform_data),
.swnode = &timberdale_gpio_swnode,
},
{
@@ -465,8 +454,6 @@ static const struct mfd_cell timberdale_cells_bar0_cfg1[] = {
.name = "timb-gpio",
.num_resources = ARRAY_SIZE(timberdale_gpio_resources),
.resources = timberdale_gpio_resources,
- .platform_data = &timberdale_gpio_platform_data,
- .pdata_size = sizeof(timberdale_gpio_platform_data),
.swnode = &timberdale_gpio_swnode,
},
{
@@ -528,8 +515,6 @@ static const struct mfd_cell timberdale_cells_bar0_cfg2[] = {
.name = "timb-gpio",
.num_resources = ARRAY_SIZE(timberdale_gpio_resources),
.resources = timberdale_gpio_resources,
- .platform_data = &timberdale_gpio_platform_data,
- .pdata_size = sizeof(timberdale_gpio_platform_data),
.swnode = &timberdale_gpio_swnode,
},
{
@@ -579,8 +564,6 @@ static const struct mfd_cell timberdale_cells_bar0_cfg3[] = {
.name = "timb-gpio",
.num_resources = ARRAY_SIZE(timberdale_gpio_resources),
.resources = timberdale_gpio_resources,
- .platform_data = &timberdale_gpio_platform_data,
- .pdata_size = sizeof(timberdale_gpio_platform_data),
.swnode = &timberdale_gpio_swnode,
},
{
diff --git a/include/linux/timb_gpio.h b/include/linux/timb_gpio.h
deleted file mode 100644
index 74f5e73bf6db67170817352415ca58b415870886..0000000000000000000000000000000000000000
--- a/include/linux/timb_gpio.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * timb_gpio.h timberdale FPGA GPIO driver, platform data definition
- * Copyright (c) 2009 Intel Corporation
- */
-
-#ifndef _LINUX_TIMB_GPIO_H
-#define _LINUX_TIMB_GPIO_H
-
-/**
- * struct timbgpio_platform_data - Platform data of the Timberdale GPIO driver
- * @gpio_base: The number of the first GPIO pin, set to -1 for
- * dynamic number allocation.
- * @nr_pins: Number of pins that is supported by the hardware (1-32)
- * @irq_base: If IRQ is supported by the hardware, this is the base
- * number of IRQ:s. One IRQ per pin will be used. Set to
- * -1 if IRQ:s is not supported.
- */
-struct timbgpio_platform_data {
- int gpio_base;
- int nr_pins;
- int irq_base;
-};
-
-#endif
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 3/3] gpio: timberdale: remove platform data header
2026-03-13 10:04 ` [PATCH 3/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
@ 2026-03-13 10:24 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-03-13 10:24 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lee Jones, Linus Walleij, Bartosz Golaszewski, linux-kernel,
linux-gpio
On Fri, Mar 13, 2026 at 11:04:50AM +0100, Bartosz Golaszewski wrote:
> With no more users, we can remove timb_gpio.h.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread