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 X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C70E3C2B9F4 for ; Thu, 17 Jun 2021 18:07:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A42D5610A2 for ; Thu, 17 Jun 2021 18:07:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A42D5610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DFE2280796; Thu, 17 Jun 2021 20:06:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="bIf127WD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5194D82A1A; Thu, 17 Jun 2021 20:06:56 +0200 (CEST) Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (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 02FB480772 for ; Thu, 17 Jun 2021 20:06:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rfried.dev@gmail.com Received: by mail-ot1-x334.google.com with SMTP id f3-20020a0568301c23b029044ce5da4794so412979ote.11 for ; Thu, 17 Jun 2021 11:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QrfV2B+S03lQk/9GcyCbzukfvaw70rgtREmEctNZWZA=; b=bIf127WDYLO+puAPrw799ORHkt9xHZNakGx4EKWZl30nlsh9p4xRawNM/r3vze5kg/ hrNKbrOX65EceYtVyYifv6NlIuSQRCPBkSoUgxg1Trd6QYMRFdXmYfo2yEi4Ytsa9dZQ 887U3IbreiWz2YsA9nihXRZUS3S60yNaIn33wKraj2akVzG93u9V9rMs4Ty3Y8n7xMJ0 R50CWna8F4zWUOBZvV/N/VQ91V17GmIjsvlwpqMEegbVWgZNmv4O3RmW1L8fVGFNAMDS O7D71HfFpZmsMle7k2oiMCXCERIsaMmVnhGhAEeWiUsVEvPNu9jTg8DjRNCcPSzdq9X5 O1wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QrfV2B+S03lQk/9GcyCbzukfvaw70rgtREmEctNZWZA=; b=jlGL20OiOOypsEVpx3vFNHXIIjs0AUjnpe/eKGGKljOm3iOFHJLoZa4r5CL78RtDIh pTcWUpnBdgqoSDMxVT4heTR9AHsmn+cYsNbezokPmV/53rgDh+DuYRV64/gp2LHd/Qy/ VpjHNF+y5lkc6nhAvm0HhFKn472H0tlxCUV2ppqG+XmU+2JU7g2sL6dpEyysdsSzsvCr jEJ4kIiD34gYn3jmQkDTm8fbmcfxA+dpLmRVfdF6d5YAeGvg7Ae15elpxYHvihKwoQQm qNQttlGVvJiBqz1M2iAii7ddTSNRcwRXxTqEQMV89EntV45Py4wHJxeZHwXn/sbk51SN rCPg== X-Gm-Message-State: AOAM532U79rFVh9LbitotpER/DdtNjzQLMqVFD3ulphC9Pm+7FC5uRhd 2+k5Ihmi/p90/lCYeGeBH+LRMf5/6af8UfL8DCE= X-Google-Smtp-Source: ABdhPJxRP2wtW8vG3EaVYNkhegYfTQFK3e7GodB2olVPYFc3GftD51qRPHsSeuRoWd+9zfpJMfOfr7A1SRCCMle7Z7s= X-Received: by 2002:a9d:206:: with SMTP id 6mr5964534otb.31.1623953211467; Thu, 17 Jun 2021 11:06:51 -0700 (PDT) MIME-Version: 1.0 References: <20210617143554.2104712-1-vladimir.oltean@nxp.com> <20210617143554.2104712-6-vladimir.oltean@nxp.com> In-Reply-To: <20210617143554.2104712-6-vladimir.oltean@nxp.com> From: Ramon Fried Date: Thu, 17 Jun 2021 21:06:40 +0300 Message-ID: Subject: Re: [PATCH 5/6] drivers: net: fsl_enetc: require a PHY device when probing To: Vladimir Oltean Cc: Joe Hershberger , U-Boot Mailing List , Claudiu Manoil , Priyanka Jain , Bin Meng Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Thu, Jun 17, 2021 at 5:36 PM Vladimir Oltean wrote: > > Given that even a fixed-link has an associated phy_device, there is no > reason to operate in a mode when dm_eth_phy_connect fails. > > Remove the driver checks for a NULL priv->phy and just return -ENODEV > when that happens. > > Signed-off-by: Vladimir Oltean > --- > drivers/net/fsl_enetc.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c > index f6fc7801b95b..5961775024ff 100644 > --- a/drivers/net/fsl_enetc.c > +++ b/drivers/net/fsl_enetc.c > @@ -281,21 +281,20 @@ static void enetc_start_pcs(struct udevice *dev) > } > > /* Configure the actual/external ethernet PHY, if one is found */ > -static void enetc_config_phy(struct udevice *dev) > +static int enetc_config_phy(struct udevice *dev) > { > struct enetc_priv *priv = dev_get_priv(dev); > int supported; > > priv->phy = dm_eth_phy_connect(dev); > - > if (!priv->phy) > - return; > + return -ENODEV; > > supported = PHY_GBIT_FEATURES | SUPPORTED_2500baseX_Full; > priv->phy->supported &= supported; > priv->phy->advertising &= supported; > > - phy_config(priv->phy); > + return phy_config(priv->phy); > } > > /* > @@ -335,9 +334,8 @@ static int enetc_probe(struct udevice *dev) > dm_pci_clrset_config16(dev, PCI_COMMAND, 0, PCI_COMMAND_MEMORY); > > enetc_start_pcs(dev); > - enetc_config_phy(dev); > > - return 0; > + return enetc_config_phy(dev); > } > > /* > @@ -550,8 +548,7 @@ static int enetc_start(struct udevice *dev) > > enetc_setup_mac_iface(dev); > > - if (priv->phy) > - phy_startup(priv->phy); > + phy_startup(priv->phy); > > return 0; > } > -- > 2.25.1 > Reviewed-by: Ramon Fried