Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp321523rdh; Thu, 26 Oct 2023 03:18:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/brez1dJ09DMFljFHqT8aA9EZK7YHCH16R4h4yhzDpdqpU5XwVArvOF3yEwh+pw4E+sZd X-Received: by 2002:a9d:618d:0:b0:6b9:26ce:5e5c with SMTP id g13-20020a9d618d000000b006b926ce5e5cmr19782163otk.31.1698315511780; Thu, 26 Oct 2023 03:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698315511; cv=none; d=google.com; s=arc-20160816; b=mPrJqCC58N0DsTCc+X5kcgtsNG13w00H1rTIcd/iDl970AID1zGtLRMcgPdIJOgPmX lWe5sW3wHPFG4N8nWhpTJb5bVFJNnmKzCQfAxNXnMO5/xR8ris5klSEMi7AME9g0HtER bF/Nky8tudnuYXrSM+GrnIMHKDKeS77dklnKWb0pWJjQ5ikWtsNMJS60pFvtQ5D+1zEj xeJIz5b/b0GQL1ItXgmMHvPf6OVi8QtwfXAP4IRrO0p9YcwbZgiEm4c0P5vPVzvrzk3v a1aoepFHGth8C3MGnN1OwJdNYUB4q1E3CR2u3zGR2knvvsejdoJL/ngIUfIyRH01OSdS X3xg== 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=d3qFAk0dXEssihmgVm3vSQ7gaJQnXqfvi/dSt63wqzU=; fh=roY2f/tihnO/b8u76mgTMJ/ED8s9gVVICPRGeXq4kzA=; b=UeHdwsKztA4/A6hrW4F5vt+NAJ2tnGBKcLH/9EXBvVNO0OD4TSzkJueDMM4Z/nEX/2 YZNYh7AxDic0hwoLWpGqrqiWNmP9/b7t0kLDBL5TAuMTj8Xn6NzobStZwIPGOx58lmLo b/I8gEj9jiCCybnjuRXh4T6X5iR51wUTZRUwdLnZt3GgPBZzdNqFj3lqf0bHGAXs43vg nhyPppwIJFBclN4Rbp1Y9XZtM9jTj8RV7jnBnCL/iiR2HTWJa4fQQ1iO2Mo6IMFAESH0 SZ+xAnnJUuK3pgOBFXDCO7Fb7IMnLgxrW8Sn8GyBiRCikY8gteQpshYCOVy9zwBHM1p7 90Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=jSQlX4Pa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z63-20020a0dd742000000b005a7b91e234dsi14760196ywd.54.2023.10.26.03.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:18:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=jSQlX4Pa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 41A8F824C4FC; Thu, 26 Oct 2023 03:18:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbjJZKSX (ORCPT + 99 others); Thu, 26 Oct 2023 06:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjJZKSW (ORCPT ); Thu, 26 Oct 2023 06:18:22 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31F96183; Thu, 26 Oct 2023 03:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1698315500; x=1729851500; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tiJ94SMzePm8CGLJQBB+8e5vPbI81y2Nzad4KmqiHC8=; b=jSQlX4Pas5qiXz/UFXotqzGb+0Utk6S3HIDQN3d7uKf8p9sH5+l8llS4 C0NyfUAFq7XP7Zlk4sWlvbR3soCw2oZDV/lFnyWldtMnAnvJo7uB+0Hbf fBPUg6STxGGSH/K8vOKckg1tITADWHBJKn07N2WiuMej461HC0sZ+pJp6 EBnqpaNXATFj9MUF0iglPQlK+uv2LPPp2vngyt3IPV4P6v5ixUa88A7PJ VTly7En72O7mU7IKcennNdpPVVgqLb85B51l32XTmh3JrrR4NAC3Ts8+t 8KG/rr629IcVCKzfUG7GWLQRR4vpom5UWRnzYgrPVOu0HrRjESaG3HGLS w==; X-CSE-ConnectionGUID: qDRF6jxKTUqq7Gfds2wdJQ== X-CSE-MsgGUID: fqVwy8rsRWKUZd5aGAleNQ== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="10631784" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 26 Oct 2023 03:18:19 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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; Thu, 26 Oct 2023 03:17:54 -0700 Received: from HYD-DK-UNGSW21.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Thu, 26 Oct 2023 03:17:51 -0700 From: Raju Lakkaraju To: CC: , , , , , , , Subject: [PATCH net-next V2] net: pcs: xpcs: Add 2500BASE-X case in get state for XPCS drivers Date: Thu, 26 Oct 2023 15:46:42 +0530 Message-ID: <20231026101642.3913-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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 26 Oct 2023 03:18:29 -0700 (PDT) Add DW_2500BASEX case in xpcs_get_state( ) to update speed, duplex and pause Signed-off-by: Raju Lakkaraju --- Change List: ============ V1 -> V2: - Remove the default initialization of speed, pause and duplex 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 | 25 +++++++++++++++++++++++++ drivers/net/pcs/pcs-xpcs.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 4dbc21f604f2..392aaad2d412 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1090,6 +1090,24 @@ 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) + 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 +1145,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