From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5794C433EF for ; Thu, 19 May 2022 12:49:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B875983C01; Thu, 19 May 2022 14:49:29 +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="MzKAgznk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8299A83D0C; Thu, 19 May 2022 14:49:27 +0200 (CEST) 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 B45C183C2F for ; Thu, 19 May 2022 14:49:24 +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=pali@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 5084AB82432; Thu, 19 May 2022 12:49:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F312CC385AA; Thu, 19 May 2022 12:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652964563; bh=3GHcL//uNdti69R+CK0KnKQzq20q79I79sCjKl3yanU=; h=From:To:Cc:Subject:Date:From; b=MzKAgznkSMeHK9epdJA8PvuOAc8Jqy3MOt1p3k4Ib2DGAz4KQGwhKIOAQ3RqJcrpy w/fFK/dwkJQ7ZaHbsXuAH8zAidaMS879xGaXnk+YA+ZjpF1MVVqM9Wnvq0Is5rwa1a MlwtsI1QTeRPSiieGHxN3pD1sdYmu08ihO2yHsi3Yye5muhEqbO7Gees2fE/uRHYBk 2/L7itUgwdWj8F5gpAXtpY2v73u6eEig9gh0D/+R18EahUhn5V9ju/noNn2tbghsRZ Y85f0lfJ44btEp7t54+1ff7q/d5Ike31a6/XBgQQCJezX+5iBU20ob59z62Ug5pNKR qr47PCbQycqLA== Received: by pali.im (Postfix) id EE71A810; Thu, 19 May 2022 14:49:19 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , Vladimir Oltean , =?UTF-8?q?Marek=20Beh=C3=BAn?= Cc: u-boot@lists.denx.de Subject: [PATCH] phy: Fix phy_string_for_interface() function Date: Thu, 19 May 2022 14:49:12 +0200 Message-Id: <20220519124912.1995-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit c677fb1e3196 ("phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition") broke function phy_string_for_interface(). And therefore completely broke support for 2500base-x mode in Armada 3720 comphy driver. Since that commit function phy_string_for_interface() returns constant value PHY_INTERFACE_MODE_NA because PHY_INTERFACE_MODE_NA from moved from end to the beginning. Previous value of PHY_INTERFACE_MODE_NA was PHY_INTERFACE_MODE_MAX-1. So change phy_string_for_interface() code to check upper bound via previous value. This patch fixes 2500base-x mode on Armada 3720 Fixes: c677fb1e3196 ("phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition") Signed-off-by: Pali Rohár --- include/phy_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/phy_interface.h b/include/phy_interface.h index ce3b5004ec22..fed3357b9a26 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -85,7 +85,7 @@ static const char * const backplane_mode_strings[] = { static inline const char *phy_string_for_interface(phy_interface_t i) { /* Default to unknown */ - if (i > PHY_INTERFACE_MODE_NA) + if (i >= PHY_INTERFACE_MODE_MAX) i = PHY_INTERFACE_MODE_NA; return phy_interface_strings[i]; -- 2.20.1