From: Nishanth Menon <nm@ti.com>
To: Robert Nelson <robertcnelson@gmail.com>, Tom Rini <trini@konsulko.com>
Cc: <u-boot@lists.denx.de>, Nishanth Menon <nm@ti.com>
Subject: [PATCH V2 1/5] board: beagle: beagleplay: Enable 32k crystal
Date: Tue, 20 Feb 2024 12:39:48 -0600 [thread overview]
Message-ID: <20240220183952.3614252-2-nm@ti.com> (raw)
In-Reply-To: <20240220183952.3614252-1-nm@ti.com>
Enable the external 32k crystal similar to that found on other
production AM62X board. The trim settings for the crystal is board
dependent, so the sequences tend to be board specific. Since this is
a configuration that needs to be done prior to DM managing the system
and all other muxes get set, do the same from R5 context.
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes from V1:
* Added Robert's tested by.
V1: https://lore.kernel.org/r/20240212155332.541949-2-nm@ti.com
board/beagle/beagleplay/beagleplay.c | 37 ++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/board/beagle/beagleplay/beagleplay.c b/board/beagle/beagleplay/beagleplay.c
index 1c376dea372f..2adb2517ef00 100644
--- a/board/beagle/beagleplay/beagleplay.c
+++ b/board/beagle/beagleplay/beagleplay.c
@@ -11,6 +11,8 @@
#include <fdt_support.h>
#include <spl.h>
+#include <asm/arch/hardware.h>
+
DECLARE_GLOBAL_DATA_PTR;
int board_init(void)
@@ -27,3 +29,38 @@ int dram_init_banksize(void)
{
return fdtdec_setup_memory_banksize();
}
+
+#ifdef CONFIG_SPL_BOARD_INIT
+
+/*
+ * Enable the 32k Crystal: needed for accurate 32k clock
+ * and external clock sources such as wlan 32k input clock
+ * supplied from the SoC to the wlan chip.
+ *
+ * The trim setup can be very highly board type specific choice of the crystal
+ * So this is done in the board file, though, in this case, no specific trim
+ * is necessary.
+ */
+static void crystal_32k_enable(void)
+{
+ /* Only mess with 32k at the start of boot from R5 */
+ if (IS_ENABLED(CONFIG_CPU_V7R)) {
+ /*
+ * We have external 32k crystal, so lets enable it (0x0)
+ * and disable bypass (0x0)
+ */
+ writel(0x0, MCU_CTRL_LFXOSC_CTRL);
+
+ /* Add any crystal specific TRIM needed here.. */
+
+ /* Make sure to mux the SoC 32k from the crystal */
+ writel(MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL,
+ MCU_CTRL_DEVICE_CLKOUT_32K_CTRL);
+ }
+}
+
+void spl_board_init(void)
+{
+ crystal_32k_enable();
+}
+#endif
--
2.43.0
next prev parent reply other threads:[~2024-02-20 18:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 18:39 [PATCH V2 0/5] board: beagle: Enable 32k and debounce configuration and fixups Nishanth Menon
2024-02-20 18:39 ` Nishanth Menon [this message]
2024-02-20 18:39 ` [PATCH V2 2/5] configs: am62x_beagleplay_r5_defconfig: Enable SPL_BOARD_INIT Nishanth Menon
2024-02-20 18:39 ` [PATCH V2 3/5] arm: mach-k3: am62: Add Debounce configuration register definitions Nishanth Menon
2024-02-20 18:39 ` [PATCH V2 4/5] board: beagle: beagleplay: Configure debounce registers Nishanth Menon
2024-02-20 18:39 ` [PATCH V2 5/5] board: beagle: beagleplay: env: Drop usb and pxe as boot targets Nishanth Menon
2024-03-04 23:43 ` [PATCH V2 0/5] board: beagle: Enable 32k and debounce configuration and fixups Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240220183952.3614252-2-nm@ti.com \
--to=nm@ti.com \
--cc=robertcnelson@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox