Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3288655lqp; Tue, 26 Mar 2024 05:26:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxvgUMU8TnJH93pQXx/ENec/h5QGZNmx05jVpJw5BB2q1NOuxkrUtRhQSkA51SOzfJHedCuGV/l2kQvCOJkCF6ibaEQF5PgStIVyEWLg== X-Google-Smtp-Source: AGHT+IG1+VDPbNSDgfu7WBJ8g4mKaLBFGDLwP3CHI/Wp2KgR/sot+EKuMvc9sftkoZv98foT4sPd X-Received: by 2002:a05:620a:5201:b0:78a:3225:60c4 with SMTP id dc1-20020a05620a520100b0078a322560c4mr10435779qkb.53.1711456007855; Tue, 26 Mar 2024 05:26:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711456007; cv=pass; d=google.com; s=arc-20160816; b=DnsQ/6lywb3u7u/uhgSwaxCkCOrjM5MT56Kewx5XJ3r/2xwB6V0mTNlE/cyet3yRKB MZY+eqZwaF+SsoxiEWgRMjbQyFS3KaXxQbt3Ll6f6Whj4yAyQHgvdeVj/1lmqw4ZL+9e 0Pux2Etpj92DQTuOPn3AdrcnjBB3+0wk+5KKaoxXGBRPXjaeRIBqKgSr8qCQ0uu4VIb6 6/idLegqAzo/GOEgGTUa7EVo71DU8RB87K8wuixR5XvtbLAAcoamcVIpeC38ROEkmhQK 2skUDVecEicPQY+0RrakUte7y5+X07pjRTBWtg3ZgO2DCaR0UkGSPc3jeeAq6iu3lVzV kdOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=Y+XMJhPWRNDVQV14OGFoCFSqRpZIIrLj/0V6PQtElfQ=; fh=iMA9eRLwNisAB8AP73OUoKjm0F/CUucho9erxzVVkOc=; b=IxLO/2G8t2Gd2G+OOX8Naty1N/VniWWZogy5LIx1Tv/CdW8do/okt0XgYfOBglWR0d PXA+0/I4RfO9bEAiIWVEqU7SLW6XtfC4V9c64w8H2PnbSyO7HQ3mids9mURiPPQIBn+1 jMgS9A2CsA/7gYlHuajladnT6bXaio6D3Ed6A2QOBb1uIoCbXZybsSHcNKWliaCk9yzR Kz4GbcNsQbxferR6J4v1bTLpkctKz8/60C/Hs9spPCl0vKBqIVrD3CSqEtYhn7tur8zx l9Obtw79w3QYBZ4x3wZFny0mMfKDIBKZKQfzGjl6xU4RTimR4m5DhBuKcANrlHupxGxn xHrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ooe8ZA2N; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-118969-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118969-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ya3-20020a05620a5e4300b0078a66cf3409si670052qkn.493.2024.03.26.05.26.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 05:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118969-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ooe8ZA2N; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-118969-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118969-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 91E3D1C2BC63 for ; Tue, 26 Mar 2024 12:26:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F72270CDA; Tue, 26 Mar 2024 12:26:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ooe8ZA2N" Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1AC171B2D for ; Tue, 26 Mar 2024 12:26:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711455990; cv=none; b=QlBoZSmrKrwxCBNNVrcnCvFtua4Ro2Pen7vGI0VBDlYMdnEyMmBAAro774PWRZ5ZYJMfJQVObuuB5rzlXqozcOVLpXu22CnuIbUXMHn65OOFFXWu755jqXkv4NV3v2gCANLhP6yasXCXNT9SKxLacdYkEQe817RKsY+t6LsenrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711455990; c=relaxed/simple; bh=bZCKLk7wdK9avk6HcAwUlXaRw+BiBNiN0TjaPZ/bldM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jQnDXM5fbcpybMbXP4AietIF2QlFQ3i16wLkhdwex/FyFWju+zEZudmKOx5aSt5tpJh5BqZWBsQVi1NUzWT2HscoVn7CodqCzroRoq3NukQyemWpvu60WF3CtAAc4yOivGRADJpYhMzM0nkJ2O3bNS6k0YgYv+pR51qpzRfB8C8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Ooe8ZA2N; arc=none smtp.client-ip=209.85.219.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-dcc71031680so4811037276.2 for ; Tue, 26 Mar 2024 05:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711455988; x=1712060788; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Y+XMJhPWRNDVQV14OGFoCFSqRpZIIrLj/0V6PQtElfQ=; b=Ooe8ZA2NCOG0QUXioHhwaQNgw5Oqw5koEOopYj7dO/kr2xX3y7kt40bvoUTs+2idOB kh/bFva3To2oIsozkejHaCHfztbEFH5L88D770xVLgepE2YzXGXcq80KWdilGH2QNbke AQCMEVqZqEZIxGc2jB2AODiYC443infAqfwvg2NMiVP4t7L9zGQdPXt7OGD9M0I3D5EZ zCw6nzjEcVUm8eHxglJkaXXP9JyK7QZo4ZWS0n6dKbt9BUdbZwG+DDLUCmnWH0+tKD8b dSrpUUoF9/MOd5dRaTuv/apZxf1Nbgiwe7kbwDtI/skzFQomblqFgARvn1wscYwkBJeI VmCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711455988; x=1712060788; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y+XMJhPWRNDVQV14OGFoCFSqRpZIIrLj/0V6PQtElfQ=; b=UDept1+fp2JJeXDuzTc0aBfPf4eY6KTZXM3eQ9HjTguUSYxTN83pYMhJS/hl9KJ5Zy HMyrcdr745k4jEUf1KNyf/JOJ+r/k9iA3kEMJKLitZ3U5NA/Pf66Q7Rhk5b+0+4XLTvu rEIXy3VPTigMRpRV9VLpQp9YqqtwJ80GayOij5xKvR8NR8ikmo0NvS6k1nMnpRXYTL6Q bNJQVf7oPz/5tcaHbo+N9zXQmLSkRa0Gcl7E+PYe+uIacewIwkTNKr+NXDjJKXoNiFl5 zx3ni9mNm7eeeAm7voyctKov2AEMZNiGjDNdCiWlEuFyzwrRbsXRyNunhcoAW4ZUqweW YNZQ== X-Forwarded-Encrypted: i=1; AJvYcCWVkvp6ja+fvXhKqx13SVa/YEdnTpajqtNoNInpvCVgvGCC/bYOUWMphHZ2wwRMLbi/V9tetWDQW+uA3BCfnyTeo9WZtlDWla9HkOgH X-Gm-Message-State: AOJu0Yw/ZGMZf50ZeMy+mHCNULmNBHu1H5vuubCoJdKMa2sY2hKU0yKy 4JWu7pP0Bov+OprgKYYa4jmWqDG+eZAvQddUAA2MHN1aBAisj7PxpHe6Nu3Tm5uii1sH62ngEZU H+/gBW4lOMNmwaYEP+U+gJVkawlxCn9Rd4OUPtA== X-Received: by 2002:a25:6801:0:b0:dca:59a7:896b with SMTP id d1-20020a256801000000b00dca59a7896bmr6934322ybc.50.1711455987810; Tue, 26 Mar 2024 05:26:27 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240326-alpha-pll-fix-stromer-set-rate-v2-1-48ae83af71c8@gmail.com> In-Reply-To: <20240326-alpha-pll-fix-stromer-set-rate-v2-1-48ae83af71c8@gmail.com> From: Dmitry Baryshkov Date: Tue, 26 Mar 2024 14:26:16 +0200 Message-ID: Subject: Re: [PATCH v2] clk: qcom: clk-alpha-pll: fix rate setting for Stromer PLLs To: Gabor Juhos Cc: Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , Varadarajan Narayanan , Sricharan R , Kathiravan T , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 26 Mar 2024 at 14:16, Gabor Juhos wrote: > > The clk_alpha_pll_stromer_set_rate() function writes inproper > values into the ALPHA_VAL{,_U} registers which results in wrong > clock rates when the alpha value is used. > > The broken behaviour can be seen on IPQ5018 for example, when > dynamic scaling sets the CPU frequency to 800000 KHz. In this > case the CPU cores are running only at 792031 KHz: > > # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq > 800000 > # cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq > 792031 > > This happens because the function ignores the fact that the alpha > value calculated by the alpha_pll_round_rate() function is only > 32 bits wide which must be extended to 40 bits if it is used on > a hardware which supports 40 bits wide values. > > Extend the clk_alpha_pll_stromer_set_rate() function to convert > the alpha value to 40 bits before wrinting that into the registers > in order to ensure that the hardware really uses the requested rate. > > After the change the CPU frequency is correct: > > # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq > 800000 > # cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq > 800000 > > Cc: stable@vger.kernel.org > Fixes: e47a4f55f240 ("clk: qcom: clk-alpha-pll: Add support for Stromer PLLs") > Signed-off-by: Gabor Juhos > --- > Changes in v2: > - fix subject prefix > - rebase on v6.9-rc1 > - Link to v1: https://lore.kernel.org/r/20240324-alpha-pll-fix-stromer-set-rate-v1-1-335b0b157219@gmail.com > > Depends on the following patch: > https://lore.kernel.org/r/20240315-apss-ipq-pll-ipq5018-hang-v2-1-6fe30ada2009@gmail.com > --- > drivers/clk/qcom/clk-alpha-pll.c | 4 ++++ > 1 file changed, 4 insertions(+) Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry