Re: [PATCH v2 4/5] arm: mach-k3: j721e-init.c: J7200: Add support for CONFIG_K3_OPP_LOW

2024-10-30 Thread Manorit Chawdhry
Hi Neha, Aniket,

On 13:31-20241030, Manorit Chawdhry wrote:
> Hi Aniket,
> 
> On 15:40-20241029, Manorit Chawdhry wrote:
> > Hi Aniket,
> > 
> > On 18:27-20241023, 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 
> > > 
> > > ---
[...]
> > >  
> > > +int fix_freq(const void *fdt)
> 
> I think this can be static as well btw, maybe rename it to something
> more descriptive as well. fdt_fixup_a72_clock_frequency?

Do you think ft_system_setup is a good place for doing this fixup btw?
Was wondering that it would be good to know what all DT fixups are being
done at some common place instead of multiple scattered places but not
sure when does ft_system_setup kick in, would it be before we startup
a72?

Regards,
Manorit


Re: [PATCH v2 4/5] arm: mach-k3: j721e-init.c: J7200: Add support for CONFIG_K3_OPP_LOW

2024-10-30 Thread Manorit Chawdhry
Hi Aniket,

On 15:40-20241029, Manorit Chawdhry wrote:
> Hi Aniket,
> 
> On 18:27-20241023, 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 
> > 
> > ---
> > v2:
> > - Fix indentation in fix_freq()
> > - Remove the efuse data check addition from this commit, as it's not
> >   related to adding support for CONFIG_K3_OPP_LOW. The same addition
> >   was moved to the previous patch in this series.
> > - Link to v1: 
> > https://lore.kernel.org/u-boot/20241017062911.2241167-5-a-lim...@ti.com/
> > ---
> >  arch/arm/mach-k3/j721e/j721e_init.c | 45 -
> >  1 file changed, 44 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..de10517bb27 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)

I think this can be static as well btw, maybe rename it to something
more descriptive as well. fdt_fixup_a72_clock_frequency?

> > +{
> > +   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;
> > +   }
> > +
> > +   /* j7200 opp low values according to data sheet */
> > +   opp_low_freq[0] = cpu_to_fdt32(10); /* 202-2 -> 
> > A72SS0_CORE0_0_ARM_CLK */
> > +   opp_low_freq[1] = cpu_to_fdt32(2); /* 61-1 -> GTC0_GTC_CLK */
> > +   opp_low_freq[2] = cpu_to_fdt32(5); /* 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)) {
> 
> These ifs can be combined into one ig. 
> 
> > +   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);
> 
> Even if fix_freq fails, do we want to cascade and still run
> k3_avs_set_opp? Not sure what the best way to handle this is but seeing
> a lot of nesting so wondering if there is any better way to handle this
> control flow..

For this I think it might be a good idea to take this chunk out into
another function like setup_opp_low as well and keep it there, might be
more readable that way IMHO.

Regards,
Manorit

> 
> Also, better to print ret as well in these cases btw.
> 
> Regards,
> Manorit
> 
> > +   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)
> > -- 
> > 2.34.1
> > 


Re: [PATCH v2 4/5] arm: mach-k3: j721e-init.c: J7200: Add support for CONFIG_K3_OPP_LOW

2024-10-29 Thread Manorit Chawdhry
Hi Aniket,

On 18:27-20241023, 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 
> 
> ---
> v2:
> - Fix indentation in fix_freq()
> - Remove the efuse data check addition from this commit, as it's not
>   related to adding support for CONFIG_K3_OPP_LOW. The same addition
>   was moved to the previous patch in this series.
> - Link to v1: 
> https://lore.kernel.org/u-boot/20241017062911.2241167-5-a-lim...@ti.com/
> ---
>  arch/arm/mach-k3/j721e/j721e_init.c | 45 -
>  1 file changed, 44 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..de10517bb27 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;
> + }
> +
> + /* j7200 opp low values according to data sheet */
> + opp_low_freq[0] = cpu_to_fdt32(10); /* 202-2 -> 
> A72SS0_CORE0_0_ARM_CLK */
> + opp_low_freq[1] = cpu_to_fdt32(2); /* 61-1 -> GTC0_GTC_CLK */
> + opp_low_freq[2] = cpu_to_fdt32(5); /* 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)) {

These ifs can be combined into one ig. 

> + 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);

Even if fix_freq fails, do we want to cascade and still run
k3_avs_set_opp? Not sure what the best way to handle this is but seeing
a lot of nesting so wondering if there is any better way to handle this
control flow..

Also, better to print ret as well in these cases btw.

Regards,
Manorit

> + 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)
> -- 
> 2.34.1
> 


[PATCH] arch: arm: dts: k3-j784s4-r5: Introduce k3-j784s4-r5.dtsi

2024-10-24 Thread Manorit Chawdhry
Create an SoC R5 dtsi file that could be used at board level R5 files. This
would help in keeping the SoC level changes in sync across board files.

Signed-off-by: Manorit Chawdhry 
---
Test logs: https://gist.github.com/manorit2001/108a42ab67e936707f47f71e1d18e90a
---
 arch/arm/dts/k3-am69-r5-sk.dts | 125 ++---
 arch/arm/dts/k3-j784s4-r5-evm.dts  | 125 ++---
 .../{k3-j784s4-r5-evm.dts => k3-j784s4-r5.dtsi}|   9 +-
 board/ti/j784s4/MAINTAINERS|   1 +
 4 files changed, 26 insertions(+), 234 deletions(-)

diff --git a/arch/arm/dts/k3-am69-r5-sk.dts b/arch/arm/dts/k3-am69-r5-sk.dts
dissimilarity index 87%
index 
13809f82d99a6fc7da1fc2401b33bf0d0bb75548..9c6e324ba299c72f87f5f792fbfe98ef62ebde3d
 100644
--- a/arch/arm/dts/k3-am69-r5-sk.dts
+++ b/arch/arm/dts/k3-am69-r5-sk.dts
@@ -1,113 +1,12 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
- */
-
-/dts-v1/;
-
-#include "k3-am69-sk.dts"
-#include "k3-j784s4-ddr-evm-lp4-4266.dtsi"
-#include "k3-j784s4-ddr.dtsi"
-#include "k3-am69-sk-u-boot.dtsi"
-
-/ {
-   chosen {
-   tick-timer = &mcu_timer0;
-   };
-
-   aliases {
-   remoteproc0 = &sysctrler;
-   remoteproc1 = &a72_0;
-   };
-
-   a72_0: a72@0 {
-   compatible = "ti,am654-rproc";
-   reg = <0x0 0x00a9 0x0 0x10>;
-   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
-   resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
-   clock-names = "gtc", "core";
-   assigned-clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
-   assigned-clock-parents = <&k3_clks 61 2>;
-   assigned-clock-rates = <2>, <20>;
-   ti,sci = <&sms>;
-   ti,sci-proc-id = <32>;
-   ti,sci-host-id = <10>;
-   bootph-pre-ram;
-   };
-
-   dm_tifs: dm-tifs {
-   compatible = "ti,j721e-dm-sci";
-   ti,host-id = <3>;
-   ti,secure-host;
-   mbox-names = "rx", "tx";
-   mboxes= <&secure_proxy_mcu 21>, <&secure_proxy_mcu 23>;
-   bootph-pre-ram;
-   };
-};
-
-&mcu_timer0 {
-   status = "okay";
-   clock-frequency = <25000>;
-   bootph-pre-ram;
-};
-
-&secure_proxy_sa3 {
-   status = "okay";
-   bootph-pre-ram;
-};
-
-&secure_proxy_mcu {
-   status = "okay";
-   bootph-pre-ram;
-};
-
-&cbass_mcu_wakeup {
-   sysctrler: sysctrler {
-   compatible = "ti,am654-system-controller";
-   mboxes= <&secure_proxy_mcu 4>,
-   <&secure_proxy_mcu 5>,
-   <&secure_proxy_sa3 5>;
-   mbox-names = "tx", "rx", "boot_notify";
-   bootph-pre-ram;
-   };
-};
-
-&sms {
-   mboxes= <&secure_proxy_mcu 8>, <&secure_proxy_mcu 6>, 
<&secure_proxy_mcu 5>;
-   mbox-names = "tx", "rx", "notify";
-   ti,host-id = <4>;
-   ti,secure-host;
-   bootph-pre-ram;
-};
-
-/* WKUP UART0 is used for DM firmware logs */
-&wkup_uart0 {
-   bootph-pre-ram;
-   status = "okay";
-};
-
-&ospi0 {
-   reg = <0x0 0x4704 0x0 0x100>,
- <0x0 0x5000 0x0 0x800>;
-};
-
-&ospi1 {
-   reg = <0x0 0x4705 0x0 0x100>,
- <0x0 0x5800 0x0 0x800>;
-};
-
-&fss {
-   /* enable ranges missing from the FSS node */
-   ranges = <0x0 0x4700 0x0 0x4700 0x0 0x00068400>,
-<0x0 0x5000 0x0 0x5000 0x0 0x0800>;
-};
-
-&mcu_ringacc {
-   ti,sci = <&dm_tifs>;
-};
-
-&mcu_udmap {
-   ti,sci = <&dm_tifs>;
-};
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/dts-v1/;
+
+#include "k3-am69-sk.dts"
+#include "k3-j784s4-ddr-evm-lp4-4266.dtsi"
+#include "k3-j784s4-ddr.dtsi"
+#include "k3-am69-sk-u-boot.dtsi"
+#include "k3-j784s4-r5.dtsi"
diff --git a/arch/arm/dts/k3-j784s4-r5-evm.dts 
b/arch/arm/dts/k3-j784s4-r5-evm.dts
dissimilarity index 87%
index 
8b8b0e70047e6c7538eee6e39f4fca182796f751..0eeffa7874035697d28f37507b3c3feb03a10acd
 100644
-

Re: [PATCH v4 2/8] ram: k3-ddrss: Add k3_ddrss_ddr_bank_base_size_calc() to solve 'calculations restricted to 32 bits' issue

2024-10-22 Thread Manorit Chawdhry
Hi Santhosh,

On 10:10-20241021, Santhosh Kumar K wrote:
> As R5 is a 32 bit processor, the RAM banks' base and size calculation
> is restricted to 32 bits, which results in wrong values if bank's base
> is greater than 32 bits or bank's size is greater than or equal to 4GB.
> 
> So, add k3_ddrss_ddr_bank_base_size_calc() to get the base address and
> size of RAM's banks from the device tree memory node, and store in a
> 64 bit device private data which can be used for ECC reserved memory
> calculation, Setting ECC range and Fixing up bank size in device tree
> when ECC is enabled.
> 
> Signed-off-by: Santhosh Kumar K 
> ---
>  drivers/ram/k3-ddrss/k3-ddrss.c | 72 ++---
>  1 file changed, 57 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/ram/k3-ddrss/k3-ddrss.c b/drivers/ram/k3-ddrss/k3-ddrss.c
> index f2ab8cf2b49b..bd6783ebc2cd 100644
> --- a/drivers/ram/k3-ddrss/k3-ddrss.c
> +++ b/drivers/ram/k3-ddrss/k3-ddrss.c
> @@ -147,6 +147,9 @@ struct k3_ddrss_desc {
>   struct k3_ddrss_ecc_region ecc_regions[K3_DDRSS_MAX_ECC_REGIONS];
>   u64 ecc_reserved_space;
>   bool ti_ecc_enabled;
> + unsigned long long ddr_bank_base[CONFIG_NR_DRAM_BANKS];
> + unsigned long long ddr_bank_size[CONFIG_NR_DRAM_BANKS];
> + unsigned long long ddr_ram_size;

Would suggest using u64 ig if you are sending another revision, would be
a bit more readable IMHO.

Regards,
Manorit

>  };
>  
>  struct reginitdata {
> @@ -668,11 +671,54 @@ static void k3_ddrss_lpddr4_preload_full_mem(struct 
> k3_ddrss_desc *ddrss,
>   printf("ECC: priming DDR completed in %lu msec\n", get_timer(done));
>  }
>  
> +static void k3_ddrss_ddr_bank_base_size_calc(struct k3_ddrss_desc *ddrss)
> +{
> + int bank, na, ns, len, parent;
> + const fdt32_t *ptr, *end;
> +
> + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
> + ddrss->ddr_bank_base[bank] = 0;
> + ddrss->ddr_bank_size[bank] = 0;
> + }
> +
> + ofnode mem = ofnode_null();
> +
> + do {
> + mem = ofnode_by_prop_value(mem, "device_type", "memory", 7);
> + } while (!ofnode_is_enabled(mem));
> +
> + const void *fdt = ofnode_to_fdt(mem);
> + int node = ofnode_to_offset(mem);
> + const char *property = "reg";
> +
> + parent = fdt_parent_offset(fdt, node);
> + na = fdt_address_cells(fdt, parent);
> + ns = fdt_size_cells(fdt, parent);
> + ptr = fdt_getprop(fdt, node, property, &len);
> + end = ptr + len / sizeof(*ptr);
> +
> + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
> + if (ptr + na + ns <= end) {
> + if (CONFIG_IS_ENABLED(OF_TRANSLATE))
> + ddrss->ddr_bank_base[bank] = 
> fdt_translate_address(fdt, node, ptr);
> + else
> + ddrss->ddr_bank_base[bank] = 
> fdtdec_get_number(ptr, na);
> +
> + ddrss->ddr_bank_size[bank] = 
> fdtdec_get_number(&ptr[na], ns);
> + }
> +
> + ptr += na + ns;
> + }
> +
> + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++)
> + ddrss->ddr_ram_size += ddrss->ddr_bank_size[bank];
> +}
> +
>  static void k3_ddrss_lpddr4_ecc_calc_reserved_mem(struct k3_ddrss_desc 
> *ddrss)
>  {
>   fdtdec_setup_mem_size_base_lowest();
>  
> - ddrss->ecc_reserved_space = gd->ram_size;
> + ddrss->ecc_reserved_space = ddrss->ddr_ram_size;
>   do_div(ddrss->ecc_reserved_space, 9);
>  
>   /* Round to clean number */
> @@ -696,7 +742,7 @@ static void k3_ddrss_lpddr4_ecc_init(struct k3_ddrss_desc 
> *ddrss)
>   /* Preload the full memory with 0's using the BIST engine of
>* the LPDDR4 controller.
>*/
> - k3_ddrss_lpddr4_preload_full_mem(ddrss, gd->ram_size, 0);
> + k3_ddrss_lpddr4_preload_full_mem(ddrss, ddrss->ddr_ram_size, 0);
>  
>   /* Clear Error Count Register */
>   writel(0x1, base + DDRSS_ECC_1B_ERR_CNT_REG);
> @@ -741,6 +787,8 @@ static int k3_ddrss_probe(struct udevice *dev)
>  
>   k3_lpddr4_start(ddrss);
>  
> + k3_ddrss_ddr_bank_base_size_calc(ddrss);
> +
>   if (ddrss->ti_ecc_enabled) {
>   if (!ddrss->ddrss_ss_cfg) {
>   printf("%s: ss_cfg is required if ecc is enabled but 
> not provided.",
> @@ -761,30 +809,24 @@ static int k3_ddrss_probe(struct udevice *dev)
>  
>  int k3_ddrss_ddr_fdt_fixup(struct udevice *dev, void *blob, struct bd_info 
> *bd)
>  {
> - struct k3_ddrss_desc *ddrss = dev_get_priv(dev);
> - u64 start[CONFIG_NR_DRAM_BANKS];
> - u64 size[CONFIG_NR_DRAM_BANKS];
>   int bank;
> + struct k3_ddrss_desc *ddrss = dev_get_priv(dev);
>  
>   if (ddrss->ecc_reserved_space == 0)
>   return 0;
>  
>   for (bank = CONFIG_NR_DRAM_BANKS - 1; bank >= 0; bank--) {
> - if (ddrss->ecc_reserved_space > bd->bi_dram[bank].size) {
> - ddrss->ecc_reserved_space -= bd->bi_dram[bank].si

[PATCH v5 7/7] configs: j721s2_evm_r5_defconfig: Add AVS Configs

2024-10-15 Thread Manorit Chawdhry
Add AVS and PMIC regulator configs

Also, disable it explicitly in am68_sk_r5_defconfig as it includes
j721s2_evm_r5_defconfig for re-usability.

Signed-off-by: Manorit Chawdhry 
---
 configs/am68_sk_r5_defconfig| 4 
 configs/j721s2_evm_r5_defconfig | 6 ++
 2 files changed, 10 insertions(+)

diff --git a/configs/am68_sk_r5_defconfig b/configs/am68_sk_r5_defconfig
index e9b6882c1f68..f4800ef1b8ac 100644
--- a/configs/am68_sk_r5_defconfig
+++ b/configs/am68_sk_r5_defconfig
@@ -5,6 +5,10 @@ CONFIG_ARCH_K3=y
 CONFIG_SOC_K3_J721S2=y
 CONFIG_TARGET_J721S2_R5_EVM=y
 
+CONFIG_K3_AVS0=n
+CONFIG_DM_REGULATOR_TPS65941=n
+CONFIG_PMIC_TPS65941=n
+
 CONFIG_DEFAULT_DEVICE_TREE="k3-am68-sk-r5-base-board"
 CONFIG_SPL_OF_LIST="k3-am68-sk-r5-base-board"
 CONFIG_OF_LIST="k3-am68-sk-r5-base-board"
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index b6adb6a77d7e..ad7653c8f99b 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -112,6 +112,7 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_FS_LOADER=y
 CONFIG_SPL_FS_LOADER=y
+CONFIG_K3_AVS0=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_SPL_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
@@ -141,6 +142,11 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_POWER_DOMAIN=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_TPS65941=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_TPS65941=y
 CONFIG_K3_SYSTEM_CONTROLLER=y
 CONFIG_REMOTEPROC_TI_K3_ARM64=y
 CONFIG_RESET_TI_SCI=y

-- 
2.46.0



[PATCH v5 6/7] arm: dts: j721s2: Add VTM node in R5

2024-10-15 Thread Manorit Chawdhry
Also adds bootph-pre-ram property to VTM node and the pmic node.

vdd-supply is used to assign the buck regulator that the AVS driver can
use to program the proper voltage which it picked up from e-fuse.

Reviewed-by: Udit Kumar 
Signed-off-by: Manorit Chawdhry 
---

Notes:
Patches are posted to Linux [0]

[0]: 
https://lore.kernel.org/linux-arm-kernel/20240814-b4-upstream-bootph-all-v4-0-f2b462000...@ti.com/#

 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
index e92b1917df4e..506ad9b7910d 100644
--- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
@@ -10,3 +10,12 @@
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-j721s2-common-proc-board-u-boot.dtsi"
 #include "k3-j721s2-r5.dtsi"
+
+&tps659411 {
+   bootph-pre-ram;
+};
+
+&wkup_vtm0 {
+   bootph-pre-ram;
+   vdd-supply-2 = <&bucka1234>;
+};

-- 
2.46.0



[PATCH v5 5/7] arm: mach-k3: j721s2_init: Initialize AVS Class 0

2024-10-15 Thread Manorit Chawdhry
Adaptive Voltage Scaling (AVS) Class 0 is a procedure for lowering the
voltage on certain device power rails. Initialize AVS Class 0.

Link: https://www.ti.com/lit/pdf/spruj28 (Section 5.2.3.3.2.5 AVS-Class0)
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/mach-k3/j721s2/j721s2_init.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c 
b/arch/arm/mach-k3/j721s2/j721s2_init.c
index 05453fcad41a..5f5961a2c17a 100644
--- a/arch/arm/mach-k3/j721s2/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
@@ -315,6 +315,9 @@ void do_dt_magic(void)
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong dummy)
 {
+   struct udevice *dev;
+   int ret;
+
k3_spl_init();
 #if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
do_dt_magic();
@@ -325,6 +328,13 @@ void board_init_f(ulong dummy)
setup_navss_nb();
 
setup_qos();
+
+   if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) {
+   ret = uclass_get_device_by_driver(UCLASS_MISC, 
DM_DRIVER_GET(k3_avs),
+ &dev);
+   if (ret)
+   printf("AVS init failed: %d\n", ret);
+   }
 }
 #endif
 

-- 
2.46.0



[PATCH v5 4/7] drivers: misc: k3_avs: Extract MPU clk and dev ID from DT

2024-10-15 Thread Manorit Chawdhry
Different devices have different MPU clk and dev ID. Currently it had
been hardcoded. Move it to DT based extraction.

Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 66ad747f2dd8..99a18a109b7c 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -352,6 +352,9 @@ static int k3_avs_probe(struct udevice *dev)
struct k3_avs_privdata *priv;
struct vd_data *vd;
int ret;
+   ofnode node;
+   struct ofnode_phandle_args phandle_args;
+   int i = 0;
 
priv = dev_get_priv(dev);
priv->dev = dev;
@@ -367,6 +370,32 @@ static int k3_avs_probe(struct udevice *dev)
return -ENODEV;
 
for (vd = priv->vd_config->vds; vd->id >= 0; vd++) {
+   /* Get the clock and dev id for Jacinto platforms */
+   if (vd->id == J721E_VDD_MPU) {
+   node = ofnode_by_compatible(ofnode_null(), 
"ti,am654-rproc");
+   if (!ofnode_valid(node))
+   return -ENODEV;
+
+   i = ofnode_stringlist_search(node, "clock-names", 
"core");
+   if (i < 0)
+   return -ENODEV;
+
+   ret = ofnode_parse_phandle_with_args(node, "clocks",
+"#clock-cells",
+0, i,
+&phandle_args);
+   if (ret) {
+   printf("Couldn't get the clock node, ret = 
%d\n", ret);
+   return ret;
+   }
+
+   vd->dev_id = phandle_args.args[0];
+   vd->clk_id = phandle_args.args[1];
+
+   debug("%s: MPU dev_id: %d, clk_id: %d", __func__,
+ vd->dev_id, vd->clk_id);
+   }
+
if (!(readl(AM6_VTM_DEVINFO(vd->id)) &
  AM6_VTM_AVS0_SUPPORTED)) {
dev_warn(dev, "AVS-class 0 not supported for VD%d\n",
@@ -463,6 +492,12 @@ static struct vd_data j721e_vd_data[] = {
{
.id = J721E_VDD_MPU,
.opp = AM6_OPP_NOM,
+   /*
+* XXX: DEPRECATION WARNING: Around 2 u-boot versions
+*
+* These values will be picked up from DT, kept for backward
+* compatibility
+*/
.dev_id = 202, /* J721E_DEV_A72SS0_CORE0 */
.clk_id = 2, /* ARM clock */
.opps = {

-- 
2.46.0



[PATCH v5 3/7] arm: dts: k3-*-r5: Add MPU clock in clocks property

2024-10-15 Thread Manorit Chawdhry
MPU clock had been missing. Distinguish multiple clocks with clock-names
and add MPU clock as well.

Link: 
https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j721s2/clocks.html#clocks-for-a72ss0-core0-device
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am62-r5-lp-sk.dts  | 3 ++-
 arch/arm/dts/k3-am625-r5-beagleplay.dts| 3 ++-
 arch/arm/dts/k3-am625-r5-sk.dts| 3 ++-
 arch/arm/dts/k3-am62a7-r5-sk.dts   | 3 ++-
 arch/arm/dts/k3-am62p5-r5-sk.dts   | 3 ++-
 arch/arm/dts/k3-am642-r5-evm.dts   | 3 ++-
 arch/arm/dts/k3-am642-r5-sk.dts| 3 ++-
 arch/arm/dts/k3-am654-r5-base-board.dts| 3 ++-
 arch/arm/dts/k3-am69-r5-sk.dts | 3 ++-
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 3 ++-
 arch/arm/dts/k3-j721e-r5.dtsi  | 3 ++-
 arch/arm/dts/k3-j721s2-r5.dtsi | 3 ++-
 arch/arm/dts/k3-j722s-r5-evm.dts   | 3 ++-
 arch/arm/dts/k3-j784s4-r5-evm.dts  | 3 ++-
 14 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/arch/arm/dts/k3-am62-r5-lp-sk.dts 
b/arch/arm/dts/k3-am62-r5-lp-sk.dts
index ec5d3f4ba2cb..b8e5f49a1fc7 100644
--- a/arch/arm/dts/k3-am62-r5-lp-sk.dts
+++ b/arch/arm/dts/k3-am62-r5-lp-sk.dts
@@ -25,7 +25,8 @@
<&k3_pds 135 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 166 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 135 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <12>;
diff --git a/arch/arm/dts/k3-am625-r5-beagleplay.dts 
b/arch/arm/dts/k3-am625-r5-beagleplay.dts
index f0b66f0cb945..9e0a6ed67844 100644
--- a/arch/arm/dts/k3-am625-r5-beagleplay.dts
+++ b/arch/arm/dts/k3-am625-r5-beagleplay.dts
@@ -24,7 +24,8 @@
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 135 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 135 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <125000>;
diff --git a/arch/arm/dts/k3-am625-r5-sk.dts b/arch/arm/dts/k3-am625-r5-sk.dts
index 0912b953db07..d2dd75469c1a 100644
--- a/arch/arm/dts/k3-am625-r5-sk.dts
+++ b/arch/arm/dts/k3-am625-r5-sk.dts
@@ -25,7 +25,8 @@
<&k3_pds 135 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 166 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 135 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <12>;
diff --git a/arch/arm/dts/k3-am62a7-r5-sk.dts b/arch/arm/dts/k3-am62a7-r5-sk.dts
index bc05dcb5efbe..464227b3b25d 100644
--- a/arch/arm/dts/k3-am62a7-r5-sk.dts
+++ b/arch/arm/dts/k3-am62a7-r5-sk.dts
@@ -23,7 +23,8 @@
<&k3_pds 135 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 166 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 135 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 135 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <12>;
diff --git a/arch/arm/dts/k3-am62p5-r5-sk.dts b/arch/arm/dts/k3-am62p5-r5-sk.dts
index 658f2cf730a7..baf1a83dc124 100644
--- a/arch/arm/dts/k3-am62p5-r5-sk.dts
+++ b/arch/arm/dts/k3-am62p5-r5-sk.dts
@@ -26,7 +26,8 @@
<&k3_pds 135 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 166 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 135 0>;
-   clocks = <&k

[PATCH v5 2/7] drivers: misc: k3_avs: Check return code while programming AVS

2024-10-15 Thread Manorit Chawdhry
Check if AVS could not be programmed and print a warning.

Fixes: 9d233b4e3ed6 ("misc: k3_avs: add driver for K3 Adaptive Voltage Scaling 
Class 0")
Reviewed-by: Udit Kumar 
Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 87471cc3b16a..66ad747f2dd8 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -391,7 +391,10 @@ static int k3_avs_probe(struct udevice *dev)
if (vd->flags & VD_FLAG_INIT_DONE)
continue;
 
-   k3_avs_program_voltage(priv, vd, vd->opp);
+   ret = k3_avs_program_voltage(priv, vd, vd->opp);
+   if (ret)
+   dev_warn(dev, "Could not program AVS voltage for VD%d, 
vd->opp=%d, ret=%d\n",
+vd->id, vd->opp, ret);
}
 
if (!device_is_compatible(priv->dev, "ti,am654-avs"))

-- 
2.46.0



[PATCH v5 1/7] power: pmic: tps65941: Add DM_PMIC dependency

2024-10-15 Thread Manorit Chawdhry
This Kconfig depends on DM_PMIC but hadn't be explicitly stated which
could cause config related issues.

Adds the dependency in Kconfig for tps65941.

Fixes: 6b86dd0c1ead ("power: pmic: tps65941: Add support for tps65941 family of 
PMICs")
Reviewed-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 drivers/power/pmic/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 562c1a3b122a..bbcbcee4c355 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -394,6 +394,7 @@ config SPL_PMIC_LP87565
 
 config PMIC_TPS65941
bool "Enable driver for Texas Instruments TPS65941 PMIC"
+   depends on DM_PMIC
help
The TPS65941 is a PMIC containing a bunch of SMPS & LDOs.
This driver binds the pmic children.

-- 
2.46.0



[PATCH v5 0/7] Add AVS support for J721S2

2024-10-15 Thread Manorit Chawdhry
This series adds support for Adaptive voltage scaling on J721S2 device [0].

[0]: https://www.ti.com/lit/pdf/spruj28 (Section 5.2.4.1 AVS Support)

AVS Test for J721S2: 
https://gist.github.com/manorit2001/b2fd9f6764a863294d4aa0755c83c84f
Boot Test results: 
https://gist.github.com/manorit2001/d44e035552cb19aadeb0d928d5cb5f26

Signed-off-by: Manorit Chawdhry 
---
Changes in v5:
* Nishanth
- Update the commit message for defconfig update
- Add MPU clock to all devicetree node

* Simon
- Update the commit messages to be more helpful

- Link to v4: 
https://lore.kernel.org/r/20241004-b4-upstream-j721s2-avs-v4-0-6d71c6bab...@ti.com

---
Manorit Chawdhry (7):
  power: pmic: tps65941: Add DM_PMIC dependency
  drivers: misc: k3_avs: Check return code while programming AVS
  arm: dts: k3-*-r5: Add MPU clock in clocks property
  drivers: misc: k3_avs: Extract MPU clk and dev ID from DT
  arm: mach-k3: j721s2_init: Initialize AVS Class 0
  arm: dts: j721s2: Add VTM node in R5
  configs: j721s2_evm_r5_defconfig: Add AVS Configs

 arch/arm/dts/k3-am62-r5-lp-sk.dts   |  3 +-
 arch/arm/dts/k3-am625-r5-beagleplay.dts |  3 +-
 arch/arm/dts/k3-am625-r5-sk.dts |  3 +-
 arch/arm/dts/k3-am62a7-r5-sk.dts|  3 +-
 arch/arm/dts/k3-am62p5-r5-sk.dts|  3 +-
 arch/arm/dts/k3-am642-r5-evm.dts|  3 +-
 arch/arm/dts/k3-am642-r5-sk.dts |  3 +-
 arch/arm/dts/k3-am654-r5-base-board.dts |  3 +-
 arch/arm/dts/k3-am69-r5-sk.dts  |  3 +-
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts  |  3 +-
 arch/arm/dts/k3-j721e-r5.dtsi   |  3 +-
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts |  9 ++
 arch/arm/dts/k3-j721s2-r5.dtsi  |  3 +-
 arch/arm/dts/k3-j722s-r5-evm.dts|  3 +-
 arch/arm/dts/k3-j784s4-r5-evm.dts   |  3 +-
 arch/arm/mach-k3/j721s2/j721s2_init.c   | 10 +++
 configs/am68_sk_r5_defconfig|  4 +++
 configs/j721s2_evm_r5_defconfig |  6 
 drivers/misc/k3_avs.c   | 40 -
 drivers/power/pmic/Kconfig  |  1 +
 20 files changed, 97 insertions(+), 15 deletions(-)
---
base-commit: 28dc47038edc4e93f32d75a357131bcf01a18d85
change-id: 20240130-b4-upstream-j721s2-avs-8c187d3fe26a

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH v4 0/7] Add AVS support for J721S2

2024-10-07 Thread Manorit Chawdhry
Hi Simon,

On 09:23-20241007, Simon Glass wrote:
> Hi Manorit,
> 
> On Fri, 4 Oct 2024 at 00:24, Manorit Chawdhry  wrote:
> >
> > This series adds support for AVS on J721S2.
> 
> What is AVS? You should write an abbreviation out in full at least
> once in the series.

Totally missed this part, let me take that up in the next revision!

But basically it is Adaptive voltage scaling. This allows us to run
our CPU with the optimal voltage for that particular silicon which would
have been written in efuse during manufacturing itself. This helps in
saving power during runtime [0]

[0]: https://www.ti.com/lit/pdf/spruj28 (Section 5.2.4.1 AVS Support)

Regards,
Manorit

> 
> >
> > AVS Test for J721S2: 
> > https://gist.github.com/manorit2001/b2fd9f6764a863294d4aa0755c83c84f
> > Boot Test results: 
> > https://gist.github.com/manorit2001/15e45f6c421aeeb93effde023a537762
> >
> > Signed-off-by: Manorit Chawdhry 
> > ---
> > Changes in v4:
> >
> > * Udit
> > - Use the compatible for finding the node rather than alias.
> > - Remove debug print
> > - Add ret value in error prints
> >
> > - Link to v3: 
> > https://lore.kernel.org/r/20240813-b4-upstream-j721s2-avs-v3-0-5115d93cd...@ti.com
> >
> > ---
> > Manorit Chawdhry (7):
> >   power: pmic: tps65941: Add DM_PMIC dependency
> >   drivers: misc: k3_avs: Check return code while programming AVS
> >   arm: dts: k3-j7*-r5: Add MPU clock in clocks property
> >   drivers: misc: k3_avs: Extract MPU clk and dev ID from DT
> >   arm: mach-k3: j721s2_init: Initialize AVS Class 0
> >   arm: dts: j721s2: Add VTM node in R5
> >   configs: j721s2_evm_r5_defconfig: Add AVS Configs
> >
> >  arch/arm/dts/k3-am69-r5-sk.dts  |  3 +-
> >  arch/arm/dts/k3-j7200-r5-common-proc-board.dts  |  3 +-
> >  arch/arm/dts/k3-j721e-r5.dtsi   |  3 +-
> >  arch/arm/dts/k3-j721s2-r5-common-proc-board.dts |  9 ++
> >  arch/arm/dts/k3-j721s2-r5.dtsi  |  3 +-
> >  arch/arm/dts/k3-j784s4-r5-evm.dts   |  3 +-
> >  arch/arm/mach-k3/j721s2/j721s2_init.c   | 10 +++
> >  configs/am68_sk_r5_defconfig|  4 +++
> >  configs/j721s2_evm_r5_defconfig |  6 
> >  drivers/misc/k3_avs.c   | 40 
> > -
> >  drivers/power/pmic/Kconfig  |  1 +
> >  11 files changed, 79 insertions(+), 6 deletions(-)
> > ---
> > base-commit: 3a0b829efc35227b1079a444f00e0729502197ad
> > change-id: 20240130-b4-upstream-j721s2-avs-8c187d3fe26a
> >
> > Best regards,
> > --
> > Manorit Chawdhry 
> >
> 
> Regards,
> Simon


Re: [PATCH v4 7/7] configs: j721s2_evm_r5_defconfig: Add AVS Configs

2024-10-06 Thread Manorit Chawdhry
On 11:34-20241007, Manorit Chawdhry wrote:
> Hi Nishanth,
> 
> On 06:30-20241004, Nishanth Menon wrote:
> > On 11:54-20241004, Manorit Chawdhry wrote:
> > > Add AVS and PMIC regulator configs
> > > 
> > > Signed-off-by: Manorit Chawdhry 
> > > ---
> > >  configs/am68_sk_r5_defconfig| 4 
> > >  configs/j721s2_evm_r5_defconfig | 6 ++
> > >  2 files changed, 10 insertions(+)
> > > 
> > > diff --git a/configs/am68_sk_r5_defconfig b/configs/am68_sk_r5_defconfig
> > > index e9b6882c1f68..f4800ef1b8ac 100644
> > > --- a/configs/am68_sk_r5_defconfig
> > > +++ b/configs/am68_sk_r5_defconfig
> > > @@ -5,6 +5,10 @@ CONFIG_ARCH_K3=y
> > >  CONFIG_SOC_K3_J721S2=y
> > >  CONFIG_TARGET_J721S2_R5_EVM=y
> > >  
> > > +CONFIG_K3_AVS0=n
> > > +CONFIG_DM_REGULATOR_TPS65941=n
> > > +CONFIG_PMIC_TPS65941=n
> > > +
> > >  CONFIG_DEFAULT_DEVICE_TREE="k3-am68-sk-r5-base-board"
> > >  CONFIG_SPL_OF_LIST="k3-am68-sk-r5-base-board"
> > >  CONFIG_OF_LIST="k3-am68-sk-r5-base-board"
> > > diff --git a/configs/j721s2_evm_r5_defconfig 
> > > b/configs/j721s2_evm_r5_defconfig
> > > index b6adb6a77d7e..ad7653c8f99b 100644
> > > --- a/configs/j721s2_evm_r5_defconfig
> > > +++ b/configs/j721s2_evm_r5_defconfig
> > > @@ -112,6 +112,7 @@ CONFIG_DM_MAILBOX=y
> > >  CONFIG_K3_SEC_PROXY=y
> > >  CONFIG_FS_LOADER=y
> > >  CONFIG_SPL_FS_LOADER=y
> > > +CONFIG_K3_AVS0=y
> > >  CONFIG_SUPPORT_EMMC_BOOT=y
> > >  CONFIG_SPL_MMC_HS400_SUPPORT=y
> > >  CONFIG_MMC_SDHCI=y
> > > @@ -141,6 +142,11 @@ CONFIG_SPL_PINCTRL=y
> > >  CONFIG_PINCTRL_SINGLE=y
> > >  CONFIG_POWER_DOMAIN=y
> > >  CONFIG_TI_POWER_DOMAIN=y
> > > +CONFIG_DM_PMIC=y
> > > +CONFIG_PMIC_TPS65941=y
> > > +CONFIG_DM_REGULATOR=y
> > > +CONFIG_SPL_DM_REGULATOR=y
> > > +CONFIG_DM_REGULATOR_TPS65941=y
> > >  CONFIG_K3_SYSTEM_CONTROLLER=y
> > >  CONFIG_REMOTEPROC_TI_K3_ARM64=y
> > >  CONFIG_RESET_TI_SCI=y
> > 
> > 
> > Why are we mixing two different boards?
> > 
> 
> AM68 includes J721s2 defconfig for re-usability so if some board related
> feature is being enabled on J721s2, that needs to be taken care that it
> doesn't get enabled on AM68 if it doesn't support.

Board related in the sense that AVS requires PMIC support but that isn't
available yet so can't add the support for the same.

Regards,
Manorit

> 
> Regards, 
> Manorit
> 
> > -- 
> > Regards,
> > Nishanth Menon
> > Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> > 849D 1736 249D


Re: [PATCH v4 7/7] configs: j721s2_evm_r5_defconfig: Add AVS Configs

2024-10-06 Thread Manorit Chawdhry
Hi Nishanth,

On 06:30-20241004, Nishanth Menon wrote:
> On 11:54-20241004, Manorit Chawdhry wrote:
> > Add AVS and PMIC regulator configs
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> >  configs/am68_sk_r5_defconfig| 4 
> >  configs/j721s2_evm_r5_defconfig | 6 ++
> >  2 files changed, 10 insertions(+)
> > 
> > diff --git a/configs/am68_sk_r5_defconfig b/configs/am68_sk_r5_defconfig
> > index e9b6882c1f68..f4800ef1b8ac 100644
> > --- a/configs/am68_sk_r5_defconfig
> > +++ b/configs/am68_sk_r5_defconfig
> > @@ -5,6 +5,10 @@ CONFIG_ARCH_K3=y
> >  CONFIG_SOC_K3_J721S2=y
> >  CONFIG_TARGET_J721S2_R5_EVM=y
> >  
> > +CONFIG_K3_AVS0=n
> > +CONFIG_DM_REGULATOR_TPS65941=n
> > +CONFIG_PMIC_TPS65941=n
> > +
> >  CONFIG_DEFAULT_DEVICE_TREE="k3-am68-sk-r5-base-board"
> >  CONFIG_SPL_OF_LIST="k3-am68-sk-r5-base-board"
> >  CONFIG_OF_LIST="k3-am68-sk-r5-base-board"
> > diff --git a/configs/j721s2_evm_r5_defconfig 
> > b/configs/j721s2_evm_r5_defconfig
> > index b6adb6a77d7e..ad7653c8f99b 100644
> > --- a/configs/j721s2_evm_r5_defconfig
> > +++ b/configs/j721s2_evm_r5_defconfig
> > @@ -112,6 +112,7 @@ CONFIG_DM_MAILBOX=y
> >  CONFIG_K3_SEC_PROXY=y
> >  CONFIG_FS_LOADER=y
> >  CONFIG_SPL_FS_LOADER=y
> > +CONFIG_K3_AVS0=y
> >  CONFIG_SUPPORT_EMMC_BOOT=y
> >  CONFIG_SPL_MMC_HS400_SUPPORT=y
> >  CONFIG_MMC_SDHCI=y
> > @@ -141,6 +142,11 @@ CONFIG_SPL_PINCTRL=y
> >  CONFIG_PINCTRL_SINGLE=y
> >  CONFIG_POWER_DOMAIN=y
> >  CONFIG_TI_POWER_DOMAIN=y
> > +CONFIG_DM_PMIC=y
> > +CONFIG_PMIC_TPS65941=y
> > +CONFIG_DM_REGULATOR=y
> > +CONFIG_SPL_DM_REGULATOR=y
> > +CONFIG_DM_REGULATOR_TPS65941=y
> >  CONFIG_K3_SYSTEM_CONTROLLER=y
> >  CONFIG_REMOTEPROC_TI_K3_ARM64=y
> >  CONFIG_RESET_TI_SCI=y
> 
> 
> Why are we mixing two different boards?
> 

AM68 includes J721s2 defconfig for re-usability so if some board related
feature is being enabled on J721s2, that needs to be taken care that it
doesn't get enabled on AM68 if it doesn't support.

Regards, 
Manorit

> -- 
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> 849D 1736 249D


Re: [PATCH v4 3/7] arm: dts: k3-j7*-r5: Add MPU clock in clocks property

2024-10-06 Thread Manorit Chawdhry
Hi Nishanth,

On 06:30-20241004, Nishanth Menon wrote:
> On 11:54-20241004, Manorit Chawdhry wrote:
> > MPU clock had been missing. Distinguish multiple clocks with clock-names
> > and add MPU clock as well.
> > 
> > Signed-off-by: Manorit Chawdhry 
> 
> We have been a bit hacky with GTC - do we want to pull it out as a
> separate IP?

Could you explain it a bit more..

> > ---
> >  arch/arm/dts/k3-am69-r5-sk.dts | 3 ++-
> >  arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 3 ++-
> >  arch/arm/dts/k3-j721e-r5.dtsi  | 3 ++-
> >  arch/arm/dts/k3-j721s2-r5.dtsi | 3 ++-
> >  arch/arm/dts/k3-j784s4-r5-evm.dts  | 3 ++-
> >  5 files changed, 10 insertions(+), 5 deletions(-)
> 
> What about other boards? I think it might be time we refactor r5 view as
> a include file?
> 

Yeah, that makes sense. Will update the other boards with the following.

R5 is already include file for j721e and j721s2, other boards do require
that refactor but that can be taken up as a separate series ig.

Regards,
Manorit


[PATCH v4 7/7] configs: j721s2_evm_r5_defconfig: Add AVS Configs

2024-10-03 Thread Manorit Chawdhry
Add AVS and PMIC regulator configs

Signed-off-by: Manorit Chawdhry 
---
 configs/am68_sk_r5_defconfig| 4 
 configs/j721s2_evm_r5_defconfig | 6 ++
 2 files changed, 10 insertions(+)

diff --git a/configs/am68_sk_r5_defconfig b/configs/am68_sk_r5_defconfig
index e9b6882c1f68..f4800ef1b8ac 100644
--- a/configs/am68_sk_r5_defconfig
+++ b/configs/am68_sk_r5_defconfig
@@ -5,6 +5,10 @@ CONFIG_ARCH_K3=y
 CONFIG_SOC_K3_J721S2=y
 CONFIG_TARGET_J721S2_R5_EVM=y
 
+CONFIG_K3_AVS0=n
+CONFIG_DM_REGULATOR_TPS65941=n
+CONFIG_PMIC_TPS65941=n
+
 CONFIG_DEFAULT_DEVICE_TREE="k3-am68-sk-r5-base-board"
 CONFIG_SPL_OF_LIST="k3-am68-sk-r5-base-board"
 CONFIG_OF_LIST="k3-am68-sk-r5-base-board"
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index b6adb6a77d7e..ad7653c8f99b 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -112,6 +112,7 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_FS_LOADER=y
 CONFIG_SPL_FS_LOADER=y
+CONFIG_K3_AVS0=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_SPL_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
@@ -141,6 +142,11 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_POWER_DOMAIN=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_TPS65941=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_TPS65941=y
 CONFIG_K3_SYSTEM_CONTROLLER=y
 CONFIG_REMOTEPROC_TI_K3_ARM64=y
 CONFIG_RESET_TI_SCI=y

-- 
2.46.0



[PATCH v4 6/7] arm: dts: j721s2: Add VTM node in R5

2024-10-03 Thread Manorit Chawdhry
Add bootph-pre-ram property to VTM node and the pmic node.

Reviewed-by: Udit Kumar 
Signed-off-by: Manorit Chawdhry 
---

Notes:
Patches are posted to Linux [0]

[0]: 
https://lore.kernel.org/linux-arm-kernel/20240814-b4-upstream-bootph-all-v4-0-f2b462000...@ti.com/#

 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
index e92b1917df4e..506ad9b7910d 100644
--- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
@@ -10,3 +10,12 @@
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-j721s2-common-proc-board-u-boot.dtsi"
 #include "k3-j721s2-r5.dtsi"
+
+&tps659411 {
+   bootph-pre-ram;
+};
+
+&wkup_vtm0 {
+   bootph-pre-ram;
+   vdd-supply-2 = <&bucka1234>;
+};

-- 
2.46.0



[PATCH v4 5/7] arm: mach-k3: j721s2_init: Initialize AVS Class 0

2024-10-03 Thread Manorit Chawdhry
Initialize AVS Class 0.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/mach-k3/j721s2/j721s2_init.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c 
b/arch/arm/mach-k3/j721s2/j721s2_init.c
index 05453fcad41a..5f5961a2c17a 100644
--- a/arch/arm/mach-k3/j721s2/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
@@ -315,6 +315,9 @@ void do_dt_magic(void)
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong dummy)
 {
+   struct udevice *dev;
+   int ret;
+
k3_spl_init();
 #if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
do_dt_magic();
@@ -325,6 +328,13 @@ void board_init_f(ulong dummy)
setup_navss_nb();
 
setup_qos();
+
+   if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) {
+   ret = uclass_get_device_by_driver(UCLASS_MISC, 
DM_DRIVER_GET(k3_avs),
+ &dev);
+   if (ret)
+   printf("AVS init failed: %d\n", ret);
+   }
 }
 #endif
 

-- 
2.46.0



[PATCH v4 4/7] drivers: misc: k3_avs: Extract MPU clk and dev ID from DT

2024-10-03 Thread Manorit Chawdhry
Different devices have different MPU clk and dev ID. Currently it had
been hardcoded. Move it to DT based extraction.

Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 66ad747f2dd8..99a18a109b7c 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -352,6 +352,9 @@ static int k3_avs_probe(struct udevice *dev)
struct k3_avs_privdata *priv;
struct vd_data *vd;
int ret;
+   ofnode node;
+   struct ofnode_phandle_args phandle_args;
+   int i = 0;
 
priv = dev_get_priv(dev);
priv->dev = dev;
@@ -367,6 +370,32 @@ static int k3_avs_probe(struct udevice *dev)
return -ENODEV;
 
for (vd = priv->vd_config->vds; vd->id >= 0; vd++) {
+   /* Get the clock and dev id for Jacinto platforms */
+   if (vd->id == J721E_VDD_MPU) {
+   node = ofnode_by_compatible(ofnode_null(), 
"ti,am654-rproc");
+   if (!ofnode_valid(node))
+   return -ENODEV;
+
+   i = ofnode_stringlist_search(node, "clock-names", 
"core");
+   if (i < 0)
+   return -ENODEV;
+
+   ret = ofnode_parse_phandle_with_args(node, "clocks",
+"#clock-cells",
+0, i,
+&phandle_args);
+   if (ret) {
+   printf("Couldn't get the clock node, ret = 
%d\n", ret);
+   return ret;
+   }
+
+   vd->dev_id = phandle_args.args[0];
+   vd->clk_id = phandle_args.args[1];
+
+   debug("%s: MPU dev_id: %d, clk_id: %d", __func__,
+ vd->dev_id, vd->clk_id);
+   }
+
if (!(readl(AM6_VTM_DEVINFO(vd->id)) &
  AM6_VTM_AVS0_SUPPORTED)) {
dev_warn(dev, "AVS-class 0 not supported for VD%d\n",
@@ -463,6 +492,12 @@ static struct vd_data j721e_vd_data[] = {
{
.id = J721E_VDD_MPU,
.opp = AM6_OPP_NOM,
+   /*
+* XXX: DEPRECATION WARNING: Around 2 u-boot versions
+*
+* These values will be picked up from DT, kept for backward
+* compatibility
+*/
.dev_id = 202, /* J721E_DEV_A72SS0_CORE0 */
.clk_id = 2, /* ARM clock */
.opps = {

-- 
2.46.0



[PATCH v4 3/7] arm: dts: k3-j7*-r5: Add MPU clock in clocks property

2024-10-03 Thread Manorit Chawdhry
MPU clock had been missing. Distinguish multiple clocks with clock-names
and add MPU clock as well.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am69-r5-sk.dts | 3 ++-
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 3 ++-
 arch/arm/dts/k3-j721e-r5.dtsi  | 3 ++-
 arch/arm/dts/k3-j721s2-r5.dtsi | 3 ++-
 arch/arm/dts/k3-j784s4-r5-evm.dts  | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/k3-am69-r5-sk.dts b/arch/arm/dts/k3-am69-r5-sk.dts
index 4d6aab5ccc38..13809f82d99a 100644
--- a/arch/arm/dts/k3-am69-r5-sk.dts
+++ b/arch/arm/dts/k3-am69-r5-sk.dts
@@ -26,7 +26,8 @@
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <20>;
diff --git a/arch/arm/dts/k3-j7200-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j7200-r5-common-proc-board.dts
index 94760c78dd35..f8df14935dbc 100644
--- a/arch/arm/dts/k3-j7200-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j7200-r5-common-proc-board.dts
@@ -23,7 +23,8 @@
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
+   clocks = <&k3_clks 61 1>, <&k3_clks 202 2>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>, <&k3_clks 
323 0>;
assigned-clock-parents= <0>, <0>, <&k3_clks 323 2>;
assigned-clock-rates = <20>, <2>;
diff --git a/arch/arm/dts/k3-j721e-r5.dtsi b/arch/arm/dts/k3-j721e-r5.dtsi
index fd0d921272c5..688a6cf40892 100644
--- a/arch/arm/dts/k3-j721e-r5.dtsi
+++ b/arch/arm/dts/k3-j721e-r5.dtsi
@@ -20,7 +20,8 @@
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
+   clocks = <&k3_clks 61 1>, <&k3_clks 202 2>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>;
assigned-clock-rates = <20>, <2>;
ti,sci = <&dmsc>;
diff --git a/arch/arm/dts/k3-j721s2-r5.dtsi b/arch/arm/dts/k3-j721s2-r5.dtsi
index caf696c2d960..634676c8491e 100644
--- a/arch/arm/dts/k3-j721s2-r5.dtsi
+++ b/arch/arm/dts/k3-j721s2-r5.dtsi
@@ -20,7 +20,8 @@
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
+   clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
assigned-clock-parents = <&k3_clks 61 3>;
assigned-clock-rates = <2>, <20>;
diff --git a/arch/arm/dts/k3-j784s4-r5-evm.dts 
b/arch/arm/dts/k3-j784s4-r5-evm.dts
index d2c752293630..8b8b0e70047e 100644
--- a/arch/arm/dts/k3-j784s4-r5-evm.dts
+++ b/arch/arm/dts/k3-j784s4-r5-evm.dts
@@ -26,7 +26,8 @@
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <20>;

-- 
2.46.0



[PATCH v4 2/7] drivers: misc: k3_avs: Check return code while programming AVS

2024-10-03 Thread Manorit Chawdhry
Check if AVS could not be programmed and print a warning.

Fixes: 9d233b4e3ed6 ("misc: k3_avs: add driver for K3 Adaptive Voltage Scaling 
Class 0")
Reviewed-by: Udit Kumar 
Signed-off-by: Manorit Chawdhry 
---

Notes:
v4:
Pick the following change from v2, had gotten missed.
https://lore.kernel.org/all/fa14fd9c-2b6f-4a09-ab2f-01d90106c...@ti.com/

 drivers/misc/k3_avs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 87471cc3b16a..66ad747f2dd8 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -391,7 +391,10 @@ static int k3_avs_probe(struct udevice *dev)
if (vd->flags & VD_FLAG_INIT_DONE)
continue;
 
-   k3_avs_program_voltage(priv, vd, vd->opp);
+   ret = k3_avs_program_voltage(priv, vd, vd->opp);
+   if (ret)
+   dev_warn(dev, "Could not program AVS voltage for VD%d, 
vd->opp=%d, ret=%d\n",
+vd->id, vd->opp, ret);
}
 
if (!device_is_compatible(priv->dev, "ti,am654-avs"))

-- 
2.46.0



[PATCH v4 1/7] power: pmic: tps65941: Add DM_PMIC dependency

2024-10-03 Thread Manorit Chawdhry
This Kconfig depends on DM_PMIC but hadn't be explicitly stated which
could cause config related issues.

Adds the dependency in Kconfig for tps65941.

Fixes: 6b86dd0c1ead ("power: pmic: tps65941: Add support for tps65941 family of 
PMICs")
Reviewed-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 drivers/power/pmic/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 562c1a3b122a..bbcbcee4c355 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -394,6 +394,7 @@ config SPL_PMIC_LP87565
 
 config PMIC_TPS65941
bool "Enable driver for Texas Instruments TPS65941 PMIC"
+   depends on DM_PMIC
help
The TPS65941 is a PMIC containing a bunch of SMPS & LDOs.
This driver binds the pmic children.

-- 
2.46.0



[PATCH v4 0/7] Add AVS support for J721S2

2024-10-03 Thread Manorit Chawdhry
This series adds support for AVS on J721S2.

AVS Test for J721S2: 
https://gist.github.com/manorit2001/b2fd9f6764a863294d4aa0755c83c84f
Boot Test results: 
https://gist.github.com/manorit2001/15e45f6c421aeeb93effde023a537762

Signed-off-by: Manorit Chawdhry 
---
Changes in v4:

* Udit
- Use the compatible for finding the node rather than alias.
- Remove debug print
- Add ret value in error prints

- Link to v3: 
https://lore.kernel.org/r/20240813-b4-upstream-j721s2-avs-v3-0-5115d93cd...@ti.com

---
Manorit Chawdhry (7):
  power: pmic: tps65941: Add DM_PMIC dependency
  drivers: misc: k3_avs: Check return code while programming AVS
  arm: dts: k3-j7*-r5: Add MPU clock in clocks property
  drivers: misc: k3_avs: Extract MPU clk and dev ID from DT
  arm: mach-k3: j721s2_init: Initialize AVS Class 0
  arm: dts: j721s2: Add VTM node in R5
  configs: j721s2_evm_r5_defconfig: Add AVS Configs

 arch/arm/dts/k3-am69-r5-sk.dts  |  3 +-
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts  |  3 +-
 arch/arm/dts/k3-j721e-r5.dtsi   |  3 +-
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts |  9 ++
 arch/arm/dts/k3-j721s2-r5.dtsi  |  3 +-
 arch/arm/dts/k3-j784s4-r5-evm.dts   |  3 +-
 arch/arm/mach-k3/j721s2/j721s2_init.c   | 10 +++
 configs/am68_sk_r5_defconfig|  4 +++
 configs/j721s2_evm_r5_defconfig |  6 
 drivers/misc/k3_avs.c   | 40 -
 drivers/power/pmic/Kconfig  |  1 +
 11 files changed, 79 insertions(+), 6 deletions(-)
---
base-commit: 3a0b829efc35227b1079a444f00e0729502197ad
change-id: 20240130-b4-upstream-j721s2-avs-8c187d3fe26a

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH v3 5/7] arm: mach-k3: j721s2_init: Initialize AVS Class 0

2024-10-03 Thread Manorit Chawdhry
Hi Udit,

On 06:45-20241002, Kumar, Udit wrote:
> 
> On 10/1/2024 2:18 PM, Manorit Chawdhry wrote:
> > Hi Udit,
> > 
> > On 08:46-20240815, Kumar, Udit wrote:
> > > On 8/13/2024 11:40 AM, Manorit Chawdhry wrote:
> > > > Initialize AVS Class 0.
> > > > 
> > > > Signed-off-by: Manorit Chawdhry 
> > > > ---
> > > >arch/arm/mach-k3/j721s2/j721s2_init.c | 10 ++
> > > >1 file changed, 10 insertions(+)
> > > > 
> > > > diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c 
> > > > b/arch/arm/mach-k3/j721s2/j721s2_init.c
> > > > index 05453fcad41a..5f5961a2c17a 100644
> > > > --- a/arch/arm/mach-k3/j721s2/j721s2_init.c
> > > > +++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
> > > > @@ -315,6 +315,9 @@ void do_dt_magic(void)
> > > >#ifdef CONFIG_SPL_BUILD
> > > >void board_init_f(ulong dummy)
> > > >{
> > > > +   struct udevice *dev;
> > > > +   int ret;
> > > > +
> > > > k3_spl_init();
> > > >#if defined(CONFIG_SPL_OF_LIST) && 
> > > > defined(CONFIG_TI_I2C_BOARD_DETECT)
> > > > do_dt_magic();
> > > > @@ -325,6 +328,13 @@ void board_init_f(ulong dummy)
> > > > setup_navss_nb();
> > > > setup_qos();
> > > > +
> > > > +   if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) {
> > > > +   ret = uclass_get_device_by_driver(UCLASS_MISC, 
> > > > DM_DRIVER_GET(k3_avs),
> > > > + &dev);
> > > Can we remove this ret, Something like
> > I would say we can let this remain, general convention of this file is
> > to have ret itself, I know it's only used in one place as of now but I
> > feel keeping it consistent is better IMO.
> 
> 
> I still suggest to remove non needed variable .
> 
> To make it consistent , please think to change at other places :)

We are printing the ret value later, there is no point cleaning this up.

Regards,
Manorit

> 
> 
> > 
> > Regards,
> > Manorit


Re: [PATCH v3 4/7] drivers: misc: k3_avs: Extract MPU clk and dev ID from DT

2024-10-01 Thread Manorit Chawdhry
Hi Udit,

On 08:44-20240815, Kumar, Udit wrote:
> 
> On 8/13/2024 11:40 AM, Manorit Chawdhry wrote:
> > Different devices have different MPU clk and dev ID. Currently it had
> > been hardcoded. Move it to DT based extraction.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> >   drivers/misc/k3_avs.c | 37 +
> >   1 file changed, 37 insertions(+)
> > 
> > diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
> > index 568cf5b20d51..f94eee5b1c64 100644
> > --- a/drivers/misc/k3_avs.c
> > +++ b/drivers/misc/k3_avs.c
> > @@ -352,6 +352,9 @@ static int k3_avs_probe(struct udevice *dev)
> > struct k3_avs_privdata *priv;
> > struct vd_data *vd;
> > int ret;
> > +   ofnode node;
> > +   struct ofnode_phandle_args phandle_args;
> > +   int i = 0;
> > priv = dev_get_priv(dev);
> > priv->dev = dev;
> > @@ -367,6 +370,34 @@ static int k3_avs_probe(struct udevice *dev)
> > return -ENODEV;
> > for (vd = priv->vd_config->vds; vd->id >= 0; vd++) {
> > +   /* Get the clock and dev id for Jacinto platforms */
> > +   if (vd->id == J721E_VDD_MPU) {
> > +   node = ofnode_get_aliases_node("remoteproc1");
> 
> My suggestion will be to search node based upon compatible name am654-rproc

Yes, that seems like a good idea, let me try that.

> 
> 
> > +   if (!ofnode_valid(node))
> > +   return -ENODEV;
> > +
> > +   i = ofnode_stringlist_search(node, "clock-names", 
> > "core");
> > +   if (i < 0)
> > +   return -ENODEV;
> > +
> > +   debug("%s: i: %d\n", __func__, i);
> 
> I assume this was for your debug only, Please see if you can remove this

Ack.

Regards,
Manorit


Re: [PATCH v3 5/7] arm: mach-k3: j721s2_init: Initialize AVS Class 0

2024-10-01 Thread Manorit Chawdhry
Hi Udit,

On 08:46-20240815, Kumar, Udit wrote:
> 
> On 8/13/2024 11:40 AM, Manorit Chawdhry wrote:
> > Initialize AVS Class 0.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> >   arch/arm/mach-k3/j721s2/j721s2_init.c | 10 ++
> >   1 file changed, 10 insertions(+)
> > 
> > diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c 
> > b/arch/arm/mach-k3/j721s2/j721s2_init.c
> > index 05453fcad41a..5f5961a2c17a 100644
> > --- a/arch/arm/mach-k3/j721s2/j721s2_init.c
> > +++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
> > @@ -315,6 +315,9 @@ void do_dt_magic(void)
> >   #ifdef CONFIG_SPL_BUILD
> >   void board_init_f(ulong dummy)
> >   {
> > +   struct udevice *dev;
> > +   int ret;
> > +
> > k3_spl_init();
> >   #if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
> > do_dt_magic();
> > @@ -325,6 +328,13 @@ void board_init_f(ulong dummy)
> > setup_navss_nb();
> > setup_qos();
> > +
> > +   if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) {
> > +   ret = uclass_get_device_by_driver(UCLASS_MISC, 
> > DM_DRIVER_GET(k3_avs),
> > + &dev);
> 
> Can we remove this ret, Something like

I would say we can let this remain, general convention of this file is
to have ret itself, I know it's only used in one place as of now but I
feel keeping it consistent is better IMO.

Regards,
Manorit


Re: [PATCH v3 3/7] arm: dts: k3-j7*-r5: Add MPU clock in clocks property

2024-10-01 Thread Manorit Chawdhry
Hi Udit,

On 08:32-20240815, Kumar, Udit wrote:
> 
> On 8/13/2024 11:40 AM, Manorit Chawdhry wrote:
> > MPU clock had been missing. Distinguish multiple clocks with clock-names
> > and add MPU clock as well.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> >   arch/arm/dts/k3-am69-r5-sk.dts | 3 ++-
> >   arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 3 ++-
> >   arch/arm/dts/k3-j721e-r5.dtsi  | 3 ++-
> >   arch/arm/dts/k3-j721s2-r5.dtsi | 3 ++-
> >   arch/arm/dts/k3-j784s4-r5-evm.dts  | 3 ++-
> >   5 files changed, 10 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/arm/dts/k3-am69-r5-sk.dts b/arch/arm/dts/k3-am69-r5-sk.dts
> > index f177f563527f..9bbf76d8bf35 100644
> > --- a/arch/arm/dts/k3-am69-r5-sk.dts
> > +++ b/arch/arm/dts/k3-am69-r5-sk.dts
> > @@ -26,7 +26,8 @@
> > power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
> > <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
> > resets = <&k3_reset 202 0>;
> > -   clocks = <&k3_clks 61 0>;
> > +   clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
> 
> 
> Thanks for catching this
> 
> Could we think of having SOC specific R5 dt , So that we don't need to
> update such SOC information at each board level
> 
> Similar to what is done (k3-j721e-r5.dtsi)

Seems like a good idea but I believe that it could be a separate
activity regardless of this series, it can be taken up later. Current
series is putting it in the respective files so should be a non blocker.

Regards,
Manorit


Re: [PATCH v3 6/7] arm: dts: j721s2: Add VTM node in R5

2024-10-01 Thread Manorit Chawdhry
Hi Udit,

On 08:47-20240815, Kumar, Udit wrote:
> 
> On 8/13/2024 11:40 AM, Manorit Chawdhry wrote:
> > Add bootph-pre-ram property to VTM node and the pmic node.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> >   arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 +
> >   1 file changed, 9 insertions(+)
> > 
> > diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
> > b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
> > index e92b1917df4e..506ad9b7910d 100644
> > --- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
> > +++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
> > @@ -10,3 +10,12 @@
> >   #include "k3-j721s2-ddr.dtsi"
> >   #include "k3-j721s2-common-proc-board-u-boot.dtsi"
> >   #include "k3-j721s2-r5.dtsi"
> > +
> > +&tps659411 {
> > +   bootph-pre-ram;
> > +};
> 
> Ok for now. but do you plan to add this bootph-pre-ram in Linux DT too ?
> 

Yes, it's taken as a part of the series that's being run parallely in
Linux [0]

[0]: 
https://lore.kernel.org/linux-arm-kernel/20240814-b4-upstream-bootph-all-v4-0-f2b462000...@ti.com/

Regards,
Manorit


[PATCH v3 7/7] configs: j721s2_evm_r5_defconfig: Add AVS Configs

2024-08-12 Thread Manorit Chawdhry
Add AVS and PMIC regulator configs

Signed-off-by: Manorit Chawdhry 
---
 configs/am68_sk_r5_defconfig| 4 
 configs/j721s2_evm_r5_defconfig | 6 ++
 2 files changed, 10 insertions(+)

diff --git a/configs/am68_sk_r5_defconfig b/configs/am68_sk_r5_defconfig
index e9b6882c1f68..f4800ef1b8ac 100644
--- a/configs/am68_sk_r5_defconfig
+++ b/configs/am68_sk_r5_defconfig
@@ -5,6 +5,10 @@ CONFIG_ARCH_K3=y
 CONFIG_SOC_K3_J721S2=y
 CONFIG_TARGET_J721S2_R5_EVM=y
 
+CONFIG_K3_AVS0=n
+CONFIG_DM_REGULATOR_TPS65941=n
+CONFIG_PMIC_TPS65941=n
+
 CONFIG_DEFAULT_DEVICE_TREE="k3-am68-sk-r5-base-board"
 CONFIG_SPL_OF_LIST="k3-am68-sk-r5-base-board"
 CONFIG_OF_LIST="k3-am68-sk-r5-base-board"
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index 6404b1cc3037..288379797432 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -112,6 +112,7 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_FS_LOADER=y
 CONFIG_SPL_FS_LOADER=y
+CONFIG_K3_AVS0=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_SPL_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
@@ -141,6 +142,11 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_POWER_DOMAIN=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_TPS65941=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_TPS65941=y
 CONFIG_K3_SYSTEM_CONTROLLER=y
 CONFIG_REMOTEPROC_TI_K3_ARM64=y
 CONFIG_RESET_TI_SCI=y

-- 
2.46.0



[PATCH v3 6/7] arm: dts: j721s2: Add VTM node in R5

2024-08-12 Thread Manorit Chawdhry
Add bootph-pre-ram property to VTM node and the pmic node.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
index e92b1917df4e..506ad9b7910d 100644
--- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
@@ -10,3 +10,12 @@
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-j721s2-common-proc-board-u-boot.dtsi"
 #include "k3-j721s2-r5.dtsi"
+
+&tps659411 {
+   bootph-pre-ram;
+};
+
+&wkup_vtm0 {
+   bootph-pre-ram;
+   vdd-supply-2 = <&bucka1234>;
+};

-- 
2.46.0



[PATCH v3 5/7] arm: mach-k3: j721s2_init: Initialize AVS Class 0

2024-08-12 Thread Manorit Chawdhry
Initialize AVS Class 0.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/mach-k3/j721s2/j721s2_init.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c 
b/arch/arm/mach-k3/j721s2/j721s2_init.c
index 05453fcad41a..5f5961a2c17a 100644
--- a/arch/arm/mach-k3/j721s2/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
@@ -315,6 +315,9 @@ void do_dt_magic(void)
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong dummy)
 {
+   struct udevice *dev;
+   int ret;
+
k3_spl_init();
 #if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
do_dt_magic();
@@ -325,6 +328,13 @@ void board_init_f(ulong dummy)
setup_navss_nb();
 
setup_qos();
+
+   if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) {
+   ret = uclass_get_device_by_driver(UCLASS_MISC, 
DM_DRIVER_GET(k3_avs),
+ &dev);
+   if (ret)
+   printf("AVS init failed: %d\n", ret);
+   }
 }
 #endif
 

-- 
2.46.0



[PATCH v3 4/7] drivers: misc: k3_avs: Extract MPU clk and dev ID from DT

2024-08-12 Thread Manorit Chawdhry
Different devices have different MPU clk and dev ID. Currently it had
been hardcoded. Move it to DT based extraction.

Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 568cf5b20d51..f94eee5b1c64 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -352,6 +352,9 @@ static int k3_avs_probe(struct udevice *dev)
struct k3_avs_privdata *priv;
struct vd_data *vd;
int ret;
+   ofnode node;
+   struct ofnode_phandle_args phandle_args;
+   int i = 0;
 
priv = dev_get_priv(dev);
priv->dev = dev;
@@ -367,6 +370,34 @@ static int k3_avs_probe(struct udevice *dev)
return -ENODEV;
 
for (vd = priv->vd_config->vds; vd->id >= 0; vd++) {
+   /* Get the clock and dev id for Jacinto platforms */
+   if (vd->id == J721E_VDD_MPU) {
+   node = ofnode_get_aliases_node("remoteproc1");
+   if (!ofnode_valid(node))
+   return -ENODEV;
+
+   i = ofnode_stringlist_search(node, "clock-names", 
"core");
+   if (i < 0)
+   return -ENODEV;
+
+   debug("%s: i: %d\n", __func__, i);
+
+   ret = ofnode_parse_phandle_with_args(node, "clocks",
+"#clock-cells",
+0, i,
+&phandle_args);
+   if (ret) {
+   printf("Couldn't get the clock node\n");
+   return ret;
+   }
+
+   vd->dev_id = phandle_args.args[0];
+   vd->clk_id = phandle_args.args[1];
+
+   debug("%s: MPU dev_id: %d, clk_id: %d", __func__,
+ vd->dev_id, vd->clk_id);
+   }
+
if (!(readl(AM6_VTM_DEVINFO(vd->id)) &
  AM6_VTM_AVS0_SUPPORTED)) {
dev_warn(dev, "AVS-class 0 not supported for VD%d\n",
@@ -463,6 +494,12 @@ static struct vd_data j721e_vd_data[] = {
{
.id = J721E_VDD_MPU,
.opp = AM6_OPP_NOM,
+   /*
+* XXX: DEPRECATION WARNING: Around 2 u-boot versions
+*
+* These values will be picked up from DT, kept for backward
+* compatibility
+*/
.dev_id = 202, /* J721E_DEV_A72SS0_CORE0 */
.clk_id = 2, /* ARM clock */
.opps = {

-- 
2.46.0



[PATCH v3 3/7] arm: dts: k3-j7*-r5: Add MPU clock in clocks property

2024-08-12 Thread Manorit Chawdhry
MPU clock had been missing. Distinguish multiple clocks with clock-names
and add MPU clock as well.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am69-r5-sk.dts | 3 ++-
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 3 ++-
 arch/arm/dts/k3-j721e-r5.dtsi  | 3 ++-
 arch/arm/dts/k3-j721s2-r5.dtsi | 3 ++-
 arch/arm/dts/k3-j784s4-r5-evm.dts  | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/k3-am69-r5-sk.dts b/arch/arm/dts/k3-am69-r5-sk.dts
index f177f563527f..9bbf76d8bf35 100644
--- a/arch/arm/dts/k3-am69-r5-sk.dts
+++ b/arch/arm/dts/k3-am69-r5-sk.dts
@@ -26,7 +26,8 @@
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <20>;
diff --git a/arch/arm/dts/k3-j7200-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j7200-r5-common-proc-board.dts
index fb7e2e502392..e6da86f3cd10 100644
--- a/arch/arm/dts/k3-j7200-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j7200-r5-common-proc-board.dts
@@ -23,7 +23,8 @@
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
+   clocks = <&k3_clks 61 1>, <&k3_clks 202 2>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>, <&k3_clks 
323 0>;
assigned-clock-parents= <0>, <0>, <&k3_clks 323 2>;
assigned-clock-rates = <20>, <2>;
diff --git a/arch/arm/dts/k3-j721e-r5.dtsi b/arch/arm/dts/k3-j721e-r5.dtsi
index fd0d921272c5..688a6cf40892 100644
--- a/arch/arm/dts/k3-j721e-r5.dtsi
+++ b/arch/arm/dts/k3-j721e-r5.dtsi
@@ -20,7 +20,8 @@
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
+   clocks = <&k3_clks 61 1>, <&k3_clks 202 2>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>;
assigned-clock-rates = <20>, <2>;
ti,sci = <&dmsc>;
diff --git a/arch/arm/dts/k3-j721s2-r5.dtsi b/arch/arm/dts/k3-j721s2-r5.dtsi
index caf696c2d960..634676c8491e 100644
--- a/arch/arm/dts/k3-j721s2-r5.dtsi
+++ b/arch/arm/dts/k3-j721s2-r5.dtsi
@@ -20,7 +20,8 @@
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
+   clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
assigned-clock-parents = <&k3_clks 61 3>;
assigned-clock-rates = <2>, <20>;
diff --git a/arch/arm/dts/k3-j784s4-r5-evm.dts 
b/arch/arm/dts/k3-j784s4-r5-evm.dts
index bef4573d3d20..306d2007f89e 100644
--- a/arch/arm/dts/k3-j784s4-r5-evm.dts
+++ b/arch/arm/dts/k3-j784s4-r5-evm.dts
@@ -26,7 +26,8 @@
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 0>;
+   clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
+   clock-names = "gtc", "core";
assigned-clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
assigned-clock-parents = <&k3_clks 61 2>;
assigned-clock-rates = <2>, <20>;

-- 
2.46.0



[PATCH v3 2/7] drivers: misc: k3_avs: Check return code while programming AVS

2024-08-12 Thread Manorit Chawdhry
Check if AVS could not be programmed and print a warning.

Fixes: 9d233b4e3ed6 ("misc: k3_avs: add driver for K3 Adaptive Voltage Scaling 
Class 0")
Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 87471cc3b16a..568cf5b20d51 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -391,7 +391,10 @@ static int k3_avs_probe(struct udevice *dev)
if (vd->flags & VD_FLAG_INIT_DONE)
continue;
 
-   k3_avs_program_voltage(priv, vd, vd->opp);
+   ret = k3_avs_program_voltage(priv, vd, vd->opp);
+   if (ret)
+   dev_warn(dev, "Could not program AVS voltage for 
VD%d\n",
+vd->id);
}
 
if (!device_is_compatible(priv->dev, "ti,am654-avs"))

-- 
2.46.0



[PATCH v3 1/7] power: pmic: tps65941: Add DM_PMIC dependency

2024-08-12 Thread Manorit Chawdhry
This Kconfig depends on DM_PMIC but hadn't be explicitly stated which
could cause config related issues.

Adds the dependency in Kconfig for tps65941.

Fixes: 6b86dd0c1ead ("power: pmic: tps65941: Add support for tps65941 family of 
PMICs")
Reviewed-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 drivers/power/pmic/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 562c1a3b122a..bbcbcee4c355 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -394,6 +394,7 @@ config SPL_PMIC_LP87565
 
 config PMIC_TPS65941
bool "Enable driver for Texas Instruments TPS65941 PMIC"
+   depends on DM_PMIC
help
The TPS65941 is a PMIC containing a bunch of SMPS & LDOs.
This driver binds the pmic children.

-- 
2.46.0



[PATCH v3 0/7] Add AVS support for J721S2

2024-08-12 Thread Manorit Chawdhry
This series adds support for AVS on J721S2.

AVS Test for J721S2: 
https://gist.github.com/manorit2001/c64cf396281806102cae2b45ba84781e
Boot Test results: 
https://gist.github.com/manorit2001/6775d721b3df5a690497d94d012b93c4

Signed-off-by: Manorit Chawdhry 
---
Changes in v3:
* Udit
- Change the method of soc_match_device

* Tom
- That code part changed so that error wouldn't exist anymore

- Link to v2: 
https://lore.kernel.org/r/20240528-b4-upstream-j721s2-avs-v2-0-df940f230...@ti.com

---
Manorit Chawdhry (7):
  power: pmic: tps65941: Add DM_PMIC dependency
  drivers: misc: k3_avs: Check return code while programming AVS
  arm: dts: k3-j7*-r5: Add MPU clock in clocks property
  drivers: misc: k3_avs: Extract MPU clk and dev ID from DT
  arm: mach-k3: j721s2_init: Initialize AVS Class 0
  arm: dts: j721s2: Add VTM node in R5
  configs: j721s2_evm_r5_defconfig: Add AVS Configs

 arch/arm/dts/k3-am69-r5-sk.dts  |  3 +-
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts  |  3 +-
 arch/arm/dts/k3-j721e-r5.dtsi   |  3 +-
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts |  9 ++
 arch/arm/dts/k3-j721s2-r5.dtsi  |  3 +-
 arch/arm/dts/k3-j784s4-r5-evm.dts   |  3 +-
 arch/arm/mach-k3/j721s2/j721s2_init.c   | 10 ++
 configs/am68_sk_r5_defconfig|  4 +++
 configs/j721s2_evm_r5_defconfig |  6 
 drivers/misc/k3_avs.c   | 42 -
 drivers/power/pmic/Kconfig  |  1 +
 11 files changed, 81 insertions(+), 6 deletions(-)
---
base-commit: b4cbd1a257d4027038b4f997d73bdb0a066db045
change-id: 20240130-b4-upstream-j721s2-avs-8c187d3fe26a

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH 09/10] fdtgrep: Allow propagating properties up to supernodes

2024-07-15 Thread Manorit Chawdhry
Hi Simon,

On 10:39-20240711, Simon Glass wrote:
> Hi Manorit,
> 
> On Wed, 10 Jul 2024 at 07:15, Manorit Chawdhry  wrote:
> >
> > Hi Simon,
> >
> > On 09:36-20231217, Simon Glass wrote:
> > > The existing bootph binding is defined such that properties in a
> > > subnode are also implied in the supernode also, as in this example:
> > >
> > >buttons {
> > >   /* bootph,pre-ram is implied by btn1 */
> > >   compatible = "gpio-keys";
> > >
> > >   btn1 {
> > >  bootph,pre-ram;
> > >  gpios = <&gpio_a 3 0>;
> > >  label = "button1";
> > >  linux,code = ;
> > >   };
> > >
> > > Provide an option to implement this in fdtgrep.
> > >
> > > Signed-off-by: Simon Glass 
> >
> > Coming back to this patch as am facing some issues with the bootph-all
> > propagation to the parent nodes [0]. We have a dmsc/sms node in our
> > devices and it is a parent node of k3_pds, k3_clks, k3_reset.
> >
> > During U-boot proper we are initializing the serial console and during
> > that time we have to make some calls to our Device manager for clocks
> > and power domains. With the DT modelling, the clocks and power domains
> > come under the device manager node ( dmsc/sms ) but interestingly that
> > driver is not getting probed while putting bootph-all in the child
> > nodes. Do you know anything about this? I thought putting it in child
> > node will propagate it to the parent nodes as well so it'll be probed as
> > well. We are having to put bootph-all explicitely in the dmsc/sms node
> > for it to work.
> 
> Yes, that is because fdtgrep is only used with the SPL DT. The U-Boot
> one is used unmodified by U-Boot and it does not check parents for
> such properties (neither does SPL, but fdtgrep has logic to imply
> these properties internally).
> 
> The easiest way to fix this would probably be to process the DT in
> Binman for insertion into the final image, since Binman already does
> lots of other DT processing.
> 
> If you like, you could create an issue for it [1]. If you want to have
> a crack at fixing it, I could provide some pointers.

I am not sure if I'll be able to focus on this now but feel free to give
your pointers, might help anyone else as well if they want to take a
look at it.

Meanwhile I will open a issue as you mentioned for tracking this, trying
to register on the URL that you provided. Thanks!

Regards,
Manorit

> 
> Regards,
> Simon
> 
> [1] https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues
> 
> 
> >
> > [0]: 
> > https://lore.kernel.org/linux-arm-kernel/20240705-b4-upstream-bootph-all-v2-0-9007681ed...@ti.com/T/#t
> >
> > Regards,
> > Manorit
> > > ---
> > >
> > >  tools/fdtgrep.c | 18 +-
> > >  1 file changed, 17 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
> > > index ca639a2d9f4f..f1ff1946bd4a 100644
> > > --- a/tools/fdtgrep.c
> > > +++ b/tools/fdtgrep.c
> > > @@ -63,6 +63,7 @@ struct display_info {
> > >   int types_inc;  /* Mask of types that we include 
> > > (FDT_IS...) */
> > >   int types_exc;  /* Mask of types that we exclude 
> > > (FDT_IS...) */
> > >   int invert; /* Invert polarity of match */
> > > + int props_up;   /* Imply properties up to supernodes */
> > >   struct value_node *value_head;  /* List of values to match */
> > >   const char *output_fname;   /* Output filename */
> > >   FILE *fout; /* File to write dts/dtb output */
> > > @@ -606,6 +607,16 @@ static int check_props(struct display_info *disp, 
> > > const void *fdt, int node,
> > >strlen(str));
> > >   }
> > >
> > > + /* if requested, check all subnodes for this property too */
> > > + if (inc != 1 && disp->props_up) {
> > > + int subnode;
> > > +
> > > + for (subnode = fdt_first_subnode(fdt, node);
> > > +  subnode > 0 && inc != 1;
> > > +  subnode = fdt_next_subnode(fdt, subnode))
> > > + inc = check_props(disp, fdt, subnode, inc);
> > > + }
> > > +
> > >   return inc;
> > >  }
> > >
> > > @@ -955,7 +966,7 @@ static const char usage_sy

Re: [PATCH 09/10] fdtgrep: Allow propagating properties up to supernodes

2024-07-09 Thread Manorit Chawdhry
Hi Simon,

On 09:36-20231217, Simon Glass wrote:
> The existing bootph binding is defined such that properties in a
> subnode are also implied in the supernode also, as in this example:
> 
>buttons {
>   /* bootph,pre-ram is implied by btn1 */
>   compatible = "gpio-keys";
> 
>   btn1 {
>  bootph,pre-ram;
>  gpios = <&gpio_a 3 0>;
>  label = "button1";
>  linux,code = ;
>   };
> 
> Provide an option to implement this in fdtgrep.
> 
> Signed-off-by: Simon Glass 

Coming back to this patch as am facing some issues with the bootph-all
propagation to the parent nodes [0]. We have a dmsc/sms node in our
devices and it is a parent node of k3_pds, k3_clks, k3_reset. 

During U-boot proper we are initializing the serial console and during
that time we have to make some calls to our Device manager for clocks
and power domains. With the DT modelling, the clocks and power domains
come under the device manager node ( dmsc/sms ) but interestingly that
driver is not getting probed while putting bootph-all in the child
nodes. Do you know anything about this? I thought putting it in child
node will propagate it to the parent nodes as well so it'll be probed as
well. We are having to put bootph-all explicitely in the dmsc/sms node
for it to work.

[0]: 
https://lore.kernel.org/linux-arm-kernel/20240705-b4-upstream-bootph-all-v2-0-9007681ed...@ti.com/T/#t

Regards, 
Manorit
> ---
> 
>  tools/fdtgrep.c | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
> index ca639a2d9f4f..f1ff1946bd4a 100644
> --- a/tools/fdtgrep.c
> +++ b/tools/fdtgrep.c
> @@ -63,6 +63,7 @@ struct display_info {
>   int types_inc;  /* Mask of types that we include (FDT_IS...) */
>   int types_exc;  /* Mask of types that we exclude (FDT_IS...) */
>   int invert; /* Invert polarity of match */
> + int props_up;   /* Imply properties up to supernodes */
>   struct value_node *value_head;  /* List of values to match */
>   const char *output_fname;   /* Output filename */
>   FILE *fout; /* File to write dts/dtb output */
> @@ -606,6 +607,16 @@ static int check_props(struct display_info *disp, const 
> void *fdt, int node,
>strlen(str));
>   }
>  
> + /* if requested, check all subnodes for this property too */
> + if (inc != 1 && disp->props_up) {
> + int subnode;
> +
> + for (subnode = fdt_first_subnode(fdt, node);
> +  subnode > 0 && inc != 1;
> +  subnode = fdt_next_subnode(fdt, subnode))
> + inc = check_props(disp, fdt, subnode, inc);
> + }
> +
>   return inc;
>  }
>  
> @@ -955,7 +966,7 @@ static const char usage_synopsis[] =
>   case '?': usage("unknown option");
>  
>  static const char usage_short_opts[] =
> - "haAc:b:C:defg:G:HIlLmn:N:o:O:p:P:rRsStTv"
> + "haAc:b:C:defg:G:HIlLmn:N:o:O:p:P:rRsStTuv"
>   USAGE_COMMON_SHORT_OPTS;
>  static const struct option usage_long_opts[] = {
>   {"show-address",no_argument, NULL, 'a'},
> @@ -985,6 +996,7 @@ static const struct option usage_long_opts[] = {
>   {"skip-supernodes", no_argument, NULL, 'S'},
>   {"show-stringtab",  no_argument, NULL, 't'},
>   {"show-aliases",no_argument, NULL, 'T'},
> + {"props-up-to-supernode", no_argument, NULL, 'u'},
>   {"invert-match",no_argument, NULL, 'v'},
>   USAGE_COMMON_LONG_OPTS,
>  };
> @@ -1016,6 +1028,7 @@ static const char * const usage_opts_help[] = {
>   "Don't include supernodes of matching nodes",
>   "Include string table in binary output",
>   "Include matching aliases in output",
> + "Add -p properties to supernodes too",
>   "Invert the sense of matching (select non-matching lines)",
>   USAGE_COMMON_OPTS_HELP
>  };
> @@ -1202,6 +1215,9 @@ static void scan_args(struct display_info *disp, int 
> argc, char *argv[])
>   case 'T':
>   disp->add_aliases = 1;
>   break;
> + case 'u':
> + disp->props_up = 1;
> + break;
>   case 'v':
>   disp->invert = 1;
>   break;
> -- 
> 2.43.0.472.g3155946c3a-goog
> 


Re: [PATCH] configs: am62x_evm_a53_defconfig: Remove CONFIG_SYS_BOOTM_LEN

2024-07-08 Thread Manorit Chawdhry
Hi Kamlesh,

On 17:20-20240708, Kamlesh Gurudasani wrote:
> Increase the maximum size of the buffer that is used to decompress
> the OS image in to.
> 
> If image size is greater than the buffer, boot
> will fail with following error,
> "Error: inflate() returned -5"
> "gzip compressed: uncompress error -1"
> 
> Default limit for ARM64 platforms is 0x400, remove
> CONFIG_SYS_BOOTM_LEN=0x800, so that it follows default limit.

Why were we failing with a larger buffer size..?

Regards,
Manorit

> 
> Signed-off-by: Kamlesh Gurudasani 
> ---
>  configs/am62x_evm_a53_defconfig | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
> index ca993b427b..dfa5ecc847 100644
> --- a/configs/am62x_evm_a53_defconfig
> +++ b/configs/am62x_evm_a53_defconfig
> @@ -32,7 +32,6 @@ CONFIG_SPL_SPI=y
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
>  CONFIG_BOOTSTD_FULL=y
> -CONFIG_SYS_BOOTM_LEN=0x80
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; bootflow scan -lb"
>  CONFIG_BOARD_LATE_INIT=y
>  CONFIG_SPL_MAX_SIZE=0x58000
> 
> ---
> base-commit: fd46ea0e701920eb205c2bce9d527bf0dec10b59
> change-id: 20240708-remove-bootm-len-ab4e46039656
> 
> Best regards,
> -- 
> Kamlesh Gurudasani 
> 


Re: [PATCH v2 0/4] Fix fdtfile for j722s and am62p

2024-07-01 Thread Manorit Chawdhry
Hi Nishanth,

On 10:23-20240702, Manorit Chawdhry wrote:
> Hi Nishanth,
> 
> On 10:28-20240701, Nishanth Menon wrote:
> > On 10:48-20240701, Manorit Chawdhry wrote:
> > > fdtfile wasn't being populated in these boards, add the code in evm.c
> > > for the same.
> > > 
> > > Signed-off-by: Manorit Chawdhry 
> > > ---
> > > Changes in v2:
> > > - Replace findfdt with fdtfile as that is what the series fixes. 
> > > (Nishanth)
> > > - Drop findfdt as well for K3 platforms legacy support
> > > - Link to v1: 
> > > https://lore.kernel.org/r/20240628-b4-upstream-streamline-platform-v1-0-17659af99...@ti.com
> > > 
> > > ---
> > 
> > 
> > Please explain in your patches the impact the changes have on all
> > platforms - not just TI K3 platforms. that was already asked on previous
> > reviews, please provide the explanations in commit message to prevent
> > folks from having to guess.
> > 
> 
> From my understanding, there should be no impact to any platform with
> these changes, let me know if you notice any platform that is being
> impacted by the following change?
> 
> The way I see it is - 
> 1. It's adding support for populating fdtfile with ti_set_fdt_env for
>j722s, am62p
> 2. It's moving name_fdt change to fdtfile ( as name_fdt is not defined
>anymore - and we need to move away from name_fdt as well due to
>deprecation warning ) in ti/mmc.env.
> 3. ti/mmc.env even though used in k2g devices along with K3, still have
>their own override of the variable that am changing in the common
>ti/mmc.env so should be no-impact.
> 3. Since fdtfile is being set by ti_set_fdt_env for all K3 platforms (
>which are the only users of bootcmd_ti_mmc iiuc ) so we can remove
>findfdt from bootcmd_ti_mmc ( which is still legacy support and not
>used in the default BOOTCOMMAND ). 
> 
> Let me know if am understanding something incorrectly.

With my current understanding, I have rolled a v3 with updated commit
messages, let me know there if you feel am missing something.

Regards,
Manorit

> 
> Regards,
> Manorit
> 
> > > Dhruva Gole (1):
> > >   include: env: ti_common: Remove findfdt
> > > 
> > > Manorit Chawdhry (3):
> > >   include: env: ti: mmc: Change name_fdt usage to fdtfile
> > >   board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile
> > >   configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT
> > > 
> > >  board/ti/am62px/evm.c| 9 +
> > >  board/ti/j722s/evm.c | 9 +
> > >  configs/am62px_evm_a53_defconfig | 1 +
> > >  configs/j722s_evm_a53_defconfig  | 1 +
> > >  include/env/ti/mmc.env   | 2 +-
> > >  include/env/ti/ti_common.env | 2 +-
> > >  6 files changed, 22 insertions(+), 2 deletions(-)
> > > ---
> > > base-commit: 899b088674b6905710ce546f0a8848662904852a
> > > change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2
> > > 
> > > Best regards,
> > > -- 
> > > Manorit Chawdhry 
> > > 
> > 
> > -- 
> > Regards,
> > Nishanth Menon
> > Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> > 849D 1736 249D


[PATCH v3 4/4] include: env: ti_common: Remove findfdt from bootcmd_ti_mmc

2024-07-01 Thread Manorit Chawdhry
From: Dhruva Gole 

findfdt is used by bootcmd_ti_mmc by default which used to help populate
the fdtfile. The users of findfdt from bootcmd_ti_mmc have migrated to
ti_set_fdt_env for populating fdtfile; Hence, findfdt can be removed from
bootcmd_ti_mmc having no-impact for any platform.

Remove findfdt to not print out the warning that gets set after calling
ti_set_fdt_env. viz.
"echo WARN: fdtfile already set. Stop using findfdt in script"

Signed-off-by: Dhruva Gole 
Signed-off-by: Manorit Chawdhry 
---
 include/env/ti/ti_common.env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/env/ti/ti_common.env b/include/env/ti/ti_common.env
index c5c36421770c..7029d12bf203 100644
--- a/include/env/ti/ti_common.env
+++ b/include/env/ti/ti_common.env
@@ -25,7 +25,7 @@ get_fit_config=setexpr name_fit_config gsub / _ 
conf-${fdtfile}
 run_fit=run get_fit_config; bootm 
${addr_fit}#${name_fit_config}${overlaystring}
 do_main_cpsw0_qsgmii_phyinit=0
 bootcmd_ti_mmc=
-   run findfdt; run init_${boot};
+   run init_${boot};
 #if CONFIG_CMD_REMOTEPROC
if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1;
then run main_cpsw0_qsgmii_phyinit;

-- 
2.45.1



[PATCH v3 3/4] include: env: ti: mmc: Change name_fdt usage to fdtfile

2024-07-01 Thread Manorit Chawdhry
name_fdt is kept for backward compatibility but it depends on EEPROM
detection logic and some of the TI K3 platforms don't have that anymore
which causes boot failure in legacy boot flow using bootcmd_ti_mmc.

K2g platforms which uses the same file have their own override causing
this change to be no-impact for them.

Replacing name_fdt usage to fdtfile as fdtfile is populated based on
CONFIG_DEFAULT_DEVICE_TREE after using ti_set_fdt_env.

Signed-off-by: Manorit Chawdhry 
---
 include/env/ti/mmc.env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env
index 0256a2d2aaca..037a09010ce4 100644
--- a/include/env/ti/mmc.env
+++ b/include/env/ti/mmc.env
@@ -16,7 +16,7 @@ importbootenv=echo Importing environment from mmc${mmcdev} 
...;
 loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
 loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
 loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
-get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt}
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
 envboot=if mmc dev ${mmcdev}; then
if mmc rescan; then
echo SD/MMC found on device ${mmcdev};

-- 
2.45.1



[PATCH v3 2/4] configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT

2024-07-01 Thread Manorit Chawdhry
This is called to set fdtfile based on evm.c code calling ti_set_fdt_env.

Signed-off-by: Manorit Chawdhry 
---
 configs/am62px_evm_a53_defconfig | 1 +
 configs/j722s_evm_a53_defconfig  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index e1c9c8535e43..87005d03dee3 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
diff --git a/configs/j722s_evm_a53_defconfig b/configs/j722s_evm_a53_defconfig
index da0e9f4d524d..1675cedb25ef 100644
--- a/configs/j722s_evm_a53_defconfig
+++ b/configs/j722s_evm_a53_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y

-- 
2.45.1



[PATCH v3 1/4] board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile

2024-07-01 Thread Manorit Chawdhry
stdboot and legacy boot depend on fdtfile. Since findfdt is getting
deprecated, move the rest of k3 platforms dependent on findfdt to
ti_set_fdt_env.

Populate fdtfile by calling ti_set_fdt_env in board files.

Signed-off-by: Manorit Chawdhry 
---
 board/ti/am62px/evm.c | 9 +
 board/ti/j722s/evm.c  | 9 +
 2 files changed, 18 insertions(+)

diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 1a2c46c462b4..7362fa4520a3 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include "../common/fdt_ops.h"
 
 struct efi_fw_image fw_images[] = {
{
@@ -61,3 +62,11 @@ int dram_init_banksize(void)
 {
return fdtdec_setup_memory_banksize();
 }
+
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+   ti_set_fdt_env(NULL, NULL);
+   return 0;
+}
+#endif
diff --git a/board/ti/j722s/evm.c b/board/ti/j722s/evm.c
index 515aaa818783..29e06a5442fe 100644
--- a/board/ti/j722s/evm.c
+++ b/board/ti/j722s/evm.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include "../common/fdt_ops.h"
 
 int board_init(void)
 {
@@ -27,3 +28,11 @@ int dram_init_banksize(void)
 {
return fdtdec_setup_memory_banksize();
 }
+
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+   ti_set_fdt_env(NULL, NULL);
+   return 0;
+}
+#endif

-- 
2.45.1



[PATCH v3 0/4] Fix fdtfile for j722s and am62p

2024-07-01 Thread Manorit Chawdhry
fdtfile wasn't being populated in these boards in legacy boot using
bootcmd_ti_mmc, migrate these platforms to ti_set_fdt_env.

Signed-off-by: Manorit Chawdhry 
---
Changes in v3:
- Update the commit messages to make the change more clear.
- Link to v2: 
https://lore.kernel.org/r/20240701-b4-upstream-streamline-platform-v2-0-7539ff066...@ti.com

---
Dhruva Gole (1):
  include: env: ti_common: Remove findfdt from bootcmd_ti_mmc

Manorit Chawdhry (3):
  board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile
  configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT
  include: env: ti: mmc: Change name_fdt usage to fdtfile

 board/ti/am62px/evm.c| 9 +
 board/ti/j722s/evm.c | 9 +
 configs/am62px_evm_a53_defconfig | 1 +
 configs/j722s_evm_a53_defconfig  | 1 +
 include/env/ti/mmc.env   | 2 +-
 include/env/ti/ti_common.env | 2 +-
 6 files changed, 22 insertions(+), 2 deletions(-)
---
base-commit: 899b088674b6905710ce546f0a8848662904852a
change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH v2 0/4] Fix fdtfile for j722s and am62p

2024-07-01 Thread Manorit Chawdhry
Hi Nishanth,

On 10:28-20240701, Nishanth Menon wrote:
> On 10:48-20240701, Manorit Chawdhry wrote:
> > fdtfile wasn't being populated in these boards, add the code in evm.c
> > for the same.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> > Changes in v2:
> > - Replace findfdt with fdtfile as that is what the series fixes. (Nishanth)
> > - Drop findfdt as well for K3 platforms legacy support
> > - Link to v1: 
> > https://lore.kernel.org/r/20240628-b4-upstream-streamline-platform-v1-0-17659af99...@ti.com
> > 
> > ---
> 
> 
> Please explain in your patches the impact the changes have on all
> platforms - not just TI K3 platforms. that was already asked on previous
> reviews, please provide the explanations in commit message to prevent
> folks from having to guess.
> 

>From my understanding, there should be no impact to any platform with
these changes, let me know if you notice any platform that is being
impacted by the following change?

The way I see it is - 
1. It's adding support for populating fdtfile with ti_set_fdt_env for
   j722s, am62p
2. It's moving name_fdt change to fdtfile ( as name_fdt is not defined
   anymore - and we need to move away from name_fdt as well due to
   deprecation warning ) in ti/mmc.env.
3. ti/mmc.env even though used in k2g devices along with K3, still have
   their own override of the variable that am changing in the common
   ti/mmc.env so should be no-impact.
3. Since fdtfile is being set by ti_set_fdt_env for all K3 platforms (
   which are the only users of bootcmd_ti_mmc iiuc ) so we can remove
   findfdt from bootcmd_ti_mmc ( which is still legacy support and not
   used in the default BOOTCOMMAND ). 

Let me know if am understanding something incorrectly.

Regards,
Manorit

> > Dhruva Gole (1):
> >   include: env: ti_common: Remove findfdt
> > 
> > Manorit Chawdhry (3):
> >   include: env: ti: mmc: Change name_fdt usage to fdtfile
> >   board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile
> >   configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT
> > 
> >  board/ti/am62px/evm.c| 9 +
> >  board/ti/j722s/evm.c | 9 +
> >  configs/am62px_evm_a53_defconfig | 1 +
> >  configs/j722s_evm_a53_defconfig  | 1 +
> >  include/env/ti/mmc.env   | 2 +-
> >  include/env/ti/ti_common.env | 2 +-
> >  6 files changed, 22 insertions(+), 2 deletions(-)
> > ---
> > base-commit: 899b088674b6905710ce546f0a8848662904852a
> > change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2
> > 
> > Best regards,
> > -- 
> > Manorit Chawdhry 
> > 
> 
> -- 
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> 849D 1736 249D


[PATCH v2 4/4] include: env: ti_common: Remove findfdt

2024-06-30 Thread Manorit Chawdhry
From: Dhruva Gole 

findfdt is the legacy approach to find fdt and platforms have moved away
from this and don't define this anymore. This causes an error that may
seem alarming but is harmless. Remove it from the bootcmd_ti_mmc to
avoid any panic and confusion.

Signed-off-by: Dhruva Gole 
Signed-off-by: Manorit Chawdhry 
---
 include/env/ti/ti_common.env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/env/ti/ti_common.env b/include/env/ti/ti_common.env
index c5c36421770c..7029d12bf203 100644
--- a/include/env/ti/ti_common.env
+++ b/include/env/ti/ti_common.env
@@ -25,7 +25,7 @@ get_fit_config=setexpr name_fit_config gsub / _ 
conf-${fdtfile}
 run_fit=run get_fit_config; bootm 
${addr_fit}#${name_fit_config}${overlaystring}
 do_main_cpsw0_qsgmii_phyinit=0
 bootcmd_ti_mmc=
-   run findfdt; run init_${boot};
+   run init_${boot};
 #if CONFIG_CMD_REMOTEPROC
if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1;
then run main_cpsw0_qsgmii_phyinit;

-- 
2.45.1



[PATCH v2 3/4] configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT

2024-06-30 Thread Manorit Chawdhry
This is called to set fdtfile after the board is initialized.

Signed-off-by: Manorit Chawdhry 
---
 configs/am62px_evm_a53_defconfig | 1 +
 configs/j722s_evm_a53_defconfig  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index e1c9c8535e43..87005d03dee3 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
diff --git a/configs/j722s_evm_a53_defconfig b/configs/j722s_evm_a53_defconfig
index da0e9f4d524d..1675cedb25ef 100644
--- a/configs/j722s_evm_a53_defconfig
+++ b/configs/j722s_evm_a53_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y

-- 
2.45.1



[PATCH v2 2/4] board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile

2024-06-30 Thread Manorit Chawdhry
stdboot and legacy boot now depend on fdtfile and fdtfile is populated
based on evm code now. Populate fdtfile by calling ti_set_fdt_env in
board files.

Signed-off-by: Manorit Chawdhry 
---
 board/ti/am62px/evm.c | 9 +
 board/ti/j722s/evm.c  | 9 +
 2 files changed, 18 insertions(+)

diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 1a2c46c462b4..7362fa4520a3 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include "../common/fdt_ops.h"
 
 struct efi_fw_image fw_images[] = {
{
@@ -61,3 +62,11 @@ int dram_init_banksize(void)
 {
return fdtdec_setup_memory_banksize();
 }
+
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+   ti_set_fdt_env(NULL, NULL);
+   return 0;
+}
+#endif
diff --git a/board/ti/j722s/evm.c b/board/ti/j722s/evm.c
index 515aaa818783..29e06a5442fe 100644
--- a/board/ti/j722s/evm.c
+++ b/board/ti/j722s/evm.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include "../common/fdt_ops.h"
 
 int board_init(void)
 {
@@ -27,3 +28,11 @@ int dram_init_banksize(void)
 {
return fdtdec_setup_memory_banksize();
 }
+
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+   ti_set_fdt_env(NULL, NULL);
+   return 0;
+}
+#endif

-- 
2.45.1



[PATCH v2 1/4] include: env: ti: mmc: Change name_fdt usage to fdtfile

2024-06-30 Thread Manorit Chawdhry
name_fdt is kept for backward compatibility but it depends on EEPROM
detection logic and some of the platforms like J7AHP/AM69 don't have
that anymore which causes boot failure.

Replacing name_fdt usage to fdtfile as fdtfile is populated based on
CONFIG_DEFAULT_DEVICE_TREE.

Signed-off-by: Manorit Chawdhry 
---
 include/env/ti/mmc.env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env
index 0256a2d2aaca..037a09010ce4 100644
--- a/include/env/ti/mmc.env
+++ b/include/env/ti/mmc.env
@@ -16,7 +16,7 @@ importbootenv=echo Importing environment from mmc${mmcdev} 
...;
 loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
 loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
 loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
-get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt}
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
 envboot=if mmc dev ${mmcdev}; then
if mmc rescan; then
echo SD/MMC found on device ${mmcdev};

-- 
2.45.1



[PATCH v2 0/4] Fix fdtfile for j722s and am62p

2024-06-30 Thread Manorit Chawdhry
fdtfile wasn't being populated in these boards, add the code in evm.c
for the same.

Signed-off-by: Manorit Chawdhry 
---
Changes in v2:
- Replace findfdt with fdtfile as that is what the series fixes. (Nishanth)
- Drop findfdt as well for K3 platforms legacy support
- Link to v1: 
https://lore.kernel.org/r/20240628-b4-upstream-streamline-platform-v1-0-17659af99...@ti.com

---
Dhruva Gole (1):
  include: env: ti_common: Remove findfdt

Manorit Chawdhry (3):
  include: env: ti: mmc: Change name_fdt usage to fdtfile
  board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile
  configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT

 board/ti/am62px/evm.c| 9 +
 board/ti/j722s/evm.c | 9 +
 configs/am62px_evm_a53_defconfig | 1 +
 configs/j722s_evm_a53_defconfig  | 1 +
 include/env/ti/mmc.env   | 2 +-
 include/env/ti/ti_common.env | 2 +-
 6 files changed, 22 insertions(+), 2 deletions(-)
---
base-commit: 899b088674b6905710ce546f0a8848662904852a
change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH 1/3] include: env: ti: mmc: Change name_fdt usage to fdtfile

2024-06-30 Thread Manorit Chawdhry
Hi Nishanth,

On 08:05-20240628, Nishanth Menon wrote:
> On 13:53-20240628, Manorit Chawdhry wrote:
> > name_fdt is kept for backward compatibility but it depends on EEPROM
> > detection logic and some of the platforms like J7AHP/AM69 don't have
> > that anymore which causes boot failure.
> > 
> > Replacing name_fdt usage to fdtfile as fdtfile is populated based on
> > CONFIG_DEFAULT_DEVICE_TREE.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> >  include/env/ti/mmc.env | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env
> > index 0256a2d2aaca..037a09010ce4 100644
> > --- a/include/env/ti/mmc.env
> > +++ b/include/env/ti/mmc.env
> > @@ -16,7 +16,7 @@ importbootenv=echo Importing environment from 
> > mmc${mmcdev} ...;
> >  loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
> >  loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
> >  loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
> > -get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt}
> > +get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
> 
> Did you check the other users of mmc.env file? How about legacy boards like 
> k2g?

Am not sure about the status of migration to ti_set_fdt_env for k2g
platforms. Though I see k2g redefining get_fdt_mmc with name_fdt itself
so hoping that this change wouldn't affect them. If they also migrate to
ti_set_fdt_env then I think for them also this change would work and the
override can be deleted later.

Regards,
Manorit

> 
> >  envboot=if mmc dev ${mmcdev}; then
> > if mmc rescan; then
> > echo SD/MMC found on device ${mmcdev};
> > 
> > -- 
> > 2.45.1
> > 
> 
> -- 
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> 849D 1736 249D


Re: [PATCH 0/3] Fix findfdt for j722s and am62p

2024-06-30 Thread Manorit Chawdhry
Hi Nishanth,

On 08:06-20240628, Nishanth Menon wrote:
> On 13:53-20240628, Manorit Chawdhry wrote:
> > findfdt wasn't being populated in these boards, add the code in evm.c
> > for the same.
> 
> why not just drop findfdt? I am ok with #2,3 more or less, but keeping

typo... should've written fdtfile. When all the boards migrate to your
series for pulling in fdtfile from ti_set_fdt_env itself, I think findfdt can
be dropped for k3 boards at that point. This series moves am62px and
j722s to that.

Regards,
Manorit

> findfdt alive is just a bad direction when we are moving to stdboot
> flow.
> 
> 
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> > Manorit Chawdhry (3):
> >   include: env: ti: mmc: Change name_fdt usage to fdtfile
> >   board: ti: am62p|j722s: Add ti_set_fdt_env for findfdt
> >   configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT
> > 
> >  board/ti/am62px/evm.c| 9 +
> >  board/ti/j722s/evm.c | 9 +
> >  configs/am62px_evm_a53_defconfig | 1 +
> >  configs/j722s_evm_a53_defconfig  | 1 +
> >  include/env/ti/mmc.env   | 2 +-
> >  5 files changed, 21 insertions(+), 1 deletion(-)
> > ---
> > base-commit: 899b088674b6905710ce546f0a8848662904852a
> > change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2
> > 
> > Best regards,
> > -- 
> > Manorit Chawdhry 
> > 
> 
> -- 
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> 849D 1736 249D


[PATCH 3/3] configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT

2024-06-28 Thread Manorit Chawdhry
This is called to set findfdt after the board is initialized.

Signed-off-by: Manorit Chawdhry 
---
 configs/am62px_evm_a53_defconfig | 1 +
 configs/j722s_evm_a53_defconfig  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
index e1c9c8535e43..87005d03dee3 100644
--- a/configs/am62px_evm_a53_defconfig
+++ b/configs/am62px_evm_a53_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
diff --git a/configs/j722s_evm_a53_defconfig b/configs/j722s_evm_a53_defconfig
index da0e9f4d524d..1675cedb25ef 100644
--- a/configs/j722s_evm_a53_defconfig
+++ b/configs/j722s_evm_a53_defconfig
@@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y

-- 
2.45.1



[PATCH 2/3] board: ti: am62p|j722s: Add ti_set_fdt_env for findfdt

2024-06-28 Thread Manorit Chawdhry
stdboot and legacy boot now depend on findfdt and findfdt is populated
based on evm code now. Populate findfdt by calling ti_set_fdt_env in
board files.

Signed-off-by: Manorit Chawdhry 
---
 board/ti/am62px/evm.c | 9 +
 board/ti/j722s/evm.c  | 9 +
 2 files changed, 18 insertions(+)

diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 1a2c46c462b4..7362fa4520a3 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include "../common/fdt_ops.h"
 
 struct efi_fw_image fw_images[] = {
{
@@ -61,3 +62,11 @@ int dram_init_banksize(void)
 {
return fdtdec_setup_memory_banksize();
 }
+
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+   ti_set_fdt_env(NULL, NULL);
+   return 0;
+}
+#endif
diff --git a/board/ti/j722s/evm.c b/board/ti/j722s/evm.c
index 515aaa818783..29e06a5442fe 100644
--- a/board/ti/j722s/evm.c
+++ b/board/ti/j722s/evm.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include "../common/fdt_ops.h"
 
 int board_init(void)
 {
@@ -27,3 +28,11 @@ int dram_init_banksize(void)
 {
return fdtdec_setup_memory_banksize();
 }
+
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+   ti_set_fdt_env(NULL, NULL);
+   return 0;
+}
+#endif

-- 
2.45.1



[PATCH 1/3] include: env: ti: mmc: Change name_fdt usage to fdtfile

2024-06-28 Thread Manorit Chawdhry
name_fdt is kept for backward compatibility but it depends on EEPROM
detection logic and some of the platforms like J7AHP/AM69 don't have
that anymore which causes boot failure.

Replacing name_fdt usage to fdtfile as fdtfile is populated based on
CONFIG_DEFAULT_DEVICE_TREE.

Signed-off-by: Manorit Chawdhry 
---
 include/env/ti/mmc.env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env
index 0256a2d2aaca..037a09010ce4 100644
--- a/include/env/ti/mmc.env
+++ b/include/env/ti/mmc.env
@@ -16,7 +16,7 @@ importbootenv=echo Importing environment from mmc${mmcdev} 
...;
 loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
 loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
 loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
-get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt}
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
 envboot=if mmc dev ${mmcdev}; then
if mmc rescan; then
echo SD/MMC found on device ${mmcdev};

-- 
2.45.1



[PATCH 0/3] Fix findfdt for j722s and am62p

2024-06-28 Thread Manorit Chawdhry
findfdt wasn't being populated in these boards, add the code in evm.c
for the same.

Signed-off-by: Manorit Chawdhry 
---
Manorit Chawdhry (3):
  include: env: ti: mmc: Change name_fdt usage to fdtfile
  board: ti: am62p|j722s: Add ti_set_fdt_env for findfdt
  configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT

 board/ti/am62px/evm.c| 9 +
 board/ti/j722s/evm.c | 9 +
 configs/am62px_evm_a53_defconfig | 1 +
 configs/j722s_evm_a53_defconfig  | 1 +
 include/env/ti/mmc.env   | 2 +-
 5 files changed, 21 insertions(+), 1 deletion(-)
---
base-commit: 899b088674b6905710ce546f0a8848662904852a
change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH v3] arm: dts: k3-am625-beagleplay: Add symlinks for tiboot3 and tispl

2024-06-16 Thread Manorit Chawdhry
Hi Dhruva,

On 17:34-20240614, Dhruva Gole wrote:
> Add symlinks for both tiboot3.bin and tispl.bin because a user has to
> anyway rename these files to get the platform to boot up.
> This just makes it more intuitive and convenient.
> 
> Signed-off-by: Dhruva Gole 
> ---
> 
> This is just a RESEND of v1, because the changes in v2 were not
> required. Link to previous revision:
> https://lore.kernel.org/u-boot/20240614115340.4091211-1-d-g...@ti.com/

Didn't realise that u-boot.img comes by itself from the core framework
itself. Thanks for re-sending v1.

Reviewed-by: Manorit Chawdhry 

Regards,
Manorit

> 
> 
>  arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 1 +
>  arch/arm/dts/k3-am625-r5-beagleplay.dts  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi 
> b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
> index fb2032068d1c..bd48af8d186a 100644
> --- a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
> +++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
> @@ -71,6 +71,7 @@
>  
>   ti-spl_unsigned {
>   filename = "tispl.bin_unsigned";
> + symlink = "tispl.bin";
>   pad-byte = <0xff>;
>  
>   fit {
> diff --git a/arch/arm/dts/k3-am625-r5-beagleplay.dts 
> b/arch/arm/dts/k3-am625-r5-beagleplay.dts
> index 9db58f093c8c..da6746e009d5 100644
> --- a/arch/arm/dts/k3-am625-r5-beagleplay.dts
> +++ b/arch/arm/dts/k3-am625-r5-beagleplay.dts
> @@ -79,6 +79,7 @@
>  &binman {
>   tiboot3-am62x-gp-evm.bin {
>   filename = "tiboot3-am62x-gp-evm.bin";
> + symlink = "tiboot3.bin";
>   ti-secure-rom {
>   content = <&u_boot_spl_unsigned>, <&ti_fs_gp>,
>   <&combined_tifs_cfg_gp>, <&combined_dm_cfg_gp>;
> 
> base-commit: 1ebd659cf020843fd8e8ef90d85a66941cbab6ec
> -- 
> 2.34.1
> 


Re: [PATCH] arm: dts: k3-am625-beagleplay: Add symlinks for tiboot3 and tispl

2024-06-14 Thread Manorit Chawdhry
Hi Dhruva,

On 14:10-20240614, Dhruva Gole wrote:
> Add symlinks for both tiboot3.bin and tispl.bin because a user has to
> anyway rename these files to get the platform to boot up.
> This just makes it more intuitive and convenient.
> 
> Signed-off-by: Dhruva Gole 
> ---
>  arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 1 +
>  arch/arm/dts/k3-am625-r5-beagleplay.dts  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi 
> b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
> index fb2032068d1c..bd48af8d186a 100644
> --- a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
> +++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi
> @@ -71,6 +71,7 @@
>  
>   ti-spl_unsigned {
>   filename = "tispl.bin_unsigned";
> + symlink = "tispl.bin";
>   pad-byte = <0xff>;
>  
>   fit {
> diff --git a/arch/arm/dts/k3-am625-r5-beagleplay.dts 
> b/arch/arm/dts/k3-am625-r5-beagleplay.dts
> index 9db58f093c8c..da6746e009d5 100644
> --- a/arch/arm/dts/k3-am625-r5-beagleplay.dts
> +++ b/arch/arm/dts/k3-am625-r5-beagleplay.dts
> @@ -79,6 +79,7 @@
>  &binman {
>   tiboot3-am62x-gp-evm.bin {
>   filename = "tiboot3-am62x-gp-evm.bin";
> + symlink = "tiboot3.bin";
>   ti-secure-rom {
>   content = <&u_boot_spl_unsigned>, <&ti_fs_gp>,
>   <&combined_tifs_cfg_gp>, <&combined_dm_cfg_gp>;

Maybe do it for u-boot.img_unsigned as well, I see that also doesn't have a
symlink.

Regards,
Manorit

> 
> base-commit: 1ebd659cf020843fd8e8ef90d85a66941cbab6ec
> -- 
> 2.34.1
> 


[PATCH v3 4/4] configs: j721s2_evm_*_defconfig: Enable OSPI configs

2024-06-03 Thread Manorit Chawdhry
Enable OSPI related configs to boot using OSPI

Reviewed-by: Apurva Nandan 
Signed-off-by: Manorit Chawdhry 
---
 configs/j721s2_evm_a72_defconfig | 1 +
 configs/j721s2_evm_r5_defconfig  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 5ed8d00662e3..5c3b52baaee7 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -10,6 +10,7 @@ CONFIG_SOC_K3_J721S2=y
 CONFIG_TARGET_J721S2_A72_EVM=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x8048
+CONFIG_SF_DEFAULT_SPEED=2500
 CONFIG_ENV_SIZE=0x2
 CONFIG_DM_GPIO=y
 CONFIG_SPL_DM_SPI=y
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index 3c958cafbe8f..7413ddd08106 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -10,6 +10,7 @@ CONFIG_K3_EARLY_CONS=y
 CONFIG_TARGET_J721S2_R5_EVM=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c76000
+CONFIG_SF_DEFAULT_SPEED=2500
 CONFIG_ENV_SIZE=0x2
 CONFIG_DM_GPIO=y
 CONFIG_SPL_DM_SPI=y

-- 
2.45.1



[PATCH v3 3/4] arch: arm: dts: k3-j721s2-*-u-boot.dtsi: Enable the ospi0 node

2024-06-03 Thread Manorit Chawdhry
Enable ospi0 node for all boot stages

Reviewed-by: Apurva Nandan 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi 
b/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi
index 91a82b3b7ca6..54eb9b4072c7 100644
--- a/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi
@@ -102,7 +102,9 @@
 };
 
 &ospi0 {
-   status = "disabled";
+   flash@0 {
+   bootph-all;
+   };
 };
 
 &ospi1 {

-- 
2.45.1



[PATCH v3 2/4] arch: arm: dts: k3-j721s2-r5: Override ospi and fss for 32-bit mode

2024-06-03 Thread Manorit Chawdhry
R5 being a 32-bit processor can't understand the 64-bit mapping being
done in ospi node. Override the ospi node for 32-bit register ranges and
the fss node ( the parent node of ospi ) to map the ranges for the
updated child node correctly.

Reviewed-by: Apurva Nandan 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-j721s2-r5.dtsi | 13 +
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/dts/k3-j721s2-r5.dtsi b/arch/arm/dts/k3-j721s2-r5.dtsi
index eb0df42583a3..dbea6b9d0113 100644
--- a/arch/arm/dts/k3-j721s2-r5.dtsi
+++ b/arch/arm/dts/k3-j721s2-r5.dtsi
@@ -79,3 +79,16 @@
 &mcu_udmap {
ti,sci = <&dm_tifs>;
 };
+
+&ospi0 {
+   reg = <0x0 0x4704 0x0 0x100>,
+ <0x0 0x5000 0x0 0x800>;
+};
+
+&fss {
+   /* fss node has 64 bit address regions mapped to it and since the ospi
+* nodes is being override, override the fss node ranges as well
+*/
+   ranges = <0x0 0x4700 0x0 0x4700 0x0 0x00068400>,
+<0x0 0x5000 0x0 0x5000 0x0 0x0800>;
+};

-- 
2.45.1



[PATCH v3 1/4] mtd: spi-nor-core: Do not start or end writes at odd address in DTR mode

2024-06-03 Thread Manorit Chawdhry
From: Pratyush Yadav 

On DTR capable flashes like Micron Xcella the writes cannot start or end
at an odd address in DTR mode. Extra 0xff bytes need to be prepended or
appended respectively to make sure both the start and end addresses are
even.

Signed-off-by: Pratyush Yadav 
Signed-off-by: Apurva Nandan 
Signed-off-by: Vignesh Raghavendra 
Tested-by: Jonathan Humphreys 
Signed-off-by: Manorit Chawdhry 
---
 drivers/mtd/spi/spi-nor-core.c | 59 +++---
 1 file changed, 55 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 982dd251150d..aea611fef523 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -1804,11 +1804,62 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t 
to, size_t len,
if (ret < 0)
return ret;
 #endif
+
write_enable(nor);
-   ret = nor->write(nor, addr, page_remain, buf + i);
-   if (ret < 0)
-   goto write_err;
-   written = ret;
+
+   /*
+* On DTR capable flashes like Micron Xcella the writes cannot
+* start or end at an odd address in DTR mode. So we need to
+* append or prepend extra 0xff bytes to make sure the start
+* address and end address are even.
+*/
+   if (spi_nor_protocol_is_dtr(nor->write_proto) &&
+   ((addr | page_remain) & 1)) {
+   u_char *tmp;
+   size_t extra_bytes = 0;
+
+   tmp = kmalloc(nor->page_size, 0);
+   if (!tmp) {
+   ret = -ENOMEM;
+   goto write_err;
+   }
+
+   /* Prepend a 0xff byte if the start address is odd. */
+   if (addr & 1) {
+   tmp[0] = 0xff;
+   memcpy(tmp + 1, buf + i, page_remain);
+   addr--;
+   page_remain++;
+   extra_bytes++;
+   } else {
+   memcpy(tmp, buf + i, page_remain);
+   }
+
+   /* Append a 0xff byte if the end address is odd. */
+   if ((addr + page_remain) & 1) {
+   tmp[page_remain + extra_bytes] = 0xff;
+   extra_bytes++;
+   page_remain++;
+   }
+
+   ret = nor->write(nor, addr, page_remain, tmp);
+
+   kfree(tmp);
+
+   if (ret < 0)
+   goto write_err;
+
+   /*
+* We write extra bytes but they are not part of the
+* original write.
+*/
+   written = ret - extra_bytes;
+   } else {
+   ret = nor->write(nor, addr, page_remain, buf + i);
+   if (ret < 0)
+   goto write_err;
+   written = ret;
+   }
 
ret = spi_nor_wait_till_ready(nor);
if (ret)

-- 
2.45.1



[PATCH v3 0/4] Enable OSPI boot for j721s2

2024-06-03 Thread Manorit Chawdhry
The series enables ospi boot for j721s2.

Test logs: https://gist.github.com/manorit2001/6bb91885c608e3a8cb0267ab2c614781

Signed-off-by: Manorit Chawdhry 
---
Changes in v3:
- Rebase on top of -next
- Remove SF_DEFAULT_MODE as it's default 0
- Add new properties in correct location as per savedefconfig
- Link to v2: 
https://lore.kernel.org/r/20240528-b4-upstream-j721s2-ospi-support-v2-0-b2e372ebc...@ti.com

---
Manorit Chawdhry (3):
  arch: arm: dts: k3-j721s2-r5: Override ospi and fss for 32-bit mode
  arch: arm: dts: k3-j721s2-*-u-boot.dtsi: Enable the ospi0 node
  configs: j721s2_evm_*_defconfig: Enable OSPI configs

Pratyush Yadav (1):
  mtd: spi-nor-core: Do not start or end writes at odd address in DTR mode

 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|  4 +-
 arch/arm/dts/k3-j721s2-r5.dtsi | 13 +
 configs/j721s2_evm_a72_defconfig   |  1 +
 configs/j721s2_evm_r5_defconfig|  1 +
 drivers/mtd/spi/spi-nor-core.c | 59 --
 5 files changed, 73 insertions(+), 5 deletions(-)
---
base-commit: 15d0dcc0ec1f424199dff2a3cbe037bc3a7d8749
change-id: 20240322-b4-upstream-j721s2-ospi-support-d45dfaa926dc

Best regards,
-- 
Manorit Chawdhry 



[PATCH v2 4/4] configs: j721s2_evm_*_defconfig: Enable OSPI configs

2024-05-28 Thread Manorit Chawdhry
Enable OSPI related configs to boot using OSPI

Reviewed-by: Apurva Nandan 
Signed-off-by: Manorit Chawdhry 
---
 configs/j721s2_evm_a72_defconfig | 3 +++
 configs/j721s2_evm_r5_defconfig  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 5ed8d00662e3..326beedea411 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -51,6 +51,7 @@ CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
 CONFIG_SPL_I2C=y
 CONFIG_SPL_DM_MAILBOX=y
 CONFIG_SPL_MTD=y
+CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_NOR_SUPPORT=y
 CONFIG_SPL_DM_RESET=y
@@ -59,6 +60,8 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 # CONFIG_SPL_SPI_FLASH_TINY is not set
 CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SF_DEFAULT_MODE=0
+CONFIG_SF_DEFAULT_SPEED=2500
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x28
 CONFIG_SPL_THERMAL=y
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index 3c958cafbe8f..4039841488f9 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -57,6 +57,7 @@ CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_DM_MAILBOX=y
 CONFIG_SPL_MTD=y
+CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_NOR_SUPPORT=y
 CONFIG_SPL_DM_RESET=y
@@ -66,6 +67,8 @@ CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_REMOTEPROC=y
 # CONFIG_SPL_SPI_FLASH_TINY is not set
 CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SF_DEFAULT_MODE=0
+CONFIG_SF_DEFAULT_SPEED=2500
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x8
 CONFIG_SPL_THERMAL=y

-- 
2.43.2



[PATCH v2 0/4] Enable OSPI boot for j721s2

2024-05-28 Thread Manorit Chawdhry
The series enables ospi boot for j721s2.

Test logs: https://gist.github.com/manorit2001/6bb91885c608e3a8cb0267ab2c614781

Signed-off-by: Manorit Chawdhry 
---
Changes in v2:
- Rebase on top of -next
- Link to v1: 
https://lore.kernel.org/r/20240401-b4-upstream-j721s2-ospi-support-v1-0-20e4a0024...@ti.com

---
Manorit Chawdhry (3):
  arch: arm: dts: k3-j721s2-r5: Override ospi and fss for 32-bit mode
  arch: arm: dts: k3-j721s2-*-u-boot.dtsi: Enable the ospi0 node
  configs: j721s2_evm_*_defconfig: Enable OSPI configs

Pratyush Yadav (1):
  mtd: spi-nor-core: Do not start or end writes at odd address in DTR mode

 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|  4 +-
 arch/arm/dts/k3-j721s2-r5.dtsi | 13 +
 configs/j721s2_evm_a72_defconfig   |  3 ++
 configs/j721s2_evm_r5_defconfig|  3 ++
 drivers/mtd/spi/spi-nor-core.c | 59 --
 5 files changed, 77 insertions(+), 5 deletions(-)
---
base-commit: 377e91c162ab09ec20f96f966f380cb55c590edd
change-id: 20240322-b4-upstream-j721s2-ospi-support-d45dfaa926dc

Best regards,
-- 
Manorit Chawdhry 



[PATCH v2 3/4] arch: arm: dts: k3-j721s2-*-u-boot.dtsi: Enable the ospi0 node

2024-05-28 Thread Manorit Chawdhry
Enable ospi0 node for all boot stages

Reviewed-by: Apurva Nandan 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi 
b/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi
index 91a82b3b7ca6..54eb9b4072c7 100644
--- a/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi
@@ -102,7 +102,9 @@
 };
 
 &ospi0 {
-   status = "disabled";
+   flash@0 {
+   bootph-all;
+   };
 };
 
 &ospi1 {

-- 
2.43.2



[PATCH v2 2/4] arch: arm: dts: k3-j721s2-r5: Override ospi and fss for 32-bit mode

2024-05-28 Thread Manorit Chawdhry
R5 being a 32-bit processor can't understand the 64-bit mapping being
done in ospi node. Override the ospi node for 32-bit register ranges and
the fss node ( the parent node of ospi ) to map the ranges for the
updated child node correctly.

Reviewed-by: Apurva Nandan 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-j721s2-r5.dtsi | 13 +
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/dts/k3-j721s2-r5.dtsi b/arch/arm/dts/k3-j721s2-r5.dtsi
index eb0df42583a3..dbea6b9d0113 100644
--- a/arch/arm/dts/k3-j721s2-r5.dtsi
+++ b/arch/arm/dts/k3-j721s2-r5.dtsi
@@ -79,3 +79,16 @@
 &mcu_udmap {
ti,sci = <&dm_tifs>;
 };
+
+&ospi0 {
+   reg = <0x0 0x4704 0x0 0x100>,
+ <0x0 0x5000 0x0 0x800>;
+};
+
+&fss {
+   /* fss node has 64 bit address regions mapped to it and since the ospi
+* nodes is being override, override the fss node ranges as well
+*/
+   ranges = <0x0 0x4700 0x0 0x4700 0x0 0x00068400>,
+<0x0 0x5000 0x0 0x5000 0x0 0x0800>;
+};

-- 
2.43.2



[PATCH v2 1/4] mtd: spi-nor-core: Do not start or end writes at odd address in DTR mode

2024-05-28 Thread Manorit Chawdhry
From: Pratyush Yadav 

On DTR capable flashes like Micron Xcella the writes cannot start or end
at an odd address in DTR mode. Extra 0xff bytes need to be prepended or
appended respectively to make sure both the start and end addresses are
even.

Signed-off-by: Pratyush Yadav 
Signed-off-by: Apurva Nandan 
Signed-off-by: Vignesh Raghavendra 
Tested-by: Jonathan Humphreys 
Signed-off-by: Manorit Chawdhry 
---
 drivers/mtd/spi/spi-nor-core.c | 59 +++---
 1 file changed, 55 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 982dd251150d..aea611fef523 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -1804,11 +1804,62 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t 
to, size_t len,
if (ret < 0)
return ret;
 #endif
+
write_enable(nor);
-   ret = nor->write(nor, addr, page_remain, buf + i);
-   if (ret < 0)
-   goto write_err;
-   written = ret;
+
+   /*
+* On DTR capable flashes like Micron Xcella the writes cannot
+* start or end at an odd address in DTR mode. So we need to
+* append or prepend extra 0xff bytes to make sure the start
+* address and end address are even.
+*/
+   if (spi_nor_protocol_is_dtr(nor->write_proto) &&
+   ((addr | page_remain) & 1)) {
+   u_char *tmp;
+   size_t extra_bytes = 0;
+
+   tmp = kmalloc(nor->page_size, 0);
+   if (!tmp) {
+   ret = -ENOMEM;
+   goto write_err;
+   }
+
+   /* Prepend a 0xff byte if the start address is odd. */
+   if (addr & 1) {
+   tmp[0] = 0xff;
+   memcpy(tmp + 1, buf + i, page_remain);
+   addr--;
+   page_remain++;
+   extra_bytes++;
+   } else {
+   memcpy(tmp, buf + i, page_remain);
+   }
+
+   /* Append a 0xff byte if the end address is odd. */
+   if ((addr + page_remain) & 1) {
+   tmp[page_remain + extra_bytes] = 0xff;
+   extra_bytes++;
+   page_remain++;
+   }
+
+   ret = nor->write(nor, addr, page_remain, tmp);
+
+   kfree(tmp);
+
+   if (ret < 0)
+   goto write_err;
+
+   /*
+* We write extra bytes but they are not part of the
+* original write.
+*/
+   written = ret - extra_bytes;
+   } else {
+   ret = nor->write(nor, addr, page_remain, buf + i);
+   if (ret < 0)
+   goto write_err;
+   written = ret;
+   }
 
ret = spi_nor_wait_till_ready(nor);
if (ret)

-- 
2.43.2



[PATCH v2 7/7] configs: j721s2_evm_r5_defconfig: Add AVS Configs

2024-05-28 Thread Manorit Chawdhry
Add AVS and PMIC regulator configs

Signed-off-by: Manorit Chawdhry 
---
 configs/am68_sk_r5_defconfig| 4 
 configs/j721s2_evm_r5_defconfig | 6 ++
 2 files changed, 10 insertions(+)

diff --git a/configs/am68_sk_r5_defconfig b/configs/am68_sk_r5_defconfig
index e9b6882c1f68..f4800ef1b8ac 100644
--- a/configs/am68_sk_r5_defconfig
+++ b/configs/am68_sk_r5_defconfig
@@ -5,6 +5,10 @@ CONFIG_ARCH_K3=y
 CONFIG_SOC_K3_J721S2=y
 CONFIG_TARGET_J721S2_R5_EVM=y
 
+CONFIG_K3_AVS0=n
+CONFIG_DM_REGULATOR_TPS65941=n
+CONFIG_PMIC_TPS65941=n
+
 CONFIG_DEFAULT_DEVICE_TREE="k3-am68-sk-r5-base-board"
 CONFIG_SPL_OF_LIST="k3-am68-sk-r5-base-board"
 CONFIG_OF_LIST="k3-am68-sk-r5-base-board"
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig
index 3c958cafbe8f..f8a42a9a2ef6 100644
--- a/configs/j721s2_evm_r5_defconfig
+++ b/configs/j721s2_evm_r5_defconfig
@@ -111,6 +111,7 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_FS_LOADER=y
 CONFIG_SPL_FS_LOADER=y
+CONFIG_K3_AVS0=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_SPL_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
@@ -140,6 +141,11 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_POWER_DOMAIN=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_TPS65941=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_TPS65941=y
 CONFIG_K3_SYSTEM_CONTROLLER=y
 CONFIG_REMOTEPROC_TI_K3_ARM64=y
 CONFIG_RESET_TI_SCI=y

-- 
2.43.2



[PATCH v2 6/7] arm: dts: j721s2: Add VTM node in R5

2024-05-28 Thread Manorit Chawdhry
Add bootph-pre-ram property to VTM node and the pmic node.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
index e92b1917df4e..506ad9b7910d 100644
--- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
@@ -10,3 +10,12 @@
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-j721s2-common-proc-board-u-boot.dtsi"
 #include "k3-j721s2-r5.dtsi"
+
+&tps659411 {
+   bootph-pre-ram;
+};
+
+&wkup_vtm0 {
+   bootph-pre-ram;
+   vdd-supply-2 = <&bucka1234>;
+};

-- 
2.43.2



[PATCH v2 5/7] arm: mach-k3: j721s2_init: Initialize AVS Class 0

2024-05-28 Thread Manorit Chawdhry
Initialize AVS Class 0.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/mach-k3/j721s2/j721s2_init.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c 
b/arch/arm/mach-k3/j721s2/j721s2_init.c
index fe9766e9b4b2..cc49662367f0 100644
--- a/arch/arm/mach-k3/j721s2/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
@@ -290,11 +290,21 @@ void do_dt_magic(void)
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong dummy)
 {
+   struct udevice *dev;
+   int ret;
+
k3_spl_init();
 #if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
do_dt_magic();
 #endif
k3_mem_init();
+
+   if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) {
+   ret = uclass_get_device_by_driver(UCLASS_MISC, 
DM_DRIVER_GET(k3_avs),
+ &dev);
+   if (ret)
+   printf("AVS init failed: %d\n", ret);
+   }
 }
 #endif
 

-- 
2.43.2



[PATCH v2 4/7] drivers: misc: k3_avs: Add AVS Support for J721S2.

2024-05-28 Thread Manorit Chawdhry
Add AVS Support for J721S2.

Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index d9037b4512c6..3527e427ac97 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -184,6 +184,22 @@ static struct vd_data j721e_vd_data[] = {
{ .id = -1 },
 };
 
+static struct vd_data j721s2_vd_data[] = {
+   {
+   .id = J721E_VDD_MPU,
+   .opp = AM6_OPP_NOM,
+   .dev_id = 202, /* J721S2_DEV_A72SS0_CORE0 */
+   .clk_id = 0, /* ARM clock */
+   .opps = {
+   [AM6_OPP_NOM] = {
+   .volt = 88, /* TBD in DM */
+   .freq = 20,
+   },
+   },
+   },
+   { .id = -1 },
+};
+
 static struct vd_config j721e_vd_config = {
.efuse_xlate = am6_efuse_xlate,
.vds = j721e_vd_data,
@@ -194,10 +210,16 @@ static struct vd_config am654_vd_config = {
.vds = am654_vd_data,
 };
 
+static struct vd_config j721s2_vd_config = {
+   .efuse_xlate = am6_efuse_xlate,
+   .vds = j721s2_vd_data,
+};
+
 const struct soc_attr vtm_soc_list[] = {
{ .family = "AM65X", .data = (void *)&am654_vd_config },
{ .family = "J721E", .data = (void *)&j721e_vd_config },
{ .family = "J7200", .data = (void *)&j721e_vd_config },
+   { .family = "J721S2", .data = (void *)&j721s2_vd_config },
{}
 };
 

-- 
2.43.2



[PATCH v2 3/7] drivers: misc: k3_avs: Check return code while programming AVS

2024-05-28 Thread Manorit Chawdhry
Check if AVS could not be programmed and print a warning.

Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index a0d7bb7595b3..d9037b4512c6 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -489,7 +489,10 @@ static int k3_avs_probe(struct udevice *dev)
if (vd->flags & VD_FLAG_INIT_DONE)
continue;
 
-   k3_avs_program_voltage(priv, vd, vd->opp);
+   ret = k3_avs_program_voltage(priv, vd, vd->opp);
+   if (ret)
+   dev_warn(dev, "Could not program AVS voltage for 
VD%d\n",
+vd->id);
}
 
if (!device_is_compatible(priv->dev, "ti,am654-avs"))

-- 
2.43.2



[PATCH v2 2/7] drivers: misc: k3_avs: Use soc_match_device instead of compatible.

2024-05-28 Thread Manorit Chawdhry
vd_data remains the same for most of the SoCs but there are some
differences in power domains and clocks that don't need a change to
compatible and can be handled at SoC level.

Change the data population logic from compatible to soc_match_device to
add support for newer devices.

Signed-off-by: Manorit Chawdhry 
---
 drivers/misc/k3_avs.c | 189 +++---
 1 file changed, 103 insertions(+), 86 deletions(-)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 87471cc3b16a..a0d7bb7595b3 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -111,6 +112,95 @@ static u32 am6_efuse_xlate(struct k3_avs_privdata *priv, 
int idx, int opp)
return 30 + 2 * val;
 }
 
+static struct vd_data am654_vd_data[] = {
+   {
+   .id = AM6_VDD_CORE,
+   .dev_id = 82, /* AM6_DEV_CBASS0 */
+   .clk_id = 0, /* main sysclk0 */
+   .opp = AM6_OPP_NOM,
+   .opps = {
+   [AM6_OPP_NOM] = {
+   .volt = 100,
+   .freq = 25000, /* CBASS0 */
+   },
+   },
+   },
+   {
+   .id = AM6_VDD_MPU0,
+   .dev_id = 202, /* AM6_DEV_COMPUTE_CLUSTER_A53_0 */
+   .clk_id = 0, /* ARM clock */
+   .opp = AM6_OPP_NOM,
+   .opps = {
+   [AM6_OPP_NOM] = {
+   .volt = 110,
+   .freq = 8,
+   },
+   [AM6_OPP_OD] = {
+   .volt = 120,
+   .freq = 10,
+   },
+   [AM6_OPP_TURBO] = {
+   .volt = 124,
+   .freq = 11,
+   },
+   },
+   },
+   {
+   .id = AM6_VDD_MPU1,
+   .opp = AM6_OPP_NOM,
+   .dev_id = 204, /* AM6_DEV_COMPUTE_CLUSTER_A53_2 */
+   .clk_id = 0, /* ARM clock */
+   .opps = {
+   [AM6_OPP_NOM] = {
+   .volt = 110,
+   .freq = 8,
+   },
+   [AM6_OPP_OD] = {
+   .volt = 120,
+   .freq = 10,
+   },
+   [AM6_OPP_TURBO] = {
+   .volt = 124,
+   .freq = 11,
+   },
+   },
+   },
+   { .id = -1 },
+};
+
+static struct vd_data j721e_vd_data[] = {
+   {
+   .id = J721E_VDD_MPU,
+   .opp = AM6_OPP_NOM,
+   .dev_id = 202, /* J721E_DEV_A72SS0_CORE0 */
+   .clk_id = 2, /* ARM clock */
+   .opps = {
+   [AM6_OPP_NOM] = {
+   .volt = 88, /* TBD in DM */
+   .freq = 20,
+   },
+   },
+   },
+   { .id = -1 },
+};
+
+static struct vd_config j721e_vd_config = {
+   .efuse_xlate = am6_efuse_xlate,
+   .vds = j721e_vd_data,
+};
+
+static struct vd_config am654_vd_config = {
+   .efuse_xlate = am6_efuse_xlate,
+   .vds = am654_vd_data,
+};
+
+const struct soc_attr vtm_soc_list[] = {
+   { .family = "AM65X", .data = (void *)&am654_vd_config },
+   { .family = "J721E", .data = (void *)&j721e_vd_config },
+   { .family = "J7200", .data = (void *)&j721e_vd_config },
+   {}
+};
+
 static int k3_avs_program_voltage(struct k3_avs_privdata *priv,
  struct vd_data *vd,
  int opp_id)
@@ -234,8 +324,16 @@ static int k3_avs_configure(struct udevice *dev, struct 
k3_avs_privdata *priv)
int ret;
char pname[20];
struct vd_data *vd;
+   const struct soc_attr *soc;
+
+   soc = soc_device_match(vtm_soc_list);
+   if (soc && soc->data)
+   conf = (void *)soc->data;
 
-   conf = (void *)dev_get_driver_data(dev);
+   if (!conf) {
+   printf("No SoC support for AVS\n");
+   return -ENOSYS;
+   }
 
priv->vd_config = conf;
 
@@ -400,93 +498,12 @@ static int k3_avs_probe(struct udevice *dev)
return 0;
 }
 
-static struct vd_data am654_vd_data[] = {
-   {
-   .id = AM6_VDD_CORE,
-   .dev_id = 82, /* AM6_DEV_CBASS0 */
-   .clk_id = 0, /* main sysclk0 */
-   .opp = AM6_OPP_NOM,
-   .opps = {
-  

[PATCH v2 1/7] power: pmic: tps65941: Add DM_PMIC dependency

2024-05-28 Thread Manorit Chawdhry
This Kconfig depends on DM_PMIC but hadn't be explicitly stated which
could cause config related issues.

Adds the dependency in Kconfig for tps65941.

Fixes: 6b86dd0c1ead ("power: pmic: tps65941: Add support for tps65941 family of 
PMICs")
Signed-off-by: Manorit Chawdhry 
---
 drivers/power/pmic/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 562c1a3b122a..bbcbcee4c355 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -394,6 +394,7 @@ config SPL_PMIC_LP87565
 
 config PMIC_TPS65941
bool "Enable driver for Texas Instruments TPS65941 PMIC"
+   depends on DM_PMIC
help
The TPS65941 is a PMIC containing a bunch of SMPS & LDOs.
This driver binds the pmic children.

-- 
2.43.2



[PATCH v2 0/7] Add AVS support for J721S2

2024-05-28 Thread Manorit Chawdhry
This series adds support for AVS on J721S2.

AVS Test for J721S2: 
https://gist.github.com/manorit2001/d7690ded6ef685aa8ffa5b16746cc529
Boot Test results: 
https://gist.github.com/manorit2001/6775d721b3df5a690497d94d012b93c4

Signed-off-by: Manorit Chawdhry 
---
Changes in v2:
- Move AVS Initialization point to after do_dt_magic
  ( Otherwise AM68 unknowingly ends up probing AVS and fails )
- Rebase on top of OF_UPSTREAM Support
- Link to v1: 
https://lore.kernel.org/r/20240206-b4-upstream-j721s2-avs-v1-0-b75043c59...@ti.com

---
Manorit Chawdhry (7):
  power: pmic: tps65941: Add DM_PMIC dependency
  drivers: misc: k3_avs: Use soc_match_device instead of compatible.
  drivers: misc: k3_avs: Check return code while programming AVS
  drivers: misc: k3_avs: Add AVS Support for J721S2.
  arm: mach-k3: j721s2_init: Initialize AVS Class 0
  arm: dts: j721s2: Add VTM node in R5
  configs: j721s2_evm_r5_defconfig: Add AVS Configs

 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts |   9 +
 arch/arm/mach-k3/j721s2/j721s2_init.c   |  10 ++
 configs/am68_sk_r5_defconfig|   4 +
 configs/j721s2_evm_r5_defconfig |   6 +
 drivers/misc/k3_avs.c   | 216 ++--
 drivers/power/pmic/Kconfig  |   1 +
 6 files changed, 159 insertions(+), 87 deletions(-)
---
base-commit: 377e91c162ab09ec20f96f966f380cb55c590edd
change-id: 20240130-b4-upstream-j721s2-avs-8c187d3fe26a

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH] arm: dts: k3-j721e-r5-common-proc-board: Set parent clock for clock ID 342

2024-05-28 Thread Manorit Chawdhry
Hi Neha,

On 13:07-20240528, Neha Malcom Francis wrote:
> From: Apurva Nandan 
> 
> This virtual clock mux configuration enables the use of dynamic frequency
> scaling on A72 clock ID 202 by setting up the required register.
> 
> Signed-off-by: Apurva Nandan 
> Signed-off-by: Neha Malcom Francis 
> ---
> Boot logs:
> https://gist.github.com/nehamalcom/138d25fe32d4d80af3e0e4c19c1b18e0
> 
>  arch/arm/dts/k3-j721e-r5-common-proc-board.dts | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts 
> b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts
> index 9655ca21d02..25e4b4c7663 100644
> --- a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts
> +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts
> @@ -28,7 +28,8 @@
>   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
>   resets = <&k3_reset 202 0>;
>   clocks = <&k3_clks 61 1>;
> - assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>;
> + assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>, <&k3_clks 
> 342 0>;
> + assigned-clock-parents= <0>, <0>, <&k3_clks 342 2>;

I think it would be better to base this patch on top of your j721e
of_upstream series. There you have introduced k3-j721e-r5.dtsi [0] and I
feel it would be better to put this change on that file maybe.

[0]: https://lore.kernel.org/u-boot/20240520095916.1809962-2-n-fran...@ti.com/

Regards,
Manorit
>   assigned-clock-rates = <20>, <2>;
>   ti,sci = <&dmsc>;
>   ti,sci-proc-id = <32>;
> -- 
> 2.34.1
> 


Re: [PATCH 1/3] arm: dts: k3-j721e-r5*: Introduce k3-j721e-r5.dtsi

2024-05-21 Thread Manorit Chawdhry
_udmap {
> - ti,sci = <&dm_tifs>;
> -};
> -
> -&wkup_uart0_pins_default {
> - bootph-pre-ram;
> -};
> +#include "k3-j721e-r5.dtsi"
>  
>  &mcu_uart0_pins_default {
>   bootph-pre-ram;
> diff --git a/arch/arm/dts/k3-j721e-r5.dtsi b/arch/arm/dts/k3-j721e-r5.dtsi
> new file mode 100644
> index 000..fd0d921272c
> --- /dev/null
> +++ b/arch/arm/dts/k3-j721e-r5.dtsi
> @@ -0,0 +1,80 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
> + */
> +
> +/ {
> + chosen {
> + tick-timer = &mcu_timer0;
> + };
> +
> + aliases {
> + remoteproc0 = &sysctrler;
> + remoteproc1 = &a72_0;
> + };
> +
> + a72_0: a72@0 {
> + compatible = "ti,am654-rproc";
> + reg = <0x0 0x00a9 0x0 0x10>;
> + power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
> + <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
> + <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
> + resets = <&k3_reset 202 0>;
> + clocks = <&k3_clks 61 1>;
> + assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>;
> + assigned-clock-rates = <20>, <2>;
> + ti,sci = <&dmsc>;
> + ti,sci-proc-id = <32>;
> + ti,sci-host-id = <10>;
> + bootph-pre-ram;
> + };
> +
> + dm_tifs: dm-tifs {
> + compatible = "ti,j721e-dm-sci";
> + ti,host-id = <3>;
> + ti,secure-host;
> + mbox-names = "rx", "tx";
> + mboxes= <&secure_proxy_mcu 21>,
> + <&secure_proxy_mcu 23>;
> + bootph-pre-ram;
> + };
> +};
> +
> +&mcu_timer0 {
> + status = "okay";
> + bootph-pre-ram;
> +};
> +
> +&dmsc {
> + mboxes= <&secure_proxy_mcu 8>, <&secure_proxy_mcu 6>, 
> <&secure_proxy_mcu 5>;
> + mbox-names = "tx", "rx", "notify";
> + ti,host-id = <4>;
> + ti,secure-host;
> +};
> +
> +&secure_proxy_mcu {
> + bootph-pre-ram;
> + /* We require this for boot handshake */
> + status = "okay";
> +};
> +
> +&cbass_mcu_wakeup {
> + sysctrler: sysctrler {
> + bootph-pre-ram;
> + compatible = "ti,am654-system-controller";
> + mboxes= <&secure_proxy_mcu 4>, <&secure_proxy_mcu 5>;
> + mbox-names = "tx", "rx";
> + };
> +};
> +
> +&mcu_ringacc {
> + ti,sci = <&dm_tifs>;
> +};
> +
> +&mcu_udmap {
> + ti,sci = <&dm_tifs>;
> +};
> +
> +&wkup_uart0_pins_default {
> + bootph-pre-ram;
> +};

I think I just noticed that this node is only enabled in R5 dts for
j721e, though not required for cleanup in this series as we'll be
porting these tags to kernel anyways but the node is marked with
bootph-all in -u-boot.dtsi and the pins are only marked bootph-pre-ram.
Might be good to look at some other tags as well while porting these to
kernel [0].

Rest LGTM.

Reviewed-by: Manorit Chawdhry 

[0]: 
https://lore.kernel.org/linux-arm-kernel/20240507-b4-upstream-bootph-all-v1-0-c6d526518...@ti.com/

Regards,
Manorit

> -- 
> 2.34.1
> 


Re: [PATCH v2 3/6] arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file

2024-05-09 Thread Manorit Chawdhry
Hi Nishanth,

On 07:29-20240509, Nishanth Menon wrote:
> On 15:23-20240509, Manorit Chawdhry wrote:
> > Currently AM68 SK boots with J721s2 R5 DTS and then later changes to
> > AM68 SK DT during runtime.
> > 
> > To split the support of J721s2 and AM68, sync AM68 R5 DT with J721s2 R5
> > DT as that contains some essential node changes for booting up AM68
> > using AM68 R5 DT.
> > 
> > secure_proxy_mcu and secure_proxy_sa3 node changes are required for
> > establishing contact with TIFS running on M4 core, and the addition of
> 
> s/TIFS/ROM and TIFS - you need sa2 sproxy for ROM and mcu sproxy for
> TIFS.
> 

Thanks for the clarification! Was a bit confused in both of them
actually. Updated the message v3.

Regards,
Manorit

> M4 Core is generic - SMS M4 core will clarify.
> 
> > new power domain helps in holding A72 in reset for configuration of
> > firewalls.
> 
> s/A72/A72 Cluster/
> 

> 
> [...]
> 
> -- 
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 
> 849D 1736 249D


[PATCH v3 6/6] arm: dts: k3-j721s2|am68: Migrate to OF_UPSTREAM

2024-05-09 Thread Manorit Chawdhry
Use OF_UPSTREAM to pull Linux DT from dts/ tree

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/Makefile  |4 +-
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   20 +-
 arch/arm/dts/k3-am68-sk-base-board.dts |  611 ---
 arch/arm/dts/k3-am68-sk-som.dtsi   |  259 ---
 arch/arm/dts/k3-j721s2-binman.dtsi |2 +-
 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|   18 +-
 arch/arm/dts/k3-j721s2-common-proc-board.dts   |  504 -
 arch/arm/dts/k3-j721s2-main.dtsi   | 1928 
 arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi |  738 
 arch/arm/dts/k3-j721s2-som-p0.dtsi |  361 
 arch/arm/dts/k3-j721s2-thermal.dtsi|  101 -
 arch/arm/dts/k3-j721s2.dtsi|  175 --
 board/ti/j721s2/MAINTAINERS|8 -
 configs/am68_sk_a72_defconfig  |6 +-
 configs/j721s2_evm_a72_defconfig   |5 +-
 15 files changed, 23 insertions(+), 4717 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c9f1b25ad647..60660f24d942 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1331,9 +1331,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += 
k3-j721e-common-proc-board.dtb \
  k3-j721e-beagleboneai64.dtb \
  k3-j721e-r5-beagleboneai64.dtb
 
-dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-base-board.dtb\
-  k3-am68-sk-r5-base-board.dtb\
-  k3-j721s2-common-proc-board.dtb\
+dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-r5-base-board.dtb\
   k3-j721s2-r5-common-proc-board.dtb
 
 dtb-$(CONFIG_SOC_K3_J784S4) += k3-am69-r5-sk.dtb \
diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index dca588485d41..4b8d73a92d6a 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -19,10 +19,14 @@
 
 &cbass_mcu_wakeup {
bootph-all;
+};
 
-   chipid@4314 {
-   bootph-all;
-   };
+&wkup_conf {
+   bootph-all;
+};
+
+&chipid {
+   bootph-all;
 };
 
 &mcu_navss {
@@ -34,14 +38,6 @@
 };
 
 &mcu_udmap {
-   reg =   <0x0 0x285c 0x0 0x100>,
-   <0x0 0x284c 0x0 0x4000>,
-   <0x0 0x2a80 0x0 0x4>,
-   <0x0 0x284a 0x0 0x4000>,
-   <0x0 0x2aa0 0x0 0x4>,
-   <0x0 0x2840 0x0 0x2000>;
-   reg-names = "gcfg", "rchan", "rchanrt", "tchan",
-   "tchanrt", "rflow";
bootph-all;
 };
 
@@ -132,7 +128,7 @@
 
 #ifdef CONFIG_TARGET_J721S2_A72_EVM
 
-#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
+#define SPL_AM68_SK_DTB "spl/dts/ti/k3-am68-sk-base-board.dtb"
 #define AM68_SK_DTB "u-boot.dtb"
 
 &spl_j721s2_evm_dtb {
diff --git a/arch/arm/dts/k3-am68-sk-base-board.dts 
b/arch/arm/dts/k3-am68-sk-base-board.dts
deleted file mode 100644
index 1e1a82f9d2b8..
--- a/arch/arm/dts/k3-am68-sk-base-board.dts
+++ /dev/null
@@ -1,611 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
- *
- * Base Board: https://www.ti.com/lit/zip/SPRR463
- */
-
-/dts-v1/;
-
-#include "k3-am68-sk-som.dtsi"
-#include 
-#include 
-#include 
-
-#include "k3-serdes.h"
-
-/ {
-   compatible = "ti,am68-sk", "ti,j721s2";
-   model = "Texas Instruments AM68 SK";
-
-   chosen {
-   stdout-path = "serial2:115200n8";
-   };
-
-   aliases {
-   serial0 = &wkup_uart0;
-   serial1 = &mcu_uart0;
-   serial2 = &main_uart8;
-   mmc1 = &main_sdhci1;
-   can0 = &mcu_mcan0;
-   can1 = &mcu_mcan1;
-   can2 = &main_mcan6;
-   can3 = &main_mcan7;
-   };
-
-   vusb_main: regulator-vusb-main5v0 {
-   /* USB MAIN INPUT 5V DC */
-   compatible = "regulator-fixed";
-   regulator-name = "vusb-main5v0";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   regulator-always-on;
-   regulator-boot-on;
-   };
-
-   vsys_3v3: regulator-vsys3v3 {
-   /* Output of LM5141 */
-   compatible = "regulator-fixed";
-   regulator-name = "vsys_3v3";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   vi

[PATCH v3 5/6] configs: am68_sk: Move to separate defconfig for AM68 SK board

2024-05-09 Thread Manorit Chawdhry
Add defconfig for AM68 SK R5 and A72 configuration.

This includes and modifies the AM68 EVM defconfigs:
j721s2_evm_r5_defconfig -> am68_sk_r5_defconfig
j721s2_evm_a72_defconfig -> am68_sk_a72_defconfig

Reviewed-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 23 +++
 arch/arm/dts/k3-j721s2-binman.dtsi | 89 +-
 board/ti/j721s2/MAINTAINERS|  2 +
 configs/am68_sk_a72_defconfig  | 10 +++
 configs/am68_sk_r5_defconfig   | 10 +++
 configs/j721s2_evm_a72_defconfig   |  2 +-
 configs/j721s2_evm_r5_defconfig|  2 +-
 7 files changed, 49 insertions(+), 89 deletions(-)

diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index b8fc62f0dd1c..dca588485d41 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -129,3 +129,26 @@
dr_mode = "peripheral";
bootph-all;
 };
+
+#ifdef CONFIG_TARGET_J721S2_A72_EVM
+
+#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
+#define AM68_SK_DTB "u-boot.dtb"
+
+&spl_j721s2_evm_dtb {
+   filename = SPL_AM68_SK_DTB;
+};
+
+&j721s2_evm_dtb {
+   filename = AM68_SK_DTB;
+};
+
+&spl_j721s2_evm_dtb_unsigned {
+   filename = SPL_AM68_SK_DTB;
+};
+
+&j721s2_evm_dtb_unsigned {
+   filename = AM68_SK_DTB;
+};
+
+#endif
diff --git a/arch/arm/dts/k3-j721s2-binman.dtsi 
b/arch/arm/dts/k3-j721s2-binman.dtsi
index 7efb135bdff9..c46fda66b0b2 100644
--- a/arch/arm/dts/k3-j721s2-binman.dtsi
+++ b/arch/arm/dts/k3-j721s2-binman.dtsi
@@ -142,10 +142,7 @@
 #ifdef CONFIG_TARGET_J721S2_A72_EVM
 
 #define SPL_J721S2_EVM_DTB "spl/dts/k3-j721s2-common-proc-board.dtb"
-#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
-
 #define J721S2_EVM_DTB "u-boot.dtb"
-#define AM68_SK_DTB "arch/arm/dts/k3-am68-sk-base-board.dtb"
 
 &binman {
ti-dm {
@@ -306,20 +303,6 @@
};
 
};
-
-   fdt-1 {
-   description = "k3-am68-sk-base-board";
-   type = "flat_dt";
-   arch = "arm";
-   compression = "none";
-   ti-secure {
-   content = <&spl_am68_sk_dtb>;
-   keyfile = "custMpk.pem";
-   };
-   spl_am68_sk_dtb: blob-ext {
-   filename = SPL_AM68_SK_DTB;
-   };
-   };
};
 
configurations {
@@ -331,13 +314,6 @@
loadables = "tee", "dm", "spl";
fdt = "fdt-0";
};
-
-   conf-1 {
-   description = "k3-am68-sk-base-board";
-   firmware = "atf";
-   loadables = "tee", "dm", "spl";
-   fdt = "fdt-1";
-   };
};
};
};
@@ -370,25 +346,6 @@
algo = "crc32";
};
};
-
-   fdt-1 {
-   description = "k3-am68-sk-base-board";
-   type = "flat_dt";
-   arch = "arm";
-   compression = "none";
-   ti-secure {
-   content = <&am68_sk_dtb>;
-   keyfile = "custMpk.pem";
-   };
-   am68_sk_dtb: blob-ext {
-   filename = AM68_SK_DTB;
-   };
-
-   hash {
-   algo = "crc32";
-   };
-   };
-
   

[PATCH v3 4/6] arch: arm: dts: k3-j721s2-r5: Introduce k3-j721s2-r5.dtsi

2024-05-09 Thread Manorit Chawdhry
Create an SoC R5 dtsi file that could be used at board level R5 files. This
would help in keeping the SoC level changes in sync across board files.

Reviewed-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am68-sk-r5-base-board.dts   | 78 +---
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 78 +---
 arch/arm/dts/k3-j721s2-r5.dtsi  | 81 +
 board/ti/j721s2/MAINTAINERS |  1 +
 4 files changed, 84 insertions(+), 154 deletions(-)

diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
index 038b08dc3e01..3b2d7af2e528 100644
--- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
+++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
@@ -9,80 +9,4 @@
 #include "k3-j721s2-ddr-evm-lp4-4266.dtsi"
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-am68-sk-base-board-u-boot.dtsi"
-
-/ {
-   chosen {
-   tick-timer = &mcu_timer0;
-   };
-
-   aliases {
-   remoteproc0 = &sysctrler;
-   remoteproc1 = &a72_0;
-   };
-
-   a72_0: a72@0 {
-   compatible = "ti,am654-rproc";
-   reg = <0x0 0x00a9 0x0 0x10>;
-   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
-   resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
-   assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
-   assigned-clock-parents = <&k3_clks 61 2>;
-   assigned-clock-rates = <2>, <20>;
-   ti,sci = <&sms>;
-   ti,sci-proc-id = <32>;
-   ti,sci-host-id = <10>;
-   bootph-pre-ram;
-   };
-
-   dm_tifs: dm-tifs {
-   compatible = "ti,j721e-dm-sci";
-   ti,host-id = <3>;
-   ti,secure-host;
-   mbox-names = "rx", "tx";
-   mboxes= <&secure_proxy_mcu 21>,
-   <&secure_proxy_mcu 23>;
-   bootph-pre-ram;
-   };
-};
-
-&mcu_timer0 {
-   clock-frequency = <25000>;
-   bootph-pre-ram;
-};
-
-&secure_proxy_mcu {
-   bootph-pre-ram;
-   status = "okay";
-};
-
-&secure_proxy_sa3 {
-   bootph-pre-ram;
-   status = "okay";
-};
-
-&cbass_mcu_wakeup {
-   sysctrler: sysctrler {
-   compatible = "ti,am654-system-controller";
-   mboxes= <&secure_proxy_mcu 4>, <&secure_proxy_mcu 5>, 
<&secure_proxy_sa3 5>;
-   mbox-names = "tx", "rx", "boot_notify";
-   bootph-pre-ram;
-   };
-};
-
-&sms {
-   mboxes= <&secure_proxy_mcu 8>, <&secure_proxy_mcu 6>, 
<&secure_proxy_mcu 5>;
-   mbox-names = "tx", "rx", "notify";
-   ti,host-id = <4>;
-   ti,secure-host;
-};
-
-&mcu_ringacc {
-   ti,sci = <&dm_tifs>;
-};
-
-&mcu_udmap {
-   ti,sci = <&dm_tifs>;
-};
+#include "k3-j721s2-r5.dtsi"
diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
index 03bd680f4421..e92b1917df4e 100644
--- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
@@ -9,80 +9,4 @@
 #include "k3-j721s2-ddr-evm-lp4-4266.dtsi"
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-j721s2-common-proc-board-u-boot.dtsi"
-
-/ {
-   chosen {
-   tick-timer = &mcu_timer0;
-   };
-
-   aliases {
-   remoteproc0 = &sysctrler;
-   remoteproc1 = &a72_0;
-   };
-
-   a72_0: a72@0 {
-   compatible = "ti,am654-rproc";
-   reg = <0x0 0x00a9 0x0 0x10>;
-   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
-   resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
-   assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
-   assigned-clock-parents = <&k3_clks 61 2>;
-   assigned-clock-rates = <2>, <20>;
-   ti,sci = <&sms>;
-   ti,sci-proc-id = <32>;
-   ti,sci-h

[PATCH v3 3/6] arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file

2024-05-09 Thread Manorit Chawdhry
Currently AM68 SK boots with J721s2 R5 DTS and then later changes to
AM68 SK DT during runtime.

To split the support of J721s2 and AM68, sync AM68 R5 DT with J721s2 R5
DT as that contains some essential node changes for booting up AM68
using AM68 R5 DT.

secure_proxy_sa3 and secure_proxy_mcu node changes are required for
establishing contact with ROM and TIFS running on SMS M4 core,
respectively, and the addition of new power domain helps in holding A72
cluster in reset for configuration of firewalls.

Reviewed-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am68-sk-r5-base-board.dts | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
index 695aadc287bd..038b08dc3e01 100644
--- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
+++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
@@ -24,7 +24,8 @@
compatible = "ti,am654-rproc";
reg = <0x0 0x00a9 0x0 0x10>;
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
+   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
+   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
clocks = <&k3_clks 61 1>;
assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
@@ -54,10 +55,12 @@
 
 &secure_proxy_mcu {
bootph-pre-ram;
+   status = "okay";
 };
 
 &secure_proxy_sa3 {
bootph-pre-ram;
+   status = "okay";
 };
 
 &cbass_mcu_wakeup {

-- 
2.43.2



[PATCH v3 2/6] configs: j721s2_evm_a72_defconfig: Switch to bootstd

2024-05-09 Thread Manorit Chawdhry
From: Neha Malcom Francis 

Switch to using bootstd. Note that with this change, we will stop using
distro_bootcmd and instead depend entirely on bootflow method of
starting the system up.

Also config_distro_bootcmd.h header file that is no longer needed in
j721s2_evm.h.

Signed-off-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 configs/j721s2_evm_a72_defconfig | 5 +++--
 include/configs/j721s2_evm.h | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 19cd44b068c0..8b02d07a9f09 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -33,9 +33,10 @@ CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
+CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
 CONFIG_LOGLEVEL=7
 CONFIG_SPL_MAX_SIZE=0xc
 CONFIG_SPL_BOARD_INIT=y
diff --git a/include/configs/j721s2_evm.h b/include/configs/j721s2_evm.h
index 846cfa7531cc..6186ec32b1d8 100644
--- a/include/configs/j721s2_evm.h
+++ b/include/configs/j721s2_evm.h
@@ -10,7 +10,6 @@
 #define __CONFIG_J721S2_EVM_H
 
 #include 
-#include 
 
 /* SPL Loader Configuration */
 #if defined(CONFIG_TARGET_J721S2_A72_EVM)

-- 
2.43.2



[PATCH v3 1/6] board: ti: j721s2: j721s2.env: Add explicit boot_targets

2024-05-09 Thread Manorit Chawdhry
From: Neha Malcom Francis 

Add explicit boot_targets to indicate the specific boot sequence to
follow.

Signed-off-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 board/ti/j721s2/j721s2.env | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env
index 9a03b9f30aee..a6b22550809e 100644
--- a/board/ti/j721s2/j721s2.env
+++ b/board/ti/j721s2/j721s2.env
@@ -13,6 +13,7 @@ args_all=setenv optargs earlycon=ns16550a,mmio32,0x0288
${mtdparts}
 run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
 
+boot_targets=mmc1 mmc0 usb pxe dhcp
 boot=mmc
 mmcdev=1
 bootpart=1:2

-- 
2.43.2



[PATCH v3 0/6] Enable OF_UPSTREAM for J721s2 and AM68

2024-05-09 Thread Manorit Chawdhry
Series splits AM68 and J721s2 support along with enabling OF_UPSTREAM
and adding stdboot support for both the platforms.

Boot logs: https://gist.github.com/manorit2001/6c669e4273933bc46c3b28a631a96ae3

Signed-off-by: Manorit Chawdhry 
---
Changes in v3:
- Improve the commit message (Nishanth)
- Link to v2: 
https://lore.kernel.org/r/20240509-b4-upstream-j721s2-of-upstream-v2-0-149563cd4...@ti.com

---
Manorit Chawdhry (4):
  arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file
  arch: arm: dts: k3-j721s2-r5: Introduce k3-j721s2-r5.dtsi
  configs: am68_sk: Move to separate defconfig for AM68 SK board
  arm: dts: k3-j721s2|am68: Migrate to OF_UPSTREAM

Neha Malcom Francis (2):
  board: ti: j721s2: j721s2.env: Add explicit boot_targets
  configs: j721s2_evm_a72_defconfig: Switch to bootstd

 arch/arm/dts/Makefile  |4 +-
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   41 +-
 arch/arm/dts/k3-am68-sk-base-board.dts |  611 ---
 arch/arm/dts/k3-am68-sk-r5-base-board.dts  |   75 +-
 arch/arm/dts/k3-am68-sk-som.dtsi   |  259 ---
 arch/arm/dts/k3-j721s2-binman.dtsi |   91 +-
 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|   18 +-
 arch/arm/dts/k3-j721s2-common-proc-board.dts   |  504 -
 arch/arm/dts/k3-j721s2-main.dtsi   | 1928 
 arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi |  738 
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts|   78 +-
 arch/arm/dts/k3-j721s2-r5.dtsi |   81 +
 arch/arm/dts/k3-j721s2-som-p0.dtsi |  361 
 arch/arm/dts/k3-j721s2-thermal.dtsi|  101 -
 arch/arm/dts/k3-j721s2.dtsi|  175 --
 board/ti/j721s2/MAINTAINERS|   11 +-
 board/ti/j721s2/j721s2.env |1 +
 configs/am68_sk_a72_defconfig  |   10 +
 configs/am68_sk_r5_defconfig   |   10 +
 configs/j721s2_evm_a72_defconfig   |   10 +-
 configs/j721s2_evm_r5_defconfig|2 +-
 include/configs/j721s2_evm.h   |1 -
 22 files changed, 155 insertions(+), 4955 deletions(-)
---
base-commit: 2f1e76bcfee75b9f99ade63002c05ffaaec86afb
change-id: 20240506-b4-upstream-j721s2-of-upstream-3c28ff12d664

Best regards,
-- 
Manorit Chawdhry 



[PATCH v2 6/6] arm: dts: k3-j721s2|am68: Migrate to OF_UPSTREAM

2024-05-09 Thread Manorit Chawdhry
Use OF_UPSTREAM to pull Linux DT from dts/ tree

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/Makefile  |4 +-
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   20 +-
 arch/arm/dts/k3-am68-sk-base-board.dts |  611 ---
 arch/arm/dts/k3-am68-sk-som.dtsi   |  259 ---
 arch/arm/dts/k3-j721s2-binman.dtsi |2 +-
 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|   18 +-
 arch/arm/dts/k3-j721s2-common-proc-board.dts   |  504 -
 arch/arm/dts/k3-j721s2-main.dtsi   | 1928 
 arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi |  738 
 arch/arm/dts/k3-j721s2-som-p0.dtsi |  361 
 arch/arm/dts/k3-j721s2-thermal.dtsi|  101 -
 arch/arm/dts/k3-j721s2.dtsi|  175 --
 board/ti/j721s2/MAINTAINERS|8 -
 configs/am68_sk_a72_defconfig  |6 +-
 configs/j721s2_evm_a72_defconfig   |5 +-
 15 files changed, 23 insertions(+), 4717 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c9f1b25ad647..60660f24d942 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1331,9 +1331,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += 
k3-j721e-common-proc-board.dtb \
  k3-j721e-beagleboneai64.dtb \
  k3-j721e-r5-beagleboneai64.dtb
 
-dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-base-board.dtb\
-  k3-am68-sk-r5-base-board.dtb\
-  k3-j721s2-common-proc-board.dtb\
+dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-r5-base-board.dtb\
   k3-j721s2-r5-common-proc-board.dtb
 
 dtb-$(CONFIG_SOC_K3_J784S4) += k3-am69-r5-sk.dtb \
diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index dca588485d41..4b8d73a92d6a 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -19,10 +19,14 @@
 
 &cbass_mcu_wakeup {
bootph-all;
+};
 
-   chipid@4314 {
-   bootph-all;
-   };
+&wkup_conf {
+   bootph-all;
+};
+
+&chipid {
+   bootph-all;
 };
 
 &mcu_navss {
@@ -34,14 +38,6 @@
 };
 
 &mcu_udmap {
-   reg =   <0x0 0x285c 0x0 0x100>,
-   <0x0 0x284c 0x0 0x4000>,
-   <0x0 0x2a80 0x0 0x4>,
-   <0x0 0x284a 0x0 0x4000>,
-   <0x0 0x2aa0 0x0 0x4>,
-   <0x0 0x2840 0x0 0x2000>;
-   reg-names = "gcfg", "rchan", "rchanrt", "tchan",
-   "tchanrt", "rflow";
bootph-all;
 };
 
@@ -132,7 +128,7 @@
 
 #ifdef CONFIG_TARGET_J721S2_A72_EVM
 
-#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
+#define SPL_AM68_SK_DTB "spl/dts/ti/k3-am68-sk-base-board.dtb"
 #define AM68_SK_DTB "u-boot.dtb"
 
 &spl_j721s2_evm_dtb {
diff --git a/arch/arm/dts/k3-am68-sk-base-board.dts 
b/arch/arm/dts/k3-am68-sk-base-board.dts
deleted file mode 100644
index 1e1a82f9d2b8..
--- a/arch/arm/dts/k3-am68-sk-base-board.dts
+++ /dev/null
@@ -1,611 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
- *
- * Base Board: https://www.ti.com/lit/zip/SPRR463
- */
-
-/dts-v1/;
-
-#include "k3-am68-sk-som.dtsi"
-#include 
-#include 
-#include 
-
-#include "k3-serdes.h"
-
-/ {
-   compatible = "ti,am68-sk", "ti,j721s2";
-   model = "Texas Instruments AM68 SK";
-
-   chosen {
-   stdout-path = "serial2:115200n8";
-   };
-
-   aliases {
-   serial0 = &wkup_uart0;
-   serial1 = &mcu_uart0;
-   serial2 = &main_uart8;
-   mmc1 = &main_sdhci1;
-   can0 = &mcu_mcan0;
-   can1 = &mcu_mcan1;
-   can2 = &main_mcan6;
-   can3 = &main_mcan7;
-   };
-
-   vusb_main: regulator-vusb-main5v0 {
-   /* USB MAIN INPUT 5V DC */
-   compatible = "regulator-fixed";
-   regulator-name = "vusb-main5v0";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   regulator-always-on;
-   regulator-boot-on;
-   };
-
-   vsys_3v3: regulator-vsys3v3 {
-   /* Output of LM5141 */
-   compatible = "regulator-fixed";
-   regulator-name = "vsys_3v3";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   vi

[PATCH v2 5/6] configs: am68_sk: Move to separate defconfig for AM68 SK board

2024-05-09 Thread Manorit Chawdhry
Add defconfig for AM68 SK R5 and A72 configuration.

This includes and modifies the AM68 EVM defconfigs:
j721s2_evm_r5_defconfig -> am68_sk_r5_defconfig
j721s2_evm_a72_defconfig -> am68_sk_a72_defconfig

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 23 +++
 arch/arm/dts/k3-j721s2-binman.dtsi | 89 +-
 board/ti/j721s2/MAINTAINERS|  2 +
 configs/am68_sk_a72_defconfig  | 10 +++
 configs/am68_sk_r5_defconfig   | 10 +++
 configs/j721s2_evm_a72_defconfig   |  2 +-
 configs/j721s2_evm_r5_defconfig|  2 +-
 7 files changed, 49 insertions(+), 89 deletions(-)

diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index b8fc62f0dd1c..dca588485d41 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -129,3 +129,26 @@
dr_mode = "peripheral";
bootph-all;
 };
+
+#ifdef CONFIG_TARGET_J721S2_A72_EVM
+
+#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
+#define AM68_SK_DTB "u-boot.dtb"
+
+&spl_j721s2_evm_dtb {
+   filename = SPL_AM68_SK_DTB;
+};
+
+&j721s2_evm_dtb {
+   filename = AM68_SK_DTB;
+};
+
+&spl_j721s2_evm_dtb_unsigned {
+   filename = SPL_AM68_SK_DTB;
+};
+
+&j721s2_evm_dtb_unsigned {
+   filename = AM68_SK_DTB;
+};
+
+#endif
diff --git a/arch/arm/dts/k3-j721s2-binman.dtsi 
b/arch/arm/dts/k3-j721s2-binman.dtsi
index 7efb135bdff9..c46fda66b0b2 100644
--- a/arch/arm/dts/k3-j721s2-binman.dtsi
+++ b/arch/arm/dts/k3-j721s2-binman.dtsi
@@ -142,10 +142,7 @@
 #ifdef CONFIG_TARGET_J721S2_A72_EVM
 
 #define SPL_J721S2_EVM_DTB "spl/dts/k3-j721s2-common-proc-board.dtb"
-#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
-
 #define J721S2_EVM_DTB "u-boot.dtb"
-#define AM68_SK_DTB "arch/arm/dts/k3-am68-sk-base-board.dtb"
 
 &binman {
ti-dm {
@@ -306,20 +303,6 @@
};
 
};
-
-   fdt-1 {
-   description = "k3-am68-sk-base-board";
-   type = "flat_dt";
-   arch = "arm";
-   compression = "none";
-   ti-secure {
-   content = <&spl_am68_sk_dtb>;
-   keyfile = "custMpk.pem";
-   };
-   spl_am68_sk_dtb: blob-ext {
-   filename = SPL_AM68_SK_DTB;
-   };
-   };
};
 
configurations {
@@ -331,13 +314,6 @@
loadables = "tee", "dm", "spl";
fdt = "fdt-0";
};
-
-   conf-1 {
-   description = "k3-am68-sk-base-board";
-   firmware = "atf";
-   loadables = "tee", "dm", "spl";
-   fdt = "fdt-1";
-   };
};
};
};
@@ -370,25 +346,6 @@
algo = "crc32";
};
};
-
-   fdt-1 {
-   description = "k3-am68-sk-base-board";
-   type = "flat_dt";
-   arch = "arm";
-   compression = "none";
-   ti-secure {
-   content = <&am68_sk_dtb>;
-   keyfile = "custMpk.pem";
-   };
-   am68_sk_dtb: blob-ext {
-   filename = AM68_SK_DTB;
-   };
-
-   hash {
-   algo = "crc32";
-   };
-   };
-
};
 
configurations {
@@ -400,13 +3

[PATCH v2 4/6] arch: arm: dts: k3-j721s2-r5: Introduce k3-j721s2-r5.dtsi

2024-05-09 Thread Manorit Chawdhry
Create an SoC R5 dtsi file that could be used at board level R5 files. This
would help in keeping the SoC level changes in sync across board files.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am68-sk-r5-base-board.dts   | 78 +---
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 78 +---
 arch/arm/dts/k3-j721s2-r5.dtsi  | 81 +
 board/ti/j721s2/MAINTAINERS |  1 +
 4 files changed, 84 insertions(+), 154 deletions(-)

diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
index 038b08dc3e01..3b2d7af2e528 100644
--- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
+++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
@@ -9,80 +9,4 @@
 #include "k3-j721s2-ddr-evm-lp4-4266.dtsi"
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-am68-sk-base-board-u-boot.dtsi"
-
-/ {
-   chosen {
-   tick-timer = &mcu_timer0;
-   };
-
-   aliases {
-   remoteproc0 = &sysctrler;
-   remoteproc1 = &a72_0;
-   };
-
-   a72_0: a72@0 {
-   compatible = "ti,am654-rproc";
-   reg = <0x0 0x00a9 0x0 0x10>;
-   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
-   resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
-   assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
-   assigned-clock-parents = <&k3_clks 61 2>;
-   assigned-clock-rates = <2>, <20>;
-   ti,sci = <&sms>;
-   ti,sci-proc-id = <32>;
-   ti,sci-host-id = <10>;
-   bootph-pre-ram;
-   };
-
-   dm_tifs: dm-tifs {
-   compatible = "ti,j721e-dm-sci";
-   ti,host-id = <3>;
-   ti,secure-host;
-   mbox-names = "rx", "tx";
-   mboxes= <&secure_proxy_mcu 21>,
-   <&secure_proxy_mcu 23>;
-   bootph-pre-ram;
-   };
-};
-
-&mcu_timer0 {
-   clock-frequency = <25000>;
-   bootph-pre-ram;
-};
-
-&secure_proxy_mcu {
-   bootph-pre-ram;
-   status = "okay";
-};
-
-&secure_proxy_sa3 {
-   bootph-pre-ram;
-   status = "okay";
-};
-
-&cbass_mcu_wakeup {
-   sysctrler: sysctrler {
-   compatible = "ti,am654-system-controller";
-   mboxes= <&secure_proxy_mcu 4>, <&secure_proxy_mcu 5>, 
<&secure_proxy_sa3 5>;
-   mbox-names = "tx", "rx", "boot_notify";
-   bootph-pre-ram;
-   };
-};
-
-&sms {
-   mboxes= <&secure_proxy_mcu 8>, <&secure_proxy_mcu 6>, 
<&secure_proxy_mcu 5>;
-   mbox-names = "tx", "rx", "notify";
-   ti,host-id = <4>;
-   ti,secure-host;
-};
-
-&mcu_ringacc {
-   ti,sci = <&dm_tifs>;
-};
-
-&mcu_udmap {
-   ti,sci = <&dm_tifs>;
-};
+#include "k3-j721s2-r5.dtsi"
diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts 
b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
index 03bd680f4421..e92b1917df4e 100644
--- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
+++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts
@@ -9,80 +9,4 @@
 #include "k3-j721s2-ddr-evm-lp4-4266.dtsi"
 #include "k3-j721s2-ddr.dtsi"
 #include "k3-j721s2-common-proc-board-u-boot.dtsi"
-
-/ {
-   chosen {
-   tick-timer = &mcu_timer0;
-   };
-
-   aliases {
-   remoteproc0 = &sysctrler;
-   remoteproc1 = &a72_0;
-   };
-
-   a72_0: a72@0 {
-   compatible = "ti,am654-rproc";
-   reg = <0x0 0x00a9 0x0 0x10>;
-   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
-   resets = <&k3_reset 202 0>;
-   clocks = <&k3_clks 61 1>;
-   assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
-   assigned-clock-parents = <&k3_clks 61 2>;
-   assigned-clock-rates = <2>, <20>;
-   ti,sci = <&sms>;
-   ti,sci-proc-id = <32>;
-   ti,sci-host-id = <10>;
-   bootph-pre

[PATCH v2 3/6] arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file

2024-05-09 Thread Manorit Chawdhry
Currently AM68 SK boots with J721s2 R5 DTS and then later changes to
AM68 SK DT during runtime.

To split the support of J721s2 and AM68, sync AM68 R5 DT with J721s2 R5
DT as that contains some essential node changes for booting up AM68
using AM68 R5 DT.

secure_proxy_mcu and secure_proxy_sa3 node changes are required for
establishing contact with TIFS running on M4 core, and the addition of
new power domain helps in holding A72 in reset for configuration of
firewalls.

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/k3-am68-sk-r5-base-board.dts | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
index 695aadc287bd..038b08dc3e01 100644
--- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
+++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
@@ -24,7 +24,8 @@
compatible = "ti,am654-rproc";
reg = <0x0 0x00a9 0x0 0x10>;
power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
-   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
+   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
+   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
resets = <&k3_reset 202 0>;
clocks = <&k3_clks 61 1>;
assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
@@ -54,10 +55,12 @@
 
 &secure_proxy_mcu {
bootph-pre-ram;
+   status = "okay";
 };
 
 &secure_proxy_sa3 {
bootph-pre-ram;
+   status = "okay";
 };
 
 &cbass_mcu_wakeup {

-- 
2.43.2



[PATCH v2 2/6] configs: j721s2_evm_a72_defconfig: Switch to bootstd

2024-05-09 Thread Manorit Chawdhry
From: Neha Malcom Francis 

Switch to using bootstd. Note that with this change, we will stop using
distro_bootcmd and instead depend entirely on bootflow method of
starting the system up.

Also config_distro_bootcmd.h header file that is no longer needed in
j721s2_evm.h.

Signed-off-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 configs/j721s2_evm_a72_defconfig | 5 +++--
 include/configs/j721s2_evm.h | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 19cd44b068c0..8b02d07a9f09 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -33,9 +33,10 @@ CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
+CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
 CONFIG_LOGLEVEL=7
 CONFIG_SPL_MAX_SIZE=0xc
 CONFIG_SPL_BOARD_INIT=y
diff --git a/include/configs/j721s2_evm.h b/include/configs/j721s2_evm.h
index 846cfa7531cc..6186ec32b1d8 100644
--- a/include/configs/j721s2_evm.h
+++ b/include/configs/j721s2_evm.h
@@ -10,7 +10,6 @@
 #define __CONFIG_J721S2_EVM_H
 
 #include 
-#include 
 
 /* SPL Loader Configuration */
 #if defined(CONFIG_TARGET_J721S2_A72_EVM)

-- 
2.43.2



[PATCH v2 1/6] board: ti: j721s2: j721s2.env: Add explicit boot_targets

2024-05-09 Thread Manorit Chawdhry
From: Neha Malcom Francis 

Add explicit boot_targets to indicate the specific boot sequence to
follow.

Signed-off-by: Neha Malcom Francis 
Signed-off-by: Manorit Chawdhry 
---
 board/ti/j721s2/j721s2.env | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env
index 9a03b9f30aee..a6b22550809e 100644
--- a/board/ti/j721s2/j721s2.env
+++ b/board/ti/j721s2/j721s2.env
@@ -13,6 +13,7 @@ args_all=setenv optargs earlycon=ns16550a,mmio32,0x0288
${mtdparts}
 run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
 
+boot_targets=mmc1 mmc0 usb pxe dhcp
 boot=mmc
 mmcdev=1
 bootpart=1:2

-- 
2.43.2



[PATCH v2 0/6] Enable OF_UPSTREAM for J721s2 and AM68

2024-05-09 Thread Manorit Chawdhry
Series splits AM68 and J721s2 support along with enabling OF_UPSTREAM
and adding stdboot support for both the platforms.

Boot logs: https://gist.github.com/manorit2001/6c669e4273933bc46c3b28a631a96ae3

Signed-off-by: Manorit Chawdhry 
---
Changes in v2:
- Improve the commit message (Neha)
- Re-order the patches to not break bisectability
- Link to v1: 
https://lore.kernel.org/r/20240508-b4-upstream-j721s2-of-upstream-v1-0-ed0933172...@ti.com

---
Manorit Chawdhry (4):
  arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file
  arch: arm: dts: k3-j721s2-r5: Introduce k3-j721s2-r5.dtsi
  configs: am68_sk: Move to separate defconfig for AM68 SK board
  arm: dts: k3-j721s2|am68: Migrate to OF_UPSTREAM

Neha Malcom Francis (2):
  board: ti: j721s2: j721s2.env: Add explicit boot_targets
  configs: j721s2_evm_a72_defconfig: Switch to bootstd

 arch/arm/dts/Makefile  |4 +-
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   41 +-
 arch/arm/dts/k3-am68-sk-base-board.dts |  611 ---
 arch/arm/dts/k3-am68-sk-r5-base-board.dts  |   75 +-
 arch/arm/dts/k3-am68-sk-som.dtsi   |  259 ---
 arch/arm/dts/k3-j721s2-binman.dtsi |   91 +-
 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|   18 +-
 arch/arm/dts/k3-j721s2-common-proc-board.dts   |  504 -
 arch/arm/dts/k3-j721s2-main.dtsi   | 1928 
 arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi |  738 
 arch/arm/dts/k3-j721s2-r5-common-proc-board.dts|   78 +-
 arch/arm/dts/k3-j721s2-r5.dtsi |   81 +
 arch/arm/dts/k3-j721s2-som-p0.dtsi |  361 
 arch/arm/dts/k3-j721s2-thermal.dtsi|  101 -
 arch/arm/dts/k3-j721s2.dtsi|  175 --
 board/ti/j721s2/MAINTAINERS|   11 +-
 board/ti/j721s2/j721s2.env |1 +
 configs/am68_sk_a72_defconfig  |   10 +
 configs/am68_sk_r5_defconfig   |   10 +
 configs/j721s2_evm_a72_defconfig   |   10 +-
 configs/j721s2_evm_r5_defconfig|2 +-
 include/configs/j721s2_evm.h   |1 -
 22 files changed, 155 insertions(+), 4955 deletions(-)
---
base-commit: 2f1e76bcfee75b9f99ade63002c05ffaaec86afb
change-id: 20240506-b4-upstream-j721s2-of-upstream-3c28ff12d664

Best regards,
-- 
Manorit Chawdhry 



Re: [PATCH 4/6] arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file

2024-05-08 Thread Manorit Chawdhry
Hi Neha,

On 11:29-20240509, Neha Malcom Francis wrote:
> Hi Manorit
> 
> On 09/05/24 11:04, Manorit Chawdhry wrote:
> > Hi Neha,
> > 
> > On 10:37-20240509, Manorit Chawdhry wrote:
> > > Hi Neha,
> > > 
> > > On 16:09-20240508, Neha Malcom Francis wrote:
> > > > Hi Manorit,
> > > > 
> > > > On 08/05/24 12:56, Manorit Chawdhry wrote:
> > > > > Update the file with the required nodes from J721s2 R5 file to start
> > > > > using k3-am68-sk-r5 file for AM68.
> > > > > 
> > > > > Signed-off-by: Manorit Chawdhry 
> > > > > ---
> > > > 
> > > > What's the motivation behind this patch vs. squashing it into patch 5/6?
> > > > 
> > > 
> > > Could've squashed it ig, I think developed it in this order so this
> > > remained. Would squash it. Also realised that I should be putting that
> > > patch before the config split otherwise am68 boot would break again.
> > > Would take that up as well in v2. Thanks for the review!
> > > 
> > 
> > Though on second thoughts.. I think it's good as it tells that AM68 R5
> > DT had been missing some changes. If someone wants to track what changed
> > then ig it's better that they don't have to debug the merge commit which
> > ends up altering the contents of AM68 R5 DT ( in-case this patch ain't
> > there ) and people will have to manually check the diff as to what
> > altered. Do you think it's better to keep this patch with the following
> > reasoning?
> > 
> 
> Yes you can do that but I think this commit message is confusing. The "start
> using k3-am68-sk-r5 file for AM68" threw me off, maybe modify it to say that
> AM68 R5 DT is missing these changes and needs them why? After that grabbing
> the common bits into an SoC R5 file in patch 5/6 makes sense.
> 

Ah okay, I think I can explain better "start using k3-am68-sk-r5 file"
in the commit message itself along with telling the reasoning as to why
it wasn't failing previously as well along with your suggestions.
Thanks!

Regards,
Manorit

> 
> > Regards,
> > Manorit
> > 
> > > Regards,
> > > Manorit
> > > 
> > > > >arch/arm/dts/k3-am68-sk-r5-base-board.dts | 5 -
> > > > >1 file changed, 4 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
> > > > > b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > > > > index 695aadc287bd..038b08dc3e01 100644
> > > > > --- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > > > > +++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > > > > @@ -24,7 +24,8 @@
> > > > >   compatible = "ti,am654-rproc";
> > > > >   reg = <0x0 0x00a9 0x0 0x10>;
> > > > >   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
> > > > > - <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
> > > > > + <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
> > > > > + <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
> > > > >   resets = <&k3_reset 202 0>;
> > > > >   clocks = <&k3_clks 61 1>;
> > > > >   assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
> > > > > @@ -54,10 +55,12 @@
> > > > >&secure_proxy_mcu {
> > > > >   bootph-pre-ram;
> > > > > + status = "okay";
> > > > >};
> > > > >&secure_proxy_sa3 {
> > > > >   bootph-pre-ram;
> > > > > + status = "okay";
> > > > >};
> > > > >&cbass_mcu_wakeup {
> > > > > 
> > > > 
> > > > -- 
> > > > Thanking You
> > > > Neha Malcom Francis
> 
> -- 
> Thanking You
> Neha Malcom Francis


Re: [PATCH 4/6] arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file

2024-05-08 Thread Manorit Chawdhry
Hi Neha,

On 10:37-20240509, Manorit Chawdhry wrote:
> Hi Neha,
> 
> On 16:09-20240508, Neha Malcom Francis wrote:
> > Hi Manorit,
> > 
> > On 08/05/24 12:56, Manorit Chawdhry wrote:
> > > Update the file with the required nodes from J721s2 R5 file to start
> > > using k3-am68-sk-r5 file for AM68.
> > > 
> > > Signed-off-by: Manorit Chawdhry 
> > > ---
> > 
> > What's the motivation behind this patch vs. squashing it into patch 5/6?
> > 
> 
> Could've squashed it ig, I think developed it in this order so this
> remained. Would squash it. Also realised that I should be putting that
> patch before the config split otherwise am68 boot would break again.
> Would take that up as well in v2. Thanks for the review!
> 

Though on second thoughts.. I think it's good as it tells that AM68 R5
DT had been missing some changes. If someone wants to track what changed
then ig it's better that they don't have to debug the merge commit which
ends up altering the contents of AM68 R5 DT ( in-case this patch ain't
there ) and people will have to manually check the diff as to what
altered. Do you think it's better to keep this patch with the following
reasoning?

Regards,
Manorit

> Regards,
> Manorit
> 
> > >   arch/arm/dts/k3-am68-sk-r5-base-board.dts | 5 -
> > >   1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
> > > b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > > index 695aadc287bd..038b08dc3e01 100644
> > > --- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > > +++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > > @@ -24,7 +24,8 @@
> > >   compatible = "ti,am654-rproc";
> > >   reg = <0x0 0x00a9 0x0 0x10>;
> > >   power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
> > > - <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
> > > + <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
> > > + <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
> > >   resets = <&k3_reset 202 0>;
> > >   clocks = <&k3_clks 61 1>;
> > >   assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
> > > @@ -54,10 +55,12 @@
> > >   &secure_proxy_mcu {
> > >   bootph-pre-ram;
> > > + status = "okay";
> > >   };
> > >   &secure_proxy_sa3 {
> > >   bootph-pre-ram;
> > > + status = "okay";
> > >   };
> > >   &cbass_mcu_wakeup {
> > > 
> > 
> > -- 
> > Thanking You
> > Neha Malcom Francis


Re: [PATCH 4/6] arch: arm: dts: k3-am68-sk-r5: Sync with J721s2 R5 file

2024-05-08 Thread Manorit Chawdhry
Hi Neha,

On 16:09-20240508, Neha Malcom Francis wrote:
> Hi Manorit,
> 
> On 08/05/24 12:56, Manorit Chawdhry wrote:
> > Update the file with the required nodes from J721s2 R5 file to start
> > using k3-am68-sk-r5 file for AM68.
> > 
> > Signed-off-by: Manorit Chawdhry 
> > ---
> 
> What's the motivation behind this patch vs. squashing it into patch 5/6?
> 

Could've squashed it ig, I think developed it in this order so this
remained. Would squash it. Also realised that I should be putting that
patch before the config split otherwise am68 boot would break again.
Would take that up as well in v2. Thanks for the review!

Regards,
Manorit

> >   arch/arm/dts/k3-am68-sk-r5-base-board.dts | 5 -
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/dts/k3-am68-sk-r5-base-board.dts 
> > b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > index 695aadc287bd..038b08dc3e01 100644
> > --- a/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > +++ b/arch/arm/dts/k3-am68-sk-r5-base-board.dts
> > @@ -24,7 +24,8 @@
> > compatible = "ti,am654-rproc";
> > reg = <0x0 0x00a9 0x0 0x10>;
> > power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
> > -   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
> > +   <&k3_pds 202 TI_SCI_PD_EXCLUSIVE>,
> > +   <&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
> > resets = <&k3_reset 202 0>;
> > clocks = <&k3_clks 61 1>;
> > assigned-clocks = <&k3_clks 61 1>, <&k3_clks 202 0>;
> > @@ -54,10 +55,12 @@
> >   &secure_proxy_mcu {
> > bootph-pre-ram;
> > +   status = "okay";
> >   };
> >   &secure_proxy_sa3 {
> > bootph-pre-ram;
> > +   status = "okay";
> >   };
> >   &cbass_mcu_wakeup {
> > 
> 
> -- 
> Thanking You
> Neha Malcom Francis


[PATCH 6/6] arm: dts: k3-j721s2|am68: Migrate to OF_UPSTREAM

2024-05-08 Thread Manorit Chawdhry
Use OF_UPSTREAM to pull Linux DT from dts/ tree

Signed-off-by: Manorit Chawdhry 
---
 arch/arm/dts/Makefile  |4 +-
 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi |   20 +-
 arch/arm/dts/k3-am68-sk-base-board.dts |  611 ---
 arch/arm/dts/k3-am68-sk-som.dtsi   |  259 ---
 arch/arm/dts/k3-j721s2-binman.dtsi |2 +-
 .../dts/k3-j721s2-common-proc-board-u-boot.dtsi|   18 +-
 arch/arm/dts/k3-j721s2-common-proc-board.dts   |  504 -
 arch/arm/dts/k3-j721s2-main.dtsi   | 1928 
 arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi |  738 
 arch/arm/dts/k3-j721s2-som-p0.dtsi |  361 
 arch/arm/dts/k3-j721s2-thermal.dtsi|  101 -
 arch/arm/dts/k3-j721s2.dtsi|  175 --
 board/ti/j721s2/MAINTAINERS|8 -
 configs/am68_sk_a72_defconfig  |6 +-
 configs/j721s2_evm_a72_defconfig   |5 +-
 15 files changed, 23 insertions(+), 4717 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c9f1b25ad647..60660f24d942 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1331,9 +1331,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += 
k3-j721e-common-proc-board.dtb \
  k3-j721e-beagleboneai64.dtb \
  k3-j721e-r5-beagleboneai64.dtb
 
-dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-base-board.dtb\
-  k3-am68-sk-r5-base-board.dtb\
-  k3-j721s2-common-proc-board.dtb\
+dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-r5-base-board.dtb\
   k3-j721s2-r5-common-proc-board.dtb
 
 dtb-$(CONFIG_SOC_K3_J784S4) += k3-am69-r5-sk.dtb \
diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
index dca588485d41..4b8d73a92d6a 100644
--- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
@@ -19,10 +19,14 @@
 
 &cbass_mcu_wakeup {
bootph-all;
+};
 
-   chipid@4314 {
-   bootph-all;
-   };
+&wkup_conf {
+   bootph-all;
+};
+
+&chipid {
+   bootph-all;
 };
 
 &mcu_navss {
@@ -34,14 +38,6 @@
 };
 
 &mcu_udmap {
-   reg =   <0x0 0x285c 0x0 0x100>,
-   <0x0 0x284c 0x0 0x4000>,
-   <0x0 0x2a80 0x0 0x4>,
-   <0x0 0x284a 0x0 0x4000>,
-   <0x0 0x2aa0 0x0 0x4>,
-   <0x0 0x2840 0x0 0x2000>;
-   reg-names = "gcfg", "rchan", "rchanrt", "tchan",
-   "tchanrt", "rflow";
bootph-all;
 };
 
@@ -132,7 +128,7 @@
 
 #ifdef CONFIG_TARGET_J721S2_A72_EVM
 
-#define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
+#define SPL_AM68_SK_DTB "spl/dts/ti/k3-am68-sk-base-board.dtb"
 #define AM68_SK_DTB "u-boot.dtb"
 
 &spl_j721s2_evm_dtb {
diff --git a/arch/arm/dts/k3-am68-sk-base-board.dts 
b/arch/arm/dts/k3-am68-sk-base-board.dts
deleted file mode 100644
index 1e1a82f9d2b8..
--- a/arch/arm/dts/k3-am68-sk-base-board.dts
+++ /dev/null
@@ -1,611 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
- *
- * Base Board: https://www.ti.com/lit/zip/SPRR463
- */
-
-/dts-v1/;
-
-#include "k3-am68-sk-som.dtsi"
-#include 
-#include 
-#include 
-
-#include "k3-serdes.h"
-
-/ {
-   compatible = "ti,am68-sk", "ti,j721s2";
-   model = "Texas Instruments AM68 SK";
-
-   chosen {
-   stdout-path = "serial2:115200n8";
-   };
-
-   aliases {
-   serial0 = &wkup_uart0;
-   serial1 = &mcu_uart0;
-   serial2 = &main_uart8;
-   mmc1 = &main_sdhci1;
-   can0 = &mcu_mcan0;
-   can1 = &mcu_mcan1;
-   can2 = &main_mcan6;
-   can3 = &main_mcan7;
-   };
-
-   vusb_main: regulator-vusb-main5v0 {
-   /* USB MAIN INPUT 5V DC */
-   compatible = "regulator-fixed";
-   regulator-name = "vusb-main5v0";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   regulator-always-on;
-   regulator-boot-on;
-   };
-
-   vsys_3v3: regulator-vsys3v3 {
-   /* Output of LM5141 */
-   compatible = "regulator-fixed";
-   regulator-name = "vsys_3v3";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   vi

  1   2   3   4   5   >