Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2637334pxb; Tue, 13 Apr 2021 06:47:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ewQOSFi9UHMAe/QhJH1vPHoyuiWseofz+IBGBv+xleLhDjjYUqkpj8cu5nmfRclQIcmR X-Received: by 2002:a17:903:22c7:b029:e6:faf5:eb3a with SMTP id y7-20020a17090322c7b02900e6faf5eb3amr32477673plg.23.1618321622131; Tue, 13 Apr 2021 06:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618321622; cv=none; d=google.com; s=arc-20160816; b=Vjf3s3bAyC4zVcwXuIQ5xhKlu0/fb7nntEnAdGDSkfJyCDA+vmrJ0RWYrovARU/g1I QaH4znAvV/CUuEPTXMZ3uWlMfeie2nesnTIK9u+xjL1MNcptIMlldbN1OcYI5MDHp+Mc 3ljFPH7e+RANsT9wfHoJbcfje6ueTAkkR03lFcZJWbETvEXO1x2JK02vG+hPzkUxLg3v oZXE+MRRb6ec5a7Rj7p36lyVvXa7eKgptzHv6odTpb2MqZgpbUzGuA/fgwCZSkleJ5Pa HzFdBhH9/V9346TrIggWftDMLtaLwbXtB1EdT+Hh9u2/9bLZ2xljXp4ozEBJ0bsrwf2G t0ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=u6UFjwuyKnQpqmhtaDp8WV1qw1jwfIy1yUFgiKaV5UY=; b=qx8UBosHX5kbID12qrcTTcdvnewYoiTtWP1nXHYBlUNYzeAyYTeMifAbpqf7oSumk4 XnuolARcvfhjrTzPA5ejxeik5girxXYDOIP8rn70zuhABPP02uZXjAlGa4lFv2UkBoa5 KtQThWo83Lw+9d2PXd6OeRhdjQwMsAVPZ82A77/CNPDbtpRI7/+D0Fs9+UhH9vbaCqB4 hADGJVwKrClgXA4SRnceKV0dJufS2gezD8AYQkwwtDWocycdgTwDmZrdCAO3sqDvkDyF /btYr2XdRcUINgugPFlloMcjJgDtVo1CyTJoykENHe4WJN7UBz4XfKkgacuJC5578EM9 88eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si17235836ple.193.2021.04.13.06.46.50; Tue, 13 Apr 2021 06:47:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239884AbhDMHd4 (ORCPT + 99 others); Tue, 13 Apr 2021 03:33:56 -0400 Received: from mail-ua1-f44.google.com ([209.85.222.44]:45913 "EHLO mail-ua1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237567AbhDMHdy (ORCPT ); Tue, 13 Apr 2021 03:33:54 -0400 Received: by mail-ua1-f44.google.com with SMTP id f4so5020807uad.12; Tue, 13 Apr 2021 00:33:35 -0700 (PDT) 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=u6UFjwuyKnQpqmhtaDp8WV1qw1jwfIy1yUFgiKaV5UY=; b=tAh9slfyuOEcT93M35aK8CW7kqkE59vjDhsIWtgA16D7CtT7P64dq42H+tG2P6RyBv UbWmiVAkgT9HfXmVMBDCDQthz2yOXZXegr9ooDPF5i3koP4STM/G31DPf/MUpmmJbNpa G5Q4JlctLMKHQSjgjsxFkkTH22TbHzkNZZcAofHDxpYDnpG6XeAMsNMR+oZDcw2cNxs+ ZphSk7dqlcgBWoir0UvduT9Oc6LePr0CmcGF6iAH6D20gVc9u0kbG23DWlwgQTsCEpTh e1vrjSPekmkMjfOvQ2GH05WPY/NgXUGkFagme4PPB/57Vq2JkCVQjljmX/HHEGsXJNWO kJVg== X-Gm-Message-State: AOAM5306Y7SccntUKGCEAryVOc5FxmjKuxs4wpzvvGWzhJyVsJ4V1ZPW 7Ub/e5s7ofiKL53fB5V3XRo9B2c5CuPUtU6eCLfcsktoX4I= X-Received: by 2002:ab0:3157:: with SMTP id e23mr21121382uam.106.1618299215073; Tue, 13 Apr 2021 00:33:35 -0700 (PDT) MIME-Version: 1.0 References: <20210412132619.7896-1-aford173@gmail.com> <20210412132619.7896-2-aford173@gmail.com> In-Reply-To: <20210412132619.7896-2-aford173@gmail.com> From: Geert Uytterhoeven Date: Tue, 13 Apr 2021 09:33:23 +0200 Message-ID: Subject: Re: [PATCH V4 2/2] net: ethernet: ravb: Enable optional refclk To: Adam Ford Cc: netdev , Adam Ford-BE , Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , Rob Herring , Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adam, On Mon, Apr 12, 2021 at 3:27 PM Adam Ford wrote: > For devices that use a programmable clock for the AVB reference clock, > the driver may need to enable them. Add code to find the optional clock > and enable it when available. > > Signed-off-by: Adam Ford > Reviewed-by: Andrew Lunn > > --- > V4: Eliminate the NULL check when disabling refclk, and add a line > to disable the refclk if there is a failure after it's been > initialized. Thanks for the update! > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -2148,6 +2148,13 @@ static int ravb_probe(struct platform_device *pdev) > goto out_release; > } > > + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); > + if (IS_ERR(priv->refclk)) { > + error = PTR_ERR(priv->refclk); > + goto out_release; Note that this will call clk_disable_unprepare() in case of failure, which is fine, as that function is a no-op in case of a failed clock. > + } > + clk_prepare_enable(priv->refclk); > + > ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); > ndev->min_mtu = ETH_MIN_MTU; > > @@ -2244,6 +2251,7 @@ static int ravb_probe(struct platform_device *pdev) > if (chip_id != RCAR_GEN2) > ravb_ptp_stop(ndev); > out_release: > + clk_disable_unprepare(priv->refclk); > free_netdev(ndev); > > pm_runtime_put(&pdev->dev); Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds