Add support for Enclustra Mars ZX3 board as a BMC

This adds preliminary support for the Enclustra Mars ZX3 using the upstream
meta-xilinx layer. In order to get it to compile this removes the
phosphor-gpio-keys feature even though it could theoretically be supported.

(From meta-evb rev: 07837e0d7d62497302c114008d27e0a808106ca2)

Change-Id: Ie02c329864d2c981dbe245a16e0e9858b37d6aee
Signed-off-by: Alexander Hedges <ahedges@ethz.ch>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-evb/meta-evb-enclustra/conf/layer.conf b/meta-evb/meta-evb-enclustra/conf/layer.conf
new file mode 100644
index 0000000..ce416b0
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/conf/layer.conf
@@ -0,0 +1,6 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+BBFILE_COLLECTIONS += "evb-enclustra"
+BBFILE_PATTERN_evb-enclustra = ""
+LAYERSERIES_COMPAT_evb-enclustra = "sumo"
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/bblayers.conf.sample b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/bblayers.conf.sample
new file mode 100644
index 0000000..f1f9b4e
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/bblayers.conf.sample
@@ -0,0 +1,35 @@
+# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
+# changes incompatibly
+LCONF_VERSION = "8"
+
+BBPATH = "${TOPDIR}"
+BBFILES ?= ""
+
+BBLAYERS ?= " \
+  ##OEROOT##/meta \
+  ##OEROOT##/meta-poky \
+  ##OEROOT##/meta-openembedded/meta-oe \
+  ##OEROOT##/meta-openembedded/meta-networking \
+  ##OEROOT##/meta-openembedded/meta-perl \
+  ##OEROOT##/meta-openembedded/meta-python \
+  ##OEROOT##/meta-openembedded/meta-webserver \
+  ##OEROOT##/meta-phosphor \
+  ##OEROOT##/meta-xilinx/meta-xilinx-bsp/ \
+  ##OEROOT##/meta-evb \
+  ##OEROOT##/meta-evb/meta-evb-enclustra \
+  ##OEROOT##/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3 \
+  "
+BBLAYERS_NON_REMOVABLE ?= " \
+##OEROOT##/meta \
+##OEROOT##/meta-poky \
+##OEROOT##/meta-openembedded/meta-oe \
+##OEROOT##/meta-openembedded/meta-networking \
+##OEROOT##/meta-openembedded/meta-perl \
+##OEROOT##/meta-openembedded/meta-python \
+##OEROOT##/meta-openembedded/meta-webserver \
+##OEROOT##/meta-phosphor \
+##OEROOT##/meta-xilinx/meta-xilinx-bsp/ \
+##OEROOT##/meta-evb \
+##OEROOT##/meta-evb/meta-evb-enclustra \
+##OEROOT##/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3 \
+  "
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/conf-notes.txt b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/conf-notes.txt
new file mode 100644
index 0000000..9b3c01a
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/conf-notes.txt
@@ -0,0 +1,2 @@
+Common targets are:
+     obmc-phosphor-image
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/layer.conf b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/layer.conf
new file mode 100644
index 0000000..1053e77
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/layer.conf
@@ -0,0 +1,10 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have recipes-* directories, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+            ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "evb-zx3-pm3"
+BBFILE_PATTERN_evb-zx3-pm3 = ""
+LAYERSERIES_COMPAT_evb-zx3-pm3 = "sumo"
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/local.conf.sample b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/local.conf.sample
new file mode 100644
index 0000000..add76ec
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/local.conf.sample
@@ -0,0 +1,23 @@
+MACHINE ??= "evb-zx3-pm3"
+DISTRO ?= "openbmc-phosphor"
+PACKAGE_CLASSES ?= "package_rpm"
+SANITY_TESTED_DISTROS_append ?= " *"
+EXTRA_IMAGE_FEATURES = "debug-tweaks"
+USER_CLASSES ?= "buildstats image-mklibs image-prelink"
+PATCHRESOLVE = "noop"
+BB_DISKMON_DIRS = "\
+    STOPTASKS,${TMPDIR},1G,100K \
+    STOPTASKS,${DL_DIR},1G,100K \
+    STOPTASKS,${SSTATE_DIR},1G,100K \
+    STOPTASKS,/tmp,100M,100K \
+    ABORT,${TMPDIR},100M,1K \
+    ABORT,${DL_DIR},100M,1K \
+    ABORT,${SSTATE_DIR},100M,1K \
+    ABORT,/tmp,10M,1K"
+CONF_VERSION = "1"
+
+# Set the root password to '0penBmc'
+INHERIT += "extrausers"
+EXTRA_USERS_PARAMS = " \
+  usermod -p '\$1\$UGMqyqdG\$FZiylVFmRRfl9Z0Ue8G7e/' root; \
+  "
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/machine/evb-zx3-pm3.conf b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/machine/evb-zx3-pm3.conf
new file mode 100644
index 0000000..0fcb971
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/conf/machine/evb-zx3-pm3.conf
@@ -0,0 +1,39 @@
+SOC_VARIANT ?= "7z"
+
+require conf/machine/include/tune-zynq.inc
+require conf/machine/include/machine-xilinx-overrides.inc
+require conf/machine/include/machine-xilinx-default.inc
+require conf/machine/include/machine-xilinx-board.inc
+require conf/machine/include/machine-xilinx-qemu.inc
+require conf/machine/include/obmc-bsp-common.inc
+
+MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost"
+
+# u-boot configuration
+UBOOT_MACHINE = "zynq_zc702_config"
+SPL_BINARY = "spl/boot.bin"
+
+EXTRA_IMAGEDEPENDS += " \
+		u-boot-zynq-uenv \
+		virtual/boot-bin \
+		"
+
+SERIAL_CONSOLE = "115200 ttyPS0"
+
+KERNEL_DEVICETREE = "zynq-zc702.dtb"
+
+IMAGE_BOOT_FILES += "boot.bin uEnv.txt ${KERNEL_IMAGETYPE}-zynq-zc702.dtb"
+
+KERNEL_FEATURES_remove = "phosphor-gpio-keys"
+
+# Overwrite flash offsets
+FLASH_UBOOT_OFFSET = "0"
+FLASH_KERNEL_OFFSET = "6144"
+FLASH_UBI_OFFSET = "${FLASH_KERNEL_OFFSET}"
+FLASH_ROFS_OFFSET = "12288"
+FLASH_RWFS_OFFSET = "65024"
+FLASH_SIZE = "65536"
+
+PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "evb-zx3-pm3-led-manager-config-native"
+PREFERRED_PROVIDER_u-boot = "u-boot-xlnx"
+PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/recipes-phosphor/leds/evb-zx3-pm3-led-manager-config-native.bb b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/recipes-phosphor/leds/evb-zx3-pm3-led-manager-config-native.bb
new file mode 100644
index 0000000..01b58da
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/recipes-phosphor/leds/evb-zx3-pm3-led-manager-config-native.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Phosphor LED Group Management for Enclustra Mars ZX3"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+
+PROVIDES += "virtual/phosphor-led-manager-config-native"
+
+SRC_URI += "file://led.yaml"
+S = "${WORKDIR}"
+
+# Copies example led layout yaml file
+do_install() {
+    SRC=${S}
+    DEST=${D}${datadir}/phosphor-led-manager
+    install -D ${SRC}/led.yaml ${DEST}/led.yaml
+}
diff --git a/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/recipes-phosphor/leds/evb-zx3-pm3-led-manager-config/led.yaml b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/recipes-phosphor/leds/evb-zx3-pm3-led-manager-config/led.yaml
new file mode 100644
index 0000000..38eb769
--- /dev/null
+++ b/meta-evb/meta-evb-enclustra/meta-evb-zx3-pm3/recipes-phosphor/leds/evb-zx3-pm3-led-manager-config/led.yaml
@@ -0,0 +1,37 @@
+enclosure_identify:
+  led1:
+    Action: 'Blink'
+    DutyOn: 20
+    Period: 100
+
+bmc_booted:
+  led2:
+    Action: 'Blink'
+    DutyOn: 50
+    Period: 1000
+
+power_on:
+  led3:
+    Action: 'Blink'
+    DutyOn: 50
+    Period: 1000
+
+enclosure_fault:
+  led3:
+    Action: 'Blink'
+    DutyOn: 50
+    Period: 30
+
+lamp_test:
+  led1:
+    Action: 'Blink'
+    DutyOn: 20
+    Period: 50
+  led2:
+    Action: 'Blink'
+    DutyOn: 20
+    Period: 100
+  led3:
+    Action: 'Blink'
+    DutyOn: 20
+    Period: 150