1 From d2753e049b571796bb7e9290c7740c772122a3b1 Mon Sep 17 00:00:00 2001
2 From: Vincent Chen <vincent.chen@sifive.com>
3 Date: Fri, 26 Mar 2021 14:10:02 +0800
4 Subject: [PATCH 11/16] board: sifive: Set LED's color to purple in the U-boot
7 Set LED's color to purple in the U-boot stage. Because there are still
8 some functions to be executed before board_early_init_f(), it means
9 the LED's is not changed to purple instantly when entering the U-boot
12 board/sifive/unmatched/unmatched.c | 14 ++++++++++++++
13 configs/sifive_unmatched_defconfig | 1 +
14 2 files changed, 15 insertions(+)
16 diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
17 index 9924da9..5183f7f 100644
18 --- a/board/sifive/unmatched/unmatched.c
19 +++ b/board/sifive/unmatched/unmatched.c
20 @@ -38,6 +38,7 @@ void pwm_device_init(void)
21 struct pwm_sifive_regs *pwm0, *pwm1;
22 pwm0 = (struct pwm_sifive_regs *)PWM0_BASE;
23 pwm1 = (struct pwm_sifive_regs *)PWM1_BASE;
24 +#ifdef CONFIG_SPL_BUILD
25 writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp0);
26 /* Set the 3-color PWM LEDs to yellow in SPL */
27 writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp1);
28 @@ -56,6 +57,19 @@ void pwm_device_init(void)
29 writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp2);
30 writel(PWM_CMP_ENABLE_VAL, (void *)&pwm1->cmp3);
31 writel(PWM_CFG_INIT, (void *)&pwm1->cfg);
33 + /* Set the 3-color PWM LEDs to purple in U-boot */
34 + writel(PWM_CMP_DISABLE_VAL, (void *)&pwm0->cmp1);
35 + writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp2);
36 + writel(PWM_CMP_ENABLE_VAL, (void *)&pwm0->cmp3);
41 +int board_early_init_f(void)
48 diff --git a/configs/sifive_unmatched_defconfig b/configs/sifive_unmatched_defconfig
49 index 4c26504..cf08955 100644
50 --- a/configs/sifive_unmatched_defconfig
51 +++ b/configs/sifive_unmatched_defconfig
52 @@ -40,3 +40,4 @@ CONFIG_USB=y
56 +CONFIG_BOARD_EARLY_INIT_F=y