#@TYPE: Machine
#@NAME: i.MX 8QM MEK
#@SOC: i.MX8QM
#@DESCRIPTION: i.MX 8QuadMax Multisensory Enablement Kit board, rev B0
#@MAINTAINER: Lauren Post <lauren.post@nxp.com>

MACHINEOVERRIDES =. "mx8:mx8qm:"

require conf/machine/include/imx-base.inc
require conf/machine/include/arm/armv8a/tune-cortexa72-cortexa53.inc

IMX_DEFAULT_BSP = "nxp"

MACHINE_FEATURES += "pci optee bcm43455 bcm4356 nxp8997-pcie nxp9098-pcie"
MACHINE_FEATURES:append:use-nxp-bsp = " bcm4359"

# Don't include kernels in standard images
RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""

LOADADDR = ""

# We have to disable SERIAL_CONSOLE due to auto-serial-console
SERIAL_CONSOLES = "115200;ttyAMA0"

# we do not want to have getty running on tty1 as we run
# auto-serial-console there
USE_VT = "0"

KERNEL_DEVICETREE = " \
    freescale/imx8qm-mek.dtb \
    freescale/imx8qm-mek-ca53.dtb \
    freescale/imx8qm-mek-ca72.dtb \
    freescale/imx8qm-mek-dsi-rm67191.dtb \
    freescale/imx8qm-mek-enet2-tja1100.dtb \
    freescale/imx8qm-mek-esai.dtb \
    freescale/imx8qm-mek-hdmi.dtb \
    freescale/imx8qm-mek-hdmi-rx.dtb \
    freescale/imx8qm-mek-hdmi-rx-ov5640.dtb \
    freescale/imx8qm-mek-jdi-wuxga-lvds1-panel.dtb \
    freescale/imx8qm-mek-jdi-wuxga-lvds1-panel-rpmsg.dtb \
    freescale/imx8qm-mek-ov5640.dtb \
    freescale/imx8qm-mek-pcie-ep.dtb \
    freescale/imx8qm-mek-rpmsg.dtb \
    freescale/imx8qm-mek-sof.dtb \
    freescale/imx8qm-mek-sof-cs42888.dtb \
    freescale/imx8qm-mek-sof-wm8960.dtb \
    freescale/imx8qm-mek-usd-wifi.dtb \
    freescale/imx8qm-mek-usdhc3-m2.dtb \
"

UBOOT_MAKE_TARGET = \
    "${@bb.utils.contains('MACHINE_FEATURES', 'optee', '', \
                                                       'u-boot.bin', d)}"
SPL_BINARY = \
    "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'spl/u-boot-spl.bin', \
                                                       '', d)}"
IMX_DEFAULT_BOOTLOADER:use-nxp-bsp = "u-boot-imx"
IMX_DEFAULT_BOOTLOADER:use-mainline-bsp = "u-boot-fslc"

UBOOT_SUFFIX = "bin"

UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd]      = "imx8qm_mek_defconfig,sdcard"
UBOOT_CONFIG[fspi]    = "imx8qm_mek_fspi_defconfig"
UBOOT_CONFIG[mfgtool] = "imx8qm_mek_defconfig"

IMX_BOOT_SEEK = "32"

IMAGE_BOOT_FILES += "hdmitxfw.bin hdmirxfw.bin dpfw.bin"

# Set ATF platform name
ATF_PLATFORM = "imx8qm"

IMXBOOT_TARGETS_SD = \
    "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'flash_spl', \
                                                       'flash flash_ca72', d)}"
IMXBOOT_TARGETS_FSPI = \
    "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'flash_spl_flexspi', \
                                                       'flash_flexspi', d)}"
IMXBOOT_TARGETS = \
    "${@bb.utils.contains('UBOOT_CONFIG',        'sd', '${IMXBOOT_TARGETS_SD}', \
                                                       '${IMXBOOT_TARGETS_FSPI}', d)}"
IMX_BOOT_SOC_TARGET = "iMX8QM"

BOARD_TYPE = "mek"

# Add additional firmware
MACHINE_FIRMWARE:append = " linux-firmware-ath10k"
