Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp508503rdb; Fri, 6 Oct 2023 09:41:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuvxVE4lCEtBKMi/5tB4Ze8kqAxjvIV0FtqcjIyByupt16ivQxrp/fxe8LqYQgS05jIlHr X-Received: by 2002:a05:6358:7e07:b0:143:91a2:8df1 with SMTP id o7-20020a0563587e0700b0014391a28df1mr9223396rwm.3.1696610492099; Fri, 06 Oct 2023 09:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696610492; cv=none; d=google.com; s=arc-20160816; b=VlNRKdXP6LU2sqcjszK8PvskA1SEDEqHKY21XiH0SOYSiAWaUSmcFWwgcNHAlm/00X XX66GnxfCBZ7rK845kP7Zda3n8oqTVR+soODg6FqUdWpskKpex7QMYrGxhOoPNBHzo7h KidiWY6xlseXq3zA4DYlPIu998TYoXTF5pnBdRb90BWronKlXyvCxlWvBT1gt1JQzuxW kLLwieCDkIS8ZICky7imN93BJoD6IPsbjsfAiwLkPll3p0bo6w45J6z37Kz6ce0jwuA5 pDJ7ZIGu1iwyl+TvnQSJX3jiIxA4Mnb4LlEj9iBaLt3+kZW0OA7Jpl9sAk2rYAneo8CX RcJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :dkim-signature:dkim-signature:date; bh=xJK9V2VtLPnBrImfjMOmFTNsUiDy1Y0fI2z1sk+3JmU=; fh=ob2ImHsTglYzJH2iqvAtRPRGaG5hZFz0NV+GfBjHZe4=; b=cDQgUmYYhjBHr4BCdFywQJagDHujmGpZzHS4Uz0+U3wgBHWsTXUSDs4JZIRj+1r402 rbK/Fkeyq94XK14m8YQyBXeWFa/sdC6Mm3P/2YbdUnWykDGXVRyypwj83Bv1N/LpSZfT uJihF/GoZ3xEba/UdtZpA+aQ3+Dxg88wg1D8XzOJfgcr+jaENpoOtGMv91h2zHkB2jxG AfS4s+8i9kV43fpKY2gNVPqdMyTo8LcyuEJ/1UtxhnRDZshF7oD1gHS7l4+MMEI8EgjQ nW1stZOU59PaKNApQRy3cXivayMaVsdA49Vj9BUWARWcNvHykeJMDS9+eqA8QiMQoOJS XqHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1uoOGzSo; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bx29-20020a056a02051d00b00588d84b1217si4759525pgb.415.2023.10.06.09.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 09:41:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1uoOGzSo; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5699E8332FA7; Fri, 6 Oct 2023 09:40:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232922AbjJFQko (ORCPT + 99 others); Fri, 6 Oct 2023 12:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232496AbjJFQkn (ORCPT ); Fri, 6 Oct 2023 12:40:43 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2567FC2; Fri, 6 Oct 2023 09:40:40 -0700 (PDT) Date: Fri, 6 Oct 2023 18:40:36 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696610438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xJK9V2VtLPnBrImfjMOmFTNsUiDy1Y0fI2z1sk+3JmU=; b=1uoOGzSonar2EkeoparSKR9fpxQO4KWP9mczppZnHMlBSeaTPqCqtigTWCZJ3XFCDtecad G1L9RRBTaWv+ds1u7J9/x8WnhL9MLdYkDkGHszVTd7pRYndKjWotV/GG1dQR5rEi2G3M3d v53c4q7xCOmH/13Sp/ylOVcRhFfWVQIoDzcNAHI4iiegIkFvgd1CyFpKLHaKe/8OtVXQid SeqnVVChA8exJYD9p/KbyIxL1zF7DgcFO16wPwuNE0tTnEmlGjY5EyR9KC1rth3Z1vRIGT XA3MNp2PhpBSY4GQERrXN6APSzbjwntKvCYRguDWYNWjFYut3XC8880gxIwiaw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696610438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xJK9V2VtLPnBrImfjMOmFTNsUiDy1Y0fI2z1sk+3JmU=; b=74pAOyjNU+plxaJMGG2ktItK+APbVyqDvDy1lePId2QUmYEWVnhs5OppTY+ms9MDHHfPQ9 zKL2rsyKf7o9yMCA== From: Benedikt Spranger To: Maxime Ripard Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Stephen Boyd , Michael Turquette , Dinh Nguyen Subject: Re: [PATCH 1/1] clk: socfpga: gate: Fix of by factor 2 for serial console Message-ID: <20231006184020.7fb6f509@mitra> In-Reply-To: References: <20231005095927.12398-1-b.spranger@linutronix.de> <20231005095927.12398-2-b.spranger@linutronix.de> <20231005203202.08b5d1cf@mitra> Organization: Linutronix GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 06 Oct 2023 09:40:51 -0700 (PDT) X-Spam-Level: ** On Fri, 6 Oct 2023 17:01:34 +0200 Maxime Ripard wrote: > On Thu, Oct 05, 2023 at 08:32:23PM +0200, Benedikt Spranger wrote: > > On Thu, 5 Oct 2023 13:34:01 +0200 > > Maxime Ripard wrote: > > > > > Where is that factor 2 coming from? > > In drivers/tty/serial/8250/8250_dw.c p->uartclk is set twice as high, > > as it should be: > > > > dw8250_set_termios() is called and rate is evaluated to 20000000 in the > > bad and 10000000 in the good case. As a result p->uartclk is set to > > 20000000 in the bad case. > > Sure, sorry I worded that poorly. What I meant was what clock tree > decision is taken now that wasn't taken before that leads to that factor > 2 difference. OK. > Thanks for the traces, that's helpful. It looks like the culprit is: > > Good: > > init-1 [001] ..... 0.125643: clk_rate_request_start: l4_sp_clk min 0 max 4294967295, parent per_base_clk (200000000) > init-1 [001] ..... 0.125651: clk_rate_request_done: l4_sp_clk min 0 max 4294967295, parent per_base_clk (200000000) > init-1 [001] ..... 0.125657: dw8250_set_termios: dw8250_set_termios: rate = 200000000 newrate = 1843200 > > vs Bad: > > init-1 [001] ..... 0.116063: clk_rate_request_start: l4_sp_clk min 0 max 4294967295, parent per_base_clk (200000000) > init-1 [001] ..... 0.116089: clk_rate_request_done: l4_sp_clk min 0 max 4294967295, parent per_base_clk (200000000) > init-1 [001] ..... 0.116096: dw8250_set_termios: dw8250_set_termios: rate = 4294967274 newrate = 1843200 > > The rate returned is super suspicious, as it's an -EINVAL casted into an > unsigned long. So I think something on that clock chain is returning an > error for some reason, which is then treated as a rate by the rest and > everybody's just confused. OK. > What is the board that you're using? I am using a Cyclone5 DE0-Nano-Soc/Atlas board (socfpga_cyclone5_de0_nano_soc.dts). Regards Benedikt Spranger