Skip to contentSkip to conversation

arm: zynqmp: Initialize some registers at boot

PATCH Superseded Sean Anderson 2 participants 6 messages Aug 12, 2024 – Sep 3, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm: zynqmp: Initialize some registers at boot

These patches are independent in intent, but they modify adjacent lines so I have sent them as a series.

Sean Anderson (2):
zynqmp: Disable secure access for boot devices
arm: zynqmp: Enable non-invasive CCI-400 PMU debug

 arch/arm/mach-zynqmp/include/mach/hardware.h | 5 +++++
 board/xilinx/zynqmp/zynqmp.c                 | 8 ++++++++
 2 files changed, 13 insertions(+)
Signature · 1 line
2.35.1.1320.gc452695387.dirty
#1 lore raw

PATCH 1/2 zynqmp: Disable secure access for boot devices

Boot devices (QSPI, MMC, NAND, and Ethernet) use secure access for DMA by default. As this causes problems when using the SMMU [1], configure them for normal access instead.

[1] https://support.xilinx.com/s/article/72164

---

 arch/arm/mach-zynqmp/include/mach/hardware.h | 2 ++
 board/xilinx/zynqmp/zynqmp.c                 | 4 ++++
 2 files changed, 6 insertions(+)
arch/arm/mach-zynqmp/include/mach/hardware.h +2 -0
index 8cb6494e52c..f1514d6a869 100644
@@ -63,6 +63,8 @@ struct crlapb_regs {
 
 #define crlapb_base ((struct crlapb_regs *)ZYNQMP_CRL_APB_BASEADDR)
 
+#define ZYNQMP_IOU_SECURE_SLCR 0xFF240000
+
 #define ZYNQMP_IOU_SCNTR_SECURE	0xFF260000
 #define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN	0x1
 #define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG	0x2
board/xilinx/zynqmp/zynqmp.c +4 -0
index b4c15b041cc..94a66684af2 100644
@@ -72,6 +72,10 @@ int __maybe_unused psu_uboot_init(void)
 	writel(ZYNQMP_PS_SYSMON_ANALOG_BUS_VAL,
 	       ZYNQMP_AMS_PS_SYSMON_ANALOG_BUS);
 
+	/* Disable secure access for boot devices */
+	writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR);
+	writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR + 4);
+
 	/* Delay is required for clocks to be propagated */
 	udelay(1000000);
 	
Signature · 1 line
2.35.1.1320.gc452695387.dirty
maintainer
#2 lore raw

Re: [PATCH 1/2] zynqmp: Disable secure access for boot devices

Quoted 32 lines · Sean Anderson

Boot devices (QSPI, MMC, NAND, and Ethernet) use secure access for DMA by default. As this causes problems when using the SMMU [1], configure them for normal access instead.

[1] https://support.xilinx.com/s/article/72164

---

  arch/arm/mach-zynqmp/include/mach/hardware.h | 2 ++
  board/xilinx/zynqmp/zynqmp.c                 | 4 ++++
  2 files changed, 6 insertions(+)
arch/arm/mach-zynqmp/include/mach/hardware.h +2 -0
index 8cb6494e52c..f1514d6a869 100644
@@ -63,6 +63,8 @@ struct crlapb_regs {
 
  #define crlapb_base ((struct crlapb_regs *)ZYNQMP_CRL_APB_BASEADDR)
 
+#define ZYNQMP_IOU_SECURE_SLCR 0xFF240000
+
  #define ZYNQMP_IOU_SCNTR_SECURE        0xFF260000
  #define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN   0x1
  #define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG 0x2
board/xilinx/zynqmp/zynqmp.c +0 -0
index b4c15b041cc..94a66684af2 100644

board/xilinx/zynqmp/zynqmp.c int __maybe_unused psu_uboot_init(void) · line 77

Quoted 6 lines
board/xilinx/zynqmp/zynqmp.c +3 -0
@@ -72,6 +72,10 @@ int __maybe_unused psu_uboot_init(void)
         writel(ZYNQMP_PS_SYSMON_ANALOG_BUS_VAL,
                ZYNQMP_AMS_PS_SYSMON_ANALOG_BUS);
 
+       /* Disable secure access for boot devices */
+       writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR);
+       writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR + 4);

Based on
https://docs.amd.com/r/en-US/ug1087-zynq-ultrascale-registers/IOU_AXI_RPRTCN-IOU_SECURE_SLCR-Register

there is no definition for bits 27:25 that's why that upper 4 shouldn't be there.

Thanks,
Michal

#3 lore raw

Re: [PATCH 1/2] zynqmp: Disable secure access for boot devices

Quoted 38 lines · Michal Simek
Quoted 35 lines · Sean Anderson

Boot devices (QSPI, MMC, NAND, and Ethernet) use secure access for DMA by default. As this causes problems when using the SMMU [1], configure them for normal access instead.

[1] https://support.xilinx.com/s/article/72164

---

  arch/arm/mach-zynqmp/include/mach/hardware.h | 2 ++ board/xilinx/zynqmp/zynqmp.c                 | 4 ++++

  2 files changed, 6 insertions(+)
arch/arm/mach-zynqmp/include/mach/hardware.h +2 -0
index 8cb6494e52c..f1514d6a869 100644
@@ -63,6 +63,8 @@ struct crlapb_regs {
 
   #define crlapb_base ((struct crlapb_regs *)ZYNQMP_CRL_APB_BASEADDR)
 
+#define ZYNQMP_IOU_SECURE_SLCR 0xFF240000
+
   #define ZYNQMP_IOU_SCNTR_SECURE        0xFF260000
   #define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN   0x1
   #define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG 0x2
board/xilinx/zynqmp/zynqmp.c +0 -0
index b4c15b041cc..94a66684af2 100644
@@ -72,6 +72,10 @@ int __maybe_unused psu_uboot_init(void)
          writel(ZYNQMP_PS_SYSMON_ANALOG_BUS_VAL,
                 ZYNQMP_AMS_PS_SYSMON_ANALOG_BUS);
 
Quoted 8 lines

board/xilinx/zynqmp/zynqmp.c int __maybe_unused psu_uboot_init(void) · line 77

Quoted 3 lines
board/xilinx/zynqmp/zynqmp.c +3 -0
+       /* Disable secure access for boot devices */
+       writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR);
+       writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR + 4);

Based on
https://docs.amd.com/r/en-US/ug1087-zynq-ultrascale-registers/IOU_AXI_RPRTCN-IOU_SECURE_SLCR-Register

there is no definition for bits 27:25 that's why that upper 4 shouldn't be there.

OK. Will fix for v2.

--Sean

#4 lore raw

PATCH 2/2 arm: zynqmp: Enable non-invasive CCI-400 PMU debug

In reply to Sean Anderson

Set NIDEN, enabling non-invasive debug for the CCI-400 PMU. Otherwise, the PMU is effectively disabled.

---

 arch/arm/mach-zynqmp/include/mach/hardware.h | 3 +++
 board/xilinx/zynqmp/zynqmp.c                 | 4 ++++
 2 files changed, 7 insertions(+)
arch/arm/mach-zynqmp/include/mach/hardware.h +3 -0
index f1514d6a869..51eab3509b8 100644
@@ -128,6 +128,9 @@ struct crfapb_regs {
 
 #define crfapb_base ((struct crfapb_regs *)ZYNQMP_CRF_APB_BASEADDR)
 
+#define ZYNQMP_CCI_REG_CCI_MISC_CTRL	0xFD5E0040
+#define ZYNQMP_CCI_REG_CCI_MISC_CTRL_NIDEN	BIT(1)
+
 #define ZYNQMP_APU_BASEADDR	0xFD5C0000
 
 struct apu_regs {
board/xilinx/zynqmp/zynqmp.c +4 -0
index 94a66684af2..e0ff2607952 100644
@@ -76,6 +76,10 @@ int __maybe_unused psu_uboot_init(void)
 	writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR);
 	writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR + 4);
 
+	/* Enable CCI PMU events */
+	writel(ZYNQMP_CCI_REG_CCI_MISC_CTRL_NIDEN,
+	       ZYNQMP_CCI_REG_CCI_MISC_CTRL);
+
 	/* Delay is required for clocks to be propagated */
 	udelay(1000000);
 	
Signature · 1 line
2.35.1.1320.gc452695387.dirty
maintainer Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] arm: zynqmp: Enable non-invasive CCI-400 PMU debug

Quoted 16 lines · Sean Anderson

Set NIDEN, enabling non-invasive debug for the CCI-400 PMU. Otherwise, the PMU is effectively disabled.

---

  arch/arm/mach-zynqmp/include/mach/hardware.h | 3 +++
  board/xilinx/zynqmp/zynqmp.c                 | 4 ++++
  2 files changed, 7 insertions(+)
arch/arm/mach-zynqmp/include/mach/hardware.h +0 -0
index f1514d6a869..51eab3509b8 100644

arch/arm/mach-zynqmp/include/mach/hardware.h struct crfapb_regs { · line 131

Quoted 4 lines
arch/arm/mach-zynqmp/include/mach/hardware.h +1 -0
@@ -128,6 +128,9 @@ struct crfapb_regs {
 
  #define crfapb_base ((struct crfapb_regs *)ZYNQMP_CRF_APB_BASEADDR)
 
+#define ZYNQMP_CCI_REG_CCI_MISC_CTRL   0xFD5E0040

Normally this should be described via structure but some time ago also macro can be used that's why I am fine with it.

Quoted 21 lines
arch/arm/mach-zynqmp/include/mach/hardware.h +2 -0
+#define ZYNQMP_CCI_REG_CCI_MISC_CTRL_NIDEN     BIT(1)
+
  #define ZYNQMP_APU_BASEADDR    0xFD5C0000
 
  struct apu_regs {
board/xilinx/zynqmp/zynqmp.c +4 -1
index 94a66684af2..e0ff2607952 100644
@@ -76,6 +76,10 @@ int __maybe_unused psu_uboot_init(void)
         writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR);
         writel(0x04920492, ZYNQMP_IOU_SECURE_SLCR + 4);
 
+       /* Enable CCI PMU events */
+       writel(ZYNQMP_CCI_REG_CCI_MISC_CTRL_NIDEN,
+              ZYNQMP_CCI_REG_CCI_MISC_CTRL);
+
         /* Delay is required for clocks to be propagated */
         udelay(1000000);
 
--
Quoted 2 lines

2.35.1.1320.gc452695387.dirty

Thanks,
Michal