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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 556FEC4332D for ; Wed, 20 Jan 2021 14:57:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3905B2339E for ; Wed, 20 Jan 2021 14:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390710AbhATO4w (ORCPT ); Wed, 20 Jan 2021 09:56:52 -0500 Received: from inva020.nxp.com ([92.121.34.13]:37674 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390910AbhATOpn (ORCPT ); Wed, 20 Jan 2021 09:45:43 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5675F1A14BC; Wed, 20 Jan 2021 15:44:55 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3DCF51A14B4; Wed, 20 Jan 2021 15:44:55 +0100 (CET) Received: from localhost (fsr-ub1664-175.ea.freescale.net [10.171.82.40]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 296092039A; Wed, 20 Jan 2021 15:44:55 +0100 (CET) Date: Wed, 20 Jan 2021 16:44:54 +0200 From: Abel Vesa To: Adam Ford Cc: arm-soc , Adam Ford-BE , Aisheng Dong , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Linus Walleij , Jerome Brunet , linux-clk , Linux Kernel Mailing List Subject: Re: [PATCH V3] clk: imx: Fix reparenting of UARTs not associated with sdout Message-ID: <20210120144454.f6b72lnasw4q3bde@fsr-ub1664-175> References: <20210115182909.314756-1-aford173@gmail.com> <20210118125204.hxsanoohwvdtdvym@fsr-ub1664-175> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180622 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-01-18 08:00:43, Adam Ford wrote: > On Mon, Jan 18, 2021 at 6:52 AM Abel Vesa wrote: > > > > On 21-01-15 12:29:08, Adam Ford wrote: > > > > ... > > > > > diff --git a/drivers/clk/imx/clk-imx25.c b/drivers/clk/imx/clk-imx25.c > > > index a66cabfbf94f..66192fe0a898 100644 > > > --- a/drivers/clk/imx/clk-imx25.c > > > +++ b/drivers/clk/imx/clk-imx25.c > > > @@ -73,16 +73,6 @@ enum mx25_clks { > > > > > > static struct clk *clk[clk_max]; > > > > > > -static struct clk ** const uart_clks[] __initconst = { > > > - &clk[uart_ipg_per], > > > - &clk[uart1_ipg], > > > - &clk[uart2_ipg], > > > - &clk[uart3_ipg], > > > - &clk[uart4_ipg], > > > - &clk[uart5_ipg], > > > - NULL > > > -}; > > > - > > > > I'm assuming there is another patch that updates the dts files. Right ? > > I have only been able to test this on an i.MX8M Mini. I need to set > the parent clock of the i.MX8M Mini to an 80 MHz clock in order to run > the UART at 4Mbps. With this patch, I can stop enabling the all the > UART clocks early and allow the clock parent configuration to occur. > From what I can tell, the remaining clocks should get activated as > they are needed, because I was able to use Bluetooth connected to > UART1 running at 4MBps using a 80MHz clock source with this patch, and > the clk_summary shows the clock is running at the proper speed. > Without this patch, the UART fails to re-parent, so I'm stuck at lower > speeds and that means choppy Bluetooth audio. > > The Kernel that NXP hosts on Code Aurora that they use for Yocto > attempts scan through stdout to only enable those clocks [1]. I > attempted to push it upstream, but it was rejected [2]. Sascha > suggested creating an array which could be filled when the clocks are > enabled and that array would be used to deactivate the clocks at > shutdown. That's what I attempted to do here. > > I don't have older imx boards to know if their device trees are > configured in such a way without modifications to the device tree or > not, but since it appears to work for NXP in [2], I assumed it would > work here. > > [1] - https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.codeaurora.org%2Fexternal%2Fimx%2Flinux-imx%2Fcommit%2Fdrivers%2Fclk%2Fimx%2Fclk.c%3Fh%3Dimx_5.4.47_2.2.0%26id%3D754ae82cc55b7445545fc2f092a70e0f490e9c1b&data=04%7C01%7Cabel.vesa%40nxp.com%7Cf8922e76fa85485b86c508d8bbb97c47%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637465752633257569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bVmPaM1nN7Sm%2BISVvlIBoWYozfJE96fHpw431IEuggk%3D&reserved=0 > [2] - https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fproject%2Flinux-arm-kernel%2Fpatch%2F20201229145130.2680442-1-aford173%40gmail.com%2F&data=04%7C01%7Cabel.vesa%40nxp.com%7Cf8922e76fa85485b86c508d8bbb97c47%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637465752633257569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=226HwbeVhZUW%2FJ3hsCSaVIxghOsPBH9EWeF8vFxaTWE%3D&reserved=0 > > > > > TBH, I'm against the idea of having to call consumer API from a clock provider driver. > > I'm still investigating a way of moving the uart clock control calls in drivers/serial/imx, > > where they belong. > > That makes sense. > Just a thought. The uart clock used for console remains on from u-boot, so maybe it's enough to just add the CLK_IGNORE_UNUSED flag to all the uart root clocks and remove the prepare/enable calls for uart clocks for good. I don't really have a way to test it right now, but maybe you could give it a try. 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=-10.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 2F8D9C433E0 for ; Wed, 20 Jan 2021 14:46:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 E0D7323382 for ; Wed, 20 Jan 2021 14:46:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0D7323382 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=NMimhjp0YxDaF+OVuZeLGeOSkbSJfZNzk09+94eLH5A=; b=ozXMR+VESTLKf25aBY4MqbbmX 2Eff0pw1rxeN6vTgT/nTVjDHtU+Fze7nxMOviGcjWsYwuGJoq00xn7Sr1Tmzn4tM4YNcKPeR2S3iM dqITtU7L6zLEftQxWAm9bK1mu6aYapO9FfnbhUQK1lBisSjv7OW4HIchXHmKmy98Qj0/nG0yt6Wb7 gTUKxyl2/UdaU4ny3oXrwWmb/yIjq+mrIIgIAXJBPlfh8lirOBDFlvAzKEjoq/N92IIXoGMgZLC9J lQ4m3wsWo5+G4kHy+RTUHx04QlwzcE48Md95cVnANT1z/LC824ScTvlxcK0CEJPXyEKdfajTjJClQ +Y83Gq6xA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2EjF-0000R4-5Q; Wed, 20 Jan 2021 14:45:01 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2EjC-0000QI-Oo for linux-arm-kernel@lists.infradead.org; Wed, 20 Jan 2021 14:45:00 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5675F1A14BC; Wed, 20 Jan 2021 15:44:55 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3DCF51A14B4; Wed, 20 Jan 2021 15:44:55 +0100 (CET) Received: from localhost (fsr-ub1664-175.ea.freescale.net [10.171.82.40]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 296092039A; Wed, 20 Jan 2021 15:44:55 +0100 (CET) Date: Wed, 20 Jan 2021 16:44:54 +0200 From: Abel Vesa To: Adam Ford Subject: Re: [PATCH V3] clk: imx: Fix reparenting of UARTs not associated with sdout Message-ID: <20210120144454.f6b72lnasw4q3bde@fsr-ub1664-175> References: <20210115182909.314756-1-aford173@gmail.com> <20210118125204.hxsanoohwvdtdvym@fsr-ub1664-175> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180622 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210120_094458_991919_8B3AE0E7 X-CRM114-Status: GOOD ( 30.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng Dong , Linus Walleij , Linux Kernel Mailing List , Stephen Boyd , Fabio Estevam , Michael Turquette , Adam Ford-BE , linux-clk , NXP Linux Team , Pengutronix Kernel Team , Shawn Guo , Sascha Hauer , arm-soc , Jerome Brunet 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 On 21-01-18 08:00:43, Adam Ford wrote: > On Mon, Jan 18, 2021 at 6:52 AM Abel Vesa wrote: > > > > On 21-01-15 12:29:08, Adam Ford wrote: > > > > ... > > > > > diff --git a/drivers/clk/imx/clk-imx25.c b/drivers/clk/imx/clk-imx25.c > > > index a66cabfbf94f..66192fe0a898 100644 > > > --- a/drivers/clk/imx/clk-imx25.c > > > +++ b/drivers/clk/imx/clk-imx25.c > > > @@ -73,16 +73,6 @@ enum mx25_clks { > > > > > > static struct clk *clk[clk_max]; > > > > > > -static struct clk ** const uart_clks[] __initconst = { > > > - &clk[uart_ipg_per], > > > - &clk[uart1_ipg], > > > - &clk[uart2_ipg], > > > - &clk[uart3_ipg], > > > - &clk[uart4_ipg], > > > - &clk[uart5_ipg], > > > - NULL > > > -}; > > > - > > > > I'm assuming there is another patch that updates the dts files. Right ? > > I have only been able to test this on an i.MX8M Mini. I need to set > the parent clock of the i.MX8M Mini to an 80 MHz clock in order to run > the UART at 4Mbps. With this patch, I can stop enabling the all the > UART clocks early and allow the clock parent configuration to occur. > From what I can tell, the remaining clocks should get activated as > they are needed, because I was able to use Bluetooth connected to > UART1 running at 4MBps using a 80MHz clock source with this patch, and > the clk_summary shows the clock is running at the proper speed. > Without this patch, the UART fails to re-parent, so I'm stuck at lower > speeds and that means choppy Bluetooth audio. > > The Kernel that NXP hosts on Code Aurora that they use for Yocto > attempts scan through stdout to only enable those clocks [1]. I > attempted to push it upstream, but it was rejected [2]. Sascha > suggested creating an array which could be filled when the clocks are > enabled and that array would be used to deactivate the clocks at > shutdown. That's what I attempted to do here. > > I don't have older imx boards to know if their device trees are > configured in such a way without modifications to the device tree or > not, but since it appears to work for NXP in [2], I assumed it would > work here. > > [1] - https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.codeaurora.org%2Fexternal%2Fimx%2Flinux-imx%2Fcommit%2Fdrivers%2Fclk%2Fimx%2Fclk.c%3Fh%3Dimx_5.4.47_2.2.0%26id%3D754ae82cc55b7445545fc2f092a70e0f490e9c1b&data=04%7C01%7Cabel.vesa%40nxp.com%7Cf8922e76fa85485b86c508d8bbb97c47%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637465752633257569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bVmPaM1nN7Sm%2BISVvlIBoWYozfJE96fHpw431IEuggk%3D&reserved=0 > [2] - https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fproject%2Flinux-arm-kernel%2Fpatch%2F20201229145130.2680442-1-aford173%40gmail.com%2F&data=04%7C01%7Cabel.vesa%40nxp.com%7Cf8922e76fa85485b86c508d8bbb97c47%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637465752633257569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=226HwbeVhZUW%2FJ3hsCSaVIxghOsPBH9EWeF8vFxaTWE%3D&reserved=0 > > > > > TBH, I'm against the idea of having to call consumer API from a clock provider driver. > > I'm still investigating a way of moving the uart clock control calls in drivers/serial/imx, > > where they belong. > > That makes sense. > Just a thought. The uart clock used for console remains on from u-boot, so maybe it's enough to just add the CLK_IGNORE_UNUSED flag to all the uart root clocks and remove the prepare/enable calls for uart clocks for good. I don't really have a way to test it right now, but maybe you could give it a try. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel