From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1777ED21275 for ; Thu, 17 Oct 2024 10:40:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50B4E88D1B; Thu, 17 Oct 2024 12:40:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="NZ9zWShc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51B3C88EEB; Thu, 17 Oct 2024 12:40:44 +0200 (CEST) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6430C88C60 for ; Thu, 17 Oct 2024 12:40:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=n-francis@ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 49HAecab029723; Thu, 17 Oct 2024 05:40:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1729161638; bh=eY2sbaHX1qhXculEmXbn/2/bPHA7Fk57rznfWk/aG5Q=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=NZ9zWShck8I1mMJCN2rnIVjVIDsXuuKbn16zN3bti0QTt/MGha5iEWW5q4K9qz9pS uFioDC64akL+ETRy076WeD1Odp7jRNL+zO2aaedbguUz/cbfsE/wG6j/dfLG8kqliX dcRZAc7R9Fuac66m2OOWJTmZ7iYwBzVPsEnLvvN4= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 49HAecCX027920 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 17 Oct 2024 05:40:38 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 17 Oct 2024 05:40:38 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 17 Oct 2024 05:40:38 -0500 Received: from [172.24.227.36] (a0497641-hp-z2-tower-g9-workstation-desktop-pc.dhcp.ti.com [172.24.227.36] (may be forged)) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 49HAeZGZ024351; Thu, 17 Oct 2024 05:40:36 -0500 Message-ID: Date: Thu, 17 Oct 2024 16:10:35 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/6] arm: mach-k3: j721e-init.c: J7200: Add support for CONFIG_K3_OPP_LOW To: Aniket Limaye , , CC: , , , References: <20241017062911.2241167-1-a-limaye@ti.com> <20241017062911.2241167-5-a-limaye@ti.com> Content-Language: en-US From: Neha Malcom Francis In-Reply-To: <20241017062911.2241167-5-a-limaye@ti.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi Aniket On 17/10/24 11:59, Aniket Limaye wrote: > From: Reid Tonking > > The default j7200 devicetree and k3_avs driver set 2GHz/1GHz frequency > for A72/MSMC clks and the OPP_NOM voltage. > > J7200 SOCs may support OPP_LOW Operating Performance Point: > 1GHz/500MHz clks for A72/MSMC and OPP_LOW AVS voltage read from efuse. > > Hence, add a config check to select OPP_LOW specs: > - Check if OPP_LOW AVS voltage read from efuse is valid. > - Update the clock frequencies in devicetree. > - Program the OPP_LOW AVS voltage for VDD_CPU. > > Signed-off-by: Reid Tonking > Signed-off-by: Aniket Limaye > --- > arch/arm/mach-k3/j721e/j721e_init.c | 45 ++++++++++++++++++++++++++++- > drivers/misc/k3_avs.c | 5 ++++ > 2 files changed, 49 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-k3/j721e/j721e_init.c b/arch/arm/mach-k3/j721e/j721e_init.c > index e9ed8cb267c..0620759c36c 100644 > --- a/arch/arm/mach-k3/j721e/j721e_init.c > +++ b/arch/arm/mach-k3/j721e/j721e_init.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > > #include "../sysfw-loader.h" > #include "../common.h" > @@ -147,6 +148,32 @@ static void setup_navss_nb(void) > writel(NB_THREADMAP_BIT1, (uintptr_t)NAVSS0_NBSS_NB1_CFG_NB_THREADMAP); > } > > +int fix_freq(const void *fdt) > +{ > + int node, ret; > + u32 opp_low_freq[3]; > + > + node = fdt_node_offset_by_compatible(fdt, -1, "ti,am654-rproc"); > + if (node < 0) { > + printf("%s: A72 not found\n", __func__); > + return node; > + } Indentation seems to be off. > + > + /* j7200 opp low values according to data sheet */ > + opp_low_freq[0] = cpu_to_fdt32(1000000000); /* 202-2 -> A72SS0_CORE0_0_ARM_CLK */ > + opp_low_freq[1] = cpu_to_fdt32(200000000); /* 61-1 -> GTC0_GTC_CLK */ > + opp_low_freq[2] = cpu_to_fdt32(500000000); /* 4-1 -> A72SS0_CORE0_MSMC_CLK */ > + > + ret = fdt_setprop((void *)fdt, node, "assigned-clock-rates", > + opp_low_freq, sizeof(opp_low_freq)); > + if (ret) { > + printf("%s: Can not set value\n", __func__); > + return ret; > + } > + > + return 0; > +} > + > /* > * This uninitialized global variable would normal end up in the .bss section, > * but the .bss is cleared between writing and reading this variable, so move > @@ -301,8 +328,24 @@ void board_init_f(ulong dummy) > #if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0) > ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_avs), > &dev); > - if (ret) > + if (!ret) { > + if (IS_ENABLED(CONFIG_K3_OPP_LOW)) { > + ret = k3_check_opp(dev, J721E_VDD_MPU, AM6_OPP_LOW); > + if (!ret) { > + ret = fix_freq(gd->fdt_blob); > + if (ret) > + printf("Failed to set OPP_LOW frequency\n"); > + > + ret = k3_avs_set_opp(dev, J721E_VDD_MPU, AM6_OPP_LOW); > + if (ret) > + printf("Failed to set OPP_LOW voltage\n"); > + } else { > + printf("Failed to enable K3_OPP_LOW\n"); > + } > + } > + } else { > printf("AVS init failed: %d\n", ret); > + } > #endif > > #if defined(CONFIG_K3_J721E_DDRSS) > diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c > index 90cd9dfe7f9..932b355a5c1 100644 > --- a/drivers/misc/k3_avs.c > +++ b/drivers/misc/k3_avs.c > @@ -121,6 +121,11 @@ static int k3_avs_program_voltage(struct k3_avs_privdata *priv, > if (!vd->supply) > return -ENODEV; > > + if (!volt) { > + dev_err(priv->dev, "Fuse is not set for selected opp %d\n", opp_id); s/Fuse/Efuse > + return -EINVAL; > + } > + > vd->opp = opp_id; > vd->flags |= VD_FLAG_INIT_DONE; > -- Thanking You Neha Malcom Francis