summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-layerscape/lowlevel-ls1028a.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2024-01-04 15:17:42 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-01-08 11:00:59 +0100
commitf5f98467e9fc7edfb1aa077eb587ec364feef954 (patch)
tree613c0a76b2a3d44cc2d6b6f0c1b41c7ff1b03df1 /arch/arm/mach-layerscape/lowlevel-ls1028a.c
parentf194316f0c50b258867db28b2a27725762f6af9d (diff)
downloadbarebox-f5f98467e9fc7edfb1aa077eb587ec364feef954.tar.gz
barebox-f5f98467e9fc7edfb1aa077eb587ec364feef954.tar.xz
ARM: Add ls1028a lowlevel init
Link: https://lore.barebox.org/20240104141746.165014-16-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-layerscape/lowlevel-ls1028a.c')
-rw-r--r--arch/arm/mach-layerscape/lowlevel-ls1028a.c42
1 files changed, 42 insertions, 0 deletions
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();
+}