{"id":2228948,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228948/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260427142355.2532714-4-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":"<20260427142355.2532714-4-arnd@kernel.org>","date":"2026-04-27T14:23:55","name":"[v3,3/3] p54spi: convert to devicetree","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"06741a73d7afa8d1e2dcec8a954954f56a32ab07","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/20260427142355.2532714-4-arnd@kernel.org/mbox/","series":[{"id":501659,"url":"http://patchwork.ozlabs.org/api/1.1/series/501659/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=501659","date":"2026-04-27T14:23:54","name":"wireless: p54 devicetree conversion","version":3,"mbox":"http://patchwork.ozlabs.org/series/501659/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228948/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228948/checks/","tags":{},"headers":{"Return-Path":"\n <linux-gpio+bounces-35591-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=uGdsR4+k;\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-35591-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=\"uGdsR4+k\"","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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g45Vd3XTRz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 00:27:05 +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 0C7A730275E4\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 14:24:57 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 441923D5235;\n\tMon, 27 Apr 2026 14:24:22 +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 0077C3D47B8;\n\tMon, 27 Apr 2026 14:24:21 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 9F4C4C2BCC4;\n\tMon, 27 Apr 2026 14:24:16 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777299862; cv=none;\n b=kE2z9OTXg3VcoI35IkyO+LTMJOyaK3PtlMm7ju9WarMDOUqdsvm0GAYw0dRz5/Iz13sWTgIBB2anQayteYVb6AVPp+nAIicGuhze727KyCbcQKpp/kqH1CMPTx5GOlbks/7OM6UrDRNBKmJd3FlUMPMPG0ijlG5q28DmPsyv934=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777299862; c=relaxed/simple;\n\tbh=5vHeUD4XDO+jrNf3SjbxNwWzSv6HWIWXWuo72nUC1JI=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=XTEo+3K4qvj/Qw5PgD824LchE2hGsvkB/JHOROIci38DLc5hq+pQ6T1zwxe55bdaRQyRC0Cw3YpF+YU4WY7uhyPO1PU2CJOjPAAkAihpD/PmbjK2CpBXkgxndCqPdYXKCyvbD7bLmD2sBHbDL8El6OO6UUilzifla/QZVQWHP9U=","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=uGdsR4+k; 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=1777299861;\n\tbh=5vHeUD4XDO+jrNf3SjbxNwWzSv6HWIWXWuo72nUC1JI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=uGdsR4+k3FvnnYnvX3Y8UhtjVufTKOlRn85hY5P7E9hwpr3x3DRbxCttv2TDtdkMC\n\t UZBGTe8kwF1BBuT+Rk8dj3YxZ7hcEMWHn3RZ2E35/Igo/CaXdbC8fANsB7mH+rKLkb\n\t fjm8htxAkvo46HqYmaN+ZUCW7/DeEHD7hkXKPJP/trr3Fsf0pYfh+w/aRK9YuYhtgr\n\t ue73ltKQMJqkuDpyG6xB9V7mVUy303EhLF5iJFMY0kV/XSr1p86aoTUeQInQPIaC+R\n\t 2wtwquWyoYCKsrMS4MKjF7S987ZTRy66tm0UjHpMiDgYFAytkx472Rjo/Udnownd7r\n\t tog962DDwol7w==","From":"Arnd Bergmann <arnd@kernel.org>","To":"","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 netdev@vger.kernel.org, devicetree@vger.kernel.org,\n linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org,\n Christian Lamparter <chunkeey@gmail.com>","Subject":"[PATCH v3 3/3] p54spi: convert to devicetree","Date":"Mon, 27 Apr 2026 16:23:55 +0200","Message-Id":"<20260427142355.2532714-4-arnd@kernel.org>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20260427142355.2532714-1-arnd@kernel.org>","References":"<20260427142355.2532714-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---\n arch/arm/mach-omap2/board-n8x0.c           | 18 ------\n drivers/net/wireless/intersil/p54/p54spi.c | 68 ++++++++--------------\n drivers/net/wireless/intersil/p54/p54spi.h |  3 +\n 3 files changed, 28 insertions(+), 61 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..1cda3b42b5d7 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,30 +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(&spi->dev, \"powerdown\", GPIOD_OUT_HIGH);\n+\tif (IS_ERR(priv->gpio_powerdown)) {\n+\t\tret = PTR_ERR(priv->gpio_powerdown);\n+\t\tdev_err(&priv->spi->dev, \"powerdown GPIO request failed: %d\", ret);\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@@ -659,11 +636,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 +650,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 +659,19 @@ static void p54spi_remove(struct spi_device *spi)\n \tp54_free_common(priv->hw);\n }\n \n+struct of_device_id p54spi_of_ids[] = {\n+\t{ .compatible = \"cnxt,3110x\", },\n+\t{ .compatible = \"isil,p54spi\", },\n+\t{ .compatible = \"st,stlc4550\", },\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":["v3","3/3"]}