[RFT PATCH] ARM: omap1: enable real software node lookup of GPIOs on Nokia 770
Aaro Koskinen
aaro.koskinen at iki.fi
Wed Feb 11 03:42:56 PST 2026
Hi,
On Wed, Feb 11, 2026 at 12:14:49PM +0100, Bartosz Golaszewski wrote:
> Currently the board file for Nokia 770 creates dummy software nodes not
> attached in any way to the actual GPIO controller devices and uses the
> fact that GPIOLIB matching swnode's name to the GPIO chip's label during
> software node lookup. This behavior is wrong and we want to remove it.
> To that end, we need to first convert all existing users to creating
> actual fwnode links.
>
> Create real software nodes for GPIO controllers on OMAP16xx and
> reference them from the software nodes in the nokia board file.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski at oss.qualcomm.com>
> ---
> This is a follow up to the following discussion[1]. I don't have the
> hardware for testing so only build-tested it.
I won't build with CONFIG_I2C_CBUS_GPIO - the CBUS is mandatory, otherwise
the board will power off 30 seconds after the reset.
A.
> [1] https://lore.kernel.org/all/aYkdKfP5fg6iywgr@jekhomev/
>
> arch/arm/mach-omap1/board-nokia770.c | 24 ++---------------------
> arch/arm/mach-omap1/common.h | 4 ++++
> arch/arm/mach-omap1/gpio16xx.c | 29 +++++++++++++++++++++++++++-
> 3 files changed, 34 insertions(+), 23 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
> index a5bf5554800f..a81514c6f92c 100644
> --- a/arch/arm/mach-omap1/board-nokia770.c
> +++ b/arch/arm/mach-omap1/board-nokia770.c
> @@ -36,25 +36,6 @@
> #include "clock.h"
> #include "mmc.h"
>
> -static const struct software_node nokia770_mpuio_gpiochip_node = {
> - .name = "mpuio",
> -};
> -
> -static const struct software_node nokia770_gpiochip1_node = {
> - .name = "gpio-0-15",
> -};
> -
> -static const struct software_node nokia770_gpiochip2_node = {
> - .name = "gpio-16-31",
> -};
> -
> -static const struct software_node *nokia770_gpiochip_nodes[] = {
> - &nokia770_mpuio_gpiochip_node,
> - &nokia770_gpiochip1_node,
> - &nokia770_gpiochip2_node,
> - NULL
> -};
> -
> #define ADS7846_PENDOWN_GPIO 15
>
> static const unsigned int nokia770_keymap[] = {
> @@ -112,7 +93,7 @@ static const struct omap_lcd_config nokia770_lcd_config __initconst = {
> };
>
> static const struct property_entry nokia770_mipid_props[] = {
> - PROPERTY_ENTRY_GPIO("reset-gpios", &nokia770_gpiochip1_node,
> + PROPERTY_ENTRY_GPIO("reset-gpios", &omap16xx_gpio1_swnode,
> 13, GPIO_ACTIVE_LOW),
> { }
> };
> @@ -138,7 +119,7 @@ static const struct property_entry nokia770_ads7846_props[] = {
> PROPERTY_ENTRY_U16("ti,x-plate-ohms", 180),
> PROPERTY_ENTRY_U16("ti,debounce-tol", 3),
> PROPERTY_ENTRY_U16("ti,debounce-rep", 1),
> - PROPERTY_ENTRY_GPIO("pendown-gpios", &nokia770_gpiochip1_node,
> + PROPERTY_ENTRY_GPIO("pendown-gpios", &omap16xx_gpio1_swnode,
> ADS7846_PENDOWN_GPIO, GPIO_ACTIVE_LOW),
> { }
> };
> @@ -318,7 +299,6 @@ static void __init omap_nokia770_init(void)
> /* Unmask SleepX signal */
> omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
>
> - software_node_register_node_group(nokia770_gpiochip_nodes);
> platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
>
> gpiod_add_lookup_table(&nokia770_irq_gpio_table);
> diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
> index 7a7c3d9eb84a..34659b5fc6f0 100644
> --- a/arch/arm/mach-omap1/common.h
> +++ b/arch/arm/mach-omap1/common.h
> @@ -35,6 +35,10 @@
> #include "soc.h"
> #include "i2c.h"
>
> +extern const struct software_node omap16xx_mpu_gpio_swnode;
> +extern const struct software_node omap16xx_gpio1_swnode;
> +extern const struct software_node omap16xx_gpio2_swnode;
> +
> #ifdef CONFIG_OMAP_SERIAL_WAKE
> int omap_serial_wakeup_init(void);
> #else
> diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
> index 55acec22fef4..6eedb87cbf6b 100644
> --- a/arch/arm/mach-omap1/gpio16xx.c
> +++ b/arch/arm/mach-omap1/gpio16xx.c
> @@ -9,6 +9,7 @@
> */
>
> #include <linux/platform_data/gpio-omap.h>
> +#include <linux/property.h>
> #include <linux/soc/ti/omap1-io.h>
>
> #include "hardware.h"
> @@ -55,6 +56,8 @@ static struct omap_gpio_platform_data omap16xx_mpu_gpio_config = {
> .regs = &omap16xx_mpuio_regs,
> };
>
> +const struct software_node omap16xx_mpu_gpio_swnode = { };
> +
> static struct platform_device omap16xx_mpu_gpio = {
> .name = "omap_gpio",
> .id = 0,
> @@ -99,6 +102,8 @@ static struct omap_gpio_platform_data omap16xx_gpio1_config = {
> .regs = &omap16xx_gpio_regs,
> };
>
> +const struct software_node omap16xx_gpio1_swnode = { };
> +
> static struct platform_device omap16xx_gpio1 = {
> .name = "omap_gpio",
> .id = 1,
> @@ -122,6 +127,8 @@ static struct resource omap16xx_gpio2_resources[] = {
> },
> };
>
> +const struct software_node omap16xx_gpio2_swnode = { };
> +
> static struct omap_gpio_platform_data omap16xx_gpio2_config = {
> .bank_width = 16,
> .regs = &omap16xx_gpio_regs,
> @@ -155,6 +162,8 @@ static struct omap_gpio_platform_data omap16xx_gpio3_config = {
> .regs = &omap16xx_gpio_regs,
> };
>
> +const struct software_node omap16xx_gpio3_swnode = { };
> +
> static struct platform_device omap16xx_gpio3 = {
> .name = "omap_gpio",
> .id = 3,
> @@ -183,6 +192,8 @@ static struct omap_gpio_platform_data omap16xx_gpio4_config = {
> .regs = &omap16xx_gpio_regs,
> };
>
> +const struct software_node omap16xx_gpio4_swnode = { };
> +
> static struct platform_device omap16xx_gpio4 = {
> .name = "omap_gpio",
> .id = 4,
> @@ -201,6 +212,14 @@ static struct platform_device *omap16xx_gpio_dev[] __initdata = {
> &omap16xx_gpio4,
> };
>
> +static const struct software_node *omap16xx_gpio_swnodes[] __initconst = {
> + &omap16xx_mpu_gpio_swnode,
> + &omap16xx_gpio1_swnode,
> + &omap16xx_gpio2_swnode,
> + &omap16xx_gpio3_swnode,
> + &omap16xx_gpio4_swnode,
> +};
> +
> /*
> * omap16xx_gpio_init needs to be done before
> * machine_init functions access gpio APIs.
> @@ -208,7 +227,7 @@ static struct platform_device *omap16xx_gpio_dev[] __initdata = {
> */
> static int __init omap16xx_gpio_init(void)
> {
> - int i;
> + int i, ret;
> void __iomem *base;
> struct resource *res;
> struct platform_device *pdev;
> @@ -244,6 +263,14 @@ static int __init omap16xx_gpio_init(void)
> iounmap(base);
>
> platform_device_register(omap16xx_gpio_dev[i]);
> +
> + ret = device_add_software_node(&omap16xx_gpio_dev[i]->dev,
> + omap16xx_gpio_swnodes[i]);
> +
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to add software node.\n");
> + return ret;
> + }
> }
>
> return 0;
> --
> 2.47.3
>
More information about the linux-arm-kernel
mailing list