Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1271180pxb; Thu, 4 Mar 2021 07:28:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHzljiqGPLUSaHHW4cF3PbHcrSP8q0zTYAgj9AT9TYlv8Pqj+SLvTnELHTEA1v93ZYuQlm X-Received: by 2002:a17:906:fc5:: with SMTP id c5mr4663529ejk.538.1614871739110; Thu, 04 Mar 2021 07:28:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614871739; cv=none; d=google.com; s=arc-20160816; b=MOm18FyZgltv9nSSSJvVXZbxIXlGLLDoykegjRNQL2wj7WWNgXBSXwvUIcMZr6dqgo 0Zf1nH8hR3nOKNIxg4Gc8RM7TzYfirwgTB1HZvdTrii3z5irhLYQU9Mb1srNlgzFFAQt WB0nWeYImfivGkXQ8hPRrUEc5KXlJnmZ9zRZ6Zza7MF7KVxtwiLnHbG31TsvjV9BAEbL F2Nncu2s7wSzU9tO9sYhffxrhEBtuzs+zIgh7vf0JTW/lrq/himwc8h52anJbpEgSFLM cnaz1JDWcMs54BB7js+LSTWj4cCwwMBj7YV+gc+fE1XWqKGymU2MpBSTeIyvAxhxaVs+ XXtw== 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=VIhNJJMVnzvhOohhU5+sHSGrbiWXYRzHlRt+5Fa9ZAM=; b=F0BWLJAcViDOVQ71EzKWzUEsX6cBwo/dONRr9fRLNCXgO8SlvtTZlFlx8LHGr1Wpwv 94C3IR1MeGBp6/VvPsPoLxoUL25dOL+2L9EYBjROhiWym/Rq2dEwWa85CWnfDKJh7syL cQLOHlxbtjEj5I3DRGEOn602Hu+pE77IGLJEoPAX8zWabre928MypjDjAJ9+Q7FzpZZJ 0/uchpUUiGT05EPIInC0DL4PQ1kCEKiY867b96LSJvzFQBzJ1Dqp2kYqopMMCcyzYR6C B/repoN2CpcfSr6Xd1WoYMgflazghzy2KhzgVIhvr4f7DddvnaupNvp2Y3rlND/+MepY z6TA== 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 d21si4375795edu.262.2021.03.04.07.28.36; Thu, 04 Mar 2021 07:28:59 -0800 (PST) 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 S234194AbhCDIJB (ORCPT + 99 others); Thu, 4 Mar 2021 03:09:01 -0500 Received: from mail-vs1-f44.google.com ([209.85.217.44]:36301 "EHLO mail-vs1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236260AbhCDIIx (ORCPT ); Thu, 4 Mar 2021 03:08:53 -0500 Received: by mail-vs1-f44.google.com with SMTP id a12so7462852vsd.3; Thu, 04 Mar 2021 00:08:37 -0800 (PST) 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=VIhNJJMVnzvhOohhU5+sHSGrbiWXYRzHlRt+5Fa9ZAM=; b=dp9/2N97ID2W08m9XDtpLgdIenSHuAQYwynqWJ2JxBktdemD7D9+sJwGs/E9sPaPk4 64pW+KfwnlzrkHc32tsAIHWYUD3v/9n/3xwevaDjy0avQB4/vxOFbWIn1yuHyqMdc5nS T3LiW9m4HIeiQa3JzWHq67JPdlaadDcR3lWzkjmBxAuoyVSnbaciSCGaY/KtEfoYp6a9 tTpklKqUeII925Hk/RNoM880kmWA3ZvJxU4EHnIIO+byI9DCNNLhvXQd9y+wWGNHlu3Z 3qXBfdCvUY29DktW9s+aKkQ/GSfcsn3yvCFZOTbXRF4CjcYFOSo/e3LoZSvHMOoXOd/m RWxQ== X-Gm-Message-State: AOAM533cAzQNYHTwNwdP0YYYHUgzB3Gc+WTUYaDmo1CNYs7JQyE3cTkk DYfLDzkXFrCt3SPCcbvX27kUmtVpcSCtfrd3yEU= X-Received: by 2002:a67:fb86:: with SMTP id n6mr1779925vsr.3.1614845292063; Thu, 04 Mar 2021 00:08:12 -0800 (PST) MIME-Version: 1.0 References: <20210224115146.9131-1-aford173@gmail.com> <20210224115146.9131-4-aford173@gmail.com> In-Reply-To: <20210224115146.9131-4-aford173@gmail.com> From: Geert Uytterhoeven Date: Thu, 4 Mar 2021 09:08:00 +0100 Message-ID: Subject: Re: [PATCH V3 4/5] net: ethernet: ravb: Enable optional refclk To: Adam Ford Cc: netdev , Adam Ford-BE , Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , Rob Herring , Geert Uytterhoeven , Magnus Damm , 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 Wed, Feb 24, 2021 at 12:52 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 Thanks for your patch! > --- 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; > + } > + clk_prepare_enable(priv->refclk); > + Shouldn't the reference clock be disabled in case of any failure below? > ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); > ndev->min_mtu = ETH_MIN_MTU; > > @@ -2260,6 +2267,9 @@ static int ravb_remove(struct platform_device *pdev) > if (priv->chip_id != RCAR_GEN2) > ravb_ptp_stop(ndev); > > + if (priv->refclk) > + clk_disable_unprepare(priv->refclk); > + > dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, > priv->desc_bat_dma); > /* Set reset mode */ 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