Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2349077pxu; Sun, 13 Dec 2020 23:16:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSy92UhaxXzF1ttfayjeYpDJzLL4QiK0f9Pse6hzDM2M2tXHM5D5J8/dW9XkiNWL/6CuM8 X-Received: by 2002:a05:6402:1714:: with SMTP id y20mr23075050edu.360.1607930167441; Sun, 13 Dec 2020 23:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607930167; cv=none; d=google.com; s=arc-20160816; b=mfQ973YpRj5BSe5IBzLmiEndLvmZkvxBTdi6bA4scX52AY26yNcXrAACv4mF5u1RNL 93uc8TIM6QR/QzaM/6gL996AeyYD84cZGbpT80afzK6uYLo+dt7ru+pJGGQr5rkO6rdl t0MqkvP2kFz30JGhx4DUQaqOiMfoGxb+TQeL0av4zjhqhWjIF30jTR9ghCPWj21MXfz+ LoN2rG4A4NA4qcfKkQqPlreH4wAniNzanyvWZHh7gHsRSgzG5BCMDDB9faQ/3J6pboOB dRVsEYPm6P39U9FymeGZN0UONXEJJZfFB1WDbmc5cy2LQ4qQmHaaE5hNG/pK7uXe2cnR f8mA== 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:dkim-signature; bh=8ed86JCFkhqrw2FizD1MHvIk0o1cDOKUQ8JXozTaLJU=; b=iYQYywYnJQjVMVv9KbTSDZUhHeVQSTLVAJaVX6ZcK2/6aBAmF7JlVyB2jZXbwRIB50 Il9YSGs/sHUF8dD7LYM2K8wNDO400ykrHK09n4OekA4rZ5UgVyJqwB/aaUS31mtEpqv2 rvng/E8ciaevKACWt4yhwJoTHeHnHR7ET8HyDAFz7lGst6b5rIjjZMHqdw4gexY2/t4Z n8u7Y/9SVaehjrB6/5GlxUpnLTEju9i/b21/vw4XVR99ctXOXdmtVq+RyFT0UBtmxfkK xX3hUqVeMzYjKhOKR2CgILuQbEX3PJvhe//Y8HQvAxezL8rpp+zw+IRA8KJCqTeCjtaK cEKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ft+8MdXI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si10058920edq.317.2020.12.13.23.15.42; Sun, 13 Dec 2020 23:16:07 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ft+8MdXI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501954AbgLLTjC (ORCPT + 99 others); Sat, 12 Dec 2020 14:39:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388996AbgLLTjB (ORCPT ); Sat, 12 Dec 2020 14:39:01 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92D5FC0613CF; Sat, 12 Dec 2020 11:38:21 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id r17so12043974ilo.11; Sat, 12 Dec 2020 11:38:21 -0800 (PST) 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=8ed86JCFkhqrw2FizD1MHvIk0o1cDOKUQ8JXozTaLJU=; b=ft+8MdXIhIo7GCkVK1CssvoJTPZaWtMji3R9/E3gOvJ04Oxi+SKjxdnbrjuwcK8Sqq KPJy8bW/3GsiGl3nU5Hge87I3PWXXRNrLvIh+ovn+qCbNsOS6wXpta6OpsREFF8tFHtB Fy9oc3C1MIEvYNARYNSt1vhgW9+Ntxp9nHQU0MRZrkCPoj67mZZoWov0kP54kicpbgW+ Ml0truKI/bBkF+DmDWhAPyvd+r8hCKBi2m0wlTFoVPLlN/KRB+0nKabcXAJStJv+gnVz YTSTEujrI3xi7Kh/0G/29DSUzA+87BmsKNHxI/SO1VkSDxc8/oMR54MZAMGUIxpenTyB Hdrw== 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=8ed86JCFkhqrw2FizD1MHvIk0o1cDOKUQ8JXozTaLJU=; b=ZBVv2xvMPGZdfe77IHmJIYvRF3ahE+G+JOgLAR99S2C1ZxvwYKJ15vd97oLu37DLdG kDTGiWS0dAWW8Gwpcc3aoEZE5LjuTiZ/lFSiF2rHhefn+7ruaGSgR0PNjDY/9cZi9yrf jYZm8d8zFfYxP2OvCqDJjptl46FqWPcTzpwvCpePHz9m9HUJEw3SsKN5qZfVU7hyUzP0 ywMprqyxPRFwNDlGUJHS73CYH7dyk6slZbIRNiLihl9B/yeVm7E+tFfLn/iaEgemxBGu hnfNYXfForDDB7jsPGsVai1x/DEAKtjMZZpl5Xt8dB5Ry4FYOXe5FwIyy+FJDuSKK6WQ EkQA== X-Gm-Message-State: AOAM532pf6kb6W3BXhu1GirgyZBZlmWSJLYtr2YO8nvsxHbyGSRwtODn 1wxF3yg1gfwLMmUbd/Q5b0Vb8pdHp10WBodTMvU= X-Received: by 2002:a92:d0c8:: with SMTP id y8mr22783097ila.46.1607801900716; Sat, 12 Dec 2020 11:38:20 -0800 (PST) MIME-Version: 1.0 References: <20201212165648.166220-1-aford173@gmail.com> <7f5f8ef2-3e4f-5076-0558-26b48e75b674@gmail.com> In-Reply-To: <7f5f8ef2-3e4f-5076-0558-26b48e75b674@gmail.com> From: Adam Ford Date: Sat, 12 Dec 2020 13:38:09 -0600 Message-ID: Subject: Re: [RFC] ravb: Add support for optional txc_refclk To: Sergei Shtylyov Cc: Linux-Renesas , Adam Ford-BE , Charles Stevens , "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 On Sat, Dec 12, 2020 at 11:55 AM Sergei Shtylyov wrote: > > Hello! > > On 12.12.2020 19:56, 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 > [...] > > 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"); > > Why not devm_clk_get_optional()? I am not that familiar with the clock API. I'll look into that function. It looks like it makes more sense. I'll send a V2. adam > > > + 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); > > + } > > + > > ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); > > ndev->min_mtu = ETH_MIN_MTU; > > > > MBR, Sergei