summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-k3/include/mach/am62_hardware.h3
-rw-r--r--board/beagle/beagleplay/beagleplay.c61
-rw-r--r--board/beagle/beagleplay/beagleplay.env2
-rw-r--r--configs/am62x_beagleplay_r5_defconfig1
4 files changed, 66 insertions, 1 deletions
diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h
index 54380f36e16..4cf7778a89e 100644
--- a/arch/arm/mach-k3/include/mach/am62_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
@@ -75,6 +75,9 @@
#define CTRLMMR_MCU_RST_CTRL (MCU_CTRL_MMR0_BASE + 0x18170)
+/* Debounce register configuration */
+#define CTRLMMR_DBOUNCE_CFG(index) (MCU_CTRL_MMR0_BASE + 0x4080 + (index * 4))
+
#define ROM_EXTENDED_BOOT_DATA_INFO 0x43c3f1e0
#define TI_SRAM_SCRATCH_BOARD_EEPROM_START 0x43c30000
diff --git a/board/beagle/beagleplay/beagleplay.c b/board/beagle/beagleplay/beagleplay.c
index 20819ecf45b..af36439e2e2 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)
@@ -41,3 +43,62 @@ int board_late_init(void)
return 0;
}
#endif
+
+#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);
+ }
+}
+
+static void debounce_configure(void)
+{
+ /* Configure debounce one time from R5 */
+ if (IS_ENABLED(CONFIG_CPU_V7R)) {
+ /*
+ * Setup debounce time registers.
+ * arbitrary values. Times are approx
+ */
+ /* 1.9ms debounce @ 32k */
+ writel(0x1, CTRLMMR_DBOUNCE_CFG(1));
+ /* 5ms debounce @ 32k */
+ writel(0x5, CTRLMMR_DBOUNCE_CFG(2));
+ /* 20ms debounce @ 32k */
+ writel(0x14, CTRLMMR_DBOUNCE_CFG(3));
+ /* 46ms debounce @ 32k */
+ writel(0x18, CTRLMMR_DBOUNCE_CFG(4));
+ /* 100ms debounce @ 32k */
+ writel(0x1c, CTRLMMR_DBOUNCE_CFG(5));
+ /* 156ms debounce @ 32k */
+ writel(0x1f, CTRLMMR_DBOUNCE_CFG(6));
+ }
+}
+
+void spl_board_init(void)
+{
+ crystal_32k_enable();
+ debounce_configure();
+}
+#endif
diff --git a/board/beagle/beagleplay/beagleplay.env b/board/beagle/beagleplay/beagleplay.env
index 647b25d14c8..bbf6b925d02 100644
--- a/board/beagle/beagleplay/beagleplay.env
+++ b/board/beagle/beagleplay/beagleplay.env
@@ -13,6 +13,6 @@ boot=mmc
mmcdev=1
bootpart=1:1
bootdir=/boot
-boot_targets=mmc1 mmc0 usb pxe
+boot_targets=mmc1 mmc0
bootmeths=script extlinux efi pxe
rd_spec=-
diff --git a/configs/am62x_beagleplay_r5_defconfig b/configs/am62x_beagleplay_r5_defconfig
index 2f3264b7ede..9413c859870 100644
--- a/configs/am62x_beagleplay_r5_defconfig
+++ b/configs/am62x_beagleplay_r5_defconfig
@@ -36,6 +36,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
CONFIG_SPL_BSS_START_ADDR=0x43c3b000
CONFIG_SPL_BSS_MAX_SIZE=0x3000
CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
+CONFIG_SPL_BOARD_INIT=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
CONFIG_SPL_STACK_R=y
CONFIG_SPL_SEPARATE_BSS=y