Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp549275pxj; Thu, 10 Jun 2021 07:10:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr0kSHEYqPtyP06jxNDHJz+L1bqIs96KcEfeAbYMEo3Ve44VLpTdfFOvYNQFl3lSjeF8ir X-Received: by 2002:a05:6402:2805:: with SMTP id h5mr5113226ede.379.1623334249441; Thu, 10 Jun 2021 07:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623334249; cv=none; d=google.com; s=arc-20160816; b=SiyM7OJEdaJPjJPiHVaLcL8ZWlsIG+yEpFlLjPyDAObwQANu9yp+rFTUvP+DeqBK/j laZZxMD7Bb820vrCDAJVvDBMSai5M9wi3peStOCWRPwlXxFSX3oOieaMT/0om2blm4Kt W4R09uPtv94AEB1Uef76czHFBTbw5ow4sZIs02Z//a64duVzIPqTS40Wc9vY2S9Uz6yH 5Qv0FXIIXRayHLPuNumd+5xDCmVSMxGY42uapCvwyXzIJf+6I8cI2lGLi6tMA68Q8kxs mKHqxq4AQWyodFlP1M24O/IlOe3ldWJQ2qo4togTrg19jl3+ff/8cxWXQKsoZcKvyQPy 3RoA== 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=tbM+etLOCSLCI1Qw+ID4onOsBsF0/cT0k6PPBLohEEM=; b=q5qJCp81NYS4SYXNltg6+YmGz6yxfPewA4wQJ4eYmI0av8Qd4QYZoEQFQzneo6sskj mafbzlam47mb/YVqOUP7+ZsEzHj4La6cuIG+mCtqwwHz8+qhDAwUl2ueU6yxot2SngRo DOs3+5cMvrS93oR8/Y32B8V7/femq2/b/vL1OWsx1ElCrH4f5fWUN0fmJ3n8zoJb4fTC AQjHIEcYK0yXHyI7pxF0msckEmAZwawpedYUojETJu1KhLklBxTsIJLs4QJ1AXPtkMtR VexevDFe8gErcU6ASA4nGXYyXYh0Ixejay74yrJ5qY8nhNEVqYCMYtYEvJbni5gLnc+k xH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sYquY0wX; 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 r8si2447057edm.79.2021.06.10.07.10.25; Thu, 10 Jun 2021 07:10:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sYquY0wX; 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 S231274AbhFJOIb (ORCPT + 99 others); Thu, 10 Jun 2021 10:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbhFJOIa (ORCPT ); Thu, 10 Jun 2021 10:08:30 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E09C061574; Thu, 10 Jun 2021 07:06:20 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id f84so41024340ybg.0; Thu, 10 Jun 2021 07:06:19 -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=tbM+etLOCSLCI1Qw+ID4onOsBsF0/cT0k6PPBLohEEM=; b=sYquY0wXd7bW286zgFipmH21BGe2tJ8QWI54e7+eVWyKh6h0yENOIgFADqFeJkJIZo d6amP4Oef1JMdmYHIs7YsLfQJbFKlrmWS7hTqCd2AJs2Vj3SyxcMph2dJpI+/WmbitFj tPpNuG3c8HnhagusKy71Qou+Hl0NISJ3S1UNbQ+nRHI2ou1XGVTnEF/NzYxb6FzLHbhn 4O7SHdsW3RVxtRst6231aj9J9N7TmtlEcScDqDuIfCkM1P2voTlm+CtRP6vH6vHpCrH5 colXVGG1CMWP3/W3hg0ZoeJD/zAOsvTi87ZfLrPmU9d1smRHOOL0fYSb9EuWl/RxwDnc OxFw== 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=tbM+etLOCSLCI1Qw+ID4onOsBsF0/cT0k6PPBLohEEM=; b=CMo4hCampgcxww2cg4QW+S2ue1J8vBJQNlF2xx/Erob54ENhf+CaGDjYPI/XMqQ07S Lw5bxiXejs/1oc7+VA3l9SyVD3dqRvB6KclPZK3aa+cLaEH/n3tDz0l1tF643wiQ6J3j g5H3YTTVK4BgNssioBwGJ8keCO2Ma//1STC7Jo1IrbcOqkFbwWKFJsCpdbZS79CJ0krP fMy0WBgIwxDS7CZjD9v2VmxJ20zJjb7quiUO6kgX5ACL8JZtjv93tvXMxw9h418Su367 VnJBbUF5ZB3djruwN2U2vFewun/RIIXwwb6Tzx6JqdT4zhEIgvZNFmimzP5y5sIMa1Te HMZw== X-Gm-Message-State: AOAM530KxzoaMuiF/lVZdacULDFPm3lxtvJzZnghpgmBUR94hfaMLLVU 8f0NYS5Ke4abmwq8WZSTiX/W68RnCC+EevyxbZQ= X-Received: by 2002:a5b:54a:: with SMTP id r10mr7760650ybp.476.1623333979162; Thu, 10 Jun 2021 07:06:19 -0700 (PDT) MIME-Version: 1.0 References: <20210609153230.6967-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20210609153230.6967-9-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Thu, 10 Jun 2021 15:05:52 +0100 Message-ID: Subject: Re: [PATCH v3 08/11] clk: renesas: Add CPG core wrapper for RZ/G2L SoC To: Geert Uytterhoeven Cc: Lad Prabhakar , Magnus Damm , Rob Herring , Michael Turquette , Stephen Boyd , Catalin Marinas , Will Deacon , Philipp Zabel , Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , linux-clk , Linux ARM , Biju Das Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, Thank you for the review. On Thu, Jun 10, 2021 at 2:04 PM Geert Uytterhoeven wrote: > > Hi Prabhakar, > > On Wed, Jun 9, 2021 at 5:33 PM Lad Prabhakar > wrote: > > Add CPG core wrapper for RZ/G2L family. > > > > Based on a patch in the BSP by Binh Nguyen > > . > > > > Signed-off-by: Lad Prabhakar > > Reviewed-by: Biju Das > > Thanks for your patch! > > > --- a/drivers/clk/renesas/Kconfig > > +++ b/drivers/clk/renesas/Kconfig > > @@ -182,6 +182,11 @@ config CLK_RCAR_USB2_CLOCK_SEL > > help > > This is a driver for R-Car USB2 clock selector > > > > +config CLK_RZG2L > > + bool "Renesas RZ/G2L SoC clock support" if COMPILE_TEST && !ARCH_RENESAS > > s/SoC/family/? > Agreed. > I think "if COMPILE_TEST", as all other entries are using, is sufficient. > > > + depends on ARCH_RENESAS || COMPILE_TEST > > I think this can be dropped. > Agreed. > > + select RESET_CONTROLLER > > + > > # Generic > > > --- /dev/null > > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c > > > +static struct clk > > +*rzg2l_cpg_clk_src_twocell_get(struct of_phandle_args *clkspec, > > + void *data) > > +{ > > + unsigned int clkidx = clkspec->args[1]; > > + struct rzg2l_cpg_priv *priv = data; > > + struct device *dev = priv->dev; > > + const char *type; > > + struct clk *clk; > > + > > + switch (clkspec->args[0]) { > > + case CPG_CORE: > > + type = "core"; > > + if (clkidx > priv->last_dt_core_clk) { > > + dev_err(dev, "Invalid %s clock index %u\n", type, clkidx); > > + return ERR_PTR(-EINVAL); > > + } > > + clk = priv->clks[clkidx]; > > + break; > > + > > + case CPG_MOD: > > + type = "module"; > > + if (clkidx > priv->num_core_clks + priv->num_mod_clks) { > > The range of module clocks in DT specifiers starts at zero, so > > if (clkidx > priv->num_mod_clks) { > Thanks for the catch, yes the above check should be good. > > > + dev_err(dev, "Invalid %s clock index %u\n", type, > > + clkidx); > > + return ERR_PTR(-EINVAL); > > + } > > + clk = priv->clks[priv->num_core_clks + clkidx]; > > + break; > > + > > + default: > > + dev_err(dev, "Invalid CPG clock type %u\n", clkspec->args[0]); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + if (IS_ERR(clk)) > > + dev_err(dev, "Cannot get %s clock %u: %ld", type, clkidx, > > + PTR_ERR(clk)); > > + else > > + dev_dbg(dev, "clock (%u, %u) is %pC at %lu Hz\n", > > + clkspec->args[0], clkspec->args[1], clk, > > + clk_get_rate(clk)); > > + return clk; > > +} > > With the above fixed: > Reviewed-by: Geert Uytterhoeven > > I can fix these while applying. > Thank you. Cheers, Prabhakar