meta-facebook: yosemite4: Initial commit for yosemite4n
Description:
Add yosemite4n layer under yosemite4.
Add common configurations for yosemite4 and yosemite4n.
Add json file set uboot baudrate to 57600.
Tested:
Build Success.
Change-Id: I7ff2ffa3e008be9d2f132ac6c3f058fa7b33f329
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Signed-off-by: Tim Lee <timlee660101@gmail.com>
Signed-off-by: Ricky CX Wu <ricky.cx.wu.wiwynn@gmail.com>
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh
index fcb8677..ded51ae 100644
--- a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh
@@ -1,16 +1,33 @@
#!/bin/sh
-# Set mctpi2c link up and assign local address.
+# Set mctpi2c/mctpi3c link up and assign local address.
localEid=8
-# The Sentinel Dome BICs are on the i2c bus0 to bus7.
+# shellcheck source=meta-facebook/meta-yosemite4/recipes-yosemite4/plat-tool/files/yosemite4-common-functions
+. /usr/libexec/yosemite4-common-functions
+
+is_nuvoton_board="$(check_nuvoton_board)"
+
busnum=0
-while [ $busnum -le 7 ]
-do
- mctp link set mctpi2c${busnum} up
- mctp addr add ${localEid} dev mctpi2c${busnum}
- busnum=$((busnum+1))
-done
+if [ -n "$is_nuvoton_board" ]; then
+ # Enable MCTP-I3C for Nuvoton BMC
+ # The Sentinel Dome BICs are after the I3C hub on I3C bus0 and bus1.
+ while [ $busnum -le 1 ]
+ do
+ mctp link set mctpi3c${busnum} up
+ mctp addr add ${localEid} dev mctpi3c${busnum}
+ busnum=$((busnum+1))
+ done
+else
+ # Enable MCTP-I2C for ASPEED BMC
+ # The Sentinel Dome BICs are on the i2c bus0 to bus7.
+ while [ $busnum -le 7 ]
+ do
+ mctp link set mctpi2c${busnum} up
+ mctp addr add ${localEid} dev mctpi2c${busnum}
+ busnum=$((busnum+1))
+ done
+fi
# The NICs are on the i2c bus24 to bus27.
busnum=24
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs.sh b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs.sh
new file mode 100644
index 0000000..bf56636
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# shellcheck disable=SC2034
+# shellcheck source=meta-facebook/meta-yosemite4/recipes-yosemite4/plat-tool/files/yosemite4-common-functions
+. /usr/libexec/yosemite4-common-functions
+
+is_nuvoton_board="$(check_nuvoton_board)"
+
+if [ -n "$is_nuvoton_board" ]
+then
+ WIDTH=32
+ # PRSNT_NIC0 is at the 23th bit (GPIO Bank5: GPIO183), 0 means NIC is present
+ PRSNT_NIC0=0xf0015004
+ BITMASK_NIC0=0x800000
+
+ # PRSNT_NIC1 is at the 29th bit (GPIO Bank5: GPIO189), 0 means NIC is present
+ PRSNT_NIC1=0xf0015004
+ BITMASK_NIC1=0x20000000
+
+ # PRSNT_NIC2 is at the 28th bit (GPIO Bank2: GPIO92), 0 means NIC is present
+ PRSNT_NIC2=0xf0012004
+ BITMASK_NIC2=0x10000000
+
+ # PRSNT_NIC3 is at the 24th bit (GPIO Bank5: GPIO184), 0 means NIC is present
+ PRSNT_NIC3=0xf0015004
+ BITMASK_NIC3=0x400000
+else
+ WIDTH=8
+ # PRSNT_NIC0 is at the 6th bit (GPIOU5), 0 means NIC is present
+ PRSNT_NIC0=0x1e780088
+ BITMASK_NIC0=0x20
+
+ # PRSNT_NIC1 is at the 1th bit (GPIOE0), 0 means NIC is present
+ PRSNT_NIC1=0x1e780020
+ BITMASK_NIC1=0x01
+
+ # PRSNT_NIC2 is at the 2th bit (GPIOE1), 0 means NIC is present
+ PRSNT_NIC2=0x1e780020
+ BITMASK_NIC2=0x02
+
+ # PRSNT_NIC3 is at the 4th bit (GPIOM3), 0 means NIC is present
+ PRSNT_NIC3=0x1e780078
+ BITMASK_NIC3=0x08
+fi
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh
index e71e147..6cacf32 100644
--- a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh
@@ -4,27 +4,29 @@
# the gpio pin is occupied by gpio-monitor, read the value from
# gpioget is not possible.
+# shellcheck source=meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs.sh
+. /usr/share/mctp/nic-gpio-addrs.sh
+
# Setup slot1 NIC
-gpio_val=$(devmem 0x1e780088 8)
-# PRSNT_NIC0 is at the 6th bit (GPIOU5), 0 means NIC is present
-if [ $((gpio_val & 0x20)) -eq 0 ]; then
- systemctl start setup-nic-endpoint-slot@0.service
+gpio_val=$(devmem "$PRSNT_NIC0" "$WIDTH")
+if [ $((gpio_val & "$BITMASK_NIC0")) -eq 0 ]; then
+ systemctl start setup-nic-endpoint-slot@0.service
fi
-# Setup slot2 & 3 NIC
-gpio_val=$(devmem 0x1e780020 8)
-# PRSNT_NIC1 is at the 1th bit (GPIOE0), 0 means NIC is present
-if [ $((gpio_val & 0x01)) -eq 0 ]; then
- systemctl start setup-nic-endpoint-slot@1.service
+# Setup slot2 NIC
+gpio_val=$(devmem "$PRSNT_NIC1" "$WIDTH")
+if [ $((gpio_val & "$BITMASK_NIC1")) -eq 0 ]; then
+ systemctl start setup-nic-endpoint-slot@1.service
fi
-# PRSNT_NIC2 is at the 2th bit (GPIOE1), 0 means NIC is present
-if [ $((gpio_val & 0x02)) -eq 0 ]; then
- systemctl start setup-nic-endpoint-slot@2.service
+
+# Setup slot3 NIC
+gpio_val=$(devmem "$PRSNT_NIC2" "$WIDTH")
+if [ $((gpio_val & "$BITMASK_NIC2")) -eq 0 ]; then
+ systemctl start setup-nic-endpoint-slot@2.service
fi
# Setup slot4 NIC
-gpio_val=$(devmem 0x1e780078 8)
-# PRSNT_NIC3 is at the 4th bit (GPIOM3), 0 means NIC is present
-if [ $((gpio_val & 0x08)) -eq 0 ]; then
- systemctl start setup-nic-endpoint-slot@3.service
+gpio_val=$(devmem "$PRSNT_NIC3" "$WIDTH")
+if [ $((gpio_val & "$BITMASK_NIC3")) -eq 0 ]; then
+ systemctl start setup-nic-endpoint-slot@3.service
fi
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend b/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
index 04dcac3..41e2a65 100644
--- a/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
@@ -1,11 +1,11 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
-
SRC_URI += " \
file://setup-local-eid.conf \
file://setup-static-endpoints.conf \
file://mctp-config.sh \
file://setup-static-endpoints.sh \
+ file://nic-gpio-addrs.sh \
"
FILES:${PN} += "${systemd_system_unitdir}/*"
@@ -22,4 +22,7 @@
${D}${datadir}/mctp/
install -m 0755 ${WORKDIR}/setup-static-endpoints.sh \
${D}${datadir}/mctp/
+ install -d ${D}${datadir}/mctp
+ install -m 0755 ${WORKDIR}/nic-gpio-addrs.sh \
+ ${D}${datadir}/mctp/
}