summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-03-04 11:50:26 -0500
committerTom Rini <trini@konsulko.com>2024-03-04 13:40:57 -0500
commit3ba443abdb4019d7f5adc179ef7016be7778f73d (patch)
tree7686dbd12950df0e6f1b999790b52c861d080f44
parentbd465ada0e1172910f64feac6035f2344449c381 (diff)
parentfce2565f2a96ec3e22e9c337b8cbfc87e9fe8c05 (diff)
Merge patch series "board: beagle: Enable 32k and debounce configuration and fixups"
Nishanth Menon <nm@ti.com> says: Hi, Rev 2 of the series. This is a follow up from [1] - Without the 32k crystal configuration, wlan doesn't work. Debounce is needed for HDMI Hot plug detect(hpd) gpio interrupt not storming. At least the 32k configuration has been done for toradex and phytec boards, follow similar model of programming. Series is now based off master branch. Bootlog: https://gist.github.com/nmenon/75df38bee907785d1d78d1ec4abd7304 Changes from V2: - Removed depedency on [2] - depending on which way the merge sequence goes, one of the series will need a rebase. - Added a patch for a bug that Jan noticed - Fixup for the fat finger missing 0x in 0x4080 :( [1] https://lore.kernel.org/u-boot/20230725185253.2123433-4-nm@ti.com/ [2] https://lore.kernel.org/u-boot/20240212194726.1093771-1-nm@ti.com/
-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