Skip to content

Commit 6c3f2f9

Browse files
kwachowssgruszka
authored andcommitted
accel/ivpu/40xx: Ensure clock resource ownership Ack before Power-Up
We need to wait for the CLOCK_RESOURCE_OWN_ACK bit to be set after configuring the workpoint. This step ensures that the VPU microcontroller clock is actively toggling and ready for operation. Previously, we relied solely on the READY bit in the VPU_STATUS register, which indicated the completion of the workpoint download. However, this approach was insufficient, as the READY bit could be set while the device was still running on a sideband clock until the PLL locked. To guarantee that the PLL is locked and the device is running on the main clock source, we now wait for the CLOCK_RESOURCE_OWN_ACK before proceeding with the remainder of the power-up sequence. Fixes: 79cdc56 ("accel/ivpu: Add initial support for VPU 4") Signed-off-by: Karol Wachowski <[email protected]> Reviewed-by: Stanislaw Gruszka <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Signed-off-by: Stanislaw Gruszka <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0026525 commit 6c3f2f9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/accel/ivpu/ivpu_hw_40xx.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ static int ivpu_pll_wait_for_status_ready(struct ivpu_device *vdev)
196196
return REGB_POLL_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, READY, 1, PLL_TIMEOUT_US);
197197
}
198198

199+
static int ivpu_wait_for_clock_own_resource_ack(struct ivpu_device *vdev)
200+
{
201+
if (ivpu_is_simics(vdev))
202+
return 0;
203+
204+
return REGB_POLL_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, CLOCK_RESOURCE_OWN_ACK, 1, TIMEOUT_US);
205+
}
206+
199207
static void ivpu_pll_init_frequency_ratios(struct ivpu_device *vdev)
200208
{
201209
struct ivpu_hw_info *hw = vdev->hw;
@@ -556,6 +564,12 @@ static int ivpu_boot_pwr_domain_enable(struct ivpu_device *vdev)
556564
{
557565
int ret;
558566

567+
ret = ivpu_wait_for_clock_own_resource_ack(vdev);
568+
if (ret) {
569+
ivpu_err(vdev, "Timed out waiting for clock own resource ACK\n");
570+
return ret;
571+
}
572+
559573
ivpu_boot_pwr_island_trickle_drive(vdev, true);
560574
ivpu_boot_pwr_island_drive(vdev, true);
561575

drivers/accel/ivpu/ivpu_hw_40xx_reg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
#define VPU_40XX_BUTTRESS_VPU_STATUS_READY_MASK BIT_MASK(0)
7171
#define VPU_40XX_BUTTRESS_VPU_STATUS_IDLE_MASK BIT_MASK(1)
7272
#define VPU_40XX_BUTTRESS_VPU_STATUS_DUP_IDLE_MASK BIT_MASK(2)
73+
#define VPU_40XX_BUTTRESS_VPU_STATUS_CLOCK_RESOURCE_OWN_ACK_MASK BIT_MASK(6)
74+
#define VPU_40XX_BUTTRESS_VPU_STATUS_POWER_RESOURCE_OWN_ACK_MASK BIT_MASK(7)
7375
#define VPU_40XX_BUTTRESS_VPU_STATUS_PERF_CLK_MASK BIT_MASK(11)
7476
#define VPU_40XX_BUTTRESS_VPU_STATUS_DISABLE_CLK_RELINQUISH_MASK BIT_MASK(12)
7577

0 commit comments

Comments
 (0)