Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2123919rwl; Thu, 6 Apr 2023 06:15:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZvEX0xljRSPer0hS5HWm+sbZwZRDV6gK/czhH6yU7XzkR0WaTGcRWiPZxBzpI3Ap/TJM3/ X-Received: by 2002:aa7:cd62:0:b0:4fd:29a1:6a58 with SMTP id ca2-20020aa7cd62000000b004fd29a16a58mr5623660edb.19.1680786939637; Thu, 06 Apr 2023 06:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680786939; cv=none; d=google.com; s=arc-20160816; b=jASrYcUX2ZssF0ZC4VDcdlsJQ/T1YO72cdZ6Ve4OILvhlX9Z9w3yAMsogp35rq1WRB iJ/NcU85gEpeZZbAcXYFEiJUp4ckTui1X200YVnkwaYCHKx1b83sy8OS3mCy9xfkZ+Lz nE0tBk/MOYE84ZB2BsPo9USOlX1xbr38gmmkUNMcrqLdGxmt4pj0/9iV5DWCZ5lKSH6B lRQmVsHcVcmcXRCuZthBAxy9xOz7p41yf5xJH0mxMu1VJEWuYqRBjZpch0zVMrhXR/pt DJ6vKuExga8Z9MTsACjs1ToTfN+N34mylllRuN8H+BgMw79ZVCQvwVd4jn96t8r7HLkt ykWg== 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=KpoO1U+rDZspedrciHnBZ+SkMkfYySSQvrLMdTK/I0M=; b=TOgdz8vGg5rxgQ233qwD/EbRQrTHqeqEq879tgZ/+d6ptPfVyFxmsFP4nYVnJtC/dn q8NMqIfeLuGOLQAg+9wIkIi0R+DOCBWqhAn41oP7sLKW3oPqvsc4k2wfGTXOcy/7U0Ti LvOYRjMQxtKINLxRYnou9pW+v118s/hRvPbmRZo7K547hxSeEx6aj8AW+a559utzgJxF oMyRrfZWxXRK709u+RileoZZIO0plHDfne1QSnLKQnXV7/3Tp0ljU/UmIYXPOjj/LE4P BH4N5DdPBYdewUJ2J51Yyub2+ZyEMfqVCSjBqDpzK5UN5LUSOKhO+BcctInHpsb/xGYq 6w2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=RtTGNGqV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020aa7ce11000000b00502030dd391si1281413edv.46.2023.04.06.06.15.07; Thu, 06 Apr 2023 06:15:39 -0700 (PDT) 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=@denx.de header.s=phobos-20191101 header.b=RtTGNGqV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236735AbjDFNMF (ORCPT + 99 others); Thu, 6 Apr 2023 09:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjDFNME (ORCPT ); Thu, 6 Apr 2023 09:12:04 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 414258690; Thu, 6 Apr 2023 06:12:02 -0700 (PDT) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 035C780B98; Thu, 6 Apr 2023 15:11:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1680786719; bh=KpoO1U+rDZspedrciHnBZ+SkMkfYySSQvrLMdTK/I0M=; h=From:To:Cc:Subject:Date:From; b=RtTGNGqV7/wQVBz9Dai8umyDUbYuueyCHr132f0kG6b3K27JvWe0/H5P53J1Q4z1N tG+0CfjzQJEdb5HS8bcjNrqY6KoNuX1BUslUGd0NKAzf/VMvKBSOld1Jvd/5N6n23j bj+8P0ErZUJBNgts6cAsehgoqZ9eAEOkhPDzDaY+ViFhVBTm2HUGoWEDvK0HtJHPyR ogufalfMrAB2CZl4AjFEs5wPncrnFGXTA49kq5X9z5LCgVC1RiWC++nHjJOYVrB5/D aSkc1x43V7EmeigcPu0L1GVift7tCJY6rsRVfoNmXlTpKv5jfaW7R/op/HwYdnNYsB MfDpFifTS63ag== From: Lukasz Majewski To: Andrew Lunn , Heiner Kallweit Cc: Eric Dumazet , "David S. Miller" , Jakub Kicinski , Russell King , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH] phy: smsc: Implement .aneg_done callback for LAN8720Ai Date: Thu, 6 Apr 2023 15:11:27 +0200 Message-Id: <20230406131127.383006-1-lukma@denx.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The LAN8720Ai has special bit (12) in the PHY SPECIAL CONTROL/STATUS REGISTER (dec 31) to indicate if the AutoNeg is finished. Signed-off-by: Lukasz Majewski --- drivers/net/phy/smsc.c | 8 ++++++++ include/linux/smscphy.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index ac7481ce2fc1..58e5f06ef453 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -83,6 +83,13 @@ static int smsc_phy_config_intr(struct phy_device *phydev) return rc < 0 ? rc : 0; } +static int smsc_phy_aneg_done(struct phy_device *phydev) +{ + int rc = phy_read(phydev, MII_LAN83C185_PHY_CTRL_STS); + + return rc & MII_LAN87XX_AUTODONE; +} + static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev) { struct smsc_phy_priv *priv = phydev->priv; @@ -416,6 +423,7 @@ static struct phy_driver smsc_phy_driver[] = { .config_init = smsc_phy_config_init, .soft_reset = smsc_phy_reset, .config_aneg = lan95xx_config_aneg_ext, + .aneg_done = smsc_phy_aneg_done, /* IRQ related */ .config_intr = smsc_phy_config_intr, diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h index 1a136271ba6a..0debebe999d6 100644 --- a/include/linux/smscphy.h +++ b/include/linux/smscphy.h @@ -4,6 +4,7 @@ #define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */ #define MII_LAN83C185_IM 30 /* Interrupt Mask */ +#define MII_LAN83C185_PHY_CTRL_STS 31 /* PHY Special Control/Status Register */ #define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */ #define MII_LAN83C185_SPECIAL_MODES 18 /* Special Modes Register */ @@ -22,6 +23,7 @@ MII_LAN83C185_ISF_INT7) #define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */ +#define MII_LAN87XX_AUTODONE (1 << 12) /* AUTODONE */ #define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */ #define MII_LAN83C185_MODE_MASK 0xE0 -- 2.20.1