From patchwork Mon Nov 29 10:30:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12644263 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F39C433EF for ; Mon, 29 Nov 2021 11:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237859AbhK2LTY (ORCPT ); Mon, 29 Nov 2021 06:19:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241994AbhK2LRB (ORCPT ); Mon, 29 Nov 2021 06:17:01 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74317C0619D7 for ; Mon, 29 Nov 2021 02:30:28 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id x15so69597937edv.1 for ; Mon, 29 Nov 2021 02:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CRQqucCrnamTlX+tGhjWyYvcx8+/9ibHWaNBuRU1okg=; b=Jl7c3RJdfR1aN72MxV18HoPB4/9eke9eUCdSwt8ulnIhzLc4rCl73Wh8C+h5ZOGyWc X6N1dw8p9cUyDSbqgd2tgChppuwT0It9RPI4Z7XvtlNFNpCKMgMOkrCnWhV+s19X85PF cIAaVT3E9G1p5HtQgDTqhXpW7e+jWW0S0VClQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CRQqucCrnamTlX+tGhjWyYvcx8+/9ibHWaNBuRU1okg=; b=qWKZd34rccdObgTSrdg0atbSTH8n5LuLFymJRTc4mB4pWG0HNauoOHsj/nu/gYTxqq JCIVFy/B5psxyUC7MJV7ERVpQ8OWzhG5hE13u4d/XCEoKvv9jbLrlCgg8nZ+hXSdMuhx Ic1KkxBDyuwH0DeWfqnSvUelhqPlpQ9bYQjWjMKMif8EpxkagirTrVnGeork/peg6OLC 9Svch8WWq99EiDN0pZ72R1bwGvtY+hG11aZMRm6EFoUDGxEfbTlyzjfRip96W8pIIQDO 90Ax05E06BsuoQngZw4rEjZOUBPWZCJe+6KgHxz88Rk3CR3yRH1C71LnGn8jaOQVXWbS wwVw== X-Gm-Message-State: AOAM533aXXkARf8JPirk+s11ge8xiJWqcthn9GNB6+GirD16SYY6EPMt PVhSEfolZPF5HpogL7Hv5e32silPPYuKjqUA X-Google-Smtp-Source: ABdhPJw3g3iFpN5Rh4hrsgL8P7OfcwEGpMJFod6mZqeb0WxhA3dsr5G7X0cTnRT/jNtbQ+RLz5j6PA== X-Received: by 2002:a05:6402:42d4:: with SMTP id i20mr73555919edc.372.1638181827033; Mon, 29 Nov 2021 02:30:27 -0800 (PST) Received: from capella.. (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id cy26sm9008402edb.7.2021.11.29.02.30.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 02:30:26 -0800 (PST) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linus.walleij@linaro.org, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, vivien.didelot@gmail.com, hkallweit1@gmail.com, =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= Subject: [PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER Date: Mon, 29 Nov 2021 11:30:17 +0100 Message-Id: <20211129103019.1997018-1-alvin@pqrs.dk> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Alvin Šipraga Probe deferral is not an error, so don't log this as an error: [0.590156] realtek-smi ethernet-switch: unable to register switch ret = -517 Signed-off-by: Alvin Šipraga Reviewed-by: Andrew Lunn --- drivers/net/dsa/realtek-smi-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) v2: use dev_err_probe() instead of manually checking ret diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c index c66ebd0ee217..aae46ada8d83 100644 --- a/drivers/net/dsa/realtek-smi-core.c +++ b/drivers/net/dsa/realtek-smi-core.c @@ -456,7 +456,7 @@ static int realtek_smi_probe(struct platform_device *pdev) smi->ds->ops = var->ds_ops; ret = dsa_register_switch(smi->ds); if (ret) { - dev_err(dev, "unable to register switch ret = %d\n", ret); + dev_err_probe(dev, ret, "unable to register switch\n"); return ret; } return 0; From patchwork Mon Nov 29 10:30:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12644265 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F04C433F5 for ; Mon, 29 Nov 2021 11:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239556AbhK2LTZ (ORCPT ); Mon, 29 Nov 2021 06:19:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237081AbhK2LRD (ORCPT ); Mon, 29 Nov 2021 06:17:03 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC41C0619D8 for ; Mon, 29 Nov 2021 02:30:29 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id t5so69909094edd.0 for ; Mon, 29 Nov 2021 02:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y/+vMn6bPWB3K6AvZrRajw9Y36sjPoNxVrEu1AarL/Q=; b=XB6Wf4kAAnde9wUZ4ttCjqVruZXc7hzBlULw0t3bqbBji3+ehVl4r51CjoPdMbFSZ2 Df2FEezcAGX4WmO20rqkWLMft/Xa1l0Aizj/Gu/a+xEqxfw1fQPiWLWZVLmD1co87w0i j6rmVl9VGpqDfzNsk3Rpj0hqJbJWb7prZWeaw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y/+vMn6bPWB3K6AvZrRajw9Y36sjPoNxVrEu1AarL/Q=; b=yJAHFIe6ke5b8Qz1QEHNVNbkZA6DtR0Kckr9W2fZ9SDXzg+Srwc0cs1RSOHJ0wTTu7 oRaoD0Si6EF5UsprB2TQBEBAR0vxQ4QA+x09mowSMGu1jeHTvUFC584nrKSqljpvdCy3 0Gl7K6C/+tBttTQqq9MtBRqcaQPef63SDZfJ7JdxdPmaOt2zDU26T7YU97n823A1gcJe 8ssi3AljWbDNDlvFeYO2nmrF268ZHNFJte2I3xQ7+LBNRSbjENHWYPpKmFykCqNGCIU6 otJhgXGm9Er8z87Bm2cDSk7U2Rjtuthg1NgF+VgswGPxB/o0qrjnTLlGyS/SehzyUQWs jwCQ== X-Gm-Message-State: AOAM5323Q9G2zeC7RCxV6mfter/ysrj73uuRDsbVql0hRAwYTM+XVM4e q2VSPCOGT6VeN+fQIm5R42rj91VA8PrJ5+GL X-Google-Smtp-Source: ABdhPJwyVoTBOPb4sTvoLkKLheERqOCCuJmW6wam0ReYl49EZXAeJ0il48Cl2WZyrFmq0B6TSEXy0A== X-Received: by 2002:a17:906:dc8d:: with SMTP id cs13mr58469452ejc.109.1638181828052; Mon, 29 Nov 2021 02:30:28 -0800 (PST) Received: from capella.. (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id cy26sm9008402edb.7.2021.11.29.02.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 02:30:27 -0800 (PST) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linus.walleij@linaro.org, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, vivien.didelot@gmail.com, hkallweit1@gmail.com, =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= Subject: [PATCH net v2 2/3] net: dsa: rtl8365mb: fix garbled comment Date: Mon, 29 Nov 2021 11:30:18 +0100 Message-Id: <20211129103019.1997018-2-alvin@pqrs.dk> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211129103019.1997018-1-alvin@pqrs.dk> References: <20211129103019.1997018-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Alvin Šipraga Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC") Signed-off-by: Alvin Šipraga Reviewed-by: Andrew Lunn --- drivers/net/dsa/rtl8365mb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) v2: no change diff --git a/drivers/net/dsa/rtl8365mb.c b/drivers/net/dsa/rtl8365mb.c index baaae97283c5..c52225d115d4 100644 --- a/drivers/net/dsa/rtl8365mb.c +++ b/drivers/net/dsa/rtl8365mb.c @@ -276,7 +276,7 @@ (RTL8365MB_PORT_ISOLATION_REG_BASE + (_physport)) #define RTL8365MB_PORT_ISOLATION_MASK 0x07FF -/* MSTP port state registers - indexed by tree instancrSTI (tree ine */ +/* MSTP port state registers - indexed by tree instance */ #define RTL8365MB_MSTI_CTRL_BASE 0x0A00 #define RTL8365MB_MSTI_CTRL_REG(_msti, _physport) \ (RTL8365MB_MSTI_CTRL_BASE + ((_msti) << 1) + ((_physport) >> 3)) From patchwork Mon Nov 29 10:30:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12644267 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C3D4C433F5 for ; Mon, 29 Nov 2021 11:16:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240772AbhK2LTb (ORCPT ); Mon, 29 Nov 2021 06:19:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236859AbhK2LRX (ORCPT ); Mon, 29 Nov 2021 06:17:23 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC36C0619D9 for ; Mon, 29 Nov 2021 02:30:30 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id z5so4395088edd.3 for ; Mon, 29 Nov 2021 02:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KX8QCfye58yms3sdgysq4GNHlgEcGIVnlY8KvEWOgUc=; b=TmQyp/VnoK+te/voTjScOuGbQglrQfDVrtZMw/Xq/iCKk5l+vN6VL5MoOIloaF+E6/ Bc4mvYxjrs95Z39ids8NU3+6lfL9FmjqGgdR+cHbCi6Hve5lds1o/mrHDp4s0jhJ7DpW P1iJoMhZNwEajRoKaclM4hjTE0TwrZ/V0fypw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KX8QCfye58yms3sdgysq4GNHlgEcGIVnlY8KvEWOgUc=; b=3N/z1aYDMzTym7YpL+y9kufBkqwC79DeWJdb/p16nVbp9H1mf0h5t34V7TW0X5VRcw P8cNYwC1XAhGAUATbK4n2qJ9FkOqkhXqkSr4q4AwN7W5kWCJC0HgfcktnYZ/BQggt3RO ng0A/sMc1F36oGZulkyFQx65NRcmCvG8tr7OH8orH7U9dRbEJgWyoQJVPXfpp6C5w03L Y3qBrPlTwkJd9A8dxq4v6PTEfDpc58nrsVa7PxWiAFC5tzSwq5xbjJwrYCtOgZzrzbyu XNq7A5jUIOokE3T1RfBSZu++N8pEEoDYkPQLbSuC5PAPbu8XTsL5kkJZ8HGBo/qHZmYT UVXg== X-Gm-Message-State: AOAM533sTbCgDll0yMkHb5LvvIv1PMUNajdUUgWyC++aUm5JW7V8kvT2 +uOcs4X6Z9SrPMholPM/nPSD0Iyoy9uo41t0 X-Google-Smtp-Source: ABdhPJweWc6cH4Cjup9tDg8G0C+HLhNmhbjo6nFQEexmblDpfcyectJreQBwn/wAXMxTWzf5GoRQzA== X-Received: by 2002:a17:906:3e83:: with SMTP id a3mr60063753ejj.383.1638181828823; Mon, 29 Nov 2021 02:30:28 -0800 (PST) Received: from capella.. (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id cy26sm9008402edb.7.2021.11.29.02.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 02:30:28 -0800 (PST) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linus.walleij@linaro.org, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, vivien.didelot@gmail.com, hkallweit1@gmail.com, =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net v2 3/3] net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns Date: Mon, 29 Nov 2021 11:30:19 +0100 Message-Id: <20211129103019.1997018-3-alvin@pqrs.dk> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211129103019.1997018-1-alvin@pqrs.dk> References: <20211129103019.1997018-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Alvin Šipraga A contact at Realtek has clarified what exactly the units of RGMII RX delay are. The answer is that the unit of RX delay is "about 0.3 ns". Take this into account when parsing rx-internal-delay-ps by approximating the closest step value. Delays of more than 2.1 ns are rejected. This obviously contradicts the previous assumption in the driver that a step value of 4 was "about 2 ns", but Realtek also points out that it is easy to find more than one RX delay step value which makes RGMII work. Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC") Cc: Arınç ÜNAL Signed-off-by: Alvin Šipraga Acked-by: Arınç ÜNAL Reviewed-by: Andrew Lunn --- drivers/net/dsa/rtl8365mb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) v2: add Arınç's Acked-by diff --git a/drivers/net/dsa/rtl8365mb.c b/drivers/net/dsa/rtl8365mb.c index c52225d115d4..bb65576ebf3c 100644 --- a/drivers/net/dsa/rtl8365mb.c +++ b/drivers/net/dsa/rtl8365mb.c @@ -760,7 +760,8 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port, * 0 = no delay, 1 = 2 ns delay * RX delay: * 0 = no delay, 7 = maximum delay - * No units are specified, but there are a total of 8 steps. + * Each step is approximately 0.3 ns, so the maximum delay is about + * 2.1 ns. * * The vendor driver also states that this must be configured *before* * forcing the external interface into a particular mode, which is done @@ -771,10 +772,6 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port, * specified. We ignore the detail of the RGMII interface mode * (RGMII_{RXID, TXID, etc.}), as this is considered to be a PHY-only * property. - * - * For the RX delay, we assume that a register value of 4 corresponds to - * 2 ns. But this is just an educated guess, so ignore all other values - * to avoid too much confusion. */ if (!of_property_read_u32(dn, "tx-internal-delay-ps", &val)) { val = val / 1000; /* convert to ns */ @@ -787,13 +784,13 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port, } if (!of_property_read_u32(dn, "rx-internal-delay-ps", &val)) { - val = val / 1000; /* convert to ns */ + val = DIV_ROUND_CLOSEST(val, 300); /* convert to 0.3 ns step */ - if (val == 0 || val == 2) - rx_delay = val * 2; + if (val <= 7) + rx_delay = val; else dev_warn(smi->dev, - "EXT port RX delay must be 0 to 2 ns\n"); + "EXT port RX delay must be 0 to 2.1 ns\n"); } ret = regmap_update_bits(