Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2464693pxu; Mon, 14 Dec 2020 03:04:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwp530tJm/7YhJVzPXVL5LPLVN/3FbkS/bL23cGaI+EVngq6f9C9rGLGEN7boTA3Asvcpqe X-Received: by 2002:a17:907:417f:: with SMTP id oe23mr7583925ejb.259.1607943884365; Mon, 14 Dec 2020 03:04:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607943884; cv=none; d=google.com; s=arc-20160816; b=S9Wg5vNuj9eXD2bCNc+GykysBpRwQjqWXWyiVqH4QQJozDwz8MPLW64LmERj6Pm0WS 3zUWyqSeeKVUg+P2scWT9ilJ72k+KTIZOogZ5jykwDG38fmNLfd0MeuMXd1X7WWmr8rf 0tyvapsJ9FH1kNd5VQj53lPU1XFuEPh0ZAe/9Ebl68JacevjnzLGIHE6RMYw32tve/Pw AGV0oz3SdGgXEzX+3rdwmitU2lN0HoMMEE5/GwelCKOd/STgRmQCZpYI39/2HpbC1GOX cSiasuOuju3NeqvtlqTUeko1re/ZNA8TcQcGhDcG6c1eU6Xt36Zv+eC9PDgPdlD/dgqQ GDMA== 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=wU59+CvZmcAbyjsN37G3+XqMzje/NQXAt7rsV5oGj0k=; b=sYlKRRLFWa4jRdachu5gNtelDABDWTy9uCy3jv70oHRH4gAPOy0DTBo6g1aIQFyLwY 4JWOLc8QqJhlpSSIwgKedsuDIWYMbpXt6XzbbJHDucDXMSlrxce3g11NnI5SEJOuTVjR tHVvrGVGDdAvwC6JVRJAs2VZKyDvvjkaHnFyBtxZ+N4NxPN6jalsk/wDruIqH6IYHd8f rlrQc55tJuFTVeNpkpR3HexWJXQeIgNRLZFB6ZWv7NAwgzYSCh/y6NzhRJGZbVtBKFMK B340iLsrHRn38Oz62MYKo5sNcMvRXswSg/rsTwW3bjltwSDGOISh/YNzNSSxRM3qLym7 LmEw== 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 r20si9078279ejz.504.2020.12.14.03.04.21; Mon, 14 Dec 2020 03:04:44 -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 S2406635AbgLNKGt (ORCPT + 99 others); Mon, 14 Dec 2020 05:06:49 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:41911 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728795AbgLNKGc (ORCPT ); Mon, 14 Dec 2020 05:06:32 -0500 Received: by mail-oi1-f196.google.com with SMTP id 15so18607674oix.8; Mon, 14 Dec 2020 02:06:16 -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=wU59+CvZmcAbyjsN37G3+XqMzje/NQXAt7rsV5oGj0k=; b=pBG2Aq3lZ7mlTuDZWXC5FtzKOOoJp5zZ0WZhcRqSr71BQG7p+CJuEhzrYIaVhEDjNl UtW0pFdF2jvwNMvEGxYAQFWTKt4YgGJlQhs6ITKd28Zenz6+Nwcqxj9FKCd8Vpc7+oEH zqm/8IzAYdYwMGmC72SyxS0W+3iqzSXvKMUuWAXDFXucoYvj2VR60eRMuK2A1Fqgrzef q3xjMjARB3X4ziPdPpGIAK4AZegPXjGTktFTOEXYZJFx7znnz2B7FCF6v2dQibp9ye+K kIlSZ/QJfIid+AFU3+laQ2AFDB9j/dKN1u/nm2D//P2aQL11YB09rkb//CSR0X9upkIh QJDg== X-Gm-Message-State: AOAM531cVSYKQ+QC8/B0y2YCsSoNaTLcYRYOfiYHt0OuPKngKNKQQN5Z T/KpZm+CYq8Gjz16n9iUurAphB2MC6inWwtDUQk= X-Received: by 2002:aca:4b16:: with SMTP id y22mr17563683oia.148.1607940351152; Mon, 14 Dec 2020 02:05:51 -0800 (PST) MIME-Version: 1.0 References: <20201212165648.166220-1-aford173@gmail.com> In-Reply-To: <20201212165648.166220-1-aford173@gmail.com> From: Geert Uytterhoeven Date: Mon, 14 Dec 2020 11:05:40 +0100 Message-ID: Subject: Re: [RFC] ravb: Add support for optional txc_refclk To: Adam Ford Cc: Linux-Renesas , Adam Ford-BE , charles.stevens@logicpd.com, Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , netdev , 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 Sun, Dec 13, 2020 at 5:18 PM Adam Ford wrote: > The SoC expects the txv_refclk is provided, but if it is provided > by a programmable clock, there needs to be a way to get and enable > this clock to operate. It needs to be optional since it's only > necessary for those with programmable clocks. > > Signed-off-by: Adam Ford Thanks for your patch! > --- a/drivers/net/ethernet/renesas/ravb.h > +++ b/drivers/net/ethernet/renesas/ravb.h > @@ -994,6 +994,7 @@ struct ravb_private { > struct platform_device *pdev; > void __iomem *addr; > struct clk *clk; > + struct clk *ref_clk; > struct mdiobb_ctrl mdiobb; > u32 num_rx_ring[NUM_RX_QUEUE]; > u32 num_tx_ring[NUM_TX_QUEUE]; > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index bd30505fbc57..4c3f95923ef2 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -2148,6 +2148,18 @@ static int ravb_probe(struct platform_device *pdev) > goto out_release; > } > > + priv->ref_clk = devm_clk_get(&pdev->dev, "txc_refclk"); Please also update the DT bindings[1], to document the optional presence of the clock. > + if (IS_ERR(priv->ref_clk)) { > + if (PTR_ERR(priv->ref_clk) == -EPROBE_DEFER) { > + /* for Probe defer return error */ > + error = PTR_ERR(priv->ref_clk); > + goto out_release; > + } > + /* Ignore other errors since it's optional */ > + } else { > + (void)clk_prepare_enable(priv->ref_clk); This can fail. Does this clock need to be enabled all the time? At least it should be disabled in the probe failure path, and in ravb_remove(). [1] Documentation/devicetree/bindings/net/renesas,etheravb.yaml 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