From nobody Sun Apr 5 15:34:33 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