meta-bletchley: motor-ctrl: Change sled numbering to 1-based
switch sled to 1-based numbering to align with multi host systems
tools only accept input sled1 to sled6
Change-Id: Ic372e011716d8de7edf2eebdf8667e44b2179e64
Signed-off-by: Allen.Wang <Allen_Wang@quantatw.com>
diff --git a/meta-facebook/meta-bletchley/conf/machine/bletchley.conf b/meta-facebook/meta-bletchley/conf/machine/bletchley.conf
index 6b7711a..c7407e8 100644
--- a/meta-facebook/meta-bletchley/conf/machine/bletchley.conf
+++ b/meta-facebook/meta-bletchley/conf/machine/bletchley.conf
@@ -14,5 +14,5 @@
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "bletchley-led-manager-config-native"
-OBMC_HOST_INSTANCES = "0 1 2 3 4 5 "
+OBMC_HOST_INSTANCES = "1 2 3 4 5 6"
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-ctrl b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-ctrl
index 9607453..302c94b 100755
--- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-ctrl
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-ctrl
@@ -41,7 +41,7 @@
}
function show_usage(){
- echo "Usage: motor-ctrl [sled0 | sled1 | sled2 | sled3 | sled4 | sled5] [f r s]"
+ echo "Usage: motor-ctrl [sled1 | sled2 | sled3 | sled4 | sled5 | sled6] [f r s]"
echo " f : Step Motor go forward"
echo " r : Step Motor go reverse"
echo " s : Step Motor stop "
@@ -52,7 +52,7 @@
exit 1;
fi
-if [[ "$1" =~ ^(slot[0-5]{1})$ ]] || [[ "$1" =~ ^(sled[0-5]{1})$ ]]; then
+if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
SLED=$1
SLED_NUM=${SLED:4}
ACTION=$2
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-init b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-init
index 60de76b..89369ac 100755
--- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-init
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/motor-init
@@ -8,8 +8,8 @@
export PATH=$PATH:/usr/libexec
PWM_CLASS_PATH="/sys/class/pwm/pwmchip0"
-#Sleld 0~5 using bmc pwm8~13 as motor driver stick
-PWM_NUM_OFFSET=8
+#Sleld 1~6 using bmc pwm8~13 as motor driver stick
+PWM_NUM_OFFSET=7
PWM_PERIOD=2500000 #400HZ
PWM_DUTY=250000 #PWM_PERIOD X 10%
CALIBRATE_TIMEOUT=120
@@ -97,7 +97,7 @@
done
}
-if [[ "$1" =~ ^(slot[0-5]{1})$ ]] || [[ "$1" =~ ^(sled[0-5]{1})$ ]]; then
+if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
SLED=$1
SLED_NUM=${SLED:4}
else
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
index eebe50c..83d65df 100755
--- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
@@ -62,9 +62,9 @@
function get_bus_num() {
SLED_NUM=$1
local bus=0
-
- if [[ "$SLED_NUM" = [0-5] ]]; then
- bus="$SLED_NUM"
+ #Mapping Sled number 1~6 to i2c bus number 0~5
+ if [[ "$SLED_NUM" = [1-6] ]]; then
+ bus=$(( SLED_NUM - 1 ))
fi
echo "$bus"
}
@@ -120,7 +120,7 @@
}
function show_usage(){
- echo "Usage: power-ctrl [sled0 | sled1 | sled2 | sled3 | sled4 | sled5] [on off ac-on ac-off status]"
+ echo "Usage: power-ctrl [sled1 | sled2 | sled3 | sled4 | sled5 | sled6] [on off ac-on ac-off status]"
echo " power-ctrl chassis-cycle"
}
@@ -142,7 +142,7 @@
exit 1;
fi
-if [[ "$1" =~ ^(slot[0-5]{1})$ ]] || [[ "$1" =~ ^(sled[0-5]{1})$ ]]; then
+if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
SLED=$1
ACTION=$2
SLED_NUM=${SLED:4}