Add fb-powerctrl to Facebook Tiogapass

Added a new module fb-powerctrl to comtrol host power. It
includes power-util which controls power on and off of
given host server.

Tested: Build Facebook TiogaPass board and load on the
target hardware. Ensured that power on and off features
works as expected.

(From meta-facebook rev: 67abf96e04c1aab15c90480eca2b00bf9b5c51ab)

Change-Id: I21090bbe461111c15e404c544f303615fbf62c9b
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh
new file mode 100755
index 0000000..4e13109
--- /dev/null
+++ b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Set all output GPIOs as such and drive them with reasonable values.
+function set_gpio_active_low() {
+  if [ $# -ne 2 ]; then
+    echo "set_gpio_active_low: need both GPIO# and initial level";
+    return;
+  fi
+
+  echo $1 > /sys/class/gpio/export
+  echo $2 > /sys/class/gpio/gpio$1/direction
+}
+
+GPIO_BASE=$(cat /sys/class/gpio/gpio*/base)
+
+# FM_BMC_READY_N, GPIO S1, active low
+set_gpio_active_low $((${GPIO_BASE} + 144 +1)) high
+
+# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
+set_gpio_active_low $((${GPIO_BASE} + 128 + 6)) high
+
+# FP_PWR_BTN_PASS_R_N, GPIO E3, active low
+set_gpio_active_low $((${GPIO_BASE} + 32 + 3)) high
+
+# FP_PWR_GOOD, GPIO B6, active low
+set_gpio_active_low $((${GPIO_BASE} + 8 + 6)) high
+
+exit 0;