From 1c0602435416850df0f676d3e76cc55b709a37c2 Mon Sep 17 00:00:00 2001 From: Andrei Warkentin Date: Thu, 27 Oct 2022 14:53:14 -0500 Subject: [PATCH] jh7100: deal with https://github.com/starfive-tech/u-boot/issues/35 I replaced the empty loop (which would always be optimized out) with a udelay(100). Signed-off-by: Andrei Warkentin --- board/starfive/jh7100/jh_ptc.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/board/starfive/jh7100/jh_ptc.c b/board/starfive/jh7100/jh_ptc.c index 54bb5fe19fd..de22c9daab4 100644 --- a/board/starfive/jh7100/jh_ptc.c +++ b/board/starfive/jh7100/jh_ptc.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -136,16 +137,12 @@ static void ptc_start(uint32_t num) /* set GPIO PIN MUX */ static void ptc_pinmux_init(uint32_t num) { - uint32_t i = 0; - #if defined(CONFIG_JH_STARLIGHT) if(num == 0) { /* GPIOB7 */ SET_GPIO_7_dout_pwm_pad_out_bit0; SET_GPIO_7_doen_LOW; - while(0) { - for(i=0; i<100; i++) ; - SET_GPIO_7_dout_HIGH; - } + udelay(100); + SET_GPIO_7_dout_HIGH; } else if(num == 1) { /* GPIOB5 */ SET_GPIO_5_dout_pwm_pad_out_bit1; SET_GPIO_5_doen_LOW; @@ -157,11 +154,9 @@ static void ptc_pinmux_init(uint32_t num) if(num == 0) { SET_GPIO_29_dout_pwm_pad_out_bit0; SET_GPIO_29_doen_LOW; - while(0) { - SET_GPIO_29_dout_LOW; - for(i=0; i<100; i++) ; - SET_GPIO_29_dout_HIGH; - } + SET_GPIO_29_dout_LOW; + udelay(100); + SET_GPIO_29_dout_HIGH; } else if(num == 1) { SET_GPIO_30_dout_pwm_pad_out_bit1; SET_GPIO_30_doen_LOW;