[PATCH v2 5/5] platform: generic: spacemit: k3: add platform support

Troy Mitchell troy.mitchell at linux.spacemit.com
Thu Aug 20 18:55:25 PDT 2026


> +       /* Clear core and cluster power-down votes so WFI does not trigger power-down. */
> +       for (i = 0; i < PLATFORM_MAX_CPUS; i++)
> +               spacemit_disable_pwrdown_core(i);
>
> [...]
>
> +       for (i = 1; i < array_size(core_wakeup_reg); i++)
> +               writel(1 << i, (void *)(unsigned long)core_wakeup_reg[i]);
>
> [...]
>
> +       for (i = 1; i < PLATFORM_MAX_CPUS; i++) {
> +               u64 deadline = sbi_timer_value_after_msecs(HART_WFI_TIMEOUT_MS);
> +
> +               while (!(readl((void *)(unsigned long)wfi_status_reg[i]) &
> +                        wfi_status_mask[i])) {
> +                       /* ... */
> +               }
> +       }
>
> The operations in these loops should be in a .hart_start function of an HSM
> driver, not run in a loop at cold boot. You will need to do this anyway to
> support power management, and it makes cold boot faster.

Agreed. I will add a K3 HSM .hart_start callback which clears the target
hart's core and cluster power-down votes and wakes only that hart. The
cold-boot path will retain the one-time boot-vector and CCI setup, but
will no longer wake all secondary harts or wait for them to enter WFI.
This also removes the WFI status tables and timeout.

> +static bool spacemit_cold_boot_allowed(u32 hartid)
> +{
> +       return !hartid;
> +}
>
> If harts 1-15 are not powered on until spacemit_k3_pre_init(), this callback
> won't do anything, because hart 0 is the only hart running at this point.

Right. Since only hart 0 is running before platform early init, the
callback is redundant. I will remove it and its assignment.

                                            - Troy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 248 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/opensbi/attachments/20260821/e1444bda/attachment.sig>


More information about the opensbi mailing list