Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp840221rdg; Wed, 11 Oct 2023 07:04:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtRAVeugzgdwoWtCZm18vQiUFxU4Di2gomr2ioHsK48zknv0qV5yMzqWp1PMaryMhQLyYo X-Received: by 2002:a05:6a20:9188:b0:14c:d494:77c5 with SMTP id v8-20020a056a20918800b0014cd49477c5mr26135188pzd.13.1697033079552; Wed, 11 Oct 2023 07:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697033079; cv=none; d=google.com; s=arc-20160816; b=mgMM5pRrjmlQ6UNYgjlghRl2R7q8b/k1M4ByZG/2TAogmtvYkErNbpGtOy4xXsDXpL oTJpZXkGyD7x2clcyMtfWILhlNenG8pW9YomGCYrXT1CP97eRIN7MwtVL3JJTKBgl+qw acRm+0XObKhuCgsFP088iBSgfSwePJWAtC4zY6OxhUI9DXFeclRkV1YobRY4EwWI995i 0JoM1UYS24FXrYgd8AAS5iuO1ECEVXyI22XlwPR9bCSe3pS68Ufy8becRJXkp+NSW8D6 7U8B3ua10S4TzEqoGeF3fe7weeMiFdf+rEIw5Wt/OvvWCz/jUy0vsNGmQb8EktwQXErj Ao+Q== 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=/ryEPlAkCfnJebPNGelFxUu+Exl4LiDYxPfbPUhgQHM=; fh=ob2ImHsTglYzJH2iqvAtRPRGaG5hZFz0NV+GfBjHZe4=; b=ZCHhQuWFH/8UUPek6uxl3ld7/NKpOFnRhMwROMEM/eqIusLBLifp4nI91sE+8yCNOk Eb1JzHuQlhrqjFwTrxMzBpsY16rBvLPxRGkc6zaPYituYItONjJIWsQIti08dHN1O8At liSKONaNmnuSmPQDhLNo6JKzeuv/SxMReIHrZsKt7jCiEQ6YP5Vby/q1m6lrBDg4LRXI iBnjpjjSCYRqtjiznsEcEOh0GjYbf3b4qph8sO/CSLP3rZhcNlK8kaVqg785fohcPpvG aZIqlOkxxsZFTykAPCbehcEyQJ2RPeeIVCNTkI+VkdicROc0PURFENefuoYUbnPYkYQI +C/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0tIyDf3E; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=XR4TPWAk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z16-20020a656650000000b00578fcbfebdasi14658638pgv.734.2023.10.11.07.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 07:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0tIyDf3E; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=XR4TPWAk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 0BA7B81D809F; Wed, 11 Oct 2023 07:04:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232383AbjJKOER (ORCPT + 99 others); Wed, 11 Oct 2023 10:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235168AbjJKOD7 (ORCPT ); Wed, 11 Oct 2023 10:03:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5FEF1AA; Wed, 11 Oct 2023 07:03:50 -0700 (PDT) Date: Wed, 11 Oct 2023 16:03:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697033028; 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=/ryEPlAkCfnJebPNGelFxUu+Exl4LiDYxPfbPUhgQHM=; b=0tIyDf3E/7ceKdkTn+Bk4QcH0B8CgZDdg2PHfOYp4XRpDjQR+fg4H8OPwFaCJUuqFeqHL2 R5F6YFLSHAU9GAE0miJbUPLFEJVs+zqPaZSzlhteq5VsQgyStsBMX3ewa5sqSpshMn8a3t LqqUTxuK3cAVtek/pLxLFUE7rkHEVDjbTHiJUomHZOEa7VTlvG2zmeIrsf8s5Gc9VG+6Sp RYdXlqFnuGOWOm8PhsK/lw/s/tFsYprecreWkJhCQVIqKv2cvLZiAU5mYTOwyn8lVEr75g dZAJEvqWwJ9Pai2IsWOkfD8ZPtf8ragn3F3CG7MPbE1GWzrUj2BgnWN9kxV4tA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697033028; 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=/ryEPlAkCfnJebPNGelFxUu+Exl4LiDYxPfbPUhgQHM=; b=XR4TPWAkuaMPAhKQWqLauiWnZWk4PYD1G+fUxdKno3O6+LMGMLmcP2sxUMJLwE8j7Ypo2p b1EmuD1WvQBNxhCQ== 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: <20231011160339.51e3ff1e@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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 07:04:24 -0700 (PDT) On Wed, 11 Oct 2023 11:17:22 +0200 Maxime Ripard wrote: Hi, > Could you test that patch? The system booted fine. Serial console is working as expected > ----8<---- > > diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c > index 8dd601bd8538..486a4d84e418 100644 > --- a/drivers/clk/socfpga/clk-gate.c > +++ b/drivers/clk/socfpga/clk-gate.c > @@ -87,10 +87,8 @@ static int socfpga_clk_set_parent(struct clk_hw *hwclk, u8 parent) > return 0; > } > > -static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, > - unsigned long parent_rate) > +static u32 socfpga_clk_get_div(struct socfpga_gate_clk *socfpgaclk) > { > - struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk); > u32 div = 1, val; > > if (socfpgaclk->fixed_div) > @@ -105,12 +103,33 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, > div = (1 << val); > } > > + return div; > +} > + > +static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, > + unsigned long parent_rate) > +{ > + struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk); > + u32 div = socfpga_clk_get_div(socfpgaclk); > + > return parent_rate / div; > } > > + > +static int socfpga_clk_determine_rate(struct clk_hw *hw, *hwclk, > + struct clk_rate_request *req) > +{ > + struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk); > + u32 div = socfpga_clk_get_div(socfpgaclk); > + > + req->rate = req->best_parent_rate / div; > + > + return 0; > +} > + > static struct clk_ops gateclk_ops = { > .recalc_rate = socfpga_clk_recalc_rate, > - .determine_rate = clk_hw_determine_rate_no_reparent, > + .determine_rate = socfpga_clk_determine_rate, > .get_parent = socfpga_clk_get_parent, > .set_parent = socfpga_clk_set_parent, > }; Regards Benedikt Spranger