From patchwork Wed Apr 6 22:33:05 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: 1614165 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=s3ytRdTC; 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 4KYfTW0Wh7z9sFs for ; Thu, 7 Apr 2022 08:34:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 634DF83E5E; Thu, 7 Apr 2022 00:34:04 +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="s3ytRdTC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E044483E7A; Thu, 7 Apr 2022 00:33:42 +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 ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 9437683E54 for ; Thu, 7 Apr 2022 00:33:32 +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 ams.source.kernel.org (Postfix) with ESMTPS id 40D6DB8248B; Wed, 6 Apr 2022 22:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E413CC385A1; Wed, 6 Apr 2022 22:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649284410; bh=55WGuu7wleZEA+v+wDHV52FHNUmLil1B2FsiY9uB6Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3ytRdTC2fMmcWuaNzpAf+aOjKI4j8vcIC2jqYANWtunSWSibvVZmSI7aT8m67pfU rOmOAkbTzRnfzBJVosA9IN72ZfJcTVQtJn2G7IlJWTudO2PJ7yN+XNn8rBMczUaCAk GggGJrHGWtX/XI8kE23JxdLECsE0JsipojJ/kECFady2cf99z9PoPlez02xHN1cQ+i e70dzb1dRrhcbo4771IvF/WmPoF/HGAeWEUvclBOpr6JoAgOUuRF55Y2DDa5pe2nZO p87i9MtFEAh2opbRV5R7pmtv1SFGpVdRtXAG5sITrsh+3w7o81FhReWXwEXk8sdaLt rfwDR9BpD6InQ== 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 v4 11/14] net: phy: xilinx: Check interface type in ->config(), not ->probe() Date: Thu, 7 Apr 2022 00:33:05 +0200 Message-Id: <20220406223308.9833-12-kabel@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406223308.9833-1-kabel@kernel.org> References: <20220406223308.9833-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 We want to be able to have phydev->interface uninitialized during ->probe(). We should assume that phydev->interface is initialized only before ->config(). Signed-off-by: Marek BehĂșn Reviewed-by: Ramon Fried --- drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 635c0570ef..d92a364365 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -26,6 +26,11 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev) debug("%s\n", __func__); + if (phydev->interface != PHY_INTERFACE_MODE_GMII) { + printf("Incorrect interface type\n"); + return -EINVAL; + } + if (!ofnode_valid(node)) return -EINVAL; @@ -114,11 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) { debug("%s\n", __func__); - if (phydev->interface != PHY_INTERFACE_MODE_GMII) { - printf("Incorrect interface type\n"); - return -EINVAL; - } - phydev->flags |= PHY_FLAG_BROKEN_RESET; return 0;