mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
MALI: bifrost: CSF: Add MALI_CSF_INCLUDE_FW to include mali_csffw.bin into driver by default
Change-Id: Ib6374444bdda257b245c2f09475cb470f1974dcd Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
This commit is contained in:
@@ -393,6 +393,10 @@ config MALI_TRACE_POWER_GPU_WORK_PERIOD
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config MALI_CSF_INCLUDE_FW
|
||||
depends on MALI_BIFROST && MALI_CSF_SUPPORT
|
||||
bool "Whether to include CSF firmware into driver"
|
||||
default y
|
||||
|
||||
# source "$(MALI_KCONFIG_EXT_PREFIX)drivers/gpu/arm/bifrost/tests/Kconfig"
|
||||
|
||||
|
||||
@@ -2287,9 +2287,28 @@ int kbase_csf_firmware_late_init(struct kbase_device *kbdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MALI_CSF_INCLUDE_FW
|
||||
asm (
|
||||
" .pushsection .rodata, \"a\" \n"
|
||||
" .ascii \"CSFFW_ST\" \n"
|
||||
" .global mali_csffw \n"
|
||||
"mali_csffw: \n"
|
||||
" .incbin \"drivers/gpu/arm/bifrost/mali_csffw.bin\" \n"
|
||||
" .global mali_csffw_end \n"
|
||||
"mali_csffw_end: \n"
|
||||
" .ascii \"CSFFW_ED\" \n"
|
||||
" .popsection \n"
|
||||
);
|
||||
|
||||
extern char mali_csffw;
|
||||
extern char mali_csffw_end;
|
||||
#endif
|
||||
|
||||
int kbase_csf_firmware_load_init(struct kbase_device *kbdev)
|
||||
{
|
||||
#ifndef CONFIG_MALI_CSF_INCLUDE_FW
|
||||
const struct firmware *firmware = NULL;
|
||||
#endif
|
||||
struct kbase_csf_mcu_fw *const mcu_fw = &kbdev->csf.fw;
|
||||
const u32 magic = FIRMWARE_HEADER_MAGIC;
|
||||
u8 version_major, version_minor;
|
||||
@@ -2297,7 +2316,9 @@ int kbase_csf_firmware_load_init(struct kbase_device *kbdev)
|
||||
u32 entry_end_offset;
|
||||
u32 entry_offset;
|
||||
int ret;
|
||||
#ifndef CONFIG_MALI_CSF_INCLUDE_FW
|
||||
const char *fw_name = default_fw_name;
|
||||
#endif
|
||||
|
||||
lockdep_assert_held(&kbdev->fw_load_lock);
|
||||
|
||||
@@ -2320,6 +2341,14 @@ int kbase_csf_firmware_load_init(struct kbase_device *kbdev)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MALI_CSF_INCLUDE_FW
|
||||
mcu_fw->size = &mali_csffw_end - &mali_csffw;
|
||||
|
||||
dev_info(kbdev->dev, "use 'driver built-in firmware' directly\n");
|
||||
mcu_fw->data = (u8 *)(&mali_csffw);
|
||||
dev_dbg(kbdev->dev, "Firmware image (%zu-bytes) retained in csf.fw\n",
|
||||
mcu_fw->size);
|
||||
#else
|
||||
#if IS_ENABLED(CONFIG_OF)
|
||||
/* If we can't read CSF firmware name from DTB,
|
||||
* fw_name is not modified and remains the default.
|
||||
@@ -2366,6 +2395,7 @@ int kbase_csf_firmware_load_init(struct kbase_device *kbdev)
|
||||
|
||||
release_firmware(firmware);
|
||||
}
|
||||
#endif /* CONFIG_MALI_CSF_INCLUDE_FW */
|
||||
|
||||
/* If error in loading or saving the image, branches to error out */
|
||||
if (ret)
|
||||
@@ -2592,6 +2622,8 @@ void kbase_csf_firmware_unload_term(struct kbase_device *kbdev)
|
||||
kfree(metadata);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_MALI_CSF_INCLUDE_FW))
|
||||
kbdev->csf.fw.data = NULL;
|
||||
if (kbdev->csf.fw.data) {
|
||||
/* Free the copy of the firmware image */
|
||||
vfree(kbdev->csf.fw.data);
|
||||
|
||||
Reference in New Issue
Block a user