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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7F1EC433EF for ; Mon, 18 Apr 2022 11:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237874AbiDRLH7 (ORCPT ); Mon, 18 Apr 2022 07:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237868AbiDRLH5 (ORCPT ); Mon, 18 Apr 2022 07:07:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DBC013E99; Mon, 18 Apr 2022 04:05:18 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C21C61F37E; Mon, 18 Apr 2022 11:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1650279916; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2MXv4CCJ+s8PPXj9xZt112RURp4scFtLvmiRjw8DjDE=; b=jqQVK5TQAcVnxMDc24wO8sga6fhYUmXxKe/8xe6oNvirRP1ZB4/Rxosh+8BDucv1RhrfxO G8tyVq4hWBa3PTg43o269xNS6pw92b2yAHP1pwyCzaBWQCvazwy5o1MyLEndH8ZkMY+6fr gf3dF1nszgSfBB0JUNrPXQsDTOxulq8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1650279916; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2MXv4CCJ+s8PPXj9xZt112RURp4scFtLvmiRjw8DjDE=; b=Sbf493i94lbj90nCvsJyBOr/qQN6eXypLFmYZ+SMhgy7KBdRG+HKj/qREfbcpaGSKhjYGq R1qZ2lyVdA0YPOAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9EA8B13ACB; Mon, 18 Apr 2022 11:05:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id J3MfJuxFXWIkFQAAMHmgww (envelope-from ); Mon, 18 Apr 2022 11:05:16 +0000 Date: Mon, 18 Apr 2022 14:05:16 +0300 From: "Ivan T. Ivanov" To: Stefan Wahren Cc: Michael Turquette , Stephen Boyd , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , Paul Walmsley , Palmer Dabbelt , Albert Ou , Phil Elwell , kernel test robot , bcm-kernel-feedback-list@broadcom.com, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] clk: bcm2835: Round UART input clock up Message-ID: <20220418110516.s7jxsfa3jl7aagrf@suse> References: <20220404125113.80239-1-iivanov@suse.de> <20220414105656.qt52zmr5vjmjdcxc@suse> <0b3356c0-b4c8-91ed-dfde-9f50483ec36f@i2se.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0b3356c0-b4c8-91ed-dfde-9f50483ec36f@i2se.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stefan, On 04-15 10:52, Stefan Wahren wrote: > > Hi Ivan, > > Am 14.04.22 um 12:56 schrieb Ivan T. Ivanov: > > Hi Stefan, > > > > Please, could you take a look into following patch? > yes, but i cannot give a technical review. But from my gut feeling this > doesn't look really elegant to me. > > > > Thanks! > > Ivan > > > > On 04-04 15:51, Ivan T. Ivanov wrote: > > > Subject: [PATCH v2] clk: bcm2835: Round UART input clock up > > > Message-Id: <20220404125113.80239-1-iivanov@suse.de> > > > > > > The UART clock is initialised to be as close to the requested > > > frequency as possible without exceeding it. Now that there is a > > > clock manager that returns the actual frequencies, an expected > > > 48MHz clock is reported as 47999625. If the requested baudrate > > > == requested clock/16, there is no headroom and the slight > > > reduction in actual clock rate results in failure. > > > > > > If increasing a clock by less than 0.1% changes it from ..999.. > > > to ..000.., round it up. > > Based on this commit message this looks like a fix / workaround for an > issue. It would be very helpful to know: > > What issue should be fixed? > > Why is it fixed here and not in the UART driver for instance? The UART driver is amba-pl011. Original fix, see below Github link, was inside pl011 module, but somehow it didn't look as the right place either. Beside that this rounding function is not exactly perfect for all possible clock values. So I deiced to move the hack to the platform which actually need it. > > In case it fixes a regression, a Fixes tag should be necessary. I found the issue because it was reported that RPi3[1] and RPi Zero 2W boards have issues with the Bluetooth. So it turns out that when switching from initial to operation speed host and device no longer can talk each other because host uses incorrect baud rate. I open to better solution of the issue. Thanks, Ivan > > In best case this is explained in the commit message. > > Best regards > > > > > > > This is reworked version of a downstream fix: > > > https://github.com/raspberrypi/linux/commit/ab3f1b39537f6d3825b8873006fbe2fc5ff057b7 > > > [1] https://bugzilla.suse.com/show_bug.cgi?id=1188238 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 DF18EC433F5 for ; Mon, 18 Apr 2022 11:06:24 +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=xl2em4oDByRPMt6DrFshF0Dnkgkj/+sIGGweU5ouqaE=; b=p+jLMi1IXvISeL Mpl7S6ft9Pu9jbPEKQ75f9JbYHgqqNz5rglIwK0dnoKu/0SgiVHSap1f6NGzy28porXAggF7cf4B8 mHvqdVlEfs1aSCO0z3F7jaCxPxfRQheAbhTw/t4Sp20mSPn3vOCc8YAPP0rAIJfw7BWkHjsOzHekD kMuOL4xWmMesYI5onhx/yaX79CGv5adk9aCNoJSMmHNk/7LObYY24KbiBw4x5atU83rJJ7Z/xPGs4 4X2bi4iFX1BLs/Ext0Qe0ST/X/ewVOWfkmrbtNRZ0BJZdqy7T8TGlGnN7ZFFhFGv0SS6OI89yWEBS 7o4S1ucPDdLo5Uyk+oew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngPC9-00GPPo-7t; Mon, 18 Apr 2022 11:05:25 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngPC5-00GPON-Do; Mon, 18 Apr 2022 11:05:23 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C21C61F37E; Mon, 18 Apr 2022 11:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1650279916; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2MXv4CCJ+s8PPXj9xZt112RURp4scFtLvmiRjw8DjDE=; b=jqQVK5TQAcVnxMDc24wO8sga6fhYUmXxKe/8xe6oNvirRP1ZB4/Rxosh+8BDucv1RhrfxO G8tyVq4hWBa3PTg43o269xNS6pw92b2yAHP1pwyCzaBWQCvazwy5o1MyLEndH8ZkMY+6fr gf3dF1nszgSfBB0JUNrPXQsDTOxulq8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1650279916; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2MXv4CCJ+s8PPXj9xZt112RURp4scFtLvmiRjw8DjDE=; b=Sbf493i94lbj90nCvsJyBOr/qQN6eXypLFmYZ+SMhgy7KBdRG+HKj/qREfbcpaGSKhjYGq R1qZ2lyVdA0YPOAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9EA8B13ACB; Mon, 18 Apr 2022 11:05:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id J3MfJuxFXWIkFQAAMHmgww (envelope-from ); Mon, 18 Apr 2022 11:05:16 +0000 Date: Mon, 18 Apr 2022 14:05:16 +0300 From: "Ivan T. Ivanov" To: Stefan Wahren Cc: Michael Turquette , Stephen Boyd , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , Paul Walmsley , Palmer Dabbelt , Albert Ou , Phil Elwell , kernel test robot , bcm-kernel-feedback-list@broadcom.com, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] clk: bcm2835: Round UART input clock up Message-ID: <20220418110516.s7jxsfa3jl7aagrf@suse> References: <20220404125113.80239-1-iivanov@suse.de> <20220414105656.qt52zmr5vjmjdcxc@suse> <0b3356c0-b4c8-91ed-dfde-9f50483ec36f@i2se.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0b3356c0-b4c8-91ed-dfde-9f50483ec36f@i2se.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220418_040521_649438_77522DC7 X-CRM114-Status: GOOD ( 26.02 ) 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 Stefan, On 04-15 10:52, Stefan Wahren wrote: > > Hi Ivan, > > Am 14.04.22 um 12:56 schrieb Ivan T. Ivanov: > > Hi Stefan, > > > > Please, could you take a look into following patch? > yes, but i cannot give a technical review. But from my gut feeling this > doesn't look really elegant to me. > > > > Thanks! > > Ivan > > > > On 04-04 15:51, Ivan T. Ivanov wrote: > > > Subject: [PATCH v2] clk: bcm2835: Round UART input clock up > > > Message-Id: <20220404125113.80239-1-iivanov@suse.de> > > > > > > The UART clock is initialised to be as close to the requested > > > frequency as possible without exceeding it. Now that there is a > > > clock manager that returns the actual frequencies, an expected > > > 48MHz clock is reported as 47999625. If the requested baudrate > > > == requested clock/16, there is no headroom and the slight > > > reduction in actual clock rate results in failure. > > > > > > If increasing a clock by less than 0.1% changes it from ..999.. > > > to ..000.., round it up. > > Based on this commit message this looks like a fix / workaround for an > issue. It would be very helpful to know: > > What issue should be fixed? > > Why is it fixed here and not in the UART driver for instance? The UART driver is amba-pl011. Original fix, see below Github link, was inside pl011 module, but somehow it didn't look as the right place either. Beside that this rounding function is not exactly perfect for all possible clock values. So I deiced to move the hack to the platform which actually need it. > > In case it fixes a regression, a Fixes tag should be necessary. I found the issue because it was reported that RPi3[1] and RPi Zero 2W boards have issues with the Bluetooth. So it turns out that when switching from initial to operation speed host and device no longer can talk each other because host uses incorrect baud rate. I open to better solution of the issue. Thanks, Ivan > > In best case this is explained in the commit message. > > Best regards > > > > > > > This is reworked version of a downstream fix: > > > https://github.com/raspberrypi/linux/commit/ab3f1b39537f6d3825b8873006fbe2fc5ff057b7 > > > [1] https://bugzilla.suse.com/show_bug.cgi?id=1188238 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel