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