net: broadcom: Add PTP_1588_CLOCK_OPTIONAL dependency for BCMGENET under ARCH_BCM2835
Message ID | 20221125115003.30308-1-yuehaibing@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3965518wrr; Fri, 25 Nov 2022 04:10:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf66A/PCnq4ofzvps6GJxQEYsHqFpnKNkzOLYTIskpeup0G/7cLKRcc2XEwPB+5MQn2zc+44 X-Received: by 2002:a05:6402:528f:b0:461:9cbd:8fba with SMTP id en15-20020a056402528f00b004619cbd8fbamr10931612edb.19.1669378204280; Fri, 25 Nov 2022 04:10:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669378204; cv=none; d=google.com; s=arc-20160816; b=vQsUXBCFkWYBmcQGd3S3OA2m8xJAo3gpRYKSzG5vG4QqQrhoZbivjdqfNvf1TeXiT+ 4rOyEInckcWWHGsyl/lmtnN3DVtZYgA1Bgho5n3K1JXIyL3gu7j7rITSGoTXj5/aNcm9 E/4SJJxGmtZPWcLXZCKOzgBWZYDVG8/z0rYSLGDJ1aL6PV6yPldhpXpwvBa/X2FMw0J6 x7+FMQj6f1ah7Gkbh6URoFqj0A8arohg0nVd4WMwvuFh1RE+GVF9S8w1cVnyMvxdBjkq qBC2E6EqznDe7RRxDRCz9KIuIjbESYkha7zL7wGYWbfgdgMEi0D8EHuQhRvWHg4LGZmA wmyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=xDE+DxwJ/wSB9L8+ggne7xVlgXvw49bymGBETbDRHJI=; b=GXhSGu/Hv1YngyIVS7qe8EhrL2kOPRroUI+d/1QJRor6vuiZdNEK5WjiP+duE3hQIh VEdT/r6cJRZc4fpAf8RjfSnDbEa1dzEggjasUXdxR9bznDhdNoItngszvBU98adm5Wkj HHn+4K8z4nieZQlVPSJXkNVEO6uFcGo3r0rcsjTvUx/DobsKpHOR14UQnlDS38uFxqgY dOdThIxuOssb4SXw7+JITQLS1SK+PhD6l0L7qBP0StI2+O1kve2hjWe4u+SLn1rp06v2 +n7JofAr14f6WxJSj2MkwryP5y/y2iUj2sLtizKTeLvLy0ou7mBi17GZ30KdMPsZ7H4M scHQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a50ab47000000b00462848f0cdbsi3055097edc.299.2022.11.25.04.09.39; Fri, 25 Nov 2022 04:10:04 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229752AbiKYL6l (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Fri, 25 Nov 2022 06:58:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbiKYL6k (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 25 Nov 2022 06:58:40 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDB442EF10; Fri, 25 Nov 2022 03:58:38 -0800 (PST) Received: from canpemm500007.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NJYK65yWvzmW7F; Fri, 25 Nov 2022 19:58:02 +0800 (CST) Received: from localhost (10.174.179.215) by canpemm500007.china.huawei.com (7.192.104.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 19:58:36 +0800 From: YueHaibing <yuehaibing@huawei.com> To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <yuehaibing@huawei.com>, <f.fainelli@broadcom.com>, <arnd@arndb.de>, <naresh.kamboju@linaro.org> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <gregkh@linuxfoundation.org> Subject: [PATCH] net: broadcom: Add PTP_1588_CLOCK_OPTIONAL dependency for BCMGENET under ARCH_BCM2835 Date: Fri, 25 Nov 2022 19:50:03 +0800 Message-ID: <20221125115003.30308-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500007.china.huawei.com (7.192.104.62) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750469920182925097?= X-GMAIL-MSGID: =?utf-8?q?1750469920182925097?= |
Series |
net: broadcom: Add PTP_1588_CLOCK_OPTIONAL dependency for BCMGENET under ARCH_BCM2835
|
|
Commit Message
Yue Haibing
Nov. 25, 2022, 11:50 a.m. UTC
commit 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") fixes the build
that contain 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET")
and enable BCMGENET=y but PTP_1588_CLOCK_OPTIONAL=m, which otherwise
leads to a link failure. However this may trigger a runtime failure.
Fix the original issue by propagating the PTP_1588_CLOCK_OPTIONAL dependency
of BROADCOM_PHY down to BCMGENET.
Fixes: 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig")
Fixes: 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/broadcom/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Fri, Nov 25, 2022, at 12:50, YueHaibing wrote: > commit 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") fixes the build > that contain 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > and enable BCMGENET=y but PTP_1588_CLOCK_OPTIONAL=m, which otherwise > leads to a link failure. However this may trigger a runtime failure. > > Fix the original issue by propagating the PTP_1588_CLOCK_OPTIONAL dependency > of BROADCOM_PHY down to BCMGENET. > > Fixes: 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") > Fixes: 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> > Suggested-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: YueHaibing <yuehaibing@huawei.com> Thanks for fixing this, Acked-by: Arnd Bergmann <arnd@arndb.de>
On Fri, 25 Nov 2022 19:50:03 +0800 YueHaibing wrote: > commit 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") fixes the build > that contain 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > and enable BCMGENET=y but PTP_1588_CLOCK_OPTIONAL=m, which otherwise > leads to a link failure. However this may trigger a runtime failure. > > Fix the original issue by propagating the PTP_1588_CLOCK_OPTIONAL dependency > of BROADCOM_PHY down to BCMGENET. > > Fixes: 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") > Fixes: 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> > Suggested-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- > drivers/net/ethernet/broadcom/Kconfig | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig > index 55dfdb34e37b..f4ca0c6c0f51 100644 > --- a/drivers/net/ethernet/broadcom/Kconfig > +++ b/drivers/net/ethernet/broadcom/Kconfig > @@ -71,13 +71,14 @@ config BCM63XX_ENET > config BCMGENET > tristate "Broadcom GENET internal MAC support" > depends on HAS_IOMEM > + depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835 > select MII > select PHYLIB > select FIXED_PHY > select BCM7XXX_PHY > select MDIO_BCM_UNIMAC > select DIMLIB > - select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) > + select BROADCOM_PHY if ARCH_BCM2835 > help > This driver supports the built-in Ethernet MACs found in the > Broadcom BCM7xxx Set Top Box family chipset. What's the code path that leads to the failure? I want to double check that the driver is handling the PTP registration return codes correctly. IIUC this is a source of misunderstandings in the PTP API. Richard, here's the original report: https://lore.kernel.org/all/CA+G9fYvKfbJHcMZtybf_0Ru3+6fKPg9HwWTOhdCLrOBXMaeG1A@mail.gmail.com/
On Tue, Nov 29, 2022, at 04:18, Jakub Kicinski wrote: > On Fri, 25 Nov 2022 19:50:03 +0800 YueHaibing wrote: >> diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig >> index 55dfdb34e37b..f4ca0c6c0f51 100644 >> --- a/drivers/net/ethernet/broadcom/Kconfig >> +++ b/drivers/net/ethernet/broadcom/Kconfig >> @@ -71,13 +71,14 @@ config BCM63XX_ENET >> config BCMGENET >> tristate "Broadcom GENET internal MAC support" >> depends on HAS_IOMEM >> + depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835 >> select MII >> select PHYLIB >> select FIXED_PHY >> select BCM7XXX_PHY >> select MDIO_BCM_UNIMAC >> select DIMLIB >> - select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) >> + select BROADCOM_PHY if ARCH_BCM2835 >> help >> This driver supports the built-in Ethernet MACs found in the >> Broadcom BCM7xxx Set Top Box family chipset. > > What's the code path that leads to the failure? I want to double check > that the driver is handling the PTP registration return codes correctly. > IIUC this is a source of misunderstandings in the PTP API. > > Richard, here's the original report: > https://lore.kernel.org/all/CA+G9fYvKfbJHcMZtybf_0Ru3+6fKPg9HwWTOhdCLrOBXMaeG1A@mail.gmail.com The original report was for a different bug that resulted in the BROADCOM_PHY driver not being selectable at all. The remaining problem here is this configuration: CONFIG_ARM=y CONFIG_BCM2835=y CONFIG_BCMGENET=y CONFIG_PTP_1588_CLOCK=m CONFIG_PTP_1588_CLOCK_OPTIONAL=m CONFIG_BROADCOM_PHY=m In this case, BCMGENET should 'select BROADCOM_PHY' to make the driver work correctly, but fails to do this because of the dependency. During early boot, this means it cannot access the PHY because that is in a loadable module, despite commit 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") trying to ensure that it could. Note that many other ethernet drivers don't have this particular 'select' statement and just rely on the .config to contain a sensible set of drivers. In particular that is true when running 64-bit kernels on the same chip, which is now the normal configuration. The alternative to YueHaibing's fix would be to just revert 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") and instead change the defconfig file to include the phy driver, as we do elsewhere. Arnd
[Florian's broadcom.com address bounces, adding him to Cc with his gmail address] On Tue, Nov 29, 2022, at 12:56, Arnd Bergmann wrote: > On Tue, Nov 29, 2022, at 04:18, Jakub Kicinski wrote: >> On Fri, 25 Nov 2022 19:50:03 +0800 YueHaibing wrote: >>> diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig >>> index 55dfdb34e37b..f4ca0c6c0f51 100644 >>> --- a/drivers/net/ethernet/broadcom/Kconfig >>> +++ b/drivers/net/ethernet/broadcom/Kconfig >>> @@ -71,13 +71,14 @@ config BCM63XX_ENET >>> config BCMGENET >>> tristate "Broadcom GENET internal MAC support" >>> depends on HAS_IOMEM >>> + depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835 >>> select MII >>> select PHYLIB >>> select FIXED_PHY >>> select BCM7XXX_PHY >>> select MDIO_BCM_UNIMAC >>> select DIMLIB >>> - select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) >>> + select BROADCOM_PHY if ARCH_BCM2835 >>> help >>> This driver supports the built-in Ethernet MACs found in the >>> Broadcom BCM7xxx Set Top Box family chipset. >> >> What's the code path that leads to the failure? I want to double check >> that the driver is handling the PTP registration return codes correctly. >> IIUC this is a source of misunderstandings in the PTP API. >> >> Richard, here's the original report: >> https://lore.kernel.org/all/CA+G9fYvKfbJHcMZtybf_0Ru3+6fKPg9HwWTOhdCLrOBXMaeG1A@mail.gmail.com > > The original report was for a different bug that resulted in the > BROADCOM_PHY driver not being selectable at all. > > The remaining problem here is this configuration: > > CONFIG_ARM=y > CONFIG_BCM2835=y > CONFIG_BCMGENET=y > CONFIG_PTP_1588_CLOCK=m > CONFIG_PTP_1588_CLOCK_OPTIONAL=m > CONFIG_BROADCOM_PHY=m > > In this case, BCMGENET should 'select BROADCOM_PHY' to make the > driver work correctly, but fails to do this because of the > dependency. During early boot, this means it cannot access the > PHY because that is in a loadable module, despite commit > 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > trying to ensure that it could. > > Note that many other ethernet drivers don't have this > particular 'select' statement and just rely on the .config > to contain a sensible set of drivers. In particular that > is true when running 64-bit kernels on the same chip, > which is now the normal configuration. > > The alternative to YueHaibing's fix would be to just revert > 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > and instead change the defconfig file to include the phy driver, > as we do elsewhere. > > Arnd
On 11/29/22 03:58, Arnd Bergmann wrote: > [Florian's broadcom.com address bounces, adding him to Cc > with his gmail address] Yes, because it's not a valid email address :) it's either lastname, or first.lastname. > > On Tue, Nov 29, 2022, at 12:56, Arnd Bergmann wrote: >> On Tue, Nov 29, 2022, at 04:18, Jakub Kicinski wrote: >>> On Fri, 25 Nov 2022 19:50:03 +0800 YueHaibing wrote: >>>> diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig >>>> index 55dfdb34e37b..f4ca0c6c0f51 100644 >>>> --- a/drivers/net/ethernet/broadcom/Kconfig >>>> +++ b/drivers/net/ethernet/broadcom/Kconfig >>>> @@ -71,13 +71,14 @@ config BCM63XX_ENET >>>> config BCMGENET >>>> tristate "Broadcom GENET internal MAC support" >>>> depends on HAS_IOMEM >>>> + depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835 >>>> select MII >>>> select PHYLIB >>>> select FIXED_PHY >>>> select BCM7XXX_PHY >>>> select MDIO_BCM_UNIMAC >>>> select DIMLIB >>>> - select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) >>>> + select BROADCOM_PHY if ARCH_BCM2835 >>>> help >>>> This driver supports the built-in Ethernet MACs found in the >>>> Broadcom BCM7xxx Set Top Box family chipset. >>> >>> What's the code path that leads to the failure? I want to double check >>> that the driver is handling the PTP registration return codes correctly. >>> IIUC this is a source of misunderstandings in the PTP API. >>> >>> Richard, here's the original report: >>> https://lore.kernel.org/all/CA+G9fYvKfbJHcMZtybf_0Ru3+6fKPg9HwWTOhdCLrOBXMaeG1A@mail.gmail.com >> >> The original report was for a different bug that resulted in the >> BROADCOM_PHY driver not being selectable at all. >> >> The remaining problem here is this configuration: >> >> CONFIG_ARM=y >> CONFIG_BCM2835=y >> CONFIG_BCMGENET=y >> CONFIG_PTP_1588_CLOCK=m >> CONFIG_PTP_1588_CLOCK_OPTIONAL=m >> CONFIG_BROADCOM_PHY=m >> >> In this case, BCMGENET should 'select BROADCOM_PHY' to make the >> driver work correctly, but fails to do this because of the >> dependency. During early boot, this means it cannot access the >> PHY because that is in a loadable module, despite commit >> 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") >> trying to ensure that it could. I don't believe this is the failure mechanism because there is always a fallback to the Generic PHY driver, the issue is that we have configured a specific RGMII mode in the Device Tree that is acted on by both the Ethernet MAC and the PHY in a way that is electrically incompatible unless the proper PHY driver is also enabled such that the RGMII mode is enabled on the PHY side.
On Tue, 29 Nov 2022 12:58:23 +0100 Arnd Bergmann wrote: > > The original report was for a different bug that resulted in the > > BROADCOM_PHY driver not being selectable at all. > > > > The remaining problem here is this configuration: > > > > CONFIG_ARM=y > > CONFIG_BCM2835=y > > CONFIG_BCMGENET=y > > CONFIG_PTP_1588_CLOCK=m > > CONFIG_PTP_1588_CLOCK_OPTIONAL=m > > CONFIG_BROADCOM_PHY=m > > > > In this case, BCMGENET should 'select BROADCOM_PHY' to make the > > driver work correctly, but fails to do this because of the > > dependency. During early boot, this means it cannot access the > > PHY because that is in a loadable module, despite commit > > 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > > trying to ensure that it could. > > > > Note that many other ethernet drivers don't have this > > particular 'select' statement and just rely on the .config > > to contain a sensible set of drivers. In particular that > > is true when running 64-bit kernels on the same chip, > > which is now the normal configuration. > > > > The alternative to YueHaibing's fix would be to just revert > > 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > > and instead change the defconfig file to include the phy driver, > > as we do elsewhere. Ah, got it now, I think. Alternatively we could flip the 'select' to 'depends on' and make the user do the legwork? Enough brain cycles spend on this simple fix tho, so applying, thanks! :)
Hello: This patch was applied to netdev/net.git (master) by Jakub Kicinski <kuba@kernel.org>: On Fri, 25 Nov 2022 19:50:03 +0800 you wrote: > commit 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") fixes the build > that contain 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") > and enable BCMGENET=y but PTP_1588_CLOCK_OPTIONAL=m, which otherwise > leads to a link failure. However this may trigger a runtime failure. > > Fix the original issue by propagating the PTP_1588_CLOCK_OPTIONAL dependency > of BROADCOM_PHY down to BCMGENET. > > [...] Here is the summary with links: - net: broadcom: Add PTP_1588_CLOCK_OPTIONAL dependency for BCMGENET under ARCH_BCM2835 https://git.kernel.org/netdev/net/c/421f8663b3a7 You are awesome, thank you!
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig index 55dfdb34e37b..f4ca0c6c0f51 100644 --- a/drivers/net/ethernet/broadcom/Kconfig +++ b/drivers/net/ethernet/broadcom/Kconfig @@ -71,13 +71,14 @@ config BCM63XX_ENET config BCMGENET tristate "Broadcom GENET internal MAC support" depends on HAS_IOMEM + depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835 select MII select PHYLIB select FIXED_PHY select BCM7XXX_PHY select MDIO_BCM_UNIMAC select DIMLIB - select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) + select BROADCOM_PHY if ARCH_BCM2835 help This driver supports the built-in Ethernet MACs found in the Broadcom BCM7xxx Set Top Box family chipset.