Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5047802pxb; Sun, 6 Feb 2022 11:51:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsLrtcDOYFkzFFt7vnB1ir7DEnKGmqySc3mg2qD2ebeT0zdobjbWKEm9oZuLo7nRkDDv/q X-Received: by 2002:a17:906:d108:: with SMTP id b8mr2495659ejz.489.1644177097640; Sun, 06 Feb 2022 11:51:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644177097; cv=none; d=google.com; s=arc-20160816; b=nHa83a4q1tjQvodB3pPHnpMRksSJTiSh9hRVX6E5i7MWV9mYQ6hJJ82KdbAXbnGHzx xy7UWsIfQ3k2Ssun6drMADbc0Saybe7FWZuPFiqWfrdS03bsOMJVnx8pJAVxj1M3xRzY c2IzIs3HzvhUzbTlXqBYpa8zF5E2sfu8p37DTfvl/v2m5HO4C4EFPwj410jv20DlhMN+ PAni0VpDG4XWne5ncquyjuiGYm/N9sXy226ISVv4WFYRVXo+9uwmh/0kp/3mmU4DMvEX Mh7Cu4r40/le+sPTQRHxXAiyhozGoNreVhLY04NjDFqJLqOmAjd/+nmWRoljyRfmHrBy iNZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=FCcXnFe+AjDLJWHmF/M/9s62o5qLgGSOORd9vpKd/v4=; b=wVRjUIWsUEBArOS9smB+ZK8y02bXlB/5SvP7PGVERzAwu6PsexGMDpzdckAXdmPKil FERVrlD6m9bLFCtHIuL8DbFCDx5Fsen2v28BUjXtNJ+GM5PZ2+vSP1La/wrGnd3jHHIy DNczwuDLm22NAeWrYxRsR7wu3gI1RUBewGXwkKf4w5IhcnnUh2WUC7f08+fpIfFLEWjT phS7ZhAiJ9TYcQePMEmQYg0gYH54jxsFmdS5sG02PcFdvVIcKIgNnhf8XQ/bLz+g6aKM AjATtg/swlFHivnWAeCfZ331/zHU9FdPdcyagRFDlqzJubSd8Gnwpof2zC1gRYUGeEkw d70Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JVp1WoeF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js7si5989454ejc.734.2022.02.06.11.51.13; Sun, 06 Feb 2022 11:51:37 -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=@gmail.com header.s=20210112 header.b=JVp1WoeF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359644AbiBEGrt (ORCPT + 99 others); Sat, 5 Feb 2022 01:47:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbiBEGrr (ORCPT ); Sat, 5 Feb 2022 01:47:47 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19A8C061346; Fri, 4 Feb 2022 22:47:43 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id e6so6984693pfc.7; Fri, 04 Feb 2022 22:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=FCcXnFe+AjDLJWHmF/M/9s62o5qLgGSOORd9vpKd/v4=; b=JVp1WoeFWk2sg9YssMpSZiyjxY7guelYiPtHdZgPaqpz2BNVY/Z7syt4nDNbUkv7ga HuW+LXnA4oVmkJ8QraA5INWrpTPLnRWkg54p0MPhvhD86LZMyCd+SaEKVv6mxSZK0ec7 JozKoKariZ+A23A0hjoEJ+TcGuiMS+A9DnBJgP7y1l8OoiqVJqDpf/b44hLlh3Shs4KY OlpOWAMfvzjxVSgiCP6ItTN8G9j4e7afQdXr8huptEr1PqXpql6HIQXH4B0U261IJLK3 DcFG69HyocXH/b1UXkecfuywfbcXMS3qgnmc4iKqeVxzlwIMC2vEJq7ESunq0HufLlCQ Qybg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FCcXnFe+AjDLJWHmF/M/9s62o5qLgGSOORd9vpKd/v4=; b=A0yrjnLxLvIDNc0ldMAkVnW7k2HvGrWIK1UBMOSb9vrJQNKGx2kwTQTsDl/rwfitvw IceE33PmnGpAzP+tPbytSF+cEidgoxYHS9t8HsyjVX80B5RO5M8TMaCaSCJCwDzwtY81 psdJ3ezezSkcKbhux/G6qODzXMmX9mHqdQfD8EiAFy5rWO/wuMohgGOyFFjw79uv3kfo zD+3+20R8USHf6FkSpXxqUnqTgn5JuRByHRo11hWLYhJ+EvtxGlH+PGLIappputzSBTJ mSpAGUxTaWb54JRZ74Jr3XxdUqXjyf4T7TOa8ETpVBbruflSLLsmJ5QLCs+AG4P0geWt ZBgw== X-Gm-Message-State: AOAM5302hrussa5lwYdU229Kj1W/w7F0XLmx+GQX5Vt1CQw58TpfJ3gm ZtEGMJ8/McoQ7mGQO84p9vo= X-Received: by 2002:a63:27c4:: with SMTP id n187mr2049424pgn.504.1644043662372; Fri, 04 Feb 2022 22:47:42 -0800 (PST) Received: from localhost.localdomain ([2405:201:2003:b021:6001:8ce1:3e29:705e]) by smtp.gmail.com with ESMTPSA id nu15sm1706233pjb.5.2022.02.04.22.47.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Feb 2022 22:47:42 -0800 (PST) From: Raag Jadav To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Steen Hegelund , Bjarni Jonasson Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH] net: phy: mscc: enable MAC SerDes autonegotiation Date: Sat, 5 Feb 2022 12:14:52 +0530 Message-Id: <1644043492-31307-1-git-send-email-raagjadav@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Enable MAC SerDes autonegotiation to distinguish between 1000BASE-X, SGMII and QSGMII MAC. Signed-off-by: Raag Jadav --- drivers/net/phy/mscc/mscc.h | 2 ++ drivers/net/phy/mscc/mscc_main.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h index a50235f..366db14 100644 --- a/drivers/net/phy/mscc/mscc.h +++ b/drivers/net/phy/mscc/mscc.h @@ -195,6 +195,8 @@ enum rgmii_clock_delay { #define MSCC_PHY_EXTENDED_INT_MS_EGR BIT(9) /* Extended Page 3 Registers */ +#define MSCC_PHY_SERDES_PCS_CTRL 16 +#define MSCC_PHY_SERDES_ANEG BIT(7) #define MSCC_PHY_SERDES_TX_VALID_CNT 21 #define MSCC_PHY_SERDES_TX_CRC_ERR_CNT 22 #define MSCC_PHY_SERDES_RX_VALID_CNT 28 diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c index ebfeeb3..6db43a5 100644 --- a/drivers/net/phy/mscc/mscc_main.c +++ b/drivers/net/phy/mscc/mscc_main.c @@ -1685,6 +1685,25 @@ static int vsc8574_config_host_serdes(struct phy_device *phydev) PROC_CMD_RST_CONF_PORT | PROC_CMD_FIBER_1000BASE_X); } +static int vsc85xx_config_inband_aneg(struct phy_device *phydev, bool enabled) +{ + int rc; + u16 reg_val = 0; + + if (enabled) + reg_val = MSCC_PHY_SERDES_ANEG; + + mutex_lock(&phydev->lock); + + rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_3, + MSCC_PHY_SERDES_PCS_CTRL, MSCC_PHY_SERDES_ANEG, + reg_val); + + mutex_unlock(&phydev->lock); + + return rc; +} + static int vsc8584_config_init(struct phy_device *phydev) { struct vsc8531_private *vsc8531 = phydev->priv; @@ -1772,6 +1791,11 @@ static int vsc8584_config_init(struct phy_device *phydev) VSC8572_RGMII_TX_DELAY_MASK); if (ret) return ret; + } else { + /* Enable clause 37 */ + ret = vsc85xx_config_inband_aneg(phydev, true); + if (ret) + return ret; } ret = genphy_soft_reset(phydev); -- 2.7.4