{"id":2230913,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2230913/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260430081242.3686993-3-arnd@kernel.org/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/1.1/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260430081242.3686993-3-arnd@kernel.org>","date":"2026-04-30T08:12:41","name":"[v4,2/3,net-next] p54spi: convert to devicetree","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9bdc3ff664501d70fcba6f8a3a07b5649e4948de","submitter":{"id":80402,"url":"http://patchwork.ozlabs.org/api/1.1/people/80402/?format=json","name":"Arnd Bergmann","email":"arnd@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260430081242.3686993-3-arnd@kernel.org/mbox/","series":[{"id":502229,"url":"http://patchwork.ozlabs.org/api/1.1/series/502229/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=502229","date":"2026-04-30T08:12:40","name":"wireless: p54 devicetree conversion","version":4,"mbox":"http://patchwork.ozlabs.org/series/502229/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230913/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230913/checks/","tags":{},"headers":{"Return-Path":"\n <linux-gpio+bounces-35839-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-gpio@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=TIX7oGgI;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-gpio+bounces-35839-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"TIX7oGgI\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5n4V6kjMz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 18:13:46 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id DB4AE300E299\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 08:13:38 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 254613FB7D2;\n\tThu, 30 Apr 2026 08:13:37 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D8DA63E0C59;\n\tThu, 30 Apr 2026 08:13:36 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id B87E6C2BCF4;\n\tThu, 30 Apr 2026 08:13:31 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777536816; cv=none;\n b=CrrjFtcSFChJNhcQXhxBGhq9Rs3vB+n3K14p/dym6mL2JHThNX03jIWigm3HYjBhP5RG0VEUyUAUOfPV7bZtDbTEKbGIgHokv8ic+4P3+TVo6zG5z2WxIyEqyug9Sn6HHUWzt8fVjfQ6w5MQwu5fiBRFdi5fzZkXqiBCfKKTqDI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777536816; c=relaxed/simple;\n\tbh=UDO9PHehQnypMjnJlo8cn6iBwgvSNTuA16WGm72hd6A=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=Kv5pry7CAVvCEfTeyJ1ASKK7Lpz7B8Z9NDOCqG/zKFmXVBk9aUVqCn4F/N6zehm/AeP9Z7iSEIeFAUrjaJcI9dmwYsJjhXrRJx4LoSCNKL7wWjCCsSxsWdB7Fg35FZ+ALlvJaNGOAywgSrSlOR8sy5dLrG9J6yoLqbv9kVzHQD8=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=TIX7oGgI; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777536816;\n\tbh=UDO9PHehQnypMjnJlo8cn6iBwgvSNTuA16WGm72hd6A=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TIX7oGgILQl5jUe2jjao+UiIR0yiQfBgzpAyVIe7eGotzXM7xWMbYZGZD5H+Cw2BB\n\t FqEEpiv98xQ0hC44DxEdCCTCFksTD2qb0CjziSeo1+RmX0GR2+1Tj9XHpYrv7iDi+y\n\t +lAjhcnEzFFDRJHGnyJ3aJafxlrJyLRn0atQ92irfQf68esmkdZQBAUAxVWvkcTeXF\n\t vRoSw8eWFCRxqCrnim5SHHQMSO7Rhi7WyvWnmZXHMLrqPAodt30WRTdgS7sldtJ5/Q\n\t 5m+yLwjgtqIZD0N1P8FmxQjEaUnO9tLkL4uLPDPpZOGzp5yGjZ/1aBrchxJWCv1Z69\n\t cCRckfWweiyiw==","From":"Arnd Bergmann <arnd@kernel.org>","To":"netdev@vger.kernel.org","Cc":"Arnd Bergmann <arnd@arndb.de>, \"Aaro Koskinen\" <aaro.koskinen@iki.fi>,\n \"Andreas Kemnade\" <andreas@kemnade.info>,\n \"Bartosz Golaszewski\" <brgl@kernel.org>,\n =?utf-8?q?Beno=C3=AEt_Cousson?= <bcousson@baylibre.com>,\n \"David S. Miller\" <davem@davemloft.net>,\n \"Dmitry Torokhov\" <dmitry.torokhov@gmail.com>,\n \"Eric Dumazet\" <edumazet@google.com>, \"Felipe Balbi\" <balbi@kernel.org>,\n \"Jakub Kicinski\" <kuba@kernel.org>,\n \"Johannes Berg\" <johannes@sipsolutions.net>,\n \"Kevin Hilman\" <khilman@baylibre.com>,\n \"Krzysztof Kozlowski\" <krzk+dt@kernel.org>,\n \"Linus Walleij\" <linusw@kernel.org>, \"Paolo Abeni\" <pabeni@redhat.com>,\n \"Rob Herring\" <robh+dt@kernel.org>, \"Roger Quadros\" <rogerq@kernel.org>,\n \"Tony Lindgren\" <tony@atomide.com>, linux-wireless@vger.kernel.org,\n devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,\n linux-omap@vger.kernel.org, Christian Lamparter <chunkeey@gmail.com>","Subject":"[PATCH v4 2/3 net-next] p54spi: convert to devicetree","Date":"Thu, 30 Apr 2026 10:12:41 +0200","Message-Id":"<20260430081242.3686993-3-arnd@kernel.org>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20260430081242.3686993-1-arnd@kernel.org>","References":"<20260430081242.3686993-1-arnd@kernel.org>","Precedence":"bulk","X-Mailing-List":"linux-gpio@vger.kernel.org","List-Id":"<linux-gpio.vger.kernel.org>","List-Subscribe":"<mailto:linux-gpio+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-gpio+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"From: Arnd Bergmann <arnd@arndb.de>\n\nThe Prism54 SPI driver hardcodes GPIO numbers and expects users to\npass them as module parameters, apparently a relic from its life as a\nstaging driver. This works because there is only one user, the Nokia\nN8x0 tablet.\n\nConvert this to the gpio descriptor interface and DT based probing\nto improve this and simplify the code at the same time.\n\nAcked-by: Christian Lamparter <chunkeey@gmail.com>\nSigned-off-by: Arnd Bergmann <arnd@arndb.de>\n---\nv4:\n - make gpio line optional again\n - fix EPROBE_DEFER handling\n - match only st,stlc4560 compatible value, with binding change\n\nv3:\n - rebase an older patch\n---\n arch/arm/mach-omap2/board-n8x0.c           | 18 ------\n drivers/net/wireless/intersil/p54/p54spi.c | 66 ++++++++--------------\n drivers/net/wireless/intersil/p54/p54spi.h |  3 +\n 3 files changed, 25 insertions(+), 62 deletions(-)","diff":"diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c\nindex 969265d5d5c6..d9acd32c5457 100644\n--- a/arch/arm/mach-omap2/board-n8x0.c\n+++ b/arch/arm/mach-omap2/board-n8x0.c\n@@ -20,7 +20,6 @@\n #include <linux/spi/spi.h>\n #include <linux/usb/musb.h>\n #include <linux/mmc/host.h>\n-#include <linux/platform_data/spi-omap2-mcspi.h>\n #include <linux/platform_data/mmc-omap.h>\n #include <linux/mfd/menelaus.h>\n \n@@ -106,21 +105,6 @@ static void __init n8x0_usb_init(void) {}\n \n #endif /*CONFIG_USB_MUSB_TUSB6010 */\n \n-\n-static struct omap2_mcspi_device_config p54spi_mcspi_config = {\n-\t.turbo_mode\t= 0,\n-};\n-\n-static struct spi_board_info n800_spi_board_info[] __initdata = {\n-\t{\n-\t\t.modalias\t= \"p54spi\",\n-\t\t.bus_num\t= 2,\n-\t\t.chip_select\t= 0,\n-\t\t.max_speed_hz   = 48000000,\n-\t\t.controller_data = &p54spi_mcspi_config,\n-\t},\n-};\n-\n #if defined(CONFIG_MENELAUS) && IS_ENABLED(CONFIG_MMC_OMAP)\n \n /*\n@@ -524,7 +508,5 @@ omap_late_initcall(n8x0_late_initcall);\n void * __init n8x0_legacy_init(void)\n {\n \tboard_check_revision();\n-\tspi_register_board_info(n800_spi_board_info,\n-\t\t\t\tARRAY_SIZE(n800_spi_board_info));\n \treturn &mmc1_data;\n }\ndiff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wireless/intersil/p54/p54spi.c\nindex 9d66dcae54e0..806761580759 100644\n--- a/drivers/net/wireless/intersil/p54/p54spi.c\n+++ b/drivers/net/wireless/intersil/p54/p54spi.c\n@@ -8,6 +8,7 @@\n  */\n \n #include <linux/module.h>\n+#include <linux/mod_devicetable.h>\n #include <linux/platform_device.h>\n #include <linux/interrupt.h>\n #include <linux/firmware.h>\n@@ -15,7 +16,7 @@\n #include <linux/irq.h>\n #include <linux/spi/spi.h>\n #include <linux/etherdevice.h>\n-#include <linux/gpio.h>\n+#include <linux/gpio/consumer.h>\n #include <linux/slab.h>\n \n #include \"p54spi.h\"\n@@ -30,19 +31,6 @@\n MODULE_FIRMWARE(\"3826.arm\");\n MODULE_FIRMWARE(\"3826.eeprom\");\n \n-/* gpios should be handled in board files and provided via platform data,\n- * but because it's currently impossible for p54spi to have a header file\n- * in include/linux, let's use module parameters for now\n- */\n-\n-static int p54spi_gpio_power = 97;\n-module_param(p54spi_gpio_power, int, 0444);\n-MODULE_PARM_DESC(p54spi_gpio_power, \"gpio number for power line\");\n-\n-static int p54spi_gpio_irq = 87;\n-module_param(p54spi_gpio_irq, int, 0444);\n-MODULE_PARM_DESC(p54spi_gpio_irq, \"gpio number for irq line\");\n-\n static void p54spi_spi_read(struct p54s_priv *priv, u8 address,\n \t\t\t      void *buf, size_t len)\n {\n@@ -262,14 +250,14 @@ static int p54spi_upload_firmware(struct ieee80211_hw *dev)\n \n static void p54spi_power_off(struct p54s_priv *priv)\n {\n-\tdisable_irq(gpio_to_irq(p54spi_gpio_irq));\n-\tgpio_set_value(p54spi_gpio_power, 0);\n+\tdisable_irq(priv->irq);\n+\tgpiod_set_value(priv->gpio_powerdown, 1);\n }\n \n static void p54spi_power_on(struct p54s_priv *priv)\n {\n-\tgpio_set_value(p54spi_gpio_power, 1);\n-\tenable_irq(gpio_to_irq(p54spi_gpio_irq));\n+\tgpiod_set_value(priv->gpio_powerdown, 0);\n+\tenable_irq(priv->irq);\n \n \t/* need to wait a while before device can be accessed, the length\n \t * is just a guess\n@@ -608,31 +596,19 @@ static int p54spi_probe(struct spi_device *spi)\n \t\tgoto err_free;\n \t}\n \n-\tret = gpio_request(p54spi_gpio_power, \"p54spi power\");\n-\tif (ret < 0) {\n-\t\tdev_err(&priv->spi->dev, \"power GPIO request failed: %d\", ret);\n+\tpriv->gpio_powerdown = gpiod_get_optional(&spi->dev, \"powerdown\", GPIOD_OUT_HIGH);\n+\tif (IS_ERR(priv->gpio_powerdown)) {\n+\t\tret = dev_err_probe(&priv->spi->dev, PTR_ERR(priv->gpio_powerdown),\n+\t\t\t\t    \"powerdown GPIO request failed\\n\");\n \t\tgoto err_free;\n \t}\n \n-\tret = gpio_request(p54spi_gpio_irq, \"p54spi irq\");\n-\tif (ret < 0) {\n-\t\tdev_err(&priv->spi->dev, \"irq GPIO request failed: %d\", ret);\n-\t\tgoto err_free_gpio_power;\n-\t}\n-\n-\tgpio_direction_output(p54spi_gpio_power, 0);\n-\tgpio_direction_input(p54spi_gpio_irq);\n-\n-\tret = request_irq(gpio_to_irq(p54spi_gpio_irq),\n-\t\t\t  p54spi_interrupt, IRQF_NO_AUTOEN, \"p54spi\",\n-\t\t\t  priv->spi);\n+\tret = request_irq(spi->irq, p54spi_interrupt, IRQF_NO_AUTOEN, \"p54spi\", priv->spi);\n \tif (ret < 0) {\n \t\tdev_err(&priv->spi->dev, \"request_irq() failed\");\n-\t\tgoto err_free_gpio_irq;\n+\t\tgoto err_free_gpio_power;\n \t}\n \n-\tirq_set_irq_type(gpio_to_irq(p54spi_gpio_irq), IRQ_TYPE_EDGE_RISING);\n-\n \tINIT_WORK(&priv->work, p54spi_work);\n \tinit_completion(&priv->fw_comp);\n \tINIT_LIST_HEAD(&priv->tx_pending);\n@@ -659,11 +635,9 @@ static int p54spi_probe(struct spi_device *spi)\n \n err_free_common:\n \trelease_firmware(priv->firmware);\n-\tfree_irq(gpio_to_irq(p54spi_gpio_irq), spi);\n-err_free_gpio_irq:\n-\tgpio_free(p54spi_gpio_irq);\n+\tfree_irq(priv->irq, spi);\n err_free_gpio_power:\n-\tgpio_free(p54spi_gpio_power);\n+\tgpiod_put(priv->gpio_powerdown);\n err_free:\n \tp54_free_common(priv->hw);\n \treturn ret;\n@@ -675,10 +649,8 @@ static void p54spi_remove(struct spi_device *spi)\n \n \tp54_unregister_common(priv->hw);\n \n-\tfree_irq(gpio_to_irq(p54spi_gpio_irq), spi);\n-\n-\tgpio_free(p54spi_gpio_power);\n-\tgpio_free(p54spi_gpio_irq);\n+\tfree_irq(priv->irq, spi);\n+\tgpiod_put(priv->gpio_powerdown);\n \trelease_firmware(priv->firmware);\n \n \tmutex_destroy(&priv->mutex);\n@@ -686,10 +658,16 @@ static void p54spi_remove(struct spi_device *spi)\n \tp54_free_common(priv->hw);\n }\n \n+static const struct of_device_id p54spi_of_ids[] = {\n+\t{ .compatible = \"st,stlc4560\", },\n+\t{ },\n+};\n+MODULE_DEVICE_TABLE(of, p54spi_of_ids);\n \n static struct spi_driver p54spi_driver = {\n \t.driver = {\n \t\t.name\t\t= \"p54spi\",\n+\t\t.of_match_table = p54spi_of_ids,\n \t},\n \n \t.probe\t\t= p54spi_probe,\ndiff --git a/drivers/net/wireless/intersil/p54/p54spi.h b/drivers/net/wireless/intersil/p54/p54spi.h\nindex e5619a13fd61..118785cc635a 100644\n--- a/drivers/net/wireless/intersil/p54/p54spi.h\n+++ b/drivers/net/wireless/intersil/p54/p54spi.h\n@@ -107,6 +107,9 @@ struct p54s_priv {\n \n \tenum fw_state fw_state;\n \tconst struct firmware *firmware;\n+\n+\tstruct gpio_desc *gpio_powerdown;\n+\tint irq;\n };\n \n #endif /* P54SPI_H */\n","prefixes":["v4","2/3","net-next"]}