soc: ambiq: enable the TPIU clock source

This commit enables the TPIU clock source in Apollo3 and
Apollo4 soc initialization if LOG_BACKEND_SWO is used.

Signed-off-by: Aaron Ye <aye@ambiq.com>
This commit is contained in:
Aaron Ye 2024-10-30 14:48:15 +08:00 committed by Anas Nashif
parent fe3c0ecb53
commit f7b2638165
2 changed files with 12 additions and 0 deletions

View File

@ -28,4 +28,10 @@ void soc_early_init_hook(void)
#ifdef CONFIG_PM #ifdef CONFIG_PM
ambiq_power_init(); ambiq_power_init();
#endif #endif
#ifdef CONFIG_LOG_BACKEND_SWO
/* Select HFRC/8 (6MHz) for the TPIU clock source */
MCUCTRL->TPIUCTRL_b.CLKSEL = MCUCTRL_TPIUCTRL_CLKSEL_HFRCDIV8;
MCUCTRL->TPIUCTRL_b.ENABLE = MCUCTRL_TPIUCTRL_ENABLE_EN;
#endif
} }

View File

@ -23,4 +23,10 @@ void soc_early_init_hook(void)
#ifdef CONFIG_PM #ifdef CONFIG_PM
ambiq_power_init(); ambiq_power_init();
#endif #endif
#ifdef CONFIG_LOG_BACKEND_SWO
/* Select HFRC 48MHz for the TPIU clock source */
MCUCTRL->DBGCTRL_b.CM4CLKSEL = MCUCTRL_DBGCTRL_CM4CLKSEL_HFRC48;
MCUCTRL->DBGCTRL_b.CM4TPIUENABLE = MCUCTRL_DBGCTRL_CM4TPIUENABLE_EN;
#endif
} }