|
@@ -263,15 +263,35 @@ static void dce_dmcu_setup_psr(struct dmcu *dmcu,
|
|
|
REG_UPDATE(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 1);
|
|
|
}
|
|
|
|
|
|
+static bool dce_is_dmcu_initialized(struct dmcu *dmcu)
|
|
|
+{
|
|
|
+ struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu);
|
|
|
+ unsigned int dmcu_uc_reset;
|
|
|
+
|
|
|
+ /* microcontroller is not running */
|
|
|
+ REG_GET(DMCU_STATUS, UC_IN_RESET, &dmcu_uc_reset);
|
|
|
+
|
|
|
+ /* DMCU is not running */
|
|
|
+ if (dmcu_uc_reset)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
static void dce_psr_wait_loop(
|
|
|
struct dmcu *dmcu,
|
|
|
unsigned int wait_loop_number)
|
|
|
{
|
|
|
struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu);
|
|
|
union dce_dmcu_psr_config_data_wait_loop_reg1 masterCmdData1;
|
|
|
+
|
|
|
if (dmcu->cached_wait_loop_number == wait_loop_number)
|
|
|
return;
|
|
|
|
|
|
+ /* DMCU is not running */
|
|
|
+ if (!dce_is_dmcu_initialized(dmcu))
|
|
|
+ return;
|
|
|
+
|
|
|
/* waitDMCUReadyForCmd */
|
|
|
REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 0, 1, 10000);
|
|
|
|
|
@@ -691,6 +711,14 @@ static void dcn10_get_psr_wait_loop(
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+static bool dcn10_is_dmcu_initialized(struct dmcu *dmcu)
|
|
|
+{
|
|
|
+ /* microcontroller is not running */
|
|
|
+ if (dmcu->dmcu_state != DMCU_RUNNING)
|
|
|
+ return false;
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
#endif
|
|
|
|
|
|
static const struct dmcu_funcs dce_funcs = {
|
|
@@ -700,7 +728,8 @@ static const struct dmcu_funcs dce_funcs = {
|
|
|
.setup_psr = dce_dmcu_setup_psr,
|
|
|
.get_psr_state = dce_get_dmcu_psr_state,
|
|
|
.set_psr_wait_loop = dce_psr_wait_loop,
|
|
|
- .get_psr_wait_loop = dce_get_psr_wait_loop
|
|
|
+ .get_psr_wait_loop = dce_get_psr_wait_loop,
|
|
|
+ .is_dmcu_initialized = dce_is_dmcu_initialized
|
|
|
};
|
|
|
|
|
|
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
|
|
@@ -711,7 +740,8 @@ static const struct dmcu_funcs dcn10_funcs = {
|
|
|
.setup_psr = dcn10_dmcu_setup_psr,
|
|
|
.get_psr_state = dcn10_get_dmcu_psr_state,
|
|
|
.set_psr_wait_loop = dcn10_psr_wait_loop,
|
|
|
- .get_psr_wait_loop = dcn10_get_psr_wait_loop
|
|
|
+ .get_psr_wait_loop = dcn10_get_psr_wait_loop,
|
|
|
+ .is_dmcu_initialized = dcn10_is_dmcu_initialized
|
|
|
};
|
|
|
#endif
|
|
|
|