summaryrefslogtreecommitdiff
path: root/board/ti/am62x
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2023-06-19 13:53:14 -0500
committerPraneeth Bajjuri <praneeth@ti.com>2023-06-20 16:12:46 -0500
commitece9718848ec37cf764fe86c1d1ecd42e86033f7 (patch)
tree5c5c0e148d337a9608e28aab95a7a96282d998b4 /board/ti/am62x
parentce1e93b554b8dc5fd87fddd757d8098e46297c30 (diff)
board: ti: am62x: Add basic initialization for usb voltage, 32k crystal, debounce
Do the basic configuration required for setting up the USB core voltage configuration, setup to configure the 32k clock coming from 32k crystal and the debounce configurations for the various pins. Signed-off-by: Nishanth Menon <nm@ti.com>
Diffstat (limited to 'board/ti/am62x')
-rw-r--r--board/ti/am62x/evm.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index a2cddb477d..ce2955572b 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -84,8 +84,54 @@ static int video_setup(void)
return 0;
}
+#define CTRLMMR_USB0_PHY_CTRL 0x43004008
+#define CTRLMMR_USB1_PHY_CTRL 0x43004018
+#define CORE_VOLTAGE 0x80000000
+
+#define WKUP_CTRLMMR_DBOUNCE_CFG1 0x04504084
+#define WKUP_CTRLMMR_DBOUNCE_CFG2 0x04504088
+#define WKUP_CTRLMMR_DBOUNCE_CFG3 0x0450408c
+#define WKUP_CTRLMMR_DBOUNCE_CFG4 0x04504090
+#define WKUP_CTRLMMR_DBOUNCE_CFG5 0x04504094
+#define WKUP_CTRLMMR_DBOUNCE_CFG6 0x04504098
+
void spl_board_init(void)
{
+ u32 val;
+
+ /* Set USB0 PHY core voltage to 0.85V */
+ val = readl(CTRLMMR_USB0_PHY_CTRL);
+ val &= ~(CORE_VOLTAGE);
+ writel(val, CTRLMMR_USB0_PHY_CTRL);
+
+ /* Set USB1 PHY core voltage to 0.85V */
+ val = readl(CTRLMMR_USB1_PHY_CTRL);
+ val &= ~(CORE_VOLTAGE);
+ writel(val, CTRLMMR_USB1_PHY_CTRL);
+
+ /* We have 32k crystal, so lets enable it */
+ val = readl(MCU_CTRL_LFXOSC_CTRL);
+ val &= ~(MCU_CTRL_LFXOSC_32K_DISABLE_VAL);
+ writel(val, MCU_CTRL_LFXOSC_CTRL);
+ /* Add any TRIM needed for the crystal here.. */
+ /* Make sure to mux up to take the SoC 32k from the crystal */
+ writel(MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL,
+ MCU_CTRL_DEVICE_CLKOUT_32K_CTRL);
+
+ /* Setup debounce conf registers - arbitrary values. Times are approx */
+ /* 1.9ms debounce @ 32k */
+ writel(WKUP_CTRLMMR_DBOUNCE_CFG1, 0x1);
+ /* 5ms debounce @ 32k */
+ writel(WKUP_CTRLMMR_DBOUNCE_CFG2, 0x5);
+ /* 20ms debounce @ 32k */
+ writel(WKUP_CTRLMMR_DBOUNCE_CFG3, 0x14);
+ /* 46ms debounce @ 32k */
+ writel(WKUP_CTRLMMR_DBOUNCE_CFG4, 0x18);
+ /* 100ms debounce @ 32k */
+ writel(WKUP_CTRLMMR_DBOUNCE_CFG5, 0x1c);
+ /* 156ms debounce @ 32k */
+ writel(WKUP_CTRLMMR_DBOUNCE_CFG6, 0x1f);
+
video_setup();
enable_caches();
if (IS_ENABLED(CONFIG_SPL_SPLASH_SCREEN) && IS_ENABLED(CONFIG_SPL_BMP))