blob: 2c502980a47fbaa3926fec6ac5d644b3534c9457 [file] [log] [blame]
#!/bin/bash
BMC_CPLD_VER_FILE="/run/cpld0.version"
MB_CPLD_VER_FILE="/run/cpld1.version"
ver=''
function fw_rev() {
case $1 in
cpldb)
rsp=($(i2cget -y -f -a 13 0x76 0x00 i 5))
ver=$(printf '%d.%d.%d.%d' ${rsp[6]} ${rsp[5]} ${rsp[4]} ${rsp[3]})
;;
cpldm)
I2C_BUS_DEV=$(readlink "/sys/bus/i2c/devices/4-0077/channel-2" | cut -c 8-)
rsp=($(i2cget -y -f -a $I2C_BUS_DEV 0x76 0x00 i 5))
ver=$(printf '%d.%d.%d.%d' ${rsp[6]} ${rsp[5]} ${rsp[4]} ${rsp[3]})
;;
*)
;;
esac
}
fw_rev cpldb
echo "BMC CPLD version : ${ver}"
echo "${ver}" > "${BMC_CPLD_VER_FILE}"
fw_rev cpldm
echo "MB CPLD version : ${ver}"
echo "${ver}" > "${MB_CPLD_VER_FILE}"