Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp471104rdb; Sat, 16 Dec 2023 17:21:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtn6LHX3G4SroykhLvSAZ5tlG8+HL1rMgbozJddDZaiBPVHJeU87FEoEi4T3PYksFSaVHg X-Received: by 2002:a05:6830:1544:b0:6da:608a:789d with SMTP id l4-20020a056830154400b006da608a789dmr1218893otp.37.1702776099130; Sat, 16 Dec 2023 17:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702776099; cv=none; d=google.com; s=arc-20160816; b=o4WgOZ0G+idMyV+F/3P28UE1XuoaHHnNS2FxObPSJkMbkVSpqq+Qr7vM0mRs3tKK64 co2LwgfFpaoC45B8ZkZjib9g4SjKlHeYZRkr93J0e5BbvqC+/ix6fwp/FSDPioLG68BB gKEP9OsFRNxnKUdwDFVX4EKfZIfhsbDFYAlk6+QY5TJccK2gBLYP16sD2e4BHKI9Ajao GVeMoJoiClrvZIndyrmD2WW1xZkIKLv5xXjgXlZ+rw3qXGVjjBmU+RmaN+dJRC20EgN3 66dFN3AAwcaISFIj2gR8ZwJcnMMA70lr6n2ff3qnNV2hV24r4YbALNK8csV4MZiDI1z8 4KhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=us0pRg5TXSdRio4C2+7mpbubzKa8h/NFiM7z8ASMyrs=; fh=neOYR8OUhfCrKSnCJAYhxbcPTnkncdqmZDb1PEDA5zc=; b=WUyFPTkHQwnXy9LuE2ZMHb65DsKkOvQaCXe3FSCdSbK4HJaE4ASoeNvnOLM8uFLDn2 A3GxqKTqGcMiCSAbBZ6PedQqxkyPRjCsRqW3/ahUb5ZbqdtYvV0AkmgiOZ4wyu4L+tcn fINOTxDUV60bPjMGiyxsfGzc+VrI2YTzLADJAQBX58zLi8YBgQ4NjA2+FY4PqjIsZADv ZYEnOjIufRm1uBNomtiTwJFGSS2/trxdt/ID2fNIDP9R20H16FWlgTG+V8LWsKcwp4/K w8OOjhoHsz8OmlbSyrqZ+QZWXYLnK0HkkdeVxIvcNqFQF/JCv2Z5LnraJJdw1UvGHxwr inNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AmGTOZcD; spf=pass (google.com: domain of linux-kernel+bounces-2429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fd3-20020a056a002e8300b006cdcd785487si15790502pfb.304.2023.12.16.17.21.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 17:21:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AmGTOZcD; spf=pass (google.com: domain of linux-kernel+bounces-2429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8A0DAB2336E for ; Sun, 17 Dec 2023 01:21:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE3ABA40; Sun, 17 Dec 2023 01:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AmGTOZcD" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 090A417F6; Sun, 17 Dec 2023 01:21:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB4FBC433C7; Sun, 17 Dec 2023 01:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702776081; bh=MFysK8RWl80ildkfG7SPnOou5akXq8Kqg9KXX8e5xoQ=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=AmGTOZcDg/YYsQh4ThiQ4T/2F6Ku1jmNqCXd89jbNzfDWlmteSgUVWL9uyErKakJT vh8leOa+yhYytNzLsDJXOJ0KVwJ9bMm42pKYmzPq8OSAlpap7F/+Hi+tmRxr7gzWfT YJ3Ze1kSYt/neT58GarqWJOjFxm9Eo92JT+6WSK81UbWWP4rOkqYmRccIjdxGHIMq/ vvW9rQnZzJTJxjrDMKZ6MMlAUf2ZJM2GRrrV5erw9MCZiU2iZdbqMxlj8b9/Kpf/Z+ 9eo6r3+OGcBQR6IBsq99m2KuDcP87YgD938nPOOg3FsicfwnU5dq+gYAq0DPnW72DD JWSvS4D4O62vw== Message-ID: <3ddba76f5f44a7b32c5852094667d189.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20231129112916.23125-2-jay.buddhabhatti@amd.com> References: <20231129112916.23125-1-jay.buddhabhatti@amd.com> <20231129112916.23125-2-jay.buddhabhatti@amd.com> Subject: Re: [PATCH RESEND v2 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, shubhrajyoti.datta@xilinx.com Date: Sat, 16 Dec 2023 17:21:19 -0800 User-Agent: alot/0.10 Quoting Jay Buddhabhatti (2023-11-29 03:29:15) > 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 > Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver") > Signed-off-by: Jay Buddhabhatti > --- Applied to clk-next