[PATCH v2 08/11] socfpga: arria10: Replace delays with busy waiting in cm_full_cfg

Chee, Tien Fong tien.fong.chee at intel.com
Thu Jun 16 09:58:15 CEST 2022


Hi Pawel,

> -----Original Message-----
> From: Paweł Anikiel <pan at semihalf.com>
> Sent: Thursday, 26 May, 2022 10:37 PM
> To: Vasut, Marek <marex at denx.de>; simon.k.r.goldschmidt at gmail.com;
> Chee, Tien Fong <tien.fong.chee at intel.com>; michal.simek at xilinx.com
> Cc: u-boot at lists.denx.de; sjg at chromium.org; festevam at denx.de;
> jagan at amarulasolutions.com; andre.przywara at arm.com; Armstrong, Neil
> <narmstrong at baylibre.com>; pbrobinson at gmail.com;
> tharvey at gateworks.com; paul.liu at linaro.org; christianshewitt at gmail.com;
> adrian.fiergolski at fastree3d.com; marek.behun at nic.cz; Denk, Wolfgang
> <wd at denx.de>; Lim, Elly Siew Chin <elly.siew.chin.lim at intel.com>;
> mw at semihalf.com; Paweł Anikiel <pan at semihalf.com>
> Subject: [PATCH v2 08/11] socfpga: arria10: Replace delays with busy waiting
> in cm_full_cfg
> 
> Using udelay while the clocks aren't fully configured causes the timer system
> to save the wrong clock rate. Use sdelay and wait_on_value instead (the
> values used in these functions were found experimentally).
> 
> Signed-off-by: Paweł Anikiel <pan at semihalf.com>
> ---
>  arch/arm/mach-socfpga/clock_manager.c              |  7 ++++---
>  arch/arm/mach-socfpga/clock_manager_arria10.c      | 12 ++++++------
>  arch/arm/mach-socfpga/include/mach/clock_manager.h |  4 ++++
>  3 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/clock_manager.c b/arch/arm/mach-
> socfpga/clock_manager.c
> index 9e645a4253..c9bd4859f7 100644
> --- a/arch/arm/mach-socfpga/clock_manager.c
> +++ b/arch/arm/mach-socfpga/clock_manager.c
> @@ -39,9 +39,10 @@ void cm_wait_for_lock(u32 mask)
>  /* function to poll in the fsm busy bit */  int cm_wait_for_fsm(void)  {
> -	return wait_for_bit_le32((const void *)(socfpga_get_clkmgr_addr()
> +
> -				 CLKMGR_STAT), CLKMGR_STAT_BUSY, false,
> 20000,
> -				 false);
> +	void *reg = (void *)(socfpga_get_clkmgr_addr() + CLKMGR_STAT);
> +
> +	/* 20s timeout */
> +	return wait_on_value(CLKMGR_STAT_BUSY, 0, reg, 100000000);

This change breaking the socfpga_stratix10_atf_defconfig build(all aarch64 socfpga are impacted), can you fix it ?

aarch64-none-linux-gnu-ld.bfd: arch/arm/mach-socfpga/clock_manager.o: in function `cm_wait_for_fsm':
/nfs/png/disks/swuser_work_tfchee/uboot_mainline/denx/u-boot/arch/arm/mach-socfpga/clock_manager.c:45: undefined reference to `wait_on_value'
/nfs/png/disks/swuser_work_tfchee/uboot_mainline/denx/u-boot/arch/arm/mach-socfpga/clock_manager.c:45:(.text.cm_wait_for_fsm+0x24): relocation truncated to fit: R_AARCH64_JUMP26 against undefined symbol `wait_on_value'
make[1]: *** [scripts/Makefile.spl:525: spl/u-boot-spl] Error 1
make: *** [Makefile:2106: spl/u-boot-spl] Error 2
aarch64-none-linux-gnu-objcopy: 'spl/u-boot-spl-dtb.bin': No such file

Thanks.

Best regards,
Tien Fong.


More information about the U-Boot mailing list