meta-romulus: Update VRM control scripts

Romulus VDDR uses different regulator, so the scripts is updated:
1. Remove VDDR related settings in vrm-control.sh
2. Add vrm.sh to invoke vrm-control.sh to set VDN, and invoke i2cset to
set VDDR.

Change-Id: I8be757728833280392328eaf03b3a88b911a4fbd
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control.bb b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control.bb
index b924aae..049fabe 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control.bb
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control.bb
@@ -8,10 +8,12 @@
 RDEPENDS_${PN} += "i2c-tools bash"
 
 S = "${WORKDIR}"
-SRC_URI += "file://vrm-control.sh"
+SRC_URI += "file://vrm-control.sh \
+            file://vrm.sh"
 
 do_install() {
         install -d ${D}${bindir}
+        install -m 0755 ${WORKDIR}/vrm.sh ${D}${bindir}/vrm.sh
         install -m 0755 ${WORKDIR}/vrm-control.sh ${D}${bindir}/vrm-control.sh
 }
 
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
index 9e6507e..8701242 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 # #########################################################
-# Script to run on BMC to read/set vrm voltages
+# Script to run on Romulus BMC to read/set vrm voltages
 
 
 # #########################################################
@@ -84,14 +84,14 @@
 
 if [ -e $1 ]
 then
-  $0 vdda vcsa vdna vioa vddra vddb vcsb vdnb viob vddrb
+  $0 vdda vcsa vdna vioa vddb vcsb vdnb viob
   exit
 fi
 
 if [ $1 == "-h" ]
 then
   echo "  Usage: vrm [<rail>=[value] [<rail>=[value]] ...]"
-  echo "    rail: vdda vcsa vdna vioa vddra vddb vcsb vdnb viob vddrb"
+  echo "    rail: vdda vcsa vdna vioa vddb vcsb vdnb viob"
   echo "    value: volts"
   echo
   echo "    e.g., vrm vioa=1.0 viob=1.0"
@@ -107,7 +107,6 @@
   val=`echo ${param}= | cut -d'=' -f 2`
   echo -n "$rail"
   case "$rail" in
-  # FIXME: What's the addresses for Romulus?
     vdda)
       rw_vc 4 0x70 2 0 $val
       ;;
@@ -132,12 +131,6 @@
     viob)
       rw_vc 5 0x73 2 1 $val
       ;;
-    vddra)
-      rw_vc 4 0x72 2 1 $val  # This is wrong
-      ;;
-    vddrb)
-      rw_vc 5 0x72 2 1 $val  # This is wrong
-      ;;
     *)
       echo "	non-existant"
   esac
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control@.service b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control@.service
index 716c526..75c0067 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control@.service
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control@.service
@@ -6,7 +6,7 @@
 Conflicts=obmc-chassis-stop@%i.target
 
 [Service]
-ExecStart={bindir}/vrm-control.sh vdna=0.9 vddra=1.35 vdnb=0.9 vddrb=1.35
+ExecStart={bindir}/vrm.sh
 Type=oneshot
 RemainAfterExit=yes
 
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm.sh b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm.sh
new file mode 100644
index 0000000..b0ac60c
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+vrm-control.sh vdna=0.9 vdnb=0.9
+
+i2cset -y 4 0x71 0x21 0xDD 0x00 i  # CPU0 VDDR 1.35V
+i2cset -y 4 0x72 0x21 0xDD 0x00 i
+i2cset -y 5 0x71 0x21 0xDD 0x00 i  # CPU1 VDDR 1.35V
+i2cset -y 5 0x72 0x21 0xDD 0x00 i