Message ID | 20240213-realtek-reset-v3-0-37837e574713@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-64620-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp908694dyb; Tue, 13 Feb 2024 17:02:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUszrKZQ9Lq49nLEq73LvVizSUqDLaSVg87nNb+T3OG1oC1ygQDuXvHEekNJD7iRt30j4jgSNu0MxWXrhusYSWb2k1aLQ== X-Google-Smtp-Source: AGHT+IFQq2V3AK0f/RsL3kOTGJzxxhIivWiqTTsE+SszLfk7ASSkWSUhNVO1gx4Z20xXTxY+sagd X-Received: by 2002:a05:6a21:151b:b0:1a0:61e4:a952 with SMTP id nq27-20020a056a21151b00b001a061e4a952mr1445508pzb.11.1707872576234; Tue, 13 Feb 2024 17:02:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707872576; cv=pass; d=google.com; s=arc-20160816; b=MyJ/cGU9zv+1gOW3JJq9b/8WDmh1F1UnBEsVBU4/ZOzR5fgF72FdMgSTrLG+QSCC+j yBcicjNDhdlL4WOQq5y6UMFbWRRcEN8UzlpOH6C2blmxiToCdeORaqNVe7p5vcEhU3Xy qKBIhQuxqNlaNsHijS6Vjv4v44t6VBeC+z1hW/5dlm+WdQ8J4Q5HdplXBj/1EsJpDe9q p+q/qlgM+NKjRJUlsUTSvIhkM5p+iQAPE6iywnm5+FMkUhERPCVT5ZlQz0NwWu+eHoWX wRdCusNak+ww6IoglO+6X5pZ+F+/IjJMmftuVV2PwBmQtYOKDC1igJYJBvz1AOphgfjy yMAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=IRAv5G1mvUWjYBsrE0YtysVB4o7+LEIixKnLnZc8qP4=; fh=CjBzhoEyD3jdCi949aRPwM4xJ3taTaSoVtR81v8hROk=; b=HhvH07mcZ9dxui5MU8RbXJ0JvsW7G7FosA/QLo7YTMP1sZ9bj4UizbWOwjNnL8uro+ mJUy7wreKXU7R7g8sfVhZ/1o4vp94hUQcTWuQsLcu2DCI+LtVjAz9TS6cQ1hYZcYqGWg dVz6ybDta2kygDv0Ti8tcxg5cA2vcyAWWLL+vryZokzdbelNZSgpes0Tu64wmDqTIBp3 fXcZDip5wXdN3fbRUKinJOlK62uNpNMVDtiRqxNAi2+drPOeUh1TXCdrLjt1Nhekg8aZ mBg1WFbvTnkabDPOO4UO+xRVlxkaJgPF5rgBK6wF4QOQc/ETS27xE9zIVDatAjR3WXzS UfIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EyI55Nnc; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-64620-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64620-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCUb2abps+5KSjewVDuh0WBbGm77jBOfLRq2SbC9quKXNrAJJ/bx8qOsl3QwA9KRrSA7lGbpplht3PyrhMM36uyI2nRV5Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o18-20020a056a001b5200b006e08f8d3c81si7318215pfv.400.2024.02.13.17.02.55 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 17:02:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64620-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EyI55Nnc; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-64620-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64620-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F36ECB23E9C for <ouuuleilei@gmail.com>; Wed, 14 Feb 2024 00:54:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03754612E; Wed, 14 Feb 2024 00:54:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EyI55Nnc" Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 720FC7F; Wed, 14 Feb 2024 00:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707872069; cv=none; b=o9+0AsWq7Rl9Hm1WPlITM1levEGFmEjNofqJi1pNaL+0np/+6CvLSdNIFTp7qPJVHarLFguE3Qk6Hag+pPYR3jC2lUraF2ZmK7F3MUyubHa3OBQhz16GGhCz7ZmBh6jl6gsxM7koy7FPXSq08kC8dZUKyBKPhMfErE2ju0XTo5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707872069; c=relaxed/simple; bh=+MpH6MyUTdWv3FaAVCTooanj1lBPt+xls+adOgFJAzY=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=QIKLl8dqdEZ+RBsTODcTfyjxa+1Ek+g3FCMQ+DFf8dIWLsqDDWwkz/KKoPbMfs5F+KPLRuTvNVU25ZE33LZyKL+duoPhDYVKVXkGTEOWWD927Byg3AtxDeEX7MAzqIbmUpK7luW3oeHkoDOAfLP5XpEY2/++93WXQeyGSV8+ltI= 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=EyI55Nnc; arc=none smtp.client-ip=209.85.215.171 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 Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5d8df2edd29so1101739a12.2; Tue, 13 Feb 2024 16:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707872067; x=1708476867; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=IRAv5G1mvUWjYBsrE0YtysVB4o7+LEIixKnLnZc8qP4=; b=EyI55Nnc7AD3sdYkJ73MAVWdWwp8ElI5yuifLCB5c5HyLaE/jIXNNpDp31P16z37uQ pvjgBoxnVFPXDVqIuc439C/pub1JorCB1PLdFMNRV8WZpX3PbJzr3Y8p+APar8OXF/9G z45jkln8Wb/Xty/7mVzcvhkXozzZCg9u+NBm/IdBsHwFPXnxZ5Rdm4hRYPbNVcJim2Fz 5jSbXIjJv4Vqb3gIO7eZ46rnGs35mUzJseqIslbV4b61lUNVLQ/dZuJ7deFTkyGp2Lw4 xMNHhqokcNEMOotlzbaP12mI2ySz3u/XLYiSFN5Hwr3V7RbCl1WLaM7Ma5W85sQkSXem gUvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707872067; x=1708476867; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IRAv5G1mvUWjYBsrE0YtysVB4o7+LEIixKnLnZc8qP4=; b=Y0F/yhIzMPd9dY8sZduOFcsdnD7ab89PXhZE8c4XRS6KoB9N0z3yK9t1w+4cyww9eH ujR8cH1uJFnP0XH/nCZLWyD3N5957oZwr5zrzEaYrqtzSHlvN2/9Lkj3XyPXbrIueJAw zlnXpNHsDQtPCGpehNBtDpi0zvVooynFv0PtAavD01ghdo6+sxKadEqELvMzYR3SgAkM b2K+6J5fsbUkPS+ISVqxJIGF+iOX6wK9Bf9gINbFv7+m4HvgSbv/JTL4xDHyBcgii8cQ ooaq/ZrQ433VozICwIj+AvorW0owMT4v8TqVo2mmXNMt3YaCmWAeSLc7NWMO6MV/MboT TomQ== X-Forwarded-Encrypted: i=1; AJvYcCUckiCxdRNF9v7A9Bslq/c7bWC3W3iANEAW72PQW3/xDlNzl0f1MrnQHoWnffzHaxpovh+Pt2P8LOh7iExeOkmYiTSeawo3n7G3rl6421/VsQQ1h8N388v0vtgh83Co/2eEOeoUG+pGxw== X-Gm-Message-State: AOJu0YzJdrxpHDur86qU4MekMWT320yt/mmh5ERFuymESxifKXN3II1L ux1/3yzUlpJHnQMhaaPywtHJbKvFYbG00jkAUwGQX1hFzWiO6Toy X-Received: by 2002:a05:6a20:bc01:b0:19e:48e9:5052 with SMTP id fw1-20020a056a20bc0100b0019e48e95052mr1098724pzb.22.1707872066763; Tue, 13 Feb 2024 16:54:26 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX+oLq1TSbRAwIsNWJvgzFoXR36Vm7QOY4/URojqtbdaMuz+f3u/duTCMGUylCSr4/nQOJauPk5aCJu819NPbv3FYt2YX+6kV4Nd2OlFoDlpd8WXTUOY0rU2VCkJnJnSaJ1NJ0OfvMJ9YSNfIF5inYHC5cUNj+GVNK0giAb8UoiJ7eeYLUqZCwGdxQdiyJjzuxOsQd0rZkb2Upf8p+px0ziJ/NRfvOAa+QyOt/d+tTaUl1gAABGiuywlbYJkmv7TO0U1gT8JTajajRoTb5AE25GzphwoJbPWlTLiei1yLc7WwTEyxi3FdQFPacLFPLLH1Uf60AJlPd4W76EnR/woSmDnVCVE7IesoIHEhrOER7qz2cAeJEXIJL+PACGGNsC/vQ1Id9dx9t08h2lXQvWtJ86Fm3/vn+9hQrMLQETfbwVGnHtzJmtlAeHw7cfy5Gq/T59Q1QwY57juhSxkUwJzG+OnR979EB6MIvNClPn8qKjOCNwzOcCrYsYOCKN4Gyv2iaQyUWj+lbgIoZ4w8YFjhUztgyuSRuwLr5KtuzbK5n5ggFwZFD0 Received: from tresc054937.tre-sc.gov.br ([2804:c:204:200:2be:43ff:febc:c2fb]) by smtp.gmail.com with ESMTPSA id q10-20020aa7982a000000b006e094bf05f4sm8005694pfl.213.2024.02.13.16.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 16:54:26 -0800 (PST) From: Luiz Angelo Daros de Luca <luizluca@gmail.com> Subject: [PATCH net-next v3 0/3] net: dsa: realtek: support reset controller and update docs Date: Tue, 13 Feb 2024 21:54:14 -0300 Message-Id: <20240213-realtek-reset-v3-0-37837e574713@gmail.com> 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: 7bit X-B4-Tracking: v=1; b=H4sIADcPzGUC/x2M0QqDMBAEf0XuuYH0rBD6K9KHxK71UNKSCxIQ/ 92jT8PA7B6kKAKlZ3dQwS4q32zS3zqalpg/cPI2J/b88HxnVxC3itWoqC6E6NPMQ0rMZJtfwSz t/zdStiCjVXqd5wWUKiYtaQAAAA== To: Linus Walleij <linus.walleij@linaro.org>, =?utf-8?q?Alvin_=C5=A0ipraga?= <alsi@bang-olufsen.dk>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de> Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Luiz Angelo Daros de Luca <luizluca@gmail.com>, =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= <arinc.unal@arinc9.com>, Rob Herring <robh@kernel.org> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2247; i=luizluca@gmail.com; h=from:subject:message-id; bh=+MpH6MyUTdWv3FaAVCTooanj1lBPt+xls+adOgFJAzY=; b=owEBbQGS/pANAwAIAbsR27rRBztWAcsmYgBlzA89WGb88ILlID120vimjP3ywfQPNEK9cImoT znBvY35E86JATMEAAEIAB0WIQQRByhHhc1bOhL6L/i7Edu60Qc7VgUCZcwPPQAKCRC7Edu60Qc7 VvNvB/9YKsxOUQbfYacjU/vvdQf7EwylJ1tfxEDWTZloC9x0dRrYlr+AxSzy8yiErFx4BeAy32a 17OhSANqYzoEnwP8VcjnmBfRteKclqD7fDl3ksY1Duo7qGgj7cNwgvZ6fNeJXfL1nyq6swviH7g u/a6vmoI0qDgEvN/iCt2fKMU6kP8dyAqx9GiCGg5xCbTn5KV51PpxJaBxPCRIzOgiYEVUmlTLGk sO0U8Xciyv5YLkLLAq4CST/XjgZ1Wc5FNJPqM6of+n/FmDV3WyJ4cHY6jzzusdSIfI7a1EJ84R5 8F0CbQO5ZfiIdHqAapcIZT6jDYKCIKfXNgXaAKeNU/uDFcN2 X-Developer-Key: i=luizluca@gmail.com; a=openpgp; fpr=1107284785CD5B3A12FA2FF8BB11DBBAD1073B56 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790834194645443240 X-GMAIL-MSGID: 1790834194645443240 |
Series |
net: dsa: realtek: support reset controller and update docs
|
|
Message
Luiz Angelo Daros de Luca
Feb. 14, 2024, 12:54 a.m. UTC
The driver previously supported reset pins using GPIO, but it lacked
support for reset controllers. Although a reset method is generally not
required, the driver fails to detect the switch if the reset was kept
asserted by a previous driver.
This series adds support to reset a Realtek switch using a reset
controller. It also updates the binding documentation to remove the
requirement of a reset method and to add the new reset controller
property.
It was tested on a TL-WR1043ND v1 router (rtl8366rb via SMI).
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
Changes in v3:
- Rebased on the Realtek DSA driver refactoring (08f627164126)
- Dropped the reset controller example in bindings
- Used %pe in error printing
- Linked to v2: https://lore.kernel.org/r/20231027190910.27044-1-luizluca@gmail.com/
Changes in v2:
- Introduced a dedicated commit for removing the reset-gpios requirement
- Placed binding patches before code changes
- Removed the 'reset-names' property
- Moved the example from the commit message to realtek.yaml
- Split the reset function into _assert/_deassert variants
- Modified reset functions to return a warning instead of a value
- Utilized devm_reset_control_get_optional to prevent failure when the
reset control is missing
- Used 'true' and 'false' for boolean values
- Removed the CONFIG_RESET_CONTROLLER check as stub methods are
sufficient when undefined
- Linked to v1: https://lore.kernel.org/r/20231024205805.19314-1-luizluca@gmail.com/
---
Luiz Angelo Daros de Luca (3):
dt-bindings: net: dsa: realtek: reset-gpios is not required
dt-bindings: net: dsa: realtek: add reset controller
net: dsa: realtek: support reset controller
.../devicetree/bindings/net/dsa/realtek.yaml | 4 +-
drivers/net/dsa/realtek/realtek.h | 2 +
drivers/net/dsa/realtek/rtl83xx.c | 52 +++++++++++++++++++---
drivers/net/dsa/realtek/rtl83xx.h | 2 +
4 files changed, 54 insertions(+), 6 deletions(-)
---
base-commit: 0f37666d87d2dea42ec21776c3d562b7cbd71612
change-id: 20240212-realtek-reset-88a0bf25bb22
Best regards,
Comments
Hi Luiz, thanks for your patch! On Wed, Feb 14, 2024 at 1:54 AM Luiz Angelo Daros de Luca <luizluca@gmail.com> wrote: > The 'reset-gpios' will not work when the switch reset is controlled by a > reset controller. > > Although the reset is optional and the driver performs a soft reset > during setup, if the initial reset state was asserted, the driver will > not detect it. > > The reset controller will take precedence over the reset GPIO. > > Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> (...) > +void rtl83xx_reset_assert(struct realtek_priv *priv) > +{ > + int ret; > + > + if (priv->reset_ctl) { > + ret = reset_control_assert(priv->reset_ctl); Actually, reset_control_assert() is NULL-tolerand (as well as the stubs) so you can just issue this unconditionally. If priv->reset_ctl is NULL it will just return 0. > + if (!ret) > + return; > + > + dev_warn(priv->dev, > + "Failed to assert the switch reset control: %pe\n", > + ERR_PTR(ret)); > + } > + > + if (priv->reset) > + gpiod_set_value(priv->reset, true); Same here! Also NULL-tolerant. You do not need to check priv->reset. Just issue it. > +void rtl83xx_reset_deassert(struct realtek_priv *priv) Same comments for deassert. With this fixed (the rest looks just fine): Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij