From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 574B819ADA4 for ; Thu, 31 Oct 2024 12:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730377152; cv=none; b=ieDGuRo66i5weuCpf4DdnyhmVvroGk5uNlE19AhzlrjkyAHlzx1wgt1Wh7w3mjGTu8ETCZuex0vP8LzwNLf0tTGmInWSktGaU5T1OQVBDiTRZmWEsKqOw+Zz7n0mG3txdwPfOxjhWE5J5isqZ3m10lUtmVJql+YXyo7Ipw+nmlI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730377152; c=relaxed/simple; bh=HrQ03QoMggzR6XFbL9inUYz7m7h6EhF8j5YRIsrO/ss=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YxOsjliGobt0D6XQbGWxB7hsVYqySobp8XfkE6uydAsrIUsAlbkvKPIoBcOBG263QtsSjpHBn9rBkv+9WkctyTcVEb9YXQAfWSUr2LOleF6kH+n820cLdH8/u4MRlYMgn/+/1i4+Uh+61iutnnQhXEHEfj4mv9KCkCHnkOXNyHs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 865261063; Thu, 31 Oct 2024 05:19:38 -0700 (PDT) Received: from donnerap.manchester.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 70F783F66E; Thu, 31 Oct 2024 05:19:05 -0700 (PDT) Date: Thu, 31 Oct 2024 12:18:55 +0000 From: Andre Przywara To: Cody Eksal Cc: "Rafael J. Wysocki" , Viresh Kumar , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , Greg Kroah-Hartman , Kishon Vijay Abraham I , Krzysztof Kozlowski , Maxime Ripard , Michael Turquette , Nishanth Menon , Rob Herring , Stephen Boyd , Vinod Koul , Viresh Kumar , Parthiban , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v2 12/13] cpufreq: sun50i: add a100 cpufreq support Message-ID: <20241031121855.179b44a0@donnerap.manchester.arm.com> In-Reply-To: <20241031070232.1793078-13-masterr3c0rd@epochal.quest> References: <20241031070232.1793078-1-masterr3c0rd@epochal.quest> <20241031070232.1793078-13-masterr3c0rd@epochal.quest> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 31 Oct 2024 04:02:25 -0300 Cody Eksal wrote: > From: Shuosheng Huang > > Let's add cpufreq nvmem based for allwinner a100 soc. It's similar to h6, > let us use efuse_xlate to extract the differentiated part. > > Signed-off-by: Shuosheng Huang > [masterr3c0rd@epochal.quest: add A100 to opp_match_list] > Signed-off-by: Cody Eksal Looks good to me, and seems to work on my Teclast P80 tablet, so: Reviewed-by: Andre Przywara Tested-by: Andre Przywara Thanks, Andre > --- > Changes in V2: > - Add the A100 to the cpufreq-dt-platdev blacklist. > > drivers/cpufreq/cpufreq-dt-platdev.c | 1 + > drivers/cpufreq/sun50i-cpufreq-nvmem.c | 28 ++++++++++++++++++++++++++ > 2 files changed, 29 insertions(+) > > diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c > index 18942bfe9c95..2a3e8bd317c9 100644 > --- a/drivers/cpufreq/cpufreq-dt-platdev.c > +++ b/drivers/cpufreq/cpufreq-dt-platdev.c > @@ -103,6 +103,7 @@ static const struct of_device_id allowlist[] __initconst = { > * platforms using "operating-points-v2" property. > */ > static const struct of_device_id blocklist[] __initconst = { > + { .compatible = "allwinner,sun50i-a100" }, > { .compatible = "allwinner,sun50i-h6", }, > { .compatible = "allwinner,sun50i-h616", }, > { .compatible = "allwinner,sun50i-h618", }, > diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c > index 293921acec93..3a29c026d364 100644 > --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c > +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c > @@ -22,6 +22,9 @@ > #define NVMEM_MASK 0x7 > #define NVMEM_SHIFT 5 > > +#define SUN50I_A100_NVMEM_MASK 0xf > +#define SUN50I_A100_NVMEM_SHIFT 12 > + > static struct platform_device *cpufreq_dt_pdev, *sun50i_cpufreq_pdev; > > struct sunxi_cpufreq_data { > @@ -45,6 +48,23 @@ static u32 sun50i_h6_efuse_xlate(u32 speedbin) > return 0; > } > > +static u32 sun50i_a100_efuse_xlate(u32 speedbin) > +{ > + u32 efuse_value; > + > + efuse_value = (speedbin >> SUN50I_A100_NVMEM_SHIFT) & > + SUN50I_A100_NVMEM_MASK; > + > + switch (efuse_value) { > + case 0b100: > + return 2; > + case 0b010: > + return 1; > + default: > + return 0; > + } > +} > + > static int get_soc_id_revision(void) > { > #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY > @@ -108,6 +128,10 @@ static struct sunxi_cpufreq_data sun50i_h6_cpufreq_data = { > .efuse_xlate = sun50i_h6_efuse_xlate, > }; > > +static struct sunxi_cpufreq_data sun50i_a100_cpufreq_data = { > + .efuse_xlate = sun50i_a100_efuse_xlate, > +}; > + > static struct sunxi_cpufreq_data sun50i_h616_cpufreq_data = { > .efuse_xlate = sun50i_h616_efuse_xlate, > }; > @@ -116,6 +140,9 @@ static const struct of_device_id cpu_opp_match_list[] = { > { .compatible = "allwinner,sun50i-h6-operating-points", > .data = &sun50i_h6_cpufreq_data, > }, > + { .compatible = "allwinner,sun50i-a100-operating-points", > + .data = &sun50i_a100_cpufreq_data, > + }, > { .compatible = "allwinner,sun50i-h616-operating-points", > .data = &sun50i_h616_cpufreq_data, > }, > @@ -291,6 +318,7 @@ static struct platform_driver sun50i_cpufreq_driver = { > > static const struct of_device_id sun50i_cpufreq_match_list[] = { > { .compatible = "allwinner,sun50i-h6" }, > + { .compatible = "allwinner,sun50i-a100" }, > { .compatible = "allwinner,sun50i-h616" }, > { .compatible = "allwinner,sun50i-h618" }, > { .compatible = "allwinner,sun50i-h700" },