From patchwork Tue Mar 29 20:08:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1610813 X-Patchwork-Delegate: rfried.dev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=CoU3zRSv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KSggJ6lVFz9sDX for ; Wed, 30 Mar 2022 07:11:08 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 132A981DDF; Tue, 29 Mar 2022 22:10:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="CoU3zRSv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0545E83FCF; Tue, 29 Mar 2022 22:09:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CB8748407C for ; Tue, 29 Mar 2022 22:09:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C4F2616C8; Tue, 29 Mar 2022 20:09:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5FAC340ED; Tue, 29 Mar 2022 20:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648584547; bh=1/yLbRQe0gRg+x9ongvOp/2wcHDydkNQLTXMKSJDmAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CoU3zRSvaPap9iEqka/P46WH0AiXr7lklCPqoAQxaeiecIz8ZiBqbsoPNnwuTiPmE KRp/ZXloaOQcVfpGy/l5BkPE5Nlf6j58sXwcpP6AM2SwaECfOtwdlaxZx3AFqmd69i gUqGz2km2bImL9tT57Cy/W8ndlWvPgalo6gsA0c5uZs6VPFvcEX1tfSIYVME+aDSsz 9DB57RlgnZbjOa2QR6RKUrwsI2+tu3Yx56kmu+GD8oB0UnGT6hjhMSSZ5wccXprBOR doLCu68xVOxTh5rQRp+7zxzDJ8MSBBBNydlzM3jB6PEF+m62O0m8ugIin0JUEmd3b2 wOKx0h6YQ+a0Q== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Joe Hershberger , Ramon Fried Cc: u-boot@lists.denx.de, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-net v3 12/14] net: phy: use ->is_c45 instead of is_10g_interface() Date: Tue, 29 Mar 2022 22:08:43 +0200 Message-Id: <20220329200845.13435-13-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329200845.13435-1-kabel@kernel.org> References: <20220329200845.13435-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn Use phydev->is_c45 instead of is_10g_interface(phydev->interface) to determine whether clause 45 protocol should be used. Signed-off-by: Marek BehĂșn Reviewed-by: Ramon Fried --- drivers/net/phy/phy.c | 8 ++++---- include/phy.h | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 4109676a51..10c724388f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -632,10 +632,10 @@ static int phy_probe(struct phy_device *phydev) return err; } -static struct phy_driver *generic_for_interface(phy_interface_t interface) +static struct phy_driver *generic_for_phy(struct phy_device *phydev) { #ifdef CONFIG_PHYLIB_10G - if (is_10g_interface(interface)) + if (phydev->is_c45) return &gen10g_driver; #endif @@ -656,7 +656,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev, } /* If we made it here, there's no driver for this PHY */ - return generic_for_interface(interface); + return generic_for_phy(phydev); } static struct phy_device *phy_device_create(struct mii_dev *bus, int addr, @@ -859,7 +859,7 @@ int phy_reset(struct phy_device *phydev) #ifdef CONFIG_PHYLIB_10G /* If it's 10G, we need to issue reset through one of the MMDs */ - if (is_10g_interface(phydev->interface)) { + if (phydev->is_c45) { if (!phydev->mmds) gen10g_discover_mmds(phydev); diff --git a/include/phy.h b/include/phy.h index dee8fb5f2e..9742ce6fe1 100644 --- a/include/phy.h +++ b/include/phy.h @@ -359,18 +359,6 @@ static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad, #ifdef CONFIG_PHYLIB_10G extern struct phy_driver gen10g_driver; - -/* - * List all 10G interfaces here, the assumption being that PHYs on these - * interfaces are C45 - */ -static inline int is_10g_interface(phy_interface_t interface) -{ - return interface == PHY_INTERFACE_MODE_XGMII || - interface == PHY_INTERFACE_MODE_USXGMII || - interface == PHY_INTERFACE_MODE_10GBASER; -} - #endif /**