Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3665030iob; Sat, 7 May 2022 11:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/V/EHiWJvihwwbfzG2LEzO7yNxEBYhKpzoNY1fQqdDBDVSlrNLnHkJW/uofqUHjzt7+wP X-Received: by 2002:a17:902:e746:b0:15e:b4f3:72e7 with SMTP id p6-20020a170902e74600b0015eb4f372e7mr9037273plf.8.1651947365928; Sat, 07 May 2022 11:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651947365; cv=none; d=google.com; s=arc-20160816; b=r5oFf7fHtQIyenAZCd9x7zNAaJHY5LszsMl3na19ABPP1QSOJxN9t8aFwVeSGzk0cD rPCVDeMfpDe/eSNwQwmmivI5dt3UKkq1UXmvdgdpXnygU2e92E+5Ggvv+dERaLSidnhR 4I4nP+IiVQvFHy1VVQswfB+6Q4xOdVk4AB6P6vg67z72FKaTatgaajXvhh5eAoUdkmdC yB3dPXEAGztujMz/A4QOCnR7Zf+Jym4kV6BaA7/Xa8eKr14DoI0U8tXMVbcStsL11jIV ysvW8Mz81CGyZfTXHJ73CTX/Qp6wSMGP6XtrME9SS6q2+xFJsEiacc0haIE70unlBwO6 hUOQ== 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=IPe5l3hTT4WLd4gkCQ87tQ9p9+J36zEd8q/74JcdAxo=; b=RKKO6ToAc/l+vozMNXILp9sTw/yAf3zX+LvLGHNkh/2WFZAEbZdcH+sgfnnqu7xa9a Mv+B6uakMjxe/gFFp2Dz8TiOh2WeqVfU8Kh5ttDzXUdfRHpcCC0LoS9Ey9wduOUt2I/G 35hWxG8skAQNage1jgwI4e8hvQbtHS8HwRE++lxAganHGU40wcaLPJa3ph3kbLrVQusk 4LIBRKmQgRYpeepBKWQ293LpnjawI9ifobVJP17VpkUUulztoJ1s0mj1uQg7nD71/B6Z mscCng/+MD1bmMgN5e0ZMw7gfXR/EisQCwMaDwsDCV003okeUED+PVPM4IMUOe7qEg5n a6oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=irpX9tiW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a63724a000000b003ab158e5a5esi8034604pgn.121.2022.05.07.11.15.48; Sat, 07 May 2022 11:16:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=irpX9tiW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1445719AbiEGFrA (ORCPT + 99 others); Sat, 7 May 2022 01:47:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377055AbiEGFq6 (ORCPT ); Sat, 7 May 2022 01:46:58 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78EE65BD15; Fri, 6 May 2022 22:43:13 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id r11so16197372ybg.6; Fri, 06 May 2022 22:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IPe5l3hTT4WLd4gkCQ87tQ9p9+J36zEd8q/74JcdAxo=; b=irpX9tiWLkNHAwFZRwUl8vhDzGQBGF60Wgi9GuckFUCpDWl6duGxqr7Pn10mtLIhG9 g8Bm749U/Qh5Wxplfcq4uzMHgXfTT9UUi6QH8vuNwpnrxhVaWcRq1WzRaMiDJW0ILgbr sLStORWEChwi0Ts6GGHMwe2aO4AE5+d3cRAdeTqgYbsPQoxnAgrvkqoY1dCbx3pxNO/j v9C4BivxcGOhOTHP3WXu/XxxA0xfyx2mhJ4DrN2rUctbKTuP9DjfEY00apflYbRFigdo ktPyjjuRosNuKB+4dtbWiUDSneqVwDVYTcX9mDXwzBFs7qZmYGhW92AmwP+3aS/j0THt hwWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IPe5l3hTT4WLd4gkCQ87tQ9p9+J36zEd8q/74JcdAxo=; b=7u5C8QgSCARZsrOC/4mn1ZzdVX2mv8c9HqIY0gw5RY/NCGlPh9JW2OvKVpmhTJ2KD7 83MwIKwPAmn3GvGxoN4vwAioYBz5F36aQ/43sUMd1OYsa2Vl0zRIV1x/0UB/5YA4fLLv MOOGcZ22etrMDJIq2tR1AHoX/xKPRkStcC1yr1Mjf18RTySZcOnIzdtE+R8XhO6Ynnud DAXddF59NRGbsYNaJrkn2uuxpiCb9py6e4Qx4dimStogmmOtAq8wbs8o45utmY6dWkLf JqTBgZsNrZI4rdacnR/hqpcjwUw50KK+qJcfnEl8WrTQUV6fnHnf0bjGhXntMTZwFqoA LjHQ== X-Gm-Message-State: AOAM531+afstr3+pWf+g4Zj1yEAfsx0jCOq8akF68eX+Mz9tXJ/mED4T f5cDRq/oXlPO4B2MpHCl/fWSzjODFoMrAGUx2VE= X-Received: by 2002:a25:42cd:0:b0:645:d805:4fcb with SMTP id p196-20020a2542cd000000b00645d8054fcbmr5226533yba.182.1651902192697; Fri, 06 May 2022 22:43:12 -0700 (PDT) MIME-Version: 1.0 References: <20220505193143.31826-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220505193143.31826-3-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Sat, 7 May 2022 06:42:46 +0100 Message-ID: Subject: Re: [RFC PATCH 2/4] clk: renesas: rzg2l-cpg: Add support to stack the resets instead of indexing To: Biju Das Cc: Prabhakar Mahadev Lad , Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , "linux-clk@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Phil Edworthy Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Biju, On Fri, May 6, 2022 at 1:11 PM Biju Das wrote: > > Hi Prabhakar, > > Subject: Re: [RFC PATCH 2/4] clk: renesas: rzg2l-cpg: Add support to stack > > the resets instead of indexing > > > > Hi Biju, > > > > Thank you for the review. > > > > On Thu, May 5, 2022 at 8:48 PM Biju Das wrote: > > > > > > Hi Lad Prabhakar, > > > > > > Thanks for the patch. > > > > > > > Subject: [RFC PATCH 2/4] clk: renesas: rzg2l-cpg: Add support to > > > > stack the resets instead of indexing > > > > > > > > Instead of indexing the resets, stack them and instead create an id > > > > member in struct rzg2l_reset to store the index. With this approach > > > > for every id we will have to loop through the resets array to match the > > id. > > > > > > > > This in preparation to add support for Renesas RZ/Five CPG in > > > > r9a07g043- cpg.c file where the resets array will be split up into > > > > three i.e. common and two SoC specific. > > > > > > > > Signed-off-by: Lad Prabhakar > > > > > > > > --- > > > > drivers/clk/renesas/rzg2l-cpg.c | 76 > > > > ++++++++++++++++++++++++++------- drivers/clk/renesas/rzg2l-cpg.h | > > > > 4 +- > > > > 2 files changed, 63 insertions(+), 17 deletions(-) > > > > > > > > diff --git a/drivers/clk/renesas/rzg2l-cpg.c > > > > b/drivers/clk/renesas/rzg2l- cpg.c index 1ce35f65682b..94fe307ec4c5 > > > > 100644 > > > > --- a/drivers/clk/renesas/rzg2l-cpg.c > > > > +++ b/drivers/clk/renesas/rzg2l-cpg.c > > > > @@ -681,14 +681,37 @@ rzg2l_cpg_register_mod_clk(const struct > > > > rzg2l_mod_clk *mod, > > > > > > > > #define rcdev_to_priv(x) container_of(x, struct rzg2l_cpg_priv, > > > > rcdev) > > > > > > > > +static const struct rzg2l_reset > > > > +*rzg2l_get_reset_ptr(struct rzg2l_cpg_priv *priv, > > > > + unsigned long id) > > > > + > > > > +{ > > > > + const struct rzg2l_cpg_info *info = priv->info; > > > > + unsigned int i; > > > > + > > > > + for (i = 0; i < priv->num_resets; i++) { > > > > + if (info->resets[i].id == id) > > > > + return &info->resets[i]; > > > > + } > > > > > > Is it not possible to use shared reset like RZ/G2L and RZ/V2L?, which > > > has optimal memory and performance wise we can avoid bigger loop. > > > > > > Like adding Last index of RZ/Five as last reset index and Handle > > > RZ/G2UL specific as invalid reset index in xlate?? > > > > > So we will have to maintain an array id's which are invalid to RZ/Five SoC. > > For this too we will have to loop at runtime itself. The array for invalid > > index will be big too. > > As per [1], it will be 25 resets. > > if you invalidate RZ/G2L specific resets in probe, there is no runtime overhead. > when a device match found, the info->reset_callback() which is mentioned in the next mail > and invalidate the resets(resets[id].off = 0) > Ahh right got that. I'll wait for Geert if he has more cunning ideas. If not I'll go with your suggested approach. > ie, > > if(info->reset_callback) > info->reset_callback(); > > and on r9a07g043-cpg.c, make resets[id].off = 0 to invalidate the resets. > OK. > https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/tree/include/dt-bindings/clock/r9a07g043-cpg.h > > Cheers, Prabhakar