summaryrefslogtreecommitdiff
path: root/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh
diff options
context:
space:
mode:
authorVijay Khemka <vijaykhemka@fb.com>2020-02-21 00:35:51 +0300
committerAndrew Geissler <geissonator@yahoo.com>2020-03-05 04:44:17 +0300
commit60329ae7948afad0113799469efa212bba60b9b7 (patch)
treeb1599d5ef9baa2eb998019c1d2497a176952cc1c /meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh
parentde4b38553068abc5058acc7bae4d4d855999af03 (diff)
downloadopenbmc-60329ae7948afad0113799469efa212bba60b9b7.tar.xz
meta-facebook: Move common recipe under facebook layer
Moved common facebook recipe under meta-facebook to support multiple facebook platform and make use of common code across platforms. This is just a first phase to add common layer and moved meta-tiogapass/recipe-fbtp to ./recipe-fb. Slowly, will move all common meta data under meta-facebook. (From meta-facebook rev: 2769bfe7823ce0ce426f2faf463c6d91e43b6c29) Change-Id: I7f9f0d2d621524bc6de1c948a55a23238e3a7b7f Signed-off-by: Vijay Khemka <vijaykhemka@fb.com> Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh')
-rwxr-xr-xmeta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh b/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh
new file mode 100755
index 000000000..2624abd0d
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh
@@ -0,0 +1,22 @@
+#!/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)) low
+
+# FP_PECI_MUX, active low
+set_gpio_active_low $((${GPIO_BASE} + 212)) high
+
+exit 0;