From bc823433658f2446f71643cdef91cc875eb56229 Mon Sep 17 00:00:00 2001 From: "Haoran.Wang" Date: Fri, 29 Dec 2017 16:35:56 +0800 Subject: MA-10983 Load HDMI firmware before boot Load HDMI firmware to make HDMI module work. The firmware stored in /system partition. Now choose the target boot slot's system partition to load the firmware. Change-Id: Icfcd5f6c8237ee0c8875317395cf86c07d53c58e Signed-off-by: Haoran.Wang --- configs/mx8qm_mek_android_defconfig | 1 + drivers/usb/gadget/f_fastboot.c | 42 ++++++++++++++++++++++++++++++++++++ include/configs/imx8qm_mek_android.h | 5 +++++ 3 files changed, 48 insertions(+) mode change 100644 => 100755 drivers/usb/gadget/f_fastboot.c diff --git a/configs/mx8qm_mek_android_defconfig b/configs/mx8qm_mek_android_defconfig index 80c5e497ff..6d1c798966 100644 --- a/configs/mx8qm_mek_android_defconfig +++ b/configs/mx8qm_mek_android_defconfig @@ -18,6 +18,7 @@ CONFIG_DM_I2C=y # CONFIG_DM_I2C_COMPAT is not set CONFIG_SYS_I2C_IMX_LPI2C=y CONFIG_CMD_I2C=y +CONFIG_CMD_EXT4=y CONFIG_CMD_USB=y CONFIG_USB=y diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c old mode 100644 new mode 100755 index 2c93ccbceb..5a5ddff913 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -263,6 +263,10 @@ enum { }; static unsigned int download_bytes_unpadded; +#ifdef IMX_LOAD_HDMI_FIMRWARE +int hdmi_firmware_load(char* slot); +#endif + static struct cmd_fastboot_interface interface = { .rx_handler = NULL, .reset_handler = NULL, @@ -1585,6 +1589,10 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { avb_out_data->ab_suffix); } setenv("bootargs_sec", bootargs_sec); +#ifdef IMX_LOAD_HDMI_FIMRWARE + hdmi_firmware_load(avb_out_data->ab_suffix); +#endif + #ifdef CONFIG_SYSTEM_RAMDISK_SUPPORT if(!is_recovery_mode) fastboot_setup_system_boot_args(avb_out_data->ab_suffix); @@ -1635,6 +1643,9 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { sprintf(bootargs_sec, "androidboot.verifiedbootstate=orange androidboot.slot_suffix=%s", slot); setenv("bootargs_sec", bootargs_sec); +#ifdef IMX_LOAD_HDMI_FIMRWARE + hdmi_firmware_load(slot); +#endif #ifdef CONFIG_SYSTEM_RAMDISK_SUPPORT if(!is_recovery_mode) fastboot_setup_system_boot_args(slot); @@ -2637,6 +2648,37 @@ static void cb_continue(struct usb_ep *ep, struct usb_request *req) fastboot_tx_write_str("OKAY"); } +#ifdef IMX_LOAD_HDMI_FIMRWARE +int hdmi_firmware_load(char *slot) { + int mmcc = mmc_get_env_dev(); + int mmc_id; + char part_str[32]; + char command[256]; + int ret; + + sprintf(part_str, "%s%s", IMX_HDMI_FIRMWARE_PART, slot); + mmc_id = fastboot_flash_find_index(part_str); + if (mmc_id <= 0) + return -1; + + sprintf(command, "ext4load mmc %x:%x 0x%x %s", + mmcc, mmc_id, IMX_HDMI_FIRMWARE_LOAD_ADDR, IMX_HDMI_FIRMWARE_PATH); + + ret = run_command(command, 0); + if (ret) { + printf("execute command '%s' error!\n", command); + return -1; + } + + sprintf(command, "hdp load 0x%x", IMX_HDMI_FIRMWARE_LOAD_ADDR); + + ret = run_command(command, 0); + if (ret) { + printf("execute command '%s' error!\n", command); + return -1; + } +} +#endif #ifdef CONFIG_FASTBOOT_LOCK diff --git a/include/configs/imx8qm_mek_android.h b/include/configs/imx8qm_mek_android.h index 55056bf2f8..4b4cb1929f 100644 --- a/include/configs/imx8qm_mek_android.h +++ b/include/configs/imx8qm_mek_android.h @@ -25,6 +25,11 @@ #define CONFIG_FASTBOOT_LOCK #define FSL_FASTBOOT_FB_DEV "mmc" +#define IMX_LOAD_HDMI_FIMRWARE +#define IMX_HDMI_FIRMWARE_PATH "etc/firmware/hdmi/hdmitxfw.bin" +#define IMX_HDMI_FIRMWARE_PART "system" +#define IMX_HDMI_FIRMWARE_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_256M) + #ifdef CONFIG_SYS_MALLOC_LEN #undef CONFIG_SYS_MALLOC_LEN #define CONFIG_SYS_MALLOC_LEN (64 * SZ_1M) -- cgit v1.2.3