blob: 7e33776947e00c9317e7f75f839bec6a640f19b1 [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
Chau Ly0a0f3482023-04-13 05:06:28 +00006source /usr/sbin/ampere_uart_console_setup.sh
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +00007
Thu Nguyene50b26f2023-07-12 11:59:14 +07008#pre platform init function. implemented in platform_gpios_init.sh
9pre-platform-init
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +000010
11# =======================================================
Thu Nguyene50b26f2023-07-12 11:59:14 +070012# Setting default value for device sel and mux
Thang Q. Nguyened818132022-02-22 10:48:32 +000013bootstatus=$(cat /sys/class/watchdog/watchdog0/bootstatus)
14if [ "$bootstatus" == '32' ]; then
Thu Nguyene50b26f2023-07-12 11:59:14 +070015 echo "CONFIGURE: gpio pins to output high after AC power"
16 for gpioName in "${output_high_gpios_in_ac[@]}"; do
17 gpioset $(gpiofind "$gpioName")=1
18 done
19 echo "CONFIGURE: gpio pins to output low after AC power"
20 for gpioName in "${output_low_gpios_in_ac[@]}"; do
21 gpioset $(gpiofind "$gpioName")=0
22 done
23 echo "CONFIGURE: gpio pins to input after AC power"
24 for gpioName in "${input_gpios_in_ac[@]}"; do
25 gpioget $(gpiofind "$gpioName")
26 done
Thang Q. Nguyen7d0f84a2021-09-23 06:47:52 +000027fi
Thang Q. Nguyenbddca602022-07-29 14:45:33 +070028
Thu Nguyene50b26f2023-07-12 11:59:14 +070029# =======================================================
30# Setting default value for others gpio pins
31echo "CONFIGURE: gpio pins to output high"
32for gpioName in "${output_high_gpios_in_bmc_reboot[@]}"; do
33 gpioset $(gpiofind "$gpioName")=1
34done
35echo "CONFIGURE: gpio pins to output low"
36for gpioName in "${output_low_gpios_in_bmc_reboot[@]}"; do
37 gpioset $(gpiofind "$gpioName")=0
38done
39echo "CONFIGURE: gpio pins to input"
40for gpioName in "${input_gpios_in_bmc_reboot[@]}"; do
41 gpioget $(gpiofind "$gpioName")
42done
43
Chau Ly0a0f3482023-04-13 05:06:28 +000044# =======================================================
45# Setting uart muxes to BMC as default
46uart_console_setup
Thu Nguyene50b26f2023-07-12 11:59:14 +070047
48#post platform init function. implemented in platform_gpios_init.sh
49post-platform-init
50
51exit 0