meta-asrock: Initial skeleton of e3c256d4i platform support

This is a single-socket mini-ITX Xeon board with an AST2500 BMC, roughly
an updated version of the e3c246d4i.  Note though that because this
platform uses eSPI instead of LPC, it currently requires some driver
support that's not yet in the OpenBMC kernel to actually boot the host.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Ib3a13e0ac9f4130c7965ce63f804eb169262fcd3
diff --git a/meta-asrock/meta-e3c256d4i/conf/layer.conf b/meta-asrock/meta-e3c256d4i/conf/layer.conf
new file mode 100644
index 0000000..d792c95
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/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 += "e3c256d4i-layer"
+BBFILE_PATTERN_e3c256d4i-layer = "^${LAYERDIR}/"
+LAYERSERIES_COMPAT_e3c256d4i-layer = "nanbield scarthgap"
diff --git a/meta-asrock/meta-e3c256d4i/conf/machine/e3c256d4i.conf b/meta-asrock/meta-e3c256d4i/conf/machine/e3c256d4i.conf
new file mode 100644
index 0000000..cd29ac3
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/conf/machine/e3c256d4i.conf
@@ -0,0 +1,18 @@
+KMACHINE = "aspeed"
+KERNEL_DEVICETREE = "aspeed/${KMACHINE}-bmc-asrock-${MACHINE}.dtb"
+
+UBOOT_DEVICETREE = "ast2500-evb"
+UBOOT_MACHINE = "evb-ast2500_defconfig"
+
+FLASH_SIZE = "65536"
+
+require conf/machine/include/ast2500.inc
+require conf/machine/include/obmc-bsp-common.inc
+
+PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-asrock-apps"
+PREFERRED_PROVIDER_virtual/obmc-system-mgmt = "packagegroup-asrock-apps"
+
+PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw ?= "phosphor-ipmi-kcs"
+
+VIRTUAL-RUNTIME_obmc-inventory-manager = "entity-manager"
+VIRTUAL-RUNTIME_obmc-sensors-hwmon = "dbus-sensors"
diff --git a/meta-asrock/meta-e3c256d4i/conf/templates/default/bblayers.conf.sample b/meta-asrock/meta-e3c256d4i/conf/templates/default/bblayers.conf.sample
new file mode 100644
index 0000000..0d8e82c
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/conf/templates/default/bblayers.conf.sample
@@ -0,0 +1,18 @@
+# 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-python \
+  ##OEROOT##/meta-phosphor \
+  ##OEROOT##/meta-aspeed \
+  ##OEROOT##/meta-asrock \
+  ##OEROOT##/meta-asrock/meta-e3c256d4i \
+  "
diff --git a/meta-asrock/meta-e3c256d4i/conf/templates/default/local.conf.sample b/meta-asrock/meta-e3c256d4i/conf/templates/default/local.conf.sample
new file mode 100644
index 0000000..776bd28
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/conf/templates/default/local.conf.sample
@@ -0,0 +1,17 @@
+MACHINE ??= "e3c256d4i"
+DISTRO ?= "openbmc-phosphor"
+PACKAGE_CLASSES ?= "package_ipk"
+SANITY_TESTED_DISTROS:append ?= " *"
+EXTRA_IMAGE_FEATURES = "debug-tweaks"
+USER_CLASSES ?= "buildstats"
+PATCHRESOLVE = "noop"
+BB_DISKMON_DIRS = "\
+    STOPTASKS,${TMPDIR},1G,100K \
+    STOPTASKS,${DL_DIR},1G,100K \
+    STOPTASKS,${SSTATE_DIR},1G,100K \
+    STOPTASKS,/tmp,100M,100K \
+    HALT,${TMPDIR},100M,1K \
+    HALT,${DL_DIR},100M,1K \
+    HALT,${SSTATE_DIR},100M,1K \
+    HALT,/tmp,10M,1K"
+CONF_VERSION = "2"
diff --git a/meta-asrock/meta-e3c256d4i/recipes-asrock/packagegroups/packagegroup-asrock-apps.bb b/meta-asrock/meta-e3c256d4i/recipes-asrock/packagegroups/packagegroup-asrock-apps.bb
new file mode 100644
index 0000000..52b031d
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-asrock/packagegroups/packagegroup-asrock-apps.bb
@@ -0,0 +1,28 @@
+SUMMARY = "OpenBMC for ASRock - Applications"
+PR = "r1"
+
+inherit packagegroup
+
+PROVIDES = "${PACKAGES}"
+PACKAGES = " \
+    ${PN}-flash \
+    ${PN}-system \
+    "
+
+PROVIDES += "virtual/obmc-flash-mgmt"
+PROVIDES += "virtual/obmc-system-mgmt"
+
+RPROVIDES:${PN}-flash += "virtual-obmc-flash-mgmt"
+RPROVIDES:${PN}-system += "virtual-obmc-system-mgmt"
+
+SUMMARY:${PN}-flash = "ASRock Flash"
+RDEPENDS:${PN}-flash = " \
+    phosphor-ipmi-flash \
+    "
+
+SUMMARY:${PN}-system = "ASRock System"
+RDEPENDS:${PN}-system = " \
+    phosphor-host-postd \
+    phosphor-post-code-manager \
+    phosphor-software-manager \
+    "
diff --git a/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/files/e3c256d4i.cfg b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/files/e3c256d4i.cfg
new file mode 100644
index 0000000..e0814ce
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/files/e3c256d4i.cfg
@@ -0,0 +1,5 @@
+# Needed as a bug workaround -- due to (apparently) a missing pull-up resistor
+# on the reset line, u-boot switching the pinctrl when it binds its mmc driver
+# glitches the line and resets the host; disabling the driver (which we don't
+# need) prevents that.
+CONFIG_MMC_SDHCI_ASPEED=n
diff --git a/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend
new file mode 100644
index 0000000..a4d89c0
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend
@@ -0,0 +1 @@
+require u-boot-common-aspeed-sdk.inc
diff --git a/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-common-aspeed-sdk.inc b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-common-aspeed-sdk.inc
new file mode 100644
index 0000000..95ebc41
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-common-aspeed-sdk.inc
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append = " \
+    file://e3c256d4i.cfg \
+    "
diff --git a/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend
new file mode 100644
index 0000000..a4d89c0
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend
@@ -0,0 +1 @@
+require u-boot-common-aspeed-sdk.inc
diff --git a/meta-asrock/meta-e3c256d4i/recipes-kernel/linux/linux-aspeed/e3c256d4i.cfg b/meta-asrock/meta-e3c256d4i/recipes-kernel/linux/linux-aspeed/e3c256d4i.cfg
new file mode 100644
index 0000000..e2fb274
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-kernel/linux/linux-aspeed/e3c256d4i.cfg
@@ -0,0 +1,6 @@
+CONFIG_SENSORS_ISL68137=y
+CONFIG_PECI=y
+CONFIG_PECI_CPU=y
+CONFIG_PECI_ASPEED=y
+CONFIG_SENSORS_PECI_CPUTEMP=y
+CONFIG_SENSORS_PECI_DIMMTEMP=y
diff --git a/meta-asrock/meta-e3c256d4i/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-asrock/meta-e3c256d4i/recipes-kernel/linux/linux-aspeed_%.bbappend
new file mode 100644
index 0000000..ef8e971
--- /dev/null
+++ b/meta-asrock/meta-e3c256d4i/recipes-kernel/linux/linux-aspeed_%.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+SRC_URI += " \
+    file://e3c256d4i.cfg \
+    "