Skip to content

Commit 70eb23d

Browse files
kwachowspopcornmix
authored andcommitted
accel/ivpu: Update power island delays
commit 88bdd16 upstream. Apply Hardware Architecture Specification compatible delays for main island power delivery for 50xx and above. Signed-off-by: Karol Wachowski <[email protected]> Signed-off-by: Maciej Falkowski <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Jacek Lawrynowicz <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9c907db commit 70eb23d

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

drivers/accel/ivpu/ivpu_hw_40xx_reg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115

116116
#define VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY 0x00030068u
117117
#define VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY_POST_DLY_MASK GENMASK(7, 0)
118+
#define VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY_POST1_DLY_MASK GENMASK(15, 8)
119+
#define VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY_POST2_DLY_MASK GENMASK(23, 16)
118120

119121
#define VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY 0x0003006cu
120122
#define VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY_STATUS_DLY_MASK GENMASK(7, 0)

drivers/accel/ivpu/ivpu_hw_ip.c

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
#include "ivpu_hw.h"
99
#include "ivpu_hw_37xx_reg.h"
1010
#include "ivpu_hw_40xx_reg.h"
11+
#include "ivpu_hw_btrs.h"
1112
#include "ivpu_hw_ip.h"
1213
#include "ivpu_hw_reg_io.h"
1314
#include "ivpu_mmu.h"
1415
#include "ivpu_pm.h"
1516

16-
#define PWR_ISLAND_EN_POST_DLY_FREQ_DEFAULT 0
17-
#define PWR_ISLAND_EN_POST_DLY_FREQ_HIGH 18
18-
#define PWR_ISLAND_STATUS_DLY_FREQ_DEFAULT 3
19-
#define PWR_ISLAND_STATUS_DLY_FREQ_HIGH 46
2017
#define PWR_ISLAND_STATUS_TIMEOUT_US (5 * USEC_PER_MSEC)
2118

2219
#define TIM_SAFE_ENABLE 0xf1d0dead
@@ -268,20 +265,15 @@ void ivpu_hw_ip_idle_gen_disable(struct ivpu_device *vdev)
268265
idle_gen_drive_40xx(vdev, false);
269266
}
270267

271-
static void pwr_island_delay_set_50xx(struct ivpu_device *vdev)
268+
static void
269+
pwr_island_delay_set_50xx(struct ivpu_device *vdev, u32 post, u32 post1, u32 post2, u32 status)
272270
{
273-
u32 val, post, status;
274-
275-
if (vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_DEFAULT) {
276-
post = PWR_ISLAND_EN_POST_DLY_FREQ_DEFAULT;
277-
status = PWR_ISLAND_STATUS_DLY_FREQ_DEFAULT;
278-
} else {
279-
post = PWR_ISLAND_EN_POST_DLY_FREQ_HIGH;
280-
status = PWR_ISLAND_STATUS_DLY_FREQ_HIGH;
281-
}
271+
u32 val;
282272

283273
val = REGV_RD32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY);
284274
val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST_DLY, post, val);
275+
val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST1_DLY, post1, val);
276+
val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST2_DLY, post2, val);
285277
REGV_WR32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, val);
286278

287279
val = REGV_RD32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY);
@@ -686,13 +678,36 @@ static void dpu_active_drive_37xx(struct ivpu_device *vdev, bool enable)
686678
REGV_WR32(VPU_37XX_HOST_SS_AON_DPU_ACTIVE, val);
687679
}
688680

681+
static void pwr_island_delay_set(struct ivpu_device *vdev)
682+
{
683+
bool high = vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH;
684+
u32 post, post1, post2, status;
685+
686+
if (ivpu_hw_ip_gen(vdev) < IVPU_HW_IP_50XX)
687+
return;
688+
689+
switch (ivpu_device_id(vdev)) {
690+
case PCI_DEVICE_ID_PTL_P:
691+
post = high ? 18 : 0;
692+
post1 = 0;
693+
post2 = 0;
694+
status = high ? 46 : 3;
695+
break;
696+
697+
default:
698+
dump_stack();
699+
ivpu_err(vdev, "Unknown device ID\n");
700+
return;
701+
}
702+
703+
pwr_island_delay_set_50xx(vdev, post, post1, post2, status);
704+
}
705+
689706
int ivpu_hw_ip_pwr_domain_enable(struct ivpu_device *vdev)
690707
{
691708
int ret;
692709

693-
if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_50XX)
694-
pwr_island_delay_set_50xx(vdev);
695-
710+
pwr_island_delay_set(vdev);
696711
pwr_island_enable(vdev);
697712

698713
ret = wait_for_pwr_island_status(vdev, 0x1);

0 commit comments

Comments
 (0)