Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp203797rdh; Wed, 25 Oct 2023 22:44:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhqS882G3+p7Cy3Z6HTskrkFanE7twEpgd6lrwt09rY/d6+TjplWNhzq73QRMMvaAB/WUp X-Received: by 2002:a81:9147:0:b0:5ad:a3f9:1b10 with SMTP id i68-20020a819147000000b005ada3f91b10mr5825709ywg.10.1698299091632; Wed, 25 Oct 2023 22:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698299091; cv=none; d=google.com; s=arc-20160816; b=Io6TrOzrIiJfjhorxtXejPyH4HyFfAHNSRRUosxhmEwEluVn9AbrmRczHMNh7w8j3W vR7Hak0Ff3/bt+cMUp++BIB7X4xqsvkK4vc7vS4DcgZt536cFnqIAV1MdJxoXl/8R0xi l5ArvDiNIKMJmIrJJhv9hkWPFj3FdEM7/XcX/Q4CCfBOLOdoJFt7IYsDAlUhZKZc1GmM VpotdBtKS/9ZfdX/l8U5X6/COBQsbqpJeeBP+iNUdMaAAB9bst30lL0lXmj2lT6cAJVn mLyXJrtQkEdzQLzLjfxOh86EfKF50Vmjq6mAzAaD/HmIB5Np56duKRKprQLTUVZkaDjD nsxg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=YNzK01JBuvf3R6FFNfcgphfAf2aDTTQxKiSsXNWmLIY=; fh=roY2f/tihnO/b8u76mgTMJ/ED8s9gVVICPRGeXq4kzA=; b=DC1i7uO6x38Azr4GVa4BiTTK7Aye3diFVY6MVVVPFkfwHDNoNRBtDoC6Amxj1Sn/f4 z+9P7q5DljMohvp1mpE34QPYEWJ8WWnRMW/vJKPzfFG/GVTjYz9swlT82aKLncvGErUH WBLt909MRaqxF3vbgy7I+R+ZrCalg4PEZEtOHcnCQuQf368blsEgVl4el8wGO5zCexfo FeD+ZhJ5WAbf9uQhEAEOFTJezza9Pvt1O8qRcXO69yoTtJjcln27BZUk469H46K7ZIQQ dixefocAs/hg0TvrwD5Qyhd39oobC3AtRBxnTHa5X1omdxeEnOgxeU8B9XYrrUd9+9Pr kJWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="jXH/Owlu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j128-20020a0dc786000000b0058c5fee875esi12581676ywd.379.2023.10.25.22.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 22:44:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="jXH/Owlu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7854E81BEEBE; Wed, 25 Oct 2023 22:44:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344190AbjJZFop (ORCPT + 99 others); Thu, 26 Oct 2023 01:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344068AbjJZFoc (ORCPT ); Thu, 26 Oct 2023 01:44:32 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5765A1A2; Wed, 25 Oct 2023 22:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1698299064; x=1729835064; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=s4XlweU06/WjfxjbPFFYgx9tnnfQIqxKqZo14QClh4k=; b=jXH/Owlu8FHKyi8L+J2Gu9tL7qblx2ZsVYe96qT/992wt/1jETunbK3q jVPVtFKah/KG9fW6vqjVBiCcFJfjEKYeL3Adp2v55RSeVAfhmoVisXgmG Q3J18uSnWepTf8ePGjG2bbP2gMKqTKgVsqKURhA4aXu/cIp0DcjHQ0WSE jjHe7c9pMqrwRtoYse41Zs9fWMYptiBj4lWku1AKBA6OayZiWQbRL/qCY k2UB37jAej8dTPkXKuyavXYFIDgLJfQZK4TTzMWl0ssSpwYEYEXKQUuoD gdr5jtyaw6IMKErq3gEqrwLbhYWqR5yxr3HHQFfSFsx5ByvCfZ00aNoZg A==; X-CSE-ConnectionGUID: Uxd6NvfbRaGg4YfpXPM/Og== X-CSE-MsgGUID: ryL80tZOSGKD0wcqxcEsyg== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="11210278" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Oct 2023 22:44:22 -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.2507.21; Wed, 25 Oct 2023 22:44:21 -0700 Received: from HYD-DK-UNGSW21.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Wed, 25 Oct 2023 22:44:18 -0700 From: Raju Lakkaraju To: CC: , , , , , , , Subject: [PATCH net-next V1] net: pcs: xpcs: Add 2500BASE-X case in get state for XPCS drivers Date: Thu, 26 Oct 2023 11:13:05 +0530 Message-ID: <20231026054305.336968-1-Raju.Lakkaraju@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 22:44:50 -0700 (PDT) Add DW_2500BASEX case in xpcs_get_state( ) to update speed, duplex and pause Signed-off-by: Raju Lakkaraju --- Change List: ============ V0 -> V1: - Remove the auto-negotiation check due to currently the DW_2500BASEX mode doesn't imply any auto-negotiation drivers/net/pcs/pcs-xpcs.c | 29 +++++++++++++++++++++++++++++ drivers/net/pcs/pcs-xpcs.h | 2 ++ 2 files changed, 31 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 4dbc21f604f2..f5e1dcac9e3e 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1090,6 +1090,28 @@ static int xpcs_get_state_c37_1000basex(struct dw_xpcs *xpcs, return 0; } +static int xpcs_get_state_2500basex(struct dw_xpcs *xpcs, + struct phylink_link_state *state) +{ + int sts; + + sts = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_STS); + + state->link = !!(sts & DW_VR_MII_MMD_STS_LINK_STS); + if (!state->link) { + state->speed = SPEED_UNKNOWN; + state->pause = MLO_PAUSE_NONE; + state->duplex = DUPLEX_UNKNOWN; + return 0; + } + + state->speed = SPEED_2500; + state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX; + state->duplex = DUPLEX_FULL; + + return 0; +} + static void xpcs_get_state(struct phylink_pcs *pcs, struct phylink_link_state *state) { @@ -1127,6 +1149,13 @@ static void xpcs_get_state(struct phylink_pcs *pcs, ERR_PTR(ret)); } break; + case DW_2500BASEX: + ret = xpcs_get_state_2500basex(xpcs, state); + if (ret) { + pr_err("xpcs_get_state_2500basex returned %pe\n", + ERR_PTR(ret)); + } + break; default: return; } diff --git a/drivers/net/pcs/pcs-xpcs.h b/drivers/net/pcs/pcs-xpcs.h index 39a90417e535..96c36b32ca99 100644 --- a/drivers/net/pcs/pcs-xpcs.h +++ b/drivers/net/pcs/pcs-xpcs.h @@ -55,6 +55,8 @@ /* Clause 37 Defines */ /* VR MII MMD registers offsets */ #define DW_VR_MII_MMD_CTRL 0x0000 +#define DW_VR_MII_MMD_STS 0x0001 +#define DW_VR_MII_MMD_STS_LINK_STS BIT(2) #define DW_VR_MII_DIG_CTRL1 0x8000 #define DW_VR_MII_AN_CTRL 0x8001 #define DW_VR_MII_AN_INTR_STS 0x8002 -- 2.34.1