[PATCH] drivers: clk: agilex: Correct EMAC clock source selection

Chee, Tien Fong tien.fong.chee at altera.com
Mon Aug 25 10:28:32 CEST 2025


Hi Naresh,

> -----Original Message-----
> From: Ravulapalli, Naresh Kumar <naresh.kumar.ravulapalli at altera.com>
> Sent: Tuesday, August 19, 2025 12:38 PM
> To: u-boot at lists.denx.de
> Cc: Marek Vasut <marek.vasut at mailbox.org>; Simon Goldschmidt
> <simon.k.r.goldschmidt at gmail.com>; Lukasz Majewski <lukma at denx.de>;
> Chee, Tien Fong <tien.fong.chee at altera.com>; Sean Anderson --cc=Tom Rini
> <seanga2 at gmail.comtrini@konsulko.com>; Ravulapalli, Naresh Kumar
> <naresh.kumar.ravulapalli at altera.com>
> Subject: [PATCH] drivers: clk: agilex: Correct EMAC clock source selection
> 
> Fix the incorrect bit masking and bit shift used to compute EMAC control
> which in turn is used to select EMAC clock from EMAC source A or B.
> 
> Signed-off-by: Naresh Kumar Ravulapalli
> <nareshkumar.ravulapalli at altera.com>
> ---
>  drivers/clk/altera/clk-agilex.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/clk/altera/clk-agilex.c b/drivers/clk/altera/clk-agilex.c
> index e1ddd02f356..967d8a41272 100644
> --- a/drivers/clk/altera/clk-agilex.c
> +++ b/drivers/clk/altera/clk-agilex.c
> @@ -1,6 +1,7 @@
> -// SPDX-License-Identifier: GPL-2.0
> +// SPDX-License-Identifier: GPL-2.0+
>  /*
> - * Copyright (C) 2019 Intel Corporation <www.intel.com>
> + * Copyright (C) 2019-2023 Intel Corporation <www.intel.com>
> + * Copyright (C) 2025 Altera Corporation <www.altera.com>
>   */
> 
>  #include <log.h>
> @@ -515,14 +516,14 @@ static u32 clk_get_emac_clk_hz(struct
> socfpga_clk_plat *plat, u32 emac_id)
>  	/* Get EMAC clock source */
>  	ctl = CM_REG_READL(plat, CLKMGR_PERPLL_EMACCTL);
>  	if (emac_id == AGILEX_EMAC0_CLK)
> -		ctl = (ctl >>
> CLKMGR_PERPLLGRP_EMACCTL_EMAC0SELB_OFFSET) &
> -		       CLKMGR_PERPLLGRP_EMACCTL_EMAC0SELB_MASK;
> +		ctl = (ctl &
> CLKMGR_PERPLLGRP_EMACCTL_EMAC0SELB_MASK) >>
> +		       CLKMGR_PERPLLGRP_EMACCTL_EMAC0SELB_OFFSET;
>  	else if (emac_id == AGILEX_EMAC1_CLK)

Using FIELD_GET()

[...]

Best regards,
Tien Fong


More information about the U-Boot mailing list