meta-fii/meta-kudo: update kudo utility

1. Update to support DVT board
2. Support command for console redirection
3. Disable 2nd CPU clock when only 1 CPU is installed
4. Set HPM_STBY_RST_N to High to match dcscm spec

Signed-off-by: Lancelot Kao <lancelot.kao@fii-usa.com>
Change-Id: I300b272587ddc2c7d82aa76196e5db100d02aae2
Signed-off-by: Mohaimen Alsamarai <mohaimen.alsamarai@fii-na.com>
diff --git a/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-boot/init_once.sh b/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-boot/init_once.sh
index b589379..5145009 100644
--- a/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-boot/init_once.sh
+++ b/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-boot/init_once.sh
@@ -1,7 +1,10 @@
 #!/bin/bash
 
 source /usr/sbin/kudo-lib.sh
-
+# sleep so that FRU and all ipmitool Devices are ready before HOST OS
+# gpio 143 for HPM_STBY_RST_N do to DC-SCM spec
+set_gpio_ctrl 143 out 1
+sleep 5 # for the MUX to get ready 
 # set all mux route to CPU before power on host
 # BMC_CPU_RTC_I2C_SEL #120
 set_gpio_ctrl 120 out 1
@@ -21,7 +24,27 @@
 i2cset -y -f -a 13 0x76 0x10 0x00
 
 # Power control
-# MON_BMC_ALIVE, GPIO 10
+# MON_BMC_ALIVE, GPIO 10(EVT), GPIO137(DVT)
 set_gpio_ctrl 10 out 1
+set_gpio_ctrl 137 out 1
 # S0_BMC_OK, GPIO 69
 set_gpio_ctrl 69 out 1
+
+# Disable CPU 1 CLK when cpu not detected
+boardver=$(printf '%d' `cat /sys/bus/i2c/drivers/fiicpld/34-0076/CMD00 | awk '{print $6}'`)
+# echo init_once cpu $CPU1_STATUS > /dev/ttyS0
+# echo init_once board $boardver > /dev/ttyS0
+CPU1_STATUS_N=$(get_gpio_ctrl 136)
+if [[ $CPU1_STATUS_N == 1 ]]; then
+    #Execute this only on DVT systems
+    if [[ $boardver == 0 ]]; then
+        echo EVT system $boardver
+    else
+        echo DVT system $boardver
+        i2cset -y -a -f 37 0x68 0x05 0x03
+    fi
+    #These i2c deviecs are already installed on EVT systems
+    i2cset -y -a -f 16 0x6a 0 1 0xdf i
+    i2cset -y -a -f 16 0x6a 11 1 0x01 i
+    i2cset -y -a -f 17 0x67 1 2 0x3f 0x0c i
+fi
diff --git a/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo.sh b/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo.sh
index 2305a74..03adb8e 100644
--- a/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo.sh
+++ b/meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo.sh
@@ -13,7 +13,6 @@
 }
 
 function usage_led() {
-
   echo " kudo led 'att'/'boot' [parameter]"
   echo "        on --> change to CPU console"
   echo "        off --> change to CPU 0 SCP console"
@@ -22,11 +21,13 @@
 
 function usage_uart() {
   echo " kudo uart [parameter]"
-  echo "        host --> change to CPU console"
-  echo "        scp1 --> change to CPU 0 SCP console"
-  echo "        scp2 --> change to CPU 1 SCP console"
-  echo "        hosthr --> change CPU console to header"
-  echo "        scphr --> change SCP console to header"
+  echo "        host --> show CPU console"
+  echo "        scp --> show SCP0 console"
+  echo "        swhost --> change to CPU console to ttyS1"
+  echo "        swscp1 --> change to CPU 0 SCP console to ttyS3"
+  echo "        swscp2 --> change to CPU 1 SCP console"
+  echo "        swhosthr --> change CPU console to header"
+  echo "        swscphr --> change SCP console to header"
   echo "        display  --> "
 }
 
@@ -114,22 +115,38 @@
 function uartmux() {
   case $1 in
     host)
+      if [ `tty` ==  "/dev/ttyS0" ]; then
+        echo "Couldn't redirect to the host console within BMC local console"
+      else
+        echo "Entering Console use 'shift ~~..' to quit"
+        obmc-console-client -c /etc/obmc-console/server.ttyS1.conf
+      fi
+      ;;
+    scp)
+      if [ `tty` ==  "/dev/ttyS0" ]; then
+        echo "Couldn't redirect to the scp console within BMC local console"
+      else
+        echo "Entering Console use 'shift ~~..' to quit"
+        obmc-console-client -c /etc/obmc-console/server.ttyS3.conf
+      fi
+      ;;
+    swhost)
       set_gpio_ctrl 167 out 1
       ;;
-    scp1)
+    swscp1)
       set_gpio_ctrl 161 out 1
       set_gpio_ctrl 177 out 1
       set_gpio_ctrl 198 out 0
       ;;
-    scp2)
+    swscp2)
       set_gpio_ctrl 161 out 1
       set_gpio_ctrl 177 out 1
       set_gpio_ctrl 198 out 1
       ;;
-    hosthr)
+    swhosthr)
       set_gpio_ctrl 167 out 0
       ;;
-    scphr)
+    swscphr)
       set_gpio_ctrl 161 out 0
       set_gpio_ctrl 177 out 0
       ;;