From patchwork Wed Jan 13 11:56:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjarni Jonasson X-Patchwork-Id: 12016639 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 X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 048D9C433E9 for ; Wed, 13 Jan 2021 11:58:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C40722CE3 for ; Wed, 13 Jan 2021 11:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727401AbhAML6S (ORCPT ); Wed, 13 Jan 2021 06:58:18 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:39618 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbhAML6R (ORCPT ); Wed, 13 Jan 2021 06:58:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1610539097; x=1642075097; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=kyI6fnFUneAqkE2szMtIRF09ZE7CRfZRtPfxT1qCXGU=; b=aL9QuOwHhODO9+TEIVQAmVci8aydDzjyQB2czYPYDSHkWaEHhCnukDap VspWyzCELPjYGcB5edZUUDtQCsnpV44vbcRPJylATVtEBXDEbrmzhxYaR b/BOJRSeJXpJQuJKuEyxzvSd16TLvqsOCPaINwl61VBYlL9mC9nStDFrq p8om1+396rYJFKp973NiwUz4+HRMJZ6EE//iZktCUBpsQxqBWolLQIiC4 S7ggbwVdFj8p9GtpuNkerpLsTNC+Ikqed1pFVNFycvgc2yu34on4TeBSV 63CJnNGk4AK8TIgN3t48o78jtlwrUMus+GTDL+07z+Zom3v1wC3+M43xy Q==; IronPort-SDR: vCxkMK+dtOB/z5fs4QsD2tZlEB9zjnFuQ9mZoshtXtQOLKVMUFbHaFGxv5r2rgAzt/ND1vE2j1 BNQf36qRhCSYcXSi7fa1ooeNimMIpT9kHhkQy4O4dex25iSHAo/pAbzP20gCKg3jOpgb6UWXGU 6li8OyIXOMxR7DuyyPoxYD92HDmzU7L7/eSOPcTHz+qkHL+vdUwP/fP8mw7WKk+rW+Dw9XhaUk jZgdO7X5k+s3Kk9I7+vE+T9z0LBdLHereyVg5DW3LQ0lJTJ29yrscnnt17QU+MqcoazUghR/y9 kGI= X-IronPort-AV: E=Sophos;i="5.79,344,1602572400"; d="scan'208";a="105823816" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 13 Jan 2021 04:57:01 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 13 Jan 2021 04:57:01 -0700 Received: from soft-dev2.microsemi.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 13 Jan 2021 04:56:59 -0700 From: Bjarni Jonasson To: Russell King , Andrew Lunn , "Heiner Kallweit" , "David S. Miller" , Jakub Kicinski CC: Bjarni Jonasson , , , UNGLinuxDriver Subject: [PATCH net-next v2 1/2] net: phy: Add 100 base-x mode Date: Wed, 13 Jan 2021 12:56:25 +0100 Message-ID: <20210113115626.17381-2-bjarni.jonasson@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210113115626.17381-1-bjarni.jonasson@microchip.com> References: <20210113115626.17381-1-bjarni.jonasson@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Sparx-5 supports this mode and it is missing in the PHY core. Signed-off-by: Bjarni Jonasson Reviewed-by: Russell King --- Documentation/networking/phy.rst | 5 +++++ include/linux/phy.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Documentation/networking/phy.rst b/Documentation/networking/phy.rst index b2f7ec794bc8..399f17976a6c 100644 --- a/Documentation/networking/phy.rst +++ b/Documentation/networking/phy.rst @@ -286,6 +286,11 @@ Some of the interface modes are described below: Note: due to legacy usage, some 10GBASE-R usage incorrectly makes use of this definition. +``PHY_INTERFACE_MODE_100BASEX`` + This defines IEEE 802.3 Clause 24. The link operates at a fixed data + rate of 125Mpbs using a 4B/5B encoding scheme, resulting in an underlying + data rate of 100Mpbs. + Pause frames / flow control =========================== diff --git a/include/linux/phy.h b/include/linux/phy.h index 9effb511acde..24fcc6456a9e 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -104,6 +104,7 @@ extern const int phy_10gbit_features_array[1]; * @PHY_INTERFACE_MODE_MOCA: Multimedia over Coax * @PHY_INTERFACE_MODE_QSGMII: Quad SGMII * @PHY_INTERFACE_MODE_TRGMII: Turbo RGMII + * @PHY_INTERFACE_MODE_100BASEX: 100 BaseX * @PHY_INTERFACE_MODE_1000BASEX: 1000 BaseX * @PHY_INTERFACE_MODE_2500BASEX: 2500 BaseX * @PHY_INTERFACE_MODE_RXAUI: Reduced XAUI @@ -135,6 +136,7 @@ typedef enum { PHY_INTERFACE_MODE_MOCA, PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, + PHY_INTERFACE_MODE_100BASEX, PHY_INTERFACE_MODE_1000BASEX, PHY_INTERFACE_MODE_2500BASEX, PHY_INTERFACE_MODE_RXAUI, @@ -217,6 +219,8 @@ static inline const char *phy_modes(phy_interface_t interface) return "usxgmii"; case PHY_INTERFACE_MODE_10GKR: return "10gbase-kr"; + case PHY_INTERFACE_MODE_100BASEX: + return "100base-x"; default: return "unknown"; } From patchwork Wed Jan 13 11:56:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjarni Jonasson X-Patchwork-Id: 12016641 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 X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A0DC4332B for ; Wed, 13 Jan 2021 11:58:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2E96233F7 for ; Wed, 13 Jan 2021 11:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727453AbhAML60 (ORCPT ); Wed, 13 Jan 2021 06:58:26 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:22207 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727294AbhAML60 (ORCPT ); Wed, 13 Jan 2021 06:58:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1610539105; x=1642075105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KO1w7xRaJxa2Jb3V9ESyr8eR3uoe0LjjTbeTHnAaXg0=; b=UOytp/BeKE9rPm8wxUheeDwujyu2XMKSO1pmDvRhsz8kEXoTQoBMnstS D7lKMea2iZnlAXlfyFXHZVZEDXnFfhki9Ri8POUFce01OJRBpjMWJYJZO HG2P59jPmx6Pene8r07h2EndtMKixyoH13m9uY3wThTwZeB1k6lw/Tehz wzj7RdgBhzt34tTzlQ4DwKYNNX9a5sCwPmR6xdRaWt0FbkwGJSFm8Knic upH14lHbuMkS085fuh9GNktS3TPq8/omnvRLqo+AtGACt7559hs2pfZG8 80znmVTf1M7ZDWVTv4I2hgjjjPqMBGHdHXuyYuueqHfms1M8l+gK2yAV2 Q==; IronPort-SDR: U8DT2wDzGcGwYDdYV3NOgOsY/3Gc7mPYhl1+1pwWzDm9FP/ZQ9DevX+kwVGQ8M/FAQkgdZiCWM 1rJjk78s4EgHiFnmv81tGbPULuv8xy4q1WOAvPDLWGv6jBtHsGlbPdCEIhGTar0GaQIkNYNYl7 Q96aI2iObx8wf6BsRubFcWJ9d8hdPp/5dum3sXY+6zIfSURFzcF3jhFNbi8P334XgcADPDCMka uJX8ZA5Juu17rYKSRBMv1mpKvD3B1/ahdhwbZ4+6Y8IbRHOG6YRcn6dAREfn19sGd6zqmjzG/m axA= X-IronPort-AV: E=Sophos;i="5.79,344,1602572400"; d="scan'208";a="102726014" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 13 Jan 2021 04:57:09 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 13 Jan 2021 04:57:09 -0700 Received: from soft-dev2.microsemi.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 13 Jan 2021 04:57:07 -0700 From: Bjarni Jonasson To: Russell King , Andrew Lunn , "Heiner Kallweit" , "David S. Miller" , Jakub Kicinski CC: Bjarni Jonasson , , , UNGLinuxDriver Subject: [PATCH net-next v2 2/2] sfp: add support for 100 base-x SFPs Date: Wed, 13 Jan 2021 12:56:26 +0100 Message-ID: <20210113115626.17381-3-bjarni.jonasson@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210113115626.17381-1-bjarni.jonasson@microchip.com> References: <20210113115626.17381-1-bjarni.jonasson@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add support for 100Base-FX, 100Base-LX, 100Base-PX and 100Base-BX10 modules This is needed for Sparx-5 switch. Signed-off-by: Bjarni Jonasson Reviewed-by: Russell King --- drivers/net/phy/sfp-bus.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index cdfa0a190962..3c67ad9951ab 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -265,6 +265,12 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, br_min <= 1300 && br_max >= 1200) phylink_set(modes, 1000baseX_Full); + /* 100Base-FX, 100Base-LX, 100Base-PX, 100Base-BX10 */ + if (id->base.e100_base_fx || id->base.e100_base_lx) + phylink_set(modes, 100baseFX_Full); + if ((id->base.e_base_px || id->base.e_base_bx10) && br_nom == 100) + phylink_set(modes, 100baseFX_Full); + /* For active or passive cables, select the link modes * based on the bit rates and the cable compliance bytes. */ @@ -389,6 +395,9 @@ phy_interface_t sfp_select_interface(struct sfp_bus *bus, if (phylink_test(link_modes, 1000baseX_Full)) return PHY_INTERFACE_MODE_1000BASEX; + if (phylink_test(link_modes, 100baseFX_Full)) + return PHY_INTERFACE_MODE_100BASEX; + dev_warn(bus->sfp_dev, "Unable to ascertain link mode\n"); return PHY_INTERFACE_MODE_NA;