From patchwork Wed Feb 1 18:23:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 51504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp441894wrn; Wed, 1 Feb 2023 10:35:37 -0800 (PST) X-Google-Smtp-Source: AK7set/MqdFiXsC9L983tfhtJkGe36flaeGG1/ufBMQ+IpXWk6XH+ddPWRrnqsdfA2/zSVcoZT12 X-Received: by 2002:a17:903:11c7:b0:196:489a:a79f with SMTP id q7-20020a17090311c700b00196489aa79fmr4425573plh.6.1675276536922; Wed, 01 Feb 2023 10:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675276536; cv=none; d=google.com; s=arc-20160816; b=J/488vBWtrUcDxbQe5EDfMkE10+tOWHKLAZrBbe89kNUrIPQXQ+c9+fBoadewfchRU 69aDulmn6g1PcJ7TwwdHnH4YzGE774CO1bVAXYdMCjxOinQiYKZ08dNlBLczDoTc8rMH tZJD6rBSMSSlPUVVT739VMGe9zIBbtDO0hzUXS5xoETltTH4rCF7t1DGllAfoZHH4YeY rbBungcb2fT1n9hJBb2Bno2QzKLVmsnf+FfN+btJ7oyRmiBKq8HKWJ9pzDi2Ska+9ICw Vz+wTpYLI4EUuJxxNgOUpKcbWJC67pSNe10qFjCjFzWhb4Z7liQPSKNnlV20xR/Eq8XL o3gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hYKFLDvzgz8wTu0yXVwwGPKrvCrQ3oHXNUgm8HiM3ec=; b=bdOJuPyCO4tqjcAORPq9GCuckuN8PzGmamnDt6zUfE7hiiwVVTC3hVwzEM1eeM60C5 qsF1CVKF9SkRMFw977Do+22yXCxOEl92GBnK5D1J1PUrSfAcTrVMHYiHOnS9p+YYB9sR RF3XjIN0LtU8w3zdbTIFHccdKzhPAQsDfdiZ8luAT59B8ExcvS7Z/FxPiCDsV6H5IxaY eV/MJkPLybQRyNxtIpZYpHHZRQU138SBWAWgBFMwpubi20h3D4aw7INbZtckVSYjZ5AC CvZHClqT9fsp0J544R4AygwlbuUPTF/DEYxFgdmCavvTKm3ac+gTGwLYwHmbAX0oBo8o xAoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mork.no header.s=b header.b=EQNrY+Yd; 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=NONE sp=NONE dis=NONE) header.from=mork.no Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020a637d57000000b004da538f8991si18988438pgn.442.2023.02.01.10.35.25; Wed, 01 Feb 2023 10:35:36 -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; dkim=pass header.i=@mork.no header.s=b header.b=EQNrY+Yd; 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=NONE sp=NONE dis=NONE) header.from=mork.no Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbjBAS03 (ORCPT + 99 others); Wed, 1 Feb 2023 13:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjBAS02 (ORCPT ); Wed, 1 Feb 2023 13:26:28 -0500 X-Greylist: delayed 81 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 01 Feb 2023 10:26:27 PST Received: from dilbert.mork.no (dilbert.mork.no [IPv6:2a01:4f9:c010:a439::d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21AD17D285; Wed, 1 Feb 2023 10:26:26 -0800 (PST) Received: from canardo.dyn.mork.no ([IPv6:2a01:799:c9a:3200:0:0:0:1]) (authenticated bits=0) by dilbert.mork.no (8.15.2/8.15.2) with ESMTPSA id 311INgCw648785 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 1 Feb 2023 18:23:43 GMT Received: from canardo.dyn.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.dyn.mork.no (8.15.2/8.15.2) with ESMTPS id 311INbFC943482 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 1 Feb 2023 19:23:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1675275817; bh=hYKFLDvzgz8wTu0yXVwwGPKrvCrQ3oHXNUgm8HiM3ec=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=EQNrY+YdMp/sl8tD766VRm3nsIaI2jF3PEgU2yztlwaIQB+8Kb9KTGf/JUIZO1z7Z p3cke/THVCSv8x2diDspXamnyFu8v01WMOWsUIV3KoaBraD/siOK9ywaOJ9qGmaM9J MIfStSJbzvq+44DEn64BkBfQ4ZF24CGMpSdsIEEk= Received: (from bjorn@localhost) by canardo.dyn.mork.no (8.15.2/8.15.2/Submit) id 311INb6t943481; Wed, 1 Feb 2023 19:23:37 +0100 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: netdev@vger.kernel.org Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Russell King , Daniel Golle , Alexander Couzens , Simon Horman , Paolo Abeni , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Matthias Brugger , =?utf-8?q?Ren=C3=A9_van_Dorst?= , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King , =?utf-8?q?Bj=C3=B8rn_Mork?= Subject: [PATCH v5 net 1/3] net: mediatek: sgmii: ensure the SGMII PHY is powered down on configuration Date: Wed, 1 Feb 2023 19:23:29 +0100 Message-Id: <20230201182331.943411-2-bjorn@mork.no> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230201182331.943411-1-bjorn@mork.no> References: <20230201182331.943411-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 X-Virus-Scanned: clamav-milter 0.103.7 at canardo X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756654769923740404?= X-GMAIL-MSGID: =?utf-8?q?1756654769923740404?= From: Alexander Couzens The code expect the PHY to be in power down which is only true after reset. Allow changes of the SGMII parameters more than once. Only power down when reconfiguring to avoid bouncing the link when there's no reason to - based on code from Russell King. There are cases when the SGMII_PHYA_PWD register contains 0x9 which prevents SGMII from working. The SGMII still shows link but no traffic can flow. Writing 0x0 to the PHYA_PWD register fix the issue. 0x0 was taken from a good working state of the SGMII interface. Fixes: 42c03844e93d ("net-next: mediatek: add support for MediaTek MT7622 SoC") Suggested-by: Russell King (Oracle) Signed-off-by: Alexander Couzens [ bmork: rebased and squashed into one patch ] Reviewed-by: Russell King (Oracle) Signed-off-by: Bjørn Mork --- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 ++ drivers/net/ethernet/mediatek/mtk_sgmii.c | 39 +++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 18a50529ce7b..01a38f5145b1 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -1036,11 +1036,13 @@ struct mtk_soc_data { * @regmap: The register map pointing at the range used to setup * SGMII modes * @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap + * @interface: Currently configured interface mode * @pcs: Phylink PCS structure */ struct mtk_pcs { struct regmap *regmap; u32 ana_rgc3; + phy_interface_t interface; struct phylink_pcs pcs; }; diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c index 5c286f2c9418..0a06995099cf 100644 --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c @@ -43,11 +43,6 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, int advertise, link_timer; bool changed, use_an; - if (interface == PHY_INTERFACE_MODE_2500BASEX) - rgc3 = RG_PHY_SPEED_3_125G; - else - rgc3 = 0; - advertise = phylink_mii_c22_pcs_encode_advertisement(interface, advertising); if (advertise < 0) @@ -88,9 +83,22 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, bmcr = 0; } - /* Configure the underlying interface speed */ - regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3, - RG_PHY_SPEED_3_125G, rgc3); + if (mpcs->interface != interface) { + /* PHYA power down */ + regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, + SGMII_PHYA_PWD, SGMII_PHYA_PWD); + + if (interface == PHY_INTERFACE_MODE_2500BASEX) + rgc3 = RG_PHY_SPEED_3_125G; + else + rgc3 = 0; + + /* Configure the underlying interface speed */ + regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3, + RG_PHY_SPEED_3_125G, rgc3); + + mpcs->interface = interface; + } /* Update the advertisement, noting whether it has changed */ regmap_update_bits_check(mpcs->regmap, SGMSYS_PCS_ADVERTISE, @@ -108,9 +116,17 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, regmap_update_bits(mpcs->regmap, SGMSYS_PCS_CONTROL_1, SGMII_AN_RESTART | SGMII_AN_ENABLE, bmcr); - /* Release PHYA power down state */ - regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, - SGMII_PHYA_PWD, 0); + /* Release PHYA power down state + * Only removing bit SGMII_PHYA_PWD isn't enough. + * There are cases when the SGMII_PHYA_PWD register contains 0x9 which + * prevents SGMII from working. The SGMII still shows link but no traffic + * can flow. Writing 0x0 to the PHYA_PWD register fix the issue. 0x0 was + * taken from a good working state of the SGMII interface. + * Unknown how much the QPHY needs but it is racy without a sleep. + * Tested on mt7622 & mt7986. + */ + usleep_range(50, 100); + regmap_write(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, 0); return changed; } @@ -171,6 +187,7 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *r, u32 ana_rgc3) return PTR_ERR(ss->pcs[i].regmap); ss->pcs[i].pcs.ops = &mtk_pcs_ops; + ss->pcs[i].interface = PHY_INTERFACE_MODE_NA; } return 0; From patchwork Wed Feb 1 18:23:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 51506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp441995wrn; Wed, 1 Feb 2023 10:35:47 -0800 (PST) X-Google-Smtp-Source: AK7set9P4upBp+bWvsxavTQmj9EikvpvsAm2RskZoSVi20BTFiAEmsyToAxzutpCtMxx4wwlrrc1 X-Received: by 2002:a05:6a20:8bb0:b0:bc:7dc0:6a55 with SMTP id m48-20020a056a208bb000b000bc7dc06a55mr3365364pzh.29.1675276546895; Wed, 01 Feb 2023 10:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675276546; cv=none; d=google.com; s=arc-20160816; b=dgXD6pqhvVewoApzoDU2xZvOC1doQ9mVBuORCWxGyJmoPYR/deF4BWm1UvYyXXCUyf NmZ9hhH7MrZMmdHKjY6VgGwi89Wq9G6miRuRIDv2sno6iozGLHaQ2l4ByqGw53qL4QzY EKsGXq2ZBzyH66Roh4ZmC2Sq6PAcMv41LptjT5azbbXsx0oavGMq9jywFbeIpvwZS2B6 7g1SAuZ47GX1IKeo47IdaEV+Q+Mp7JFuCcKR1VIkEOGjocc9vGJfZnAxzWruqbrRC4Dk esWrbpC4S8L69+9nWfJyDzl19Uidoom99urTe+A67ZLK/xFDyorAeOdvPbseFw9qALZK 0RXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GFp/X5eUiRxs39WBP/bBKYq6n8rAaordpE22XIcRs3o=; b=kzbwV7WniHqQaQwr8wMAFhe43NOHGxYpfsBFSYe3YFXWggyaFBxVCzsoNqPjI1oQlv qBjDSSz6GrAJO9YpIE1RAkUjx6VlBUynHbwykKSp1fwh1wU/VDgSbt2HSUer25SzteMN Ac9URm5Rx3zJSR4Fk8DjWOZgb/mty+a0l0V35no/OXfijOvQ3lyLhUHnZYV7okCUQQai jsE5nHTDw9898pZQlyYpx/z1EXnrR3kBuFUKZYENbZVsen0uzU9OebygrTVbYIfWd0A9 V0suel3yacVL+vTas40IcJljAOKOqQJTVBPQpDG8wvlzObIctbJYCnyZmP6K2ZgNT1rp DBRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mork.no header.s=b header.b="hWBN14/2"; 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=NONE sp=NONE dis=NONE) header.from=mork.no Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a656a04000000b004cc3c59b5f0si23560417pgu.329.2023.02.01.10.35.34; Wed, 01 Feb 2023 10:35:46 -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; dkim=pass header.i=@mork.no header.s=b header.b="hWBN14/2"; 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=NONE sp=NONE dis=NONE) header.from=mork.no Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232034AbjBAS0g (ORCPT + 99 others); Wed, 1 Feb 2023 13:26:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbjBAS02 (ORCPT ); Wed, 1 Feb 2023 13:26:28 -0500 Received: from dilbert.mork.no (dilbert.mork.no [IPv6:2a01:4f9:c010:a439::d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E5667F303; Wed, 1 Feb 2023 10:26:27 -0800 (PST) Received: from canardo.dyn.mork.no ([IPv6:2a01:799:c9a:3200:0:0:0:1]) (authenticated bits=0) by dilbert.mork.no (8.15.2/8.15.2) with ESMTPSA id 311INgIH648786 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 1 Feb 2023 18:23:44 GMT Received: from canardo.dyn.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.dyn.mork.no (8.15.2/8.15.2) with ESMTPS id 311INbnI943492 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 1 Feb 2023 19:23:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1675275817; bh=GFp/X5eUiRxs39WBP/bBKYq6n8rAaordpE22XIcRs3o=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=hWBN14/2wzWOK+nFje/kXjMYvsUSle8vOEHyiepQkgr21Jm8Eut/PqaJg8/UqG8yy 3u3/HKHiX3/pL9k0ut1bvwidn0bBcqglycX1udqOiIi0MmvRFyv+t7JvaFZgDFDYeW 6q+4KSL052su2g5UUYOrMtZFMu3YDDx3c6xOW8Qs= Received: (from bjorn@localhost) by canardo.dyn.mork.no (8.15.2/8.15.2/Submit) id 311INbIQ943491; Wed, 1 Feb 2023 19:23:37 +0100 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: netdev@vger.kernel.org Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Russell King , Daniel Golle , Alexander Couzens , Simon Horman , Paolo Abeni , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Matthias Brugger , =?utf-8?q?Ren=C3=A9_van_Dorst?= , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Bj=C3=B8rn_Mork?= , Russell King Subject: [PATCH v5 net 2/3] net: mediatek: sgmii: fix duplex configuration Date: Wed, 1 Feb 2023 19:23:30 +0100 Message-Id: <20230201182331.943411-3-bjorn@mork.no> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230201182331.943411-1-bjorn@mork.no> References: <20230201182331.943411-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 X-Virus-Scanned: clamav-milter 0.103.7 at canardo X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756654780249163271?= X-GMAIL-MSGID: =?utf-8?q?1756654780249163271?= The logic of the duplex bit is inverted. Setting it means half duplex, not full duplex. Fix and rename macro to avoid confusion. Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII") Reviewed-by: Russell King (Oracle) Signed-off-by: Bjørn Mork --- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +- drivers/net/ethernet/mediatek/mtk_sgmii.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 01a38f5145b1..2d9186d32bc0 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -519,7 +519,7 @@ #define SGMII_SPEED_10 FIELD_PREP(SGMII_SPEED_MASK, 0) #define SGMII_SPEED_100 FIELD_PREP(SGMII_SPEED_MASK, 1) #define SGMII_SPEED_1000 FIELD_PREP(SGMII_SPEED_MASK, 2) -#define SGMII_DUPLEX_FULL BIT(4) +#define SGMII_DUPLEX_HALF BIT(4) #define SGMII_IF_MODE_BIT5 BIT(5) #define SGMII_REMOTE_FAULT_DIS BIT(8) #define SGMII_CODE_SYNC_SET_VAL BIT(9) diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c index 0a06995099cf..c4261069b521 100644 --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c @@ -154,11 +154,11 @@ static void mtk_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, else sgm_mode = SGMII_SPEED_1000; - if (duplex == DUPLEX_FULL) - sgm_mode |= SGMII_DUPLEX_FULL; + if (duplex != DUPLEX_FULL) + sgm_mode |= SGMII_DUPLEX_HALF; regmap_update_bits(mpcs->regmap, SGMSYS_SGMII_MODE, - SGMII_DUPLEX_FULL | SGMII_SPEED_MASK, + SGMII_DUPLEX_HALF | SGMII_SPEED_MASK, sgm_mode); } } From patchwork Wed Feb 1 18:23:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 51505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp441981wrn; Wed, 1 Feb 2023 10:35:45 -0800 (PST) X-Google-Smtp-Source: AK7set/QPXTO8dYF3Az/hFswzrNxVhXBA1pjEFrhaPBUxVFikyXJADaUXNnbITsdYChq2/FyhUGf X-Received: by 2002:a05:6a20:ba8f:b0:be:df22:96c9 with SMTP id fb15-20020a056a20ba8f00b000bedf2296c9mr3248523pzb.11.1675276545139; Wed, 01 Feb 2023 10:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675276545; cv=none; d=google.com; s=arc-20160816; b=uXbX7mX1ULa552jEO0WSbaJHLNnpUH5p2avpkmLCSOCB/3TSaYwVhBkEnu3jfvLjiG IvajBiHkjc/8u7owPNIjgaAS6P6q16i9RI1CrCwyKxFNfQDO5EUhtrwB7sSF0kelLYUC Hwr1CUbRqFZCA4UJCyP5slpCqaEqECdLQNYr+NEyI0yGJli3TTt417D8e/zR2FUXp9cq C0UIwI0U0Rihnm1Q9uz8gBweWEgLMHGDlNGd/cQVdxV+8gqMXvScZpHgCrRJ2eqVGb0I 3sP7DMVcqnFulXSpdhPN7X6KDn64y9bjR11VZ6WwJqKezN/PAkkrLwr0HPt2CcSMvezJ zTDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Glgu/yk2U5EWQt75/QlM/u6TaWcg4FLsGoFLNc2dM8Q=; b=QH7pa5XB9J+BgvBQaoKegvUkRMbOOLVem98eyff9VYU2BpruwwQqZMuVcEgN2U/GOj HkWqII1Ml3xJ/Z2gSqilgBOVhsYVjrTAD5F7Rkzgy1mj2TLGoF2oDL4p2Ikhw93+BYfn s1dyd/zio72HqLOwar//w8ci7okyHMZyE77NaiSrgOQqnvBuLIhzKdJCb15S0pqBLzwU eyQQjZ86hbqI+oenQaZWgrBFrjcU75PvF5Sh4LI+XdhU9q5rU7Z0to84iwHNMBybkN5m RGJQ4EPJR7Rm2wz1MsiYcevAAAlbmM9aLerLNAJzqJHtw9L2qy32LGLhv7GNzU2esysz fEZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mork.no header.s=b header.b="Sph/y2KG"; 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=NONE sp=NONE dis=NONE) header.from=mork.no Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a63a845000000b004e73c30e3fbsi11733245pgp.571.2023.02.01.10.35.33; Wed, 01 Feb 2023 10:35:45 -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; dkim=pass header.i=@mork.no header.s=b header.b="Sph/y2KG"; 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=NONE sp=NONE dis=NONE) header.from=mork.no Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbjBAS0d (ORCPT + 99 others); Wed, 1 Feb 2023 13:26:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbjBAS02 (ORCPT ); Wed, 1 Feb 2023 13:26:28 -0500 Received: from dilbert.mork.no (dilbert.mork.no [IPv6:2a01:4f9:c010:a439::d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D907EFE1; Wed, 1 Feb 2023 10:26:27 -0800 (PST) Received: from canardo.dyn.mork.no ([IPv6:2a01:799:c9a:3200:0:0:0:1]) (authenticated bits=0) by dilbert.mork.no (8.15.2/8.15.2) with ESMTPSA id 311INgu6648787 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 1 Feb 2023 18:23:44 GMT Received: from canardo.dyn.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.dyn.mork.no (8.15.2/8.15.2) with ESMTPS id 311INbfD943502 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 1 Feb 2023 19:23:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1675275817; bh=Glgu/yk2U5EWQt75/QlM/u6TaWcg4FLsGoFLNc2dM8Q=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=Sph/y2KGFxMJYIQWs6QVFiaaGAQ0wWLhhp7LicCpUJjrfeqIDd+XJzvb2qVKxJ9Mr GoKVwYDVvwbsoYHHw9BL0JEaEW+RJgTIhs1MXveqrhAqMZCzV5y67pbnRjj9vZtam4 tOWyevD+aLFExf/dfkE03aa4AFfKGglM9hQe1V4M= Received: (from bjorn@localhost) by canardo.dyn.mork.no (8.15.2/8.15.2/Submit) id 311INbas943501; Wed, 1 Feb 2023 19:23:37 +0100 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: netdev@vger.kernel.org Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Russell King , Daniel Golle , Alexander Couzens , Simon Horman , Paolo Abeni , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Matthias Brugger , =?utf-8?q?Ren=C3=A9_van_Dorst?= , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King , =?utf-8?q?Bj=C3=B8rn_Mork?= Subject: [PATCH v5 net 3/3] mtk_sgmii: enable PCS polling to allow SFP work Date: Wed, 1 Feb 2023 19:23:31 +0100 Message-Id: <20230201182331.943411-4-bjorn@mork.no> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230201182331.943411-1-bjorn@mork.no> References: <20230201182331.943411-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 X-Virus-Scanned: clamav-milter 0.103.7 at canardo X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756654778810928821?= X-GMAIL-MSGID: =?utf-8?q?1756654778810928821?= From: Alexander Couzens Currently there is no IRQ handling (even the SGMII supports it). Enable polling to support SFP ports. Fixes: 14a44ab0330d ("net: mtk_eth_soc: partially convert to phylink_pcs") Reviewed-by: Russell King (Oracle) Signed-off-by: Alexander Couzens [ bmork: changed "1" => "true" ] Signed-off-by: Bjørn Mork --- drivers/net/ethernet/mediatek/mtk_sgmii.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c index c4261069b521..bb00de1003ac 100644 --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c @@ -187,6 +187,7 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *r, u32 ana_rgc3) return PTR_ERR(ss->pcs[i].regmap); ss->pcs[i].pcs.ops = &mtk_pcs_ops; + ss->pcs[i].pcs.poll = true; ss->pcs[i].interface = PHY_INTERFACE_MODE_NA; }