#@TYPE: Machine
#@NAME: Boundary Devices Nitrogen8MP
#@SOC: i.MX8 MP
#@DESCRIPTION: Machine configuration for Boundary Devices Nitrogen8MP
#@MAINTAINER: Chris Dimich <chris.dimich@boundarydevices.com>

MACHINEOVERRIDES =. "mx8mp:imx-boot-container:"

IMX_DEFAULT_BSP ?= "nxp"

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

# Kernel configuration
PREFERRED_PROVIDER_virtual/kernel ??= "linux-boundary"
KERNEL_DEVICETREE = "freescale/imx8mp-nitrogen8mp.dtb \
	freescale/imx8mp-nitrogen_smarc.dtb \
	freescale/imx8mp-nitrogen8mp-m4.dtb \
	freescale/imx8mp-nitrogen8mp-basler3840-4200.dtb \
	freescale/imx8mp-nitrogen8mp-enc.dtb \
	freescale/imx8mp-nitrogen8mp-enc-m4.dtb \
	freescale/imx8mp-nitrogen8mp-enc-ar.dtb \
	freescale/imx8mp-nitrogen8mp-enc-basler4200-ov5640.dtb \
	freescale/imx8mp-nitrogen8mp-enc-tc358743.dtb \
	freescale/imx8mp-nitrogen8mp_r20.dtb \
	freescale/imx8mp-nitrogen8mp_r20-m4.dtb \
	freescale/imx8mp-nitrogen8mp_r20-basler3840-4200.dtb \
	freescale/imx8mp-nitrogen8mp_r20-enc.dtb \
	freescale/imx8mp-nitrogen8mp_r20-enc-m4.dtb \
	freescale/imx8mp-nitrogen8mp_r20-enc-ar.dtb \
	freescale/imx8mp-nitrogen8mp_r20-enc-basler4200-ov5640.dtb \
	freescale/imx8mp-nitrogen8mp_r20-enc-tc358743.dtb \
	freescale/imx8mp-nitrogen8mp_vm.dtb \
"

KERNEL_IMAGETYPE = "Image"
RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""

# U-Boot configuration
IMX_DEFAULT_BOOTLOADER:imx-nxp-bsp = "u-boot-boundary"
PREFERRED_PROVIDER_u-boot ??= "u-boot-boundary"
PREFERRED_PROVIDER_virtual/bootloader ??= "u-boot-boundary"
PREFERRED_PROVIDER_imx-atf ??= "imx-atf-boundary"
SPL_BINARY = "spl/u-boot-spl.bin"
UBOOT_SUFFIX = "bin"

UBOOT_CONFIG ??= "2g 2gr0 4g 8g smarc"
UBOOT_CONFIG[2g]   = "${MACHINE}_2g_defconfig,sdcard"
UBOOT_CONFIG[2gr0] = "${MACHINE}_2gr0_defconfig,sdcard"
UBOOT_CONFIG[4g]   = "${MACHINE}_4g_defconfig,sdcard"
UBOOT_CONFIG[8g]   = "${MACHINE}_8g_defconfig,sdcard"
UBOOT_CONFIG[smarc]   = "imx8mp_nitrogen_smarc_2gr0_defconfig,sdcard"

ATF_PLATFORM = "imx8mp"

DDR_FIRMWARE_NAME = "\
    lpddr4_pmu_train_1d_imem_202006.bin \
    lpddr4_pmu_train_1d_dmem_202006.bin \
    lpddr4_pmu_train_2d_imem_202006.bin \
    lpddr4_pmu_train_2d_dmem_202006.bin \
"

IMAGE_BOOT_FILES:append = " \
	boot.scr-${MACHINE};boot.scr \
	upgrade.scr-${MACHINE};upgrade.scr \
	flash.bin-${MACHINE}-2g;u-boot.${MACHINE}_2g \
	flash.bin-${MACHINE}-2gr0;u-boot.${MACHINE}_2gr0 \
	flash.bin-${MACHINE}-4g;u-boot.${MACHINE}_4g \
	flash.bin-${MACHINE}-8g;u-boot.${MACHINE}_8g \
	flash.bin-${MACHINE}-smarc;u-boot.imx8mp_nitrogen_smarc_2gr0 \
"

# wic support
WKS_FILE = "sdimage-bootpart.wks"
WKS_FILE_DEPENDS += "u-boot-script-boundary"

OPTEE_BIN_EXT = "8mp"

SERIAL_CONSOLES = "115200;ttymxc1"

MACHINE_FEATURES += " pci wifi bluetooth"
