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

MACHINEOVERRIDES =. "mx8mn: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/imx8mn-nitrogen8mn.dtb \
	freescale/imx8mn-nitrogen8mn_som.dtb \
	freescale/imx8mn-nitrogen8mn_som-m4.dtb \
	freescale/imx8mn-nitrogen8_nano.dtb \
	freescale/imx8mn-nitrogen8_nano-m4.dtb \
"

KERNEL_IMAGETYPE = "Image"
KERNEL_DEFCONFIG = "boundary_defconfig"
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 ??= "1g som_1g"
UBOOT_CONFIG[1g]   = "${MACHINE}_1g_defconfig,sdcard"
UBOOT_CONFIG[som_1g] = "${MACHINE}_som_1g_defconfig,sdcard"

ATF_PLATFORM = "imx8mn"

DDR_FIRMWARE_NAME = "\
    lpddr4_pmu_train_1d_imem.bin \
    lpddr4_pmu_train_1d_dmem.bin \
    lpddr4_pmu_train_2d_imem.bin \
    lpddr4_pmu_train_2d_dmem.bin \
"

IMAGE_BOOT_FILES:append = " \
	boot.scr-${MACHINE};boot.scr \
	upgrade.scr-${MACHINE};upgrade.scr \
	flash.bin-${MACHINE}-1g;u-boot.${MACHINE}_1g \
	flash.bin-${MACHINE}-som_1g;u-boot.${MACHINE}_som_1g \
"

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

SERIAL_CONSOLES = "115200;ttymxc1"

MACHINE_FEATURES += " pci wifi bluetooth"
