| // SPDX-License-Identifier: GPL-2.0+ |
| /* |
| * Copyright 2018 NXP |
| */ |
| |
| #include <asm/arch/clock.h> |
| #include <asm/arch/imx8mq_pins.h> |
| #include <asm/arch/sys_proto.h> |
| #include <asm/mach-imx/iomux-v3.h> |
| #include <efi_loader.h> |
| #include <env.h> |
| |
| #define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1) |
| |
| #define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) |
| |
| static iomux_v3_cfg_t const wdog_pads[] = { |
| IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL), |
| }; |
| |
| static iomux_v3_cfg_t const uart_pads[] = { |
| IMX8MQ_PAD_UART1_RXD__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL), |
| IMX8MQ_PAD_UART1_TXD__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL), |
| }; |
| |
| #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) |
| #define IMX_BOOT_IMAGE_GUID \ |
| EFI_GUID(0x296119cf, 0xdd70, 0x43de, 0x8a, 0xc8, \ |
| 0xa7, 0x05, 0x1f, 0x31, 0x25, 0x77) |
| |
| struct efi_fw_image fw_images[] = { |
| { |
| .image_type_id = IMX_BOOT_IMAGE_GUID, |
| .fw_name = u"IMX8MQ-EVK-RAW", |
| .image_index = 1, |
| }, |
| }; |
| |
| struct efi_capsule_update_info update_info = { |
| .dfu_string = "mmc 0=flash-bin raw 0x42 0x2000 mmcpart 1", |
| .num_images = ARRAY_SIZE(fw_images), |
| .images = fw_images, |
| }; |
| #endif /* EFI_HAVE_CAPSULE_SUPPORT */ |
| |
| int board_early_init_f(void) |
| { |
| struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; |
| |
| imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads)); |
| set_wdog_reset(wdog); |
| |
| imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads)); |
| |
| return 0; |
| } |
| |
| int board_init(void) |
| { |
| #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_DWC3) |
| init_usb_clk(); |
| #endif |
| |
| return 0; |
| } |
| |
| int board_mmc_get_env_dev(int devno) |
| { |
| return devno; |
| } |
| |
| int board_late_init(void) |
| { |
| #if CONFIG_IS_ENABLED(ENV_IS_IN_MMC) |
| board_late_mmc_env_init(); |
| #endif |
| |
| #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG |
| env_set("board_name", "EVK"); |
| env_set("board_rev", "iMX8MQ"); |
| #endif |
| |
| return 0; |
| } |