Re: [PATCH] arm: mach-k3: am62p: Fixup TF-A/OP-TEE reserved-memory node in FDT

2024-05-23 Thread Bryan Brattlof
On May 23, 2024 thus sayeth Bryan Brattlof:
> On May 23, 2024 thus sayeth Andrew Davis:
> > On 5/23/24 11:43 AM, Bryan Brattlof wrote:
> > > The address we load TFA and OPTEE is configurable by the
> > > CONFIG_K3_{ATF,OPTEE)_LOAD_ADDR, but the DT node reservations remain
> > > static which can cause some confusion about where exactly these firmware
> > > are exactly. Fix this by updating the reserved-memory{} nodes when the
> > > loaded address does not match the address in DT.
> > > 
> > > Reported-by: Andrew Davis 
> > > Signed-off-by: Bryan Brattlof 
> > > ---
> > > Hello everyone,
> > > 
> > > This is a little fixup to avoid any confusion once we're in the kernel.
> > > Because TF-A can be configured in U-Boot to be anywhere we want, we need
> > > up update the reserved-memory{} node with this change.
> > > 
> > > Thanks for reviewing
> > > ~Bryan
> > > ---
> > >   arch/arm/mach-k3/Makefile   |  1 +
> > >   arch/arm/mach-k3/am62p5_fdt.c   | 16 
> > 
> > You'll want to rebase this on -next, these _fdt.c files all got moved
> > into directories for each SoC.
> > 
> 
> Ah! my bad, you're right this belongs in -next. v2 incoming momentarily
> 

Wait no on second thought, this needs to be in v2024.07 also. I'll leave 
this for Tom for -master and maybe send out another version for -next to 
preempt the merge conflict for v2024.10?

~Bryan


Re: [PATCH] arm: mach-k3: am62p: Fixup TF-A/OP-TEE reserved-memory node in FDT

2024-05-23 Thread Bryan Brattlof
On May 23, 2024 thus sayeth Andrew Davis:
> On 5/23/24 11:43 AM, Bryan Brattlof wrote:
> > The address we load TFA and OPTEE is configurable by the
> > CONFIG_K3_{ATF,OPTEE)_LOAD_ADDR, but the DT node reservations remain
> > static which can cause some confusion about where exactly these firmware
> > are exactly. Fix this by updating the reserved-memory{} nodes when the
> > loaded address does not match the address in DT.
> > 
> > Reported-by: Andrew Davis 
> > Signed-off-by: Bryan Brattlof 
> > ---
> > Hello everyone,
> > 
> > This is a little fixup to avoid any confusion once we're in the kernel.
> > Because TF-A can be configured in U-Boot to be anywhere we want, we need
> > up update the reserved-memory{} node with this change.
> > 
> > Thanks for reviewing
> > ~Bryan
> > ---
> >   arch/arm/mach-k3/Makefile   |  1 +
> >   arch/arm/mach-k3/am62p5_fdt.c   | 16 
> 
> You'll want to rebase this on -next, these _fdt.c files all got moved
> into directories for each SoC.
> 

Ah! my bad, you're right this belongs in -next. v2 incoming momentarily

Thanks Andrew
~Bryan


[PATCH] arm: mach-k3: am62p: Fixup TF-A/OP-TEE reserved-memory node in FDT

2024-05-23 Thread Bryan Brattlof
The address we load TFA and OPTEE is configurable by the
CONFIG_K3_{ATF,OPTEE)_LOAD_ADDR, but the DT node reservations remain
static which can cause some confusion about where exactly these firmware
are exactly. Fix this by updating the reserved-memory{} nodes when the
loaded address does not match the address in DT.

Reported-by: Andrew Davis 
Signed-off-by: Bryan Brattlof 
---
Hello everyone,

This is a little fixup to avoid any confusion once we're in the kernel. 
Because TF-A can be configured in U-Boot to be anywhere we want, we need 
up update the reserved-memory{} node with this change.

Thanks for reviewing
~Bryan
---
 arch/arm/mach-k3/Makefile   |  1 +
 arch/arm/mach-k3/am62p5_fdt.c   | 16 
 arch/arm/mach-k3/am62px/Kconfig |  1 +
 3 files changed, 18 insertions(+)

diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile
index 1bd523329a4f8..4e9d0925f13f5 100644
--- a/arch/arm/mach-k3/Makefile
+++ b/arch/arm/mach-k3/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_SOC_K3_J721S2) += j721s2_fdt.o
 obj-$(CONFIG_SOC_K3_AM625) += am625_fdt.o
 obj-$(CONFIG_SOC_K3_AM62A7) += am62a7_fdt.o
 obj-$(CONFIG_SOC_K3_J784S4) += j784s4_fdt.o
+obj-$(CONFIG_SOC_K3_AM62P5) += am62p5_fdt.o
 endif
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_SOC_K3_AM654) += am654_init.o
diff --git a/arch/arm/mach-k3/am62p5_fdt.c b/arch/arm/mach-k3/am62p5_fdt.c
new file mode 100644
index 0..d67f012a5dcc4
--- /dev/null
+++ b/arch/arm/mach-k3/am62p5_fdt.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include "common_fdt.h"
+#include 
+
+int ft_system_setup(void *blob, struct bd_info *bd)
+{
+   fdt_fixup_reserved(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR, 0x8);
+   fdt_fixup_reserved(blob, "optee", CONFIG_K3_OPTEE_LOAD_ADDR, 0x180);
+
+   return 0;
+}
diff --git a/arch/arm/mach-k3/am62px/Kconfig b/arch/arm/mach-k3/am62px/Kconfig
index 38a9e6811b119..76ae86b66222f 100644
--- a/arch/arm/mach-k3/am62px/Kconfig
+++ b/arch/arm/mach-k3/am62px/Kconfig
@@ -13,6 +13,7 @@ config TARGET_AM62P5_A53_EVM
bool "TI K3 based AM62P5 EVM running on A53"
select ARM64
select BINMAN
+   select OF_SYSTEM_SETUP
 
 config TARGET_AM62P5_R5_EVM
bool "TI K3 based AM62P5 EVM running on R5"

---
base-commit: a7f0154c412859323396111dd0c09dbafbc153cb
change-id: 20240520-am62p-fdt-fix-7c51e1a1cd54

Best regards,
-- 
Bryan Brattlof 



Re: [PATCH v3 2/2] configs: add defconfigs for the am625-lp-sk

2024-05-16 Thread Bryan Brattlof
On May 15, 2024 thus sayeth Andrew Davis:
> On 5/15/24 1:21 PM, Tom Rini wrote:
> > On Fri, May 03, 2024 at 11:44:29AM -0500, Bryan Brattlof wrote:
> > 
> > > The am62x-lp-sk is a package and reference board spin of the am62x-sk to
> > > showcase the low-power features of the am62x SoC family. Because it so
> > > closely resembles the am62x-sk board, use the preprocessor to inherit
> > > its configuration making the needed changes for this board where
> > > necessary.
> > > 
> > > Reviewed-by: Dhruva Gole 
> > > Signed-off-by: Bryan Brattlof 
> > > ---
> > >   configs/am62x_lp_sk_a53_defconfig | 3 +++
> > >   configs/am62x_lp_sk_r5_defconfig  | 2 ++
> > >   2 files changed, 5 insertions(+)
> > > 
> > > diff --git a/configs/am62x_lp_sk_a53_defconfig 
> > > b/configs/am62x_lp_sk_a53_defconfig
> > > new file mode 100644
> > > index 0..904b2142b2f53
> > > --- /dev/null
> > > +++ b/configs/am62x_lp_sk_a53_defconfig
> > > @@ -0,0 +1,3 @@
> > > +#include 
> > > +CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62-lp-sk"
> > > +CONFIG_OF_UPSTREAM=y
> > 
> > So, there's a problem here. The #include trick for defconfig files isn't
> > working as intended, exactly. The example here doesn't work right.
> > First, it shows up as a variant of "sandbox" (as buildman will show and
> > leads to https://source.denx.de/u-boot/u-boot/-/jobs/835067#L119)
> > 
> > And this becomes clearer if you look at configs/am69_sk_r5_defconfig
> > which has to set some symbols already found in
> > configs/j784s4_evm_r5_defconfig in order to work. This is seemingly very
> > not equivalent to invoking "make foo_defconfig bar.config" to combine
> > things.
> > 
> 
> This is equivalent when running make. The issue is with buildman which
> manually checks the content of the defconfig to find what ARCH it should
> run the defconfig with. buildman doesn't understand the #include yet.
> Until buildman can be fixed, you'll need to do what we did with
> am69_sk_r5_defconfig and redefine the ARCH/SOC/TARGET info in the
> defconfig file so buildman can find it without following the #include.

Ah Okay, I'll take a stab at the buildman fix. Also noticed in the logs 
I didn't add the configs to a MAINTAINERS entry.

~Bryan


Re: [PATCH v2 0/2] introduce basic support for TI's am625-lp-sk

2024-05-03 Thread Bryan Brattlof
Sorry everyone I hit send a little to fast on this one!

On May  3, 2024 thus sayeth Bryan Brattlof:
> Hello Everyone!
> 
> The am625-lp-sk is a variant of the am625-sk showcasing the low-power 
> features of the am625 SoC Family. Because it's essentially a board and 
> package spin of the am625-sk I've inherited the am625 configuration and 
> overridden what was needed.
> 
> This is a new spin of Nitin's original work which has been updated 
> significantly since October 2023
> 
>   https://lore.kernel.org/u-boot/20231030110138.1347603-1-n-ya...@ti.com/
> 
> Unfortunately a patch is need on top of this series to boot:
> 
>   https://lore.kernel.org/u-boot/20240429214936.15187-1...@ti.com
> 
> For those of us interested here is proof of life using buildroot:
> 
>https://paste.sr.ht/~bryanb/40f7787f7760bee383aa8fbc342a29e8544dbdab
> 
> Thank you for reviewing
> ~Bryan
> 
> Signed-off-by: Bryan Brattlof 
> ---
> Changes in v2:
> - updated copyright year
> - Link to v1: 
> https://lore.kernel.org/r/20240429-am62q-wip-v1-0-927fd2e0a...@ti.com
> 

Didn't actually fixup the copyright year. Just sent out v3 which 
actually did what I said I was going to :/

Sorry for the spam.

~Bryan


[PATCH v3 1/2] arm: dts: add U-Boot dtbs for the am625-lp-sk

2024-05-03 Thread Bryan Brattlof
From: Nitin Yadav 

Add the U-Boot device tree overrides for the am62x-lp-sk reference
board.

Signed-off-by: Nitin Yadav 
Reviewed-by: Dhruva Gole 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
 arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
 arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 ++
 arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
 4 files changed, 2310 insertions(+)

diff --git a/arch/arm/dts/k3-am62-lp-sk-binman.dtsi 
b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
new file mode 100644
index 0..18341d0d3f2e7
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+#include "k3-am625-sk-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM625_A53_EVM
+
+#define SPL_AM62_LP_SK_DTB "spl/dts/ti/k3-am62-lp-sk.dtb"
+
+_am625_sk_dtb {
+   filename = SPL_AM62_LP_SK_DTB;
+};
+
+_am625_sk_dtb_unsigned {
+   filename = SPL_AM62_LP_SK_DTB;
+};
+
+#endif
diff --git a/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
new file mode 100644
index 0..cbcc7f3bb45cb
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AM62x LP SK dts file for SPLs
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-am62-lp-sk-binman.dtsi"
+
+/ {
+   chosen {
+   tick-timer = _timer0;
+   };
+};
+
+_timer0 {
+   clock-frequency = <2500>;
+};
diff --git a/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi 
b/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi
new file mode 100644
index 0..c255ae6530f5b
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi
@@ -0,0 +1,2190 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This file was generated with the
+ * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.07
+ * Wed Mar 01 2023 17:52:11 GMT-0600 (Central Standard Time)
+ * DDR Type: LPDDR4
+ * F0 = 50MHzF1 = NA F2 = 800MHz
+ * Density (per channel): 16Gb
+ * Write DBI: Enable
+ * Number of Ranks: 1
+ */
+
+#define DDRSS_PLL_FHS_CNT 3
+#define DDRSS_PLL_FREQUENCY_1 4
+#define DDRSS_PLL_FREQUENCY_2 4
+
+#define DDRSS_CTL_0_DATA 0x0B00
+#define DDRSS_CTL_1_DATA 0x
+#define DDRSS_CTL_2_DATA 0x
+#define DDRSS_CTL_3_DATA 0x
+#define DDRSS_CTL_4_DATA 0x
+#define DDRSS_CTL_5_DATA 0x
+#define DDRSS_CTL_6_DATA 0x
+#define DDRSS_CTL_7_DATA 0x2710
+#define DDRSS_CTL_8_DATA 0x000186A0
+#define DDRSS_CTL_9_DATA 0x0005
+#define DDRSS_CTL_10_DATA 0x0064
+#define DDRSS_CTL_11_DATA 0x00027100
+#define DDRSS_CTL_12_DATA 0x00186A00
+#define DDRSS_CTL_13_DATA 0x0005
+#define DDRSS_CTL_14_DATA 0x0640
+#define DDRSS_CTL_15_DATA 0x00027100
+#define DDRSS_CTL_16_DATA 0x00186A00
+#define DDRSS_CTL_17_DATA 0x0005
+#define DDRSS_CTL_18_DATA 0x0640
+#define DDRSS_CTL_19_DATA 0x01010100
+#define DDRSS_CTL_20_DATA 0x01010100
+#define DDRSS_CTL_21_DATA 0x01000110
+#define DDRSS_CTL_22_DATA 0x02010002
+#define DDRSS_CTL_23_DATA 0x000A
+#define DDRSS_CTL_24_DATA 0x000186A0
+#define DDRSS_CTL_25_DATA 0x
+#define DDRSS_CTL_26_DATA 0x
+#define DDRSS_CTL_27_DATA 0x
+#define DDRSS_CTL_28_DATA 0x
+#define DDRSS_CTL_29_DATA 0x00020200
+#define DDRSS_CTL_30_DATA 0x
+#define DDRSS_CTL_31_DATA 0x
+#define DDRSS_CTL_32_DATA 0x
+#define DDRSS_CTL_33_DATA 0x
+#define DDRSS_CTL_34_DATA 0x0810
+#define DDRSS_CTL_35_DATA 0x2020
+#define DDRSS_CTL_36_DATA 0x
+#define DDRSS_CTL_37_DATA 0x
+#define DDRSS_CTL_38_DATA 0x040C
+#define DDRSS_CTL_39_DATA 0x
+#define DDRSS_CTL_40_DATA 0x081C
+#define DDRSS_CTL_41_DATA 0x
+#define DDRSS_CTL_42_DATA 0x081C
+#define DDRSS_CTL_43_DATA 0x
+#define DDRSS_CTL_44_DATA 0x05000804
+#define DDRSS_CTL_45_DATA 0x0700
+#define DDRSS_CTL_46_DATA 0x09090004
+#define DDRSS_CTL_47_DATA 0x0203
+#define DDRSS_CTL_48_DATA 0x00320007
+#define DDRSS_CTL_49_DATA 0x09090023
+#define DDRSS_CTL_50_DATA 0x190F
+#define DDRSS_CTL_51_DATA 0x00320007
+#define DDRSS_CTL_52_DATA 0x09090023
+#define DDRSS_CTL_53_DATA 0x0900190F
+#define DDRSS_CTL_54_DATA 0x000A0A09
+#define DDRSS_CTL_55_DATA 0x040006DB
+#define DDRSS_CTL_56_DATA 0x09092004
+#define DDRSS_CTL_57_DATA 0x0C0A
+#define DDRSS_CTL_58_DATA 0x06006DB0
+#define DDRSS_CTL_59_DATA 0x09092006
+#define DDRSS_CTL_60_DATA 0x0C0A
+#define DDRSS_CTL_61_DATA 0x06006DB0
+#define DDRSS_CTL_62_DATA 0x03042006
+#define DDRSS_CTL_63_DATA 0x04050002
+#define DDRSS_CTL_64_DATA 0x100F100F
+#define DDRSS_CTL_65_DATA 0x01010008
+#define DDRSS_CTL_66_DATA 0x041F1F07
+#define DDRSS_CTL_67_DATA 0x0303

[PATCH v3 0/2] introduce basic support for TI's am625-lp-sk

2024-05-03 Thread Bryan Brattlof
Hello Everyone!

The am625-lp-sk is a variant of the am625-sk showcasing the low-power 
features of the am625 SoC Family. Because it's essentially a board and 
package spin of the am625-sk I've inherited the am625 configuration and 
overridden what was needed.

This is a new spin of Nitin's original work which has been updated 
significantly since October 2023

  https://lore.kernel.org/u-boot/20231030110138.1347603-1-n-ya...@ti.com/

Unfortunately a patch is need on top of this series to boot:

  https://lore.kernel.org/u-boot/20240429214936.15187-1...@ti.com

For those of us interested here is proof of life using buildroot:

   https://paste.sr.ht/~bryanb/40f7787f7760bee383aa8fbc342a29e8544dbdab

Thank you for reviewing
~Bryan

Signed-off-by: Bryan Brattlof 
---
Changes in v3:
- actually update the copyright year
- Link to v2: 
https://lore.kernel.org/r/20240429-am62q-wip-v2-0-e78f09174...@ti.com

Changes in v2:
- updated copyright year
- Link to v1: 
https://lore.kernel.org/r/20240429-am62q-wip-v1-0-927fd2e0a...@ti.com

---
Bryan Brattlof (1):
  configs: add defconfigs for the am625-lp-sk

Nitin Yadav (1):
  arm: dts: add U-Boot dtbs for the am625-lp-sk

 arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
 arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
 arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 ++
 arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
 configs/am62x_lp_sk_a53_defconfig|3 +
 configs/am62x_lp_sk_r5_defconfig |2 +
 6 files changed, 2315 insertions(+)
---
base-commit: 714d31ca73fe1dd7a8217afc4a9f6a35ef7a9c01
change-id: 20240429-am62q-wip-f3453de038fb

Best regards,
-- 
Bryan Brattlof 



[PATCH v3 2/2] configs: add defconfigs for the am625-lp-sk

2024-05-03 Thread Bryan Brattlof
The am62x-lp-sk is a package and reference board spin of the am62x-sk to
showcase the low-power features of the am62x SoC family. Because it so
closely resembles the am62x-sk board, use the preprocessor to inherit
its configuration making the needed changes for this board where
necessary.

Reviewed-by: Dhruva Gole 
Signed-off-by: Bryan Brattlof 
---
 configs/am62x_lp_sk_a53_defconfig | 3 +++
 configs/am62x_lp_sk_r5_defconfig  | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/configs/am62x_lp_sk_a53_defconfig 
b/configs/am62x_lp_sk_a53_defconfig
new file mode 100644
index 0..904b2142b2f53
--- /dev/null
+++ b/configs/am62x_lp_sk_a53_defconfig
@@ -0,0 +1,3 @@
+#include 
+CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62-lp-sk"
+CONFIG_OF_UPSTREAM=y
diff --git a/configs/am62x_lp_sk_r5_defconfig b/configs/am62x_lp_sk_r5_defconfig
new file mode 100644
index 0..93b3922e6fec5
--- /dev/null
+++ b/configs/am62x_lp_sk_r5_defconfig
@@ -0,0 +1,2 @@
+#include 
+CONFIG_DEFAULT_DEVICE_TREE="k3-am62-r5-lp-sk"

-- 
2.43.2



[PATCH v2 1/2] arm: dts: add U-Boot dtbs for the am625-lp-sk

2024-05-03 Thread Bryan Brattlof
From: Nitin Yadav 

Add the U-Boot device tree overrides for the am62x-lp-sk reference
board.

Signed-off-by: Nitin Yadav 
Reviewed-by: Dhruva Gole 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
 arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
 arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 ++
 arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
 4 files changed, 2310 insertions(+)

diff --git a/arch/arm/dts/k3-am62-lp-sk-binman.dtsi 
b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
new file mode 100644
index 0..de425a4b54f81
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+#include "k3-am625-sk-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM625_A53_EVM
+
+#define SPL_AM62_LP_SK_DTB "spl/dts/ti/k3-am62-lp-sk.dtb"
+
+_am625_sk_dtb {
+   filename = SPL_AM62_LP_SK_DTB;
+};
+
+_am625_sk_dtb_unsigned {
+   filename = SPL_AM62_LP_SK_DTB;
+};
+
+#endif
diff --git a/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
new file mode 100644
index 0..08f572446657e
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AM62x LP SK dts file for SPLs
+ * Copyright (C) 2021-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-am62-lp-sk-binman.dtsi"
+
+/ {
+   chosen {
+   tick-timer = _timer0;
+   };
+};
+
+_timer0 {
+   clock-frequency = <2500>;
+};
diff --git a/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi 
b/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi
new file mode 100644
index 0..c255ae6530f5b
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi
@@ -0,0 +1,2190 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This file was generated with the
+ * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.07
+ * Wed Mar 01 2023 17:52:11 GMT-0600 (Central Standard Time)
+ * DDR Type: LPDDR4
+ * F0 = 50MHzF1 = NA F2 = 800MHz
+ * Density (per channel): 16Gb
+ * Write DBI: Enable
+ * Number of Ranks: 1
+ */
+
+#define DDRSS_PLL_FHS_CNT 3
+#define DDRSS_PLL_FREQUENCY_1 4
+#define DDRSS_PLL_FREQUENCY_2 4
+
+#define DDRSS_CTL_0_DATA 0x0B00
+#define DDRSS_CTL_1_DATA 0x
+#define DDRSS_CTL_2_DATA 0x
+#define DDRSS_CTL_3_DATA 0x
+#define DDRSS_CTL_4_DATA 0x
+#define DDRSS_CTL_5_DATA 0x
+#define DDRSS_CTL_6_DATA 0x
+#define DDRSS_CTL_7_DATA 0x2710
+#define DDRSS_CTL_8_DATA 0x000186A0
+#define DDRSS_CTL_9_DATA 0x0005
+#define DDRSS_CTL_10_DATA 0x0064
+#define DDRSS_CTL_11_DATA 0x00027100
+#define DDRSS_CTL_12_DATA 0x00186A00
+#define DDRSS_CTL_13_DATA 0x0005
+#define DDRSS_CTL_14_DATA 0x0640
+#define DDRSS_CTL_15_DATA 0x00027100
+#define DDRSS_CTL_16_DATA 0x00186A00
+#define DDRSS_CTL_17_DATA 0x0005
+#define DDRSS_CTL_18_DATA 0x0640
+#define DDRSS_CTL_19_DATA 0x01010100
+#define DDRSS_CTL_20_DATA 0x01010100
+#define DDRSS_CTL_21_DATA 0x01000110
+#define DDRSS_CTL_22_DATA 0x02010002
+#define DDRSS_CTL_23_DATA 0x000A
+#define DDRSS_CTL_24_DATA 0x000186A0
+#define DDRSS_CTL_25_DATA 0x
+#define DDRSS_CTL_26_DATA 0x
+#define DDRSS_CTL_27_DATA 0x
+#define DDRSS_CTL_28_DATA 0x
+#define DDRSS_CTL_29_DATA 0x00020200
+#define DDRSS_CTL_30_DATA 0x
+#define DDRSS_CTL_31_DATA 0x
+#define DDRSS_CTL_32_DATA 0x
+#define DDRSS_CTL_33_DATA 0x
+#define DDRSS_CTL_34_DATA 0x0810
+#define DDRSS_CTL_35_DATA 0x2020
+#define DDRSS_CTL_36_DATA 0x
+#define DDRSS_CTL_37_DATA 0x
+#define DDRSS_CTL_38_DATA 0x040C
+#define DDRSS_CTL_39_DATA 0x
+#define DDRSS_CTL_40_DATA 0x081C
+#define DDRSS_CTL_41_DATA 0x
+#define DDRSS_CTL_42_DATA 0x081C
+#define DDRSS_CTL_43_DATA 0x
+#define DDRSS_CTL_44_DATA 0x05000804
+#define DDRSS_CTL_45_DATA 0x0700
+#define DDRSS_CTL_46_DATA 0x09090004
+#define DDRSS_CTL_47_DATA 0x0203
+#define DDRSS_CTL_48_DATA 0x00320007
+#define DDRSS_CTL_49_DATA 0x09090023
+#define DDRSS_CTL_50_DATA 0x190F
+#define DDRSS_CTL_51_DATA 0x00320007
+#define DDRSS_CTL_52_DATA 0x09090023
+#define DDRSS_CTL_53_DATA 0x0900190F
+#define DDRSS_CTL_54_DATA 0x000A0A09
+#define DDRSS_CTL_55_DATA 0x040006DB
+#define DDRSS_CTL_56_DATA 0x09092004
+#define DDRSS_CTL_57_DATA 0x0C0A
+#define DDRSS_CTL_58_DATA 0x06006DB0
+#define DDRSS_CTL_59_DATA 0x09092006
+#define DDRSS_CTL_60_DATA 0x0C0A
+#define DDRSS_CTL_61_DATA 0x06006DB0
+#define DDRSS_CTL_62_DATA 0x03042006
+#define DDRSS_CTL_63_DATA 0x04050002
+#define DDRSS_CTL_64_DATA 0x100F100F
+#define DDRSS_CTL_65_DATA 0x01010008
+#define DDRSS_CTL_66_DATA 0x041F1F07
+#define DDRSS_CTL_67_DATA 0x0303

[PATCH v2 2/2] configs: add defconfigs for the am625-lp-sk

2024-05-03 Thread Bryan Brattlof
The am62x-lp-sk is a package and reference board spin of the am62x-sk to
showcase the low-power features of the am62x SoC family. Because it so
closely resembles the am62x-sk board, use the preprocessor to inherit
its configuration making the needed changes for this board where
necessary.

Reviewed-by: Dhruva Gole 
Signed-off-by: Bryan Brattlof 
---
 configs/am62x_lp_sk_a53_defconfig | 3 +++
 configs/am62x_lp_sk_r5_defconfig  | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/configs/am62x_lp_sk_a53_defconfig 
b/configs/am62x_lp_sk_a53_defconfig
new file mode 100644
index 0..904b2142b2f53
--- /dev/null
+++ b/configs/am62x_lp_sk_a53_defconfig
@@ -0,0 +1,3 @@
+#include 
+CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62-lp-sk"
+CONFIG_OF_UPSTREAM=y
diff --git a/configs/am62x_lp_sk_r5_defconfig b/configs/am62x_lp_sk_r5_defconfig
new file mode 100644
index 0..93b3922e6fec5
--- /dev/null
+++ b/configs/am62x_lp_sk_r5_defconfig
@@ -0,0 +1,2 @@
+#include 
+CONFIG_DEFAULT_DEVICE_TREE="k3-am62-r5-lp-sk"

-- 
2.43.2



[PATCH v2 0/2] introduce basic support for TI's am625-lp-sk

2024-05-03 Thread Bryan Brattlof
Hello Everyone!

The am625-lp-sk is a variant of the am625-sk showcasing the low-power 
features of the am625 SoC Family. Because it's essentially a board and 
package spin of the am625-sk I've inherited the am625 configuration and 
overridden what was needed.

This is a new spin of Nitin's original work which has been updated 
significantly since October 2023

  https://lore.kernel.org/u-boot/20231030110138.1347603-1-n-ya...@ti.com/

Unfortunately a patch is need on top of this series to boot:

  https://lore.kernel.org/u-boot/20240429214936.15187-1...@ti.com

For those of us interested here is proof of life using buildroot:

   https://paste.sr.ht/~bryanb/40f7787f7760bee383aa8fbc342a29e8544dbdab

Thank you for reviewing
~Bryan

Signed-off-by: Bryan Brattlof 
---
Changes in v2:
- updated copyright year
- Link to v1: 
https://lore.kernel.org/r/20240429-am62q-wip-v1-0-927fd2e0a...@ti.com

---
Bryan Brattlof (1):
  configs: add defconfigs for the am625-lp-sk

Nitin Yadav (1):
  arm: dts: add U-Boot dtbs for the am625-lp-sk

 arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
 arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
 arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 ++
 arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
 configs/am62x_lp_sk_a53_defconfig|3 +
 configs/am62x_lp_sk_r5_defconfig |2 +
 6 files changed, 2315 insertions(+)
---
base-commit: 714d31ca73fe1dd7a8217afc4a9f6a35ef7a9c01
change-id: 20240429-am62q-wip-f3453de038fb

Best regards,
-- 
Bryan Brattlof 



Re: [PATCH] configs: am62x_evm_r5: Increase size of malloc_simple heap after relocation

2024-05-03 Thread Bryan Brattlof
Thanks Judith!

On April 29, 2024 thus sayeth Judith Mendez:
> On AM62x SK we can see a boot failure with signature "alloc space
> exhausted", so fix by increasing size of SPL_STACK_R_MALLOC_SIMPLE_LEN.
> 
> Fixes: 128f81290b ("arm: dts: k3: binman: am625: add support for signing 
> TIFSSTUB Images")
> Signed-off-by: Judith Mendez 
> ---
>  configs/am62x_evm_r5_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 

This fixes the 62 for me

Reviewed-by: Bryan Brattlof 

~Bryan


Re: [PATCH 1/2] arm: dts: add U-Boot dtbs for the am625-lp-sk

2024-05-03 Thread Bryan Brattlof
On May  3, 2024 thus sayeth Dhruva Gole:
> On Apr 30, 2024 at 14:57:45 -0500, Bryan Brattlof wrote:
> > From: Nitin Yadav 
> > 
> > Add the U-Boot device tree overrides for the am62x-lp-sk reference
> > board.
> > 
> > Signed-off-by: Nitin Yadav 
> > Signed-off-by: Bryan Brattlof 
> > ---
> >  arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
> >  arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
> >  arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 
> > ++
> >  arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
> >  4 files changed, 2310 insertions(+)
> > 
> > diff --git a/arch/arm/dts/k3-am62-lp-sk-binman.dtsi 
> > b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
> > new file mode 100644
> > index 0..de425a4b54f81
> > --- /dev/null
> > +++ b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
> > @@ -0,0 +1,21 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
> 
> Can make this 2024, here and everywhere else.
> 
> > + */
> > +
> > +#include "k3-binman.dtsi"
> > +#include "k3-am625-sk-binman.dtsi"
> > +
> > +#ifdef CONFIG_TARGET_AM625_A53_EVM
> > +
> > +#define SPL_AM62_LP_SK_DTB "spl/dts/ti/k3-am62-lp-sk.dtb"
> > +
> > +_am625_sk_dtb {
> > +   filename = SPL_AM62_LP_SK_DTB;
> > +};
> > +
> > +_am625_sk_dtb_unsigned {
> > +   filename = SPL_AM62_LP_SK_DTB;
> > +};
> > +
> > +#endif
> > diff --git a/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi 
> > b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
> > new file mode 100644
> > index 0..08f572446657e
> > --- /dev/null
> > +++ b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
> > @@ -0,0 +1,17 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * AM62x LP SK dts file for SPLs
> > + * Copyright (C) 2021-2023 Texas Instruments Incorporated - 
> > https://www.ti.com/
> 
> 2024 ^^
> 
> [...]
> 
> With that fixed,
> Reviewed-by: Dhruva Gole 
> 

Okay I'll get that fixed for v2

~Bryan


Re: [PATCH 63/81] soc: Remove and add needed includes

2024-05-03 Thread Bryan Brattlof
On May  1, 2024 thus sayeth Tom Rini:
> Remove  from this driver directory and when needed
> add missing include files directly.
> 
> Signed-off-by: Tom Rini 
> ---
> Cc: Tom Rini 
> Cc: Simon Glass 
> Cc: Michal Simek 
> Cc: Nishanth Menon 
> Cc: Roger Quadros 
> Cc: Apurva Nandan 
> Cc: Hari Nagalla 
> Cc: Bryan Brattlof 
> ---
>  drivers/soc/soc-uclass.c| 1 -
>  drivers/soc/soc_sandbox.c   | 1 -
>  drivers/soc/soc_ti_k3.c | 1 -
>  drivers/soc/soc_xilinx_versal.c | 1 -
>  drivers/soc/soc_xilinx_versal_net.c | 1 -
>  drivers/soc/soc_xilinx_zynqmp.c | 1 -
>  drivers/soc/ti/k3-navss-ringacc.c   | 1 -
>  drivers/soc/ti/keystone_serdes.c| 1 -
>  drivers/soc/ti/pruss.c  | 1 -
>  9 files changed, 9 deletions(-)
> 

...

>  
> diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
> index 3a4e58bba671..b585e47d46fe 100644
> --- a/drivers/soc/soc_ti_k3.c
> +++ b/drivers/soc/soc_ti_k3.c
> @@ -4,7 +4,6 @@
>   *   Dave Gerlach 
>   */
>  
> -#include 
>  #include 
>  #include 
>  

Thanks Tom!

Reviewed-by: Bryan Brattlof 

~Bryan


[PATCH 1/2] arm: dts: add U-Boot dtbs for the am625-lp-sk

2024-04-30 Thread Bryan Brattlof
From: Nitin Yadav 

Add the U-Boot device tree overrides for the am62x-lp-sk reference
board.

Signed-off-by: Nitin Yadav 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
 arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
 arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 ++
 arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
 4 files changed, 2310 insertions(+)

diff --git a/arch/arm/dts/k3-am62-lp-sk-binman.dtsi 
b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
new file mode 100644
index 0..de425a4b54f81
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp-sk-binman.dtsi
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-binman.dtsi"
+#include "k3-am625-sk-binman.dtsi"
+
+#ifdef CONFIG_TARGET_AM625_A53_EVM
+
+#define SPL_AM62_LP_SK_DTB "spl/dts/ti/k3-am62-lp-sk.dtb"
+
+_am625_sk_dtb {
+   filename = SPL_AM62_LP_SK_DTB;
+};
+
+_am625_sk_dtb_unsigned {
+   filename = SPL_AM62_LP_SK_DTB;
+};
+
+#endif
diff --git a/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi 
b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
new file mode 100644
index 0..08f572446657e
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AM62x LP SK dts file for SPLs
+ * Copyright (C) 2021-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "k3-am62-lp-sk-binman.dtsi"
+
+/ {
+   chosen {
+   tick-timer = _timer0;
+   };
+};
+
+_timer0 {
+   clock-frequency = <2500>;
+};
diff --git a/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi 
b/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi
new file mode 100644
index 0..c255ae6530f5b
--- /dev/null
+++ b/arch/arm/dts/k3-am62-lp4-50-800-800.dtsi
@@ -0,0 +1,2190 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This file was generated with the
+ * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.07
+ * Wed Mar 01 2023 17:52:11 GMT-0600 (Central Standard Time)
+ * DDR Type: LPDDR4
+ * F0 = 50MHzF1 = NA F2 = 800MHz
+ * Density (per channel): 16Gb
+ * Write DBI: Enable
+ * Number of Ranks: 1
+ */
+
+#define DDRSS_PLL_FHS_CNT 3
+#define DDRSS_PLL_FREQUENCY_1 4
+#define DDRSS_PLL_FREQUENCY_2 4
+
+#define DDRSS_CTL_0_DATA 0x0B00
+#define DDRSS_CTL_1_DATA 0x
+#define DDRSS_CTL_2_DATA 0x
+#define DDRSS_CTL_3_DATA 0x
+#define DDRSS_CTL_4_DATA 0x
+#define DDRSS_CTL_5_DATA 0x
+#define DDRSS_CTL_6_DATA 0x
+#define DDRSS_CTL_7_DATA 0x2710
+#define DDRSS_CTL_8_DATA 0x000186A0
+#define DDRSS_CTL_9_DATA 0x0005
+#define DDRSS_CTL_10_DATA 0x0064
+#define DDRSS_CTL_11_DATA 0x00027100
+#define DDRSS_CTL_12_DATA 0x00186A00
+#define DDRSS_CTL_13_DATA 0x0005
+#define DDRSS_CTL_14_DATA 0x0640
+#define DDRSS_CTL_15_DATA 0x00027100
+#define DDRSS_CTL_16_DATA 0x00186A00
+#define DDRSS_CTL_17_DATA 0x0005
+#define DDRSS_CTL_18_DATA 0x0640
+#define DDRSS_CTL_19_DATA 0x01010100
+#define DDRSS_CTL_20_DATA 0x01010100
+#define DDRSS_CTL_21_DATA 0x01000110
+#define DDRSS_CTL_22_DATA 0x02010002
+#define DDRSS_CTL_23_DATA 0x000A
+#define DDRSS_CTL_24_DATA 0x000186A0
+#define DDRSS_CTL_25_DATA 0x
+#define DDRSS_CTL_26_DATA 0x
+#define DDRSS_CTL_27_DATA 0x
+#define DDRSS_CTL_28_DATA 0x
+#define DDRSS_CTL_29_DATA 0x00020200
+#define DDRSS_CTL_30_DATA 0x
+#define DDRSS_CTL_31_DATA 0x
+#define DDRSS_CTL_32_DATA 0x
+#define DDRSS_CTL_33_DATA 0x
+#define DDRSS_CTL_34_DATA 0x0810
+#define DDRSS_CTL_35_DATA 0x2020
+#define DDRSS_CTL_36_DATA 0x
+#define DDRSS_CTL_37_DATA 0x
+#define DDRSS_CTL_38_DATA 0x040C
+#define DDRSS_CTL_39_DATA 0x
+#define DDRSS_CTL_40_DATA 0x081C
+#define DDRSS_CTL_41_DATA 0x
+#define DDRSS_CTL_42_DATA 0x081C
+#define DDRSS_CTL_43_DATA 0x
+#define DDRSS_CTL_44_DATA 0x05000804
+#define DDRSS_CTL_45_DATA 0x0700
+#define DDRSS_CTL_46_DATA 0x09090004
+#define DDRSS_CTL_47_DATA 0x0203
+#define DDRSS_CTL_48_DATA 0x00320007
+#define DDRSS_CTL_49_DATA 0x09090023
+#define DDRSS_CTL_50_DATA 0x190F
+#define DDRSS_CTL_51_DATA 0x00320007
+#define DDRSS_CTL_52_DATA 0x09090023
+#define DDRSS_CTL_53_DATA 0x0900190F
+#define DDRSS_CTL_54_DATA 0x000A0A09
+#define DDRSS_CTL_55_DATA 0x040006DB
+#define DDRSS_CTL_56_DATA 0x09092004
+#define DDRSS_CTL_57_DATA 0x0C0A
+#define DDRSS_CTL_58_DATA 0x06006DB0
+#define DDRSS_CTL_59_DATA 0x09092006
+#define DDRSS_CTL_60_DATA 0x0C0A
+#define DDRSS_CTL_61_DATA 0x06006DB0
+#define DDRSS_CTL_62_DATA 0x03042006
+#define DDRSS_CTL_63_DATA 0x04050002
+#define DDRSS_CTL_64_DATA 0x100F100F
+#define DDRSS_CTL_65_DATA 0x01010008
+#define DDRSS_CTL_66_DATA 0x041F1F07
+#define DDRSS_CTL_67_DATA 0x0303
+#define DDRSS_CTL

[PATCH 2/2] configs: add defconfigs for the am625-lp-sk

2024-04-30 Thread Bryan Brattlof
The am62x-lp-sk is a package and reference board spin of the am62x-sk to
showcase the low-power features of the am62x SoC family. Because it so
closely resembles the am62x-sk board, us the preprocessor to inherit its
configuration making the needed changes for this board.

Signed-off-by: Bryan Brattlof 
---
 configs/am62x_lp_sk_a53_defconfig | 3 +++
 configs/am62x_lp_sk_r5_defconfig  | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/configs/am62x_lp_sk_a53_defconfig 
b/configs/am62x_lp_sk_a53_defconfig
new file mode 100644
index 0..904b2142b2f53
--- /dev/null
+++ b/configs/am62x_lp_sk_a53_defconfig
@@ -0,0 +1,3 @@
+#include 
+CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62-lp-sk"
+CONFIG_OF_UPSTREAM=y
diff --git a/configs/am62x_lp_sk_r5_defconfig b/configs/am62x_lp_sk_r5_defconfig
new file mode 100644
index 0..93b3922e6fec5
--- /dev/null
+++ b/configs/am62x_lp_sk_r5_defconfig
@@ -0,0 +1,2 @@
+#include 
+CONFIG_DEFAULT_DEVICE_TREE="k3-am62-r5-lp-sk"

-- 
2.43.2



[PATCH 0/2] introduce basic support for TI's am625-lp-sk

2024-04-30 Thread Bryan Brattlof
Hello Everyone!

The am625-lp-sk is a variant of the am625-sk showcasing the low-power 
features of the am625 SoC Family. Because it's essentially a board and 
package spin of the am625-sk I've inherited the am625 configuration and 
overridden what was needed.

This is a new spin of Nitin's original work which has been updated 
significantly since October 2023

  https://lore.kernel.org/u-boot/20231030110138.1347603-1-n-ya...@ti.com/

Unfortunately a few patches have broken the am62x boot currently and 
need to be added and reverted for this series to work:

One to increase the size of MALLOC space to make room for the DM stubs

  https://lore.kernel.org/u-boot/20240429214936.15187-1...@ti.com

And this patch (in active debug) will need to be reverted for MMC boot.

   
https://lore.kernel.org/u-boot/20240422190035.25852-1-greg.mal...@timesys.com/

For those of us interested here is proof of life using buildroot:

   https://paste.sr.ht/~bryanb/40f7787f7760bee383aa8fbc342a29e8544dbdab

Thank you for reviewing
~Bryan

Signed-off-by: Bryan Brattlof 
---
Bryan Brattlof (1):
  configs: add defconfigs for the am625-lp-sk

Nitin Yadav (1):
  arm: dts: add U-Boot dtbs for the am625-lp-sk

 arch/arm/dts/k3-am62-lp-sk-binman.dtsi   |   21 +
 arch/arm/dts/k3-am62-lp-sk-u-boot.dtsi   |   17 +
 arch/arm/dts/k3-am62-lp4-50-800-800.dtsi | 2190 ++
 arch/arm/dts/k3-am62-r5-lp-sk.dts|   82 ++
 configs/am62x_lp_sk_a53_defconfig|3 +
 configs/am62x_lp_sk_r5_defconfig |2 +
 6 files changed, 2315 insertions(+)
---
base-commit: b43a0c7ed600fc608262b9a274a1cad4c7465b6a
change-id: 20240429-am62q-wip-f3453de038fb

Best regards,
-- 
Bryan Brattlof 



Re: [PATCH v2] configs: am62px_evm_a53_defconfig: Enable MMC UHS config option

2024-04-19 Thread Bryan Brattlof
On April 16, 2024 thus sayeth Judith Mendez:
> Enable MMC UHS support for to allow to enter the UHS
> modes for MMC1.
> 

s/support for/support/

Though it doesn't really matter to me. ;)

> Signed-off-by: Judith Mendez 
> ---
> Changes since v1:
> - Fix typo in patch description
> ---
> 
>  configs/am62px_evm_a53_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 

Thanks for finally getting MMC sorted so we can enable these configs

Acked-by: Bryan Brattlof 

~Bryan


Re: [RFC PATCH 08/15] arm: mach-k3: j722s: introduce clock and device files for wkup spl

2024-04-04 Thread Bryan Brattlof
On April  4, 2024 thus sayeth Jayesh Choudhary:
> Include the clock and lpsc tree files needed for the wkup spl to
> initialize the proper PLLs and power domains to boot the SoC.
> 
> Signed-off-by: Vaishnav Achath 
> Signed-off-by: Jayesh Choudhary 
> ---
>  arch/arm/mach-k3/r5/Makefile   |   1 +
>  arch/arm/mach-k3/r5/j722s/Makefile |   6 +
>  arch/arm/mach-k3/r5/j722s/clk-data.c   | 312 +
>  arch/arm/mach-k3/r5/j722s/dev-data.c   |  69 ++
>  drivers/clk/ti/clk-k3.c|   6 +
>  drivers/power/domain/ti-power-domain.c |   6 +
>  include/k3-clk.h   |   1 +
>  include/k3-dev.h   |   1 +
>  8 files changed, 402 insertions(+)
>  create mode 100644 arch/arm/mach-k3/r5/j722s/Makefile
>  create mode 100644 arch/arm/mach-k3/r5/j722s/clk-data.c
>  create mode 100644 arch/arm/mach-k3/r5/j722s/dev-data.c
> 

Reviewed-by: Bryan Brattlof 

~Bryan


Re: [RFC PATCH 05/15] clk: ti: clk-k3: use IS_ENABLED macro and fix the clock-data order

2024-04-04 Thread Bryan Brattlof
On April  4, 2024 thus sayeth Jayesh Choudhary:
> Use IS_ENABLED macro for the platform clock-data list and add them
> in alphabetical order.
> 
> Signed-off-by: Jayesh Choudhary 
> ---
>  drivers/clk/ti/clk-k3.c | 41 +
>  1 file changed, 21 insertions(+), 20 deletions(-)
> 

Reviewed-by: Bryan Brattlof 

~Bryan



Re: [PATCH 1/2] arm: mach-k3: am625: copy bootindex to OCRAM for main domain SPL

2024-04-01 Thread Bryan Brattlof
On April  1, 2024 thus sayeth Wadim Egorov:
> Hi Vignesh, Hi Bryan,
> 
> 
> Am 05.03.24 um 18:36 schrieb Raghavendra, Vignesh:
> > 
> > 
> > On 3/5/2024 11:04 PM, Bryan Brattlof wrote:
> > > On March  5, 2024 thus sayeth Vignesh Raghavendra:
> > > > 
> > > > On 05/03/24 01:57, Bryan Brattlof wrote:
> > > > > Hey Vignesh!
> > > > > 
> > > > > On March  4, 2024 thus sayeth Vignesh Raghavendra:
> > > > > > Hi Wadim,
> > > > > > 
> > > > > > On 26/02/24 19:00, Wadim Egorov wrote:
> > > > > > > Texas Instruments has begun enabling security settings on the 
> > > > > > > SoCs it
> > > > > > > produces to instruct ROM and TIFS to begin protecting the Security
> > > > > > > Management Subsystem (SMS) from other binaries we load into the 
> > > > > > > chip by
> > > > > > > default.
> > > > > > > 
> > > > > > > One way ROM and TIFS do this is by enabling firewalls to protect 
> > > > > > > the
> > > > > > > OCSRAM and HSM RAM regions they're using during bootup.
> > > > > > > 
> > > > > > > The HSM RAM the wakeup SPL is in is firewalled by TIFS to protect
> > > > > > > itself from the main domain applications. This means the 
> > > > > > > 'bootindex'
> > > > > > > value in HSM RAM, left by ROM to indicate if we're using the 
> > > > > > > primary
> > > > > > > or secondary boot-method, must be moved to OCSRAM (that TIFS has 
> > > > > > > open
> > > > > > > for us) before we make the jump to the main domain so the main 
> > > > > > > domain's
> > > > > > > bootloaders can keep access to this information.
> > > > > > > 
> > > > > > > Based on commit
> > > > > > >b672e8581070 ("arm: mach-k3: copy bootindex to OCRAM for main 
> > > > > > > domain SPL")
> 
> I was thinking, even if the reason described here is not right or does not
> apply to the am62x, it is still a valid solution for carrying this variable
> into the context for next stage A53 bootloader.
> 
> store_boot_info_from_rom() stores the index to the bootindex (.data)
> variable which makes sure it is valid in R5 SPL context. But the next stage
> bootloader does not know anything about the bootindex variable. So from my
> understanding it needs to be copied to a different region to preserve the
> data for next stage bootloaders.
> 
> Or do I miss something?

That's correct. We typically put this bootindex variable in the same 
location for both SPLs.

~Bryan

> > > > > > > 
> > > > > > FYI, this is mostly a problem in non SPL flow (TI prosperity SBL for
> > > > > > example) where HSM RAM would be used by HSM firmware. This should 
> > > > > > be a
> > > > > > issue in R5 SPL flow.  Do you see any issues today? If so, whats the
> > > > > > TIFS firmware being used?
> > > > > > 
> > > > > > > Signed-off-by: Wadim Egorov 
> > > > > > > ---
> > > > > > >   arch/arm/mach-k3/Kconfig  |  3 ++-
> > > > > > >   arch/arm/mach-k3/am625_init.c | 15 
> > > > > > > +--
> > > > > > >   arch/arm/mach-k3/include/mach/am62_hardware.h | 15 
> > > > > > > +++
> > > > > > >   3 files changed, 30 insertions(+), 3 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
> > > > > > > index 03898424c9..f5d06593f7 100644
> > > > > > > --- a/arch/arm/mach-k3/Kconfig
> > > > > > > +++ b/arch/arm/mach-k3/Kconfig
> > > > > > > @@ -75,7 +75,8 @@ config SYS_K3_BOOT_PARAM_TABLE_INDEX
> > > > > > >   default 0x41cffbfc if SOC_K3_J721E
> > > > > > >   default 0x41cfdbfc if SOC_K3_J721S2
> > > > > > >   default 0x701bebfc if SOC_K3_AM642
> > > > > > > - default 0x43c3f290 if SOC_K3_AM625
> > > > > > > + default 0x43c3f290 if SOC_K3_AM625 && CPU_V7R
> > > > > > > + default 0x7000f290 if SO

[PATCH v4 10/13] arm: dts: introduce am62p5 U-Boot dts files

2024-03-12 Thread Bryan Brattlof
Include the U-Boot device tree files needed to boot the board.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/Makefile  |2 +
 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
 arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
 arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   23 +
 5 files changed, 3099 insertions(+)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 784192125d352..a965a70f37cc6 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1437,6 +1437,8 @@ dtb-$(CONFIG_SOC_K3_AM625) += k3-am625-sk.dtb \
 dtb-$(CONFIG_SOC_K3_AM62A7) += k3-am62a7-sk.dtb \
  k3-am62a7-r5-sk.dtb
 
+dtb-$(CONFIG_SOC_K3_AM62P5) += k3-am62p5-r5-sk.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7622-rfb.dtb \
mt7623a-unielec-u7623-02-emmc.dtb \
diff --git a/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi 
b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
new file mode 100644
index 0..f66435201530f
--- /dev/null
+++ b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
@@ -0,0 +1,2800 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This file was generated with the
+ * AM62Px SysConfig DDR Subsystem Register Configuration Tool v0.10.02
+ * Thu Jan 25 2024 10:43:46 GMT-0600 (Central Standard Time)
+ * DDR Type: LPDDR4
+ * F0 = 50MHzF1 = NA F2 = 1600MHz
+ * Density (per channel): 16Gb
+ * Number of Ranks: 2
+ */
+
+#define DDRSS_PLL_FHS_CNT 5
+#define DDRSS_PLL_FREQUENCY_1 8
+#define DDRSS_PLL_FREQUENCY_2 8
+#define DDRSS_SDRAM_IDX 17
+#define DDRSS_REGION_IDX 17
+
+#define DDRSS_CTL_0_DATA 0x0B00
+#define DDRSS_CTL_1_DATA 0x
+#define DDRSS_CTL_2_DATA 0x
+#define DDRSS_CTL_3_DATA 0x
+#define DDRSS_CTL_4_DATA 0x
+#define DDRSS_CTL_5_DATA 0x
+#define DDRSS_CTL_6_DATA 0x
+#define DDRSS_CTL_7_DATA 0x2710
+#define DDRSS_CTL_8_DATA 0x000186A0
+#define DDRSS_CTL_9_DATA 0x0005
+#define DDRSS_CTL_10_DATA 0x0064
+#define DDRSS_CTL_11_DATA 0x0004E200
+#define DDRSS_CTL_12_DATA 0x0030D400
+#define DDRSS_CTL_13_DATA 0x0005
+#define DDRSS_CTL_14_DATA 0x0C80
+#define DDRSS_CTL_15_DATA 0x0004E200
+#define DDRSS_CTL_16_DATA 0x0030D400
+#define DDRSS_CTL_17_DATA 0x0005
+#define DDRSS_CTL_18_DATA 0x0C80
+#define DDRSS_CTL_19_DATA 0x01010100
+#define DDRSS_CTL_20_DATA 0x01010100
+#define DDRSS_CTL_21_DATA 0x01000110
+#define DDRSS_CTL_22_DATA 0x02010002
+#define DDRSS_CTL_23_DATA 0x000A
+#define DDRSS_CTL_24_DATA 0x000186A0
+#define DDRSS_CTL_25_DATA 0x
+#define DDRSS_CTL_26_DATA 0x
+#define DDRSS_CTL_27_DATA 0x
+#define DDRSS_CTL_28_DATA 0x
+#define DDRSS_CTL_29_DATA 0x00020200
+#define DDRSS_CTL_30_DATA 0x
+#define DDRSS_CTL_31_DATA 0x
+#define DDRSS_CTL_32_DATA 0x
+#define DDRSS_CTL_33_DATA 0x
+#define DDRSS_CTL_34_DATA 0x0810
+#define DDRSS_CTL_35_DATA 0x4040
+#define DDRSS_CTL_36_DATA 0x
+#define DDRSS_CTL_37_DATA 0x
+#define DDRSS_CTL_38_DATA 0x
+#define DDRSS_CTL_39_DATA 0x
+#define DDRSS_CTL_40_DATA 0x040C
+#define DDRSS_CTL_41_DATA 0x
+#define DDRSS_CTL_42_DATA 0x0E38
+#define DDRSS_CTL_43_DATA 0x
+#define DDRSS_CTL_44_DATA 0x0E38
+#define DDRSS_CTL_45_DATA 0x
+#define DDRSS_CTL_46_DATA 0x05000804
+#define DDRSS_CTL_47_DATA 0x0700
+#define DDRSS_CTL_48_DATA 0x09090004
+#define DDRSS_CTL_49_DATA 0x0303
+#define DDRSS_CTL_50_DATA 0x00620011
+#define DDRSS_CTL_51_DATA 0x09110045
+#define DDRSS_CTL_52_DATA 0x421D
+#define DDRSS_CTL_53_DATA 0x00620011
+#define DDRSS_CTL_54_DATA 0x09110045
+#define DDRSS_CTL_55_DATA 0x0900421D
+#define DDRSS_CTL_56_DATA 0x000A0A09
+#define DDRSS_CTL_57_DATA 0x040006DB
+#define DDRSS_CTL_58_DATA 0x090D2005
+#define DDRSS_CTL_59_DATA 0x1710
+#define DDRSS_CTL_60_DATA 0x0C00DB60
+#define DDRSS_CTL_61_DATA 0x090D200D
+#define DDRSS_CTL_62_DATA 0x1710
+#define DDRSS_CTL_63_DATA 0x0C00DB60
+#define DDRSS_CTL_64_DATA 0x0304200D
+#define DDRSS_CTL_65_DATA 0x04050002
+#define DDRSS_CTL_66_DATA 0x1F1E1F1E
+#define DDRSS_CTL_67_DATA 0x01010008
+#define DDRSS_CTL_68_DATA 0x043C3C07
+#define DDRSS_CTL_69_DATA 0x0303
+#define DDRSS_CTL_70_DATA 0x
+#define DDRSS_CTL_71_DATA 0x0101
+#define DDRSS_CTL_72_DATA 0x
+#define DDRSS_CTL_73_DATA 0x0100
+#define DDRSS_CTL_74_DATA 0x00130803
+#define DDRSS_CTL_75_DATA 0x00BB
+#define DDRSS_CTL_76_DATA 0x0260
+#define DDRSS_CTL_77_DATA 0x1858
+#define DDRSS_CTL_78_DATA 0x0260
+#define DDRSS_CTL_79_DATA 0x1858
+#define DDRSS_CTL_80_DATA 0x0005
+#define DDRSS_CTL_81_DATA 0x000A
+#define DDRSS_CTL_82_DATA 0x0010
+#define DDRSS_CTL_83_DATA 0x0130
+#define DDRSS_CTL_84_DATA 0x0304
+#define DDRSS_CTL_85_DATA 0x0130
+#define DDRSS_CTL_86_DATA 0x0304
+#define DDRSS_CTL_87_DATA

[PATCH v4 03/13] arm: mach-k3: am62px: introduce clock and device files for wkup spl

2024-03-12 Thread Bryan Brattlof
Include the clock and lpsc tree files needed for the wkup spl to
initialize the proper PLLs and power domains to boot the SoC.

Reviewed-by: Neha Malcom Francis 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/r5/Makefile   |   1 +
 arch/arm/mach-k3/r5/am62px/Makefile|   6 +
 arch/arm/mach-k3/r5/am62px/clk-data.c  | 325 +
 arch/arm/mach-k3/r5/am62px/dev-data.c  |  71 +++
 drivers/clk/ti/clk-k3.c|   6 +
 drivers/power/domain/ti-power-domain.c |   8 +-
 include/k3-clk.h   |   1 +
 include/k3-dev.h   |   1 +
 8 files changed, 418 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/r5/Makefile b/arch/arm/mach-k3/r5/Makefile
index ef0bf39d4503b..1cfc8e3ade966 100644
--- a/arch/arm/mach-k3/r5/Makefile
+++ b/arch/arm/mach-k3/r5/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_SOC_K3_J721S2) += j721s2/
 obj-$(CONFIG_SOC_K3_AM625) += am62x/
 obj-$(CONFIG_SOC_K3_AM62A7) += am62ax/
 obj-$(CONFIG_SOC_K3_J784S4) += j784s4/
+obj-$(CONFIG_SOC_K3_AM62P5) += am62px/
 
 obj-y += common.o
 obj-y += lowlevel_init.o
diff --git a/arch/arm/mach-k3/r5/am62px/Makefile 
b/arch/arm/mach-k3/r5/am62px/Makefile
new file mode 100644
index 0..50b0df20a3d1a
--- /dev/null
+++ b/arch/arm/mach-k3/r5/am62px/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+
+obj-y += clk-data.o
+obj-y += dev-data.o
diff --git a/arch/arm/mach-k3/r5/am62px/clk-data.c 
b/arch/arm/mach-k3/r5/am62px/clk-data.c
new file mode 100644
index 0..4b9892fe05167
--- /dev/null
+++ b/arch/arm/mach-k3/r5/am62px/clk-data.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * AM62PX specific clock platform data
+ *
+ * This file is auto generated. Please do not hand edit and report any issues
+ * to Bryan Brattlof .
+ *
+ * Copyright (C) 2020-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include "k3-clk.h"
+
+static const char * const gluelogic_hfosc0_clkout_parents[] = {
+   NULL,
+   NULL,
+   "osc_24_mhz",
+   "osc_25_mhz",
+   "osc_26_mhz",
+   NULL,
+};
+
+static const char * const clk_32k_rc_sel_out0_parents[] = {
+   "gluelogic_rcosc_clk_1p0v_97p65k",
+   "gluelogic_hfosc0_clkout",
+   "gluelogic_rcosc_clk_1p0v_97p65k",
+   "gluelogic_lfosc0_clkout",
+};
+
+static const char * const main_emmcsd1_io_clklb_sel_out0_parents[] = {
+   "board_0_mmc1_clklb_out",
+   "board_0_mmc1_clk_out",
+};
+
+static const char * const main_ospi_loopback_clk_sel_out0_parents[] = {
+   "board_0_ospi0_dqs_out",
+   "board_0_ospi0_lbclko_out",
+};
+
+static const char * const main_usb0_refclk_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "postdiv4_16ff_main_0_hsdivout8_clk",
+};
+
+static const char * const main_usb1_refclk_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "postdiv4_16ff_main_0_hsdivout8_clk",
+};
+
+static const char * const sam62_pll_ctrl_wrap_main_0_sysclkout_clk_parents[] = 
{
+   "gluelogic_hfosc0_clkout",
+   "hsdiv4_16fft_main_0_hsdivout0_clk",
+};
+
+static const char * const sam62_pll_ctrl_wrap_mcu_0_sysclkout_clk_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "hsdiv4_16fft_mcu_0_hsdivout0_clk",
+};
+
+static const char * const clkout0_ctrl_out0_parents[] = {
+   "hsdiv4_16fft_main_2_hsdivout1_clk",
+   "hsdiv4_16fft_main_2_hsdivout1_clk",
+};
+
+static const char * const main_emmcsd0_refclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_0_hsdivout5_clk",
+   "hsdiv4_16fft_main_2_hsdivout2_clk",
+};
+
+static const char * const main_emmcsd1_refclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_0_hsdivout5_clk",
+   "hsdiv4_16fft_main_2_hsdivout2_clk",
+};
+
+static const char * const main_gtcclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_2_hsdivout5_clk",
+   "postdiv4_16ff_main_0_hsdivout6_clk",
+   "board_0_cp_gemac_cpts0_rft_clk_out",
+   NULL,
+   "board_0_mcu_ext_refclk0_out",
+   "board_0_ext_refclk1_out",
+   "sam62_pll_ctrl_wrap_mcu_0_chip_div1_clk_clk",
+   "sam62_pll_ctrl_wrap_main_0_chip_div1_clk_clk",
+};
+
+static const char * const main_ospi_ref_clk_sel_out0_parents[] = {
+   "hsdiv4_16fft_main_0_hsdivout1_clk",
+   "postdiv1_16fft_main_1_hsdivout5_clk",
+};
+
+static const char * const main_timerclkn_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "clk_32k_rc_sel_out0",
+   "postdiv4_16ff_main_0_hsdivout7_clk&qu

[PATCH v4 08/13] firmware: ti_sci_static_data: add static DMA channel data

2024-03-12 Thread Bryan Brattlof
From: Hari Nagalla 

Include the static DMA channel data for ti_sci

Signed-off-by: Hari Nagalla 
Signed-off-by: Bryan Brattlof 
---
 drivers/firmware/ti_sci_static_data.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/ti_sci_static_data.h 
b/drivers/firmware/ti_sci_static_data.h
index 789f0c6b2d903..9662bd95f2835 100644
--- a/drivers/firmware/ti_sci_static_data.h
+++ b/drivers/firmware/ti_sci_static_data.h
@@ -84,7 +84,8 @@ static struct ti_sci_resource_static_data rm_static_data[] = {
 };
 #endif /* CONFIG_SOC_K3_J721S2 */
 
-#if IS_ENABLED(CONFIG_SOC_K3_AM625) || IS_ENABLED(CONFIG_SOC_K3_AM62A7)
+#if IS_ENABLED(CONFIG_SOC_K3_AM625) || IS_ENABLED(CONFIG_SOC_K3_AM62A7) || \
+   IS_ENABLED(CONFIG_SOC_K3_AM62P5)
 static struct ti_sci_resource_static_data rm_static_data[] = {
/* BC channels */
{
@@ -95,7 +96,7 @@ static struct ti_sci_resource_static_data rm_static_data[] = {
},
{ },
 };
-#endif /* CONFIG_SOC_K3_AM625 || CONFIG_SOC_K3_AM62A7 */
+#endif /* CONFIG_SOC_K3_AM625 || CONFIG_SOC_K3_AM62A7 || CONFIG_SOC_K3_AM62P5 
*/
 
 #if IS_ENABLED(CONFIG_SOC_K3_J784S4)
 static struct ti_sci_resource_static_data rm_static_data[] = {

-- 
2.43.2



[PATCH v4 13/13] arm: mach-k3: fixup whitespace in SPDX License IDs

2024-03-12 Thread Bryan Brattlof
The SPDX ID format usese a single space used after the
'SPDX-License-Identifier:'. Fix all files that use any other white-space
character other than a single space.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/r5/am62ax/Makefile | 2 +-
 arch/arm/mach-k3/r5/am62px/Makefile | 2 +-
 arch/arm/mach-k3/r5/am62x/Makefile  | 2 +-
 arch/arm/mach-k3/r5/j7200/Makefile  | 2 +-
 arch/arm/mach-k3/r5/j721e/Makefile  | 2 +-
 arch/arm/mach-k3/r5/j721s2/Makefile | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-k3/r5/am62ax/Makefile 
b/arch/arm/mach-k3/r5/am62ax/Makefile
index e4e55ce5c7dd2..313ce5a05fdc0 100644
--- a/arch/arm/mach-k3/r5/am62ax/Makefile
+++ b/arch/arm/mach-k3/r5/am62ax/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
 
diff --git a/arch/arm/mach-k3/r5/am62px/Makefile 
b/arch/arm/mach-k3/r5/am62px/Makefile
index 50b0df20a3d1a..091d4fa5b4512 100644
--- a/arch/arm/mach-k3/r5/am62px/Makefile
+++ b/arch/arm/mach-k3/r5/am62px/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
 
diff --git a/arch/arm/mach-k3/r5/am62x/Makefile 
b/arch/arm/mach-k3/r5/am62x/Makefile
index d6c876df66dde..9ab0100ee174a 100644
--- a/arch/arm/mach-k3/r5/am62x/Makefile
+++ b/arch/arm/mach-k3/r5/am62x/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
 
diff --git a/arch/arm/mach-k3/r5/j7200/Makefile 
b/arch/arm/mach-k3/r5/j7200/Makefile
index 0f91cf4daea41..78325db402c56 100644
--- a/arch/arm/mach-k3/r5/j7200/Makefile
+++ b/arch/arm/mach-k3/r5/j7200/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
 obj-y += clk-data.o
diff --git a/arch/arm/mach-k3/r5/j721e/Makefile 
b/arch/arm/mach-k3/r5/j721e/Makefile
index 0f91cf4daea41..78325db402c56 100644
--- a/arch/arm/mach-k3/r5/j721e/Makefile
+++ b/arch/arm/mach-k3/r5/j721e/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
 obj-y += clk-data.o
diff --git a/arch/arm/mach-k3/r5/j721s2/Makefile 
b/arch/arm/mach-k3/r5/j721s2/Makefile
index e794bffb3afa9..8588c5e4c39c6 100644
--- a/arch/arm/mach-k3/r5/j721s2/Makefile
+++ b/arch/arm/mach-k3/r5/j721s2/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
 obj-y += clk-data.o

-- 
2.43.2



[PATCH v4 04/13] ram: k3-ddrss: enable the am62ax's DDR controller for am62px

2024-03-12 Thread Bryan Brattlof
The am62px family of SoCs uses the same DDR controller as found on the
am62ax family. Enable this option when building for the am62px family

Reviewed-by: Neha Malcom Francis 
Signed-off-by: Bryan Brattlof 
---
 drivers/ram/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ram/Kconfig b/drivers/ram/Kconfig
index 8e9e53cbb0e1f..9838a2798f922 100644
--- a/drivers/ram/Kconfig
+++ b/drivers/ram/Kconfig
@@ -65,7 +65,7 @@ choice
default K3_J721E_DDRSS if SOC_K3_J721E || SOC_K3_J721S2 || SOC_K3_J784S4
default K3_AM64_DDRSS if SOC_K3_AM642
default K3_AM64_DDRSS if SOC_K3_AM625
-   default K3_AM62A_DDRSS if SOC_K3_AM62A7
+   default K3_AM62A_DDRSS if SOC_K3_AM62A7 || SOC_K3_AM62P5
 
 config K3_J721E_DDRSS
bool "Enable J721E DDRSS support"

-- 
2.43.2



[PATCH v4 07/13] board: ti: introduce basic board files for the am62px family

2024-03-12 Thread Bryan Brattlof
Introduce the basic files needed to support the am62px family of SoCs

Co-developed-by: Hari Nagalla 
Signed-off-by: Hari Nagalla 
Reviewed-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 board/ti/am62px/Kconfig  |  26 ++
 board/ti/am62px/MAINTAINERS  |   9 +
 board/ti/am62px/Makefile |   7 +
 board/ti/am62px/am62px.env   |  15 +
 board/ti/am62px/board-cfg.yaml   |  37 ++
 board/ti/am62px/evm.c|  29 ++
 board/ti/am62px/pm-cfg.yaml  |  12 +
 board/ti/am62px/rm-cfg.yaml  | 987 +++
 board/ti/am62px/sec-cfg.yaml | 378 +++
 board/ti/am62px/tifs-rm-cfg.yaml | 879 ++
 10 files changed, 2379 insertions(+)

diff --git a/board/ti/am62px/Kconfig b/board/ti/am62px/Kconfig
new file mode 100644
index 0..9d95ffd9b2908
--- /dev/null
+++ b/board/ti/am62px/Kconfig
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+
+if TARGET_AM62P5_R5_EVM || TARGET_AM62P5_A53_EVM
+
+config SYS_BOARD
+   default "am62px"
+
+config SYS_VENDOR
+   default "ti"
+
+config SYS_CONFIG_NAME
+   default "am62px_evm"
+
+source "board/ti/common/Kconfig"
+
+endif
+
+if TARGET_AM62P5_R5_EVM
+
+config SPL_LDSCRIPT
+   default "arch/arm/mach-omap2/u-boot-spl.lds"
+
+endif
diff --git a/board/ti/am62px/MAINTAINERS b/board/ti/am62px/MAINTAINERS
new file mode 100644
index 0..57c86ddbc4aef
--- /dev/null
+++ b/board/ti/am62px/MAINTAINERS
@@ -0,0 +1,9 @@
+AM62Px BOARD
+M: Vignesh Raghavendra 
+M: Bryan Brattlof 
+M: Tom Rini 
+S: Maintained
+F: board/ti/am62px/
+F: include/configs/am62p5_evm.h
+F: configs/am62px_evm_r5_defconfig
+F: configs/am62px_evm_a53_defconfig
diff --git a/board/ti/am62px/Makefile b/board/ti/am62px/Makefile
new file mode 100644
index 0..921afdff27a24
--- /dev/null
+++ b/board/ti/am62px/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += evm.o
diff --git a/board/ti/am62px/am62px.env b/board/ti/am62px/am62px.env
new file mode 100644
index 0..f8b6aff2c2fdf
--- /dev/null
+++ b/board/ti/am62px/am62px.env
@@ -0,0 +1,15 @@
+#include 
+#include 
+
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x0280
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+boot_targets=mmc1 mmc0 pxe dhcp
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+rd_spec=-
diff --git a/board/ti/am62px/board-cfg.yaml b/board/ti/am62px/board-cfg.yaml
new file mode 100644
index 0..d539011aff9f3
--- /dev/null
+++ b/board/ti/am62px/board-cfg.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62Px SoCs
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj: 0x0
+boardcfg_abi_min: 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable: 0x5A
+main_isolation_hostid: 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor: 0x1
+scaling_profile: 0x1
+disable_main_nav_secure_proxy: 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size: 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables: 0x00
+trace_src_enables: 0x00
diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
new file mode 100644
index 0..97a95ce8cc2d5
--- /dev/null
+++ b/board/ti/am62px/evm.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Board specific initialization for AM62Px platforms
+ *
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int board_init(void)
+{
+   return 0;
+}
+
+int dram_init(void)
+{
+   return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+   return fdtdec_setup_memory_banksize();
+}
diff --git a/board/ti/am62px/pm-cfg.yaml b/board/ti/am62px/pm-cfg.yaml
new file mode 100644
index 0..3ff27ce702c26
--- /dev/null
+++ b/board/ti/am62px/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62Px
+#
+#
+---
+pm-cfg:
+rev:
+boardcfg_abi_maj: 0x0
+boardcfg_abi_min: 0x1
diff --git a/board/ti/am62px/rm-cfg.yaml b/board/ti/am62px/rm-cfg.yaml
new file mode 100644
index 0..caa2f7a5a83e1
--- /dev/null
+++ b/board/ti/am62px/rm-cfg.yaml
@@ 

[PATCH v4 00/13] Introduce basic support for TI's AM62Px SoC family

2024-03-12 Thread Bryan Brattlof
Hello Again Everyone!

The AM62Px is an extension of the existing Sitara AM62x low-cost family
of application processors built for Automotive and Linux Application
development. Scalable Arm Cortex-A53 performance and embedded features,
such as: multi high-definition display support, 3D-graphics
acceleration, 4K video acceleration, and extensive peripherals make the
AM62Px well-suited for a broad range of automation and industrial
application, including automotive digital instrumentation, automotive
displays, industrial HMI, and more.

Some highlights of AM62P SoC are:

* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
  Dual/Single core variants are provided in the same package to allow HW
  compatible designs.

* One Device manager Cortex-R5F for system power and resource
  management, and one Cortex-R5F for Functional Safety or
  general-purpose usage.

* One 3D GPU up to 50 GLFOPS

* H.264/H.265 Video Encode/Decode.

* Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
  2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution

* Integrated Giga-bit Ethernet switch supporting up to a total of two
  external ports (TSN capable).

* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
  1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.

* Dedicated Centralized Hardware Security Module with support for secure
  boot, debug security and crypto acceleration and trusted execution
  environment.

* One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.

* Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
  enabling battery powered system design.

For those interested, more details about this SoC can be found in the
Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83

Proof-of-Life: 
https://paste.sr.ht/~bryanb/af2ac108a9362549aa326f182e87918d52bf2d71

Thanks for reviewing!
~Bryan

Changes from v3: [2]
 - rebased on current -next
 - moved remove_fwl_configs() inside the 'has rom loaded the sysfw' 
   check to avoid removing the firewalls when the A53 SPL is executed.
 - added the TFA address for the AM62Px to the ATF_LOAD_ADDR Kconfig
 - fixed formatting issues with clk and dev auto-generated files

 Changes from v2: [1]
 - dropped the extra ARCH_K3 not needed for the K3_DM_FW option
 - removed the extra _pktdma and _bcdma nodes already
   present in the kernel dtbs
 - corrected a few patch fixup errors
 - rebased ontop op OF_UPSTREAM v5 [0]
 - %s/uboot/U-Boot/g

Changes from v1: [0]
 - squashed all clk and lpsc tree updates into a single commit
 - corrected SOC_K3_AM642 typo with DM firmware Kconfig option
 - updated RM configs and dma nodes to enable IP that need DMA
 - added the dtb targets to the dts/Makefile
 - rebased the series on top of v2024.01-rc1
 - switched to bootstd rather than use distro boot scripts.
 - enabled OF_UPSTREAM instead of using the arch/arm/dts directory

[0] https://lore.kernel.org/all/20231012230616.2101992-13...@ti.com/
[1] https://lore.kernel.org/u-boot/20240201030634.1120963-17...@ti.com/
[2] 
https://lore.kernel.org/u-boot/20240205-am62px-wip-rebasing-v3-0-04cbb42ea...@ti.com/

---
Bryan Brattlof (11):
  soc: add info to identify the am62p SoC family
  power: domain: ti: use IS_ENABLED macro
  arm: mach-k3: am62px: introduce clock and device files for wkup spl
  ram: k3-ddrss: enable the am62ax's DDR controller for am62px
  arm: mach-k3: invert logic for split DM firmware config
  arch: mach-k3: introduce basic files to support the am62px SoC family
  board: ti: introduce basic board files for the am62px family
  arm: dts: introduce am62p5 U-Boot dts files
  configs: introduce configs needed for the am62px
  doc: board: ti: introduce am62px documentation
  arm: mach-k3: fixup whitespace in SPDX License IDs

Hari Nagalla (1):
  firmware: ti_sci_static_data: add static DMA channel data

Vignesh Raghavendra (1):
  dma: ti: k3-udma: Add DMA PSIL mappings for AM62P and J722S

 arch/arm/dts/Makefile  |2 +
 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
 arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
 arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   23 +
 arch/arm/mach-k3/Kconfig   |9 +-
 arch/arm/mach-k3/Makefile  |1 +
 arch/arm/mach-k3/am62p5_init.c |  281 +++
 arch/arm/mach-k3/am62px/Kconfig|   32 +
 arch/arm/mach-k3/include/mach/am62p_hardware.h |   83 +
 arch/arm/mach-k3/include/mach/am62p_spl.h  |   49 +
 arch/arm/mach-k3/include/mach/hardware.h   |6 +
 arch/arm/mach-k3/include/mach/spl.h|4 +
 arch/arm/mach-k3/r5/Makefile   |1 +
 arch/arm/mach-k3/r5/am62ax/Makefile|2 +-
 arch/arm/mach

[PATCH v4 12/13] doc: board: ti: introduce am62px documentation

2024-03-12 Thread Bryan Brattlof
Introduce basic documentation for the am62p family of SoCs.

Signed-off-by: Bryan Brattlof 
---
 doc/board/ti/am62px_sk.rst | 289 +
 doc/board/ti/k3.rst|   1 +
 2 files changed, 290 insertions(+)

diff --git a/doc/board/ti/am62px_sk.rst b/doc/board/ti/am62px_sk.rst
new file mode 100644
index 0..1f2982c36f9e4
--- /dev/null
+++ b/doc/board/ti/am62px_sk.rst
@@ -0,0 +1,289 @@
+.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+.. sectionauthor:: Bryan Brattlof 
+
+AM62Px Platforms
+
+
+The AM62Px is an extension of the existing Sitara AM62x low-cost family
+of application processors built for Automotive and Linux Application
+development. Scalable Arm Cortex-A53 performance and embedded features,
+such as: multi high-definition display support, 3D-graphics
+acceleration, 4K video acceleration, and extensive peripherals make the
+AM62Px well-suited for a broad range of automation and industrial
+application, including automotive digital instrumentation, automotive
+displays, industrial HMI, and more.
+
+Some highlights of AM62P SoC are:
+
+* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
+  Dual/Single core variants are provided in the same package to allow HW
+  compatible designs.
+
+* One Device manager Cortex-R5F for system power and resource
+  management, and one Cortex-R5F for Functional Safety or
+  general-purpose usage.
+
+* One 3D GPU up to 50 GLFOPS
+
+* H.264/H.265 Video Encode/Decode.
+
+* Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
+  2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution
+
+* Integrated Giga-bit Ethernet switch supporting up to a total of two
+  external ports (TSN capable).
+
+* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
+  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
+  1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.
+
+* Dedicated Centralized Hardware Security Module with support for secure
+  boot, debug security and crypto acceleration and trusted execution
+  environment.
+
+* One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.
+
+* Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
+  enabling battery powered system design.
+
+For those interested, more details about this SoC can be found in the
+Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83
+
+Boot Flow:
+--
+
+The bootflow is exactly the same as all SoCs in the am62xxx extended SoC
+family. Below is the pictorial representation:
+
+.. image:: img/boot_diagram_k3_current.svg
+  :alt: Boot flow diagram
+
+- Here TIFS acts as master and provides all the critical services. R5/A53
+  requests TIFS to get these services done as shown in the above diagram.
+
+Sources:
+
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_boot_sources
+:end-before: .. k3_rst_include_end_boot_sources
+
+Build procedure:
+
+
+0. Setup the environment variables:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_desc
+:end-before: .. k3_rst_include_end_common_env_vars_desc
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_board_env_vars_desc
+:end-before: .. k3_rst_include_end_board_env_vars_desc
+
+Set the variables corresponding to this platform:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_defn
+:end-before: .. k3_rst_include_end_common_env_vars_defn
+
+.. code-block:: bash
+
+ $ export UBOOT_CFG_CORTEXR=am62px_evm_r5_defconfig
+ $ export UBOOT_CFG_CORTEXA=am62px_evm_a53_defconfig
+ $ export TFA_BOARD=lite
+ $ # we dont use any extra TFA parameters
+ $ unset TFA_EXTRA_ARGS
+ $ export OPTEE_PLATFORM=k3-am62x
+ $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+
+.. am62px_evm_rst_include_start_build_steps
+
+1. Trusted Firmware-A:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_tfa
+:end-before: .. k3_rst_include_end_build_steps_tfa
+
+
+2. OP-TEE:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_optee
+:end-before: .. k3_rst_include_end_build_steps_optee
+
+3. U-Boot:
+
+* 3.1 R5:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_spl_r5
+:end-before: .. k3_rst_include_end_build_steps_spl_r5
+
+* 3.2 A53:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_uboot
+:end-before: .. k3_rst_include_end_build_steps_uboot
+.. am62px_evm_rst_include_end_build_steps
+
+Target Images
+--
+
+In order to boot we need tiboot3.bin, tispl.bin and u-boot.img.  Each SoC
+variant (HS-FS, HS-SE) requires a different source for these files.
+
+ - HS-FS
+
+* tiboot3-am62px-hs-fs-evm.bin from step 3.1
+* tispl.bin, u-boot.img from step 3.2
+
+ - HS-SE
+
+   

[PATCH v4 09/13] dma: ti: k3-udma: Add DMA PSIL mappings for AM62P and J722S

2024-03-12 Thread Bryan Brattlof
From: Vignesh Raghavendra 

Add PSIL data for the AM62P and the J722S SoC family. The PSIL mapping
for the J722S is the same except for the extra instances of the CSI-RX.
So let's reuse the same file for both the AM62P and J722S.

Signed-off-by: Vignesh Raghavendra 
Signed-off-by: Ravi Gunasekaran 
Signed-off-by: Vaishnav Achath 
Signed-off-by: Jayesh Choudhary 
[b...@ti.com: rebased to U-Boot v2024.01]
Signed-off-by: Bryan Brattlof 
---
 drivers/dma/ti/Makefile|   2 +
 drivers/dma/ti/k3-psil-am62p.c | 325 +
 drivers/dma/ti/k3-psil-priv.h  |   1 +
 drivers/dma/ti/k3-psil.c   |   4 +
 4 files changed, 332 insertions(+)

diff --git a/drivers/dma/ti/Makefile b/drivers/dma/ti/Makefile
index 9e0b13e8c0215..94ec13ba7ca44 100644
--- a/drivers/dma/ti/Makefile
+++ b/drivers/dma/ti/Makefile
@@ -10,3 +10,5 @@ k3-psil-data-$(CONFIG_SOC_K3_AM642) += k3-psil-am64.o
 k3-psil-data-$(CONFIG_SOC_K3_AM625) += k3-psil-am62.o
 k3-psil-data-$(CONFIG_SOC_K3_AM62A7) += k3-psil-am62a.o
 k3-psil-data-$(CONFIG_SOC_K3_J784S4) += k3-psil-j784s4.o
+k3-psil-data-$(CONFIG_SOC_K3_AM62P5) += k3-psil-am62p.o
+k3-psil-data-$(CONFIG_SOC_K3_J722S) += k3-psil-am62p.o
diff --git a/drivers/dma/ti/k3-psil-am62p.c b/drivers/dma/ti/k3-psil-am62p.c
new file mode 100644
index 0..8739bf41b5b7c
--- /dev/null
+++ b/drivers/dma/ti/k3-psil-am62p.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com
+ */
+
+#include 
+
+#include "k3-psil-priv.h"
+
+#define PSIL_PDMA_XY_TR(x) \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .mapped_channel_id = -1,\
+   .default_flow_id = -1,  \
+   },  \
+   }
+
+#define PSIL_PDMA_XY_PKT(x)\
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .mapped_channel_id = -1,\
+   .default_flow_id = -1,  \
+   .pkt_mode = 1,  \
+   },  \
+   }
+
+#define PSIL_ETHERNET(x, ch, flow_base, flow_cnt)  \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_NATIVE,  \
+   .pkt_mode = 1,  \
+   .needs_epib = 1,\
+   .psd_size = 16, \
+   .mapped_channel_id = ch,\
+   .flow_start = flow_base,\
+   .flow_num = flow_cnt,   \
+   .default_flow_id = flow_base,   \
+   },  \
+   }
+
+#define PSIL_SAUL(x, ch, flow_base, flow_cnt, default_flow, tx)\
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_NATIVE,  \
+   .pkt_mode = 1,  \
+   .needs_epib = 1,\
+   .psd_size = 64, \
+   .mapped_channel_id = ch,\
+   .flow_start = flow_base,\
+   .flow_num = flow_cnt,   \
+   .default_flow_id = default_flow,\
+   .notdpkt = tx,  \
+   },  \
+   }
+
+#define PSIL_PDMA_MCASP(x) \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .pdma_acc32 = 1,\
+   .pdma

[PATCH v4 06/13] arch: mach-k3: introduce basic files to support the am62px SoC family

2024-03-12 Thread Bryan Brattlof
Introduce the basic functions and definitions needed to properly
initialize TI's am62p family of SoCs

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/Kconfig   |   7 +-
 arch/arm/mach-k3/Makefile  |   1 +
 arch/arm/mach-k3/am62p5_init.c | 281 +
 arch/arm/mach-k3/am62px/Kconfig|  32 +++
 arch/arm/mach-k3/include/mach/am62p_hardware.h |  83 
 arch/arm/mach-k3/include/mach/am62p_spl.h  |  49 +
 arch/arm/mach-k3/include/mach/hardware.h   |   4 +
 arch/arm/mach-k3/include/mach/spl.h|   4 +
 8 files changed, 460 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 6a937ff96d208..2bb970c2d4c9b 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -10,6 +10,9 @@ config SOC_K3_AM625
 config SOC_K3_AM62A7
bool "TI's K3 based AM62A7 SoC Family Support"
 
+config SOC_K3_AM62P5
+   bool "TI's K3 based AM62P5 SoC Family Support"
+
 config SOC_K3_AM642
bool "TI's K3 based AM642 SoC Family Support"
 
@@ -80,6 +83,7 @@ config SYS_K3_BOOT_PARAM_TABLE_INDEX
default 0x43c3f290 if SOC_K3_AM625
default 0x43c3f290 if SOC_K3_AM62A7 && CPU_V7R
default 0x7000f290 if SOC_K3_AM62A7 && ARM64
+   default 0x43c4f290 if SOC_K3_AM62P5
help
  Address at which ROM stores the value which determines if SPL
  is booted up by primary boot media or secondary boot media.
@@ -118,7 +122,7 @@ config K3_EARLY_CONS_IDX
 
 config K3_ATF_LOAD_ADDR
hex "Load address of ATF image"
-   default 0x8000 if (SOC_K3_AM625 || SOC_K3_AM62A7)
+   default 0x8000 if (SOC_K3_AM625 || SOC_K3_AM62A7 || SOC_K3_AM62P5)
default 0x7000
help
  The load address for the ATF image. This value is used to build the
@@ -156,6 +160,7 @@ source "arch/arm/mach-k3/am65x/Kconfig"
 source "arch/arm/mach-k3/am64x/Kconfig"
 source "arch/arm/mach-k3/am62x/Kconfig"
 source "arch/arm/mach-k3/am62ax/Kconfig"
+source "arch/arm/mach-k3/am62px/Kconfig"
 source "arch/arm/mach-k3/j721e/Kconfig"
 source "arch/arm/mach-k3/j721s2/Kconfig"
 source "arch/arm/mach-k3/j784s4/Kconfig"
diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile
index 310a4c211404b..6ee9864c72cad 100644
--- a/arch/arm/mach-k3/Makefile
+++ b/arch/arm/mach-k3/Makefile
@@ -22,5 +22,6 @@ obj-$(CONFIG_SOC_K3_AM642) += am642_init.o
 obj-$(CONFIG_SOC_K3_AM625) += am625_init.o
 obj-$(CONFIG_SOC_K3_AM62A7) += am62a7_init.o
 obj-$(CONFIG_SOC_K3_J784S4) += j784s4_init.o
+obj-$(CONFIG_SOC_K3_AM62P5) += am62p5_init.o
 endif
 obj-y += common.o security.o
diff --git a/arch/arm/mach-k3/am62p5_init.c b/arch/arm/mach-k3/am62p5_init.c
new file mode 100644
index 0..aab99aa0c958f
--- /dev/null
+++ b/arch/arm/mach-k3/am62p5_init.c
@@ -0,0 +1,281 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AM62P5: SoC specific initialization
+ *
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include 
+#include 
+#include "sysfw-loader.h"
+#include "common.h"
+#include 
+#include 
+#include 
+
+struct fwl_data cbass_main_fwls[] = {
+   { "FSS_DAT_REG3", 7, 8 },
+};
+
+/*
+ * 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
+ * it to the .data section.
+ */
+u32 bootindex __section(".data");
+static struct rom_extended_boot_data bootdata __section(".data");
+
+static void store_boot_info_from_rom(void)
+{
+   bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
+   memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
+  sizeof(struct rom_extended_boot_data));
+}
+
+static void ctrl_mmr_unlock(void)
+{
+   /* Unlock all WKUP_CTRL_MMR0 module registers */
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 0);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 1);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 2);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 3);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 4);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 5);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 6);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 7);
+
+   /* Unlock all CTRL_MMR0 module registers */
+   mmr_unlock(CTRL_MMR0_BASE, 0);
+   mmr_unlock(CTRL_MMR0_BASE, 1);
+   mmr_unlock(CTRL_MMR0_BASE, 2);
+   mmr_unlock(CTRL_MMR0_BASE, 4);
+   mmr_unlock(CTRL_MMR0_BASE, 5);
+   mmr_unlock(CTRL_MMR0_BASE, 6);
+
+   /* Unlock all MCU_CTRL_MMR0 module registers */
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 0);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 1);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 2);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 3);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 4);
+ 

[PATCH v4 01/13] soc: add info to identify the am62p SoC family

2024-03-12 Thread Bryan Brattlof
Include the part number for TI's am62px family of SoCs so we can
properly identify it during boot

Reviewed-by: Igor Opaniuk 
Reviewed-by: Neha Malcom Francis 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/include/mach/hardware.h | 2 ++
 drivers/soc/soc_ti_k3.c  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/mach-k3/include/mach/hardware.h 
b/arch/arm/mach-k3/include/mach/hardware.h
index 055715f20d6f2..224367d9f1adc 100644
--- a/arch/arm/mach-k3/include/mach/hardware.h
+++ b/arch/arm/mach-k3/include/mach/hardware.h
@@ -43,6 +43,7 @@
 #define JTAG_ID_PARTNO_SHIFT   12
 #define JTAG_ID_PARTNO_MASK(0x << 12)
 #define JTAG_ID_PARTNO_AM62AX   0xbb8d
+#define JTAG_ID_PARTNO_AM62PX  0xbb9d
 #define JTAG_ID_PARTNO_AM62X   0xbb7e
 #define JTAG_ID_PARTNO_AM64X   0xbb38
 #define JTAG_ID_PARTNO_AM65X   0xbb5a
@@ -65,6 +66,7 @@ K3_SOC_ID(am64x, AM64X)
 K3_SOC_ID(j721s2, J721S2)
 K3_SOC_ID(am62x, AM62X)
 K3_SOC_ID(am62ax, AM62AX)
+K3_SOC_ID(am62px, AM62PX)
 
 #define K3_SEC_MGR_SYS_STATUS  0x44234100
 #define SYS_STATUS_DEV_TYPE_SHIFT  0
diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
index d176980915605..3a4e58bba6715 100644
--- a/drivers/soc/soc_ti_k3.c
+++ b/drivers/soc/soc_ti_k3.c
@@ -48,6 +48,9 @@ static const char *get_family_string(u32 idreg)
case JTAG_ID_PARTNO_J784S4:
family = "J784S4";
break;
+   case JTAG_ID_PARTNO_AM62PX:
+   family = "AM62PX";
+   break;
default:
family = "Unknown Silicon";
};

-- 
2.43.2



[PATCH v4 05/13] arm: mach-k3: invert logic for split DM firmware config

2024-03-12 Thread Bryan Brattlof
Currently, for the K3 generation of SoCs, there are more SoCs that
utilize the split firmware approach than the combined DMSC firmware.
Invert the logic to avoid adding more and more SoCs to this list.

Reviewed-by: Neha Malcom Francis 
Acked-by: Andrew Davis 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index fc971d517ab16..6a937ff96d208 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -133,7 +133,7 @@ config K3_OPTEE_LOAD_ADDR
 
 config K3_DM_FW
bool "Separate DM firmware image"
-   depends on CPU_V7R && (SOC_K3_J721E || SOC_K3_J721S2 || SOC_K3_AM625 || 
SOC_K3_AM62A7 || SOC_K3_J784S4) && !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
+   depends on CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && !CLK_TI_SCI && 
!TI_SCI_POWER_DOMAIN
default y
help
  Enabling this will indicate that the system has separate DM

-- 
2.43.2



[PATCH v4 11/13] configs: introduce configs needed for the am62px

2024-03-12 Thread Bryan Brattlof
Introduce the initial configs needed to support the am62px SoC family

Signed-off-by: Bryan Brattlof 
---
 configs/am62px_evm_a53_defconfig | 177 +++
 configs/am62px_evm_r5_defconfig  | 137 ++
 include/configs/am62px_evm.h |  14 
 3 files changed, 328 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
new file mode 100644
index 0..2621abb8ce18a
--- /dev/null
+++ b/configs/am62px_evm_a53_defconfig
@@ -0,0 +1,177 @@
+CONFIG_ARM=y
+CONFIG_ARCH_K3=y
+CONFIG_TI_SECURE_DEVICE=y
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_SOC_K3_AM62P5=y
+CONFIG_TARGET_AM62P5_A53_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=0x4
+CONFIG_DM_GPIO=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62p5-sk"
+CONFIG_SPL_TEXT_BASE=0x8008
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_STACK_R_ADDR=0x8200
+CONFIG_SPL_FS_FAT=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+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_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_SPL_MAX_SIZE=0x58000
+CONFIG_SPL_PAD_TO=0x0
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x80a0
+CONFIG_SPL_BSS_MAX_SIZE=0x8
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
+CONFIG_SPL_DMA=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
+CONFIG_SPL_I2C=y
+CONFIG_SPL_DM_MAILBOX=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_POWER_DOMAIN=y
+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_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x28
+CONFIG_SPL_THERMAL=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_SYS_MAXARGS=64
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_REMOTEPROC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_DEVICE_REMOVE=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK=y
+CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_MTD=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_SF=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x80
+CONFIG_DMA_CHANNELS=y
+CONFIG_TI_K3_NAVSS_UDMA=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0xC000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F00
+CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y
+CONFIG_DA8XX_GPIO=y
+CONFIG_DM_PCA953X=y
+CONFIG_SPL_DM_PCA953X=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_OMAP24XX=y
+CONFIG_DM_MAILBOX=y
+CONFIG_K3_SEC_PROXY=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SPL_I2C_EEPROM=y
+CONFIG_FS_LOADER=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_SPL_MMC_IO_VOLTAGE=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ADMA=y
+CONFIG_SPL_MMC_SDHCI_ADMA=y
+CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SOFT_RESET=y
+CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_S28HX_T=y
+CONFIG_PHY_TI_DP83867=y
+CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_TI_SCI_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPL_DM_REGULATOR_GPIO=y
+CONFIG_K3_SYSTEM_CONTROLLER=y
+CONFIG_REMOTEPROC_TI_K3_ARM64=y
+CONFIG_REMOTEPROC_TI_K3_DSP=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
+CONFIG_RESET_TI_SCI=y
+CONFIG_DM_SERIAL=y
+CONFIG_SOC_DEVICE=y
+CONFIG_SOC_DEVICE_TI_K3=y
+CONFIG_SOC_TI=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_CADENCE_QSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
+CONFIG_SYSRESET_TI_SCI=y
+CONFIG_DM_THERMAL=y
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_SPL_DM_USB_GADGET=y
+CONFIG_SPL_USB_HOST=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENER

[PATCH v4 02/13] power: domain: ti: use IS_ENABLED macro

2024-03-12 Thread Bryan Brattlof
Cleanup this list and standardize on using the IS_ENABLED macro for the
power domain data list.

Reviewed-by: Igor Opaniuk 
Signed-off-by: Bryan Brattlof 
---
 drivers/power/domain/ti-power-domain.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/domain/ti-power-domain.c 
b/drivers/power/domain/ti-power-domain.c
index fb4ca2dd6b45f..8fa9892c02c7a 100644
--- a/drivers/power/domain/ti-power-domain.c
+++ b/drivers/power/domain/ti-power-domain.c
@@ -81,19 +81,20 @@ static const struct soc_attr ti_k3_soc_pd_data[] = {
.family = "J7200",
.data = _pd_platdata,
},
-#elif CONFIG_SOC_K3_J721S2
+#endif
+#if IS_ENABLED(CONFIG_SOC_K3_J721S2)
{
.family = "J721S2",
.data = _pd_platdata,
},
 #endif
-#ifdef CONFIG_SOC_K3_AM625
+#if IS_ENABLED(CONFIG_SOC_K3_AM625)
{
.family = "AM62X",
.data = _pd_platdata,
},
 #endif
-#ifdef CONFIG_SOC_K3_AM62A7
+#if IS_ENABLED(CONFIG_SOC_K3_AM62A7)
{
.family = "AM62AX",
.data = _pd_platdata,

-- 
2.43.2



Re: [PATCH 4/6] arm: mach-k3: am62: Fixup TF-A/OP-TEE reserved-memory node in FDT

2024-03-06 Thread Bryan Brattlof
On March  6, 2024 thus sayeth Andrew Davis:
> On 3/6/24 7:35 AM, Bryan Brattlof wrote:
> > On February 14, 2024 thus sayeth Andrew Davis:
> > > The address we load TF-A and OP-TEE to is configurable by Kconfig
> > > CONFIG_K3_{ATF,OPTEE}_LOAD_ADDR, but the DT nodes reserving this memory
> > > are often statically defined. As these binaries are dynamically loadable,
> > > and in the case of OP-TEE may not even be loaded at all, hard-coding these
> > > addresses is not a hardware description, but rather a configuration.
> > > 
> > > If the address that U-Boot loaded TF-A or OP-TEE does not match the
> > > address in hard-coded in DT, then fix that node address. This also handles
> > > the case when no reserved memory for these is provided by DT, which is
> > > more correct as explained above.
> > > 
> > > Add this fixup function, and enable it for AM62.
> > > 
> > > Signed-off-by: Andrew Davis 
> > 
> > Acked-by: Bryan Brattlof 
> > 
> > Does this mean we need to no-map these regions in the MMU as well? Right
> > now it's just statically defined. I was looking into trying to read the
> > reserved-memory{} node to see if we could dynamically build the MMU
> > config but that would have to happen after this step right?
> > 
> 
> Good question. So TF-A/OP-TEE are loaded by R5 SPL, which means by
> the time A53 SPL starts they are already in place and firewalled,
> which means yes we should no-map them in MMU to prevent some
> speculative fetch (A53 doesn't do that, but A72 on other K3 device
> might) or similar from causing a firewall exception.
> 
> The fixup in this patch is done to the Linux DT file right before
> it is handed off to Linux, which as you point out happens after
> we setup the U-Boot MMU.
> 
> This is more a problem in theory, but not really one in practice.
> I know, I don't like that answer either, but I can't think of a
> better solution outside of doing this fixup in R5 SPL to the
> U-Boot DTB also. (Which might work, but seems overkill)..
> 

Ah that's a good point. Only the SoCs with A53s are using DRAM for TFA 
so we should be good for now :)

Thanks Andrew

> Andrew
> 
> > ~Bryan


Re: [PATCH 6/6] arm: mach-k3: Move DRAM address of ATF for AM62/AM62a

2024-03-06 Thread Bryan Brattlof
On February 14, 2024 thus sayeth Andrew Davis:
> The current address of TF-A in DRAM is just below the 512MB address line.
> This means if the DRAM in a system is 512MB then TF-A is right at the
> end of memory which is often reused, for instance U-Boot relocates itself
> here. If a system has less than 512MB then that system wouldn't work at
> all as TF-A would fail to load.
> 
> To avoid the issues above, move TF-A to the start of DRAM, which doesn't
> change from system to system.
> 
> As TF-A is position independent, this has no dependency on TF-A. We
> also fixup DT as needed when TF-A address is moved, so this change also
> has no dependency on Linux and is fully forward/backward compatible.
> 
> Signed-off-by: Andrew Davis 

Acked-by: Bryan Brattlof 

Thanks for this! This will make adding SIP support much easier.

~Bryan

> ---
>  arch/arm/mach-k3/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
> index 55bb874d9aa..33f20f61f83 100644
> --- a/arch/arm/mach-k3/Kconfig
> +++ b/arch/arm/mach-k3/Kconfig
> @@ -123,7 +123,7 @@ config SYS_K3_SPL_ATF
>  
>  config K3_ATF_LOAD_ADDR
>   hex "Load address of ATF image"
> - default 0x9e78 if (SOC_K3_AM625 || SOC_K3_AM62A7)
> + default 0x8000 if (SOC_K3_AM625 || SOC_K3_AM62A7)
>   default 0x7000
>   help
> The load address for the ATF image. This value is used to build the
> -- 
> 2.39.2
> 


Re: [PATCH 5/6] arm: mach-k3: am62a: Fixup TF-A/OP-TEE reserved-memory node in FDT

2024-03-06 Thread Bryan Brattlof
On February 14, 2024 thus sayeth Andrew Davis:
> The address we load TFA and OP-TEE to is configurable by
> CONFIG_K3_{ATF,OPTEE}_LOAD_ADDR, but the DT nodes reserving this memory
> are static. Fix that by updating this node when the loaded address
> does not match the address in DT.
> 
> Signed-off-by: Andrew Davis 

Acked-by: Bryan Brattlof 

~Bryan


Re: [PATCH 4/6] arm: mach-k3: am62: Fixup TF-A/OP-TEE reserved-memory node in FDT

2024-03-06 Thread Bryan Brattlof
On February 14, 2024 thus sayeth Andrew Davis:
> The address we load TF-A and OP-TEE to is configurable by Kconfig
> CONFIG_K3_{ATF,OPTEE}_LOAD_ADDR, but the DT nodes reserving this memory
> are often statically defined. As these binaries are dynamically loadable,
> and in the case of OP-TEE may not even be loaded at all, hard-coding these
> addresses is not a hardware description, but rather a configuration.
> 
> If the address that U-Boot loaded TF-A or OP-TEE does not match the
> address in hard-coded in DT, then fix that node address. This also handles
> the case when no reserved memory for these is provided by DT, which is
> more correct as explained above.
> 
> Add this fixup function, and enable it for AM62.
> 
> Signed-off-by: Andrew Davis 

Acked-by: Bryan Brattlof 

Does this mean we need to no-map these regions in the MMU as well? Right 
now it's just statically defined. I was looking into trying to read the 
reserved-memory{} node to see if we could dynamically build the MMU 
config but that would have to happen after this step right?

~Bryan


Re: [PATCH 2/6] arm: mach-k3: Add config option for setting OP-TEE address

2024-03-06 Thread Bryan Brattlof
On February 14, 2024 thus sayeth Andrew Davis:
> Much like we have for ATF, OP-TEE has a standard address that we load
> it too and run it from. Add a Kconfig item for this to remove some
> hard-coding and allow this address to be more easily changed.
> 
> Signed-off-by: Andrew Davis 

Acked-by: Bryan Brattlof 

~Bryan


Re: [PATCH 1/6] arm: mach-k3: Add default ATF location for AM62/AM62a

2024-03-06 Thread Bryan Brattlof
On February 14, 2024 thus sayeth Andrew Davis:
> There is a default ATF load address that is used for devices that have
> ATF running in SRAM. For AM62 and AM62a, ATF runs from DRAM. Instead
> of having to override the address in every defconfig, make add a
> default for these ATF in DRAM devices.
> 
> Signed-off-by: Andrew Davis 

Acked-by: Bryan Brattlof 

> ---
>  arch/arm/mach-k3/Kconfig   | 5 +++--
>  configs/am62ax_evm_a53_defconfig   | 1 -
>  configs/am62x_beagleplay_a53_defconfig | 1 -
>  configs/am62x_evm_a53_defconfig| 1 -
>  configs/phycore_am62x_a53_defconfig| 1 -
>  configs/verdin-am62_a53_defconfig  | 1 -
>  6 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
> index 03898424c95..0bd3f9fa12d 100644
> --- a/arch/arm/mach-k3/Kconfig
> +++ b/arch/arm/mach-k3/Kconfig
> @@ -123,10 +123,11 @@ config SYS_K3_SPL_ATF
>  
>  config K3_ATF_LOAD_ADDR
>   hex "Load address of ATF image"
> + default 0x9e78 if (SOC_K3_AM625 || SOC_K3_AM62A7)

I went ahead an added this to the TODO for 62p's respin

~Bryan


Re: [PATCH 1/2] arm: mach-k3: am625: copy bootindex to OCRAM for main domain SPL

2024-03-05 Thread Bryan Brattlof
On March  5, 2024 thus sayeth Vignesh Raghavendra:
> 
> 
> On 05/03/24 01:57, Bryan Brattlof wrote:
> > Hey Vignesh!
> > 
> > On March  4, 2024 thus sayeth Vignesh Raghavendra:
> >> Hi Wadim,
> >>
> >> On 26/02/24 19:00, Wadim Egorov wrote:
> >>> Texas Instruments has begun enabling security settings on the SoCs it
> >>> produces to instruct ROM and TIFS to begin protecting the Security
> >>> Management Subsystem (SMS) from other binaries we load into the chip by
> >>> default.
> >>>
> >>> One way ROM and TIFS do this is by enabling firewalls to protect the
> >>> OCSRAM and HSM RAM regions they're using during bootup.
> >>>
> >>> The HSM RAM the wakeup SPL is in is firewalled by TIFS to protect
> >>> itself from the main domain applications. This means the 'bootindex'
> >>> value in HSM RAM, left by ROM to indicate if we're using the primary
> >>> or secondary boot-method, must be moved to OCSRAM (that TIFS has open
> >>> for us) before we make the jump to the main domain so the main domain's
> >>> bootloaders can keep access to this information.
> >>>
> >>> Based on commit
> >>>   b672e8581070 ("arm: mach-k3: copy bootindex to OCRAM for main domain 
> >>> SPL")
> >>>
> >>
> >> FYI, this is mostly a problem in non SPL flow (TI prosperity SBL for
> >> example) where HSM RAM would be used by HSM firmware. This should be a
> >> issue in R5 SPL flow.  Do you see any issues today? If so, whats the
> >> TIFS firmware being used?
> >>
> >>> Signed-off-by: Wadim Egorov 
> >>> ---
> >>>  arch/arm/mach-k3/Kconfig  |  3 ++-
> >>>  arch/arm/mach-k3/am625_init.c | 15 +--
> >>>  arch/arm/mach-k3/include/mach/am62_hardware.h | 15 +++
> >>>  3 files changed, 30 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
> >>> index 03898424c9..f5d06593f7 100644
> >>> --- a/arch/arm/mach-k3/Kconfig
> >>> +++ b/arch/arm/mach-k3/Kconfig
> >>> @@ -75,7 +75,8 @@ config SYS_K3_BOOT_PARAM_TABLE_INDEX
> >>>   default 0x41cffbfc if SOC_K3_J721E
> >>>   default 0x41cfdbfc if SOC_K3_J721S2
> >>>   default 0x701bebfc if SOC_K3_AM642
> >>> - default 0x43c3f290 if SOC_K3_AM625
> >>> + default 0x43c3f290 if SOC_K3_AM625 && CPU_V7R
> >>> + default 0x7000f290 if SOC_K3_AM625 && ARM64
> >>>   default 0x43c3f290 if SOC_K3_AM62A7 && CPU_V7R
> >>>   default 0x7000f290 if SOC_K3_AM62A7 && ARM64
> >>>   help
> >>> diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c
> >>> index 6c96e88114..67cf63b103 100644
> >>> --- a/arch/arm/mach-k3/am625_init.c
> >>> +++ b/arch/arm/mach-k3/am625_init.c
> >>> @@ -35,8 +35,10 @@ static struct rom_extended_boot_data bootdata 
> >>> __section(".data");
> >>>  static void store_boot_info_from_rom(void)
> >>>  {
> >>>   bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
> >>> - memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
> >>> -sizeof(struct rom_extended_boot_data));
> >>> + if (IS_ENABLED(CONFIG_CPU_V7R)) {
> >>> + memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
> >>> +sizeof(struct rom_extended_boot_data));
> >>> + }
> >>>  }
> >>>  
> >>>  static void ctrl_mmr_unlock(void)
> >>> @@ -175,6 +177,15 @@ void board_init_f(ulong dummy)
> >>>   k3_sysfw_loader(true, NULL, NULL);
> >>>   }
> >>>  
> >>> +#if defined(CONFIG_CPU_V7R)
> >>> + /*
> >>> +  * Relocate boot information to OCRAM (after TIFS has opend this
> >>> +  * region for us) so the next bootloader stages can keep access to
> >>> +  * primary vs backup bootmodes.
> >>> +  */
> >>> + writel(bootindex, K3_BOOT_PARAM_TABLE_INDEX_OCRAM);
> >>> +#endif
> >>> +
> >>>   /*
> >>>* Force probe of clk_k3 driver here to ensure basic default clock
> >>>* configuration is always done.
> >>> diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h 
> >>> b/arch/arm/mach-k3/include/mach/am62_hardware.h
> >>> 

Re: [PATCH 1/2] arm: mach-k3: am625: copy bootindex to OCRAM for main domain SPL

2024-03-04 Thread Bryan Brattlof
Hey Vignesh!

On March  4, 2024 thus sayeth Vignesh Raghavendra:
> Hi Wadim,
> 
> On 26/02/24 19:00, Wadim Egorov wrote:
> > Texas Instruments has begun enabling security settings on the SoCs it
> > produces to instruct ROM and TIFS to begin protecting the Security
> > Management Subsystem (SMS) from other binaries we load into the chip by
> > default.
> > 
> > One way ROM and TIFS do this is by enabling firewalls to protect the
> > OCSRAM and HSM RAM regions they're using during bootup.
> > 
> > The HSM RAM the wakeup SPL is in is firewalled by TIFS to protect
> > itself from the main domain applications. This means the 'bootindex'
> > value in HSM RAM, left by ROM to indicate if we're using the primary
> > or secondary boot-method, must be moved to OCSRAM (that TIFS has open
> > for us) before we make the jump to the main domain so the main domain's
> > bootloaders can keep access to this information.
> > 
> > Based on commit
> >   b672e8581070 ("arm: mach-k3: copy bootindex to OCRAM for main domain SPL")
> > 
> 
> FYI, this is mostly a problem in non SPL flow (TI prosperity SBL for
> example) where HSM RAM would be used by HSM firmware. This should be a
> issue in R5 SPL flow.  Do you see any issues today? If so, whats the
> TIFS firmware being used?
> 
> > Signed-off-by: Wadim Egorov 
> > ---
> >  arch/arm/mach-k3/Kconfig  |  3 ++-
> >  arch/arm/mach-k3/am625_init.c | 15 +--
> >  arch/arm/mach-k3/include/mach/am62_hardware.h | 15 +++
> >  3 files changed, 30 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
> > index 03898424c9..f5d06593f7 100644
> > --- a/arch/arm/mach-k3/Kconfig
> > +++ b/arch/arm/mach-k3/Kconfig
> > @@ -75,7 +75,8 @@ config SYS_K3_BOOT_PARAM_TABLE_INDEX
> > default 0x41cffbfc if SOC_K3_J721E
> > default 0x41cfdbfc if SOC_K3_J721S2
> > default 0x701bebfc if SOC_K3_AM642
> > -   default 0x43c3f290 if SOC_K3_AM625
> > +   default 0x43c3f290 if SOC_K3_AM625 && CPU_V7R
> > +   default 0x7000f290 if SOC_K3_AM625 && ARM64
> > default 0x43c3f290 if SOC_K3_AM62A7 && CPU_V7R
> > default 0x7000f290 if SOC_K3_AM62A7 && ARM64
> > help
> > diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c
> > index 6c96e88114..67cf63b103 100644
> > --- a/arch/arm/mach-k3/am625_init.c
> > +++ b/arch/arm/mach-k3/am625_init.c
> > @@ -35,8 +35,10 @@ static struct rom_extended_boot_data bootdata 
> > __section(".data");
> >  static void store_boot_info_from_rom(void)
> >  {
> > bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
> > -   memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
> > -  sizeof(struct rom_extended_boot_data));
> > +   if (IS_ENABLED(CONFIG_CPU_V7R)) {
> > +   memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
> > +  sizeof(struct rom_extended_boot_data));
> > +   }
> >  }
> >  
> >  static void ctrl_mmr_unlock(void)
> > @@ -175,6 +177,15 @@ void board_init_f(ulong dummy)
> > k3_sysfw_loader(true, NULL, NULL);
> > }
> >  
> > +#if defined(CONFIG_CPU_V7R)
> > +   /*
> > +* Relocate boot information to OCRAM (after TIFS has opend this
> > +* region for us) so the next bootloader stages can keep access to
> > +* primary vs backup bootmodes.
> > +*/
> > +   writel(bootindex, K3_BOOT_PARAM_TABLE_INDEX_OCRAM);
> > +#endif
> > +
> > /*
> >  * Force probe of clk_k3 driver here to ensure basic default clock
> >  * configuration is always done.
> > diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h 
> > b/arch/arm/mach-k3/include/mach/am62_hardware.h
> > index 54380f36e1..9f504f4642 100644
> > --- a/arch/arm/mach-k3/include/mach/am62_hardware.h
> > +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
> > @@ -76,8 +76,23 @@
> >  #define CTRLMMR_MCU_RST_CTRL   (MCU_CTRL_MMR0_BASE + 
> > 0x18170)
> >  
> >  #define ROM_EXTENDED_BOOT_DATA_INFO0x43c3f1e0
> > +#define K3_BOOT_PARAM_TABLE_INDEX_OCRAM 0x7000F290
> >  
> > +/*
> > + * During the boot process ROM will kill anything that writes to OCSRAM.
> 
> R5 ROM is long gone when R5 SPL starts, how would it kill anything?

Looks like this was based on my patch long ago for the AM62Ax family. 
>From what little I remember about this was ROM is leaving behind a 
firewall that we need TIFS's help to bring down for us. So I just
blamed ROM ;)

IDK if this is an issue for the AM62x family though.

> 
> > + * This means the wakeup SPL cannot use this region during boot. To
> > + * complicate things, TIFS will set a firewall between HSM RAM and the
> > + * main domain.
> > + *
> > + * So, during the wakeup SPL, we will need to store the EEPROM data
> > + * somewhere in HSM RAM, and the main domain's SPL will need to store it
> > + * somewhere in OCSRAM
> > + */
> > +#ifdef CONFIG_CPU_V7R
> >  #define TI_SRAM_SCRATCH_BOARD_EEPROM_START 0x43c3
> > +#else
> > + #define 

[PATCH v3 10/13] arm: dts: introduce am62p5 U-Boot dts files

2024-02-26 Thread Bryan Brattlof
Include the U-Boot device tree files needed to boot the board.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/Makefile  |2 +
 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
 arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
 arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   23 +
 5 files changed, 3099 insertions(+)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 7c2681eb93779..c8fd41d4a816e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1429,6 +1429,8 @@ dtb-$(CONFIG_SOC_K3_AM625) += k3-am625-sk.dtb \
 dtb-$(CONFIG_SOC_K3_AM62A7) += k3-am62a7-sk.dtb \
  k3-am62a7-r5-sk.dtb
 
+dtb-$(CONFIG_SOC_K3_AM62P5) += k3-am62p5-r5-sk.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7622-rfb.dtb \
mt7623a-unielec-u7623-02-emmc.dtb \
diff --git a/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi 
b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
new file mode 100644
index 0..f66435201530f
--- /dev/null
+++ b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
@@ -0,0 +1,2800 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This file was generated with the
+ * AM62Px SysConfig DDR Subsystem Register Configuration Tool v0.10.02
+ * Thu Jan 25 2024 10:43:46 GMT-0600 (Central Standard Time)
+ * DDR Type: LPDDR4
+ * F0 = 50MHzF1 = NA F2 = 1600MHz
+ * Density (per channel): 16Gb
+ * Number of Ranks: 2
+ */
+
+#define DDRSS_PLL_FHS_CNT 5
+#define DDRSS_PLL_FREQUENCY_1 8
+#define DDRSS_PLL_FREQUENCY_2 8
+#define DDRSS_SDRAM_IDX 17
+#define DDRSS_REGION_IDX 17
+
+#define DDRSS_CTL_0_DATA 0x0B00
+#define DDRSS_CTL_1_DATA 0x
+#define DDRSS_CTL_2_DATA 0x
+#define DDRSS_CTL_3_DATA 0x
+#define DDRSS_CTL_4_DATA 0x
+#define DDRSS_CTL_5_DATA 0x
+#define DDRSS_CTL_6_DATA 0x
+#define DDRSS_CTL_7_DATA 0x2710
+#define DDRSS_CTL_8_DATA 0x000186A0
+#define DDRSS_CTL_9_DATA 0x0005
+#define DDRSS_CTL_10_DATA 0x0064
+#define DDRSS_CTL_11_DATA 0x0004E200
+#define DDRSS_CTL_12_DATA 0x0030D400
+#define DDRSS_CTL_13_DATA 0x0005
+#define DDRSS_CTL_14_DATA 0x0C80
+#define DDRSS_CTL_15_DATA 0x0004E200
+#define DDRSS_CTL_16_DATA 0x0030D400
+#define DDRSS_CTL_17_DATA 0x0005
+#define DDRSS_CTL_18_DATA 0x0C80
+#define DDRSS_CTL_19_DATA 0x01010100
+#define DDRSS_CTL_20_DATA 0x01010100
+#define DDRSS_CTL_21_DATA 0x01000110
+#define DDRSS_CTL_22_DATA 0x02010002
+#define DDRSS_CTL_23_DATA 0x000A
+#define DDRSS_CTL_24_DATA 0x000186A0
+#define DDRSS_CTL_25_DATA 0x
+#define DDRSS_CTL_26_DATA 0x
+#define DDRSS_CTL_27_DATA 0x
+#define DDRSS_CTL_28_DATA 0x
+#define DDRSS_CTL_29_DATA 0x00020200
+#define DDRSS_CTL_30_DATA 0x
+#define DDRSS_CTL_31_DATA 0x
+#define DDRSS_CTL_32_DATA 0x
+#define DDRSS_CTL_33_DATA 0x
+#define DDRSS_CTL_34_DATA 0x0810
+#define DDRSS_CTL_35_DATA 0x4040
+#define DDRSS_CTL_36_DATA 0x
+#define DDRSS_CTL_37_DATA 0x
+#define DDRSS_CTL_38_DATA 0x
+#define DDRSS_CTL_39_DATA 0x
+#define DDRSS_CTL_40_DATA 0x040C
+#define DDRSS_CTL_41_DATA 0x
+#define DDRSS_CTL_42_DATA 0x0E38
+#define DDRSS_CTL_43_DATA 0x
+#define DDRSS_CTL_44_DATA 0x0E38
+#define DDRSS_CTL_45_DATA 0x
+#define DDRSS_CTL_46_DATA 0x05000804
+#define DDRSS_CTL_47_DATA 0x0700
+#define DDRSS_CTL_48_DATA 0x09090004
+#define DDRSS_CTL_49_DATA 0x0303
+#define DDRSS_CTL_50_DATA 0x00620011
+#define DDRSS_CTL_51_DATA 0x09110045
+#define DDRSS_CTL_52_DATA 0x421D
+#define DDRSS_CTL_53_DATA 0x00620011
+#define DDRSS_CTL_54_DATA 0x09110045
+#define DDRSS_CTL_55_DATA 0x0900421D
+#define DDRSS_CTL_56_DATA 0x000A0A09
+#define DDRSS_CTL_57_DATA 0x040006DB
+#define DDRSS_CTL_58_DATA 0x090D2005
+#define DDRSS_CTL_59_DATA 0x1710
+#define DDRSS_CTL_60_DATA 0x0C00DB60
+#define DDRSS_CTL_61_DATA 0x090D200D
+#define DDRSS_CTL_62_DATA 0x1710
+#define DDRSS_CTL_63_DATA 0x0C00DB60
+#define DDRSS_CTL_64_DATA 0x0304200D
+#define DDRSS_CTL_65_DATA 0x04050002
+#define DDRSS_CTL_66_DATA 0x1F1E1F1E
+#define DDRSS_CTL_67_DATA 0x01010008
+#define DDRSS_CTL_68_DATA 0x043C3C07
+#define DDRSS_CTL_69_DATA 0x0303
+#define DDRSS_CTL_70_DATA 0x
+#define DDRSS_CTL_71_DATA 0x0101
+#define DDRSS_CTL_72_DATA 0x
+#define DDRSS_CTL_73_DATA 0x0100
+#define DDRSS_CTL_74_DATA 0x00130803
+#define DDRSS_CTL_75_DATA 0x00BB
+#define DDRSS_CTL_76_DATA 0x0260
+#define DDRSS_CTL_77_DATA 0x1858
+#define DDRSS_CTL_78_DATA 0x0260
+#define DDRSS_CTL_79_DATA 0x1858
+#define DDRSS_CTL_80_DATA 0x0005
+#define DDRSS_CTL_81_DATA 0x000A
+#define DDRSS_CTL_82_DATA 0x0010
+#define DDRSS_CTL_83_DATA 0x0130
+#define DDRSS_CTL_84_DATA 0x0304
+#define DDRSS_CTL_85_DATA 0x0130
+#define DDRSS_CTL_86_DATA 0x0304
+#define DDRSS_CTL_87_DATA

[PATCH v3 06/13] arch: mach-k3: introduce basic files to support the am62px SoC family

2024-02-26 Thread Bryan Brattlof
Introduce the basic functions and definitions needed to properly
initialize TI's am62p family of SoCs

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/Kconfig   |   7 +-
 arch/arm/mach-k3/Makefile  |   1 +
 arch/arm/mach-k3/am62p5_init.c | 280 +
 arch/arm/mach-k3/am62px/Kconfig|  32 +++
 arch/arm/mach-k3/include/mach/am62p_hardware.h |  83 
 arch/arm/mach-k3/include/mach/am62p_spl.h  |  49 +
 arch/arm/mach-k3/include/mach/hardware.h   |   4 +
 arch/arm/mach-k3/include/mach/spl.h|   4 +
 8 files changed, 459 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index ffceb6428d42e..3200418db9e2a 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -22,6 +22,9 @@ config SOC_K3_AM625
 config SOC_K3_AM62A7
bool "TI's K3 based AM62A7 SoC Family Support"
 
+config SOC_K3_AM62P5
+   bool "TI's K3 based AM62P5 SoC Family Support"
+
 endchoice
 
 if SOC_K3_J721E
@@ -34,7 +37,7 @@ config SYS_SOC
 
 config SYS_K3_NON_SECURE_MSRAM_SIZE
hex
-   default 0x8 if SOC_K3_AM654
+   default 0x8 if SOC_K3_AM654 || SOC_K3_AM62P5
default 0x10 if SOC_K3_J721E || SOC_K3_J721S2
default 0x1c if SOC_K3_AM642
default 0x3c000 if SOC_K3_AM625 || SOC_K3_AM62A7
@@ -78,6 +81,7 @@ config SYS_K3_BOOT_PARAM_TABLE_INDEX
default 0x43c3f290 if SOC_K3_AM625
default 0x43c3f290 if SOC_K3_AM62A7 && CPU_V7R
default 0x7000f290 if SOC_K3_AM62A7 && ARM64
+   default 0x43c4f290 if SOC_K3_AM62P5
help
  Address at which ROM stores the value which determines if SPL
  is booted up by primary boot media or secondary boot media.
@@ -153,6 +157,7 @@ source "arch/arm/mach-k3/am65x/Kconfig"
 source "arch/arm/mach-k3/am64x/Kconfig"
 source "arch/arm/mach-k3/am62x/Kconfig"
 source "arch/arm/mach-k3/am62ax/Kconfig"
+source "arch/arm/mach-k3/am62px/Kconfig"
 source "arch/arm/mach-k3/j721e/Kconfig"
 source "arch/arm/mach-k3/j721s2/Kconfig"
 
diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile
index 42161376469e2..820b313a83c23 100644
--- a/arch/arm/mach-k3/Makefile
+++ b/arch/arm/mach-k3/Makefile
@@ -20,5 +20,6 @@ obj-$(CONFIG_SOC_K3_J721S2) += j721s2_init.o
 obj-$(CONFIG_SOC_K3_AM642) += am642_init.o
 obj-$(CONFIG_SOC_K3_AM625) += am625_init.o
 obj-$(CONFIG_SOC_K3_AM62A7) += am62a7_init.o
+obj-$(CONFIG_SOC_K3_AM62P5) += am62p5_init.o
 endif
 obj-y += common.o security.o
diff --git a/arch/arm/mach-k3/am62p5_init.c b/arch/arm/mach-k3/am62p5_init.c
new file mode 100644
index 0..9ff877d5d26e8
--- /dev/null
+++ b/arch/arm/mach-k3/am62p5_init.c
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AM62P5: SoC specific initialization
+ *
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include 
+#include 
+#include "sysfw-loader.h"
+#include "common.h"
+#include 
+#include 
+#include 
+
+struct fwl_data cbass_main_fwls[] = {
+   { "FSS_DAT_REG3", 7, 8 },
+};
+
+/*
+ * 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
+ * it to the .data section.
+ */
+u32 bootindex __section(".data");
+static struct rom_extended_boot_data bootdata __section(".data");
+
+static void store_boot_info_from_rom(void)
+{
+   bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
+   memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
+  sizeof(struct rom_extended_boot_data));
+}
+
+static void ctrl_mmr_unlock(void)
+{
+   /* Unlock all WKUP_CTRL_MMR0 module registers */
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 0);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 1);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 2);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 3);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 4);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 5);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 6);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 7);
+
+   /* Unlock all CTRL_MMR0 module registers */
+   mmr_unlock(CTRL_MMR0_BASE, 0);
+   mmr_unlock(CTRL_MMR0_BASE, 1);
+   mmr_unlock(CTRL_MMR0_BASE, 2);
+   mmr_unlock(CTRL_MMR0_BASE, 4);
+   mmr_unlock(CTRL_MMR0_BASE, 5);
+   mmr_unlock(CTRL_MMR0_BASE, 6);
+
+   /* Unlock all MCU_CTRL_MMR0 module registers */
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 0);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 1);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 2);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 3);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 4);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 6);
+
+   /* Unlock PADCFG_CTRL_MMR padconf registers */
+   mmr_unlock(PADCFG_MMR0_BASE, 1);
+   mm

[PATCH v3 12/13] configs: introduce configs needed for the am62px

2024-02-26 Thread Bryan Brattlof
Introduce the initial configs needed to support the am62px SoC family

Signed-off-by: Bryan Brattlof 
---
 configs/am62px_evm_a53_defconfig | 178 +++
 configs/am62px_evm_r5_defconfig  | 137 ++
 include/configs/am62px_evm.h |  14 +++
 3 files changed, 329 insertions(+)

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
new file mode 100644
index 0..bd8002108b10c
--- /dev/null
+++ b/configs/am62px_evm_a53_defconfig
@@ -0,0 +1,178 @@
+CONFIG_ARM=y
+CONFIG_ARCH_K3=y
+CONFIG_TI_SECURE_DEVICE=y
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_SOC_K3_AM62P5=y
+CONFIG_K3_ATF_LOAD_ADDR=0x9e78
+CONFIG_TARGET_AM62P5_A53_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=0x4
+CONFIG_DM_GPIO=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62p5-sk"
+CONFIG_SPL_TEXT_BASE=0x8008
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_STACK_R_ADDR=0x8200
+CONFIG_SPL_FS_FAT=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+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_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_SPL_MAX_SIZE=0x58000
+CONFIG_SPL_PAD_TO=0x0
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x80a0
+CONFIG_SPL_BSS_MAX_SIZE=0x8
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
+CONFIG_SPL_DMA=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
+CONFIG_SPL_I2C=y
+CONFIG_SPL_DM_MAILBOX=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_POWER_DOMAIN=y
+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_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x28
+CONFIG_SPL_THERMAL=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_SYS_MAXARGS=64
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_REMOTEPROC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_DEVICE_REMOVE=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK=y
+CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_MTD=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_SF=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x80
+CONFIG_DMA_CHANNELS=y
+CONFIG_TI_K3_NAVSS_UDMA=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0xC000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F00
+CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y
+CONFIG_DA8XX_GPIO=y
+CONFIG_DM_PCA953X=y
+CONFIG_SPL_DM_PCA953X=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_OMAP24XX=y
+CONFIG_DM_MAILBOX=y
+CONFIG_K3_SEC_PROXY=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SPL_I2C_EEPROM=y
+CONFIG_FS_LOADER=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_SPL_MMC_IO_VOLTAGE=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ADMA=y
+CONFIG_SPL_MMC_SDHCI_ADMA=y
+CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SOFT_RESET=y
+CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_S28HX_T=y
+CONFIG_PHY_TI_DP83867=y
+CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_TI_SCI_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPL_DM_REGULATOR_GPIO=y
+CONFIG_K3_SYSTEM_CONTROLLER=y
+CONFIG_REMOTEPROC_TI_K3_ARM64=y
+CONFIG_REMOTEPROC_TI_K3_DSP=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
+CONFIG_RESET_TI_SCI=y
+CONFIG_DM_SERIAL=y
+CONFIG_SOC_DEVICE=y
+CONFIG_SOC_DEVICE_TI_K3=y
+CONFIG_SOC_TI=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_CADENCE_QSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
+CONFIG_SYSRESET_TI_SCI=y
+CONFIG_DM_THERMAL=y
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_SPL_DM_USB_GADGET=y
+CONFIG_SPL_USB_HOST=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y

[PATCH v3 07/13] board: ti: introduce basic board files for the am62px family

2024-02-26 Thread Bryan Brattlof
Introduce the basic files needed to support the am62px family of SoCs

Co-developed-by: Hari Nagalla 
Signed-off-by: Hari Nagalla 
Signed-off-by: Bryan Brattlof 
---
 board/ti/am62px/Kconfig  |  26 ++
 board/ti/am62px/MAINTAINERS  |   9 +
 board/ti/am62px/Makefile |   7 +
 board/ti/am62px/am62px.env   |  15 +
 board/ti/am62px/board-cfg.yaml   |  37 ++
 board/ti/am62px/evm.c|  29 ++
 board/ti/am62px/pm-cfg.yaml  |  12 +
 board/ti/am62px/rm-cfg.yaml  | 987 +++
 board/ti/am62px/sec-cfg.yaml | 378 +++
 board/ti/am62px/tifs-rm-cfg.yaml | 879 ++
 10 files changed, 2379 insertions(+)

diff --git a/board/ti/am62px/Kconfig b/board/ti/am62px/Kconfig
new file mode 100644
index 0..9d95ffd9b2908
--- /dev/null
+++ b/board/ti/am62px/Kconfig
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+
+if TARGET_AM62P5_R5_EVM || TARGET_AM62P5_A53_EVM
+
+config SYS_BOARD
+   default "am62px"
+
+config SYS_VENDOR
+   default "ti"
+
+config SYS_CONFIG_NAME
+   default "am62px_evm"
+
+source "board/ti/common/Kconfig"
+
+endif
+
+if TARGET_AM62P5_R5_EVM
+
+config SPL_LDSCRIPT
+   default "arch/arm/mach-omap2/u-boot-spl.lds"
+
+endif
diff --git a/board/ti/am62px/MAINTAINERS b/board/ti/am62px/MAINTAINERS
new file mode 100644
index 0..57c86ddbc4aef
--- /dev/null
+++ b/board/ti/am62px/MAINTAINERS
@@ -0,0 +1,9 @@
+AM62Px BOARD
+M: Vignesh Raghavendra 
+M: Bryan Brattlof 
+M: Tom Rini 
+S: Maintained
+F: board/ti/am62px/
+F: include/configs/am62p5_evm.h
+F: configs/am62px_evm_r5_defconfig
+F: configs/am62px_evm_a53_defconfig
diff --git a/board/ti/am62px/Makefile b/board/ti/am62px/Makefile
new file mode 100644
index 0..921afdff27a24
--- /dev/null
+++ b/board/ti/am62px/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += evm.o
diff --git a/board/ti/am62px/am62px.env b/board/ti/am62px/am62px.env
new file mode 100644
index 0..f8b6aff2c2fdf
--- /dev/null
+++ b/board/ti/am62px/am62px.env
@@ -0,0 +1,15 @@
+#include 
+#include 
+
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x0280
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+boot_targets=mmc1 mmc0 pxe dhcp
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+rd_spec=-
diff --git a/board/ti/am62px/board-cfg.yaml b/board/ti/am62px/board-cfg.yaml
new file mode 100644
index 0..d539011aff9f3
--- /dev/null
+++ b/board/ti/am62px/board-cfg.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62Px SoCs
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj: 0x0
+boardcfg_abi_min: 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable: 0x5A
+main_isolation_hostid: 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor: 0x1
+scaling_profile: 0x1
+disable_main_nav_secure_proxy: 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size: 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables: 0x00
+trace_src_enables: 0x00
diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
new file mode 100644
index 0..97a95ce8cc2d5
--- /dev/null
+++ b/board/ti/am62px/evm.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Board specific initialization for AM62Px platforms
+ *
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int board_init(void)
+{
+   return 0;
+}
+
+int dram_init(void)
+{
+   return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+   return fdtdec_setup_memory_banksize();
+}
diff --git a/board/ti/am62px/pm-cfg.yaml b/board/ti/am62px/pm-cfg.yaml
new file mode 100644
index 0..3ff27ce702c26
--- /dev/null
+++ b/board/ti/am62px/pm-cfg.yaml
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62Px
+#
+#
+---
+pm-cfg:
+rev:
+boardcfg_abi_maj: 0x0
+boardcfg_abi_min: 0x1
diff --git a/board/ti/am62px/rm-cfg.yaml b/board/ti/am62px/rm-cfg.yaml
new file mode 100644
index 0..caa2f7a5a83e1
--- /dev/null
+++ b/board/ti/am62px/rm-cfg.yaml
@@ -0,0 +1,987 @@
+# SPDX-Licen

[PATCH v3 08/13] firmware: ti_sci_static_data: add static DMA channel data

2024-02-26 Thread Bryan Brattlof
From: Hari Nagalla 

Include the static DMA channel data for ti_sci

Signed-off-by: Hari Nagalla 
Signed-off-by: Bryan Brattlof 
---
 drivers/firmware/ti_sci_static_data.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/ti_sci_static_data.h 
b/drivers/firmware/ti_sci_static_data.h
index 567ce8911a7da..135ec01bda460 100644
--- a/drivers/firmware/ti_sci_static_data.h
+++ b/drivers/firmware/ti_sci_static_data.h
@@ -84,7 +84,8 @@ static struct ti_sci_resource_static_data rm_static_data[] = {
 };
 #endif /* CONFIG_SOC_K3_J721S2 */
 
-#if IS_ENABLED(CONFIG_SOC_K3_AM625) || IS_ENABLED(CONFIG_SOC_K3_AM62A7)
+#if IS_ENABLED(CONFIG_SOC_K3_AM625) || IS_ENABLED(CONFIG_SOC_K3_AM62A7) || \
+   IS_ENABLED(CONFIG_SOC_K3_AM62P5)
 static struct ti_sci_resource_static_data rm_static_data[] = {
/* BC channels */
{
@@ -95,7 +96,7 @@ static struct ti_sci_resource_static_data rm_static_data[] = {
},
{ },
 };
-#endif /* CONFIG_SOC_K3_AM625 || CONFIG_SOC_K3_AM62A7 */
+#endif /* CONFIG_SOC_K3_AM625 || CONFIG_SOC_K3_AM62A7 || CONFIG_SOC_K3_AM62P5 
*/
 
 #else
 static struct ti_sci_resource_static_data rm_static_data[] = {

-- 
2.43.2



[PATCH v3 02/13] power: domain: ti: use IS_ENABLED macro

2024-02-26 Thread Bryan Brattlof
Cleanup this list and standardize on using the IS_ENABLED macro for the
power domain data list.

Reviewed-by: Igor Opaniuk 
Signed-off-by: Bryan Brattlof 
---
 drivers/power/domain/ti-power-domain.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/domain/ti-power-domain.c 
b/drivers/power/domain/ti-power-domain.c
index b34c982f4f5fa..dc5d74539edcf 100644
--- a/drivers/power/domain/ti-power-domain.c
+++ b/drivers/power/domain/ti-power-domain.c
@@ -81,19 +81,20 @@ static const struct soc_attr ti_k3_soc_pd_data[] = {
.family = "J7200",
.data = _pd_platdata,
},
-#elif CONFIG_SOC_K3_J721S2
+#endif
+#if IS_ENABLED(CONFIG_SOC_K3_J721S2)
{
.family = "J721S2",
.data = _pd_platdata,
},
 #endif
-#ifdef CONFIG_SOC_K3_AM625
+#if IS_ENABLED(CONFIG_SOC_K3_AM625)
{
.family = "AM62X",
.data = _pd_platdata,
},
 #endif
-#ifdef CONFIG_SOC_K3_AM62A7
+#if IS_ENABLED(CONFIG_SOC_K3_AM62A7)
{
.family = "AM62AX",
.data = _pd_platdata,

-- 
2.43.2



[PATCH v3 03/13] arm: mach-k3: am62px: introduce clock and device files for wkup spl

2024-02-26 Thread Bryan Brattlof
Include the clock and lpsc tree files needed for the wkup spl to
initialize the proper PLLs and power domains to boot the SoC.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/r5/Makefile   |   1 +
 arch/arm/mach-k3/r5/am62px/Makefile|   6 +
 arch/arm/mach-k3/r5/am62px/clk-data.c  | 325 +
 arch/arm/mach-k3/r5/am62px/dev-data.c  |  71 +++
 drivers/clk/ti/clk-k3.c|   6 +
 drivers/power/domain/ti-power-domain.c |   6 +
 include/k3-clk.h   |   1 +
 include/k3-dev.h   |   1 +
 8 files changed, 417 insertions(+)

diff --git a/arch/arm/mach-k3/r5/Makefile b/arch/arm/mach-k3/r5/Makefile
index b99199d337411..d1cd96d459bc4 100644
--- a/arch/arm/mach-k3/r5/Makefile
+++ b/arch/arm/mach-k3/r5/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_SOC_K3_J721E) += j7200/
 obj-$(CONFIG_SOC_K3_J721S2) += j721s2/
 obj-$(CONFIG_SOC_K3_AM625) += am62x/
 obj-$(CONFIG_SOC_K3_AM62A7) += am62ax/
+obj-$(CONFIG_SOC_K3_AM62P5) += am62px/
 
 obj-y += lowlevel_init.o
 obj-y += r5_mpu.o
diff --git a/arch/arm/mach-k3/r5/am62px/Makefile 
b/arch/arm/mach-k3/r5/am62px/Makefile
new file mode 100644
index 0..50b0df20a3d1a
--- /dev/null
+++ b/arch/arm/mach-k3/r5/am62px/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+
+obj-y += clk-data.o
+obj-y += dev-data.o
diff --git a/arch/arm/mach-k3/r5/am62px/clk-data.c 
b/arch/arm/mach-k3/r5/am62px/clk-data.c
new file mode 100644
index 0..4b9892fe05167
--- /dev/null
+++ b/arch/arm/mach-k3/r5/am62px/clk-data.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * AM62PX specific clock platform data
+ *
+ * This file is auto generated. Please do not hand edit and report any issues
+ * to Bryan Brattlof .
+ *
+ * Copyright (C) 2020-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include "k3-clk.h"
+
+static const char * const gluelogic_hfosc0_clkout_parents[] = {
+   NULL,
+   NULL,
+   "osc_24_mhz",
+   "osc_25_mhz",
+   "osc_26_mhz",
+   NULL,
+};
+
+static const char * const clk_32k_rc_sel_out0_parents[] = {
+   "gluelogic_rcosc_clk_1p0v_97p65k",
+   "gluelogic_hfosc0_clkout",
+   "gluelogic_rcosc_clk_1p0v_97p65k",
+   "gluelogic_lfosc0_clkout",
+};
+
+static const char * const main_emmcsd1_io_clklb_sel_out0_parents[] = {
+   "board_0_mmc1_clklb_out",
+   "board_0_mmc1_clk_out",
+};
+
+static const char * const main_ospi_loopback_clk_sel_out0_parents[] = {
+   "board_0_ospi0_dqs_out",
+   "board_0_ospi0_lbclko_out",
+};
+
+static const char * const main_usb0_refclk_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "postdiv4_16ff_main_0_hsdivout8_clk",
+};
+
+static const char * const main_usb1_refclk_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "postdiv4_16ff_main_0_hsdivout8_clk",
+};
+
+static const char * const sam62_pll_ctrl_wrap_main_0_sysclkout_clk_parents[] = 
{
+   "gluelogic_hfosc0_clkout",
+   "hsdiv4_16fft_main_0_hsdivout0_clk",
+};
+
+static const char * const sam62_pll_ctrl_wrap_mcu_0_sysclkout_clk_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "hsdiv4_16fft_mcu_0_hsdivout0_clk",
+};
+
+static const char * const clkout0_ctrl_out0_parents[] = {
+   "hsdiv4_16fft_main_2_hsdivout1_clk",
+   "hsdiv4_16fft_main_2_hsdivout1_clk",
+};
+
+static const char * const main_emmcsd0_refclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_0_hsdivout5_clk",
+   "hsdiv4_16fft_main_2_hsdivout2_clk",
+};
+
+static const char * const main_emmcsd1_refclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_0_hsdivout5_clk",
+   "hsdiv4_16fft_main_2_hsdivout2_clk",
+};
+
+static const char * const main_gtcclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_2_hsdivout5_clk",
+   "postdiv4_16ff_main_0_hsdivout6_clk",
+   "board_0_cp_gemac_cpts0_rft_clk_out",
+   NULL,
+   "board_0_mcu_ext_refclk0_out",
+   "board_0_ext_refclk1_out",
+   "sam62_pll_ctrl_wrap_mcu_0_chip_div1_clk_clk",
+   "sam62_pll_ctrl_wrap_main_0_chip_div1_clk_clk",
+};
+
+static const char * const main_ospi_ref_clk_sel_out0_parents[] = {
+   "hsdiv4_16fft_main_0_hsdivout1_clk",
+   "postdiv1_16fft_main_1_hsdivout5_clk",
+};
+
+static const char * const main_timerclkn_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "clk_32k_rc_sel_out0",
+   "postdiv4_16ff_main_0_hsdivout7_clk",
+   "gluelogic_rcosc_clkout",

[PATCH v3 04/13] ram: k3-ddrss: enable the am62ax's DDR controller for am62px

2024-02-26 Thread Bryan Brattlof
The am62px family of SoCs uses the same DDR controller as found on the
am62ax family. Enable this option when building for the am62px family

Signed-off-by: Bryan Brattlof 
---
 drivers/ram/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ram/Kconfig b/drivers/ram/Kconfig
index 5b07e92030142..56391058567bb 100644
--- a/drivers/ram/Kconfig
+++ b/drivers/ram/Kconfig
@@ -65,7 +65,7 @@ choice
default K3_J721E_DDRSS if SOC_K3_J721E || SOC_K3_J721S2
default K3_AM64_DDRSS if SOC_K3_AM642
default K3_AM64_DDRSS if SOC_K3_AM625
-   default K3_AM62A_DDRSS if SOC_K3_AM62A7
+   default K3_AM62A_DDRSS if SOC_K3_AM62A7 || SOC_K3_AM62P5
 
 config K3_J721E_DDRSS
bool "Enable J721E DDRSS support"

-- 
2.43.2



[PATCH v3 09/13] dma: ti: k3-udma: Add DMA PSIL mappings for AM62P and J722S

2024-02-26 Thread Bryan Brattlof
From: Vignesh Raghavendra 

Add PSIL data for the AM62P and the J722S SoC family. The PSIL mapping
for the J722S is the same except for the extra instances of the CSI-RX.
So let's reuse the same file for both the AM62P and J722S.

Signed-off-by: Vignesh Raghavendra 
Signed-off-by: Ravi Gunasekaran 
Signed-off-by: Vaishnav Achath 
Signed-off-by: Jayesh Choudhary 
[b...@ti.com: rebased to U-Boot v2024.01]
Signed-off-by: Bryan Brattlof 
---
 drivers/dma/ti/Makefile|   2 +
 drivers/dma/ti/k3-psil-am62p.c | 325 +
 drivers/dma/ti/k3-psil-priv.h  |   1 +
 drivers/dma/ti/k3-psil.c   |   4 +
 4 files changed, 332 insertions(+)

diff --git a/drivers/dma/ti/Makefile b/drivers/dma/ti/Makefile
index f4e0271efbf32..17223b20432da 100644
--- a/drivers/dma/ti/Makefile
+++ b/drivers/dma/ti/Makefile
@@ -9,3 +9,5 @@ k3-psil-data-$(CONFIG_SOC_K3_J721S2) += k3-psil-j721s2.o
 k3-psil-data-$(CONFIG_SOC_K3_AM642) += k3-psil-am64.o
 k3-psil-data-$(CONFIG_SOC_K3_AM625) += k3-psil-am62.o
 k3-psil-data-$(CONFIG_SOC_K3_AM62A7) += k3-psil-am62a.o
+k3-psil-data-$(CONFIG_SOC_K3_AM62P5) += k3-psil-am62p.o
+k3-psil-data-$(CONFIG_SOC_K3_J722S) += k3-psil-am62p.o
diff --git a/drivers/dma/ti/k3-psil-am62p.c b/drivers/dma/ti/k3-psil-am62p.c
new file mode 100644
index 0..8739bf41b5b7c
--- /dev/null
+++ b/drivers/dma/ti/k3-psil-am62p.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com
+ */
+
+#include 
+
+#include "k3-psil-priv.h"
+
+#define PSIL_PDMA_XY_TR(x) \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .mapped_channel_id = -1,\
+   .default_flow_id = -1,  \
+   },  \
+   }
+
+#define PSIL_PDMA_XY_PKT(x)\
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .mapped_channel_id = -1,\
+   .default_flow_id = -1,  \
+   .pkt_mode = 1,  \
+   },  \
+   }
+
+#define PSIL_ETHERNET(x, ch, flow_base, flow_cnt)  \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_NATIVE,  \
+   .pkt_mode = 1,  \
+   .needs_epib = 1,\
+   .psd_size = 16, \
+   .mapped_channel_id = ch,\
+   .flow_start = flow_base,\
+   .flow_num = flow_cnt,   \
+   .default_flow_id = flow_base,   \
+   },  \
+   }
+
+#define PSIL_SAUL(x, ch, flow_base, flow_cnt, default_flow, tx)\
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_NATIVE,  \
+   .pkt_mode = 1,  \
+   .needs_epib = 1,\
+   .psd_size = 64, \
+   .mapped_channel_id = ch,\
+   .flow_start = flow_base,\
+   .flow_num = flow_cnt,   \
+   .default_flow_id = default_flow,\
+   .notdpkt = tx,  \
+   },  \
+   }
+
+#define PSIL_PDMA_MCASP(x) \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .pdma_acc32 = 1,\
+   .pdma

[PATCH v3 05/13] arm: mach-k3: invert logic for split DM firmware config

2024-02-26 Thread Bryan Brattlof
Currently, for the K3 generation of SoCs, there are more SoCs that
utilize the split firmware approach than the combined DMSC firmware.
Invert the logic to avoid adding more and more SoCs to this list.

Acked-by: Andrew Davis 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 03898424c9546..ffceb6428d42e 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -130,7 +130,7 @@ config K3_ATF_LOAD_ADDR
 
 config K3_DM_FW
bool "Separate DM firmware image"
-   depends on CPU_V7R && (SOC_K3_J721E || SOC_K3_J721S2 || SOC_K3_AM625 || 
SOC_K3_AM62A7) && !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
+   depends on CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && !CLK_TI_SCI && 
!TI_SCI_POWER_DOMAIN
default y
help
  Enabling this will indicate that the system has separate DM

-- 
2.43.2



[PATCH v3 00/13] Hello Again Everyone!

2024-02-26 Thread Bryan Brattlof
**Note:**  This series depends on the v6 OF_UPSTREAM work from Sumit[0].
Patch #11 was added to fix some Makefile.spl targets to allow SPL builds
to complete with the OF_UPSTREAM series.

The AM62Px is an extension of the existing Sitara AM62x low-cost family
of application processors built for Automotive and Linux Application
development. Scalable Arm Cortex-A53 performance and embedded features,
such as: multi high-definition display support, 3D-graphics
acceleration, 4K video acceleration, and extensive peripherals make the
AM62Px well-suited for a broad range of automation and industrial
application, including automotive digital instrumentation, automotive
displays, industrial HMI, and more.

Some highlights of AM62P SoC are:

* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
  Dual/Single core variants are provided in the same package to allow HW
  compatible designs.

* One Device manager Cortex-R5F for system power and resource
  management, and one Cortex-R5F for Functional Safety or
  general-purpose usage.

* One 3D GPU up to 50 GLFOPS

* H.264/H.265 Video Encode/Decode.

* Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
  2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution

* Integrated Giga-bit Ethernet switch supporting up to a total of two
  external ports (TSN capable).

* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
  1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.

* Dedicated Centralized Hardware Security Module with support for secure
  boot, debug security and crypto acceleration and trusted execution
  environment.

* One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.

* Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
  enabling battery powered system design.

For those interested, more details about this SoC can be found in the
Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83

Proof-of-Life: 
https://paste.sr.ht/~bryanb/af2ac108a9362549aa326f182e87918d52bf2d71

Currently, while more peripherals are being added in Linux[0], this
series will only support UART boot.

Thanks for reviewing!
~Bryan

Changes from v2: [2]
 - dropped the extra ARCH_K3 not needed for the K3_DM_FW option
 - removed the extra _pktdma and _bcdma nodes already
   present in the kernel dtbs
 - corrected a few patch fixup errors
 - rebased ontop op OF_UPSTREAM v5 [0]
 - %s/uboot/U-Boot/g

Changes from v1: [1]
 - squashed all clk and lpsc tree updates into a single commit
 - corrected SOC_K3_AM642 typo with DM firmware Kconfig option
 - updated RM configs and dma nodes to enable IP that need DMA
 - added the dtb targets to the dts/Makefile
 - rebased the series on top of v2024.01-rc1
 - switched to bootstd rather than use distro boot scripts.
 - enabled OF_UPSTREAM instead of using the arch/arm/dts directory

[0] 
https://lore.kernel.org/u-boot/20240222093607.3085545-1-sumit.g...@linaro.org/
[1] https://lore.kernel.org/all/20231012230616.2101992-13...@ti.com/
[2] https://lore.kernel.org/u-boot/20240201030634.1120963-17...@ti.com/

---
Bryan Brattlof (11):
  soc: add info to identify the am62p SoC family
  power: domain: ti: use IS_ENABLED macro
  arm: mach-k3: am62px: introduce clock and device files for wkup spl
  ram: k3-ddrss: enable the am62ax's DDR controller for am62px
  arm: mach-k3: invert logic for split DM firmware config
  arch: mach-k3: introduce basic files to support the am62px SoC family
  board: ti: introduce basic board files for the am62px family
  arm: dts: introduce am62p5 U-Boot dts files
  Makefile: remove hardcoded device tree source directory
  configs: introduce configs needed for the am62px
  doc: board: ti: introduce am62px documentation

Hari Nagalla (1):
  firmware: ti_sci_static_data: add static DMA channel data

Vignesh Raghavendra (1):
  dma: ti: k3-udma: Add DMA PSIL mappings for AM62P and J722S

 Makefile   |   18 +-
 arch/arm/dts/Makefile  |2 +
 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
 arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
 arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   23 +
 arch/arm/mach-k3/Kconfig   |9 +-
 arch/arm/mach-k3/Makefile  |1 +
 arch/arm/mach-k3/am62p5_init.c |  280 +++
 arch/arm/mach-k3/am62px/Kconfig|   32 +
 arch/arm/mach-k3/include/mach/am62p_hardware.h |   83 +
 arch/arm/mach-k3/include/mach/am62p_spl.h  |   49 +
 arch/arm/mach-k3/include/mach/hardware.h   |6 +
 arch/arm/mach-k3/include/mach/spl.h|4 +
 arch/arm/mach-k3/r5/Makefile   |1 +
 arch/arm/mach-k3/r5/am62px/Makefile|6 +
 arch/arm/mach

[PATCH v3 13/13] doc: board: ti: introduce am62px documentation

2024-02-26 Thread Bryan Brattlof
Introduce basic documentation for the am62p family of SoCs.

Signed-off-by: Bryan Brattlof 
---
 doc/board/ti/am62px_sk.rst | 289 +
 doc/board/ti/k3.rst|   1 +
 2 files changed, 290 insertions(+)

diff --git a/doc/board/ti/am62px_sk.rst b/doc/board/ti/am62px_sk.rst
new file mode 100644
index 0..1f2982c36f9e4
--- /dev/null
+++ b/doc/board/ti/am62px_sk.rst
@@ -0,0 +1,289 @@
+.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+.. sectionauthor:: Bryan Brattlof 
+
+AM62Px Platforms
+
+
+The AM62Px is an extension of the existing Sitara AM62x low-cost family
+of application processors built for Automotive and Linux Application
+development. Scalable Arm Cortex-A53 performance and embedded features,
+such as: multi high-definition display support, 3D-graphics
+acceleration, 4K video acceleration, and extensive peripherals make the
+AM62Px well-suited for a broad range of automation and industrial
+application, including automotive digital instrumentation, automotive
+displays, industrial HMI, and more.
+
+Some highlights of AM62P SoC are:
+
+* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
+  Dual/Single core variants are provided in the same package to allow HW
+  compatible designs.
+
+* One Device manager Cortex-R5F for system power and resource
+  management, and one Cortex-R5F for Functional Safety or
+  general-purpose usage.
+
+* One 3D GPU up to 50 GLFOPS
+
+* H.264/H.265 Video Encode/Decode.
+
+* Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
+  2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution
+
+* Integrated Giga-bit Ethernet switch supporting up to a total of two
+  external ports (TSN capable).
+
+* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
+  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
+  1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.
+
+* Dedicated Centralized Hardware Security Module with support for secure
+  boot, debug security and crypto acceleration and trusted execution
+  environment.
+
+* One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.
+
+* Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
+  enabling battery powered system design.
+
+For those interested, more details about this SoC can be found in the
+Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83
+
+Boot Flow:
+--
+
+The bootflow is exactly the same as all SoCs in the am62xxx extended SoC
+family. Below is the pictorial representation:
+
+.. image:: img/boot_diagram_k3_current.svg
+  :alt: Boot flow diagram
+
+- Here TIFS acts as master and provides all the critical services. R5/A53
+  requests TIFS to get these services done as shown in the above diagram.
+
+Sources:
+
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_boot_sources
+:end-before: .. k3_rst_include_end_boot_sources
+
+Build procedure:
+
+
+0. Setup the environment variables:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_desc
+:end-before: .. k3_rst_include_end_common_env_vars_desc
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_board_env_vars_desc
+:end-before: .. k3_rst_include_end_board_env_vars_desc
+
+Set the variables corresponding to this platform:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_defn
+:end-before: .. k3_rst_include_end_common_env_vars_defn
+
+.. code-block:: bash
+
+ $ export UBOOT_CFG_CORTEXR=am62px_evm_r5_defconfig
+ $ export UBOOT_CFG_CORTEXA=am62px_evm_a53_defconfig
+ $ export TFA_BOARD=lite
+ $ # we dont use any extra TFA parameters
+ $ unset TFA_EXTRA_ARGS
+ $ export OPTEE_PLATFORM=k3-am62x
+ $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+
+.. am62px_evm_rst_include_start_build_steps
+
+1. Trusted Firmware-A:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_tfa
+:end-before: .. k3_rst_include_end_build_steps_tfa
+
+
+2. OP-TEE:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_optee
+:end-before: .. k3_rst_include_end_build_steps_optee
+
+3. U-Boot:
+
+* 3.1 R5:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_spl_r5
+:end-before: .. k3_rst_include_end_build_steps_spl_r5
+
+* 3.2 A53:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_uboot
+:end-before: .. k3_rst_include_end_build_steps_uboot
+.. am62px_evm_rst_include_end_build_steps
+
+Target Images
+--
+
+In order to boot we need tiboot3.bin, tispl.bin and u-boot.img.  Each SoC
+variant (HS-FS, HS-SE) requires a different source for these files.
+
+ - HS-FS
+
+* tiboot3-am62px-hs-fs-evm.bin from step 3.1
+* tispl.bin, u-boot.img from step 3.2
+
+ - HS-SE
+
+   

[PATCH v3 11/13] Makefile: remove hardcoded device tree source directory

2024-02-26 Thread Bryan Brattlof
Some boards that choose to utilize the OF_UPSTREAM directory for their
device tree files will need to specify that directory instead of the
traditional arch/$(ARCH)/dts/* path.

Include the correct path to the board's dtbs depending on if OF_UPSTREAM
is selected or not.

Reviewed-by: Sumit Garg 
Signed-off-by: Bryan Brattlof 
---
 Makefile | 18 ++
 scripts/Makefile.spl | 17 +
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 0f0c7f30d2717..51b57d26857f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1184,6 +1184,16 @@ dt_binding_check: scripts_dtc
 quiet_cmd_copy = COPY$@
   cmd_copy = cp $< $@
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/upstream/src/arm64
+else
+dt_dir := dts/upstream/src/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
+
 ifeq ($(CONFIG_MULTI_DTB_FIT),y)
 
 ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y)
@@ -1209,7 +1219,7 @@ endif
 
 MKIMAGEFLAGS_fit-dtb.blob = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
-a 0 -e 0 -E \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) 
-d /dev/null
+   $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d 
/dev/null
 
 MKIMAGEFLAGS_fit-dtb.blob += -B 0x8
 
@@ -1407,9 +1417,9 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware 
-C none -O u-boot \
-a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-p $(CONFIG_FIT_EXTERNAL_OFFSET) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst 
",,$(CONFIG_OF_OVERLAY_LIST)))
+   $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(DEVICE_TREE))) \
+   $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
+   $(patsubst %,-b $(dt_dir)/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST)))
 else
 MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 407fc52376a50..d074ba2350065 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -559,9 +559,15 @@ FORCE:
 $(obj)/dts/dt-$(SPL_NAME).dtb: dts/dt.dtb
$(Q)$(MAKE) $(build)=$(obj)/dts spl_dtbs
 
-PHONY += dts_dir
-dts_dir:
-   $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/upstream/src/arm64
+else
+dt_dir := dts/upstream/src/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
 
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable so we can use it in if_changed and friends.
@@ -569,8 +575,11 @@ dts_dir:
 
 SPL_OF_LIST_TARGETS = $(patsubst %,dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST)))
 SHRUNK_ARCH_DTB = $(addprefix $(obj)/,$(SPL_OF_LIST_TARGETS))
+$(dir $(SHRUNK_ARCH_DTB)):
+   $(shell [ -d $@ ] || mkdir -p $@)
+
 .SECONDEXPANSION:
-$(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, arch/$(ARCH)/dts/%, $$@) dts_dir
+$(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, $(dt_dir)/%, $$@) $(dir 
$(SHRUNK_ARCH_DTB))
$(call if_changed,fdtgrep)
 
 targets += $(SPL_OF_LIST_TARGETS)

-- 
2.43.2



[PATCH v3 01/13] soc: add info to identify the am62p SoC family

2024-02-26 Thread Bryan Brattlof
Include the part number for TI's am62px family of SoCs so we can
properly identify it during boot

Reviewed-by: Igor Opaniuk 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/include/mach/hardware.h | 2 ++
 drivers/soc/soc_ti_k3.c  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/mach-k3/include/mach/hardware.h 
b/arch/arm/mach-k3/include/mach/hardware.h
index a1a9dfbde66c8..040288150b12f 100644
--- a/arch/arm/mach-k3/include/mach/hardware.h
+++ b/arch/arm/mach-k3/include/mach/hardware.h
@@ -46,6 +46,7 @@
 #define JTAG_ID_PARTNO_J721S2  0xbb75
 #define JTAG_ID_PARTNO_AM62X   0xbb7e
 #define JTAG_ID_PARTNO_AM62AX   0xbb8d
+#define JTAG_ID_PARTNO_AM62PX  0xbb9d
 
 #define K3_SOC_ID(id, ID) \
 static inline bool soc_is_##id(void) \
@@ -61,6 +62,7 @@ K3_SOC_ID(am64x, AM64X)
 K3_SOC_ID(j721s2, J721S2)
 K3_SOC_ID(am62x, AM62X)
 K3_SOC_ID(am62ax, AM62AX)
+K3_SOC_ID(am62px, AM62PX)
 
 #define K3_SEC_MGR_SYS_STATUS  0x44234100
 #define SYS_STATUS_DEV_TYPE_SHIFT  0
diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
index 355a5368dd45a..d7d0152b115fa 100644
--- a/drivers/soc/soc_ti_k3.c
+++ b/drivers/soc/soc_ti_k3.c
@@ -45,6 +45,9 @@ static const char *get_family_string(u32 idreg)
case JTAG_ID_PARTNO_AM62AX:
family = "AM62AX";
break;
+   case JTAG_ID_PARTNO_AM62PX:
+   family = "AM62PX";
+   break;
default:
family = "Unknown Silicon";
};

-- 
2.43.2



Re: [PATCH v2] arm: mach-k3: Refactor QoS settings

2024-02-12 Thread Bryan Brattlof
Hey Aradhya!

On February 12, 2024 thus sayeth Aradhya Bhatia:
> Refactor common QoS code into a new common header file, and the soc
> specific setup_qos functions into a common API.
> 
> Rename $(soc)_qos_count and $(soc)_qos_data variables to qos_count and
> qos_data. When QoS settings of more SoCs are added, only one pair will
> be defined at a time, based on the config SOC_K3_$(soc).
> 
> This refactoring has been done for 2 major purposes.
> 
> - The auto-generated $(soc)_qos_data.c and $(soc)_qos.h files cannot
>   have any code that is specific to any bootloader. Those files have to
>   remain agnostic of different bootloader implementations and their
>   header files.
> 
> - The existing implementation was less than ideal and would have enabled
>   multiple $(soc)_qos_count and $(soc)_qos_data variables for all SoC
>   variants.
> 
> Signed-off-by: Aradhya Bhatia 
> ---
> 
> Change Log:
> 
>  - new in v2:
>- Move K3_QOS config to the r5/Kconfig.
> 
> Previous versions:
> 
>   - v1: https://lore.kernel.org/all/20240206085610.3226136-1-a-bhat...@ti.com/
> 

...

> diff --git a/arch/arm/mach-k3/r5/am62ax/Makefile 
> b/arch/arm/mach-k3/r5/am62ax/Makefile
> index 02a941805e9a..e4e55ce5c7dd 100644
> --- a/arch/arm/mach-k3/r5/am62ax/Makefile
> +++ b/arch/arm/mach-k3/r5/am62ax/Makefile
> @@ -4,4 +4,4 @@
>  
>  obj-y += clk-data.o
>  obj-y += dev-data.o
> -obj-y += am62a_qos_data.o
> +obj-y += am62a_qos_uboot.o

No objections from me though I am curious about the name change. Was 
there an issue with using the original am62a_qos_data.c

~Bryan


Re: [PATCH v2 05/13] arm: mach-k3: invert logic for split DM firmware config

2024-02-02 Thread Bryan Brattlof
On February  2, 2024 thus sayeth Andrew Davis:
> On 1/31/24 9:06 PM, Bryan Brattlof wrote:
> > Currently, for the K3 generation of SoCs, there are more SoCs that
> > utilize the split firmware approach than the combined DMSC firmware.
> > Invert the logic to avoid adding more and more SoCs to this list.
> > 
> > Signed-off-by: Bryan Brattlof 
> > ---
> >   arch/arm/mach-k3/Kconfig | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
> > index 03898424c9546..0574e81075e6d 100644
> > --- a/arch/arm/mach-k3/Kconfig
> > +++ b/arch/arm/mach-k3/Kconfig
> > @@ -130,7 +130,7 @@ config K3_ATF_LOAD_ADDR
> >   config K3_DM_FW
> > bool "Separate DM firmware image"
> > -   depends on CPU_V7R && (SOC_K3_J721E || SOC_K3_J721S2 || SOC_K3_AM625 || 
> > SOC_K3_AM62A7) && !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
> > +   depends on CPU_V7R && ARCH_K3 && !SOC_K3_AM642 && !SOC_K3_AM654 && 
> > !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
> 
> Always amusing to see how many SoCs get added to these lists before someone
> realizes there is only one or two SoCs that are not on the list :)

Haha having to resize my terminal is when I had enough :)

> 
> BTW, this whole file is inside an "if ARCH_K3" block, so all symbols
> depend on ARCH_K3 automatically. You can drop that check.
> 

Nice catch! I'll drop that in v2

> Otherwise,
> 
> Acked-by: Andrew Davis 
> 
> > default y
> > help
> >   Enabling this will indicate that the system has separate DM


Re: [PATCH v2 10/13] arm: dts: introduce am62p5 uboot dts files

2024-02-02 Thread Bryan Brattlof
On February  2, 2024 thus sayeth Andrew Davis:
> On 2/2/24 10:28 AM, Bryan Brattlof wrote:
> > Hi Andrew!
> > 
> > On February  2, 2024 thus sayeth Andrew Davis:
> > > On 1/31/24 9:06 PM, Bryan Brattlof wrote:
> > > > Include the uboot device tree files needed to boot the board.
> > > > 
> > > > Signed-off-by: Bryan Brattlof 
> > > > ---
> > > >arch/arm/dts/Makefile  |2 +
> > > >arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
> > > > 
> > > >arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
> > > >arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
> > > >arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   49 +
> > > >arch/arm/mach-k3/Makefile  |1 +
> > > >arch/arm/mach-k3/am62p5_init.c |4 +-
> > > >dts/arch/arm64/ti  |1 +
> > > >8 files changed, 3129 insertions(+), 2 deletions(-)
> > > >create mode 100644 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> > > >create mode 100644 arch/arm/dts/k3-am62p-sk-binman.dtsi
> > > >create mode 100644 arch/arm/dts/k3-am62p5-r5-sk.dts
> > > >create mode 100644 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi
> > > >create mode 12 dts/arch/arm64/ti
> > > > 
> > 
> > ...
> > 
> > > > diff --git a/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> > > > b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> > > > new file mode 100644
> > > > index 0..f66435201530f
> > > > --- /dev/null
> > > > +++ b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> > > > @@ -0,0 +1,2800 @@
> > > > +// SPDX-License-Identifier: GPL-2.0+
> > > > +/*
> > > > + * This file was generated with the
> > > > + * AM62Px SysConfig DDR Subsystem Register Configuration Tool v0.10.02
> > > > + * Thu Jan 25 2024 10:43:46 GMT-0600 (Central Standard Time)
> > > > + * DDR Type: LPDDR4
> > > > + * F0 = 50MHzF1 = NA F2 = 1600MHz
> > > > + * Density (per channel): 16Gb
> > > > + * Number of Ranks: 2
> > > > + */
> > > > +
> > > > +#define DDRSS_PLL_FHS_CNT 5
> > > > +#define DDRSS_PLL_FREQUENCY_1 8
> > > > +#define DDRSS_PLL_FREQUENCY_2 8
> > > > +#define DDRSS_SDRAM_IDX 17
> > > > +#define DDRSS_REGION_IDX 17
> > > > +
> > > > +#define DDRSS_CTL_0_DATA 0x0B00
> > > > +#define DDRSS_CTL_1_DATA 0x
> > > > +#define DDRSS_CTL_2_DATA 0x
> > > > +#define DDRSS_CTL_3_DATA 0x
> > > > +#define DDRSS_CTL_4_DATA 0x
> > > > +#define DDRSS_CTL_5_DATA 0x
> > > 
> > > I wonder if it would be better to generate this file
> > > during build..
> > > 
> > 
> > Yeah we can save a lot of space by removing tons of these registers
> > writing 0x0 to the reserved ranges... The section for the different PHYs
> > is particularly aggravating.
> > 
> 
> Might be a silly question, what happens if you don't write these 0x0
> at all, is there a sane default of 0x0, or is it random on powerup?
> 

The vast majority (especially the spaces between the PHYs) are just 
holes in the bus that find their way to a black hole when we write to 
it. Nothing bad will happen. There are some shadow registers we need to 
be careful about but those aren't hard to work around before we start 
the controller.

We'd just need to refactor how these registers are copied into the 
controller, right now it's something dumb like

   for(offset=0, offset > I told Simon and Marex last year I'd get to it once I find some free
> > cycles and then I went and had a son ;) but it's still in the backlog
> > 
> 
> Know the feeling :)
> 
> Andrew
> 
> > > 
> > > > +_bcdma {
> > > > +   reg = <0x00 0x485c0100 0x00 0x100>,
> > > > + <0x00 0x4c00 0x00 0x2>,
> > > > + <0x00 0x4a82 0x00 0x2>,
> > > > + <0x00 0x4aa4 0x00 0x2>,
> > > > + <0x00 0x4bc0 0x00 0x10>,
> > > > + <0x00 0x4860 0x00 0x8000>,
> > > > + <0x00 0x484a4000 0x00 0x2000>,
> > > > + <0x00 0x484c2000 0x00 0x2000>;
> > > > +   reg-names = "gcfg", "b

Re: [PATCH v2 00/13] Introduce basic support for TI's AM62Px SoC family

2024-02-02 Thread Bryan Brattlof
Hi Sumit!

On February  2, 2024 thus sayeth Sumit Garg:
> Hi Bryan,
> 
> On Thu, 1 Feb 2024 at 08:36, Bryan Brattlof  wrote:
> >
> > Hello Again Everyone!
> >
> > **Note:**  This series depends on the OF_UPSTREAM work from Sumit [0].
> > Patch #11 was added to fix some Makefile.spl targets to allow SPL builds
> > to complete with the OF_UPSTREAM series.
> 
> Thanks for your adoption of OF_UPSTREAM work. As evident from this
> series, it would be much easier to maintain U-Boot specific DT pieces
> rather than the full SoC specific DT copy from Linux source tree.
> 

Like all good ideas we should have done this years ago. Thanks for 
taking up the task of making this easier for us.

> -Sumit
> 
> >
> > The AM62Px is an extension of the existing Sitara AM62x low-cost family
> > of application processors built for Automotive and Linux Application
> > development. Scalable Arm Cortex-A53 performance and embedded features,
> > such as: multi high-definition display support, 3D-graphics
> > acceleration, 4K video acceleration, and extensive peripherals make the
> > AM62Px well-suited for a broad range of automation and industrial
> > application, including automotive digital instrumentation, automotive
> > displays, industrial HMI, and more.
> >
> > Some highlights of AM62P SoC are:
> >
> > * Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
> >   Dual/Single core variants are provided in the same package to allow HW
> >   compatible designs.
> >
> > * One Device manager Cortex-R5F for system power and resource
> >   management, and one Cortex-R5F for Functional Safety or
> >   general-purpose usage.
> >
> > * One 3D GPU up to 50 GLFOPS
> >
> > * H.264/H.265 Video Encode/Decode.
> >
> > * Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
> >   2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution
> >
> > * Integrated Giga-bit Ethernet switch supporting up to a total of two
> >   external ports (TSN capable).
> >
> > * 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
> >   NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
> >   1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.
> >
> > * Dedicated Centralized Hardware Security Module with support for secure
> >   boot, debug security and crypto acceleration and trusted execution
> >   environment.
> >
> > * One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.
> >
> > * Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
> >   enabling battery powered system design.
> >
> > For those interested, more details about this SoC can be found in the
> > Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83
> >
> > Proof-of-Life: 
> > https://paste.sr.ht/~bryanb/af2ac108a9362549aa326f182e87918d52bf2d71
> >
> > Currently, while more peripherals are being added in Linux[0], this
> > series will only support UART boot.
> >
> > Thanks for reviewing!
> > ~Bryan
> >
> > Changes from v1: [1]
> >  - squashed all clk and lpsc tree updates into a single commit
> >  - corrected SOC_K3_AM642 typo with DM firmware Kconfig option
> >  - updated RM configs and dma nodes to enable IP that need DMA
> >  - added the dtb targets to the dts/Makefile
> >  - rebased the series on top of v2024.01-rc1
> >  - switched to bootstd rather than use distro boot scripts.
> >  - enabled OF_UPSTREAM instead of using the arch/arm/dts directory
> >
> > [0] 
> > https://lore.kernel.org/u-boot/20240110103547.719757-1-sumit.g...@linaro.org/
> > [1] https://lore.kernel.org/all/20231012230616.2101992-13...@ti.com/
> >
> > Bryan Brattlof (11):
> >   soc: add info to identify the am62p SoC family
> >   power: domain: ti: use IS_ENABLED macro
> >   arm: mach-k3: am62px: introduce clock and device files for wkup spl
> >   ram: k3-ddrss: enable the am62ax's DDR controller for am62px
> >   arm: mach-k3: invert logic for split DM firmware config
> >   arch: mach-k3: introduce basic files to support the am62px SoC family
> >   board: ti: introduce basic board files for the am62px family
> >   arm: dts: introduce am62p5 uboot dts files
> >   Makefile: remove hardcoded device tree source directory
> >   configs: introduce configs needed for the am62px
> >   doc: board: ti: introduce am62px documentation
> >
> > Hari Nagalla (1):
> >   firmware: ti_sci_static_data: add static DMA channel data
> >
> > Vignesh Raghavendra (1):
> 

Re: [PATCH v2 10/13] arm: dts: introduce am62p5 uboot dts files

2024-02-02 Thread Bryan Brattlof
Hi Andrew!

On February  2, 2024 thus sayeth Andrew Davis:
> On 1/31/24 9:06 PM, Bryan Brattlof wrote:
> > Include the uboot device tree files needed to boot the board.
> > 
> > Signed-off-by: Bryan Brattlof 
> > ---
> >   arch/arm/dts/Makefile  |2 +
> >   arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
> >   arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
> >   arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
> >   arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   49 +
> >   arch/arm/mach-k3/Makefile  |1 +
> >   arch/arm/mach-k3/am62p5_init.c |4 +-
> >   dts/arch/arm64/ti  |1 +
> >   8 files changed, 3129 insertions(+), 2 deletions(-)
> >   create mode 100644 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> >   create mode 100644 arch/arm/dts/k3-am62p-sk-binman.dtsi
> >   create mode 100644 arch/arm/dts/k3-am62p5-r5-sk.dts
> >   create mode 100644 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi
> >   create mode 12 dts/arch/arm64/ti
> > 

...

> > diff --git a/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi 
> > b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> > new file mode 100644
> > index 0..f66435201530f
> > --- /dev/null
> > +++ b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
> > @@ -0,0 +1,2800 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * This file was generated with the
> > + * AM62Px SysConfig DDR Subsystem Register Configuration Tool v0.10.02
> > + * Thu Jan 25 2024 10:43:46 GMT-0600 (Central Standard Time)
> > + * DDR Type: LPDDR4
> > + * F0 = 50MHzF1 = NA F2 = 1600MHz
> > + * Density (per channel): 16Gb
> > + * Number of Ranks: 2
> > + */
> > +
> > +#define DDRSS_PLL_FHS_CNT 5
> > +#define DDRSS_PLL_FREQUENCY_1 8
> > +#define DDRSS_PLL_FREQUENCY_2 8
> > +#define DDRSS_SDRAM_IDX 17
> > +#define DDRSS_REGION_IDX 17
> > +
> > +#define DDRSS_CTL_0_DATA 0x0B00
> > +#define DDRSS_CTL_1_DATA 0x
> > +#define DDRSS_CTL_2_DATA 0x
> > +#define DDRSS_CTL_3_DATA 0x
> > +#define DDRSS_CTL_4_DATA 0x
> > +#define DDRSS_CTL_5_DATA 0x
> 
> I wonder if it would be better to generate this file
> during build..
> 

Yeah we can save a lot of space by removing tons of these registers 
writing 0x0 to the reserved ranges... The section for the different PHYs 
is particularly aggravating.

I told Simon and Marex last year I'd get to it once I find some free 
cycles and then I went and had a son ;) but it's still in the backlog 

> 
> > +_bcdma {
> > +   reg = <0x00 0x485c0100 0x00 0x100>,
> > + <0x00 0x4c00 0x00 0x2>,
> > + <0x00 0x4a82 0x00 0x2>,
> > + <0x00 0x4aa4 0x00 0x2>,
> > + <0x00 0x4bc0 0x00 0x10>,
> > + <0x00 0x4860 0x00 0x8000>,
> > + <0x00 0x484a4000 0x00 0x2000>,
> > + <0x00 0x484c2000 0x00 0x2000>;
> > +   reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt",
> > +   "ringrt", "cfg", "tchan", "rchan";
> > +};
> > +
> 
> Do we still need these? Thought they got fixed kernel side already.

Ah you're right I missed that i'll remove this in v2

> 
> > +_pktdma {
> > +   reg = <0x00 0x485c 0x00 0x100>,
> > + <0x00 0x4a80 0x00 0x2>,
> > + <0x00 0x4aa0 0x00 0x4>,
> > + <0x00 0x4b80 0x00 0x40>,
> > + <0x00 0x485e 0x00 0x2>,
> > + <0x00 0x484a 0x00 0x4000>,
> > + <0x00 0x484c 0x00 0x2000>,
> > + <0x00 0x4843 0x00 0x4000>;
> > +   reg-names = "gcfg", "rchanrt", "tchanrt", "ringrt",
> > +   "cfg", "tchan", "rchan", "rflow";
> > +};
> > diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile
> > index 42161376469e2..820b313a83c23 100644
> > --- a/arch/arm/mach-k3/Makefile
> > +++ b/arch/arm/mach-k3/Makefile
> > @@ -20,5 +20,6 @@ obj-$(CONFIG_SOC_K3_J721S2) += j721s2_init.o
> >   obj-$(CONFIG_SOC_K3_AM642) += am642_init.o
> >   obj-$(CONFIG_SOC_K3_AM625) += am625_init.o
> >   obj-$(CONFIG_SOC_K3_AM62A7) += am62a7_init.o
> > +obj-$(CONFIG_SOC_K3_AM62P5) += am62p5_init.o
> >   endif
> >   obj-y += common.o security.o
> > diff --git a/arch/arm/mach-k3/am62p5_init.c b/arch/arm/mach-k3/am62p5_init.c
> > index 5b6795cc7d246..9ff877d5d26e8 100644
> > --- a/arch/arm/mach-k3/am62p5_init.c
> > +++ b/arch/arm/mach-k3/am62p5_init.c
> > @@ -110,7 +110,7 @@ void board_init_f(ulong dummy)
> >  * through a SYSFW PM-init step and will need a re-init in some way
> >  * due to changing module clock frequencies.
> >  */
> > -   if (IS_ENABLED(CONFIG_K3_EARLY_CONS))
> > +   if (IS_ENABLED(CONFIG_K3_EARLY_CONS)) {
> 
> Looks like fixes for a previous patch that didn't get squashed.
>

haha Oops good catch.. I'll fixup this properly


Thanks for the review Andrew
~Bryan


[PATCH v2 10/13] arm: dts: introduce am62p5 uboot dts files

2024-02-01 Thread Bryan Brattlof
Include the uboot device tree files needed to boot the board.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/Makefile  |2 +
 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi | 2800 
 arch/arm/dts/k3-am62p-sk-binman.dtsi   |  173 ++
 arch/arm/dts/k3-am62p5-r5-sk.dts   |  101 +
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   49 +
 arch/arm/mach-k3/Makefile  |1 +
 arch/arm/mach-k3/am62p5_init.c |4 +-
 dts/arch/arm64/ti  |1 +
 8 files changed, 3129 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
 create mode 100644 arch/arm/dts/k3-am62p-sk-binman.dtsi
 create mode 100644 arch/arm/dts/k3-am62p5-r5-sk.dts
 create mode 100644 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi
 create mode 12 dts/arch/arm64/ti

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 34ebf2b58417d..36de84287d4c2 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1424,6 +1424,8 @@ dtb-$(CONFIG_SOC_K3_AM625) += k3-am625-sk.dtb \
 dtb-$(CONFIG_SOC_K3_AM62A7) += k3-am62a7-sk.dtb \
  k3-am62a7-r5-sk.dtb
 
+dtb-$(CONFIG_SOC_K3_AM62P5) += k3-am62p5-r5-sk.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7622-rfb.dtb \
mt7623a-unielec-u7623-02-emmc.dtb \
diff --git a/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi 
b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
new file mode 100644
index 0..f66435201530f
--- /dev/null
+++ b/arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi
@@ -0,0 +1,2800 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This file was generated with the
+ * AM62Px SysConfig DDR Subsystem Register Configuration Tool v0.10.02
+ * Thu Jan 25 2024 10:43:46 GMT-0600 (Central Standard Time)
+ * DDR Type: LPDDR4
+ * F0 = 50MHzF1 = NA F2 = 1600MHz
+ * Density (per channel): 16Gb
+ * Number of Ranks: 2
+ */
+
+#define DDRSS_PLL_FHS_CNT 5
+#define DDRSS_PLL_FREQUENCY_1 8
+#define DDRSS_PLL_FREQUENCY_2 8
+#define DDRSS_SDRAM_IDX 17
+#define DDRSS_REGION_IDX 17
+
+#define DDRSS_CTL_0_DATA 0x0B00
+#define DDRSS_CTL_1_DATA 0x
+#define DDRSS_CTL_2_DATA 0x
+#define DDRSS_CTL_3_DATA 0x
+#define DDRSS_CTL_4_DATA 0x
+#define DDRSS_CTL_5_DATA 0x
+#define DDRSS_CTL_6_DATA 0x
+#define DDRSS_CTL_7_DATA 0x2710
+#define DDRSS_CTL_8_DATA 0x000186A0
+#define DDRSS_CTL_9_DATA 0x0005
+#define DDRSS_CTL_10_DATA 0x0064
+#define DDRSS_CTL_11_DATA 0x0004E200
+#define DDRSS_CTL_12_DATA 0x0030D400
+#define DDRSS_CTL_13_DATA 0x0005
+#define DDRSS_CTL_14_DATA 0x0C80
+#define DDRSS_CTL_15_DATA 0x0004E200
+#define DDRSS_CTL_16_DATA 0x0030D400
+#define DDRSS_CTL_17_DATA 0x0005
+#define DDRSS_CTL_18_DATA 0x0C80
+#define DDRSS_CTL_19_DATA 0x01010100
+#define DDRSS_CTL_20_DATA 0x01010100
+#define DDRSS_CTL_21_DATA 0x01000110
+#define DDRSS_CTL_22_DATA 0x02010002
+#define DDRSS_CTL_23_DATA 0x000A
+#define DDRSS_CTL_24_DATA 0x000186A0
+#define DDRSS_CTL_25_DATA 0x
+#define DDRSS_CTL_26_DATA 0x
+#define DDRSS_CTL_27_DATA 0x
+#define DDRSS_CTL_28_DATA 0x
+#define DDRSS_CTL_29_DATA 0x00020200
+#define DDRSS_CTL_30_DATA 0x
+#define DDRSS_CTL_31_DATA 0x
+#define DDRSS_CTL_32_DATA 0x
+#define DDRSS_CTL_33_DATA 0x
+#define DDRSS_CTL_34_DATA 0x0810
+#define DDRSS_CTL_35_DATA 0x4040
+#define DDRSS_CTL_36_DATA 0x
+#define DDRSS_CTL_37_DATA 0x
+#define DDRSS_CTL_38_DATA 0x
+#define DDRSS_CTL_39_DATA 0x
+#define DDRSS_CTL_40_DATA 0x040C
+#define DDRSS_CTL_41_DATA 0x
+#define DDRSS_CTL_42_DATA 0x0E38
+#define DDRSS_CTL_43_DATA 0x
+#define DDRSS_CTL_44_DATA 0x0E38
+#define DDRSS_CTL_45_DATA 0x
+#define DDRSS_CTL_46_DATA 0x05000804
+#define DDRSS_CTL_47_DATA 0x0700
+#define DDRSS_CTL_48_DATA 0x09090004
+#define DDRSS_CTL_49_DATA 0x0303
+#define DDRSS_CTL_50_DATA 0x00620011
+#define DDRSS_CTL_51_DATA 0x09110045
+#define DDRSS_CTL_52_DATA 0x421D
+#define DDRSS_CTL_53_DATA 0x00620011
+#define DDRSS_CTL_54_DATA 0x09110045
+#define DDRSS_CTL_55_DATA 0x0900421D
+#define DDRSS_CTL_56_DATA 0x000A0A09
+#define DDRSS_CTL_57_DATA 0x040006DB
+#define DDRSS_CTL_58_DATA 0x090D2005
+#define DDRSS_CTL_59_DATA 0x1710
+#define DDRSS_CTL_60_DATA 0x0C00DB60
+#define DDRSS_CTL_61_DATA 0x090D200D
+#define DDRSS_CTL_62_DATA 0x1710
+#define DDRSS_CTL_63_DATA 0x0C00DB60
+#define DDRSS_CTL_64_DATA 0x0304200D
+#define DDRSS_CTL_65_DATA 0x04050002
+#define DDRSS_CTL_66_DATA 0x1F1E1F1E
+#define DDRSS_CTL_67_DATA 0x01010008
+#define DDRSS_CTL_68_DATA 0x043C3C07
+#define DDRSS_CTL_69_DATA 0x0303
+#define DDRSS_CTL_70_DATA 0x
+#define DDRSS_CTL_71_DATA 0x0101
+#define DDRSS_CTL_72_DATA 0x
+#define DDRSS_CTL_73_DATA 0x0100
+#define DDRSS_CTL_74_DATA 0x00130803
+#define DDRSS_CTL_75_DATA 0x00BB
+#define

[PATCH v2 03/13] arm: mach-k3: am62px: introduce clock and device files for wkup spl

2024-01-31 Thread Bryan Brattlof
Include the clock and lpsc tree files needed for the wkup spl to
initialize the proper PLLs and power domains to boot the SoC.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/r5/Makefile   |   1 +
 arch/arm/mach-k3/r5/am62px/Makefile|   6 +
 arch/arm/mach-k3/r5/am62px/clk-data.c  | 325 +
 arch/arm/mach-k3/r5/am62px/dev-data.c  |  71 ++
 drivers/clk/ti/clk-k3.c|   6 +
 drivers/power/domain/ti-power-domain.c |   6 +
 include/k3-clk.h   |   1 +
 include/k3-dev.h   |   1 +
 8 files changed, 417 insertions(+)
 create mode 100644 arch/arm/mach-k3/r5/am62px/Makefile
 create mode 100644 arch/arm/mach-k3/r5/am62px/clk-data.c
 create mode 100644 arch/arm/mach-k3/r5/am62px/dev-data.c

diff --git a/arch/arm/mach-k3/r5/Makefile b/arch/arm/mach-k3/r5/Makefile
index b99199d337411..d1cd96d459bc4 100644
--- a/arch/arm/mach-k3/r5/Makefile
+++ b/arch/arm/mach-k3/r5/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_SOC_K3_J721E) += j7200/
 obj-$(CONFIG_SOC_K3_J721S2) += j721s2/
 obj-$(CONFIG_SOC_K3_AM625) += am62x/
 obj-$(CONFIG_SOC_K3_AM62A7) += am62ax/
+obj-$(CONFIG_SOC_K3_AM62P5) += am62px/
 
 obj-y += lowlevel_init.o
 obj-y += r5_mpu.o
diff --git a/arch/arm/mach-k3/r5/am62px/Makefile 
b/arch/arm/mach-k3/r5/am62px/Makefile
new file mode 100644
index 0..50b0df20a3d1a
--- /dev/null
+++ b/arch/arm/mach-k3/r5/am62px/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+
+obj-y += clk-data.o
+obj-y += dev-data.o
diff --git a/arch/arm/mach-k3/r5/am62px/clk-data.c 
b/arch/arm/mach-k3/r5/am62px/clk-data.c
new file mode 100644
index 0..4b9892fe05167
--- /dev/null
+++ b/arch/arm/mach-k3/r5/am62px/clk-data.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * AM62PX specific clock platform data
+ *
+ * This file is auto generated. Please do not hand edit and report any issues
+ * to Bryan Brattlof .
+ *
+ * Copyright (C) 2020-2023 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include "k3-clk.h"
+
+static const char * const gluelogic_hfosc0_clkout_parents[] = {
+   NULL,
+   NULL,
+   "osc_24_mhz",
+   "osc_25_mhz",
+   "osc_26_mhz",
+   NULL,
+};
+
+static const char * const clk_32k_rc_sel_out0_parents[] = {
+   "gluelogic_rcosc_clk_1p0v_97p65k",
+   "gluelogic_hfosc0_clkout",
+   "gluelogic_rcosc_clk_1p0v_97p65k",
+   "gluelogic_lfosc0_clkout",
+};
+
+static const char * const main_emmcsd1_io_clklb_sel_out0_parents[] = {
+   "board_0_mmc1_clklb_out",
+   "board_0_mmc1_clk_out",
+};
+
+static const char * const main_ospi_loopback_clk_sel_out0_parents[] = {
+   "board_0_ospi0_dqs_out",
+   "board_0_ospi0_lbclko_out",
+};
+
+static const char * const main_usb0_refclk_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "postdiv4_16ff_main_0_hsdivout8_clk",
+};
+
+static const char * const main_usb1_refclk_sel_out0_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "postdiv4_16ff_main_0_hsdivout8_clk",
+};
+
+static const char * const sam62_pll_ctrl_wrap_main_0_sysclkout_clk_parents[] = 
{
+   "gluelogic_hfosc0_clkout",
+   "hsdiv4_16fft_main_0_hsdivout0_clk",
+};
+
+static const char * const sam62_pll_ctrl_wrap_mcu_0_sysclkout_clk_parents[] = {
+   "gluelogic_hfosc0_clkout",
+   "hsdiv4_16fft_mcu_0_hsdivout0_clk",
+};
+
+static const char * const clkout0_ctrl_out0_parents[] = {
+   "hsdiv4_16fft_main_2_hsdivout1_clk",
+   "hsdiv4_16fft_main_2_hsdivout1_clk",
+};
+
+static const char * const main_emmcsd0_refclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_0_hsdivout5_clk",
+   "hsdiv4_16fft_main_2_hsdivout2_clk",
+};
+
+static const char * const main_emmcsd1_refclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_0_hsdivout5_clk",
+   "hsdiv4_16fft_main_2_hsdivout2_clk",
+};
+
+static const char * const main_gtcclk_sel_out0_parents[] = {
+   "postdiv4_16ff_main_2_hsdivout5_clk",
+   "postdiv4_16ff_main_0_hsdivout6_clk",
+   "board_0_cp_gemac_cpts0_rft_clk_out",
+   NULL,
+   "board_0_mcu_ext_refclk0_out",
+   "board_0_ext_refclk1_out",
+   "sam62_pll_ctrl_wrap_mcu_0_chip_div1_clk_clk",
+   "sam62_pll_ctrl_wrap_main_0_chip_div1_clk_clk",
+};
+
+static const char * const main_ospi_ref_clk_sel_out0_parents[] = {
+   "hsdiv4_16fft_main_0_hsdivout1_clk",
+   "postdiv1_16fft_main_1_hsdivout5_clk",
+};
+
+static const char * const main_timerclkn_sel_out0_parents[] = {
+   "gluelogic_hfosc0_cl

[PATCH v2 06/13] arch: mach-k3: introduce basic files to support the am62px SoC family

2024-01-31 Thread Bryan Brattlof
Introduce the basic functions and definitions needed to properly
initialize TI's am62p family of SoCs

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/Kconfig  |   7 +-
 arch/arm/mach-k3/am62p5_init.c| 280 ++
 arch/arm/mach-k3/am62px/Kconfig   |  32 ++
 .../arm/mach-k3/include/mach/am62p_hardware.h |  83 ++
 arch/arm/mach-k3/include/mach/am62p_spl.h |  49 +++
 arch/arm/mach-k3/include/mach/hardware.h  |   4 +
 arch/arm/mach-k3/include/mach/spl.h   |   4 +
 7 files changed, 458 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-k3/am62p5_init.c
 create mode 100644 arch/arm/mach-k3/am62px/Kconfig
 create mode 100644 arch/arm/mach-k3/include/mach/am62p_hardware.h
 create mode 100644 arch/arm/mach-k3/include/mach/am62p_spl.h

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 0574e81075e6d..02a9c423ecdb8 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -22,6 +22,9 @@ config SOC_K3_AM625
 config SOC_K3_AM62A7
bool "TI's K3 based AM62A7 SoC Family Support"
 
+config SOC_K3_AM62P5
+   bool "TI's K3 based AM62P5 SoC Family Support"
+
 endchoice
 
 if SOC_K3_J721E
@@ -34,7 +37,7 @@ config SYS_SOC
 
 config SYS_K3_NON_SECURE_MSRAM_SIZE
hex
-   default 0x8 if SOC_K3_AM654
+   default 0x8 if SOC_K3_AM654 || SOC_K3_AM62P5
default 0x10 if SOC_K3_J721E || SOC_K3_J721S2
default 0x1c if SOC_K3_AM642
default 0x3c000 if SOC_K3_AM625 || SOC_K3_AM62A7
@@ -78,6 +81,7 @@ config SYS_K3_BOOT_PARAM_TABLE_INDEX
default 0x43c3f290 if SOC_K3_AM625
default 0x43c3f290 if SOC_K3_AM62A7 && CPU_V7R
default 0x7000f290 if SOC_K3_AM62A7 && ARM64
+   default 0x43c4f290 if SOC_K3_AM62P5
help
  Address at which ROM stores the value which determines if SPL
  is booted up by primary boot media or secondary boot media.
@@ -153,6 +157,7 @@ source "arch/arm/mach-k3/am65x/Kconfig"
 source "arch/arm/mach-k3/am64x/Kconfig"
 source "arch/arm/mach-k3/am62x/Kconfig"
 source "arch/arm/mach-k3/am62ax/Kconfig"
+source "arch/arm/mach-k3/am62px/Kconfig"
 source "arch/arm/mach-k3/j721e/Kconfig"
 source "arch/arm/mach-k3/j721s2/Kconfig"
 
diff --git a/arch/arm/mach-k3/am62p5_init.c b/arch/arm/mach-k3/am62p5_init.c
new file mode 100644
index 0..5b6795cc7d246
--- /dev/null
+++ b/arch/arm/mach-k3/am62p5_init.c
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AM62P5: SoC specific initialization
+ *
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include 
+#include 
+#include 
+#include "sysfw-loader.h"
+#include "common.h"
+#include 
+#include 
+#include 
+
+struct fwl_data cbass_main_fwls[] = {
+   { "FSS_DAT_REG3", 7, 8 },
+};
+
+/*
+ * 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
+ * it to the .data section.
+ */
+u32 bootindex __section(".data");
+static struct rom_extended_boot_data bootdata __section(".data");
+
+static void store_boot_info_from_rom(void)
+{
+   bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
+   memcpy(, (uintptr_t *)ROM_EXTENDED_BOOT_DATA_INFO,
+  sizeof(struct rom_extended_boot_data));
+}
+
+static void ctrl_mmr_unlock(void)
+{
+   /* Unlock all WKUP_CTRL_MMR0 module registers */
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 0);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 1);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 2);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 3);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 4);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 5);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 6);
+   mmr_unlock(WKUP_CTRL_MMR0_BASE, 7);
+
+   /* Unlock all CTRL_MMR0 module registers */
+   mmr_unlock(CTRL_MMR0_BASE, 0);
+   mmr_unlock(CTRL_MMR0_BASE, 1);
+   mmr_unlock(CTRL_MMR0_BASE, 2);
+   mmr_unlock(CTRL_MMR0_BASE, 4);
+   mmr_unlock(CTRL_MMR0_BASE, 5);
+   mmr_unlock(CTRL_MMR0_BASE, 6);
+
+   /* Unlock all MCU_CTRL_MMR0 module registers */
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 0);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 1);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 2);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 3);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 4);
+   mmr_unlock(MCU_CTRL_MMR0_BASE, 6);
+
+   /* Unlock PADCFG_CTRL_MMR padconf registers */
+   mmr_unlock(PADCFG_MMR0_BASE, 1);
+   mmr_unlock(PADCFG_MMR1_BASE, 1);
+}
+
+void board_init_f(ulong dummy)
+{
+   struct udevice *dev;
+   int ret;
+
+   if (IS_ENABLED(CONFIG_CPU_V7R))
+   setup_k3_mpu_regions();
+
+   /*
+* Cannot delay this further as there is a chance that
+* K3_BOOT_PARAM_TA

[PATCH v2 07/13] board: ti: introduce basic board files for the am62px family

2024-01-31 Thread Bryan Brattlof
Introduce the basic files needed to support the am62px family of SoCs

Co-developed-by: Hari Hagalla 
Signed-off-by: Hari Hagalla 
Signed-off-by: Bryan Brattlof 
---
 board/ti/am62px/Kconfig  |  26 +
 board/ti/am62px/MAINTAINERS  |   9 +
 board/ti/am62px/Makefile |   7 +
 board/ti/am62px/am62px.env   |  16 +
 board/ti/am62px/board-cfg.yaml   |  37 ++
 board/ti/am62px/evm.c|  29 +
 board/ti/am62px/pm-cfg.yaml  |  12 +
 board/ti/am62px/rm-cfg.yaml  | 987 +++
 board/ti/am62px/sec-cfg.yaml | 378 
 board/ti/am62px/tifs-rm-cfg.yaml | 879 +++
 10 files changed, 2380 insertions(+)
 create mode 100644 board/ti/am62px/Kconfig
 create mode 100644 board/ti/am62px/MAINTAINERS
 create mode 100644 board/ti/am62px/Makefile
 create mode 100644 board/ti/am62px/am62px.env
 create mode 100644 board/ti/am62px/board-cfg.yaml
 create mode 100644 board/ti/am62px/evm.c
 create mode 100644 board/ti/am62px/pm-cfg.yaml
 create mode 100644 board/ti/am62px/rm-cfg.yaml
 create mode 100644 board/ti/am62px/sec-cfg.yaml
 create mode 100644 board/ti/am62px/tifs-rm-cfg.yaml

diff --git a/board/ti/am62px/Kconfig b/board/ti/am62px/Kconfig
new file mode 100644
index 0..9d95ffd9b2908
--- /dev/null
+++ b/board/ti/am62px/Kconfig
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+
+if TARGET_AM62P5_R5_EVM || TARGET_AM62P5_A53_EVM
+
+config SYS_BOARD
+   default "am62px"
+
+config SYS_VENDOR
+   default "ti"
+
+config SYS_CONFIG_NAME
+   default "am62px_evm"
+
+source "board/ti/common/Kconfig"
+
+endif
+
+if TARGET_AM62P5_R5_EVM
+
+config SPL_LDSCRIPT
+   default "arch/arm/mach-omap2/u-boot-spl.lds"
+
+endif
diff --git a/board/ti/am62px/MAINTAINERS b/board/ti/am62px/MAINTAINERS
new file mode 100644
index 0..57c86ddbc4aef
--- /dev/null
+++ b/board/ti/am62px/MAINTAINERS
@@ -0,0 +1,9 @@
+AM62Px BOARD
+M: Vignesh Raghavendra 
+M: Bryan Brattlof 
+M: Tom Rini 
+S: Maintained
+F: board/ti/am62px/
+F: include/configs/am62p5_evm.h
+F: configs/am62px_evm_r5_defconfig
+F: configs/am62px_evm_a53_defconfig
diff --git a/board/ti/am62px/Makefile b/board/ti/am62px/Makefile
new file mode 100644
index 0..921afdff27a24
--- /dev/null
+++ b/board/ti/am62px/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += evm.o
diff --git a/board/ti/am62px/am62px.env b/board/ti/am62px/am62px.env
new file mode 100644
index 0..e982c8104c192
--- /dev/null
+++ b/board/ti/am62px/am62px.env
@@ -0,0 +1,16 @@
+#include 
+#include 
+#include 
+
+name_kern=Image
+console=ttyS2,115200n8
+args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x0280
+   ${mtdparts}
+run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
+
+boot_targets=mmc1 pxe dhcp
+boot=mmc
+mmcdev=1
+bootpart=1:2
+bootdir=/boot
+rd_spec=-
diff --git a/board/ti/am62px/board-cfg.yaml b/board/ti/am62px/board-cfg.yaml
new file mode 100644
index 0..d539011aff9f3
--- /dev/null
+++ b/board/ti/am62px/board-cfg.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62Px SoCs
+#
+
+---
+
+board-cfg:
+rev:
+boardcfg_abi_maj: 0x0
+boardcfg_abi_min: 0x1
+control:
+subhdr:
+magic: 0xC1D3
+size: 7
+main_isolation_enable: 0x5A
+main_isolation_hostid: 0x2
+secproxy:
+subhdr:
+magic: 0x1207
+size: 7
+scaling_factor: 0x1
+scaling_profile: 0x1
+disable_main_nav_secure_proxy: 0
+msmc:
+subhdr:
+magic: 0xA5C3
+size: 5
+msmc_cache_size: 0x10
+debug_cfg:
+subhdr:
+magic: 0x020C
+size: 8
+trace_dst_enables: 0x00
+trace_src_enables: 0x00
diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
new file mode 100644
index 0..97a95ce8cc2d5
--- /dev/null
+++ b/board/ti/am62px/evm.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Board specific initialization for AM62Px platforms
+ *
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int board_init(void)
+{
+   return 0;
+}
+
+int dram_init(void)
+{
+   return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+   return fdtdec_setup_memory_banksize();
+}
diff --git a/board/ti/am62px/pm-cfg.yaml b/board/ti/am62px/pm-cfg.yaml
new file mode 100644
index 0..3ff27ce702c26
--- /dev/null
+++ b/board/ti/am62px/pm-cfg.yaml
@@ -0,0 +1,12 @@
+#

[PATCH v2 05/13] arm: mach-k3: invert logic for split DM firmware config

2024-01-31 Thread Bryan Brattlof
Currently, for the K3 generation of SoCs, there are more SoCs that
utilize the split firmware approach than the combined DMSC firmware.
Invert the logic to avoid adding more and more SoCs to this list.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 03898424c9546..0574e81075e6d 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -130,7 +130,7 @@ config K3_ATF_LOAD_ADDR
 
 config K3_DM_FW
bool "Separate DM firmware image"
-   depends on CPU_V7R && (SOC_K3_J721E || SOC_K3_J721S2 || SOC_K3_AM625 || 
SOC_K3_AM62A7) && !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
+   depends on CPU_V7R && ARCH_K3 && !SOC_K3_AM642 && !SOC_K3_AM654 && 
!CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
default y
help
  Enabling this will indicate that the system has separate DM
-- 
2.43.0



[PATCH v2 11/13] Makefile: remove hardcoded device tree source directory

2024-01-31 Thread Bryan Brattlof
Some boards that choose to utilize the OF_UPSTREAM directory for their
device tree files will need to specify that directory instead of the
traditional arch/$(ARCH)/dts/* path.

Include the correct path to the board's dtbs depending on if OF_UPSTREAM
is selected or not.

Signed-off-by: Bryan Brattlof 
---
 Makefile | 18 ++
 scripts/Makefile.spl | 17 +
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 996a43c8624ae..f81d09c892b80 100644
--- a/Makefile
+++ b/Makefile
@@ -1184,6 +1184,16 @@ dt_binding_check: scripts_dtc
 quiet_cmd_copy = COPY$@
   cmd_copy = cp $< $@
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/upstream/src/arm64
+else
+dt_dir := dts/upstream/src/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
+
 ifeq ($(CONFIG_MULTI_DTB_FIT),y)
 
 ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y)
@@ -1209,7 +1219,7 @@ endif
 
 MKIMAGEFLAGS_fit-dtb.blob = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
-a 0 -e 0 -E \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) 
-d /dev/null
+   $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d 
/dev/null
 
 MKIMAGEFLAGS_fit-dtb.blob += -B 0x8
 
@@ -1407,9 +1417,9 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware 
-C none -O u-boot \
-a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-p $(CONFIG_FIT_EXTERNAL_OFFSET) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
-   $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst 
",,$(CONFIG_OF_OVERLAY_LIST)))
+   $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(DEVICE_TREE))) \
+   $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
+   $(patsubst %,-b $(dt_dir)/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST)))
 else
 MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 407fc52376a50..d074ba2350065 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -559,9 +559,15 @@ FORCE:
 $(obj)/dts/dt-$(SPL_NAME).dtb: dts/dt.dtb
$(Q)$(MAKE) $(build)=$(obj)/dts spl_dtbs
 
-PHONY += dts_dir
-dts_dir:
-   $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/upstream/src/arm64
+else
+dt_dir := dts/upstream/src/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
 
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable so we can use it in if_changed and friends.
@@ -569,8 +575,11 @@ dts_dir:
 
 SPL_OF_LIST_TARGETS = $(patsubst %,dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST)))
 SHRUNK_ARCH_DTB = $(addprefix $(obj)/,$(SPL_OF_LIST_TARGETS))
+$(dir $(SHRUNK_ARCH_DTB)):
+   $(shell [ -d $@ ] || mkdir -p $@)
+
 .SECONDEXPANSION:
-$(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, arch/$(ARCH)/dts/%, $$@) dts_dir
+$(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, $(dt_dir)/%, $$@) $(dir 
$(SHRUNK_ARCH_DTB))
$(call if_changed,fdtgrep)
 
 targets += $(SPL_OF_LIST_TARGETS)
-- 
2.43.0



[PATCH v2 08/13] firmware: ti_sci_static_data: add static DMA channel data

2024-01-31 Thread Bryan Brattlof
From: Hari Nagalla 

Include the static DMA channel data for ti_sci

Signed-off-by: Hari Nagalla 
Signed-off-by: Bryan Brattlof 
---
 drivers/firmware/ti_sci_static_data.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/ti_sci_static_data.h 
b/drivers/firmware/ti_sci_static_data.h
index 567ce8911a7da..135ec01bda460 100644
--- a/drivers/firmware/ti_sci_static_data.h
+++ b/drivers/firmware/ti_sci_static_data.h
@@ -84,7 +84,8 @@ static struct ti_sci_resource_static_data rm_static_data[] = {
 };
 #endif /* CONFIG_SOC_K3_J721S2 */
 
-#if IS_ENABLED(CONFIG_SOC_K3_AM625) || IS_ENABLED(CONFIG_SOC_K3_AM62A7)
+#if IS_ENABLED(CONFIG_SOC_K3_AM625) || IS_ENABLED(CONFIG_SOC_K3_AM62A7) || \
+   IS_ENABLED(CONFIG_SOC_K3_AM62P5)
 static struct ti_sci_resource_static_data rm_static_data[] = {
/* BC channels */
{
@@ -95,7 +96,7 @@ static struct ti_sci_resource_static_data rm_static_data[] = {
},
{ },
 };
-#endif /* CONFIG_SOC_K3_AM625 || CONFIG_SOC_K3_AM62A7 */
+#endif /* CONFIG_SOC_K3_AM625 || CONFIG_SOC_K3_AM62A7 || CONFIG_SOC_K3_AM62P5 
*/
 
 #else
 static struct ti_sci_resource_static_data rm_static_data[] = {
-- 
2.43.0



[PATCH v2 09/13] dma: ti: k3-udma: Add DMA PSIL mappings for AM62P and J722S

2024-01-31 Thread Bryan Brattlof
From: Vignesh Raghavendra 

Add PSIL data for the AM62P and the J722S SoC family. The PSIL mapping
for the J722S is the same except for the extra instances of the CSI-RX.
So let's reuse the same file for both the AM62P and J722S.

Signed-off-by: Vignesh Raghavendra 
Signed-off-by: Ravi Gunasekaran 
Signed-off-by: Vaishnav Achath 
Signed-off-by: Jayesh Choudhary 
[b...@ti.com: rebased to U-Boot v2024.01]
Signed-off-by: Bryan Brattlof 
---
 drivers/dma/ti/Makefile|   2 +
 drivers/dma/ti/k3-psil-am62p.c | 325 +
 drivers/dma/ti/k3-psil-priv.h  |   1 +
 drivers/dma/ti/k3-psil.c   |   4 +
 4 files changed, 332 insertions(+)
 create mode 100644 drivers/dma/ti/k3-psil-am62p.c

diff --git a/drivers/dma/ti/Makefile b/drivers/dma/ti/Makefile
index f4e0271efbf32..17223b20432da 100644
--- a/drivers/dma/ti/Makefile
+++ b/drivers/dma/ti/Makefile
@@ -9,3 +9,5 @@ k3-psil-data-$(CONFIG_SOC_K3_J721S2) += k3-psil-j721s2.o
 k3-psil-data-$(CONFIG_SOC_K3_AM642) += k3-psil-am64.o
 k3-psil-data-$(CONFIG_SOC_K3_AM625) += k3-psil-am62.o
 k3-psil-data-$(CONFIG_SOC_K3_AM62A7) += k3-psil-am62a.o
+k3-psil-data-$(CONFIG_SOC_K3_AM62P5) += k3-psil-am62p.o
+k3-psil-data-$(CONFIG_SOC_K3_J722S) += k3-psil-am62p.o
diff --git a/drivers/dma/ti/k3-psil-am62p.c b/drivers/dma/ti/k3-psil-am62p.c
new file mode 100644
index 0..8739bf41b5b7c
--- /dev/null
+++ b/drivers/dma/ti/k3-psil-am62p.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com
+ */
+
+#include 
+
+#include "k3-psil-priv.h"
+
+#define PSIL_PDMA_XY_TR(x) \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .mapped_channel_id = -1,\
+   .default_flow_id = -1,  \
+   },  \
+   }
+
+#define PSIL_PDMA_XY_PKT(x)\
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .mapped_channel_id = -1,\
+   .default_flow_id = -1,  \
+   .pkt_mode = 1,  \
+   },  \
+   }
+
+#define PSIL_ETHERNET(x, ch, flow_base, flow_cnt)  \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_NATIVE,  \
+   .pkt_mode = 1,  \
+   .needs_epib = 1,\
+   .psd_size = 16, \
+   .mapped_channel_id = ch,\
+   .flow_start = flow_base,\
+   .flow_num = flow_cnt,   \
+   .default_flow_id = flow_base,   \
+   },  \
+   }
+
+#define PSIL_SAUL(x, ch, flow_base, flow_cnt, default_flow, tx)\
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_NATIVE,  \
+   .pkt_mode = 1,  \
+   .needs_epib = 1,\
+   .psd_size = 64, \
+   .mapped_channel_id = ch,\
+   .flow_start = flow_base,\
+   .flow_num = flow_cnt,   \
+   .default_flow_id = default_flow,\
+   .notdpkt = tx,  \
+   },  \
+   }
+
+#define PSIL_PDMA_MCASP(x) \
+   {   \
+   .thread_id = x, \
+   .ep_config = {  \
+   .ep_type = PSIL_EP_PDMA_XY, \
+   .pdma_acc32 = 1,\
+   .pdma

[PATCH v2 13/13] doc: board: ti: introduce am62px documentation

2024-01-31 Thread Bryan Brattlof
Introduce basic documentation for the am62p family of SoCs.

Signed-off-by: Bryan Brattlof 
---
 doc/board/ti/am62px_sk.rst | 289 +
 doc/board/ti/k3.rst|   1 +
 2 files changed, 290 insertions(+)
 create mode 100644 doc/board/ti/am62px_sk.rst

diff --git a/doc/board/ti/am62px_sk.rst b/doc/board/ti/am62px_sk.rst
new file mode 100644
index 0..1f2982c36f9e4
--- /dev/null
+++ b/doc/board/ti/am62px_sk.rst
@@ -0,0 +1,289 @@
+.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+.. sectionauthor:: Bryan Brattlof 
+
+AM62Px Platforms
+
+
+The AM62Px is an extension of the existing Sitara AM62x low-cost family
+of application processors built for Automotive and Linux Application
+development. Scalable Arm Cortex-A53 performance and embedded features,
+such as: multi high-definition display support, 3D-graphics
+acceleration, 4K video acceleration, and extensive peripherals make the
+AM62Px well-suited for a broad range of automation and industrial
+application, including automotive digital instrumentation, automotive
+displays, industrial HMI, and more.
+
+Some highlights of AM62P SoC are:
+
+* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
+  Dual/Single core variants are provided in the same package to allow HW
+  compatible designs.
+
+* One Device manager Cortex-R5F for system power and resource
+  management, and one Cortex-R5F for Functional Safety or
+  general-purpose usage.
+
+* One 3D GPU up to 50 GLFOPS
+
+* H.264/H.265 Video Encode/Decode.
+
+* Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
+  2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution
+
+* Integrated Giga-bit Ethernet switch supporting up to a total of two
+  external ports (TSN capable).
+
+* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
+  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
+  1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.
+
+* Dedicated Centralized Hardware Security Module with support for secure
+  boot, debug security and crypto acceleration and trusted execution
+  environment.
+
+* One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.
+
+* Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
+  enabling battery powered system design.
+
+For those interested, more details about this SoC can be found in the
+Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83
+
+Boot Flow:
+--
+
+The bootflow is exactly the same as all SoCs in the am62xxx extended SoC
+family. Below is the pictorial representation:
+
+.. image:: img/boot_diagram_k3_current.svg
+  :alt: Boot flow diagram
+
+- Here TIFS acts as master and provides all the critical services. R5/A53
+  requests TIFS to get these services done as shown in the above diagram.
+
+Sources:
+
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_boot_sources
+:end-before: .. k3_rst_include_end_boot_sources
+
+Build procedure:
+
+
+0. Setup the environment variables:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_desc
+:end-before: .. k3_rst_include_end_common_env_vars_desc
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_board_env_vars_desc
+:end-before: .. k3_rst_include_end_board_env_vars_desc
+
+Set the variables corresponding to this platform:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_common_env_vars_defn
+:end-before: .. k3_rst_include_end_common_env_vars_defn
+
+.. code-block:: bash
+
+ $ export UBOOT_CFG_CORTEXR=am62px_evm_r5_defconfig
+ $ export UBOOT_CFG_CORTEXA=am62px_evm_a53_defconfig
+ $ export TFA_BOARD=lite
+ $ # we dont use any extra TFA parameters
+ $ unset TFA_EXTRA_ARGS
+ $ export OPTEE_PLATFORM=k3-am62x
+ $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y"
+
+.. am62px_evm_rst_include_start_build_steps
+
+1. Trusted Firmware-A:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_tfa
+:end-before: .. k3_rst_include_end_build_steps_tfa
+
+
+2. OP-TEE:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_optee
+:end-before: .. k3_rst_include_end_build_steps_optee
+
+3. U-Boot:
+
+* 3.1 R5:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_spl_r5
+:end-before: .. k3_rst_include_end_build_steps_spl_r5
+
+* 3.2 A53:
+
+.. include::  ../ti/k3.rst
+:start-after: .. k3_rst_include_start_build_steps_uboot
+:end-before: .. k3_rst_include_end_build_steps_uboot
+.. am62px_evm_rst_include_end_build_steps
+
+Target Images
+--
+
+In order to boot we need tiboot3.bin, tispl.bin and u-boot.img.  Each SoC
+variant (HS-FS, HS-SE) requires a different source for these files.
+
+ - HS-FS
+
+* tiboot3-am62px-hs-fs-evm.bin from step 3.1
+* tispl.bin, u-boot.img

[PATCH v2 02/13] power: domain: ti: use IS_ENABLED macro

2024-01-31 Thread Bryan Brattlof
Cleanup this list and standardize on using the IS_ENABLED macro for the
power domain data list.

Signed-off-by: Bryan Brattlof 
---
 drivers/power/domain/ti-power-domain.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/domain/ti-power-domain.c 
b/drivers/power/domain/ti-power-domain.c
index b34c982f4f5fa..dc5d74539edcf 100644
--- a/drivers/power/domain/ti-power-domain.c
+++ b/drivers/power/domain/ti-power-domain.c
@@ -81,19 +81,20 @@ static const struct soc_attr ti_k3_soc_pd_data[] = {
.family = "J7200",
.data = _pd_platdata,
},
-#elif CONFIG_SOC_K3_J721S2
+#endif
+#if IS_ENABLED(CONFIG_SOC_K3_J721S2)
{
.family = "J721S2",
.data = _pd_platdata,
},
 #endif
-#ifdef CONFIG_SOC_K3_AM625
+#if IS_ENABLED(CONFIG_SOC_K3_AM625)
{
.family = "AM62X",
.data = _pd_platdata,
},
 #endif
-#ifdef CONFIG_SOC_K3_AM62A7
+#if IS_ENABLED(CONFIG_SOC_K3_AM62A7)
{
.family = "AM62AX",
.data = _pd_platdata,
-- 
2.43.0



[PATCH v2 00/13] Introduce basic support for TI's AM62Px SoC family

2024-01-31 Thread Bryan Brattlof
Hello Again Everyone!

**Note:**  This series depends on the OF_UPSTREAM work from Sumit [0].
Patch #11 was added to fix some Makefile.spl targets to allow SPL builds
to complete with the OF_UPSTREAM series.

The AM62Px is an extension of the existing Sitara AM62x low-cost family
of application processors built for Automotive and Linux Application
development. Scalable Arm Cortex-A53 performance and embedded features,
such as: multi high-definition display support, 3D-graphics
acceleration, 4K video acceleration, and extensive peripherals make the
AM62Px well-suited for a broad range of automation and industrial
application, including automotive digital instrumentation, automotive
displays, industrial HMI, and more.

Some highlights of AM62P SoC are:

* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
  Dual/Single core variants are provided in the same package to allow HW
  compatible designs.

* One Device manager Cortex-R5F for system power and resource
  management, and one Cortex-R5F for Functional Safety or
  general-purpose usage.

* One 3D GPU up to 50 GLFOPS

* H.264/H.265 Video Encode/Decode.

* Display support: 3x display support over OLDI/LVDS (1x OLDI-DL, 1x or
  2x OLDI-SL), DSI, or DPI. Up to 3840x1080 @ 60fps resolution

* Integrated Giga-bit Ethernet switch supporting up to a total of two
  external ports (TSN capable).

* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3xMMC and SD, GPMC for
  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
  1xCSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.

* Dedicated Centralized Hardware Security Module with support for secure
  boot, debug security and crypto acceleration and trusted execution
  environment.

* One 32-bit DDR Subsystem that supports LPDDR4, DDR4 memory types.

* Multiple low power modes support, ex: Deep sleep, Standby, MCU-only,
  enabling battery powered system design.

For those interested, more details about this SoC can be found in the
Technical Reference Manual here: https://www.ti.com/lit/pdf/spruj83

Proof-of-Life: 
https://paste.sr.ht/~bryanb/af2ac108a9362549aa326f182e87918d52bf2d71

Currently, while more peripherals are being added in Linux[0], this
series will only support UART boot.

Thanks for reviewing!
~Bryan

Changes from v1: [1]
 - squashed all clk and lpsc tree updates into a single commit
 - corrected SOC_K3_AM642 typo with DM firmware Kconfig option
 - updated RM configs and dma nodes to enable IP that need DMA
 - added the dtb targets to the dts/Makefile
 - rebased the series on top of v2024.01-rc1
 - switched to bootstd rather than use distro boot scripts.
 - enabled OF_UPSTREAM instead of using the arch/arm/dts directory

[0] 
https://lore.kernel.org/u-boot/20240110103547.719757-1-sumit.g...@linaro.org/
[1] https://lore.kernel.org/all/20231012230616.2101992-13...@ti.com/

Bryan Brattlof (11):
  soc: add info to identify the am62p SoC family
  power: domain: ti: use IS_ENABLED macro
  arm: mach-k3: am62px: introduce clock and device files for wkup spl
  ram: k3-ddrss: enable the am62ax's DDR controller for am62px
  arm: mach-k3: invert logic for split DM firmware config
  arch: mach-k3: introduce basic files to support the am62px SoC family
  board: ti: introduce basic board files for the am62px family
  arm: dts: introduce am62p5 uboot dts files
  Makefile: remove hardcoded device tree source directory
  configs: introduce configs needed for the am62px
  doc: board: ti: introduce am62px documentation

Hari Nagalla (1):
  firmware: ti_sci_static_data: add static DMA channel data

Vignesh Raghavendra (1):
  dma: ti: k3-udma: Add DMA PSIL mappings for AM62P and J722S

 Makefile  |   18 +-
 arch/arm/dts/Makefile |2 +
 arch/arm/dts/k3-am62p-ddr-lp4-50-1600.dtsi| 2800 +
 arch/arm/dts/k3-am62p-sk-binman.dtsi  |  173 +
 arch/arm/dts/k3-am62p5-r5-sk.dts  |  101 +
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi |   49 +
 arch/arm/mach-k3/Kconfig  |9 +-
 arch/arm/mach-k3/Makefile |1 +
 arch/arm/mach-k3/am62p5_init.c|  280 ++
 arch/arm/mach-k3/am62px/Kconfig   |   32 +
 .../arm/mach-k3/include/mach/am62p_hardware.h |   83 +
 arch/arm/mach-k3/include/mach/am62p_spl.h |   49 +
 arch/arm/mach-k3/include/mach/hardware.h  |6 +
 arch/arm/mach-k3/include/mach/spl.h   |4 +
 arch/arm/mach-k3/r5/Makefile  |1 +
 arch/arm/mach-k3/r5/am62px/Makefile   |6 +
 arch/arm/mach-k3/r5/am62px/clk-data.c |  325 ++
 arch/arm/mach-k3/r5/am62px/dev-data.c |   71 +
 board/ti/am62px/Kconfig   |   26 +
 board/ti/am62px/MAINTAINERS   |9 +
 board/ti/am62px/Makefile  |7 +
 board/ti/am62px/am62px.env|   16 +
 board/ti/am62px/board-cfg.yaml|   37 +
 board/ti/am62px/evm.c

[PATCH v2 01/13] soc: add info to identify the am62p SoC family

2024-01-31 Thread Bryan Brattlof
Include the part number for TI's am62px family of SoCs so we can
properly identify it during boot

Signed-off-by: Bryan Brattlof 
---
 arch/arm/mach-k3/include/mach/hardware.h | 2 ++
 drivers/soc/soc_ti_k3.c  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/mach-k3/include/mach/hardware.h 
b/arch/arm/mach-k3/include/mach/hardware.h
index a1a9dfbde66c8..040288150b12f 100644
--- a/arch/arm/mach-k3/include/mach/hardware.h
+++ b/arch/arm/mach-k3/include/mach/hardware.h
@@ -46,6 +46,7 @@
 #define JTAG_ID_PARTNO_J721S2  0xbb75
 #define JTAG_ID_PARTNO_AM62X   0xbb7e
 #define JTAG_ID_PARTNO_AM62AX   0xbb8d
+#define JTAG_ID_PARTNO_AM62PX  0xbb9d
 
 #define K3_SOC_ID(id, ID) \
 static inline bool soc_is_##id(void) \
@@ -61,6 +62,7 @@ K3_SOC_ID(am64x, AM64X)
 K3_SOC_ID(j721s2, J721S2)
 K3_SOC_ID(am62x, AM62X)
 K3_SOC_ID(am62ax, AM62AX)
+K3_SOC_ID(am62px, AM62PX)
 
 #define K3_SEC_MGR_SYS_STATUS  0x44234100
 #define SYS_STATUS_DEV_TYPE_SHIFT  0
diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
index 355a5368dd45a..d7d0152b115fa 100644
--- a/drivers/soc/soc_ti_k3.c
+++ b/drivers/soc/soc_ti_k3.c
@@ -45,6 +45,9 @@ static const char *get_family_string(u32 idreg)
case JTAG_ID_PARTNO_AM62AX:
family = "AM62AX";
break;
+   case JTAG_ID_PARTNO_AM62PX:
+   family = "AM62PX";
+   break;
default:
family = "Unknown Silicon";
};
-- 
2.43.0



[PATCH v2 12/13] configs: introduce configs needed for the am62px

2024-01-31 Thread Bryan Brattlof
Introduce the initial configs needed to support the am62px SoC family

Signed-off-by: Bryan Brattlof 
---
 configs/am62px_evm_a53_defconfig | 178 +++
 configs/am62px_evm_r5_defconfig  | 137 
 include/configs/am62px_evm.h |  14 +++
 3 files changed, 329 insertions(+)
 create mode 100644 configs/am62px_evm_a53_defconfig
 create mode 100644 configs/am62px_evm_r5_defconfig
 create mode 100644 include/configs/am62px_evm.h

diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
new file mode 100644
index 0..bd8002108b10c
--- /dev/null
+++ b/configs/am62px_evm_a53_defconfig
@@ -0,0 +1,178 @@
+CONFIG_ARM=y
+CONFIG_ARCH_K3=y
+CONFIG_TI_SECURE_DEVICE=y
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_SOC_K3_AM62P5=y
+CONFIG_K3_ATF_LOAD_ADDR=0x9e78
+CONFIG_TARGET_AM62P5_A53_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=0x4
+CONFIG_DM_GPIO=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am62p5-sk"
+CONFIG_SPL_TEXT_BASE=0x8008
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_STACK_R_ADDR=0x8200
+CONFIG_SPL_FS_FAT=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+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_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_SPL_MAX_SIZE=0x58000
+CONFIG_SPL_PAD_TO=0x0
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x80a0
+CONFIG_SPL_BSS_MAX_SIZE=0x8
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
+CONFIG_SPL_DMA=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
+CONFIG_SPL_I2C=y
+CONFIG_SPL_DM_MAILBOX=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_POWER_DOMAIN=y
+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_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x28
+CONFIG_SPL_THERMAL=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_SYS_MAXARGS=64
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_REMOTEPROC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_DEVICE_REMOVE=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK=y
+CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_MTD=y
+CONFIG_DFU_RAM=y
+CONFIG_DFU_SF=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x4
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x80
+CONFIG_DMA_CHANNELS=y
+CONFIG_TI_K3_NAVSS_UDMA=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0xC000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F00
+CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y
+CONFIG_DA8XX_GPIO=y
+CONFIG_DM_PCA953X=y
+CONFIG_SPL_DM_PCA953X=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_OMAP24XX=y
+CONFIG_DM_MAILBOX=y
+CONFIG_K3_SEC_PROXY=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SPL_I2C_EEPROM=y
+CONFIG_FS_LOADER=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_SPL_MMC_IO_VOLTAGE=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ADMA=y
+CONFIG_SPL_MMC_SDHCI_ADMA=y
+CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SOFT_RESET=y
+CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_S28HX_T=y
+CONFIG_PHY_TI_DP83867=y
+CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_TI_SCI_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPL_DM_REGULATOR_GPIO=y
+CONFIG_K3_SYSTEM_CONTROLLER=y
+CONFIG_REMOTEPROC_TI_K3_ARM64=y
+CONFIG_REMOTEPROC_TI_K3_DSP=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
+CONFIG_RESET_TI_SCI=y
+CONFIG_DM_SERIAL=y
+CONFIG_SOC_DEVICE=y
+CONFIG_SOC_DEVICE_TI_K3=y
+CONFIG_SOC_TI=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_CADENCE_QSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
+CONFIG_SYSRESET_TI_SCI=y
+CONFIG_DM_THERMAL=y
+CONFIG

[PATCH] arm: dts: k3-am62p5: enable the wkup i2c bus

2024-01-31 Thread Bryan Brattlof
The PMIC for the am62p5-sk is connected to the i2c bus on the wakeup
island. While we do not have a driver yet, enable it anyway so we can
begin development of the driver and characterization of the board.

Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am62p5-sk.dts | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/dts/k3-am62p5-sk.dts b/arch/arm/dts/k3-am62p5-sk.dts
index 9e4479aa78886..77298d31a986f 100644
--- a/arch/arm/dts/k3-am62p5-sk.dts
+++ b/arch/arm/dts/k3-am62p5-sk.dts
@@ -790,6 +790,13 @@
 _pmx0 {
bootph-all;
 
+   wkup_i2c0_pins_default: wkup-i2c0-default-pins {
+   pinctrl-single,pins = <
+   AM62PX_MCU_IOPAD(0x04c, PIN_INPUT, 0)   /* (A13) 
WKUP_I2C0_SCL */
+   AM62PX_MCU_IOPAD(0x050, PIN_INPUT, 0)   /* (C11) 
WKUP_I2C0_SDA */
+   >;
+   };
+
wkup_uart0_pins_default: wkup-uart0-default-pins {
pinctrl-single,pins = <
AM62PX_MCU_IOPAD(0x02c, PIN_INPUT, 0)   /* (C7) 
WKUP_UART0_CTSn */
@@ -801,6 +808,13 @@
};
 };
 
+_i2c0 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_i2c0_pins_default>;
+   clock-frequency = <40>;
+};
+
 _uart0 {
/* WKUP UART0 is used by DM firmware */
pinctrl-names = "default";

base-commit: b0d717b732ee28e446baf94522b3491e590f7fbb
-- 
2.43.0



[PATCH v2 04/13] ram: k3-ddrss: enable the am62ax's DDR controller for am62px

2024-01-31 Thread Bryan Brattlof
The am62px family of SoCs uses the same DDR controller as found on the
am62ax family. Enable this option when building for the am62px family

Signed-off-by: Bryan Brattlof 
---
 drivers/ram/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ram/Kconfig b/drivers/ram/Kconfig
index 5b07e92030142..56391058567bb 100644
--- a/drivers/ram/Kconfig
+++ b/drivers/ram/Kconfig
@@ -65,7 +65,7 @@ choice
default K3_J721E_DDRSS if SOC_K3_J721E || SOC_K3_J721S2
default K3_AM64_DDRSS if SOC_K3_AM642
default K3_AM64_DDRSS if SOC_K3_AM625
-   default K3_AM62A_DDRSS if SOC_K3_AM62A7
+   default K3_AM62A_DDRSS if SOC_K3_AM62A7 || SOC_K3_AM62P5
 
 config K3_J721E_DDRSS
bool "Enable J721E DDRSS support"
-- 
2.43.0



Re: [PATCH 0/2] arm: dts: Add Itap Delay Value For High Speed DDR

2024-01-10 Thread Bryan Brattlof
On January 10, 2024 thus sayeth Bhavya Kapoor:
> 
> On 08/01/24 7:35 pm, Bryan Brattlof wrote:
> > Hi Bhavya!
> > 
> > On January  8, 2024 thus sayeth Bhavya Kapoor:
> > > This Series adds Itap Delay Value for DDR52 speed mode for eMMC in
> > > J7200 SoC and for DDR50 speed mode for MMCSD in J721s2 SoC.
> > > 
> > > Bhavya Kapoor (2):
> > >arm: dts: k3-j7200-main: Add Itap Delay Value For DDR52 speed mode
> > >arm: dts: k3-j721s2-main: Add Itap Delay Value For DDR50 speed mode
> > > 
> > >   arch/arm/dts/k3-j7200-main.dtsi  | 1 +
> > >   arch/arm/dts/k3-j721s2-main.dtsi | 1 +
> > Because of the periodic syncs with the kernel, modifying these dt files
> > in U-Boot will cause confusion. (Which node is correct why did we have
> > to do this in U-Boot and not in the Kernel... bla bla bla) If they
> > absolutely need to go in now please override these nodes in the
> > *-u-boot.dtsi files with a comment so we can keep track of these changes
> > during the next sync with Linux.
> > 
> > ~Bryan
> 
> Hi Bryan, Fyi, This patch went in kernel as well.
> 
> Can be tracked below-
> 
> https://lore.kernel.org/all/170266085077.3490141.14935960940418963459.b4...@ti.com/
> 
> So , kernel and uboot dt files will remain in sync.
> 

Sorry I may be missing something. Why do we need these properties in 
U-Boot now? Why not wait 2 weeks for the v6.8-rc1 tag in Linux and sync 
everything all at once?

~Bryan


Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

2024-01-09 Thread Bryan Brattlof
On January  9, 2024 thus sayeth Sumit Garg:
> On Tue, 9 Jan 2024 at 07:24, Bryan Brattlof  wrote:
> >
> > On January  8, 2024 thus sayeth Sumit Garg:
> > > Hi Bryan,
> > >
> > > On Sat, 6 Jan 2024 at 02:12, Bryan Brattlof  wrote:
> > > >
> > > > Hi Sumit!
> > > >
> > > > On December 28, 2023 thus sayeth Sumit Garg:
> > > > > Allow u-boot to build DTB from a different directory tree such that
> > > > > *-u-boot.dtsi files can be included from a common location. Currently
> > > > > that location is arch/$(ARCH)/dts/, so statically define that common
> > > > > location.
> > > > >
> > > > > This is needed for platform owners to start building DTB files from
> > > > > devicetree-rebasing directory but still being able to include
> > > > > *-u-boot.dtsi files.
> > > > >
> > > > > Reviewed-by: Tom Rini 
> > > > > Reviewed-by: Simon Glass 
> > > > > Reviewed-by: Ilias Apalodimas 
> > > > > Signed-off-by: Sumit Garg 
> > > > > ---
> > > > >
> > > >
> > > > ...
> > > >
> > > > >
> > > > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > > > > index 27b9437027c..09330421856 100644
> > > > > --- a/scripts/Makefile.lib
> > > > > +++ b/scripts/Makefile.lib
> > > >
> > > > ...
> > > >
> > > > >  # Uncomment for debugging
> > > > > @@ -190,6 +192,7 @@ dtsi_include_list += 
> > > > > $(CONFIG_DEVICE_TREE_INCLUDES)
> > > > >  dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc
> > > > > \
> > > > >$(UBOOTINCLUDE)
> > > > >  \
> > > > >-I$(dir $<)
> > > > >  \
> > > > > +  -I$(u_boot_dtsi_loc)   
> > > > >   \
> > > > >-I$(srctree)/arch/$(ARCH)/dts/include  
> > > > >  \
> > > > >-I$(srctree)/include   
> > > > >  \
> > > > >-D__ASSEMBLY__ 
> > > > >  \
> > > > > @@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> > > > > echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
> > > > >   $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o 
> > > > > $(dtc-tmp) $(pre-tmp) ; \
> > > > >   $(DTC) -O dtb -o $@ -b 0 \
> > > > > - -i $(dir $<) $(DTC_FLAGS) \
> > > > > + -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
> > > > >   -d $(depfile).dtc.tmp $(dtc-tmp) || \
> > > > >   (echo "Check $(shell pwd)/$(pre-tmp) for errors" && 
> > > > > false) \
> > > > >   ; \
> > > >
> > > > One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt
> > > > directory is when we have U-Boot board files that use dtsi files in the
> > > > OF_UPSTREAM folder.
> > > >
> > > > For example our reference boards uses the primary bootloader's dtb (eg:
> > > > k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be
> > > > found in the OF_UPSTREAM directory and modifies it to give it the
> > > > perspective of the micro-controller it will be running on during boot.
> > >
> > > Thanks for bringing this up. I have been playing with the idea to
> > > reuse DT includes from upstream.
> > >
> > > >
> > > > What do you think if we have both paths included regardless if
> > > > OF_UPSTREAM is selected or not? IDK if this will break anyone else
> > >
> > > Sure, we should be able to do that if we maintain the correct order of
> > > include paths as per following patch [1]. If this works for you let me
> > > know and I will include it for v4.
> > >
> >
> > This works beautifully.
> >
> > I did have to hack around to get Makefile.spl working but this is headed
> > in the right direction for me :)
> 
> Thanks for testing. I hope I can take that as a tested-by tag for this patch.
> 

Absolutely 

Tested-by: Bryan Brattlof 

~Bryan


Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

2024-01-08 Thread Bryan Brattlof
On January  8, 2024 thus sayeth Sumit Garg:
> Hi Bryan,
> 
> On Sat, 6 Jan 2024 at 02:12, Bryan Brattlof  wrote:
> >
> > Hi Sumit!
> >
> > On December 28, 2023 thus sayeth Sumit Garg:
> > > Allow u-boot to build DTB from a different directory tree such that
> > > *-u-boot.dtsi files can be included from a common location. Currently
> > > that location is arch/$(ARCH)/dts/, so statically define that common
> > > location.
> > >
> > > This is needed for platform owners to start building DTB files from
> > > devicetree-rebasing directory but still being able to include
> > > *-u-boot.dtsi files.
> > >
> > > Reviewed-by: Tom Rini 
> > > Reviewed-by: Simon Glass 
> > > Reviewed-by: Ilias Apalodimas 
> > > Signed-off-by: Sumit Garg 
> > > ---
> > >
> >
> > ...
> >
> > >
> > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > > index 27b9437027c..09330421856 100644
> > > --- a/scripts/Makefile.lib
> > > +++ b/scripts/Makefile.lib
> >
> > ...
> >
> > >  # Uncomment for debugging
> > > @@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
> > >  dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc
> > > \
> > >$(UBOOTINCLUDE) \
> > >-I$(dir $<) \
> > > +  -I$(u_boot_dtsi_loc) \
> > >-I$(srctree)/arch/$(ARCH)/dts/include   \
> > >-I$(srctree)/include\
> > >-D__ASSEMBLY__  \
> > > @@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> > > echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
> > >   $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) 
> > > $(pre-tmp) ; \
> > >   $(DTC) -O dtb -o $@ -b 0 \
> > > - -i $(dir $<) $(DTC_FLAGS) \
> > > + -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
> > >   -d $(depfile).dtc.tmp $(dtc-tmp) || \
> > >   (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
> > >   ; \
> >
> > One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt
> > directory is when we have U-Boot board files that use dtsi files in the
> > OF_UPSTREAM folder.
> >
> > For example our reference boards uses the primary bootloader's dtb (eg:
> > k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be
> > found in the OF_UPSTREAM directory and modifies it to give it the
> > perspective of the micro-controller it will be running on during boot.
> 
> Thanks for bringing this up. I have been playing with the idea to
> reuse DT includes from upstream.
> 
> >
> > What do you think if we have both paths included regardless if
> > OF_UPSTREAM is selected or not? IDK if this will break anyone else
> 
> Sure, we should be able to do that if we maintain the correct order of
> include paths as per following patch [1]. If this works for you let me
> know and I will include it for v4.
> 

This works beautifully.

I did have to hack around to get Makefile.spl working but this is headed 
in the right direction for me :)

Thank you
~Bryan


Re: [PATCH 0/2] arm: dts: Add Itap Delay Value For High Speed DDR

2024-01-08 Thread Bryan Brattlof
Hi Bhavya!

On January  8, 2024 thus sayeth Bhavya Kapoor:
> This Series adds Itap Delay Value for DDR52 speed mode for eMMC in
> J7200 SoC and for DDR50 speed mode for MMCSD in J721s2 SoC.
> 
> Bhavya Kapoor (2):
>   arm: dts: k3-j7200-main: Add Itap Delay Value For DDR52 speed mode
>   arm: dts: k3-j721s2-main: Add Itap Delay Value For DDR50 speed mode
> 
>  arch/arm/dts/k3-j7200-main.dtsi  | 1 +
>  arch/arm/dts/k3-j721s2-main.dtsi | 1 +

Because of the periodic syncs with the kernel, modifying these dt files 
in U-Boot will cause confusion. (Which node is correct why did we have 
to do this in U-Boot and not in the Kernel... bla bla bla) If they 
absolutely need to go in now please override these nodes in the 
*-u-boot.dtsi files with a comment so we can keep track of these changes 
during the next sync with Linux.

~Bryan


Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

2024-01-05 Thread Bryan Brattlof
Hi Sumit!

On December 28, 2023 thus sayeth Sumit Garg:
> Allow u-boot to build DTB from a different directory tree such that
> *-u-boot.dtsi files can be included from a common location. Currently
> that location is arch/$(ARCH)/dts/, so statically define that common
> location.
> 
> This is needed for platform owners to start building DTB files from
> devicetree-rebasing directory but still being able to include
> *-u-boot.dtsi files.
> 
> Reviewed-by: Tom Rini 
> Reviewed-by: Simon Glass 
> Reviewed-by: Ilias Apalodimas 
> Signed-off-by: Sumit Garg 
> ---
> 

...

> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 27b9437027c..09330421856 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib

...

>  # Uncomment for debugging
> @@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
>  dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc\
>$(UBOOTINCLUDE) \
>-I$(dir $<) \
> +  -I$(u_boot_dtsi_loc) \
>-I$(srctree)/arch/$(ARCH)/dts/include   \
>-I$(srctree)/include\
>-D__ASSEMBLY__  \
> @@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
>   $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) 
> $(pre-tmp) ; \
>   $(DTC) -O dtb -o $@ -b 0 \
> - -i $(dir $<) $(DTC_FLAGS) \
> + -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
>   -d $(depfile).dtc.tmp $(dtc-tmp) || \
>   (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
>   ; \

One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt 
directory is when we have U-Boot board files that use dtsi files in the 
OF_UPSTREAM folder.

For example our reference boards uses the primary bootloader's dtb (eg: 
k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be 
found in the OF_UPSTREAM directory and modifies it to give it the 
perspective of the micro-controller it will be running on during boot.

What do you think if we have both paths included regardless if 
OF_UPSTREAM is selected or not? IDK if this will break anyone else

~Bryan


Re: [PATCH v7 06/17] arm: mach-k3: j784s4: Add clk and power support

2024-01-03 Thread Bryan Brattlof
On January  3, 2024 thus sayeth Nishanth Menon:
> On 00:45-20231220, Apurva Nandan wrote:
> > Add clk and device data which can be used by respective drivers
> > to configure clocks and PSC.
> > 
> > Signed-off-by: Hari Nagalla 
> > Signed-off-by: Apurva Nandan 
> > Reviewed-by: Sean Anderson 
> > ---
> 
> Cursory look (have not verified actual data), looks fine..
> 
> Reviewed-by: Nishanth Menon 
> 

These look to be correct, just a little old.

Reviewed-by: Bryan Brattlof 

~Bryan


[PATCH v2 05/26] arm: dts: k3-am654: copy bootph properties to a53 dts

2023-12-29 Thread Bryan Brattlof
In order to unify the R5 board dtb file with the Linux board dtb file,
we will need to copy all bootph-pre-ram properties to the *-u-boot.dtsi
overlay.

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 160 +++
 arch/arm/dts/k3-am654-r5-base-board.dts  |  85 +-
 2 files changed, 162 insertions(+), 83 deletions(-)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index f29cecf870bcd..4b1e8ce2c920c 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -5,6 +5,166 @@
 
 #include "k3-am65x-binman.dtsi"
 
+_supply {
+   bootph-pre-ram;
+};
+
+_main {
+   bootph-pre-ram;
+};
+
+_navss {
+   bootph-pre-ram;
+};
+
+_mcu {
+   bootph-pre-ram;
+};
+
+_navss {
+   bootph-pre-ram;
+};
+
+_ringacc {
+   bootph-pre-ram;
+};
+
+_udmap {
+   bootph-pre-ram;
+};
+
+_gpio0 {
+   bootph-pre-ram;
+};
+
+_proxy_main {
+   bootph-pre-ram;
+};
+
+_wakeup {
+   bootph-pre-ram;
+
+   chipid@4314 {
+   bootph-pre-ram;
+   };
+};
+
+ {
+   bootph-pre-ram;
+};
+
+_pds {
+   bootph-pre-ram;
+};
+
+_clks {
+   bootph-pre-ram;
+};
+
+_reset {
+   bootph-pre-ram;
+};
+
+_uart0 {
+   bootph-pre-ram;
+};
+
+_vtm0 {
+   bootph-pre-ram;
+};
+
+_pmx0 {
+   bootph-pre-ram;
+};
+
+_uart0_pins_default {
+   bootph-pre-ram;
+};
+
+_vtt_pins_default {
+   bootph-pre-ram;
+};
+
+_uart0_pins_default {
+   bootph-pre-ram;
+};
+
+_i2c0_pins_default {
+   bootph-pre-ram;
+};
+
+_fss0_ospi0_pins_default {
+   bootph-pre-ram;
+};
+
+_pmx0 {
+   bootph-pre-ram;
+};
+
+_uart0_pins_default {
+   bootph-pre-ram;
+};
+
+_mmc0_pins_default {
+   bootph-pre-ram;
+};
+
+_mmc1_pins_default {
+   bootph-pre-ram;
+};
+
+_pins_default {
+   bootph-pre-ram;
+};
+
+_pmx1 {
+   bootph-pre-ram;
+};
+
+ {
+   bootph-pre-ram;
+};
+
+ {
+   bootph-pre-ram;
+};
+
+_i2c0 {
+   bootph-pre-ram;
+};
+
+_mpu {
+   bootph-pre-ram;
+};
+
+ {
+   bootph-pre-ram;
+
+   flash@0 {
+   bootph-pre-ram;
+   };
+};
+
+_0 {
+   bootph-pre-ram;
+};
+
+_phy {
+   bootph-pre-ram;
+};
+
+ {
+   bootph-pre-ram;
+};
+
+_conf {
+   bootph-pre-ram;
+};
+
+ {
+   bootph-pre-ram;
+};
+
 _0 {
remoteproc-name = "pru0_0";
 };
diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index d75c7bf3fe662..8f55dab508ee6 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -53,13 +53,10 @@
regulator-max-microvolt = <330>;
gpios = <_gpio0 28 GPIO_ACTIVE_HIGH>;
states = <0 0x0 330 0x1>;
-   bootph-pre-ram;
};
 };
 
 _main {
-   bootph-pre-ram;
-
timer1: timer@4040 {
compatible = "ti,omap5430-timer";
reg = <0x0 0x4040 0x0 0x80>;
@@ -67,15 +64,9 @@
clock-frequency = <2500>;
bootph-all;
};
-
-   main_navss: bus@3080 {
-   bootph-pre-ram;
-   };
 };
 
 _mcu {
-   bootph-pre-ram;
-
mcu_secproxy: secproxy@2838 {
compatible = "ti,am654-secure-proxy";
reg = <0x0 0x2a38 0x0 0x8>,
@@ -87,8 +78,6 @@
};
 
mcu_navss: bus@2838 {
-   bootph-pre-ram;
-
ringacc@2b80 {
reg =   <0x0 0x2b80 0x0 0x40>,
<0x0 0x2b00 0x0 0x40>,
@@ -96,7 +85,6 @@
<0x0 0x2a50 0x0 0x4>,
<0x0 0x2844 0x0 0x4>;
reg-names = "rt", "fifos", "proxy_gcfg", 
"proxy_target", "cfg";
-   bootph-pre-ram;
ti,dma-ring-reset-quirk;
};
 
@@ -109,34 +97,11 @@
<0x0 0x2840 0x0 0x2000>;
reg-names = "gcfg", "rchan", "rchanrt", "tchan",
"tchanrt", "rflow";
-   bootph-pre-ram;
};
};
 };
 
-_pds {
-   bootph-pre-ram;
-};
-
-_clks {
-   bootph-pre-ram;
-};
-
-_reset {
-   bootph-pre-ram;
-};
-
-_gpio0 {
-   bootph-pre-ram;
-};
-
-_proxy_main {
-   bootph-pre-ram;
-};
-
 _wakeup {
-   bootph-pre-ram;
-
sysctrler: sysctrler {
compatible = "ti,am654-system-controller";
mboxes= <_secproxy 4>, <_secproxy 5>;
@@ -150,40 +115,29 @@

[PATCH v2 00/26] sync am65x device tree with Linux v6.7-rc1

2023-12-29 Thread Bryan Brattlof
Hello Again Everyone!

This series gets the am65x booting again along with syncing the device
tree files with v6.7-rc1 Linux.

The bulk of these patches unify the WKUP SPL board file with the arm64
files to make future syncs from Linux much easier. In the end the DTBs
should look a lot like what the DTBs look like for the am64x which
is fairly similar to the am65x.

For those interested in what UART boot looks like:
   https://paste.sr.ht/~bryanb/7df8a645dc548912cd806abd5ecab967ef3287bc

Changes from v1: [0]
- fixed multi-line comment format
- moved wkup_uart0 and mcu_uart0 U-Boot overrides to the r5 board file
  as they are not needed for a53/main domain U-Boot builds
- corrected a bad wkup_i2c0_pins_default fixup in PATCH 6/26
- spelling fix (s/Libux/Linux/) in commit body for PATCH 6/26
- added trailers from Tom

Thanks for reviewing and happy holidays
~Bryan

[0] https://lore.kernel.org/u-boot/20231221174412.210807-1...@ti.com/

Bryan Brattlof (26):
  configs: am65x_evm_r5: enable driver for fixed regulators
  configs: am65x_evm_a53: disable CONSOLE_MUX
  arm: dts: k3-am654-r5: Merge board file and U-Boot overlay
  arm: dts: k3-am654: pull in dtb update from Linux
  arm: dts: k3-am654: copy bootph properties to a53 dts
  arm: dts: k3-am654: include a53 board dtb for r5 build
  arm: dts: k3-am654: remove duplicate vtt_supply
  arm: dts: k3-am654: remove duplicate wkup_uart0
  arm: dts: k3-am654: remove duplicate timer
  arm: dts: k3-am654: remove duplicate mcu_ringacc
  arm: dts: k3-am654: remove duplicate mcu_udmap
  arm: dts: k3-am654: add needed regs to udmap nodes
  arm: dts: k3-am654: remove duplicate mcu_uart0 node
  arm: dts: k3-am654: remove duplicate main_uart0
  arm: dts: k3-am654: remove duplicate sdhci0 pinmux node
  arm: dts: k3-am654: remove duplicate sdhci1 pinmux node
  arm: dts: k3-am654: remove duplicate wkup_i2c0
  arm: dts: k3-am654: remove duplicate ospi0 node
  arm: dts: k3-am654: remove usb0
  arm: dts: k3-am654: remove duplicate mdio
  arm: dts: k3-am654: remove duplicate vtt pinmux
  arm: dts: k3-am654: remove duplicate root properties
  arm: dts: k3-am654: remove un-needed aliases
  arm: dts: k3-am654: move dummy_clock to root node
  arm: dts: k3-am654: remove duplicate mcu secure proxy node
  arm: dts: k3-am654: convert bootph-pre-ram to bootph-all

 arch/arm/dts/k3-am65-main.dtsi| 342 +++---
 arch/arm/dts/k3-am65-mcu.dtsi | 156 +++-
 arch/arm/dts/k3-am65-wakeup.dtsi  |  10 +-
 arch/arm/dts/k3-am65.dtsi |  19 +-
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 195 +-
 arch/arm/dts/k3-am654-base-board.dts  | 301 +--
 .../dts/k3-am654-r5-base-board-u-boot.dtsi| 208 ---
 arch/arm/dts/k3-am654-r5-base-board.dts   | 303 
 arch/arm/dts/k3-am654.dtsi|   7 +
 configs/am65x_evm_a53_defconfig   |   1 -
 configs/am65x_evm_r5_defconfig|   2 +
 11 files changed, 886 insertions(+), 658 deletions(-)
 delete mode 100644 arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi


base-commit: 0a0ceea2269b983e736b80104f03cc800d1a5e2a
-- 
2.43.0



[PATCH v2 13/26] arm: dts: k3-am654: remove duplicate mcu_uart0 node

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified we now have a
duplicate mcu_uart0 node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 12 
 1 file changed, 12 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index 19806ec4e2309..bdee47802b047 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -18,7 +18,6 @@
ethernet0 = _port1;
remoteproc0 = 
remoteproc1 = _0;
-   serial1 = _uart0;
serial2 = _uart0;
spi0 = 
spi1 = 
@@ -98,8 +97,6 @@
 };
 
 _uart0 {
-   pinctrl-names = "default";
-   pinctrl-0 = <_uart0_pins_default>;
clock-frequency = <4800>;
/delete-property/ power-domains;
status = "okay";
@@ -126,15 +123,6 @@
>;
};
 
-   mcu_uart0_pins_default: mcu_uart0_pins_default {
-   pinctrl-single,pins = <
-   AM65X_WKUP_IOPAD(0x0044, PIN_INPUT, 4)  /* (P4) 
MCU_OSPI1_D1.MCU_UART0_RXD */
-   AM65X_WKUP_IOPAD(0x0048, PIN_OUTPUT, 4) /* (P5) 
MCU_OSPI1_D2.MCU_UART0_TXD */
-   AM65X_WKUP_IOPAD(0x004C, PIN_INPUT, 4)  /* (P1) 
MCU_OSPI1_D3.MCU_UART0_CTSn */
-   AM65X_WKUP_IOPAD(0x0054, PIN_OUTPUT, 4) /* (N3) 
MCU_OSPI1_CSn1.MCU_UART0_RTSn */
-   >;
-   };
-
wkup_i2c0_pins_default: wkup-i2c0-pins-default {
pinctrl-single,pins = <
AM65X_WKUP_IOPAD(0x00e0, PIN_INPUT, 0) /* (AC7) 
WKUP_I2C0_SCL */
-- 
2.43.0



[PATCH v2 24/26] arm: dts: k3-am654: move dummy_clock to root node

2023-12-29 Thread Bryan Brattlof
The dummy_clock node is used to help the drivers probe the IO needed to
setup consoles and boot media to load firmware into the SoC.

This dummy_clock isn't a device that exists nor does it exist in the
mcu domain. So move it from cbass_mcu to the root node to avoid any
confusion.

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index 9926981c661a0..b27b2b05ad840 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -30,6 +30,13 @@
ti,sci-host-id = <10>;
bootph-pre-ram;
};
+
+   clk_200mhz: dummy_clock {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2>;
+   bootph-pre-ram;
+   };
 };
 
 _mcu {
@@ -51,13 +58,6 @@
mbox-names = "tx", "rx";
bootph-pre-ram;
};
-
-   clk_200mhz: dummy_clock {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <2>;
-   bootph-pre-ram;
-   };
 };
 
 /*
-- 
2.43.0



[PATCH v2 25/26] arm: dts: k3-am654: remove duplicate mcu secure proxy node

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified, we now have a
duplicate mcu secure proxy node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index b27b2b05ad840..dea2ba85dcb31 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -39,22 +39,15 @@
};
 };
 
-_mcu {
-   mcu_secproxy: secproxy@2838 {
-   compatible = "ti,am654-secure-proxy";
-   reg = <0x0 0x2a38 0x0 0x8>,
- <0x0 0x2a40 0x0 0x8>,
- <0x0 0x2a48 0x0 0x8>;
-   reg-names = "rt", "scfg", "target_data";
-   #mbox-cells = <1>;
-   bootph-pre-ram;
-   };
+_proxy_mcu {
+   status = "okay";
+   bootph-pre-ram;
 };
 
 _wakeup {
sysctrler: sysctrler {
compatible = "ti,am654-system-controller";
-   mboxes= <_secproxy 4>, <_secproxy 5>;
+   mboxes= <_proxy_mcu 4>, <_proxy_mcu 5>;
mbox-names = "tx", "rx";
bootph-pre-ram;
};
@@ -76,7 +69,9 @@
 };
 
  {
-   mboxes= <_secproxy 8>, <_secproxy 6>, <_secproxy 5>;
+   mboxes = <_proxy_mcu 8>,
+<_proxy_mcu 6>,
+<_proxy_mcu 5>;
mbox-names = "tx", "rx", "notify";
ti,host-id = <4>;
ti,secure-host;
-- 
2.43.0



[PATCH v2 09/26] arm: dts: k3-am654: remove duplicate timer

2023-12-29 Thread Bryan Brattlof
timer1 is really just the mcu_timer0 node redefined for the WKUP SPL.
Remove the timer1 and replace it with the mcu_timer0 from the Linux
device tree we imported into U-Boot.

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 12 
 arch/arm/dts/k3-am654-r5-base-board.dts  | 30 ++--
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index 4b1e8ce2c920c..a008af5b4a047 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -5,6 +5,18 @@
 
 #include "k3-am65x-binman.dtsi"
 
+/ {
+   chosen {
+   tick-timer = _timer0;
+   };
+};
+
+_timer0 {
+   ti,timer-alwon;
+   clock-frequency = <2500>;
+   bootph-all;
+};
+
 _supply {
bootph-pre-ram;
 };
diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index fb13a17b1dc64..f462262b9aaac 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -26,11 +26,6 @@
usb1 = 
};
 
-   chosen {
-   stdout-path = "serial2:115200n8";
-   tick-timer = 
-   };
-
a53_0: a53@0 {
compatible = "ti,am654-rproc";
reg = <0x0 0x00a9 0x0 0x10>;
@@ -47,16 +42,6 @@
};
 };
 
-_main {
-   timer1: timer@4040 {
-   compatible = "ti,omap5430-timer";
-   reg = <0x0 0x4040 0x0 0x80>;
-   ti,timer-alwon;
-   clock-frequency = <2500>;
-   bootph-all;
-   };
-};
-
 _mcu {
mcu_secproxy: secproxy@2838 {
compatible = "ti,am654-secure-proxy";
@@ -108,6 +93,21 @@
};
 };
 
+/*
+ * timer init is called as part of rproc_start() while
+ * starting System Firmware, so any clock/power-domain
+ * operations will fail as SYSFW is not yet up and running.
+ * Delete all clock/power-domain properties to avoid
+ * timer init failure.
+ * This is an always on timer at 20MHz.
+ */
+_timer0 {
+   /delete-property/ clocks;
+   /delete-property/ assigned-clocks;
+   /delete-property/ assigned-clock-parents;
+   /delete-property/ power-domains;
+};
+
  {
mboxes= <_secproxy 8>, <_secproxy 6>, <_secproxy 5>;
mbox-names = "tx", "rx", "notify";
-- 
2.43.0



[PATCH v2 04/26] arm: dts: k3-am654: pull in dtb update from Linux

2023-12-29 Thread Bryan Brattlof
Pull in dtb updates for the am654 base board from v6.7-rc1 of Linux

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am65-main.dtsi   | 342 ++-
 arch/arm/dts/k3-am65-mcu.dtsi| 156 ++--
 arch/arm/dts/k3-am65-wakeup.dtsi |  10 +-
 arch/arm/dts/k3-am65.dtsi|  19 +-
 arch/arm/dts/k3-am654-base-board.dts | 301 ++-
 arch/arm/dts/k3-am654.dtsi   |   7 +
 6 files changed, 626 insertions(+), 209 deletions(-)

diff --git a/arch/arm/dts/k3-am65-main.dtsi b/arch/arm/dts/k3-am65-main.dtsi
index ba4e5d3e1ed7a..5ebb87f467de5 100644
--- a/arch/arm/dts/k3-am65-main.dtsi
+++ b/arch/arm/dts/k3-am65-main.dtsi
@@ -35,7 +35,10 @@
#interrupt-cells = <3>;
interrupt-controller;
reg = <0x00 0x0180 0x00 0x1>,   /* GICD */
- <0x00 0x0188 0x00 0x9>;   /* GICR */
+ <0x00 0x0188 0x00 0x9>,   /* GICR */
+ <0x00 0x6f00 0x00 0x2000>,/* GICC */
+ <0x00 0x6f01 0x00 0x1000>,/* GICH */
+ <0x00 0x6f02 0x00 0x2000>;/* GICV */
/*
 * vcpumntirq:
 * virtual CPU interface maintenance interrupt
@@ -88,6 +91,7 @@
clock-frequency = <4800>;
current-speed = <115200>;
power-domains = <_pds 146 TI_SCI_PD_EXCLUSIVE>;
+   status = "disabled";
};
 
main_uart1: serial@281 {
@@ -96,6 +100,7 @@
interrupts = ;
clock-frequency = <4800>;
power-domains = <_pds 147 TI_SCI_PD_EXCLUSIVE>;
+   status = "disabled";
};
 
main_uart2: serial@282 {
@@ -104,29 +109,47 @@
interrupts = ;
clock-frequency = <4800>;
power-domains = <_pds 148 TI_SCI_PD_EXCLUSIVE>;
+   status = "disabled";
};
 
crypto: crypto@4e0 {
compatible = "ti,am654-sa2ul";
reg = <0x0 0x4e0 0x0 0x1200>;
-   power-domains = <_pds 136 TI_SCI_PD_EXCLUSIVE>;
+   power-domains = <_pds 136 TI_SCI_PD_SHARED>;
#address-cells = <2>;
#size-cells = <2>;
ranges = <0x0 0x04e0 0x00 0x04e0 0x0 0x3>;
 
-   dmas = <_udmap 0xc000>, <_udmap 0x4000>,
-   <_udmap 0x4001>;
+   dmas = <_udmap 0xc001>, <_udmap 0x4002>,
+   <_udmap 0x4003>;
dma-names = "tx", "rx1", "rx2";
-   dma-coherent;
 
rng: rng@4e1 {
compatible = "inside-secure,safexcel-eip76";
reg = <0x0 0x4e1 0x0 0x7d>;
interrupts = ;
-   clocks = <_clks 136 1>;
+   status = "disabled"; /* Used by OP-TEE */
};
};
 
+   /* TIMERIO pad input CTRLMMR_TIMER*_CTRL registers */
+   main_timerio_input: pinctrl@104200 {
+   compatible = "pinctrl-single";
+   reg = <0x0 0x104200 0x0 0x30>;
+   #pinctrl-cells = <1>;
+   pinctrl-single,register-width = <32>;
+   pinctrl-single,function-mask = <0x001ff>;
+   };
+
+   /* TIMERIO pad output CTCTRLMMR_TIMERIO*_CTRL registers */
+   main_timerio_output: pinctrl@104280 {
+   compatible = "pinctrl-single";
+   reg = <0x0 0x104280 0x0 0x20>;
+   #pinctrl-cells = <1>;
+   pinctrl-single,register-width = <32>;
+   pinctrl-single,function-mask = <0x000f>;
+   };
+
main_pmx0: pinctrl@11c000 {
compatible = "pinctrl-single";
reg = <0x0 0x11c000 0x0 0x2e4>;
@@ -152,6 +175,7 @@
clock-names = "fck";
clocks = <_clks 110 1>;
power-domains = <_pds 110 TI_SCI_PD_EXCLUSIVE>;
+   status = "disabled";
};
 
main_i2c1: i2c@201 {
@@ -163,6 +187,7 @@
clock-names = "fck";
clocks = <_clks 111 1>;
power-domains = <_pds 111 TI_SCI_PD_EXCLUSIVE>;
+   status = "disabled";
};
 
main_i2c2: i2c@202 {
@@ -174,6 +199,7 @@
clock-names = "fck";
clocks = <_clks 112 1>;
power-dom

[PATCH v2 18/26] arm: dts: k3-am654: remove duplicate ospi0 node

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified, we now have a
duplicate ospi0 node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 37 -
 1 file changed, 37 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index 8c6cb147c821a..da41971a78f81 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -18,8 +18,6 @@
ethernet0 = _port1;
remoteproc0 = 
remoteproc1 = _0;
-   spi0 = 
-   spi1 = 
usb0 = 
usb1 = 
};
@@ -114,22 +112,6 @@
AM65X_WKUP_IOPAD(0x0040, PIN_OUTPUT_PULLUP, 7)  /* 
WKUP_GPIO0_28 */
>;
};
-
-   mcu_fss0_ospi0_pins_default: mcu-fss0-ospi0-pins_default {
-   pinctrl-single,pins = <
-   AM65X_WKUP_IOPAD(0x, PIN_OUTPUT, 0) /* (V1) 
MCU_OSPI0_CLK */
-   AM65X_WKUP_IOPAD(0x0008, PIN_INPUT, 0)   /* (U2) 
MCU_OSPI0_DQS */
-   AM65X_WKUP_IOPAD(0x000c, PIN_INPUT, 0)  /* (U4) 
MCU_OSPI0_D0 */
-   AM65X_WKUP_IOPAD(0x0010, PIN_INPUT, 0)  /* (U5) 
MCU_OSPI0_D1 */
-   AM65X_WKUP_IOPAD(0x0014, PIN_INPUT, 0)  /* (T2) 
MCU_OSPI0_D2 */
-   AM65X_WKUP_IOPAD(0x0018, PIN_INPUT, 0)  /* (T3) 
MCU_OSPI0_D3 */
-   AM65X_WKUP_IOPAD(0x001c, PIN_INPUT, 0)  /* (T4) 
MCU_OSPI0_D4 */
-   AM65X_WKUP_IOPAD(0x0020, PIN_INPUT, 0)  /* (T5) 
MCU_OSPI0_D5 */
-   AM65X_WKUP_IOPAD(0x0024, PIN_INPUT, 0)  /* (R2) 
MCU_OSPI0_D6 */
-   AM65X_WKUP_IOPAD(0x0028, PIN_INPUT, 0)  /* (R3) 
MCU_OSPI0_D7 */
-   AM65X_WKUP_IOPAD(0x002c, PIN_OUTPUT, 0) /* (R4) 
MCU_OSPI0_CSn0 */
-   >;
-   };
 };
 
 _pmx0 {
@@ -175,27 +157,8 @@
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_fss0_ospi0_pins_default>;
-   bootph-pre-ram;
-
reg = <0x0 0x4704 0x0 0x100>,
  <0x0 0x5000 0x0 0x800>;
-
-   flash@0{
-   compatible = "jedec,spi-nor";
-   reg = <0x0>;
-   spi-tx-bus-width = <1>;
-   spi-rx-bus-width = <8>;
-   spi-max-frequency = <5000>;
-   cdns,tshsl-ns = <60>;
-   cdns,tsd2d-ns = <60>;
-   cdns,tchsh-ns = <60>;
-   cdns,tslch-ns = <60>;
-   cdns,read-delay = <0>;
-   #address-cells = <1>;
-   #size-cells = <1>;
-   };
 };
 
 _pmx0 {
-- 
2.43.0



[PATCH v2 14/26] arm: dts: k3-am654: remove duplicate main_uart0

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified, we now have a
duplicate main_uart0 node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 17 -
 1 file changed, 17 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index bdee47802b047..3d599a5413812 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -18,7 +18,6 @@
ethernet0 = _port1;
remoteproc0 = 
remoteproc1 = _0;
-   serial2 = _uart0;
spi0 = 
spi1 = 
usb0 = 
@@ -103,13 +102,6 @@
bootph-pre-ram;
 };
 
-_uart0 {
-   pinctrl-names = "default";
-   pinctrl-0 = <_uart0_pins_default>;
-   power-domains = <_pds 146 TI_SCI_PD_SHARED>;
-   status = "okay";
-};
-
 _vtm0 {
compatible = "ti,am654-vtm", "ti,am654-avs";
vdd-supply-3 = <_mpu>;
@@ -148,15 +140,6 @@
 };
 
 _pmx0 {
-   main_uart0_pins_default: main-uart0-pins-default {
-   pinctrl-single,pins = <
-   AM65X_IOPAD(0x01e4, PIN_INPUT, 0)   /* (AF11) 
UART0_RXD */
-   AM65X_IOPAD(0x01e8, PIN_OUTPUT, 0)  /* (AE11) 
UART0_TXD */
-   AM65X_IOPAD(0x01ec, PIN_INPUT, 0)   /* (AG11) 
UART0_CTSn */
-   AM65X_IOPAD(0x01f0, PIN_OUTPUT, 0)  /* (AD11) 
UART0_RTSn */
-   >;
-   };
-
main_mmc0_pins_default: main_mmc0_pins_default {
pinctrl-single,pins = <
AM65X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0)  /* 
(B25) MMC0_CLK */
-- 
2.43.0



[PATCH v2 16/26] arm: dts: k3-am654: remove duplicate sdhci1 pinmux node

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified, we now have a
duplicate sdhci1 pinmux node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 23 ---
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index f28245b12b6f6..9d7467acd30c9 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -140,19 +140,6 @@
 };
 
 _pmx0 {
-   main_mmc1_pins_default: main_mmc1_pins_default {
-   pinctrl-single,pins = <
-   AM65X_IOPAD(0x02d4, PIN_INPUT_PULLDOWN, 0)  /* 
(C27) MMC1_CLK */
-   AM65X_IOPAD(0x02d8, PIN_INPUT_PULLUP, 0)/* 
(C28) MMC1_CMD */
-   AM65X_IOPAD(0x02d0, PIN_INPUT_PULLUP, 0)/* 
(D28) MMC1_DAT0 */
-   AM65X_IOPAD(0x02cc, PIN_INPUT_PULLUP, 0)/* 
(E27) MMC1_DAT1 */
-   AM65X_IOPAD(0x02c8, PIN_INPUT_PULLUP, 0)/* 
(D26) MMC1_DAT2 */
-   AM65X_IOPAD(0x02c4, PIN_INPUT_PULLUP, 0)/* 
(D27) MMC1_DAT3 */
-   AM65X_IOPAD(0x02dc, PIN_INPUT_PULLUP, 0)/* 
(B24) MMC1_SDCD */
-   AM65X_IOPAD(0x02e0, PIN_INPUT, 0)   /* 
(C24) MMC1_SDWP */
-   >;
-   };
-
usb0_pins_default: usb0_pins_default {
pinctrl-single,pins = <
AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) 
USB0_DRVVBUS */
@@ -180,12 +167,18 @@
/delete-property/ power-domains;
 };
 
+/*
+ * MMC is probed to pull in firmware, so any clock
+ * or power-domain operation will fail as we do not
+ * have the firmware running at this point. Delete the
+ * power-domain properties to avoid making calls to
+ * SYSFW before it is loaded. Public ROM has already
+ * set it up for us anyway.
+ */
  {
clock-names = "clk_xin";
clocks = <_200mhz>;
-   pinctrl-0 = <_mmc1_pins_default>;
/delete-property/ power-domains;
-   ti,driver-strength-ohm = <50>;
 };
 
 _i2c0 {
-- 
2.43.0



[PATCH v2 19/26] arm: dts: k3-am654: remove usb0

2023-12-29 Thread Bryan Brattlof
The pinmux for usb0 is missing from the Linux board dtb file. Remove it
until we can introduce it in Linux

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 12 
 arch/arm/dts/k3-am654-r5-base-board.dts  | 29 
 2 files changed, 41 deletions(-)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index a24cb895e5578..3647088c29e4b 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -125,10 +125,6 @@
bootph-pre-ram;
 };
 
-_pins_default {
-   bootph-pre-ram;
-};
-
 _pmx1 {
bootph-pre-ram;
 };
@@ -161,14 +157,6 @@
bootph-pre-ram;
 };
 
-_phy {
-   bootph-pre-ram;
-};
-
- {
-   bootph-pre-ram;
-};
-
 _conf {
bootph-pre-ram;
 };
diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index da41971a78f81..8e57c77cba923 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -18,8 +18,6 @@
ethernet0 = _port1;
remoteproc0 = 
remoteproc1 = _0;
-   usb0 = 
-   usb1 = 
};
 
a53_0: a53@0 {
@@ -114,14 +112,6 @@
};
 };
 
-_pmx0 {
-   usb0_pins_default: usb0_pins_default {
-   pinctrl-single,pins = <
-   AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) 
USB0_DRVVBUS */
-   >;
-   };
-};
-
  {
vtt-supply = <_supply>;
pinctrl-names = "default";
@@ -161,14 +151,6 @@
  <0x0 0x5000 0x0 0x800>;
 };
 
-_pmx0 {
-   usb0_pins_default: usb0_pins_default {
-   pinctrl-single,pins = <
-   AM65X_IOPAD(0x02bc, PIN_OUTPUT, 0) /* (AD9) 
USB0_DRVVBUS */
-   >;
-   };
-};
-
 _0 {
status = "okay";
/delete-property/ clocks;
@@ -177,17 +159,6 @@
/delete-property/ assigned-clock-parents;
 };
 
-_phy {
-   status = "okay";
-   /delete-property/ clocks;
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_default>;
-   dr_mode = "peripheral";
-};
-
 _mdio {
phy0: ethernet-phy@0 {
reg = <0>;
-- 
2.43.0



[PATCH v2 06/26] arm: dts: k3-am654: include a53 board dtb for r5 build

2023-12-29 Thread Bryan Brattlof
To make things as organized as possible, start from the Linux board dtbs
and apply all properties needed for U-Boot in our *-u-boot.dtsi file for
the MAIN SPL and U-Boot builds.

We can then include these files for the WKUP SPL build making further
edits to the needed properties and nodes for the WKUP SPL bootloader's
view of the am65x.

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index 8f55dab508ee6..79ca6387c22bb 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -5,7 +5,8 @@
 
 /dts-v1/;
 
-#include "k3-am654.dtsi"
+#include "k3-am654-base-board.dts"
+#include "k3-am654-base-board-u-boot.dtsi"
 #include "k3-am654-base-board-ddr4-1600MTs.dtsi"
 #include "k3-am654-ddr.dtsi"
 
-- 
2.43.0



[PATCH v2 12/26] arm: dts: k3-am654: add needed regs to udmap nodes

2023-12-29 Thread Bryan Brattlof
Ethernet is one of a few IPs in U-Boot that depend on DMA to operate.
However there are a few missing registers ranges in the udmap nodes
need to properly setup DMA for the am65x.

A fix has been added to the Linux kernel[0] to add these ranges however
they have not made it to a Linux tag. To keep DMA operational until the
next DT sync from Linux, add these ranges to the *-u-boot.dtsi with a
note for our future selves.

[0] https://lore.kernel.org/r/20231213135138.929517-2-vigne...@ti.com

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 34 
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index a008af5b4a047..a24cb895e5578 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -252,3 +252,37 @@
 _r5fss0 {
ti,cluster-mode = <0>;
 };
+
+/*
+ * The DMA driver requires a few extra register ranges
+ * which are missing for the am65x. A patch has been
+ * sent and will be synced after the v6.8-rc1 linux
+ * tag is published
+ */
+_udmap {
+   reg = <0x0 0x3115 0x0 0x100>,
+ <0x0 0x3400 0x0 0x10>,
+ <0x0 0x3500 0x0 0x10>,
+ <0x0 0x30b0 0x0 0x1>,
+ <0x0 0x30c0 0x0 0x1>,
+ <0x0 0x30d0 0x0 0x8000>;
+   reg-names = "gcfg", "rchanrt", "tchanrt",
+   "tchan", "rchan", "rflow";
+};
+
+/*
+ * The DMA driver requires a few extra register ranges
+ * which are missing for the am65x. A patch has been
+ * sent and will be synced after the v6.8-rc1 linux
+ * tag is published
+ */
+_udmap {
+   reg = <0x0 0x285c 0x0 0x100>,
+ <0x0 0x2a80 0x0 0x4>,
+ <0x0 0x2aa0 0x0 0x4>,
+ <0x0 0x284a 0x0 0x4000>,
+ <0x0 0x284c 0x0 0x4000>,
+ <0x0 0x2840 0x0 0x2000>;
+   reg-names = "gcfg", "rchanrt", "tchanrt",
+   "tchan", "rchan", "rflow";
+};
-- 
2.43.0



[PATCH v2 10/26] arm: dts: k3-am654: remove duplicate mcu_ringacc

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified, we now have a
duplicate mcu_ringacc node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 10 --
 1 file changed, 10 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index f462262b9aaac..c4fa84a3d0b05 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -54,16 +54,6 @@
};
 
mcu_navss: bus@2838 {
-   ringacc@2b80 {
-   reg =   <0x0 0x2b80 0x0 0x40>,
-   <0x0 0x2b00 0x0 0x40>,
-   <0x0 0x2859 0x0 0x100>,
-   <0x0 0x2a50 0x0 0x4>,
-   <0x0 0x2844 0x0 0x4>;
-   reg-names = "rt", "fifos", "proxy_gcfg", 
"proxy_target", "cfg";
-   ti,dma-ring-reset-quirk;
-   };
-
dma-controller@285c {
reg =   <0x0 0x285c 0x0 0x100>,
<0x0 0x284c 0x0 0x4000>,
-- 
2.43.0



[PATCH v2 26/26] arm: dts: k3-am654: convert bootph-pre-ram to bootph-all

2023-12-29 Thread Bryan Brattlof
Many nodes are reused between WKUP SPL, MAIN SPL, and U-Boot. Using
bootph-pre-ram is causing these nodes to be present in SPL builds but
pruned away during the U-Boot build. Convert these nodes to bootph-all
so they will remain no matter which dtb build is happening.

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 74 ++--
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi 
b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index da6d4dffbf9d2..4fd188fa191b4 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -18,151 +18,151 @@
 };
 
 _supply {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _main {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _navss {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _mcu {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _navss {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _ringacc {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _udmap {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _gpio0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _proxy_main {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _wakeup {
-   bootph-pre-ram;
+   bootph-all;
 
chipid@4314 {
-   bootph-pre-ram;
+   bootph-all;
};
 };
 
  {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _pds {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _clks {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _reset {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _uart0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _vtm0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _pmx0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _uart0_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _vtt_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _uart0_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _i2c0_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _fss0_ospi0_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _pmx0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _uart0_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _mmc0_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _mmc1_pins_default {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _pmx1 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
  {
-   bootph-pre-ram;
+   bootph-all;
 };
 
  {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _i2c0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _mpu {
-   bootph-pre-ram;
+   bootph-all;
 };
 
  {
-   bootph-pre-ram;
+   bootph-all;
 
flash@0 {
-   bootph-pre-ram;
+   bootph-all;
};
 };
 
 _0 {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _conf {
-   bootph-pre-ram;
+   bootph-all;
 };
 
  {
-   bootph-pre-ram;
+   bootph-all;
 };
 
 _0 {
-- 
2.43.0



[PATCH v2 08/26] arm: dts: k3-am654: remove duplicate wkup_uart0

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board files unified, we now have a duplicate
wkup_uart0 node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 12 
 1 file changed, 12 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index 50e6be6118294..fb13a17b1dc64 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -18,7 +18,6 @@
ethernet0 = _port1;
remoteproc0 = 
remoteproc1 = _0;
-   serial0 = _uart0;
serial1 = _uart0;
serial2 = _uart0;
spi0 = 
@@ -117,8 +116,6 @@
 };
 
 _uart0 {
-   pinctrl-names = "default";
-   pinctrl-0 = <_uart0_pins_default>;
status = "okay";
bootph-pre-ram;
 };
@@ -146,15 +143,6 @@
 };
 
 _pmx0 {
-   wkup_uart0_pins_default: wkup_uart0_pins_default {
-   pinctrl-single,pins = <
-   AM65X_WKUP_IOPAD(0x00a0, PIN_INPUT, 0)  /* (AB1) 
WKUP_UART0_RXD */
-   AM65X_WKUP_IOPAD(0x00a4, PIN_OUTPUT, 0) /* (AB5) 
WKUP_UART0_TXD */
-   AM65X_WKUP_IOPAD(0x00c8, PIN_INPUT, 1)  /* (AC2) 
WKUP_GPIO0_6.WKUP_UART0_CTSn */
-   AM65X_WKUP_IOPAD(0x00cc, PIN_OUTPUT, 1) /* (AC1) 
WKUP_GPIO0_7.WKUP_UART0_RTSn */
-   >;
-   };
-
wkup_vtt_pins_default: wkup_vtt_pins_default {
pinctrl-single,pins = <
AM65X_WKUP_IOPAD(0x0040, PIN_OUTPUT_PULLUP, 7)  /* 
WKUP_GPIO0_28 */
-- 
2.43.0



[PATCH v2 20/26] arm: dts: k3-am654: remove duplicate mdio

2023-12-29 Thread Bryan Brattlof
With the Linux and U-Boot board dtb files unified, we now have a
duplicate mdio node. Remove it

Tested-by: Tom Rini 
Signed-off-by: Bryan Brattlof 
---
 arch/arm/dts/k3-am654-r5-base-board.dts | 9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/dts/k3-am654-r5-base-board.dts 
b/arch/arm/dts/k3-am654-r5-base-board.dts
index 8e57c77cba923..14bf1b4c8a462 100644
--- a/arch/arm/dts/k3-am654-r5-base-board.dts
+++ b/arch/arm/dts/k3-am654-r5-base-board.dts
@@ -159,15 +159,6 @@
/delete-property/ assigned-clock-parents;
 };
 
-_mdio {
-   phy0: ethernet-phy@0 {
-   reg = <0>;
-   /* TODO: phy reset: 
TCA9555RTWR(i2c:0x21)[p04].GPIO_MCU_RGMII_RSTN */
-   ti,rx-internal-delay = ;
-   ti,fifo-depth = ;
-   };
-};
-
 _cpsw {
reg = <0x0 0x4600 0x0 0x20>,
  <0x0 0x40f00200 0x0 0x2>;
-- 
2.43.0



  1   2   3   >