Hi David,

Thank you for the patch.

I have tested this v2 patch on Filogic SoCs (MT7987/MT7988), and I can 
confirm that the issue regarding the clock usage before relocation 
(e.g., UART early console) is now fixed. The system boots up and works 
properly without the previous regression.

Please feel free to add my Tested-by tag:

Tested-by: Sam Shih <[email protected]>

Best regards,
Sam

On Thu, 2026-08-13 at 08:10 -0500, David Lechner wrote:
> Clear the MediaTek clock provider registry after relocation. This is
> necessary for a couple of reasons. If any clock probed before the
> relocation, the registry will contain a pointer to pre-relocation
> memory. Also, all drivers reprobe after relocation, so even if we
> had a valid pointer, it would be to a clock provider that had not
> been
> reprobed yet. Clearing the registry ensures that all clock providers
> are re-registered when they are reprobed after relocation.
> 
> Reported-by: Sam Shih <[email protected]>
> Fixes: 8ef0ad4c7a6d ("clk: mediatek: use registered provider for
> parent lookup")
> Signed-off-by: David Lechner <[email protected]>
> ---
>  drivers/clk/mediatek/clk-mtk.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/clk/mediatek/clk-mtk.c
> b/drivers/clk/mediatek/clk-mtk.c
> index 13c248c93a6..849e8a196e5 100644
> --- a/drivers/clk/mediatek/clk-mtk.c
> +++ b/drivers/clk/mediatek/clk-mtk.c
> @@ -1130,3 +1130,21 @@ int mtk_clk_probe(struct udevice *dev)
>  
>       return mtk_clk_tree_register_provider(dev, tree);
>  }
> +
> +static int mtk_clock_reset_registry(void)
> +{
> +     /*
> +      * When U-Boot is relocated, the static clock provider
> registry is no
> +      * longer valid since it contains pointers to the old U-Boot
> memory.
> +      * Furthermore, all devices are re-probed after relocation.
> Therefore,
> +      * we need to reset the registry before any devices can
> probe after
> +      * relocation.
> +      */
> +
> +     for (int i = 0; i < ARRAY_SIZE(mtk_clk_providers); i++)
> +             mtk_clk_providers[i] = NULL;
> +
> +     return 0;
> +}
> +
> +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, mtk_clock_reset_registry);
> 
> ---
> base-commit: 0b581a9612e46310ee52bf8359165950d38b2a2b
> change-id: 20260813-mtk-clk-fix-reprobe-regression-6ac0c072600b
> 
> Best regards,
> --  
> David Lechner <[email protected]>
> 

Reply via email to