From: Shuosheng Huang <huangshuosheng@allwinnertech.com>
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 <huangshuosheng@allwinnertech.com>
[masterr3c0rd@epochal.quest: add A100 to opp_match_list]
Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest>
---
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" },
--
2.47.0
On 31-10-24, 04:02, Cody Eksal wrote: > From: Shuosheng Huang <huangshuosheng@allwinnertech.com> > > 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 <huangshuosheng@allwinnertech.com> > [masterr3c0rd@epochal.quest: add A100 to opp_match_list] > Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest> > --- > Changes in V2: > - Add the A100 to the cpufreq-dt-platdev blacklist. Can this be applied to the cpufreq tree separately ? -- viresh
On Mon, Nov 11, 2024 at 12:13 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On 31-10-24, 04:02, Cody Eksal wrote: > > From: Shuosheng Huang <huangshuosheng@allwinnertech.com> > > > > 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 <huangshuosheng@allwinnertech.com> > > [masterr3c0rd@epochal.quest: add A100 to opp_match_list] > > Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest> > > --- > > Changes in V2: > > - Add the A100 to the cpufreq-dt-platdev blacklist. > > Can this be applied to the cpufreq tree separately ? Yes. Acked-by: Chen-Yu Tsai <wens@csie.org>
On 11-11-24, 13:30, Chen-Yu Tsai wrote: > On Mon, Nov 11, 2024 at 12:13 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > > > On 31-10-24, 04:02, Cody Eksal wrote: > > > From: Shuosheng Huang <huangshuosheng@allwinnertech.com> > > > > > > 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 <huangshuosheng@allwinnertech.com> > > > [masterr3c0rd@epochal.quest: add A100 to opp_match_list] > > > Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest> > > > --- > > > Changes in V2: > > > - Add the A100 to the cpufreq-dt-platdev blacklist. > > > > Can this be applied to the cpufreq tree separately ? > > Yes. > > Acked-by: Chen-Yu Tsai <wens@csie.org> Applied. Thanks. -- viresh
On Sun, Nov 10, 2024 at 11:55 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On 11-11-24, 13:30, Chen-Yu Tsai wrote: > > On Mon, Nov 11, 2024 at 12:13 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > > > > > On 31-10-24, 04:02, Cody Eksal wrote: > > > > From: Shuosheng Huang <huangshuosheng@allwinnertech.com> > > > > > > > > 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 <huangshuosheng@allwinnertech.com> > > > > [masterr3c0rd@epochal.quest: add A100 to opp_match_list] > > > > Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest> > > > > --- > > > > Changes in V2: > > > > - Add the A100 to the cpufreq-dt-platdev blacklist. > > > > > > Can this be applied to the cpufreq tree separately ? > > > > Yes. > > > > Acked-by: Chen-Yu Tsai <wens@csie.org> > > Applied. Thanks. You missed the binding patch, so "allwinner,sun50i-a100-operating-points" is undocumented. Can you pick that up please. Rob
On Mon, Nov 18, 2024 at 09:36:37AM -0600, Rob Herring wrote: > On Sun, Nov 10, 2024 at 11:55 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > > > On 11-11-24, 13:30, Chen-Yu Tsai wrote: > > > On Mon, Nov 11, 2024 at 12:13 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > > > > > > > On 31-10-24, 04:02, Cody Eksal wrote: > > > > > From: Shuosheng Huang <huangshuosheng@allwinnertech.com> > > > > > > > > > > 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 <huangshuosheng@allwinnertech.com> > > > > > [masterr3c0rd@epochal.quest: add A100 to opp_match_list] > > > > > Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest> > > > > > --- > > > > > Changes in V2: > > > > > - Add the A100 to the cpufreq-dt-platdev blacklist. > > > > > > > > Can this be applied to the cpufreq tree separately ? > > > > > > Yes. > > > > > > Acked-by: Chen-Yu Tsai <wens@csie.org> > > > > Applied. Thanks. > > You missed the binding patch, so > "allwinner,sun50i-a100-operating-points" is undocumented. Can you pick > that up please. Still not applied, so I applied it. Rob
On 09-01-25, 16:53, Rob Herring wrote: > > You missed the binding patch, so > > "allwinner,sun50i-a100-operating-points" is undocumented. Can you pick > > that up please. > > Still not applied, so I applied it. Somehow missed your previous email. Sorry about that. -- viresh
On Thu, 31 Oct 2024 04:02:25 -0300
Cody Eksal <masterr3c0rd@epochal.quest> wrote:
> From: Shuosheng Huang <huangshuosheng@allwinnertech.com>
>
> 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 <huangshuosheng@allwinnertech.com>
> [masterr3c0rd@epochal.quest: add A100 to opp_match_list]
> Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest>
Looks good to me, and seems to work on my Teclast P80 tablet, so:
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
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" },
On 10/31/24 12:32 PM, Cody Eksal wrote:
> From: Shuosheng Huang <huangshuosheng@allwinnertech.com>
>
> 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 <huangshuosheng@allwinnertech.com>
> [masterr3c0rd@epochal.quest: add A100 to opp_match_list]
> Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest>
Although I couldn't get the secondary CPU's running because of missing BL31 support,
it works fine in CPU0.
Tested-by: Parthiban Nallathambi <parthiban@linumiz.com>
Thanks,
Parthiban
> ---
> 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" },
© 2016 - 2026 Red Hat, Inc.