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 2C975C433EF for ; Wed, 4 May 2022 08:52:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19A3E83C19; Wed, 4 May 2022 10:52:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=solid-run.com 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=solid-run-com.20210112.gappssmtp.com header.i=@solid-run-com.20210112.gappssmtp.com header.b="EI4C5MjP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D64C83E55; Wed, 4 May 2022 10:52:16 +0200 (CEST) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4FDEE83BAC for ; Wed, 4 May 2022 10:52:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=solid-run.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=josua@solid-run.com Received: by mail-wr1-x431.google.com with SMTP id q23so1053427wra.1 for ; Wed, 04 May 2022 01:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=M/4BEz8vTB+EnpyLQT0/l4JzfoyOOOw11fsVwlLTSm0=; b=EI4C5MjPCe1ZhfoZfaWflym9m71cMamGIjiDWwSL14/FYnoAsaWQWUmoEt2weRgDsY gtmYlJ5JjKUsA5VkAx4Sp8kQ6wPvAFrfYeG+retpYauhQkTSwNelnzxBWkKdv92sffXG dXM3BmELtyumKvtR7L0dUhK/F0P3eg9DoqWkARzCuIWCx8Ftzcbqjartd4a9G5L7ILgF MP6H8gvSzHbwAoM1FC1HsB+BldaZhfxU8C/jcyihcx7DRFlfpJD5PJK56XlqDSYbTX5x PggJxut6c0dFGahxzDmLHNHXMtCQow4kVryKgXPuEaWWvX9ByhWeobb+LjJMiQ/tkAt9 CNGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=M/4BEz8vTB+EnpyLQT0/l4JzfoyOOOw11fsVwlLTSm0=; b=D4u3c6QE7BsRrUor8IMWw6iSjtsg2udjBSkR/IQojUW+nLEtBmyv2kL3APnYckbDPR o0bChesTJRNOYZDv5+EUmoxdlc4wEpLfoCm+UjdwMGjr9e0ju6GCVEmKOpGULRplz4ga RIH3ughowvyK0EBW4CbE4Pz0wxn+pzpMHouXm0UQ0jDzWpDtCUIWODpJVMAPUjBhglBZ HVIIDQ6gEWOjlBkH/zIHoI/dytb3l7PVqc7nnmVgYt55rWrKuSTINCCaAVSapmDFbM2e y4jWQsQ+3h+0/zO4dDvahBVQvCfDM9MKyYSu/COJpE4NkhfQZf0xcwU0pBzwDIJoInlN wDKA== X-Gm-Message-State: AOAM5318rFekOpwiuLVlhI+tWASHB+GKABYa2zGCdtF7wFJaTDcRHk1w PSdDyKsj+W306Eh1THsrMhgvDQ== X-Google-Smtp-Source: ABdhPJw3eaDp1WsWUR+ySwifAE8FiRNsZa3sAif3Pv6IqP18n7qCRHkaiwpHEmjHq9ohAJAmiCF9kw== X-Received: by 2002:adf:f6c1:0:b0:20a:daf6:9bd3 with SMTP id y1-20020adff6c1000000b0020adaf69bd3mr15652264wrp.425.1651654332850; Wed, 04 May 2022 01:52:12 -0700 (PDT) Received: from [10.100.0.34] (bzq-162-168-31-21.red.bezeqint.net. [31.168.162.21]) by smtp.gmail.com with ESMTPSA id e9-20020a05600c218900b0039453fe55a7sm2198038wme.35.2022.05.04.01.52.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 May 2022 01:52:12 -0700 (PDT) Message-ID: Date: Wed, 4 May 2022 11:51:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 1/5] phy: adin: remove broken support for adi,phy-mode-override Content-Language: en-US To: Nate Drude , "u-boot@lists.denx.de" Cc: "alvaro.karsz@solid-run.com" , "joe.hershberger@ni.com" , "rfried.dev@gmail.com" References: <20220501124131.30614-1-josua@solid-run.com> <20220501124131.30614-2-josua@solid-run.com> <305de6cf1db72f24deb78ae1714dcb6ed2f7da7e.camel@variscite.com> From: Josua Mayer In-Reply-To: <305de6cf1db72f24deb78ae1714dcb6ed2f7da7e.camel@variscite.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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 Hi Nate, Am 02.05.22 um 16:25 schrieb Nate Drude: > Hi Josua, > > On Sun, 2022-05-01 at 15:41 +0300, Josua Mayer wrote: >> The adin_get_phy_mode_override function does not compile, because it >> is >> missing both declaration and implementation of >> phy_get_interface_by_name. >> >> Remove the whole function for now, since the missing implementation >> is >> not included in mainline Linux - and thus can not be copied. >> >> Signed-off-by: Josua Mayer >> --- >>  drivers/net/phy/adin.c | 34 ---------------------------------- >>  1 file changed, 34 deletions(-) >> >> diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c >> index cff841ab3d..2433e76fea 100644 >> --- a/drivers/net/phy/adin.c >> +++ b/drivers/net/phy/adin.c >> @@ -94,35 +94,6 @@ static u32 adin_get_reg_value(struct phy_device >> *phydev, >>         return rc; >>  } >> >> -/** >> - * adin_get_phy_mode_override - Get phy-mode override for adin PHY >> - * >> - * The function gets phy-mode string from property 'adi,phy-mode- >> override' >> - * and return its index in phy_interface_strings table, or -1 in >> error case. >> - */ >> -int adin_get_phy_mode_override(struct phy_device *phydev) >> -{ >> -       ofnode node = phy_get_ofnode(phydev); >> -       const char *phy_mode_override; >> -       const char *prop_phy_mode_override = "adi,phy-mode-override"; >> -       int override_interface; >> - >> -       phy_mode_override = ofnode_read_string(node, >> prop_phy_mode_override); >> -       if (!phy_mode_override) >> -               return -ENODEV; >> - >> -       debug("%s: %s = '%s'\n", >> -             __func__, prop_phy_mode_override, phy_mode_override); >> - >> -       override_interface = >> phy_get_interface_by_name(phy_mode_override); >> - >> -       if (override_interface < 0) >> -               printf("%s: %s = '%s' is not valid\n", >> -                      __func__, prop_phy_mode_override, >> phy_mode_override); >> - >> -       return override_interface; >> -} >> - >>  static u16 adin_ext_read(struct phy_device *phydev, const u32 >> regnum) >>  { >>         u16 val; >> @@ -148,11 +119,6 @@ static int adin_config_rgmii_mode(struct >> phy_device *phydev) >>  { >>         u16 reg_val; >>         u32 val; >> -       int phy_mode_override = adin_get_phy_mode_override(phydev); >> - >> -       if (phy_mode_override >= 0) { >> -               phydev->interface = (phy_interface_t) >> phy_mode_override; >> -       } >> >>         reg_val = adin_ext_read(phydev, ADIN1300_GE_RGMII_CFG); >> > The patch that introduced adin_get_phy_mode_override was tested against > the U-Boot master branch. Unfortunately, phy_get_interface_by_name was > removed just a few days before by: > https://github.com/u-boot/u-boot/commit/123ca114e07ecf28aa2538748d733e2b22d8b8b5 :( > Can we fix adin_get_phy_mode_override instead of removing it? I will take a look in the coming days and see if I understand how to fix this. I don't really mind if we fix it, or remove it - removing was the faster way getting my patch-set out of course ... > We can > implement part of ofnode_read_phy_mode. This needs to be tested, but > for example: > > diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c > index cff841ab3d..6a05b9fd05 100644 > --- a/drivers/net/phy/adin.c > +++ b/drivers/net/phy/adin.c > @@ -100,27 +100,28 @@ static u32 adin_get_reg_value(struct phy_device > *phydev, > * The function gets phy-mode string from property 'adi,phy-mode- > override' > * and return its index in phy_interface_strings table, or -1 in error > case. > */ > -int adin_get_phy_mode_override(struct phy_device *phydev) > +phy_interface_t adin_get_phy_mode_override(struct phy_device *phydev) > { > ofnode node = phy_get_ofnode(phydev); > const char *phy_mode_override; > const char *prop_phy_mode_override = "adi,phy-mode-override"; > - int override_interface; > + int i; > > phy_mode_override = ofnode_read_string(node, > prop_phy_mode_override); > + > if (!phy_mode_override) > - return -ENODEV; > + return PHY_INTERFACE_MODE_NA; > > debug("%s: %s = '%s'\n", > __func__, prop_phy_mode_override, phy_mode_override); > > - override_interface = > phy_get_interface_by_name(phy_mode_override); > + for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++) > + if (!strcmp(phy_mode_override, > phy_interface_strings[i])) > + return i; > > - if (override_interface < 0) > - printf("%s: %s = '%s' is not valid\n", > - __func__, prop_phy_mode_override, > phy_mode_override); > + debug("%s: Invalid PHY interface '%s'\n", __func__, > phy_mode_override); > > - return override_interface; > + return PHY_INTERFACE_MODE_NA; > } > > static u16 adin_ext_read(struct phy_device *phydev, const u32 regnum) > @@ -148,10 +149,10 @@ static int adin_config_rgmii_mode(struct > phy_device *phydev) > { > u16 reg_val; > u32 val; > - int phy_mode_override = adin_get_phy_mode_override(phydev); > + phy_interface_t phy_mode_override = > adin_get_phy_mode_override(phydev); > > - if (phy_mode_override >= 0) { > - phydev->interface = (phy_interface_t) > phy_mode_override; > + if (phy_mode_override != PHY_INTERFACE_MODE_NA) { > + phydev->interface = phy_mode_override; > } > > reg_val = adin_ext_read(phydev, ADIN1300_GE_RGMII_CFG); > > Thanks, > Nate