Re: [PATCH] ARM: beaglebone: add delay in lowlevel.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Konsti,

On Tue, Jan 07, 2025 at 04:01:58PM +0100, Konstantin Kletschke wrote:
> Some Beaglebone Black devices are not able to cope with a warm start.
> When system is powered up and booted hitting reset button (S1) or
> issuing "reset" at barebox prompt the new instance of first stage gets
> stuck after PLL init.
> 
> Adding a delay of ~1.8ms in lowlevel.c after PLL init solves this.
> 
> Signed-off-by: Konstantin Kletschke <konstantin.kletschke@xxxxxxxxxxxxx>
> ---
>  arch/arm/boards/beaglebone/lowlevel.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/boards/beaglebone/lowlevel.c b/arch/arm/boards/beaglebone/lowlevel.c
> index 5dc49dfaaf..ccae1d1122 100644
> --- a/arch/arm/boards/beaglebone/lowlevel.c
> +++ b/arch/arm/boards/beaglebone/lowlevel.c
> @@ -97,6 +97,12 @@ extern char __dtb_z_am335x_boneblack_start[];
>  extern char __dtb_z_am335x_bone_common_start[];
>  extern char __dtb_z_am335x_bone_start[];
> 
> +static void __udelay(int us)
> +{
> +        volatile int i;
> +       for (i = 0; i < us * 3; i++);
> +}
> +
>  /**
>   * @brief The basic entry point for board initialization.
>   *
> @@ -135,6 +141,7 @@ static noinline int beaglebone_sram_init(void)
>         am33xx_enable_uart0_pin_mux();
>         omap_debug_ll_init();
>         putc_ll('>');
> +       __udelay(1000); // Adding delay of 1.8ms

Calling udelay(1000) and adding a comment saying it delays 1.8ms looks
inconsistent. Maybe better count up to 2 in __udelay() above which makes
it more accurate and then call __udelay(2000) if necessary.

Drop the comment, because it's obvious what the delay does. Better add a
comment why you are doing so (i.e. copy parts of the commit message as
comment).

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux