Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp435315rdh; Thu, 23 Nov 2023 07:53:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkjcNvp0pOISju8jqLy0jF/OIxCdoSTdTHJTieT+QvLWtDhdYzEms42j601ZauJB+h299S X-Received: by 2002:a05:6a00:1412:b0:6c3:75e1:9dcd with SMTP id l18-20020a056a00141200b006c375e19dcdmr5934119pfu.18.1700754830960; Thu, 23 Nov 2023 07:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700754830; cv=none; d=google.com; s=arc-20160816; b=v18kjjmQGI1NucGe2Fdg/jwUJwt7KI7fRpF+uUcs8xaUL+5+zax1I0RSEEsWDG3Dkf aF0bAxJ19nlJa4x710CwgOlAQMWM73F/3FWqw3gISJypL89CP4bsZBa0qIakl4uMK6YE uPX0sxX0mRgoj5ZCyt8QskvBQa7ici4Y0asHaH1S8WkGEZM0mcQnlNo7WQIVqz2kq2dY iKiWuSuAnS+oerpKiRXHaxiHgsDkAozscmT0oB6CI3yFQY88DUO5UledJtK9JX7fTKSc VYBlst5hP3G2dcP+vdLMFYUFZCt7pInwaG6NPA1dyiGHfHPpBOciBdSOl3dq0OWwm3z6 1LpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=8FuIsVRhSn36AtIR/C2QvqHqkHpI+ee/dKPY6Jfo1X4=; fh=JvSyr9x06qTi6TUQTxhuouq2DEyQrGb/s7QE82ckXPw=; b=he6qGADrGOvxqMGgdxmzOrwgaA+UZ5rn90Frqx1zdkhhvAxNDItOAHUespga0w8K6r fhGRlBdGxYTEZJJ2ygPLmpzUcgtc2hY0cRtou1WWDGr6TtNOTWYPFK8JFb46e7GFD+3f 947uAoYgM6KyQdIG5o1XcTwBMuygsKhAzZjswfcpet1m9Z0OBpnr+F9XL0rDjvzG/mgU QT5ce//yryVF4ccfglYx7poD3LyFu6mcliQzTCEEOvRec0uE0mJrp+v4fV4Hot0Kf/hu dKR86iC6QxW2ul31ijj7+M+XMuMWztFVlNSSICxpiKuN/sNGz56vR2qV1dIK+Z6xFy+A KRXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o16-20020a056a0015d000b006cb83204cffsi1500367pfu.256.2023.11.23.07.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 07:53:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 364CE8290981; Thu, 23 Nov 2023 07:53:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346182AbjKWPx1 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 23 Nov 2023 10:53:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346149AbjKWPx0 (ORCPT ); Thu, 23 Nov 2023 10:53:26 -0500 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCACAD41; Thu, 23 Nov 2023 07:53:32 -0800 (PST) Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d9beb865a40so918933276.1; Thu, 23 Nov 2023 07:53:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700754812; x=1701359612; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+4a8muWVJERlW0eLxhsAPKkg7UICmbIYUzNpVBBHRwc=; b=XYfzrHsa0W0DAj70+yfUOMJO6hqVmc58/a2AkSqPqbQBqFb1PLGGeclV4YYb75+vvl ugN26NOFhUlNivOGlewDIcFh1RgwLq/iVwHvI4M9AcDUDdM2lYekfvc+nNcto4TzxIus XLM/mQXnzfVzVmWpd9AoCXKiLAbCN8iCg6ZE2SpDU+6r6kyCrEIZYmd80T64KFl8i8Qu JkE8i+zGErTamwLSjGhWbmE07csu53DSiHxrk3V15cbudipccVs1MOSKChqJzLYvuWhx YvcEJ0+FGiZL+q98yPEXwcLr3REvC0FDRWJCMxiWOfUY0OLfmDLyVTtlPBWF6Y2rAA45 Uaag== X-Gm-Message-State: AOJu0YwIh1Td87oWrLXWPHalpbss6hGFs6WNjKkLmbHE/ARmTioJ4TXb ey2SGFyuPRiWhXEH1MUTM/PYn7mCh0AAwg== X-Received: by 2002:a25:c094:0:b0:d9c:7d48:3020 with SMTP id c142-20020a25c094000000b00d9c7d483020mr5514911ybf.20.1700754811733; Thu, 23 Nov 2023 07:53:31 -0800 (PST) Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com. [209.85.128.182]) by smtp.gmail.com with ESMTPSA id 123-20020a250b81000000b00db3fca90d6esm378661ybl.2.2023.11.23.07.53.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Nov 2023 07:53:31 -0800 (PST) Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-5cc5988f85eso10390567b3.2; Thu, 23 Nov 2023 07:53:30 -0800 (PST) X-Received: by 2002:a0d:fe43:0:b0:5cb:95e8:16ba with SMTP id o64-20020a0dfe43000000b005cb95e816bamr6373455ywf.46.1700754810638; Thu, 23 Nov 2023 07:53:30 -0800 (PST) MIME-Version: 1.0 References: <20231120070024.4079344-1-claudiu.beznea.uj@bp.renesas.com> <20231120070024.4079344-3-claudiu.beznea.uj@bp.renesas.com> In-Reply-To: <20231120070024.4079344-3-claudiu.beznea.uj@bp.renesas.com> From: Geert Uytterhoeven Date: Thu, 23 Nov 2023 16:53:17 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 02/14] clk: renesas: rzg2l-cpg: Check reset monitor registers To: Claudiu Cc: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux@armlinux.org.uk, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, linus.walleij@linaro.org, p.zabel@pengutronix.de, arnd@arndb.de, m.szyprowski@samsung.com, alexandre.torgue@foss.st.com, afd@ti.com, broonie@kernel.org, alexander.stein@ew.tq-group.com, eugen.hristev@collabora.com, sergei.shtylyov@gmail.com, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com, linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, Claudiu Beznea Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 23 Nov 2023 07:53:46 -0800 (PST) Hi Claudiu, On Mon, Nov 20, 2023 at 8:01 AM Claudiu wrote: > From: Claudiu Beznea > > Hardware manual of both RZ/G2L and RZ/G3S specifies that reset monitor > registers need to be interrogated when the reset signals are toggled > (chapters "Procedures for Supplying and Stopping Reset Signals" and > "Procedure for Activating Modules"). Without this there is a chance that > different modules (e.g. Ethernet) to not be ready after reset signal is > toggled leading to failures (on probe or resume from deep sleep states). > > Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC") > Signed-off-by: Claudiu Beznea Thanks for your patch! > In case you apply this patch and patch 1/13 as is, please add a Depend-on > tag on this patch to point to patch 1/13 for proper backporting. There is no such Depend-on tag? Anyway, this patch won't apply if 1/13 is not backported... > --- a/drivers/clk/renesas/rzg2l-cpg.c > +++ b/drivers/clk/renesas/rzg2l-cpg.c > @@ -1416,12 +1416,23 @@ static int rzg2l_cpg_assert(struct reset_controller_dev *rcdev, > struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev); > const struct rzg2l_cpg_info *info = priv->info; > unsigned int reg = info->resets[id].off; > - u32 value = BIT(info->resets[id].bit) << 16; > + u32 dis = BIT(info->resets[id].bit); > + u32 value = dis << 16; > + int ret = 0; > > dev_dbg(rcdev->dev, "assert id:%ld offset:0x%x\n", id, CLK_RST_R(reg)); > > writel(value, priv->base + CLK_RST_R(reg)); > - return 0; > + > + if (info->has_clk_mon_regs) { > + ret = readl_poll_timeout_atomic(priv->base + CLK_MRST_R(reg), value, > + value & dis, 10, 200); > + } else { > + /* Wait for at least one cycle of the RCLK clock (@ ca. 32 kHz) */ > + udelay(35); > + } I think this should also take into account CPG_RST_MON on RZ/V2M, cfr. rzg2l_cpg_status(). > + > + return ret; > } > > static int rzg2l_cpg_deassert(struct reset_controller_dev *rcdev, > @@ -1432,12 +1443,22 @@ static int rzg2l_cpg_deassert(struct reset_controller_dev *rcdev, > unsigned int reg = info->resets[id].off; > u32 dis = BIT(info->resets[id].bit); > u32 value = (dis << 16) | dis; > + int ret = 0; > > dev_dbg(rcdev->dev, "deassert id:%ld offset:0x%x\n", id, > CLK_RST_R(reg)); > > writel(value, priv->base + CLK_RST_R(reg)); > - return 0; > + > + if (info->has_clk_mon_regs) { > + ret = readl_poll_timeout_atomic(priv->base + CLK_MRST_R(reg), value, > + !(value & dis), 10, 200); > + } else { > + /* Wait for at least one cycle of the RCLK clock (@ ca. 32 kHz) */ > + udelay(35); > + } Likewise. > + > + return ret; > } > > static int rzg2l_cpg_reset(struct reset_controller_dev *rcdev, The rest LGTM. 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