From nobody Sun Apr 5 11:46:44 2026 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01CD22BE621 for ; Tue, 10 Mar 2026 06:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123142; cv=none; b=bEK5ngUf03N1Ecb73IbeLmohF3EWyBxf2HM39wLNqxluXZ3QRrVjxz1OdBZbD5kEBzJc8bpOk7mYGS5bG8mQ+2MOrLwSdle9jgtyxGqfOrpSb7UoJEjvkWeWGSKxVXnRamBajVr/QXb/Zo4waaJe2Lwa2x0yMyBmSJQWK5XTAII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123142; c=relaxed/simple; bh=XRio9G3PpzIKf5fTbcsvkoxkVC0WokjbqLbKOkmTnjc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t8t0hyrPuKWAkt52oZHrk0iWbnFpmFFMIh/ygsj8J1h544fqsPrUJil0pfssxUzZamdw+xkTkDMVOcfzqVtcw+AlMLW8gsAyY2JcORLuiXj2/KV2oYkRNFSkEt0/COgQjqBKoTE5exC/IQwNG82Pr+OLymtrGVXcyPcBcHnIfpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f95H87We; arc=none smtp.client-ip=74.125.82.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f95H87We" Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-2be3bdfda8eso5852640eec.1 for ; Mon, 09 Mar 2026 23:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773123140; x=1773727940; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=T3lT/PTNwNOc4iufAidrAcgLB/0uuZoI/g6mDpTtk9I=; b=f95H87We702gnCPFjBpwZwpQiNh3nQEHi3ebfJyw/vkGPpWrOIV+oTePVIWGbcqLkA 6c/gJhtln3TTdZWjcqXRvSaSW5hWfHkcBi8jomkNzWK7/8ieV4iF6XW2aY1avZ7d/fgF sD32uQxod32f/ddWYvkm97X7uUdv7rJruuGIHKfx2sMTkaBAYmuhKu40593ocKg2vOcc /rPx2Kmh3gY23QP06xM/Qc16bu8Xzp9YXUUWUZp7BGIHB7WKHnNMO+VNxkDxbTZ+zU/W QOzbgfmUzRVUMJaYzKrGCXIYn2xH5T1G6irsWCla3oddAC8rgdeYw82s67ixbm68CbJL m8+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773123140; x=1773727940; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=T3lT/PTNwNOc4iufAidrAcgLB/0uuZoI/g6mDpTtk9I=; b=YLlLtba40E1h/ntD/XdeXeYXovl2XN1VflWdgZBUA0YFe9asm05Kutuq8xCkew4JDW 23kvp4Ehizo+77AiC6QUAEE3rN6w5suwrBPvzixV5Oegqh5yT95/ShZNcZOflP15tVPX fmIzgOcTZ12P+i3du4ZPceLugjK0AK1plwqgvWi99Q7NpDq7kaW461P9NowBK1jXf7z+ WEN90tmkHqiiKzqARhjxxttVKpEQeJrMi2q3o6RWTtJs+Wfi7cAtZjPrSGQTPp8BOKU3 p1NTOGu+zH4KUbRs57h7OteaW8g4y+NWvQSGq2tao1LnQHwDsNROBHEbeokMI2dn7XCW 5y7w== X-Forwarded-Encrypted: i=1; AJvYcCURznCgH5JxOD42gnBWDbW1xXh8kPJ1jOHpHNKmQYFLQa9+mAPHlxQob5Zu0/JvMN/DvyEbwRyU90ERWhM=@vger.kernel.org X-Gm-Message-State: AOJu0YxYbt6s+0dk1U19F9kXAivRukd5PEvRfSxVN03S5OQ1dhMak7u0 tzerM0Us5RKG/3fEonwqZzsR0mvTjeSm89jahFQmF+vFEasjg/qdkAYh X-Gm-Gg: ATEYQzwzWJ8r9sQQjUGbozDZ2tBjCyCwjOJTxvj8Ag5Na0ATFQKEEGUno2OQNTiGfRV iuNGRGQnZGRGkY/C5UJ1201oXitMG2NiZV7OWUK7efep0wdl07n5M2LF6aJX7m9ShMADU+n4x/B eZvAev65YO1I5khRqGn3RfOCyn8TtSv455TPr4bcLJDEsR7Ohp5kqheNVxw6ksEBe6Ws2G8x1M2 5AW+27l6yB8oA0uKKLARH6yOA3Zsed+edEFf3bZi0PI4vdcAMxby9HLnKbu4PKJvQRHqbM9i4+3 aUYn3REZFgZCKB/LlGTyOGQtMlp/GxjWPap+73O+ZNipS3SaX9y3yWp/tsOrSACcuvnAk9JXRUt gJAEiYqjiXbqrWyR+HormQ2TeCo+zzH3EB5veTT8cbKqToGwDg5OqSQvsAOR1HkBJfXfRBBMj+/ RMwsSdEDusijErOQGxP7ua2gqGXXxnOn9g+qrRyVCSdjFqoOoL+BP4X5L7BmEM8RD3+/nUd5TYa V4W2hb99geLgxM= X-Received: by 2002:a05:7300:f194:b0:2be:2bc5:ba05 with SMTP id 5a478bee46e88-2be4de63f5emr4444129eec.7.1773123139778; Mon, 09 Mar 2026 23:12:19 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:2a0a:17c2:21e7:dcfb]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be4f96aa32sm11787106eec.26.2026.03.09.23.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 23:12:18 -0700 (PDT) From: Dmitry Torokhov Date: Mon, 09 Mar 2026 23:11:58 -0700 Subject: [PATCH 1/4] MIPS: alchemy: mtx1: attach software nodes to GPIO chips Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260309-alchemy-v1-1-f55e9dc60ba1@gmail.com> References: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> In-Reply-To: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-a6826 GPIO subsystem is switching the way it locates GPIO chip instances for GPIO references in software nodes from matching on node names to identity matching, which necessitates assigning firmware nodes (software nodes) to GPIO chips. Move the node definitions for alchemy-gpio1 and alchemy-gpio2 to arch/misp/alchemy/common/gpiolib.c, register them there, and attach them to gpio_chip instances. Adjust MTX1 board file to use these nodes. Note that because nodes need to be registered before they can be used in PROPERTY_ENTRY_GPIO() we have to do the registration at postcore_initcall level, otherwise (due to the link order) MTX1 board initialization code will run first. Signed-off-by: Dmitry Torokhov --- arch/mips/alchemy/board-mtx1.c | 79 +++++++++++----------= ---- arch/mips/alchemy/common/gpiolib.c | 39 +++++++++++- arch/mips/include/asm/mach-au1x00/gpio-au1000.h | 4 ++ 3 files changed, 75 insertions(+), 47 deletions(-) diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index cb6be58808a0..740b38c0b81e 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -78,27 +79,22 @@ void __init board_setup(void) =20 /*************************************************************************= *****/ =20 -static const struct software_node mtx1_gpiochip_node =3D { - .name =3D "alchemy-gpio2", -}; - static const struct software_node mtx1_gpio_keys_node =3D { .name =3D "mtx1-gpio-keys", }; =20 -static const struct property_entry mtx1_button_props[] =3D { - PROPERTY_ENTRY_U32("linux,code", BTN_0), - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 7, GPIO_ACTIVE_HIGH), - PROPERTY_ENTRY_STRING("label", "System button"), - { } -}; - static const struct software_node mtx1_button_node =3D { .parent =3D &mtx1_gpio_keys_node, - .properties =3D mtx1_button_props, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("linux,code", BTN_0), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 7, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_STRING("label", "System button"), + { } + }, }; =20 -static const struct software_node *mtx1_gpio_keys_swnodes[] __initconst = =3D { +static const struct software_node * const mtx1_gpio_keys_swnodes[] __initc= onst =3D { &mtx1_gpio_keys_node, &mtx1_button_node, NULL @@ -127,16 +123,15 @@ static void __init mtx1_keys_init(void) pr_err("failed to create gpio-keys device: %d\n", err); } =20 -/* Global number 215 is offset 15 on Alchemy GPIO 2 */ -static const struct property_entry mtx1_wdt_props[] =3D { - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 15, GPIO_ACTIVE_HIGH), - { } -}; - -static struct platform_device_info mtx1_wdt_info __initconst =3D { +static const struct platform_device_info mtx1_wdt_info __initconst =3D { .name =3D "mtx1-wdt", .id =3D 0, - .properties =3D mtx1_wdt_props, + .properties =3D (const struct property_entry[]){ + /* Global number 215 is offset 15 on Alchemy GPIO 2 */ + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 15, + GPIO_ACTIVE_HIGH), + { } + }, }; =20 static void __init mtx1_wdt_init(void) @@ -147,36 +142,34 @@ static void __init mtx1_wdt_init(void) pd =3D platform_device_register_full(&mtx1_wdt_info); err =3D PTR_ERR_OR_ZERO(pd); if (err) - pr_err("failed to create gpio-keys device: %d\n", err); + pr_err("failed to create watchdog device: %d\n", err); } =20 static const struct software_node mtx1_gpio_leds_node =3D { .name =3D "mtx1-leds", }; =20 -static const struct property_entry mtx1_green_led_props[] =3D { - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 11, GPIO_ACTIVE_HIGH), - { } -}; - static const struct software_node mtx1_green_led_node =3D { .name =3D "mtx1:green", .parent =3D &mtx1_gpio_leds_node, - .properties =3D mtx1_green_led_props, -}; - -static const struct property_entry mtx1_red_led_props[] =3D { - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 12, GPIO_ACTIVE_HIGH), - { } + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 11, + GPIO_ACTIVE_HIGH), + { } + }, }; =20 static const struct software_node mtx1_red_led_node =3D { .name =3D "mtx1:red", .parent =3D &mtx1_gpio_leds_node, - .properties =3D mtx1_red_led_props, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 12, + GPIO_ACTIVE_HIGH), + { } + }, }; =20 -static const struct software_node *mtx1_gpio_leds_swnodes[] =3D { +static const struct software_node * const mtx1_gpio_leds_swnodes[] __initc= onst =3D { &mtx1_gpio_leds_node, &mtx1_green_led_node, &mtx1_red_led_node, @@ -185,10 +178,6 @@ static const struct software_node *mtx1_gpio_leds_swno= des[] =3D { =20 static void __init mtx1_leds_init(void) { - struct platform_device_info led_info =3D { - .name =3D "leds-gpio", - .id =3D PLATFORM_DEVID_NONE, - }; struct platform_device *led_dev; int err; =20 @@ -198,9 +187,11 @@ static void __init mtx1_leds_init(void) return; } =20 - led_info.fwnode =3D software_node_fwnode(&mtx1_gpio_leds_node); - - led_dev =3D platform_device_register_full(&led_info); + led_dev =3D platform_device_register_full(&(struct platform_device_info){ + .name =3D "leds-gpio", + .id =3D PLATFORM_DEVID_NONE, + .fwnode =3D software_node_fwnode(&mtx1_gpio_leds_node), + }); err =3D PTR_ERR_OR_ZERO(led_dev); if (err) pr_err("failed to create LED device: %d\n", err); @@ -335,10 +326,6 @@ static int __init mtx1_register_devices(void) =20 au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata); =20 - rc =3D software_node_register(&mtx1_gpiochip_node); - if (rc) - return rc; - rc =3D platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); if (rc) return rc; diff --git a/arch/mips/alchemy/common/gpiolib.c b/arch/mips/alchemy/common/= gpiolib.c index e79e26ffac99..2141eae5ce45 100644 --- a/arch/mips/alchemy/common/gpiolib.c +++ b/arch/mips/alchemy/common/gpiolib.c @@ -30,6 +30,7 @@ =20 #include #include +#include #include #include #include @@ -95,7 +96,21 @@ static int gpio1_to_irq(struct gpio_chip *chip, unsigned= offset) return alchemy_gpio1_to_irq(offset + ALCHEMY_GPIO1_BASE); } =20 -struct gpio_chip alchemy_gpio_chip[] =3D { +const struct software_node alchemy_gpio1_node =3D { + .name =3D "alchemy-gpio1", +}; + +const struct software_node alchemy_gpio2_node =3D { + .name =3D "alchemy-gpio2", +}; + +static const struct software_node *alchemy_gpio_node_group[] =3D { + &alchemy_gpio1_node, + &alchemy_gpio2_node, + NULL +}; + +static struct gpio_chip alchemy_gpio_chip[] =3D { [0] =3D { .label =3D "alchemy-gpio1", .direction_input =3D gpio1_direction_input, @@ -157,6 +172,28 @@ static struct gpio_chip au1300_gpiochip =3D { .ngpio =3D AU1300_GPIO_NUM, }; =20 +/* + * Software nodes must be registered before board-specific code (that runs + * at arch_initcall level) attempts to use them as GPIO targets or as fwno= des + * for registered devices. We can not do registration in alchemy_gpiochip_= init + * because it also runs as arch_initcall and runs after board-specific code + * because of the link order, and so we do it at postcore_initcall level. + */ +static int __init alchemy_gpio_nodes_init(void) +{ + int ret; + + ret =3D software_node_register_node_group(alchemy_gpio_node_group); + if (ret) + return ret; + + alchemy_gpio_chip[0].fwnode =3D software_node_fwnode(&alchemy_gpio1_node); + alchemy_gpio_chip[1].fwnode =3D software_node_fwnode(&alchemy_gpio2_node); + + return 0; +} +postcore_initcall(alchemy_gpio_nodes_init); + static int __init alchemy_gpiochip_init(void) { int ret =3D 0; diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h b/arch/mips/in= clude/asm/mach-au1x00/gpio-au1000.h index d820b481ac56..a0eebc24c4a8 100644 --- a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h +++ b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h @@ -41,6 +41,10 @@ #define AU1000_GPIO2_ENABLE 0x14 =20 struct gpio; +struct software_node; + +extern const struct software_node alchemy_gpio1_node; +extern const struct software_node alchemy_gpio2_node; =20 static inline int au1000_gpio1_to_irq(int gpio) { --=20 2.53.0.473.g4a7958ca14-goog From nobody Sun Apr 5 11:46:44 2026 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 402A9314A82 for ; Tue, 10 Mar 2026 06:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123143; cv=none; b=VFAuv6XZERngUQliHNuHghifj5NztyZEORwNov9tgad+q7L4LPXcK7P/QE29JQeRtCQIhN02BNREnx1DCel6UF/DEFsQQMIiO/bsD6jYJS1l2jB321XsgZ3P2V4Fhg9sbTJr1tu5GDQGmCsWHF9rJFzqIScMPy2DjaXIvx9Yc4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123143; c=relaxed/simple; bh=GiBQRQwmwilpQYyY+FBB4dRdiEVi8kF7ZMt0+wdAXH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PkzG1o96vxzReG4lEvPghLEImbkoTEU4gP+pqOVtGIphb4yndyOGxjgZs+UtacqiuC3oNvoHzwVgWFUqwWBTPveVIBENSaxZNc+PNEkg5J4wv4gPN2ldyHas5TBSDxjkAPcOZOI6WLsMh/1L55XiPWn/WFTqAk7tiwO/WpwCobQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d+iwtnIp; arc=none smtp.client-ip=74.125.82.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d+iwtnIp" Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-2be26842fd5so4088934eec.1 for ; Mon, 09 Mar 2026 23:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773123141; x=1773727941; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4rN4V1kFQ4B979w9z8IfxCTP5Tip9YLt5+/xSuLcGnc=; b=d+iwtnIpdl2OMrgWqNKHapuaTxYtfhxFLhZ9FwyKuS1zXMUcC2VHWCiCWTMIo8ByW/ 12ygTFnHrgxN6jRtwjur4pXJnT3IMYb3NjDL0dI/Zbi+ToKiQG1o7ker1mwlysWGu5LM +oERDolTp+1yDKNBQwZYNX6d20rxIohFpFE7yQrZeJ+zrA3mQUIb9mlL5OM3PvAspiAu spyX/km1qtQ/fHp9iPc1s/pY/uVyqeh0HKxGvI+VndUOaaKaoRFE9zGYMc1ilys2dLqa in5VSqQ7jBfGlrolXVsIrPhHAWtwOy5EiD6h/Bz0QXXW8ecBpX3VrD1J2Tmr7JRoqYX6 rguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773123141; x=1773727941; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4rN4V1kFQ4B979w9z8IfxCTP5Tip9YLt5+/xSuLcGnc=; b=rd11BsdE2wHet6Q2rl1eiSsjxevR79ACkUaEUKstfHuC+tT9rJY5iQV/yd0cRFc8zA 1j9wE1Vht+hhTmh3W4cMLLd7gSTnAYQJXwwCT83P+cEan/GVS3psR060ijYmDEQHMpMT FXxHBCFlPpbHDYqZ7iskPzdGKcfUp8Ov34kOsnd1dQhPptDpa1c1e63X4Gq5smsEIAoG eowr+HjwfX8f81OyAoYGIrCSv3RIHHmXBX8q7yzvrSPx6VpYPVOcZh/uXspVMBovSDbn e1sDIvTCDRRhmWM16hee7dF2VPLSH5mCt0TXpd4FimFJK7sCSF/sN3Qg7Xh2/bwOpTn5 xkXA== X-Forwarded-Encrypted: i=1; AJvYcCWdjCg4QNJENepSZF4Cq+5pHGRXHn9WpJ5CxmW7XgG9O276oHbIO8Yi9PXnGi8xQYiO/64EhvjsoTbbQQQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwV6yy+YgwA5koF9s/wUuFAqWDbdK+KktcfmVsI8In5CeDTHIuE pWToL6Vwhh+Ptji4fh0sosatv9aOgQq1HlyOnORWg2R/6gFTOISWXySq X-Gm-Gg: ATEYQzyNaa6kEjmQ/g5UxZVGwAcEHr8YHgneLf5291cujnrbccw5OiAKEGug0rCvlZ+ MLnGSOm5m6EHWS6WWIO07T8Rqlk/74KzgWYDmT6ANPZRHuryrHZtGSsm1nQzjphDojLdE+LdOvd QJxXe1/YLDNQEfsQ4pyFRSbdXIwuIaAH0uyKkgScNgx/8xM5CSwZ/ejXip+URumGBw5OmFh2Xj0 jEJgiaxx4pgKYM1oKgczdtoopWeFAMuedFoyV7obZGnKwMvDroyv/Df7qCAkDNEWWcfl1wtvKkZ BDGdx3JUvXDfVPysoi+TecEJGQZsiNm/C/i+jcZiUVmaUEMLUn53Dwjp8LkHL8mFeBILbe9deKW TAIr4+haWb2IbGdbkiXaTVqsHLoqNNtFoGFehKk+su8ZwAkuVaHxnXBLR39jTfq6vtwISxuBW// NFSGPEGVIKMemT3czaR8OlbhnzGV0vTSCOurJ+vPnOvMT1jZ8x8+WbVkXEI3f5jJMMVt/fLkOoq a8CASUxNK1dNnE= X-Received: by 2002:a05:693c:60ce:b0:2be:6693:9b4d with SMTP id 5a478bee46e88-2be7a0dbcd1mr683634eec.9.1773123141276; Mon, 09 Mar 2026 23:12:21 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:2a0a:17c2:21e7:dcfb]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be4f96aa32sm11787106eec.26.2026.03.09.23.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 23:12:20 -0700 (PDT) From: Dmitry Torokhov Date: Mon, 09 Mar 2026 23:11:59 -0700 Subject: [PATCH 2/4] MIPS: alchemy: db1000: use nodes attached to GPIO chips in properties Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260309-alchemy-v1-2-f55e9dc60ba1@gmail.com> References: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> In-Reply-To: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-a6826 GPIO subsystem is switching the way it locates GPIO chip instances for GPIO references in software nodes by doing identity matching instead of matching on node names. Switch to using software nodes attached to gpio chips instead of using freestanding software nodes. Also stop supplying platform data for the spi-gpio controller since spi-gpio driver can derive number of chipselect lines from device properties. Signed-off-by: Dmitry Torokhov --- arch/mips/alchemy/devboards/db1000.c | 36 +++++++++++---------------------= ---- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devbo= ards/db1000.c index 6984cd5169b5..d9dffacc5f5a 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -375,20 +374,14 @@ static struct platform_device db1100_mmc1_dev =3D { =20 /*************************************************************************= *****/ =20 -static const struct software_node db1100_alchemy2_gpiochip =3D { - .name =3D "alchemy-gpio2", -}; - -static const struct property_entry db1100_ads7846_properties[] =3D { - PROPERTY_ENTRY_U16("ti,vref_min", 3300), - PROPERTY_ENTRY_GPIO("pendown-gpios", - &db1100_alchemy2_gpiochip, 21, GPIO_ACTIVE_LOW), - { } -}; - static const struct software_node db1100_ads7846_swnode =3D { .name =3D "ads7846", - .properties =3D db1100_ads7846_properties, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U16("ti,vref_min", 3300), + PROPERTY_ENTRY_GPIO("pendown-gpios", + &alchemy_gpio2_node, 21, GPIO_ACTIVE_LOW), + { } + }, }; =20 static struct spi_board_info db1100_spi_info[] __initdata =3D { @@ -403,32 +396,26 @@ static struct spi_board_info db1100_spi_info[] __init= data =3D { }, }; =20 -static const struct spi_gpio_platform_data db1100_spictl_pd __initconst = =3D { - .num_chipselect =3D 1, -}; - /* * Alchemy GPIO 2 has its base at 200 so the GPIO lines * 207 thru 210 are GPIOs at offset 7 thru 10 at this chip. */ static const struct property_entry db1100_spi_dev_properties[] __initconst= =3D { PROPERTY_ENTRY_GPIO("miso-gpios", - &db1100_alchemy2_gpiochip, 7, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 7, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_GPIO("mosi-gpios", - &db1100_alchemy2_gpiochip, 8, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 8, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_GPIO("sck-gpios", - &db1100_alchemy2_gpiochip, 9, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 9, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_GPIO("cs-gpios", - &db1100_alchemy2_gpiochip, 10, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 10, GPIO_ACTIVE_HIGH), { } }; =20 static const struct platform_device_info db1100_spi_dev_info __initconst = =3D { .name =3D "spi_gpio", .id =3D 0, - .data =3D &db1100_spictl_pd, - .size_data =3D sizeof(db1100_spictl_pd), - .dma_mask =3D DMA_BIT_MASK(32), + .dma_mask =3D DMA_BIT_MASK(32), .properties =3D db1100_spi_dev_properties, }; =20 @@ -481,7 +468,6 @@ int __init db1000_dev_setup(void) pfc |=3D (1 << 0); /* SSI0 pins as GPIOs */ alchemy_wrsys(pfc, AU1000_SYS_PINFUNC); =20 - software_node_register(&db1100_alchemy2_gpiochip); spi_register_board_info(db1100_spi_info, ARRAY_SIZE(db1100_spi_info)); =20 --=20 2.53.0.473.g4a7958ca14-goog From nobody Sun Apr 5 11:46:44 2026 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C903314D15 for ; Tue, 10 Mar 2026 06:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123145; cv=none; b=go8iF5BP71VeHGE7Z7VAceMPQkH4g/bCWeN0cfCDnVljn9bhORfOvXM4kj3AGTbcPNr/pk4itIEIjKEZvt3LjvVM8xY0NO1Ip4eH5Z4qBBINb6kw09opzljtCrMeIytBueqDkC97XTwUNPt8JTsxlNsv+R6ZFsfCL0IvakQCGEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123145; c=relaxed/simple; bh=Ww1uOxXj4zg02OyEIEQ6zxV8fvva8dIE3hzD0F9KZUY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MwWoUv4LLDYI4ZuN4cjKz/a1NtlIJAHFtR9eOE2bYbvmgXs9L1IE6rwegs+TYRxbS34OHjO251GTB+/i4NXZsJ2gaa1ST/0TQbQn8qjG9aEPfSE8BoOrHDNmxqhm4dcyVMuW9eIpJFKb/BT2+TwIhaCSZL1i86Q1Q9a1AObvBZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=URZf0K89; arc=none smtp.client-ip=74.125.82.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="URZf0K89" Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-2bdcf5970cdso8270483eec.0 for ; Mon, 09 Mar 2026 23:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773123143; x=1773727943; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oc9kvg6kj8oQJRsEf7n0ivGSmV5Oi+rLWC/z8Agp6PI=; b=URZf0K8967jBKMk4w+eO2P4ugKK6QvJuqipL8/XvSJu3gTsZb+vTi5wZObfYzcd0m5 tw8QuGFxlSBE/+m5hSl9kFOq2WRZdI5DG7KDfSXoVPKL7Aj0jM4T5sgFddBmDSwvCLYD ys5Jsb5Whqwy/dLs1WRzapGoTlCoVUen93TV7H3dLZOHbzS3+qEBvLCMzK0d1XVkEZ8m NLRHhjs861evkZ4/oHq/+D6VYFjBHI6yXleYM4oKmC0rq6N+PFFVIfCS/sfgd0rIH04R H+DzDmDQ+c5MJzLJVBJR4bO0POAJQ8a60/eGNmIcbPwAhXraWwBJDMRzO9cCECeyc8Tl 2F5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773123143; x=1773727943; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=oc9kvg6kj8oQJRsEf7n0ivGSmV5Oi+rLWC/z8Agp6PI=; b=hIu5pkrjVuCalMDHv1pvZmUSS4KtZhNhlKmoeBh5yu2g2kKJyLdLqjP6BWRxyX2Jfd p1a3u6FOA6o8e4vRcu3xlXvmUk9AuoIBWcSaql9kFw9/HPCCNIJoOLS65p5QLOq68mnM VsmaDHXWxBbmIvtVuMRObM/5L3fxUVvWp+c1TUE5ttyHiwiTTCCZM1ZjHZ2bZ495ahGr cLshyCefrf4TeYmW7RnHQ1u2wlCx7fqF5WYaR3MbuSK51X1CcgvNMJdX9QpIAPS69rWk 62kBrBkMDc1D7SNYVNtxw9Hdk+3tRepCAyhe8aXZBeIxTevGzSjD7wG2N/U025sR+VpO YzXQ== X-Forwarded-Encrypted: i=1; AJvYcCVGst9n+BVP4c5tcHOQ0RAtOtRenjMeLeQpWxMsYEtO9G9NPGIVuolHC0wFOsAYkk5QMZOb0OOvH0NEjbI=@vger.kernel.org X-Gm-Message-State: AOJu0YwzAfXH9O2KnbINfF59y/rFR6n+jSBJwGGFKh2YrE+cJz1MNkwc TQcBwVlBjFwEib4r1vOc3HXIF8xketi+wuAX8zBh4UsQISFiUwdJuVoS X-Gm-Gg: ATEYQzws21imYHVYor/3hY1ItqX+Vpxnk7jHkgDK7CF4+oLW5B5TmWtHMgCoYIPYVIF NP/O28LoeUABW5Yv8YCgFHwlrl4kivgQpwpEjfrjNmA3FKO2bvfNdW4vuJOyfAUaFAt+yvYJq00 Qp7OTxbdzntqgzIoAddcaOu36LzbYEFAqb/yDt9LPLX6urMu2Hm7QPNuF1zNfeWdu+XwomxrdJp kFwaHeQqKhxJVYOVLhr5lCowxHoHe9FXp4KxgBgqxz8VfbZujZgGiLZuqNqP69yn5rgrotEk7k1 ZUACyFBYJUXjsrFHCxzR1RBmDFz6O4guw4t9ZyRBpo+6jEselILG/Y5uWaSNfbP3ytM098QS7mp EtAoB0Fha7Hu0IBBCM2r4JztVo5/0u/gIHQ7Y33CdHhdWwdBRUbTj9kSCyvDaVdBCxl6eNd3jzW vuGkcAione4wWMMGhtN8nWSSkJnal7Old5YYCZncGzCReEQ63j9jY7yzZjw8bAmPlPnwVVOa0gL eMC2kNt9Uu6dgI= X-Received: by 2002:a05:7300:3215:b0:2be:514:3697 with SMTP id 5a478bee46e88-2be7a25f162mr843406eec.13.1773123142942; Mon, 09 Mar 2026 23:12:22 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:2a0a:17c2:21e7:dcfb]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be4f96aa32sm11787106eec.26.2026.03.09.23.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 23:12:21 -0700 (PDT) From: Dmitry Torokhov Date: Mon, 09 Mar 2026 23:12:00 -0700 Subject: [PATCH 3/4] MIPS: alchemy: gpr: switch to static device properties Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260309-alchemy-v1-3-f55e9dc60ba1@gmail.com> References: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> In-Reply-To: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-a6826 Convert I2C-gpio device and GPIO-connected LEDs on GPR board to software nodes/properties, so that support for platform data can be removed from gpio-leds driver (which will rely purely on generic device properties for configuration). Signed-off-by: Dmitry Torokhov --- arch/mips/alchemy/board-gpr.c | 122 ++++++++++++++++++++++++--------------= ---- 1 file changed, 71 insertions(+), 51 deletions(-) diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c index f587c40b6d00..3e9bd179844f 100644 --- a/arch/mips/alchemy/board-gpr.c +++ b/arch/mips/alchemy/board-gpr.c @@ -13,11 +13,11 @@ #include #include #include -#include -#include #include #include #include +#include +#include #include #include #include @@ -161,66 +161,87 @@ static struct platform_device gpr_mtd_device =3D { /* * LEDs */ -static const struct gpio_led gpr_gpio_leds[] =3D { - { /* green */ - .name =3D "gpr:green", - .gpio =3D 4, - .active_low =3D 1, +static const struct software_node gpr_gpio_leds_node =3D { + .name =3D "gpr-leds", +}; + +static const struct software_node gpr_green_led_node =3D { + .name =3D "gpr:green", + .parent =3D &gpr_gpio_leds_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_GPIO("gpios", + &alchemy_gpio1_node, 4, GPIO_ACTIVE_LOW), + { } }, - { /* red */ - .name =3D "gpr:red", - .gpio =3D 5, - .active_low =3D 1, - } }; =20 -static struct gpio_led_platform_data gpr_led_data =3D { - .num_leds =3D ARRAY_SIZE(gpr_gpio_leds), - .leds =3D gpr_gpio_leds, +static const struct software_node gpr_red_led_node =3D { + .name =3D "gpr:red", + .parent =3D &gpr_gpio_leds_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_GPIO("gpios", + &alchemy_gpio1_node, 5, GPIO_ACTIVE_LOW), + { } + }, }; =20 -static struct platform_device gpr_led_devices =3D { - .name =3D "leds-gpio", - .id =3D -1, - .dev =3D { - .platform_data =3D &gpr_led_data, - } +static const struct software_node * const gpr_gpio_leds_swnodes[] __initco= nst =3D { + &gpr_gpio_leds_node, + &gpr_green_led_node, + &gpr_red_led_node, + NULL }; =20 +static void __init gpr_leds_init(void) +{ + struct platform_device *pd; + int err; + + err =3D software_node_register_node_group(gpr_gpio_leds_swnodes); + if (err) { + pr_err("failed to register LED software nodes: %d\n", err); + return; + } + + pd =3D platform_device_register_full(&(struct platform_device_info){ + .name =3D "leds-gpio", + .id =3D PLATFORM_DEVID_NONE, + .fwnode =3D software_node_fwnode(&gpr_gpio_leds_node), + }); + err =3D PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create LED device: %d\n", err); +} + /* * I2C */ -static struct gpiod_lookup_table gpr_i2c_gpiod_table =3D { - .dev_id =3D "i2c-gpio", - .table =3D { - /* - * This should be on "GPIO2" which has base at 200 so - * the global numbers 209 and 210 should correspond to - * local offsets 9 and 10. - */ - GPIO_LOOKUP_IDX("alchemy-gpio2", 9, NULL, 0, - GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("alchemy-gpio2", 10, NULL, 1, - GPIO_ACTIVE_HIGH), - }, +static const struct property_entry gpr_i2c_props[] __initconst =3D { + PROPERTY_ENTRY_GPIO("sda-gpios", &alchemy_gpio2_node, 9, GPIO_ACTIVE_HIGH= ), + PROPERTY_ENTRY_GPIO("scl-gpios", &alchemy_gpio2_node, 10, GPIO_ACTIVE_HIG= H), + PROPERTY_ENTRY_U32("i2c-gpio,delay-us", 2), /* ~100 kHz */ + PROPERTY_ENTRY_U32("i2c-gpio,timeout-ms", 1000), + PROPERTY_ENTRY_BOOL("i2c-gpio,sda-open-drain"), + PROPERTY_ENTRY_BOOL("i2c-gpio,scl-open-drain"), + { } }; =20 -static struct i2c_gpio_platform_data gpr_i2c_data =3D { - /* - * The open drain mode is hardwired somewhere or an electrical - * property of the alchemy GPIO controller. - */ - .sda_is_open_drain =3D 1, - .scl_is_open_drain =3D 1, - .udelay =3D 2, /* ~100 kHz */ - .timeout =3D HZ, +static const struct platform_device_info gpr_i2c_pdev_info __initconst =3D= { + .name =3D "i2c-gpio", + .id =3D PLATFORM_DEVID_NONE, + .properties =3D gpr_i2c_props, }; =20 -static struct platform_device gpr_i2c_device =3D { - .name =3D "i2c-gpio", - .id =3D -1, - .dev.platform_data =3D &gpr_i2c_data, -}; +static void __init gpr_i2c_init(void) +{ + struct platform_device *pd; + int err; + + pd =3D platform_device_register_full(&gpr_i2c_pdev_info); + err =3D PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create I2C device: %d\n", err); +} =20 static struct i2c_board_info gpr_i2c_info[] __initdata =3D { { @@ -270,8 +291,6 @@ static struct platform_device gpr_pci_host_dev =3D { static struct platform_device *gpr_devices[] __initdata =3D { &gpr_wdt_device, &gpr_mtd_device, - &gpr_i2c_device, - &gpr_led_devices, }; =20 static int __init gpr_pci_init(void) @@ -284,8 +303,9 @@ arch_initcall(gpr_pci_init); =20 static int __init gpr_dev_init(void) { - gpiod_add_lookup_table(&gpr_i2c_gpiod_table); i2c_register_board_info(0, gpr_i2c_info, ARRAY_SIZE(gpr_i2c_info)); + gpr_i2c_init(); + gpr_leds_init(); =20 return platform_add_devices(gpr_devices, ARRAY_SIZE(gpr_devices)); } --=20 2.53.0.473.g4a7958ca14-goog From nobody Sun Apr 5 11:46:44 2026 Received: from mail-dy1-f169.google.com (mail-dy1-f169.google.com [74.125.82.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81F6B314D13 for ; Tue, 10 Mar 2026 06:12:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123147; cv=none; b=iKa78U7qDvesDmDnXjbJ6IXCSkW5CQXLtRh4WpRp94gw6bVZy167h2wEEHTelpOJI1j2ymW9XmnpbS11dIdAwsz6kczIGsy9UfAvmVwDS5g/EguUcUn2UQ2IlbMZx5zp052SzZ6PbNmdiUdEQtvc+ksfj0aW1xeOH9dRAKieX0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773123147; c=relaxed/simple; bh=h5UVABpQZUkO05OBEUSYfy0NZP2rxkBLkvFv6He2r1Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=slUH2sLOtmk/gdseWAJ08kVM1psWwsX5VoTgzBlHFgQMBmnlkAI+DkjM2792vzfEl42CY9gQKZ/o0x9Kps2Xdfut+7NlqwCQyhYR6/qZjzuU1RRNlNesG/m4UhrJbtul3qdOV840NV6mgoDw+qwaVsBYgDDtvmgjoiNnyopyyvg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X2qg0A4c; arc=none smtp.client-ip=74.125.82.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X2qg0A4c" Received: by mail-dy1-f169.google.com with SMTP id 5a478bee46e88-2b6b0500e06so14727289eec.1 for ; Mon, 09 Mar 2026 23:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773123145; x=1773727945; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=runPVszt3agTYmsgIh3va2R0o5GPxMmFccPuUgOxdtM=; b=X2qg0A4cvJVyC7NCiu8aGDU6YzeXyoH/Q1LuaDByCLofHgyQZxLH4NGvdna5VP51R3 CddEKnaVlI3Vs/BtRUJwUeW76yJqtPob0M9OrffpxFCaGeXYYuDNdEyITXflvcWp7ZuY KxpGFtWYRRum31186moHKBtYSGNn44f4l1k80SQpvCFEQu+8dh+frPBYD6TA2u5dBJmh GOza3poj0qEvICzXjlM4PMYtXnNb9J1Gegwgrec5FOzY8dKU+/DrnccmKxlsuTh3MP8f lvNohlRBHpgLu3RIAwacoO4qd5sAuMZMMvx0SJzStZgKSKFCfyOMbYk1Q/cfh4naejjd Kybw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773123145; x=1773727945; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=runPVszt3agTYmsgIh3va2R0o5GPxMmFccPuUgOxdtM=; b=X7uBdkrmxiruJ1vqdCs9iaBgS7rWxjEVX/8fEaMXtWQM1dex8xM7LEmgCT8SCGWUMb hcuAbepLLvpQ8hvaFhbL9LhD23vjFPZ9OD05TilhqamkrUsTVgNnzu9w9WlG3Ocq5E7+ GAy0CI10+0r11i0Vs4qRLnFV5AuJf+CXx3r3iwFFfzsqFP7QWX29+tZoRf7a2+6BjXj/ 5T17vVsJS8CmAc5nJ5cCmbJo6DXHUwTAvYMrc2UG5BkhoJCvG2ACdA6blE4E+C6PIZQE BJhcKLMTjXXBV78JzAfj5nxBO+1e96pEy6P9j0DblnEnB6d2+4+5P4SxbYY3vrW551WA wOgA== X-Forwarded-Encrypted: i=1; AJvYcCXxAUNhcyLRuQ/fgUDIKv+CvyyJJo3l0jRbIgOqfRBdfPGw+JhfvYaDhsXHNNtNGTbqsI6zyF8fFpQXsQg=@vger.kernel.org X-Gm-Message-State: AOJu0YwQn5jKTlk5qx0+rlCQujMWBLzpsOO/cxsfQS6MQTPLMH26SXOK IWLl8vaVNElfzCvW28esu+1Htiu0IBG6I/lxeUOvOGqhkjE9fkO578Qz X-Gm-Gg: ATEYQzw6SGxYd9F2ke3m+ocJa6i+LlzqjU4hcEV21Feqn1vAox6y6N28dBssona01Ta VakDz/+k41+hPPwg19m6ztl/cbRlah5udHoJGVndI1rIZPPwZtuWXBqyRmaqMp9bYQaTQb+JQno FiN9Dp9BwD/ksTrztN3Q6GK1/IDNbnITwGW/SUuNB/+QQV46xg6IhZ+4YGjub9KJiuBv9Tj9H9I fhoJS6Adm3lRQ7XJOAbGlt0w6UnOsRODKe4aHMy2pGHpLegwMzdYfn4QXNCbV+pDojVrYyiY+Hc O3/nbAmKQgoqrudsBh4tzcchA57/Kguxb85mwQTSWjIOhfkiuooWFhAFzyh/h3HzRzScreoKDnq 93LSJMycI0ZpRB/vPEfLXP75s+uBUAoZPk/IS7/t66DQlxwUEvf79XhTspTqW4DtbIfUWapcCWx ITRmivca1XcCihRQcEAUx4SUjlgBGhSq7CH1rlMnwkS1f8zF5BssJaD6HiCc7S8N3vs4MLB5VKP BF2HvbsdwDA78E= X-Received: by 2002:a05:7301:1f12:b0:2be:126c:e32d with SMTP id 5a478bee46e88-2be4e08ffabmr5303246eec.39.1773123144458; Mon, 09 Mar 2026 23:12:24 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:2a0a:17c2:21e7:dcfb]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be4f96aa32sm11787106eec.26.2026.03.09.23.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 23:12:23 -0700 (PDT) From: Dmitry Torokhov Date: Mon, 09 Mar 2026 23:12:01 -0700 Subject: [PATCH 4/4] MIPS: alchemy: db1300: switch to static device properties Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260309-alchemy-v1-4-f55e9dc60ba1@gmail.com> References: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> In-Reply-To: <20260309-alchemy-v1-0-f55e9dc60ba1@gmail.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-a6826 Convert "5way switch" gpio-keys device and smsc911x ethernet controller to use static device properties instead of bespoke platform data structures for configuration. Signed-off-by: Dmitry Torokhov --- arch/mips/alchemy/common/gpiolib.c | 6 + arch/mips/alchemy/devboards/db1300.c | 209 +++++++++++++++-----= ---- arch/mips/include/asm/mach-au1x00/gpio-au1300.h | 3 + 3 files changed, 144 insertions(+), 74 deletions(-) diff --git a/arch/mips/alchemy/common/gpiolib.c b/arch/mips/alchemy/common/= gpiolib.c index 2141eae5ce45..c926cc137561 100644 --- a/arch/mips/alchemy/common/gpiolib.c +++ b/arch/mips/alchemy/common/gpiolib.c @@ -104,9 +104,14 @@ const struct software_node alchemy_gpio2_node =3D { .name =3D "alchemy-gpio2", }; =20 +const struct software_node alchemy_gpic_node =3D { + .name =3D "alchemy-gpic", +}; + static const struct software_node *alchemy_gpio_node_group[] =3D { &alchemy_gpio1_node, &alchemy_gpio2_node, + &alchemy_gpic_node, NULL }; =20 @@ -189,6 +194,7 @@ static int __init alchemy_gpio_nodes_init(void) =20 alchemy_gpio_chip[0].fwnode =3D software_node_fwnode(&alchemy_gpio1_node); alchemy_gpio_chip[1].fwnode =3D software_node_fwnode(&alchemy_gpio2_node); + au1300_gpiochip.fwnode =3D software_node_fwnode(&alchemy_gpic_node); =20 return 0; } diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devbo= ards/db1300.c index d377e043b49f..1c8b01e5263a 100644 --- a/arch/mips/alchemy/devboards/db1300.c +++ b/arch/mips/alchemy/devboards/db1300.c @@ -7,10 +7,10 @@ =20 #include #include -#include -#include +#include +#include #include -#include /* KEY_* codes */ +#include #include #include #include @@ -20,6 +20,7 @@ #include #include #include +#include #include #include =20 @@ -236,23 +237,36 @@ static struct resource db1300_eth_res[] =3D { }, }; =20 -static struct smsc911x_platform_config db1300_eth_config =3D { - .phy_interface =3D PHY_INTERFACE_MODE_MII, - .irq_polarity =3D SMSC911X_IRQ_POLARITY_ACTIVE_LOW, - .irq_type =3D SMSC911X_IRQ_TYPE_PUSH_PULL, - .flags =3D SMSC911X_USE_32BIT, -}; +static u8 db1300_eth_macaddr[6]; =20 -static struct platform_device db1300_eth_dev =3D { - .name =3D "smsc911x", - .id =3D -1, - .num_resources =3D ARRAY_SIZE(db1300_eth_res), - .resource =3D db1300_eth_res, - .dev =3D { - .platform_data =3D &db1300_eth_config, +static const struct platform_device_info db1300_eth_info __initconst =3D { + .name =3D "smsc911x", + .id =3D PLATFORM_DEVID_NONE, + .res =3D db1300_eth_res, + .num_res =3D ARRAY_SIZE(db1300_eth_res), + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("reg-io-width", 4), + PROPERTY_ENTRY_U32("reg-shift", 0), + PROPERTY_ENTRY_BOOL("smsc,irq-push-pull"), + PROPERTY_ENTRY_STRING("phy-mode", "mii"), + PROPERTY_ENTRY_U8_ARRAY("local-mac-address", db1300_eth_macaddr), + { } }, }; =20 +static void __init db1300_eth_init(void) +{ + struct platform_device *pd; + int err; + + prom_get_ethernet_addr(db1300_eth_macaddr); + + pd =3D platform_device_register_full(&db1300_eth_info); + err =3D PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create eth device: %d\n", err); +} + /**********************************************************************/ =20 static struct resource au1300_psc1_res[] =3D { @@ -355,62 +369,110 @@ static struct platform_device db1300_i2c_dev =3D { * according to the schematics swap up with down and left with right. * I chose to use it to emulate the arrow keys of a keyboard. */ -static struct gpio_keys_button db1300_5waysw_arrowkeys[] =3D { - { - .code =3D KEY_DOWN, - .gpio =3D AU1300_PIN_LCDPWM0, - .type =3D EV_KEY, - .debounce_interval =3D 1, - .active_low =3D 1, - .desc =3D "5waysw-down", - }, - { - .code =3D KEY_UP, - .gpio =3D AU1300_PIN_PSC2SYNC1, - .type =3D EV_KEY, - .debounce_interval =3D 1, - .active_low =3D 1, - .desc =3D "5waysw-up", - }, - { - .code =3D KEY_RIGHT, - .gpio =3D AU1300_PIN_WAKE3, - .type =3D EV_KEY, - .debounce_interval =3D 1, - .active_low =3D 1, - .desc =3D "5waysw-right", - }, - { - .code =3D KEY_LEFT, - .gpio =3D AU1300_PIN_WAKE2, - .type =3D EV_KEY, - .debounce_interval =3D 1, - .active_low =3D 1, - .desc =3D "5waysw-left", - }, - { - .code =3D KEY_ENTER, - .gpio =3D AU1300_PIN_WAKE1, - .type =3D EV_KEY, - .debounce_interval =3D 1, - .active_low =3D 1, - .desc =3D "5waysw-push", - }, -}; +static const struct software_node db1300_5waysw_node =3D { + .name =3D "db1300-5wayswitch", + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_BOOL("autorepeat"), + PROPERTY_ENTRY_STRING("label", "db1300-5wayswitch"), + { } + }, +}; + +static const struct software_node db1300_5waysw_down_node =3D { + .name =3D "5waysw-down", + .parent =3D &db1300_5waysw_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("linux,code", KEY_DOWN), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_LCDPWM0, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-down"), + { } + }, +}; + +static const struct software_node db1300_5waysw_up_node =3D { + .name =3D "5waysw-up", + .parent =3D &db1300_5waysw_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("linux,code", KEY_UP), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_PSC2SYNC1, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-up"), + { } + }, +}; + +static const struct software_node db1300_5waysw_right_node =3D { + .name =3D "5waysw-right", + .parent =3D &db1300_5waysw_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("linux,code", KEY_RIGHT), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_WAKE3, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-right"), + { } + }, +}; + +static const struct software_node db1300_5waysw_left_node =3D { + .name =3D "5waysw-left", + .parent =3D &db1300_5waysw_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("linux,code", KEY_LEFT), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_WAKE2, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-left"), + { } + }, +}; + +static const struct software_node db1300_5waysw_push_node =3D { + .name =3D "5waysw-push", + .parent =3D &db1300_5waysw_node, + .properties =3D (const struct property_entry[]){ + PROPERTY_ENTRY_U32("linux,code", KEY_ENTER), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_WAKE1, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-push"), + { } + }, +}; + +static const struct software_node * const db1300_5waysw_swnodes[] __initco= nst =3D { + &db1300_5waysw_node, + &db1300_5waysw_down_node, + &db1300_5waysw_up_node, + &db1300_5waysw_right_node, + &db1300_5waysw_left_node, + &db1300_5waysw_push_node, + NULL +}; + +static void __init db1300_5waysw_init(void) +{ + struct platform_device *pd; + int err; =20 -static struct gpio_keys_platform_data db1300_5waysw_data =3D { - .buttons =3D db1300_5waysw_arrowkeys, - .nbuttons =3D ARRAY_SIZE(db1300_5waysw_arrowkeys), - .rep =3D 1, - .name =3D "db1300-5wayswitch", -}; + err =3D software_node_register_node_group(db1300_5waysw_swnodes); + if (err) { + pr_err("failed to register 5waysw software nodes: %d\n", err); + return; + } =20 -static struct platform_device db1300_5waysw_dev =3D { - .name =3D "gpio-keys", - .dev =3D { - .platform_data =3D &db1300_5waysw_data, - }, -}; + pd =3D platform_device_register_full(&(struct platform_device_info){ + .name =3D "gpio-keys", + .id =3D PLATFORM_DEVID_NONE, + .fwnode =3D software_node_fwnode(&db1300_5waysw_node), + }); + err =3D PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create 5waysw device: %d\n", err); +} =20 /**********************************************************************/ =20 @@ -764,9 +826,7 @@ static struct platform_driver db1300_wm97xx_driver =3D { /**********************************************************************/ =20 static struct platform_device *db1300_dev[] __initdata =3D { - &db1300_eth_dev, &db1300_i2c_dev, - &db1300_5waysw_dev, &db1300_nand_dev, &db1300_ide_dev, #ifdef CONFIG_MMC_AU1X @@ -804,8 +864,6 @@ int __init db1300_dev_setup(void) /* * setup board */ - prom_get_ethernet_addr(&db1300_eth_config.mac[0]); - i2c_register_board_info(0, db1300_i2c_devs, ARRAY_SIZE(db1300_i2c_devs)); =20 @@ -848,6 +906,9 @@ int __init db1300_dev_setup(void) swapped =3D bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; db1x_register_norflash(64 << 20, 2, swapped); =20 + db1300_eth_init(); + db1300_5waysw_init(); + return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); } =20 diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1300.h b/arch/mips/in= clude/asm/mach-au1x00/gpio-au1300.h index 43d44f384f97..912534ecb1a4 100644 --- a/arch/mips/include/asm/mach-au1x00/gpio-au1300.h +++ b/arch/mips/include/asm/mach-au1x00/gpio-au1300.h @@ -14,6 +14,9 @@ =20 struct gpio; struct gpio_chip; +struct software_node; + +extern const struct software_node alchemy_gpic_node; =20 /* with the current GPIC design, up to 128 GPIOs are possible. * The only implementation so far is in the Au1300, which has 75 externally --=20 2.53.0.473.g4a7958ca14-goog