From: Neha Malcom Francis <n-francis@ti.com>
To: Aniket Limaye <a-limaye@ti.com>, <u-boot@lists.denx.de>,
<trini@konsulko.com>
Cc: <u-kumar1@ti.com>, <reidt@ti.com>, <m-chawdhry@ti.com>, <nm@ti.com>
Subject: Re: [PATCH 4/6] arm: mach-k3: j721e-init.c: J7200: Add support for CONFIG_K3_OPP_LOW
Date: Thu, 17 Oct 2024 16:10:35 +0530 [thread overview]
Message-ID: <e05c19c9-47ef-4a39-896b-c8d936c6eca4@ti.com> (raw)
In-Reply-To: <20241017062911.2241167-5-a-limaye@ti.com>
Hi Aniket
On 17/10/24 11:59, Aniket Limaye wrote:
> From: Reid Tonking <reidt@ti.com>
>
> 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 <reidt@ti.com>
> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
> ---
> 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 <fdtdec.h>
> #include <mmc.h>
> #include <remoteproc.h>
> +#include <k3-avs.h>
>
> #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
next prev parent reply other threads:[~2024-10-17 10:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 6:29 [PATCH 0/6] Add OPP_LOW support for J7200 Aniket Limaye
2024-10-17 6:29 ` [PATCH 1/6] arm: dts: k3-j7200-r5-common: Add msmc clk to a72 node Aniket Limaye
2024-10-17 10:30 ` Neha Malcom Francis
2024-10-23 6:12 ` Aniket Limaye
2024-10-23 6:47 ` Neha Malcom Francis
2024-10-23 7:58 ` Aniket Limaye
2024-10-23 8:51 ` Neha Malcom Francis
2024-10-17 6:29 ` [PATCH 2/6] misc: k3_avs: Add OPP_LOW voltage and frequency to vd_data Aniket Limaye
2024-10-17 6:29 ` [PATCH 3/6] misc: k3_avs: Add k3_check_opp function Aniket Limaye
2024-10-17 10:36 ` Neha Malcom Francis
2024-10-22 12:55 ` Limaye, Aniket
2024-10-17 6:29 ` [PATCH 4/6] arm: mach-k3: j721e-init.c: J7200: Add support for CONFIG_K3_OPP_LOW Aniket Limaye
2024-10-17 10:40 ` Neha Malcom Francis [this message]
2024-10-22 12:57 ` Limaye, Aniket
2024-10-17 6:29 ` [PATCH 5/6] configs: j7200_evm_r5_defconfig: Define K3_OPP_LOW Aniket Limaye
2024-10-17 6:29 ` [PATCH 6/6] DONOTMERGE: For testing only Aniket Limaye
2024-10-17 7:22 ` Lothar Waßmann
2024-10-17 17:54 ` Tom Rini
2024-10-18 4:51 ` Aniket Limaye
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e05c19c9-47ef-4a39-896b-c8d936c6eca4@ti.com \
--to=n-francis@ti.com \
--cc=a-limaye@ti.com \
--cc=m-chawdhry@ti.com \
--cc=nm@ti.com \
--cc=reidt@ti.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=u-kumar1@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox