From 1599df538a93a3848f82b21b4ac6f1f96abd676e Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Thu, 16 Mar 2023 17:07:01 +0100 Subject: verdin-am62: enable the 32kHz clock input Set the LFOSC0 mode to bypass. This makes the external provided 32kHz clock available. A noteable consumer is the AM62x internal RTC. Upstream-Status: Pending Initial U-Boot to be used for bring-up and validation of the V1.0 design, we'll decide on the step forward to mainline this once the bring-up and validation will be done. Signed-off-by: Max Krummenacher --- board/toradex/verdin-am62/verdin-am62.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index f1c0614e07..e718eb0030 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -226,6 +226,18 @@ void spl_board_init(void) writel(val, CTRLMMR_USB1_PHY_CTRL); /* We use the 32k FOUT from the Epson RX8130CE RTC chip */ + /* In WKUP_LFOSC0 clear the power down bit and set the bypass bit + * The bypass bit is required as we provide a CMOS clock signal and + * the power down seems to be required also in the bypass case + * despite of the datasheet stating otherwise + */ + /* Compare with the AM62 datasheet, + * Table 7-21. LFXOSC Modes of Operation + */ + val = readl(MCU_CTRL_LFXOSC_CTRL); + val &= ~MCU_CTRL_LFXOSC_32K_DISABLE_VAL; + val |= MCU_CTRL_LFXOSC_32K_BYPASS_VAL; + writel(val, MCU_CTRL_LFXOSC_CTRL); /* Make sure to mux up to take the SoC 32k from the LFOSC input */ writel(MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL, MCU_CTRL_DEVICE_CLKOUT_32K_CTRL); -- cgit v1.2.3