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 EDF7CC7618E for ; Mon, 24 Apr 2023 07:05:09 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D20ZbpbjFc538/Aq1SJJeSAprnwHl399WeHSXnV9jXc=; b=mCT1xzuqQUvtb2 FPByzKeodg0J4UqulgNZpYt5rBf4THwmKcQr57hJdnxBnJrTo6THZa728sXMViY2lKw9hSweUh2ql U/X2J8usVuKgZDEDO5rBqQqVnSXZoRYHNI12d4oQmPkW/o1H/YyHpNu8xk92OhRmWBO+ywl8jYnLn MZt3D59MgYjr5SKIhiQ3CHz13e9tKJL31WlI/2gSTFEtQ6YepJvWsvlafAuHvHssd1m+w0HiX4Z6c MmbwwXcUrAwgkVxYrWtEx0om34uhcGBu+OfAy/WmADvgE28WhX+BBNUSbt5KZonPSq/cvO4pSYF2j F6QMiEmi/9c3RIwsfwqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pqqEi-00FX1i-0C; Mon, 24 Apr 2023 07:03:44 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pqqEe-00FX0B-20 for linux-arm-kernel@lists.infradead.org; Mon, 24 Apr 2023 07:03:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1682319820; x=1713855820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Qh/mGcO5arvIrbknB3KqoLqa6GFPJoOeetSNDovtO4=; b=CUEpY7eS9g31JOGVhC7SUXBK5ZgjNtplhGVxCOCFoo5C6W5eDd/tnFh5 Wk/AimP//zNSsbalbUW/6jLYq535KOtaISLOK9QlM4iV4j56UlH61TLFA /5NjDMyMGsUIKFKy0IbT/e4EexCCaSAZD7cuigyGsSNf6ydjOz1dLfyNo Jib1P7m7ZTR+QILnLOvWR8HISVQUMEBZYOC/vzoczw8wwl7tCu+dgsq4Z sv3QvqrlUz86g5FscIcy0WQptnEezF9KUNivkRBxtzbbB0Rh3HxwEDl2Z szdXjHWHd2Duhz7g1DyX0ev1h9XqyZ7tIOE4AURqQtrF8flwRMgbyRy5m Q==; X-IronPort-AV: E=Sophos;i="5.99,222,1677538800"; d="scan'208";a="30504448" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 24 Apr 2023 09:03:34 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Mon, 24 Apr 2023 09:03:34 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Mon, 24 Apr 2023 09:03:34 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1682319814; x=1713855814; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Qh/mGcO5arvIrbknB3KqoLqa6GFPJoOeetSNDovtO4=; b=ObykGGSrwtABRMz+nng6UIhT5pUgFexwwIU5Ahb26GZy3KZ3o4kNsNCn uBxpKEs/9/gGk5Z6CN1Zcxr0OVr+P5UBMjXHeCWY1EjeSfHf9pFQyCPUS ly9tQGdt/nzfMAl12AsBgV9RMwyq3zTHMgCW4k7fsjSypn2t/WUrBc74g rKG6nihfobh1MIyuc4e2mIOAPRxA0E4VoJePhFxPBDS1iUomkm59s68lp m1yTw0Te8Nj+OBlcwdoJs6tbp8PQWoHXwusyjgk2yFdAZlsmM9k16cyhn EjAWTyOd68nJW5fEMXei7Jx53kCNSX4LLJE/W5HrD+OhVYa3USwh3aEKn w==; X-IronPort-AV: E=Sophos;i="5.99,222,1677538800"; d="scan'208";a="30504447" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 24 Apr 2023 09:03:34 +0200 Received: from steina-w.localnet (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 170A8280056; Mon, 24 Apr 2023 09:03:34 +0200 (CEST) From: Alexander Stein To: Marc Kleine-Budde Cc: NXP Linux Team , "A. Sverdlin" , Dong Aisheng , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] i2c: lpi2c: cache peripheral clock rate Date: Mon, 24 Apr 2023 09:03:34 +0200 Message-ID: <4797405.GXAFRqVoOG@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20230421-kinfolk-glancing-e185fd9c47b4-mkl@pengutronix.de> References: <20230310130815.562418-1-alexander.sverdlin@siemens.com> <9272339.EvYhyI6sBW@steina-w> <20230421-kinfolk-glancing-e185fd9c47b4-mkl@pengutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230424_000341_089587_C6A58052 X-CRM114-Status: GOOD ( 12.53 ) 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 Hi Marc, Am Freitag, 21. April 2023, 15:59:52 CEST schrieb Marc Kleine-Budde: > * PGP Signed by an unknown key > = > On 21.04.2023 15:48:59, Alexander Stein wrote: > [...] > = > > Now lpi2c_runtime_resume will call into clk_prepare() which also calls > > clk_prepare_lock() (identical to clk_get_rate). > = > IIRC this is a general problem^w limitation of the clock framework, > clock providers cannot use clocks themselves in certain callback, e.g. > set_rate. Well, that's essentially impossible when this clock provider is attached vi= a = i2c. i2c transfers potentially need to change or prepare clocks. One problem is that during clock registration (__clk_core_init) in the call= to = clk_ops.recalc_rate an i2c transfer is issued (via regmap). This is the = inverse lock order to a regular transfer runtime resuming the i2c master an= d = preparing the clocks. While looking at this, is_prepared is also affected by this. It's reading a = register, thus issuing a i2c transfer. But this function can also be called = from within clk_unprepare_unused_subtree, which holds clk_prepare_lock as = well. This might be avoided by using regcache, but I'm not really sure this catch= es = every case. Best regards, Alexander -- = TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel