[PATCH 15/19] ARM: Add ls1028a lowlevel init

Sascha Hauer s.hauer at pengutronix.de
Thu Jan 4 06:17:42 PST 2024


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-layerscape/Makefile           |  2 +
 arch/arm/mach-layerscape/lowlevel-ls1028a.c | 42 +++++++++++++++++++++
 include/mach/layerscape/layerscape.h        |  7 ++++
 3 files changed, 51 insertions(+)
 create mode 100644 arch/arm/mach-layerscape/lowlevel-ls1028a.c

diff --git a/arch/arm/mach-layerscape/Makefile b/arch/arm/mach-layerscape/Makefile
index 8f288851ff..e4bb1b42f2 100644
--- a/arch/arm/mach-layerscape/Makefile
+++ b/arch/arm/mach-layerscape/Makefile
@@ -12,3 +12,5 @@ obj-$(CONFIG_BOOTM) += pblimage.o
 
 lwl-$(CONFIG_ARCH_LS1021) += lowlevel-ls102xa.o
 obj-$(CONFIG_ARCH_LS1021) += restart.o ls102xa_stream_id.o
+
+lwl-$(CONFIG_ARCH_LS1028) += lowlevel-ls1028a.o
diff --git a/arch/arm/mach-layerscape/lowlevel-ls1028a.c b/arch/arm/mach-layerscape/lowlevel-ls1028a.c
new file mode 100644
index 0000000000..fd013b2b52
--- /dev/null
+++ b/arch/arm/mach-layerscape/lowlevel-ls1028a.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <common.h>
+#include <io.h>
+#include <asm/syscounter.h>
+#include <asm/system.h>
+#include <mach/layerscape/errata.h>
+#include <mach/layerscape/lowlevel.h>
+#include <soc/fsl/immap_lsch3.h>
+#include <soc/fsl/scfg.h>
+
+static void ls1028a_timer_init(void)
+{
+	u32 __iomem *cntcr = IOMEM(LSCH3_TIMER_ADDR);
+	u32 __iomem *cltbenr = IOMEM(LSCH3_PMU_CLTBENR);
+
+	u32 __iomem *pctbenr = IOMEM(LSCH3_PCTBENR_OFFSET);
+
+	/* Enable timebase for all clusters.
+	 * It is safe to do so even some clusters are not enabled.
+	 */
+	out_le32(cltbenr, 0xf);
+
+	/*
+	 * In certain Layerscape SoCs, the clock for each core's
+	 * has an enable bit in the PMU Physical Core Time Base Enable
+	 * Register (PCTBENR), which allows the watchdog to operate.
+	 */
+	setbits_le32(pctbenr, 0xff);
+
+	/* Enable clock for timer
+	 * This is a global setting.
+	 */
+	out_le32(cntcr, 0x1);
+}
+
+void ls1028a_init_lowlevel(void)
+{
+	scfg_init(SCFG_ENDIANESS_LITTLE);
+	set_cntfrq(25000000);
+	ls1028a_timer_init();
+	ls1028a_errata();
+}
diff --git a/include/mach/layerscape/layerscape.h b/include/mach/layerscape/layerscape.h
index c3dfe4d860..95c230b8f3 100644
--- a/include/mach/layerscape/layerscape.h
+++ b/include/mach/layerscape/layerscape.h
@@ -9,6 +9,13 @@
 #define LS1021A_DDR_SDRAM_BASE		0x80000000
 #define LS1021A_DDR_FREQ		1600000000
 
+#define LS1028A_DDR_SDRAM_BASE		0x80000000
+#define LS1028A_DDR_SDRAM_LOWMEM_SIZE	0x80000000
+#define LS1028A_DDR_SDRAM_HIGHMEM_BASE	0x2080000000
+#define LS1028A_SECURE_DRAM_SIZE	SZ_64M
+#define LS1028A_SP_SHARED_DRAM_SIZE	SZ_2M
+#define LS1028A_TZC400_BASE		0x01100000
+
 enum bootsource ls1046a_bootsource_get(void);
 enum bootsource ls1021a_bootsource_get(void);
 
-- 
2.39.2




More information about the barebox mailing list