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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3B11EC43334 for ; Tue, 12 Jul 2022 14:01:28 +0000 (UTC) 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0nxSZgn9vRg0d3a89ZOfmH82MR6lMqFSfJzgKNM2Exs=; b=k5hwKMwq9n36sL ad69bc3o2c9mWCyQE5UeADf+wpB2mlfpqpfqoKcS8+i2Lo49NbOKfuCmfqej8YhF3irTChWQ85kEu 6wQHzu8dJcJwYJPCG45uI9Z0v6AwqrB+karZ3DQdZWXjwQ7GAGhm8lAKM01pt347MsAGXycDL+M7Z Gu/ctu3Zzpi5vKrIzj2A0yl5jLyZsrIWnjrGxrUudct+LH99M8em9UCcjDfhWtiISd3wBfmhXc/Lb XnOARzsKUDZty9rQLPohaPBWgjdHtVnLXv3UnfASS24/0HAt3+8RKbiNgv3LWKsnmRU0o6SfrOuED /Z/jahbP5vrICUi2OhAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBGR2-00Ba49-8w; Tue, 12 Jul 2022 14:00:20 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBGQz-00Ba3Q-Bo; Tue, 12 Jul 2022 14:00:19 +0000 Received: from notapiano (pool-98-113-53-228.nycmny.fios.verizon.net [98.113.53.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id 13E0B66016F8; Tue, 12 Jul 2022 15:00:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1657634415; bh=mbcA91S5p6wcOQpchlxMqQs99CbpqYRQB8T7w4Nci6I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZJoOAEjRo3DgflaYetEXXTahyQ9YbJxeMhcsLOru17+VQSWm9crnflya6zAuO169F PNDsaEQuwqqiFB1VNtKUVJcj0YtMGihuCBjJI4vA9cMWj4XT94jEaQWzqUB3IiUidy SIWEei97AJus7Ya3q2UC3HRAuFhK7iAImVhCf+C3+m9SHKJbiXTKuM5NvrXIc1bcTN 3jLhUWa6zb7yjqru4RzRLzkt1aWIhr3fE1cA/c5rjSpsF0tgwT/0cQYJFLL8m00bow woUWTYKMRB/Ad+/KIX962tsD1G5jnbxDqG1VGF+E6g64HOPDRv4pLMimjAJlfdDAXT VWZ/kAd0IUP2Q== Date: Tue, 12 Jul 2022 10:00:10 -0400 From: =?utf-8?B?TsOtY29sYXMgRi4gUi4gQS4=?= Prado To: AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , Stephen Boyd , kernel@collabora.com, Chun-Jie Chen , Ikjoon Jang , Matthias Brugger , Michael Turquette , Miles Chen , Ran Jianping , Weiyi Lu , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] clk: mediatek: Don't check HW status for mt8192/5's imp_iic_wrap clocks Message-ID: <20220712140010.nfxo42td3zzy3iqp@notapiano> References: <20220711205733.203963-1-nfraprado@collabora.com> <473aa749-fcfe-bd38-0d83-95375aeef8a3@collabora.com> <9102680e-2c4c-6c62-0255-5f3f669dd16c@collabora.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9102680e-2c4c-6c62-0255-5f3f669dd16c@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220712_070017_649491_006FED47 X-CRM114-Status: GOOD ( 30.23 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 12, 2022 at 12:57:47PM +0200, AngeloGioacchino Del Regno wrote: > Il 12/07/22 12:56, Chen-Yu Tsai ha scritto: > > On Tue, Jul 12, 2022 at 6:55 PM AngeloGioacchino Del Regno > > wrote: > > > = > > > Il 12/07/22 12:44, Chen-Yu Tsai ha scritto: > > > > Hi, > > > > = > > > > On Tue, Jul 12, 2022 at 4:57 AM N=EDcolas F. R. A. Prado > > > > wrote: > > > > > = > > > > > The imp_iic_wrap clocks on mt8192/mt8195 require that the i2c_sel= parent > > > > > clock be enabled before their hardware status can be checked. Sin= ce this > > > > > wasn't taken into account, reading from the clk_summary debugfs f= ile > > > > > would cause the system to completely freeze. > > > > > = > > > > > Assuming that this clock is managed only by the kernel, and not b= y any > > > > > firmware, simply drop the is_enabled() optional callback and inst= ead > > > > > rely on the enable count for the imp_iic_wrap clocks. > > > > = > > > > That's the wrong way to go about it. > > > > = > > > > The I2C clocks already have the CLK_OPS_PARENT_ENABLE flag set. So = the > > > > issue is that somewhere in the clk core, a piece of code is not hon= oring > > > > that flag. > > > > = > > > > And it seems that's in more than one place. > > > > = > > > = > > > Uhm, you're right. I gave my Tested-by, but not a Reviewed-by because= I > > > wasn't really convinced about this solution being the best. > > > = > > > Now that I think of it, the solution may be as simple as: > > > = > > > clk.c > > > = > > > static bool clk_core_is_enabled(struct clk_core *core) > > > { > > > bool ret =3D false; > > > = > > > /* > > > * If this clock needs parent enabled, but its parent is > > > * off, we directly return false for two reasons: > > > * 1. This clock being enabled would be impossible > > > * 2. The platform may crash for unclocked access while > > > * reading the status of this clock (where a .is_enabled > > > * callback is provided). > > > */ > > > if (core->flags & CLK_OPS_PARENT_ENABLE && > > > !clk_core_is_enabled(core->parent)) > > > return false; > > > = > > > ... etc etc etc ... > > > } > > > = > > > N=EDcolas, did you try this approach? >From reading the core clock code, it's mentioned that CLK_OPS_PARENT_ENABLE= is used "during gate/ungate, set rate and re-parent", there's no mention of "checking the gate state", so I assumed this operation was intentionally not handled by this flag. That's why I went for this solution. But from the discussion sounds like the flag should indeed be caring about = the is_enabled() operation as well, so let's go with Chen-Yu's patch. Thanks, N=EDcolas > > = > > I have a patch ready, but I got distracted by other stuff today. > > = > = > Let's just wait for your patch then, seems like being the most sensible o= ption. > = > Cheers! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel