Message ID | 20240213-wilc_1000_reset_line-v1-1-e01da2b23fed@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63797-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp610882dyb; Tue, 13 Feb 2024 07:25:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWwp5ZED06DhCrmTctwSw9MwUL74vvUDqjBmHNP88eTz36xit0B0A+X8vcNypZnV21tcVjS7/+XEeJ99XSliPYkK3Putw== X-Google-Smtp-Source: AGHT+IGsGjGk9nozpf1bUdhWnUjIvaJWz2y/zlqgYwrpRnO/h3yK7VmGiD/1juyYDmjDQDNX+ZjV X-Received: by 2002:a05:6402:1608:b0:561:212a:114 with SMTP id f8-20020a056402160800b00561212a0114mr7417214edv.32.1707837916984; Tue, 13 Feb 2024 07:25:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707837916; cv=pass; d=google.com; s=arc-20160816; b=i/Ck//tRyi3ER1MS+81grm8SjhnZFI+o8XTfLfTO6Bd4NyFzHS6V8lSVzRyhV3JenK 8QfeqLKqcFVLUwLafOboz93RQkwiGhQTXFxAJZmOyWyOCOEFMIUxp00/aepTvo1hqus5 6TI17xl2VaUOJRZU+GDLsfALhno7XPMIMl3tS3spb/rvWgk2FXVLXcy+olluMbY/qXKu doH+iKITIXAhbmTfYvGWFAgz1hDPz7LjXE0tYrtBsoypHhifoZhDpQqon/rbTawqKZu2 Iz8VeE87NgT7r6c16ePe/gvKg2BdfMoCigvKVWeersBqqFUGtr8iBOLNmrWLTt2zqPWC HTXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=52cY2LUgFu15OCe72LM2FQu+S39du9WmCDQ8io2kZ8M=; fh=uHua52hSiuSfsiIbHwXzJe7HPKAuKVkWV5fZYyuN708=; b=UyaUCkNNUTVxXwkaXQPYeImMC7qu+RfoPA+rYFatEdIxDVeCVCtqgp2SB+PSZBe4OT gD22dgmjx1ZNiJC81Q+qaTrIt0o1tZ4CcMwNBDVYxICiKqfbli17PWI1y3Un/K2J79Eq 6bYP7LvmSAKbjxRfA56+2uZtRn3B7fqLI7uUTaO8EdkXL9UjUL3ClvkNP/HqHtW8cfn/ Y9oKPE2jZAx7yoq9UHksv01TV9oO8/rTE23N7hZOeeEKDV7RFY9JGic/Dqpwxy0OjXCs wTPuI1DsIOOjgqgB7muFeAUyxKWEEc7IJX3FECvCuvVOuDGjpzbUV/EESJnsgDobvh9j jCxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="kfaq/68N"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-63797-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63797-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCXLPpfPnGmufzilOM5yCVxz+T7yr5JOtYllmWi5Hq310+ITmpvmbQve1aBic+aJHig0hPhio8prxFef3nPAycy9DObNCA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y24-20020aa7d518000000b00561401d1f68si3692108edq.574.2024.02.13.07.25.16 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:25:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63797-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="kfaq/68N"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-63797-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63797-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 94CBE1F23A73 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 15:25:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEDB55EE87; Tue, 13 Feb 2024 15:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kfaq/68N" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B25045D902; Tue, 13 Feb 2024 15:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707837888; cv=none; b=f4TYqgQfFRuHcwvoFnEssnJ6jzpOmCQBj9M5qGovxCowOdgI3i8I5HlNlaF0BrddMd5bFzXySqFJRnR7os8Ox9WuDE53DTU8+FH6TYNG2bHyTYYEs5OH6ulrR3CVc2Z1zK6qGIYTV3/e2ouANOW8kLW+2r5FKc4s66egxPuQSA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707837888; c=relaxed/simple; bh=ZRse6JczO8c8briiSuR06UnfYpScvqAmNKuKcNSxv4E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=s+huxKBTuACenrk7I5H9LRQkclTGti4Kn72BePFoJ9jX92c4IINTp1hOO0S4RADMbnh72S7UaRidWAcqQkOU2mQH8bIq32ThdIGe5KwrZYWK3/pMm9WGJtqidqs83jF0di/rKtnpHg6VufadyI9+2aI6kP4y7nLy7qZJsJT7jxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kfaq/68N; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C49012000B; Tue, 13 Feb 2024 15:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707837877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=52cY2LUgFu15OCe72LM2FQu+S39du9WmCDQ8io2kZ8M=; b=kfaq/68NzMwiXUkSTseCvfYIiL4b4bIu5M5IexBkVGXzeSEmz1ghDU6VPuKXiseIpxTfgm OX6X86yQEKg3JgHyYBq5oDJ4OzDJM21V6yGD4BUOdbgbqSUHilpQAr/kgPe/uQzcXkmfMW TWllHo+DBBJjAIskfwiu6GvrKkigwvYgeiBvPIsEijh2zu9NsyvORI/AAzZT/XG/iA6PVE vXmzpmaPhgYjsUm7g7bqNz2syNx0S9Go4hlOJP6I+qL+iRR8NzQiNF1+grwWirAvm0+rxj L/4iU5xiIcVO73t9ELMpD6XOGyZTzaH9pRnWZyUrGIkckJNM5+Bva5gD/vqg7g== From: =?utf-8?q?Alexis_Lothor=C3=A9?= <alexis.lothore@bootlin.com> Date: Tue, 13 Feb 2024 16:22:44 +0100 Subject: [PATCH RFC] wifi: wilc1000: fix reset line assert/deassert polarity Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240213-wilc_1000_reset_line-v1-1-e01da2b23fed@bootlin.com> X-B4-Tracking: v=1; b=H4sIAEOJy2UC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDQ0NL3fLMnOR4QwMDg/ii1OLUkviczLxUXWNLYyNzg7RkE3OTVCWg1oK i1LTMCrCx0UpBbs5KsbW1AK54SQtrAAAA To: linux-wireless@vger.kernel.org Cc: Ajay Singh <ajay.kathat@microchip.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev>, Kalle Valo <kvalo@kernel.org>, David Mosberger-Tang <davidm@egauge.net>, Thomas Petazzoni <thomas.petazzoni@bootlin.com>, linux-kernel@vger.kernel.org, =?utf-8?q?Alexis_Lothor=C3=A9?= <alexis.lothore@bootlin.com> X-Mailer: b4 0.12.4 X-GND-Sasl: alexis.lothore@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790797851554382474 X-GMAIL-MSGID: 1790797851554382474 |
Series |
[RFC] wifi: wilc1000: fix reset line assert/deassert polarity
|
|
Commit Message
Alexis Lothoré
Feb. 13, 2024, 3:22 p.m. UTC
When using a wilc1000 chip over a spi bus, users can optionally define a
reset gpio and a chip enable gpio. The reset line of wilc1000 is active
low, so to hold the chip in reset, a low (physical) value must be applied.
The corresponding device tree binding documentation was introduced by
commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios
properties") and correctly indicates that the reset line is an active-low
signal. However, the corresponding driver part, brought by commit
ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is
misusing the gpiod APIs and apply an inverted logic when powering up/down
the chip (for example, setting the reset line to a logic "1" during power
up, which in fact asserts the reset line when device tree describes the
reset line as GPIO_ACTIVE_LOW). As a consequence, any platform currently
using the driver in SPI mode must use a faulty reset line description in
device tree, or else chip will be maintained in reset and will not even
allow to bring up the chip.
Fix reset line usage by inverting back the gpiod APIs usage, setting the
reset line to the logic value "0" when powering the chip, and the logic
value "1" when powering off the chip.
Fixes: ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver")
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
This issue was detected because I struggled a bit to setup a WILC-over-SPI
setup, and eventually realized that it was due to chip being hold in reset.
This patch, if accepted, will force any WILC-over-SPI user to update its
device tree description: any platform currently working correctly in this
setup likely have a wrong GPIO_ACTIVE_HIGH used on the reset line device
tree description, contrary to what the documentation says. I am not sure
whether this is tolerable ? If not, what would be the proper way to fix
this ? Make the driver manually parse this flag and somehow make it able
to deal with both versions (so basically: ignoring the setting) ? Just live
with it, and possibly document the issue somewhere ?
---
drivers/net/wireless/microchip/wilc1000/spi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 246a8c611ace197f43ecc6ea4936c6ca363b8aaa
change-id: 20240119-wilc_1000_reset_line-393270fc474e
Best regards,
Comments
On Tue, 2024-02-13 at 16:22 +0100, Alexis Lothoré wrote: > When using a wilc1000 chip over a spi bus, users can optionally define a > reset gpio and a chip enable gpio. The reset line of wilc1000 is active > low, so to hold the chip in reset, a low (physical) value must be applied. > > The corresponding device tree binding documentation was introduced by > commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios > properties") and correctly indicates that the reset line is an active-low > signal. However, the corresponding driver part, brought by commit > ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is > misusing the gpiod APIs and apply an inverted logic when powering up/down > the chip (for example, setting the reset line to a logic "1" during power > up, which in fact asserts the reset line when device tree describes the > reset line as GPIO_ACTIVE_LOW). Note that commit ec031ac4792c is doing the right thing in regards to an ACTIVE_LOW RESET pin and the binding documentation is consistent with that code. It was later on that commit fcf690b0 flipped the RESET line polarity to treat it as GPIO_ACTIVE_HIGH. I never understood why that was done and, as you noted, it introduced in inconsistency with the binding documentation. On our platform, we never merged commit fcf690b0 and hence our DTS already defines the RESET pin as GPIO_ACTIVE_LOW. So, I don't have any issues at all with your patch! :-) --david gi
On 2/13/24 17:42, David Mosberger-Tang wrote: > On Tue, 2024-02-13 at 16:22 +0100, Alexis Lothoré wrote: >> When using a wilc1000 chip over a spi bus, users can optionally define a >> reset gpio and a chip enable gpio. The reset line of wilc1000 is active >> low, so to hold the chip in reset, a low (physical) value must be applied. >> >> The corresponding device tree binding documentation was introduced by >> commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios >> properties") and correctly indicates that the reset line is an active-low >> signal. However, the corresponding driver part, brought by commit >> ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is >> misusing the gpiod APIs and apply an inverted logic when powering up/down >> the chip (for example, setting the reset line to a logic "1" during power >> up, which in fact asserts the reset line when device tree describes the >> reset line as GPIO_ACTIVE_LOW). > > Note that commit ec031ac4792c is doing the right thing in regards to an > ACTIVE_LOW RESET pin and the binding documentation is consistent with that code. > > It was later on that commit fcf690b0 flipped the RESET line polarity to treat it > as GPIO_ACTIVE_HIGH. I never understood why that was done and, as you noted, it > introduced in inconsistency with the binding documentation. Ah, you are right, and I was wrong citing your GPIOs patch as faulty (git-blaming too fast !), thanks for the clarification. I missed this patch from Ajay (fcf690b0) flipping the reset logic. Maybe he had issues while missing proper device tree configuration and then submitted this flip ? > On our platform, we never merged commit fcf690b0 and hence our DTS already > defines the RESET pin as GPIO_ACTIVE_LOW. So, I don't have any issues at all > with your patch! :-) So in the end, the patch should be about a mere revert. I will update accordingly when relevant, but before that I'll wait for some feedback about the potential issue of this patch (forcing users to udpate faulty devicetree) Thanks, Alexis
Hi, On 2/13/24 09:58, Alexis Lothoré wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On 2/13/24 17:42, David Mosberger-Tang wrote: >> On Tue, 2024-02-13 at 16:22 +0100, Alexis Lothoré wrote: >>> When using a wilc1000 chip over a spi bus, users can optionally define a >>> reset gpio and a chip enable gpio. The reset line of wilc1000 is active >>> low, so to hold the chip in reset, a low (physical) value must be applied. >>> >>> The corresponding device tree binding documentation was introduced by >>> commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios >>> properties") and correctly indicates that the reset line is an active-low >>> signal. However, the corresponding driver part, brought by commit >>> ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is >>> misusing the gpiod APIs and apply an inverted logic when powering up/down >>> the chip (for example, setting the reset line to a logic "1" during power >>> up, which in fact asserts the reset line when device tree describes the >>> reset line as GPIO_ACTIVE_LOW). >> >> Note that commit ec031ac4792c is doing the right thing in regards to an >> ACTIVE_LOW RESET pin and the binding documentation is consistent with that code. >> >> It was later on that commit fcf690b0 flipped the RESET line polarity to treat it >> as GPIO_ACTIVE_HIGH. I never understood why that was done and, as you noted, it >> introduced in inconsistency with the binding documentation. > > Ah, you are right, and I was wrong citing your GPIOs patch as faulty > (git-blaming too fast !), thanks for the clarification. I missed this patch from > Ajay (fcf690b0) flipping the reset logic. Maybe he had issues while missing > proper device tree configuration and then submitted this flip ? Indeed, it was done to align the code as per the DT entry suggested in WILC1000/3000 porting guide[1 -page 18], which is already used by most of the existing users. This change has impact on the users who are using DT entry from porting guide. One approach is to retain the current code and document this if needed. 1. https://ww1.microchip.com/downloads/en/DeviceDoc/ATWILC1000-ATWILC3000-ATWILC-Devices-Linux-Porting-Guide-User-Guide-DS70005329C.pdf Regards, Ajay
(Adding devicetree list for comments) <Ajay.Kathat@microchip.com> writes: > On 2/13/24 09:58, Alexis Lothoré wrote: >> >> On 2/13/24 17:42, David Mosberger-Tang wrote: >>> On Tue, 2024-02-13 at 16:22 +0100, Alexis Lothoré wrote: >>>> When using a wilc1000 chip over a spi bus, users can optionally define a >>>> reset gpio and a chip enable gpio. The reset line of wilc1000 is active >>>> low, so to hold the chip in reset, a low (physical) value must be applied. >>>> >>>> The corresponding device tree binding documentation was introduced by >>>> commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios >>>> properties") and correctly indicates that the reset line is an active-low >>>> signal. However, the corresponding driver part, brought by commit >>>> ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is >>>> misusing the gpiod APIs and apply an inverted logic when powering up/down >>>> the chip (for example, setting the reset line to a logic "1" during power >>>> up, which in fact asserts the reset line when device tree describes the >>>> reset line as GPIO_ACTIVE_LOW). >>> >>> Note that commit ec031ac4792c is doing the right thing in regards to an >>> ACTIVE_LOW RESET pin and the binding documentation is consistent with that code. >>> >>> It was later on that commit fcf690b0 flipped the RESET line polarity to treat it >>> as GPIO_ACTIVE_HIGH. I never understood why that was done and, as you noted, it >>> introduced in inconsistency with the binding documentation. >> >> Ah, you are right, and I was wrong citing your GPIOs patch as faulty >> (git-blaming too fast !), thanks for the clarification. I missed this patch from >> Ajay (fcf690b0) flipping the reset logic. Maybe he had issues while missing >> proper device tree configuration and then submitted this flip ? > > Indeed, it was done to align the code as per the DT entry suggested in > WILC1000/3000 porting guide[1 -page 18], which is already used by most > of the existing users. This change has impact on the users who are using > DT entry from porting guide. One approach is to retain the current code > and document this if needed. So if I'm understanding the situation correctly Microchip's porting guide[1] doesn't match with kernel.org documentation[2]? I'm not the expert here but from my point of view the issue is clear: the code needs to follow kernel.org documentation[2], not external documentation. I'll add devicetree list so hopefully people there can comment also, full patch available in [3]. Alexis, if there are no more comments I'm in favor submitting the revert you mentioned. [1] https://ww1.microchip.com/downloads/en/DeviceDoc/ATWILC1000-ATWILC3000-ATWILC-Devices-Linux-Porting-Guide-User-Guide-DS70005329C.pdf [2] Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml [3] https://patchwork.kernel.org/project/linux-wireless/patch/20240213-wilc_1000_reset_line-v1-1-e01da2b23fed@bootlin.com/
On Fri, Feb 16, 2024 at 06:01:52PM +0200, Kalle Valo wrote: > (Adding devicetree list for comments) > > <Ajay.Kathat@microchip.com> writes: > > > On 2/13/24 09:58, Alexis Lothoré wrote: > >> > >> On 2/13/24 17:42, David Mosberger-Tang wrote: > >>> On Tue, 2024-02-13 at 16:22 +0100, Alexis Lothoré wrote: > >>>> When using a wilc1000 chip over a spi bus, users can optionally define a > >>>> reset gpio and a chip enable gpio. The reset line of wilc1000 is active > >>>> low, so to hold the chip in reset, a low (physical) value must be applied. > >>>> > >>>> The corresponding device tree binding documentation was introduced by > >>>> commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios > >>>> properties") and correctly indicates that the reset line is an active-low > >>>> signal. However, the corresponding driver part, brought by commit > >>>> ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is > >>>> misusing the gpiod APIs and apply an inverted logic when powering up/down > >>>> the chip (for example, setting the reset line to a logic "1" during power > >>>> up, which in fact asserts the reset line when device tree describes the > >>>> reset line as GPIO_ACTIVE_LOW). > >>> > >>> Note that commit ec031ac4792c is doing the right thing in regards to an > >>> ACTIVE_LOW RESET pin and the binding documentation is consistent with that code. > >>> > >>> It was later on that commit fcf690b0 flipped the RESET line polarity to treat it > >>> as GPIO_ACTIVE_HIGH. I never understood why that was done and, as you noted, it > >>> introduced in inconsistency with the binding documentation. > >> > >> Ah, you are right, and I was wrong citing your GPIOs patch as faulty > >> (git-blaming too fast !), thanks for the clarification. I missed this patch from > >> Ajay (fcf690b0) flipping the reset logic. Maybe he had issues while missing > >> proper device tree configuration and then submitted this flip ? > > > > Indeed, it was done to align the code as per the DT entry suggested in > > WILC1000/3000 porting guide[1 -page 18], which is already used by most > > of the existing users. This change has impact on the users who are using > > DT entry from porting guide. One approach is to retain the current code > > and document this if needed. > > So if I'm understanding the situation correctly Microchip's porting > guide[1] doesn't match with kernel.org documentation[2]? I'm not the > expert here but from my point of view the issue is clear: the code needs > to follow kernel.org documentation[2], not external documentation. My point of view would definitely be that drivers in the mainline kernel absolutely should respect the ABI defined in the dt-binding. What a vendor decides to do in their own tree I suppose is their problem, but I would advocate that vendor kernels would also respect the ABI from mainline. Looking a bit more closely at the porting guide, it contains other properties that are not present in the dt-binding - undocumented compatibles and a different enable gpio property for example. I guess it (and the vendor version of the driver) never got updated when wilc1000 supported landed in mainline? > I'll add devicetree list so hopefully people there can comment also, > full patch available in [3]. > > Alexis, if there are no more comments I'm in favor submitting the revert > you mentioned. From a dt-bindings point of view, the aforementioned revert seems correct and would be Acked-by: Conor Dooley <conor.dooley@microchip.com> Getting off my dt-binding maintainer high-horse, linux4microchip is going be updating to a 6.6 based kernel in the coming weeks - maybe that's a good time to update the vendor kernel wilc drivers (and therefore the porting guide?) to match the properties used by mainline Ajay? Cheers, Conor.
On Fri, Feb 16, 2024 at 04:54:29PM +0000, Conor Dooley wrote: > On Fri, Feb 16, 2024 at 06:01:52PM +0200, Kalle Valo wrote: > > (Adding devicetree list for comments) > > > > <Ajay.Kathat@microchip.com> writes: > > > > > On 2/13/24 09:58, Alexis Lothoré wrote: > > >> > > >> On 2/13/24 17:42, David Mosberger-Tang wrote: > > >>> On Tue, 2024-02-13 at 16:22 +0100, Alexis Lothoré wrote: > > >>>> When using a wilc1000 chip over a spi bus, users can optionally define a > > >>>> reset gpio and a chip enable gpio. The reset line of wilc1000 is active > > >>>> low, so to hold the chip in reset, a low (physical) value must be applied. > > >>>> > > >>>> The corresponding device tree binding documentation was introduced by > > >>>> commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios > > >>>> properties") and correctly indicates that the reset line is an active-low > > >>>> signal. However, the corresponding driver part, brought by commit > > >>>> ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver"), is > > >>>> misusing the gpiod APIs and apply an inverted logic when powering up/down > > >>>> the chip (for example, setting the reset line to a logic "1" during power > > >>>> up, which in fact asserts the reset line when device tree describes the > > >>>> reset line as GPIO_ACTIVE_LOW). > > >>> > > >>> Note that commit ec031ac4792c is doing the right thing in regards to an > > >>> ACTIVE_LOW RESET pin and the binding documentation is consistent with that code. > > >>> > > >>> It was later on that commit fcf690b0 flipped the RESET line polarity to treat it > > >>> as GPIO_ACTIVE_HIGH. I never understood why that was done and, as you noted, it > > >>> introduced in inconsistency with the binding documentation. > > >> > > >> Ah, you are right, and I was wrong citing your GPIOs patch as faulty > > >> (git-blaming too fast !), thanks for the clarification. I missed this patch from > > >> Ajay (fcf690b0) flipping the reset logic. Maybe he had issues while missing > > >> proper device tree configuration and then submitted this flip ? > > > > > > Indeed, it was done to align the code as per the DT entry suggested in > > > WILC1000/3000 porting guide[1 -page 18], which is already used by most > > > of the existing users. This change has impact on the users who are using > > > DT entry from porting guide. One approach is to retain the current code > > > and document this if needed. > > > > So if I'm understanding the situation correctly Microchip's porting > > guide[1] doesn't match with kernel.org documentation[2]? I'm not the > > expert here but from my point of view the issue is clear: the code needs > > to follow kernel.org documentation[2], not external documentation. > > My point of view would definitely be that drivers in the mainline kernel > absolutely should respect the ABI defined in the dt-binding. What a vendor > decides to do in their own tree I suppose is their problem, but I would > advocate that vendor kernels would also respect the ABI from mainline. > > Looking a bit more closely at the porting guide, it contains other > properties that are not present in the dt-binding - undocumented > compatibles and a different enable gpio property for example. > I guess it (and the vendor version of the driver) never got updated when > wilc1000 supported landed in mainline? > > > I'll add devicetree list so hopefully people there can comment also, > > full patch available in [3]. > > > > Alexis, if there are no more comments I'm in favor submitting the revert > > you mentioned. > > From a dt-bindings point of view, the aforementioned revert seems > correct and would be > Acked-by: Conor Dooley <conor.dooley@microchip.com> Maybe an R-b is more suitable here, too used to acking trivial patches that are dt related.. > > Getting off my dt-binding maintainer high-horse, linux4microchip is going > be updating to a 6.6 based kernel in the coming weeks - maybe that's a > good time to update the vendor kernel wilc drivers (and therefore the > porting guide?) to match the properties used by mainline Ajay? > > Cheers, > Conor.
Conor Dooley <conor@kernel.org> writes: >> > So if I'm understanding the situation correctly Microchip's porting >> > guide[1] doesn't match with kernel.org documentation[2]? I'm not the >> > expert here but from my point of view the issue is clear: the code needs >> > to follow kernel.org documentation[2], not external documentation. >> >> My point of view would definitely be that drivers in the mainline kernel >> absolutely should respect the ABI defined in the dt-binding. What a vendor >> decides to do in their own tree I suppose is their problem, but I would >> advocate that vendor kernels would also respect the ABI from mainline. >> >> Looking a bit more closely at the porting guide, it contains other >> properties that are not present in the dt-binding - undocumented >> compatibles and a different enable gpio property for example. >> I guess it (and the vendor version of the driver) never got updated when >> wilc1000 supported landed in mainline? >> >> > I'll add devicetree list so hopefully people there can comment also, >> > full patch available in [3]. >> > >> > Alexis, if there are no more comments I'm in favor submitting the revert >> > you mentioned. >> >> From a dt-bindings point of view, the aforementioned revert seems >> correct and would be >> Acked-by: Conor Dooley <conor.dooley@microchip.com> > > Maybe an R-b is more suitable here, too used to acking trivial patches > that are dt related.. On the contrary, I think Acked-by is the right thing here and makes it easier for Alexis and me. Thanks!
On 2/16/24 11:07, Kalle Valo wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > Conor Dooley <conor@kernel.org> writes: > >>>> So if I'm understanding the situation correctly Microchip's porting >>>> guide[1] doesn't match with kernel.org documentation[2]? I'm not the >>>> expert here but from my point of view the issue is clear: the code needs >>>> to follow kernel.org documentation[2], not external documentation. >>> >>> My point of view would definitely be that drivers in the mainline kernel >>> absolutely should respect the ABI defined in the dt-binding. What a vendor >>> decides to do in their own tree I suppose is their problem, but I would >>> advocate that vendor kernels would also respect the ABI from mainline. >>> >>> Looking a bit more closely at the porting guide, it contains other >>> properties that are not present in the dt-binding - undocumented >>> compatibles and a different enable gpio property for example. >>> I guess it (and the vendor version of the driver) never got updated when >>> wilc1000 supported landed in mainline? >>> >>>> I'll add devicetree list so hopefully people there can comment also, >>>> full patch available in [3]. >>>> >>>> Alexis, if there are no more comments I'm in favor submitting the revert >>>> you mentioned. >>> >>> From a dt-bindings point of view, the aforementioned revert seems >>> correct and would be >>> Acked-by: Conor Dooley <conor.dooley@microchip.com> >> >> Maybe an R-b is more suitable here, too used to acking trivial patches >> that are dt related.. > > On the contrary, I think Acked-by is the right thing here and makes it > easier for Alexis and me. Thanks! Acked-by: Ajay Singh <ajay.kathat@microchip.com> Agree, we can go ahead with this patch to make the code inline with kernel.org documentation. I don't think any change is required in dt-binding definition after this patch. However external documentation update is needed as Conor has also pointed out, I will be taking care of it. Regards, Ajay
diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c index c92ee4b73a74..30eed2ea523d 100644 --- a/drivers/net/wireless/microchip/wilc1000/spi.c +++ b/drivers/net/wireless/microchip/wilc1000/spi.c @@ -192,11 +192,11 @@ static void wilc_wlan_power(struct wilc *wilc, bool on) /* assert ENABLE: */ gpiod_set_value(gpios->enable, 1); mdelay(5); - /* assert RESET: */ - gpiod_set_value(gpios->reset, 1); - } else { /* deassert RESET: */ gpiod_set_value(gpios->reset, 0); + } else { + /* assert RESET: */ + gpiod_set_value(gpios->reset, 1); /* deassert ENABLE: */ gpiod_set_value(gpios->enable, 0); }