#@TYPE: Machine
#@NAME: ultra96-zynqmp
#@DESCRIPTION: Machine support for Ultra96 Evaluation Board.

#### Preamble
MACHINEOVERRIDES =. "${@['', 'ultra96-zynqmp:']['ultra96-zynqmp' !='${MACHINE}']}"
#### Regular settings follow

# Variables that changes based on hw design or board specific requirement must be
# defined before calling the required inclusion file else pre-expansion value
# defined in zynqmp-generic.conf will be set.

# Yocto device-tree variables
YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_1"
YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0"
YAML_DT_BOARD_FLAGS ?= "{BOARD avnet-ultra96-rev1}"

# Yocto arm-trusted-firmware(TF-A) variables
ATF_CONSOLE ?= "cadence1"
TFA_BL33_LOAD ?= "0x8000000"

# Yocto PMUFW variables
YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_1"
YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_1"

# Yocto FSBL variables
YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_1"
YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_1"

# Yocto KERNEL Variables
UBOOT_ENTRYPOINT  ?= "0x200000"
UBOOT_LOADADDRESS ?= "0x200000"

# ultra96-zynqmp Serial Console
# In Ultra96 uart1 is the primary uart device but DTG set the serial0 alias
# to uart1, hence we are using ttyPS0 for Ultra96.
SERIAL_CONSOLES ?= "115200;ttyPS0"
YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200"

# Required generic machine inclusion
# Ultra96 board uses ZynqMP EG device hence use soc variant based generic machine
# inclusion
require conf/machine/zynqmp-eg-generic.conf

# This eval board machine conf file uses ultra96-zynqmp xsa as reference input.
# User can override with ultra96 custom xsa using HDF_BASE and HDF_PATH variables
# from local.conf.
HDF_MACHINE = "ultra96-zynqmp"

# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match
# the xsa. User can enable explicitly if required from local.conf.
# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu100-revC.dtb"

# Ultra96 has 2GB memory only but default zynqmp-generic has QB_MEM set to 4G,
# Hence set QB_MEM to 2GB.
QB_MEM = "-m 2G"

# Ultra96 board uses ultra96-arm.dtb as QEMU HW PS DTB.
QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/ultra96-arm.dtb"

# runqemu assumes psu_uart_0 is used but in Ultra96 psu_uart_1 is the primary
# uart device, So set psu_uart_0 as null.
QB_OPT_APPEND += " -serial null"

# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match
# the xsa. User can enable explicitly if required from local.conf.
# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu100-revC.dtb"

# Enable bluetooth and wifi module
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " \
    linux-firmware-wl18xx \
    linux-firmware-ti-bt-wl180x \
    "

#### No additional settings should be after the Postamble
#### Postamble
PACKAGE_EXTRA_ARCHS:append = "${@['', ' ultra96_zynqmp']['ultra96-zynqmp' != '${MACHINE}']}"
