Message ID | 1691796578-846-1-git-send-email-justin.chen@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1424257vqi; Fri, 11 Aug 2023 16:51:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDdstlb1Y6Fmxc5MdyzW6KLK1M4y5N43T3xKKVDZtGQ5k2hvyn5CSbYbCdPHdY9NqQo36O X-Received: by 2002:a05:6808:347:b0:3a7:6f16:b549 with SMTP id j7-20020a056808034700b003a76f16b549mr4385988oie.49.1691797890548; Fri, 11 Aug 2023 16:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691797890; cv=none; d=google.com; s=arc-20160816; b=DXwgcARn3wDrnVqaTGwQoOMrEZIu1NVw1xor3Gneoc++4Hno1MmJhZjhlu6OgOOanF Na4d5teMIY2pDyiM9Z66tFPr1ZMjxpNV8z8ULn0ACvQhTlhNfbWfm9yDhyit6QQRB8u4 nV7u4fVxD5zDLaRHske/41efXWL0yryqOcZwsKQQ1cugN+AbHGQCgKKaSK9nWGTzFEar 5gmaH5EVCSu83eYpzrKlkIMhEZrGRrzyHN8W/vYJoywCFSfiU0QTPe2rjIdBRf04B0zi tH3JnH6GvN9AylWEoovpWk5hQMEDPbrVJTLMJ35j5jB5KtELEuKADriXm+9rDBEyhAs7 hnBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=59K473q2/buWTUdRFuaTzSiUjEQA7c7u37P9wTrnsfk=; fh=H5l7Lg1Sb6kDz7wqoCxwj5gANelAB0OkqGIrOkcfxaI=; b=UW3876f3Z6qSDFdUV+HBYXeO8qJodk9SrYR0PYDTgjrR2DzefKuY65uEblHza1DlyO V4ZnqNsqrbQzRHa28l6QP5o5tbbE0GNi4IsAiSgXXjI02tg+YZDrNolpt0dWe2F5MjfD w0OaVX61MtjA9j4fjVWVmOoDPMNHdp/tUtYuQt8wGCFwSVPziQerOd+co3PVhb1XpOAy W7o7Q1fEE+QTeKKbBpwsoPYcgMH5uu/pQESIromXODH84HuOcFhTY/As2TAJLqVXF2A6 dMC2y19BZhLuwlwbGbsPu1550kguB/fREb8LcSAlkq0Eu4gKa9NVH5Zl0Zo5QsTsaqO+ ho3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ckVFP+El; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a63e113000000b005443c85156bsi4150132pgh.222.2023.08.11.16.51.17; Fri, 11 Aug 2023 16:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ckVFP+El; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236538AbjHKX3r (ORCPT <rfc822;lanlanxiyiji@gmail.com> + 99 others); Fri, 11 Aug 2023 19:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231685AbjHKX3p (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 19:29:45 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74AC5E73 for <linux-kernel@vger.kernel.org>; Fri, 11 Aug 2023 16:29:45 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-76cd8dab98fso183609785a.3 for <linux-kernel@vger.kernel.org>; Fri, 11 Aug 2023 16:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1691796584; x=1692401384; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=59K473q2/buWTUdRFuaTzSiUjEQA7c7u37P9wTrnsfk=; b=ckVFP+ElNfHqdcRGP8NRRD/Dk+CFx0s4V2D/JtLm2tlzfzXJsXW1PrLIDw9qkV28pd 0WPp7tVRwncuuutp99ETZ4mKY2tQtCeWSb/NqetNDRIl9LmseYfvciFLfsyKraYytMzn xgkwqQcw0imWm0kAiEsqiWyHG8lFCxjVhCuDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691796584; x=1692401384; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=59K473q2/buWTUdRFuaTzSiUjEQA7c7u37P9wTrnsfk=; b=cRYgsKB9kcnGQMkZbiq3xnA295NYhINUu7mL5CELVKG0R4p6k4748konfclYXJrudH JlgsXAlLXZok0/dS7HKEDwI9QX5rr9Ci+GPPaDgfOR5oFUviLNAqaMkBDw8HcEeCLSN7 yr50ELW+1Q9oHYAiAtfnM2Aiy8zmfoMquzRR3spNda3e6NnL8KS08rb+JBssFLGG0It4 7yfe+tNnzHa+WxqO3xz/nbXZLpblXbwkVq/hMEQt8U3kFprw+DUYG/ripiUYU/iTouMk h8tXR9MhpWqgmsDxzM5MdTk627EPFyZfBt1kTHmDsfK54ohu8EZ+Rt7/2GbSqN+jOiKy ieUg== X-Gm-Message-State: AOJu0YyWKVjFRRhss3hpYcWPdz+fDAJcYkulAmgohBymVlS0BDX6XcP3 ly9PVgNJRvMT0iaAINB4z1GGGQ== X-Received: by 2002:a05:620a:4593:b0:768:f02:532e with SMTP id bp19-20020a05620a459300b007680f02532emr4274907qkb.39.1691796584559; Fri, 11 Aug 2023 16:29:44 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id u2-20020ae9c002000000b00767c961eb47sm1495927qkk.43.2023.08.11.16.29.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2023 16:29:43 -0700 (PDT) From: Justin Chen <justin.chen@broadcom.com> To: netdev@vger.kernel.org Cc: Justin Chen <justin.chen@broadcom.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, linux-kernel@vger.kernel.org (open list) Subject: [PATCH] net: phy: broadcom: stub c45 read/write for 54810 Date: Fri, 11 Aug 2023 16:29:37 -0700 Message-Id: <1691796578-846-1-git-send-email-justin.chen@broadcom.com> X-Mailer: git-send-email 2.7.4 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000007892240602ae16e8" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, MIME_HEADER_CTYPE_ONLY,MIME_NO_TEXT,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773978664648364097 X-GMAIL-MSGID: 1773978664648364097 |
Series |
net: phy: broadcom: stub c45 read/write for 54810
|
|
Commit Message
Justin Chen
Aug. 11, 2023, 11:29 p.m. UTC
The 54810 does not support c45. The mmd_phy_indirect accesses return
arbirtary values leading to odd behavior like saying it supports EEE
when it doesn't. We also see that reading/writing these non-existent
MMD registers leads to phy instability in some cases.
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
---
drivers/net/phy/broadcom.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
Comments
On 8/11/2023 4:29 PM, Justin Chen wrote: > The 54810 does not support c45. The mmd_phy_indirect accesses return > arbirtary values leading to odd behavior like saying it supports EEE > when it doesn't. We also see that reading/writing these non-existent > MMD registers leads to phy instability in some cases. > > Signed-off-by: Justin Chen <justin.chen@broadcom.com> Thanks for submitting this fix, I would be tempted to slap a: Fixes: b14995ac2527 ("net: phy: broadcom: Add BCM54810 PHY entry") so we get it back ported to stable trees where appropriate. It is not clear whether we should return -EINVAL vs. -EOPNOTSUPP which may more clearly indicate the inability to support MMD registers?
On Fri, Aug 11, 2023 at 4:40 PM Florian Fainelli <florian.fainelli@broadcom.com> wrote: > > > > On 8/11/2023 4:29 PM, Justin Chen wrote: > > The 54810 does not support c45. The mmd_phy_indirect accesses return > > arbirtary values leading to odd behavior like saying it supports EEE > > when it doesn't. We also see that reading/writing these non-existent > > MMD registers leads to phy instability in some cases. > > > > Signed-off-by: Justin Chen <justin.chen@broadcom.com> > > Thanks for submitting this fix, I would be tempted to slap a: > > Fixes: b14995ac2527 ("net: phy: broadcom: Add BCM54810 PHY entry") > > so we get it back ported to stable trees where appropriate. It is not > clear whether we should return -EINVAL vs. -EOPNOTSUPP which may more > clearly indicate the inability to support MMD registers? Hmm agreed EOPNOTSUPP seems better here. Will submit v2 with fixes tag if there are no objections to this patch. Thanks, Justin > -- > Florian
On 8/11/2023 4:47 PM, Justin Chen wrote: > On Fri, Aug 11, 2023 at 4:40 PM Florian Fainelli > <florian.fainelli@broadcom.com> wrote: >> >> >> >> On 8/11/2023 4:29 PM, Justin Chen wrote: >>> The 54810 does not support c45. The mmd_phy_indirect accesses return >>> arbirtary values leading to odd behavior like saying it supports EEE >>> when it doesn't. We also see that reading/writing these non-existent >>> MMD registers leads to phy instability in some cases. >>> >>> Signed-off-by: Justin Chen <justin.chen@broadcom.com> >> >> Thanks for submitting this fix, I would be tempted to slap a: >> >> Fixes: b14995ac2527 ("net: phy: broadcom: Add BCM54810 PHY entry") >> >> so we get it back ported to stable trees where appropriate. It is not >> clear whether we should return -EINVAL vs. -EOPNOTSUPP which may more >> clearly indicate the inability to support MMD registers? > > Hmm agreed EOPNOTSUPP seems better here. Will submit v2 with fixes tag > if there are no objections to this patch. Since this is a fix, you will want to use [PATCH net] as the subject prefix per: https://www.kernel.org/doc/Documentation/networking/netdev-FAQ.txt and wait 24hrs in case someone provides additional review that you can incorporate in your v2.
> Hmm agreed EOPNOTSUPP seems better here.
I was thinking the same.
Andrew
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 59cae0d808aa..8cc39427ce78 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -542,6 +542,17 @@ static int bcm54xx_resume(struct phy_device *phydev) return bcm54xx_config_init(phydev); } +static int bcm54810_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) +{ + return -EINVAL; +} + +static int bcm54810_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, + u16 val) +{ + return -EINVAL; +} + static int bcm54811_config_init(struct phy_device *phydev) { int err, reg; @@ -1103,6 +1114,8 @@ static struct phy_driver broadcom_drivers[] = { .get_strings = bcm_phy_get_strings, .get_stats = bcm54xx_get_stats, .probe = bcm54xx_phy_probe, + .read_mmd = bcm54810_read_mmd, + .write_mmd = bcm54810_write_mmd, .config_init = bcm54xx_config_init, .config_aneg = bcm5481_config_aneg, .config_intr = bcm_phy_config_intr,