From patchwork Fri Oct 27 04:43:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Lakkaraju X-Patchwork-Id: 158755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp359721vqb; Thu, 26 Oct 2023 21:45:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHc7RUuPNaHbRFywRGmFNPdKpcLTw+nxfd8n2bigzffkOQgjb6X9koI0YHX3XSty4qGpCaO X-Received: by 2002:a81:c80a:0:b0:5a8:5824:b953 with SMTP id n10-20020a81c80a000000b005a85824b953mr1615691ywi.8.1698381904455; Thu, 26 Oct 2023 21:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698381904; cv=none; d=google.com; s=arc-20160816; b=gGoghz5Mrp6BmNDoVz0BSHqztMPZAjEd56B0I+0m+IaiYGuIcJCGmYexjUCFOm0AzF +pgMkSutjxIcQJwYuo3W2B7OGLHiaK8ryGvkxiB+bTM3gxvc22u8hdaiJLZxVvBQuerN 9YiCnfKGyRyDffD3KBXgr/apkIQbYqtRZjpTuaRl3JXrXSY0ut3Wu9+WzGKGr4L+yldC u7bA7uX6eeUU/xUzLw6eb2H8TJ+XrGQjDAlxTTV3Bx9paeOG/8llEODU+64PooLfeMCB y9B//NhM6yhpErpxmoF9PJzLrvM2OQv38nw/lzF1w9lrEwTEBA8fu0rGadd1Le3HKlAt Karw== 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=TusyDos9DmSbVYHYXm1nFEKVFoQ/RQG7jHneUhXGjYs=; fh=roY2f/tihnO/b8u76mgTMJ/ED8s9gVVICPRGeXq4kzA=; b=Dlf7bskGUwlikb03TRNFYbLyzbYGYqRBaARwDtIEO6juTtoYuwplke/HrijvSIH7kP 5/GRlVx4R5TwdJclsamX5BC7XC93S3pcTIyinGZAb2LqVwWfCDmPWbaTDVnQuqSunxn/ xAU9WfSRJ5yeSbvwkY76+Raj7Ebc9HUukO2+gD3V0d3KOR+IKp0PGOKVG7S6NBo6w3RO rRy5GdWHE9aThOfbHdyWeayJjovFIYhq8WDM9nHnRGimmhj0O0ClKgpcJBMqF3ROEVdj yj21cWF16YxUs1uKW2XjIoVWdmHcl9y6CaFuxriFSJv+X6DFuvHDZp3TDSPCG3CLK4b1 g1Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=S+FoYgOb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g13-20020a0ddd0d000000b0058d37d41f1dsi1294125ywe.16.2023.10.26.21.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 21:45:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=S+FoYgOb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 8EE2B81E5E64; Thu, 26 Oct 2023 21:45:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345081AbjJ0Eor (ORCPT + 26 others); Fri, 27 Oct 2023 00:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjJ0Eoq (ORCPT ); Fri, 27 Oct 2023 00:44:46 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5396D186; Thu, 26 Oct 2023 21:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1698381884; x=1729917884; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=VmLiELaK/Ivyv/q4NmWbLMsH15oiokzsKdwnybGZ42o=; b=S+FoYgObqAKLxdcnkBN44TIu/13pUniiincqPvoyaz4BktjT8kXroD14 aaDFL045+JQOcPFEFukevR5WjKb7DxzzfPYw4PVV5+5LGm7nvhg3M5bYl bJ74LZNAPfTllXD6Bkw3aa8y7nLHVKgypU0fplgGLthUMknhyzuEil5ms GT0Kkz+ElbFycBF1sJxyQNX89sKjt/aQIM/pGBNU/aUOlekMqof3FyIur orHNXek5rZZb8OM8/+1rT4rbd02UVYlmA4ZGeSawtZ8g4gmTv6RPL9hKL vhKhmjQFeHcfZ1A7ghzuZ4OgmtbXeKfzD/FXib02cgWNJBjKOXi9iUnFT w==; X-CSE-ConnectionGUID: izhIcdEzSdCqSlk7qDKuoQ== X-CSE-MsgGUID: Ptz7A/q5TKW4snRDANH8yw== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="11294004" 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; 26 Oct 2023 21:44:43 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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.2507.21; Thu, 26 Oct 2023 21:44:19 -0700 Received: from HYD-DK-UNGSW21.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Thu, 26 Oct 2023 21:44:16 -0700 From: Raju Lakkaraju To: CC: , , , , , , , Subject: [PATCH net-next V3] net: pcs: xpcs: Add 2500BASE-X case in get state for XPCS drivers Date: Fri, 27 Oct 2023 10:13:06 +0530 Message-ID: <20231027044306.291250-1-Raju.Lakkaraju@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 26 Oct 2023 21:45:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780882504280458959 X-GMAIL-MSGID: 1780882504280458959 Add DW_2500BASEX case in xpcs_get_state( ) to update speed, duplex and pause Signed-off-by: Raju Lakkaraju Reviewed-by: Serge Semin --- 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..31f0beba638a 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 ret; + + ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_STS); + if (ret < 0) { + state->link = 0; + return ret; + } + + state->link = !!(ret & 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 +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