From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FCB1C4708D for ; Thu, 27 May 2021 12:04:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82B39613E2 for ; Thu, 27 May 2021 12:04:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234797AbhE0MG2 (ORCPT ); Thu, 27 May 2021 08:06:28 -0400 Received: from mail-vs1-f48.google.com ([209.85.217.48]:35737 "EHLO mail-vs1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234540AbhE0MG0 (ORCPT ); Thu, 27 May 2021 08:06:26 -0400 Received: by mail-vs1-f48.google.com with SMTP id x22so236297vsn.2; Thu, 27 May 2021 05:04:51 -0700 (PDT) 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=Uh4zzMKY6luxk0/SSNclejeRcmWG2GmwP9Z21NWThdc=; b=asW3k569xrt+g9/xBoM3MSOxqw+0cWd14K6oi1Wl3YNxZqS2q569Pga0JdbTa25w21 YcodyfhNLPuUtzEsspO1dbMv9TQ/kSEiQsa6qxVvV6goaponRUkXg02xR52X/kVxsiyU K5Li9uInR0M/PFGYPWdS97hK7SiVmx+juwkLizPeV/wjMBXbE1NqKngzY+spnqldSMCm gs7qmUv72ybHsCFZrLFGcls1TBgCerkPb0bBf0kd0efe8ZwwoYuan5AbBmFacKIgHXoj jYwWiS7230iEH2sJBTRFjbgbBtz5KXtrli8LOsxIl0+GJDxcXFZ6/Ugbbw8PuLSnaTBn Vqbg== X-Gm-Message-State: AOAM530c6j/Y4vJLigg2kcF7oxi9XuwzzLtQRQdYcZQtr0SoSdfDf8c6 OyHzPaaa1lXWbOQKtQp4TPC6uRa/3Bvz0XDOtBU= X-Google-Smtp-Source: ABdhPJzBFvcXREuBIQYuRn70o9fXD4fkLjhIMPBlK3HLIgpWiKiyIy29QjGBrmD2cFoYRf6BqEL19Uz/PEFSKm9Yabc= X-Received: by 2002:a05:6102:392:: with SMTP id m18mr1556875vsq.40.1622117091488; Thu, 27 May 2021 05:04:51 -0700 (PDT) MIME-Version: 1.0 References: <20210514192218.13022-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20210514192218.13022-14-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20210514192218.13022-14-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Geert Uytterhoeven Date: Thu, 27 May 2021 14:04:39 +0200 Message-ID: Subject: Re: [PATCH 13/16] clk: renesas: Add CPG core wrapper for RZ/G2L SoC To: Lad Prabhakar Cc: Rob Herring , Magnus Damm , Michael Turquette , Stephen Boyd , Greg Kroah-Hartman , Catalin Marinas , Will Deacon , Jiri Slaby , Philipp Zabel , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux-Renesas , linux-clk , "open list:SERIAL DRIVERS" , Linux ARM , Biju Das , Prabhakar Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prabhakar, On Fri, May 14, 2021 at 9:24 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 > --- /dev/null > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c > +static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) > +{ > + struct mstp_clock *clock = to_mod_clock(hw); > + struct cpg_mssr_priv *priv = clock->priv; > + unsigned int reg = MSSR_OFF(clock->bit) * 4; The "* 4" here makes it difficult to review the module clock tables. E.g. DEF_MOD("gic", R9A07G044_CLK_GIC600, R9A07G044_CLK_P1, MSSR(5, BIT(0), (BIT(0) | BIT(1)))), The "5" means the CLK_ON_GIC600 register is at offset CLK_ON_R(5 * 4) = 0x514. Removing the "* 4" means you could use "MSSR(0x14, BIT(0), (BIT(0) | BIT(1))" instead. Unless it has unpleasant side effects, I'd even consider putting the full CLK_ON offset there, i.e. "MSSR(0x514, BIT(0), (BIT(0) | BIT(1))" and change the macros like: #define CLK_ON_R(reg) (reg) #define CLK_MON_R(reg) (0x680 - 0x500 + (reg)) > --- /dev/null > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h > +#define CLK_ON_R(reg) (0x500 + reg) > +#define CLK_MON_R(reg) (0x680 + reg) > +#define CLK_RST_R(reg) (0x800 + reg) > +#define CLK_MRST_R(reg) (0x980 + reg) The last three don't seem to be documented? 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0D79C47089 for ; Thu, 27 May 2021 12:06:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 742216143F for ; Thu, 27 May 2021 12:06:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 742216143F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RKwUsGjDXqGtIGc1d2XGnVtElPeWrg9RpnxE8jIHzwg=; b=Qx+gRXpyZk1B4I pgZ1CzQmIaCP5ICWFJ6IxnIDD6L95OAyPkhaQXbQu4fuHJQb90QcZ9XFFo5ewNa4hmrDCZ5OGP7JP U1lkQYhJuNHeBjTFMOrGDuGYvdsv/CjKxM6ZqqiJS3wd3mYqocAX3Io0Naa72lb9Rb9L65mxYI1vq ZBfIEQBsxAldXsG2JA+EvM3JC0N6Dd59k7yyZRQXk/IudxZZAgc/mtD275CYsGWQZTMxfKh3+lgr6 dH0FVGrR0VJWONDq5RckL1IsFTY+bNg/toKoEx4vOTzvPyEx1Cih0D1IwLczMqb3hgLr/XE5gy9lG M2pEwGo/PfuvKq4h6P3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmEl1-005aVy-VY; Thu, 27 May 2021 12:05:00 +0000 Received: from mail-vs1-f54.google.com ([209.85.217.54]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmEkv-005aSw-0U for linux-arm-kernel@lists.infradead.org; Thu, 27 May 2021 12:04:54 +0000 Received: by mail-vs1-f54.google.com with SMTP id u188so225179vsu.8 for ; Thu, 27 May 2021 05:04:52 -0700 (PDT) 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=Uh4zzMKY6luxk0/SSNclejeRcmWG2GmwP9Z21NWThdc=; b=H+uaqnWh3yUn7ehu+Taciivtm8Zgm2kLMxTia7cGIOHNoP4PyuUGpDjreIevvHaO1p +ss0W5oOWh65xIqh9afp8lWARcnnIUxHpF9O5hMIM6QnQfL6ooHr16LzsH53GfUx/ZO9 ETXt8QWXShQBCdURpSoFWgp6YFGn4Qoha264GNwJ7jy2FWpIybIlZz6CFdYAhZkQdrSF qRekItkvboWjZvlelCPeN3/EpK7YOayFYb+AyZqmLjANOYBxg9Xmzmwl7W3mmHimdE1l 4NY+kHlVuVY6zepuho64GG4Pxvw0fg9CoiXo/VSDWfb7tPD60/KXILOzIciR3gmtYYns 8zUw== X-Gm-Message-State: AOAM531aTe9gb0MlpdGTRrngYd3BGRS91k2RvbUxWUUKkZtfNGMi+v4J 836OwoQcP8GilNtCXVnv8p2IA85FsVzarZtFlOE= X-Google-Smtp-Source: ABdhPJzBFvcXREuBIQYuRn70o9fXD4fkLjhIMPBlK3HLIgpWiKiyIy29QjGBrmD2cFoYRf6BqEL19Uz/PEFSKm9Yabc= X-Received: by 2002:a05:6102:392:: with SMTP id m18mr1556875vsq.40.1622117091488; Thu, 27 May 2021 05:04:51 -0700 (PDT) MIME-Version: 1.0 References: <20210514192218.13022-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20210514192218.13022-14-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20210514192218.13022-14-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Geert Uytterhoeven Date: Thu, 27 May 2021 14:04:39 +0200 Message-ID: Subject: Re: [PATCH 13/16] clk: renesas: Add CPG core wrapper for RZ/G2L SoC To: Lad Prabhakar Cc: Rob Herring , Magnus Damm , Michael Turquette , Stephen Boyd , Greg Kroah-Hartman , Catalin Marinas , Will Deacon , Jiri Slaby , Philipp Zabel , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux-Renesas , linux-clk , "open list:SERIAL DRIVERS" , Linux ARM , Biju Das , Prabhakar X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_050453_083165_C15EB586 X-CRM114-Status: GOOD ( 23.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Prabhakar, On Fri, May 14, 2021 at 9:24 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 > --- /dev/null > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c > +static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) > +{ > + struct mstp_clock *clock = to_mod_clock(hw); > + struct cpg_mssr_priv *priv = clock->priv; > + unsigned int reg = MSSR_OFF(clock->bit) * 4; The "* 4" here makes it difficult to review the module clock tables. E.g. DEF_MOD("gic", R9A07G044_CLK_GIC600, R9A07G044_CLK_P1, MSSR(5, BIT(0), (BIT(0) | BIT(1)))), The "5" means the CLK_ON_GIC600 register is at offset CLK_ON_R(5 * 4) = 0x514. Removing the "* 4" means you could use "MSSR(0x14, BIT(0), (BIT(0) | BIT(1))" instead. Unless it has unpleasant side effects, I'd even consider putting the full CLK_ON offset there, i.e. "MSSR(0x514, BIT(0), (BIT(0) | BIT(1))" and change the macros like: #define CLK_ON_R(reg) (reg) #define CLK_MON_R(reg) (0x680 - 0x500 + (reg)) > --- /dev/null > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h > +#define CLK_ON_R(reg) (0x500 + reg) > +#define CLK_MON_R(reg) (0x680 + reg) > +#define CLK_RST_R(reg) (0x800 + reg) > +#define CLK_MRST_R(reg) (0x980 + reg) The last three don't seem to be documented? 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel