Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1633465rda; Mon, 23 Oct 2023 20:39:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9ifOynNZ5dAAnDYxxPmgRqvSZSbraRjKilDeISjHeWe/US9ZYq0QbCVzIs6w+i6hgkkKA X-Received: by 2002:a05:6359:d12:b0:168:e777:adf9 with SMTP id gp18-20020a0563590d1200b00168e777adf9mr2612399rwb.18.1698118748153; Mon, 23 Oct 2023 20:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698118748; cv=none; d=google.com; s=arc-20160816; b=H/v1+fWIYdK3OlWhunTT3CxOKd27+Ni1aV7TQmG67bB93C1jwgRv6JmMjHXhnyc+Ud pmoGAr40oEhVzGg4QzxtAtjhGPJoo3vziEAQlGOEFU3ovBOhuj08LAYiN+oHV00sQUYk DTL9zUp/i9f9UMzJ/cqp+TxC6rR+sBVweSQbV9u1/dsdJ5Jjc5c6UwCQu4UaBStIwuVE M2eZYDPDTkxx7O+Yz/iDIniSdeqZ+MoVqMdewWBw/DX37mV2U4wMXdexJ91b5ZX4bn15 hQJ99wcJoFvb9DWWLFq2RoMsq3R+REIVcpcp4VYXoeRf6kQ2xdQnymfKZwdZVnqjUlKO Q0Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=hPhPjzpp8rTCY2CHECWJrbe49kGeIWx2tOqu+P92RsA=; fh=/LH0r9S4eyEDe58t2VyaLGAKKqu/xpfWA+AmyqQGeUQ=; b=a6J2JU5GgcueENGvrRV/E33Wve+38KytH7DzyeDzcOKQdXo68NTF9G+M46HPdiVqIa 7hFjkSKPFkTa7g+KBAO1S0vsFSkHosCK6LcmWKDo9CZOQ/7YsPgHtqD4I/1r22jLxKqL 4kBgfmhS7KuD6rnKpTTYG/fM43gxdbGggzEQfg05pJUUM1eSs4yKcz7hZPpbmUaSLX7v G9HN+P+hF2QCt2ZFlz1JtJx8gNGWd96vyFvSOVfSDRFlLJi9x5Y54qeYrXt4d6VRpDt8 P4dl0+L5+DF7Subtew7a9tUHh5rnTvWIZgnmDYzgazmZzBinESQSdIHe0G42uaW6j9q7 s4Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a7ImS2zH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id fd35-20020a056a002ea300b00690f191430csi7879632pfb.56.2023.10.23.20.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 20:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a7ImS2zH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2DA3E80505E6; Mon, 23 Oct 2023 20:39:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbjJXDiw (ORCPT + 99 others); Mon, 23 Oct 2023 23:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbjJXDiv (ORCPT ); Mon, 23 Oct 2023 23:38:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39180B7; Mon, 23 Oct 2023 20:38:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8FE1C433C8; Tue, 24 Oct 2023 03:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698118728; bh=xinKZF7gQ6fnFF1wJ3HeENUjv5ikkykRN2jQu+EuQJY=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=a7ImS2zH1XdVnvPAra1OedejZt+kVx5c/flpRjIPJPuFSiFPFK7G+NepTZD2KtYjY pynIiAmYjBfyPCXFH0j9+m7tGW16kJBvyL0vLRLkTYO60uZFqDzB5I530YSz/NgXnx QdNu7iSSPGRbjpn7yiFZ8ko3XIEXaA9v+nwKyrfN13A7lEgUa9BvedYgNahAcFiRqC TW1hBalKv6fPFok36TPHuCdArmspBf4+59hqkEp1ZXg+Y+AsNoD7O2Np/qR3L1/fDH yPbNkrFxxc6rY1A5PDEFXDKgIQhL+3s2/mU9jFKBDnlsziZa/dXcPv9NZfyYJ1Rdod mOzIbWViQo8MA== Message-ID: <47616bcf9f17a2d8665767d9ada49f25.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20231016113002.15929-2-jay.buddhabhatti@amd.com> References: <20231016113002.15929-1-jay.buddhabhatti@amd.com> <20231016113002.15929-2-jay.buddhabhatti@amd.com> Subject: Re: [PATCH RESEND 1/2] drivers: clk: zynqmp: calculate closest mux rate From: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jay Buddhabhatti To: Jay Buddhabhatti , michal.simek@amd.com, mturquette@baylibre.com Date: Mon, 23 Oct 2023 20:38:46 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 20:39:05 -0700 (PDT) Quoting Jay Buddhabhatti (2023-10-16 04:30:01) > Currently zynqmp clock driver is not calculating closest mux rate and > because of that Linux is not setting proper frequency for CPU and > not able to set given frequency for dynamic frequency scaling. >=20 > E.g., In current logic initial acpu clock parent and frequency as below > apll1 0 0 0 2199999978 0 0 50000 Y > acpu0_mux 0 0 0 2199999978 0 0 50000 Y > acpu0_idiv1 0 0 0 2199999978 0 0 50000 Y > acpu0 0 0 0 2199999978 0 0 50000 Y >=20 > After changing acpu frequency to 549999994 Hz using CPU freq scaling its > selecting incorrect parent which is not closest frequency. > rpll_to_xpd 0 0 0 1599999984 0 0 50000 Y > acpu0_mux 0 0 0 1599999984 0 0 50000 Y > acpu0_div1 0 0 0 533333328 0 0 50000 Y > acpu0 0 0 0 533333328 0 0 50000 Y >=20 > Parent should remain same since 549999994 =3D 2199999978 / 4. >=20 > So use __clk_mux_determine_rate_closest() generic function to calculate > closest rate for mux clock. After this change its selecting correct > parent and correct clock rate. > apll1 0 0 0 2199999978 0 0 50000 Y > acpu0_mux 0 0 0 2199999978 0 0 50000 Y > acpu0_div1 0 0 0 549999995 0 0 50000 Y > acpu0 0 0 0 549999995 0 0 50000 Y >=20 > Signed-off-by: Jay Buddhabhatti > --- Any Fixes tag here?