blob: 98f4ffc0b354bc34d7eadd7372d8e11c6bd45552 [file] [log] [blame]
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +00001#!/bin/bash
2
Thu Nguyene50b26f2023-07-12 11:59:14 +07003# shellcheck disable=SC2046
4# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/mtjade_platform_gpios_init.sh
5source /usr/sbin/platform_gpios_init.sh
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +00006
Thu Nguyene50b26f2023-07-12 11:59:14 +07007#pre platform init function. implemented in platform_gpios_init.sh
8pre-platform-init
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +00009
10# =======================================================
Thu Nguyene50b26f2023-07-12 11:59:14 +070011# Setting default value for device sel and mux
Thang Q. Nguyened818132022-02-22 10:48:32 +000012bootstatus=$(cat /sys/class/watchdog/watchdog0/bootstatus)
13if [ "$bootstatus" == '32' ]; then
Thu Nguyene50b26f2023-07-12 11:59:14 +070014 echo "CONFIGURE: gpio pins to output high after AC power"
15 for gpioName in "${output_high_gpios_in_ac[@]}"; do
16 gpioset $(gpiofind "$gpioName")=1
17 done
18 echo "CONFIGURE: gpio pins to output low after AC power"
19 for gpioName in "${output_low_gpios_in_ac[@]}"; do
20 gpioset $(gpiofind "$gpioName")=0
21 done
22 echo "CONFIGURE: gpio pins to input after AC power"
23 for gpioName in "${input_gpios_in_ac[@]}"; do
24 gpioget $(gpiofind "$gpioName")
25 done
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +000026fi
Thang Q. Nguyenbddca602022-07-29 14:45:33 +070027
Thu Nguyene50b26f2023-07-12 11:59:14 +070028# =======================================================
29# Setting default value for others gpio pins
30echo "CONFIGURE: gpio pins to output high"
31for gpioName in "${output_high_gpios_in_bmc_reboot[@]}"; do
32 gpioset $(gpiofind "$gpioName")=1
33done
34echo "CONFIGURE: gpio pins to output low"
35for gpioName in "${output_low_gpios_in_bmc_reboot[@]}"; do
36 gpioset $(gpiofind "$gpioName")=0
37done
38echo "CONFIGURE: gpio pins to input"
39for gpioName in "${input_gpios_in_bmc_reboot[@]}"; do
40 gpioget $(gpiofind "$gpioName")
41done
42
Thu Nguyene50b26f2023-07-12 11:59:14 +070043#post platform init function. implemented in platform_gpios_init.sh
44post-platform-init
45
46exit 0