summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/goya/goya.c
diff options
context:
space:
mode:
authorOhad Sharabi <osharabi@habana.ai>2021-04-08 13:42:00 +0300
committerOded Gabbay <ogabbay@kernel.org>2021-06-18 15:23:39 +0300
commit22a795b4af5a7bc66335166054805c1f103c3e4d (patch)
tree317aa096a12bd9e5e230adfa5883d6f7ba14c45c /drivers/misc/habanalabs/goya/goya.c
parent50f036df476c6e58f597f684345141e406b12099 (diff)
habanalabs: dynamic fw load reset protocol
First stage of the dynamic FW load protocol is to reset the protocol to avoid residues from former load cycles. Signed-off-by: Ohad Sharabi <osharabi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/goya/goya.c')
-rw-r--r--drivers/misc/habanalabs/goya/goya.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index dd55fec19e8d..dc5659340220 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -2402,24 +2402,44 @@ static int goya_load_boot_fit_to_device(struct hl_device *hdev)
return hl_fw_load_fw_to_device(hdev, GOYA_BOOT_FIT_FILE, dst, 0, 0);
}
+static void goya_init_dynamic_firmware_loader(struct hl_device *hdev)
+{
+
+}
+
+static void goya_init_static_firmware_loader(struct hl_device *hdev)
+{
+ struct static_fw_load_mgr *static_loader;
+
+ static_loader = &hdev->fw_loader.static_loader;
+
+ static_loader->preboot_version_max_off = SRAM_SIZE - VERSION_MAX_LEN;
+ static_loader->boot_fit_version_max_off = SRAM_SIZE - VERSION_MAX_LEN;
+ static_loader->cpu_boot_status_reg = mmPSOC_GLOBAL_CONF_CPU_BOOT_STATUS;
+ static_loader->cpu_boot_dev_status_reg = mmCPU_BOOT_DEV_STS0;
+ static_loader->boot_err0_reg = mmCPU_BOOT_ERR0;
+ static_loader->preboot_version_offset_reg = mmPREBOOT_VER_OFFSET;
+ static_loader->boot_fit_version_offset_reg = mmUBOOT_VER_OFFSET;
+ static_loader->sram_offset_mask = ~((u32)SRAM_BASE_ADDR);
+}
+
static void goya_init_firmware_loader(struct hl_device *hdev)
{
+ struct asic_fixed_properties *prop = &hdev->asic_prop;
struct fw_load_mgr *fw_loader = &hdev->fw_loader;
- fw_loader->preboot_version_max_off = SRAM_SIZE - VERSION_MAX_LEN;
- fw_loader->boot_fit_version_max_off = SRAM_SIZE - VERSION_MAX_LEN;
+ /* fill common fields */
fw_loader->kmd_msg_to_cpu_reg = mmPSOC_GLOBAL_CONF_KMD_MSG_TO_CPU;
fw_loader->cpu_cmd_status_to_host_reg = mmCPU_CMD_STATUS_TO_HOST;
- fw_loader->preboot_version_offset_reg = mmPREBOOT_VER_OFFSET;
- fw_loader->boot_fit_version_offset_reg = mmUBOOT_VER_OFFSET;
- fw_loader->sram_offset_mask = ~((u32)SRAM_BASE_ADDR);
fw_loader->cpu_timeout = GOYA_CPU_TIMEOUT_USEC;
fw_loader->boot_fit_timeout = GOYA_BOOT_FIT_REQ_TIMEOUT_USEC;
fw_loader->skip_bmc = false;
- fw_loader->cpu_boot_status_reg = mmPSOC_GLOBAL_CONF_CPU_BOOT_STATUS;
- fw_loader->cpu_boot_dev_status_reg = mmCPU_BOOT_DEV_STS0;
- fw_loader->boot_err0_reg = mmCPU_BOOT_ERR0;
fw_loader->sram_bar_id = SRAM_CFG_BAR_ID;
+
+ if (prop->dynamic_fw_load)
+ goya_init_dynamic_firmware_loader(hdev);
+ else
+ goya_init_static_firmware_loader(hdev);
}
static int goya_init_cpu(struct hl_device *hdev)