mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-24 22:05:40 +00:00
feat(nxp-clk): enable UART clock
Before this change, the internal oscillator clocked the UART with a frequency of 48MHz. With the necessary support added, the UART clock rate is increased to 125MHz by changing the clock source from FIRC to PERIPH PLL PHI3. Change-Id: I3160dc6860ebf441c9bea8eaf9d8d12de48bd647 Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
This commit is contained in:
parent
8653352ad7
commit
e4462dae81
4 changed files with 49 additions and 4 deletions
|
@ -58,6 +58,13 @@ static struct s32cc_clkmux cgm0_mux0 =
|
||||||
S32CC_CLK_ARM_PLL_DFS1, 0, 0, 0);
|
S32CC_CLK_ARM_PLL_DFS1, 0, 0, 0);
|
||||||
static struct s32cc_clk cgm0_mux0_clk = S32CC_MODULE_CLK(cgm0_mux0);
|
static struct s32cc_clk cgm0_mux0_clk = S32CC_MODULE_CLK(cgm0_mux0);
|
||||||
|
|
||||||
|
static struct s32cc_clkmux cgm0_mux8 =
|
||||||
|
S32CC_SHARED_CLKMUX_INIT(S32CC_CGM0, 8, 3,
|
||||||
|
S32CC_CLK_FIRC,
|
||||||
|
S32CC_CLK_PERIPH_PLL_PHI3,
|
||||||
|
S32CC_CLK_FXOSC, 0, 0);
|
||||||
|
static struct s32cc_clk cgm0_mux8_clk = S32CC_MODULE_CLK(cgm0_mux8);
|
||||||
|
|
||||||
/* XBAR */
|
/* XBAR */
|
||||||
static struct s32cc_clk xbar_2x_clk =
|
static struct s32cc_clk xbar_2x_clk =
|
||||||
S32CC_CHILD_CLK(cgm0_mux0_clk, 48 * MHZ, 800 * MHZ);
|
S32CC_CHILD_CLK(cgm0_mux0_clk, 48 * MHZ, 800 * MHZ);
|
||||||
|
@ -82,6 +89,14 @@ static struct s32cc_fixed_div xbar_div12 =
|
||||||
static struct s32cc_clk xbar_div6_clk =
|
static struct s32cc_clk xbar_div6_clk =
|
||||||
S32CC_FREQ_MODULE_CLK(xbar_div12, 4 * MHZ, 66666666);
|
S32CC_FREQ_MODULE_CLK(xbar_div12, 4 * MHZ, 66666666);
|
||||||
|
|
||||||
|
/* Linflex */
|
||||||
|
static struct s32cc_clk linflex_baud_clk =
|
||||||
|
S32CC_CHILD_CLK(cgm0_mux8_clk, 19200, 133333333);
|
||||||
|
static struct s32cc_fixed_div linflex_div =
|
||||||
|
S32CC_FIXED_DIV_INIT(linflex_baud_clk, 2);
|
||||||
|
static struct s32cc_clk linflex_clk =
|
||||||
|
S32CC_FREQ_MODULE_CLK(linflex_div, 9600, 66666666);
|
||||||
|
|
||||||
/* MC_CGM1 */
|
/* MC_CGM1 */
|
||||||
static struct s32cc_clkmux cgm1_mux0 =
|
static struct s32cc_clkmux cgm1_mux0 =
|
||||||
S32CC_SHARED_CLKMUX_INIT(S32CC_CGM1, 0, 3,
|
S32CC_SHARED_CLKMUX_INIT(S32CC_CGM1, 0, 3,
|
||||||
|
@ -143,7 +158,7 @@ static struct s32cc_clk_array s32cc_hw_clocks = {
|
||||||
.n_clks = ARRAY_SIZE(s32cc_hw_clk_list),
|
.n_clks = ARRAY_SIZE(s32cc_hw_clk_list),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s32cc_clk *s32cc_arch_clk_list[15] = {
|
static struct s32cc_clk *s32cc_arch_clk_list[18] = {
|
||||||
/* ARM PLL */
|
/* ARM PLL */
|
||||||
[S32CC_CLK_ID(S32CC_CLK_ARM_PLL_MUX)] = &arm_pll_mux_clk,
|
[S32CC_CLK_ID(S32CC_CLK_ARM_PLL_MUX)] = &arm_pll_mux_clk,
|
||||||
[S32CC_CLK_ID(S32CC_CLK_ARM_PLL_VCO)] = &arm_pll_vco_clk,
|
[S32CC_CLK_ID(S32CC_CLK_ARM_PLL_VCO)] = &arm_pll_vco_clk,
|
||||||
|
@ -152,6 +167,7 @@ static struct s32cc_clk *s32cc_arch_clk_list[15] = {
|
||||||
[S32CC_CLK_ID(S32CC_CLK_PERIPH_PLL_VCO)] = &periph_pll_vco_clk,
|
[S32CC_CLK_ID(S32CC_CLK_PERIPH_PLL_VCO)] = &periph_pll_vco_clk,
|
||||||
/* MC_CGM0 */
|
/* MC_CGM0 */
|
||||||
[S32CC_CLK_ID(S32CC_CLK_MC_CGM0_MUX0)] = &cgm0_mux0_clk,
|
[S32CC_CLK_ID(S32CC_CLK_MC_CGM0_MUX0)] = &cgm0_mux0_clk,
|
||||||
|
[S32CC_CLK_ID(S32CC_CLK_MC_CGM0_MUX8)] = &cgm0_mux8_clk,
|
||||||
/* XBAR */
|
/* XBAR */
|
||||||
[S32CC_CLK_ID(S32CC_CLK_XBAR_2X)] = &xbar_2x_clk,
|
[S32CC_CLK_ID(S32CC_CLK_XBAR_2X)] = &xbar_2x_clk,
|
||||||
[S32CC_CLK_ID(S32CC_CLK_XBAR)] = &xbar_clk,
|
[S32CC_CLK_ID(S32CC_CLK_XBAR)] = &xbar_clk,
|
||||||
|
@ -165,6 +181,9 @@ static struct s32cc_clk *s32cc_arch_clk_list[15] = {
|
||||||
[S32CC_CLK_ID(S32CC_CLK_A53_CORE)] = &a53_core_clk,
|
[S32CC_CLK_ID(S32CC_CLK_A53_CORE)] = &a53_core_clk,
|
||||||
[S32CC_CLK_ID(S32CC_CLK_A53_CORE_DIV2)] = &a53_core_div2_clk,
|
[S32CC_CLK_ID(S32CC_CLK_A53_CORE_DIV2)] = &a53_core_div2_clk,
|
||||||
[S32CC_CLK_ID(S32CC_CLK_A53_CORE_DIV10)] = &a53_core_div10_clk,
|
[S32CC_CLK_ID(S32CC_CLK_A53_CORE_DIV10)] = &a53_core_div10_clk,
|
||||||
|
/* Linflex */
|
||||||
|
[S32CC_CLK_ID(S32CC_CLK_LINFLEX)] = &linflex_clk,
|
||||||
|
[S32CC_CLK_ID(S32CC_CLK_LINFLEX_BAUD)] = &linflex_baud_clk,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s32cc_clk_array s32cc_arch_clocks = {
|
static struct s32cc_clk_array s32cc_arch_clocks = {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <drivers/clk.h>
|
#include <drivers/clk.h>
|
||||||
|
#include <platform_def.h>
|
||||||
#include <s32cc-clk-drv.h>
|
#include <s32cc-clk-drv.h>
|
||||||
#include <s32cc-clk-ids.h>
|
#include <s32cc-clk-ids.h>
|
||||||
#include <s32cc-clk-utils.h>
|
#include <s32cc-clk-utils.h>
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
#define S32CC_A53_FREQ (1U * GHZ)
|
#define S32CC_A53_FREQ (1U * GHZ)
|
||||||
#define S32CC_XBAR_2X_FREQ (800U * MHZ)
|
#define S32CC_XBAR_2X_FREQ (800U * MHZ)
|
||||||
#define S32CC_PERIPH_PLL_VCO_FREQ (2U * GHZ)
|
#define S32CC_PERIPH_PLL_VCO_FREQ (2U * GHZ)
|
||||||
#define S32CC_PERIPH_PLL_PHI3_FREQ (125U * MHZ)
|
#define S32CC_PERIPH_PLL_PHI3_FREQ UART_CLOCK_HZ
|
||||||
|
|
||||||
static int enable_fxosc_clk(void)
|
static int enable_fxosc_clk(void)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +147,23 @@ static int enable_xbar_clk(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int enable_uart_clk(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = clk_set_parent(S32CC_CLK_MC_CGM0_MUX8, S32CC_CLK_PERIPH_PLL_PHI3);
|
||||||
|
if (ret != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = clk_enable(S32CC_CLK_LINFLEX_BAUD);
|
||||||
|
if (ret != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int s32cc_init_early_clks(void)
|
int s32cc_init_early_clks(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -177,5 +195,10 @@ int s32cc_init_early_clks(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = enable_uart_clk();
|
||||||
|
if (ret != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,8 @@
|
||||||
#define S32CC_CLK_PERIPH_PLL_MUX S32CC_ARCH_CLK(13)
|
#define S32CC_CLK_PERIPH_PLL_MUX S32CC_ARCH_CLK(13)
|
||||||
#define S32CC_CLK_PERIPH_PLL_VCO S32CC_ARCH_CLK(14)
|
#define S32CC_CLK_PERIPH_PLL_VCO S32CC_ARCH_CLK(14)
|
||||||
|
|
||||||
|
#define S32CC_CLK_MC_CGM0_MUX8 S32CC_ARCH_CLK(15)
|
||||||
|
#define S32CC_CLK_LINFLEX_BAUD S32CC_ARCH_CLK(16)
|
||||||
|
#define S32CC_CLK_LINFLEX S32CC_ARCH_CLK(17)
|
||||||
|
|
||||||
#endif /* S32CC_CLK_IDS_H */
|
#endif /* S32CC_CLK_IDS_H */
|
||||||
|
|
|
@ -54,8 +54,7 @@
|
||||||
/* Console settings */
|
/* Console settings */
|
||||||
#define UART_BASE UL(0x401C8000)
|
#define UART_BASE UL(0x401C8000)
|
||||||
#define UART_BAUDRATE U(115200)
|
#define UART_BAUDRATE U(115200)
|
||||||
/* FIRC clock */
|
#define UART_CLOCK_HZ U(125000000)
|
||||||
#define UART_CLOCK_HZ U(48000000)
|
|
||||||
|
|
||||||
#define S32G_FIP_BASE UL(0x34100000)
|
#define S32G_FIP_BASE UL(0x34100000)
|
||||||
#define S32G_FIP_SIZE UL(0x100000)
|
#define S32G_FIP_SIZE UL(0x100000)
|
||||||
|
|
Loading…
Add table
Reference in a new issue