Merge tag 'tpm-030822' of https://source.denx.de/u-boot/custodians/u-boot-tpm
[platform/kernel/u-boot.git] / board / advantech / imx8mp_rsb3720a1 / imx8mp_rsb3720a1.c
index 1656609..aa9687f 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dwc3-uboot.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <errno.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/arch/clock.h>
 #include <asm/mach-imx/dma.h>
 #include <linux/delay.h>
+#include <linux/kernel.h>
 #include <power/pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define UART_PAD_CTRL  (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
-#define WDOG_PAD_CTRL  (PAD_CTL_DSE6 | PAD_CTL_ODE | PAD_CTL_PUE | PAD_CTL_PE)
-
-static const iomux_v3_cfg_t uart_pads[] = {
-       MX8MP_PAD_ECSPI1_SCLK__UART3_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
-       MX8MP_PAD_ECSPI1_MOSI__UART3_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
-};
-
-static const iomux_v3_cfg_t wdog_pads[] = {
-       MX8MP_PAD_GPIO1_IO02__WDOG1_WDOG_B  | MUX_PAD_CTRL(WDOG_PAD_CTRL),
-};
-
 #ifdef CONFIG_NAND_MXS
 static void setup_gpmi_nand(void)
 {
@@ -44,16 +35,34 @@ static void setup_gpmi_nand(void)
 }
 #endif
 
-int board_early_init_f(void)
-{
-       struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
+       {
+               .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
+               .fw_name = u"IMX8MP-RSB3720-FIT",
+               .image_index = 1,
+       },
+#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
+       {
+               .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,
+               .fw_name = u"IMX8MP-RSB3720-FIT",
+               .image_index = 1,
+       },
+#endif
+};
 
-       imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads));
+struct efi_capsule_update_info update_info = {
+       .dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1",
+       .images = fw_images,
+};
 
-       set_wdog_reset(wdog);
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
 
-       imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
 
+int board_early_init_f(void)
+{
        init_uart_clk(2);
 
        return 0;
@@ -197,7 +206,7 @@ int board_late_init(void)
        return 0;
 }
 
-#ifdef CONFIG_SPL_MMC_SUPPORT
+#ifdef CONFIG_SPL_MMC
 #define UBOOT_RAW_SECTOR_OFFSET 0x40
 unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
 {
@@ -210,4 +219,4 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
                return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
        }
 }
-#endif /* CONFIG_SPL_MMC_SUPPORT */
+#endif /* CONFIG_SPL_MMC */