|
@@ -48,7 +48,6 @@ struct cvp_tzbsp_memprot {
|
|
|
u32 cp_nonpixel_size;
|
|
|
};
|
|
|
|
|
|
-#define TZBSP_PIL_SET_STATE 0xA
|
|
|
#define TZBSP_CVP_PAS_ID 26
|
|
|
|
|
|
/* Poll interval in uS */
|
|
@@ -56,8 +55,8 @@ struct cvp_tzbsp_memprot {
|
|
|
|
|
|
enum tzbsp_subsys_state {
|
|
|
TZ_SUBSYS_STATE_SUSPEND = 0,
|
|
|
- TZ_SUBSYS_STATE_RESUME = 1,
|
|
|
- TZ_SUBSYS_STATE_RESTORE_THRESHOLD = 2,
|
|
|
+ TZ_SUBSYS_STATE_RESUME = 1,
|
|
|
+ TZ_SUBSYS_STATE_RESTORE_THRESHOLD = 2,
|
|
|
};
|
|
|
|
|
|
const struct msm_cvp_gov_data CVP_DEFAULT_BUS_VOTE = {
|
|
@@ -84,6 +83,7 @@ static bool __is_session_valid(struct iris_hfi_device *device,
|
|
|
static int __iface_cmdq_write(struct iris_hfi_device *device,
|
|
|
void *pkt);
|
|
|
static int __load_fw(struct iris_hfi_device *device);
|
|
|
+static int __power_on_init(struct iris_hfi_device *device);
|
|
|
static void __unload_fw(struct iris_hfi_device *device);
|
|
|
static int __tzbsp_set_cvp_state(enum tzbsp_subsys_state state);
|
|
|
static int __enable_subcaches(struct iris_hfi_device *device);
|
|
@@ -1075,6 +1075,70 @@ static inline void check_tensilica_in_reset(struct iris_hfi_device *device)
|
|
|
X2RPMh, wait_mode, fal10_veto);
|
|
|
}
|
|
|
|
|
|
+static const char boot_states[0x40][32] = {
|
|
|
+ "NOT INIT",
|
|
|
+ "RST_START",
|
|
|
+ "INIT_MEMCTL",
|
|
|
+ "INTENABLE_RST",
|
|
|
+ "LITBASE_RST",
|
|
|
+ "PREFETCH_EN",
|
|
|
+ "MPU_INIT",
|
|
|
+ "CTRL_INIT_READ",
|
|
|
+ "MEMCTL_L1_FIX",
|
|
|
+ "RESTORE_EXTRA_NW",
|
|
|
+ "CORE_RESTORE",
|
|
|
+ "COLD_BOOT",
|
|
|
+ "DISABLE_CACHE",
|
|
|
+ "BEFORE_MPU_C",
|
|
|
+ "RET_MPU_C",
|
|
|
+ "IN_MPU_C",
|
|
|
+ "IN_MPU_DEFAULT",
|
|
|
+ "IN_MPU_SYNX",
|
|
|
+ "UCR_SIZE_FAIL",
|
|
|
+ "UCR_ADDR_FAIL",
|
|
|
+ "UCR1_SIZE_FAIL",
|
|
|
+ "UCR1_ADDR_FAIL",
|
|
|
+ "UCR_OVERLAPPED_UCR1",
|
|
|
+ "UCR1_OVERLAPPED_UCR",
|
|
|
+ "UCR_EQ_UCR1",
|
|
|
+ "MPU_CHECK_DONE",
|
|
|
+ "BEFORE_INT_LOCK",
|
|
|
+ "AFTER_INT_LOCK",
|
|
|
+ "BEFORE_INT_UNLOCK",
|
|
|
+ "AFTER_INT_UNLOCK",
|
|
|
+ "CALL_START",
|
|
|
+ "MAIN_ENTRY",
|
|
|
+ "VENUS_INIT_ENTRY",
|
|
|
+ "VSYS_INIT_ENTRY",
|
|
|
+ "BEFORE_XOS_CLK",
|
|
|
+ "AFTER_XOS_CLK",
|
|
|
+ "LOG_MUTEX_INIT",
|
|
|
+ "CREATE_FRAMEWORK_ENTRY",
|
|
|
+ "DTG_INIT",
|
|
|
+ "IDLE_TASK_INIT",
|
|
|
+ "VENUS_CORE_INIT",
|
|
|
+ "HW_CORES_INIT",
|
|
|
+ "RST_THREAD_INIT",
|
|
|
+ "HOST_THREAD_INIT",
|
|
|
+ "ALL_THREADS_INIT",
|
|
|
+ "TASK_MEMPOOL",
|
|
|
+ "SESSION_MUTEX",
|
|
|
+ "SIGNALS_INIT",
|
|
|
+ "RST_SIGNAL_INIT",
|
|
|
+ "INTR_EN_HOST",
|
|
|
+ "INTR_REG_HOST",
|
|
|
+ "INTR_EN_DSP",
|
|
|
+ "INTR_REG_DSP",
|
|
|
+ "X2HSOFTINTEN",
|
|
|
+ "H2XSOFTINTEN",
|
|
|
+ "CPU2DSPINTEN",
|
|
|
+ "DSP2CPUINT_SWRESET",
|
|
|
+ "THREADS_START",
|
|
|
+ "RST_THREAD_START",
|
|
|
+ "HST_THREAD_START",
|
|
|
+ "HST_THREAD_ENTRY"
|
|
|
+};
|
|
|
+
|
|
|
static inline int __boot_firmware(struct iris_hfi_device *device)
|
|
|
{
|
|
|
int rc = 0, loop = 10;
|
|
@@ -1108,8 +1172,9 @@ static inline int __boot_firmware(struct iris_hfi_device *device)
|
|
|
|
|
|
skip_core_power_check:
|
|
|
ctrl_init_val = BIT(0);
|
|
|
+ /* RUMI: CVP_CTRL_INIT in MPTest has bit 0 and 3 set */
|
|
|
__write_register(device, CVP_CTRL_INIT, ctrl_init_val);
|
|
|
- while (!ctrl_status && count < max_tries) {
|
|
|
+ while (!(ctrl_status & CVP_CTRL_INIT_STATUS__M) && count < max_tries) {
|
|
|
ctrl_status = __read_register(device, CVP_CTRL_STATUS);
|
|
|
if ((ctrl_status & CVP_CTRL_ERROR_STATUS__M) == 0x4) {
|
|
|
dprintk(CVP_ERR, "invalid setting for UC_REGION\n");
|
|
@@ -1125,8 +1190,9 @@ skip_core_power_check:
|
|
|
if (!(ctrl_status & CVP_CTRL_INIT_STATUS__M)) {
|
|
|
ctrl_init_val = __read_register(device, CVP_CTRL_INIT);
|
|
|
dprintk(CVP_ERR,
|
|
|
- "Failed to boot FW status: %x %x\n",
|
|
|
- ctrl_status, ctrl_init_val);
|
|
|
+ "Failed to boot FW status: %x %x %s\n",
|
|
|
+ ctrl_status, ctrl_init_val,
|
|
|
+ boot_states[(ctrl_status >> 9) & 0x3f]);
|
|
|
check_tensilica_in_reset(device);
|
|
|
rc = -ENODEV;
|
|
|
}
|
|
@@ -2120,9 +2186,9 @@ static int iris_hfi_core_init(void *device)
|
|
|
|
|
|
__hwfence_regs_map(dev);
|
|
|
|
|
|
- rc = __load_fw(dev);
|
|
|
+ rc = __power_on_init(dev);
|
|
|
if (rc) {
|
|
|
- dprintk(CVP_ERR, "Failed to load Iris FW\n");
|
|
|
+ dprintk(CVP_ERR, "Failed to power on init EVA\n");
|
|
|
goto err_load_fw;
|
|
|
}
|
|
|
|
|
@@ -2171,6 +2237,12 @@ static int iris_hfi_core_init(void *device)
|
|
|
__write_register(dev, CVP_MMAP_ADDR, ipcc_iova);
|
|
|
}
|
|
|
|
|
|
+ rc = __load_fw(dev);
|
|
|
+ if (rc) {
|
|
|
+ dprintk(CVP_ERR, "Failed to load Iris FW\n");
|
|
|
+ goto err_core_init;
|
|
|
+ }
|
|
|
+
|
|
|
rc = __boot_firmware(dev);
|
|
|
if (rc) {
|
|
|
dprintk(CVP_ERR, "Failed to start core\n");
|
|
@@ -4825,6 +4897,10 @@ static inline int __resume(struct iris_hfi_device *device)
|
|
|
dprintk(CVP_ERR, "CVP power on failed gdsc %x cbcr %x\n",
|
|
|
reg_gdsc, reg_cbcr);
|
|
|
|
|
|
+ __setup_ucregion_memory_map(device);
|
|
|
+
|
|
|
+ /* RUMI: set CVP_CTRL_INIT register to disable synx in FW */
|
|
|
+
|
|
|
/* Reboot the firmware */
|
|
|
rc = __tzbsp_set_cvp_state(TZ_SUBSYS_STATE_RESUME);
|
|
|
if (rc) {
|
|
@@ -4832,8 +4908,6 @@ static inline int __resume(struct iris_hfi_device *device)
|
|
|
goto err_set_cvp_state;
|
|
|
}
|
|
|
|
|
|
- __setup_ucregion_memory_map(device);
|
|
|
-
|
|
|
/* Wait for boot completion */
|
|
|
rc = __boot_firmware(device);
|
|
|
if (rc) {
|
|
@@ -4874,7 +4948,7 @@ err_iris_power_on:
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
-static int __load_fw(struct iris_hfi_device *device)
|
|
|
+static int __power_on_init(struct iris_hfi_device *device)
|
|
|
{
|
|
|
int rc = 0;
|
|
|
|
|
@@ -4882,36 +4956,41 @@ static int __load_fw(struct iris_hfi_device *device)
|
|
|
rc = __init_resources(device, device->res);
|
|
|
if (rc) {
|
|
|
dprintk(CVP_ERR, "Failed to init resources: %d\n", rc);
|
|
|
- goto fail_init_res;
|
|
|
+ return rc;
|
|
|
}
|
|
|
|
|
|
rc = __initialize_packetization(device);
|
|
|
if (rc) {
|
|
|
dprintk(CVP_ERR, "Failed to initialize packetization\n");
|
|
|
- goto fail_init_pkt;
|
|
|
+ goto fail_iris_init;
|
|
|
}
|
|
|
|
|
|
rc = __iris_power_on(device);
|
|
|
if (rc) {
|
|
|
dprintk(CVP_ERR, "Failed to power on iris in in load_fw\n");
|
|
|
- goto fail_iris_power_on;
|
|
|
+ goto fail_iris_init;
|
|
|
}
|
|
|
|
|
|
+ return rc;
|
|
|
+fail_iris_init:
|
|
|
+ __deinit_resources(device);
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+static int __load_fw(struct iris_hfi_device *device)
|
|
|
+{
|
|
|
+ int rc = 0;
|
|
|
+
|
|
|
if ((!device->res->use_non_secure_pil && !device->res->firmware_base)
|
|
|
- || device->res->use_non_secure_pil) {
|
|
|
+ || device->res->use_non_secure_pil) {
|
|
|
rc = load_cvp_fw_impl(device);
|
|
|
if (rc)
|
|
|
goto fail_load_fw;
|
|
|
}
|
|
|
-
|
|
|
return rc;
|
|
|
|
|
|
fail_load_fw:
|
|
|
call_iris_op(device, power_off, device);
|
|
|
-fail_iris_power_on:
|
|
|
-fail_init_pkt:
|
|
|
- __deinit_resources(device);
|
|
|
-fail_init_res:
|
|
|
return rc;
|
|
|
}
|
|
|
|