Skip to contentSkip to conversation

IPQ40xx: Add DRAM detection & FDT fixup

PATCH New Robert Marko 2 participants 6 messages Aug 3, 2020 – Aug 7, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 IPQ40xx: Add DRAM detection & FDT fixup

Fixup the Linux FDT with the detection of onboard DRAM as provided by SBL (Secondary boot loader) by reading the shared-memory region.

Imported from Snapdragon target.

---
 arch/arm/mach-ipq40xx/Makefile            |  1 +
 arch/arm/mach-ipq40xx/dram.c              | 99 +++++++++++++++++++++++
 arch/arm/mach-ipq40xx/include/mach/dram.h | 12 +++
 3 files changed, 112 insertions(+)
 create mode 100644 arch/arm/mach-ipq40xx/dram.c
 create mode 100644 arch/arm/mach-ipq40xx/include/mach/dram.h
arch/arm/mach-ipq40xx/Makefile +1 -0
index 08a65b8854..97d72b1723 100644
@@ -5,5 +5,6 @@
 # Author: Robert Marko <[email protected]>
 
 obj-y += clock-ipq4019.o
+obj-y += dram.o
 obj-y += pinctrl-snapdragon.o
 obj-y += pinctrl-ipq4019.o
arch/arm/mach-ipq40xx/dram.c new file +99 -0

99 lines not on this page · raw message

arch/arm/mach-ipq40xx/include/mach/dram.h new file +12 -0
new file mode 100644
index 0000000000..0a9eedda41
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Snapdragon DRAM
+ * Copyright (C) 2018 Ramon Fried <[email protected]>
+ */
+
+#ifndef DRAM_H
+#define DRAM_H
+
+int msm_fixup_memory(void *blob);
+
+#endif
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 IPQ40xx: Add SMEM support

There is already existing driver for SMEM so lets enable it for IPQ40xx as well.

---
 arch/arm/Kconfig               | 2 ++
 arch/arm/dts/qcom-ipq4019.dtsi | 5 +++++
 drivers/smem/Kconfig           | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
arch/arm/Kconfig +2 -0
index 3e11ddfa9b..5ed893bc73 100644
@@ -784,8 +784,10 @@ config ARCH_IPQ40XX
 	select DM
 	select DM_GPIO
 	select DM_SERIAL
+	select MSM_SMEM
 	select PINCTRL
 	select CLK
+	select SMEM
 	select OF_CONTROL
 	imply CMD_DM
 
arch/arm/dts/qcom-ipq4019.dtsi +5 -0
index 5f78bc5ab9..9d21b15bb3 100644
@@ -38,6 +38,11 @@
 		};
 	};
 
+	smem {
+		compatible = "qcom,smem";
+		memory-region = <&smem_mem>;
+	};
+
 	soc: soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
drivers/smem/Kconfig +1 -1
index 7169d0f205..73d51b3a7a 100644
@@ -15,7 +15,7 @@ config SANDBOX_SMEM
 config MSM_SMEM
     bool "Qualcomm Shared Memory Manager (SMEM)"
     depends on DM
-    depends on ARCH_SNAPDRAGON
+    depends on ARCH_SNAPDRAGON || ARCH_IPQ40XX
     help
       Enable support for the Qualcomm Shared Memory Manager.
       The driver provides an interface to items in a heap shared among all
Signature · 1 line
2.26.2
#2 lore raw

PATCH 1/2 IPQ40xx: Add DRAM detection & FDT fixup

In reply to Robert Marko
Quoted 8 lines · Robert Marko

Fixup the Linux FDT with the detection of onboard DRAM as provided by SBL (Secondary boot loader) by reading the shared-memory region.

Imported from Snapdragon target.

Quoted 7 lines
---
 arch/arm/mach-ipq40xx/Makefile            |  1 +
 arch/arm/mach-ipq40xx/dram.c              | 99 +++++++++++++++++++++++
 arch/arm/mach-ipq40xx/include/mach/dram.h | 12 +++
 3 files changed, 112 insertions(+)
 create mode 100644 arch/arm/mach-ipq40xx/dram.c
 create mode 100644 arch/arm/mach-ipq40xx/include/mach/dram.h

Is this as-is? If so, we need to figure out something or another to make sharing the code, rather than copying, possible. How are these both grouped in the kernel? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200803/8411dcc0/attachment.sig>
#3 lore raw

PATCH 1/2 IPQ40xx: Add DRAM detection & FDT fixup

Quoted 19 lines · Tom Rini
Quoted 8 lines · Robert Marko

Fixup the Linux FDT with the detection of onboard DRAM as provided by SBL (Secondary boot loader) by reading the shared-memory region.

Imported from Snapdragon target.

Quoted 7 lines
---
 arch/arm/mach-ipq40xx/Makefile            |  1 +
 arch/arm/mach-ipq40xx/dram.c              | 99 +++++++++++++++++++++++
 arch/arm/mach-ipq40xx/include/mach/dram.h | 12 +++
 3 files changed, 112 insertions(+)
 create mode 100644 arch/arm/mach-ipq40xx/dram.c
 create mode 100644 arch/arm/mach-ipq40xx/include/mach/dram.h
Quoted 3 lines

Is this as-is? If so, we need to figure out something or another to make sharing the code, rather than copying, possible. How are these both grouped in the kernel? Thanks!

Yes, the Snapdragon target uses the identical code. The kernel does not have code for this but rather relies on the bootloader to do it.

Quoted 3 lines

--
Tom

#4 lore raw

PATCH 1/2 IPQ40xx: Add DRAM detection & FDT fixup

Quoted 20 lines · Robert Marko
Quoted 19 lines · Tom Rini
Quoted 15 lines · Robert Marko

Fixup the Linux FDT with the detection of onboard DRAM as provided by SBL (Secondary boot loader) by reading the shared-memory region.

Imported from Snapdragon target.

---
 arch/arm/mach-ipq40xx/Makefile            |  1 +
 arch/arm/mach-ipq40xx/dram.c              | 99 +++++++++++++++++++++++
 arch/arm/mach-ipq40xx/include/mach/dram.h | 12 +++
 3 files changed, 112 insertions(+)
 create mode 100644 arch/arm/mach-ipq40xx/dram.c
 create mode 100644 arch/arm/mach-ipq40xx/include/mach/dram.h
Quoted 7 lines
Quoted 3 lines

Is this as-is? If so, we need to figure out something or another to make sharing the code, rather than copying, possible. How are these both grouped in the kernel? Thanks!

Yes, the Snapdragon target uses the identical code. The kernel does not have code for this but rather relies on the bootloader to do it.

Right, but I mean what does the kernel do to avoid copying identical code between these two platforms? I guess the answer is that for arch/arm64 everything has been pushed out of arch/arm64/. So in this case, the dram code should get moved to our drivers/ddr/ or drivers/ram/ depending on which place "dram.c" really belongs best.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200804/56217123/attachment.sig>
#5 lore raw

PATCH 1/2 IPQ40xx: Add DRAM detection & FDT fixup

Quoted 30 lines · Tom Rini
Quoted 20 lines · Robert Marko
Quoted 19 lines · Tom Rini
Quoted 15 lines · Robert Marko

Fixup the Linux FDT with the detection of onboard DRAM as provided by SBL (Secondary boot loader) by reading the shared-memory region.

Imported from Snapdragon target.

---
 arch/arm/mach-ipq40xx/Makefile            |  1 +
 arch/arm/mach-ipq40xx/dram.c              | 99 +++++++++++++++++++++++
 arch/arm/mach-ipq40xx/include/mach/dram.h | 12 +++
 3 files changed, 112 insertions(+)
 create mode 100644 arch/arm/mach-ipq40xx/dram.c
 create mode 100644 arch/arm/mach-ipq40xx/include/mach/dram.h
Quoted 7 lines
Quoted 3 lines

Is this as-is? If so, we need to figure out something or another to make sharing the code, rather than copying, possible. How are these both grouped in the kernel? Thanks!

Yes, the Snapdragon target uses the identical code. The kernel does not have code for this but rather relies on the bootloader to do it.

Quoted 5 lines

Right, but I mean what does the kernel do to avoid copying identical code between these two platforms? I guess the answer is that for arch/arm64 everything has been pushed out of arch/arm64/. So in this case, the dram code should get moved to our drivers/ddr/ or drivers/ram/ depending on which place "dram.c" really belongs best.

Hi, I have been doing some further testing of the DRAM code on multiple boards. Since it uses SMEM to detect DRAM configuration it's supposed to remove the need to manually define DRAM size etc.
Unfortunately, what I experienced was that it's not uncommon for boards to ship with
incorrect DRAM info in SMEM.
So, I have decided to drop this for now as it's not reliable and manually config DRAM
start, size, etc.

Regards,
Robert

Quoted 3 lines

--
Tom