summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh
diff options
context:
space:
mode:
authorThang Q. Nguyen <thang@os.amperecomputing.com>2021-11-04 11:30:27 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2021-11-04 16:10:58 +0300
commitdde1fede1f832f029742a1d27290cfe252ab1bc5 (patch)
treed8e4bbb3ee309dbcc4324a98682bbf444bbe8ca2 /meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh
parent5a5f33c729e6b5869362172b63595422eb84a418 (diff)
downloadopenbmc-dde1fede1f832f029742a1d27290cfe252ab1bc5.tar.xz
meta-ampere: fix shellcheck issues
Fix all issues from the shellcheck checked on bash shells under meta-ampere. Tested: Verify the following features: 1. Power control (on,off, cycle, graceful shutdown, hard reset). 2. UART switching. 3. UEFI firmware update. Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com> Change-Id: Idabf839b7521ecadb642230cc8bb3472c787002e
Diffstat (limited to 'meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh')
-rw-r--r--meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh50
1 files changed, 26 insertions, 24 deletions
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh b/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh
index 8e4f455bf..1a098f446 100644
--- a/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-gpio-config/ampere_gpio_utils.sh
@@ -1,43 +1,45 @@
#!/bin/bash
+
+# shellcheck source=/dev/null
source /usr/sbin/gpio-defs.sh
source /usr/sbin/gpio-lib.sh
function usage() {
- echo "usage: ampere_gpio_utils.sh [power] [on|off]";
+ echo "usage: ampere_gpio_utils.sh [power] [on|off]";
}
set_gpio_power_off() {
- echo "Setting GPIO before Power off"
- gpio_configure_output $OCP_AUX_PWREN 1
- gpio_configure_output $OCP_MAIN_PWREN 0
- gpio_configure_output $SPI0_PROGRAM_SEL 0
+ echo "Setting GPIO before Power off"
+ gpio_configure_output "$OCP_AUX_PWREN" 1
+ gpio_configure_output "$OCP_MAIN_PWREN" 0
+ gpio_configure_output "$SPI0_PROGRAM_SEL" 0
}
set_gpio_power_on() {
- echo "Setting GPIO before Power on"
- gpio_configure_output $OCP_AUX_PWREN 1
- gpio_configure_output $OCP_MAIN_PWREN 1
- gpio_configure_output $SPI0_PROGRAM_SEL 1
- gpio_configure_output $SPI0_BACKUP_SEL 0
+ echo "Setting GPIO before Power on"
+ gpio_configure_output "$OCP_AUX_PWREN" 1
+ gpio_configure_output "$OCP_MAIN_PWREN" 1
+ gpio_configure_output "$SPI0_PROGRAM_SEL" 1
+ gpio_configure_output "$SPI0_BACKUP_SEL" 0
}
if [ $# -lt 2 ]; then
- echo "Total number of parameter=$#"
- echo "Insufficient parameter"
- usage;
- exit 0;
+ echo "Total number of parameter=$#"
+ echo "Insufficient parameter"
+ usage;
+ exit 0;
fi
-if [ $1 == "power" ]; then
- if [ $2 == "on" ]; then
- set_gpio_power_on
- elif [ $2 == "off" ]; then
- set_gpio_power_off
- fi
- exit 0;
+if [ "$1" == "power" ]; then
+ if [ "$2" == "on" ]; then
+ set_gpio_power_on
+ elif [ "$2" == "off" ]; then
+ set_gpio_power_off
+ fi
+ exit 0;
else
- echo "Invalid parameter1=$1"
- usage;
- exit 0;
+ echo "Invalid parameter1=$1"
+ usage;
+ exit 0;
fi
exit 0;