base-files: armsr: number Ten64 GPIOs according to kernel version
[openwrt/openwrt.git] / target / linux / armsr / base-files / etc / board.d / 03_gpio_switches
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0-or-later
3
4 . /lib/functions/uci-defaults.sh
5
6 KERNEL_MAJOR=$(uname -r | awk -F '.' '{print $1}')
7 KERNEL_MINOR=$(uname -r | awk -F '.' '{print $2}')
8
9 board_config_update
10
11 board=$(board_name)
12
13 case "$board" in
14 traverse,ten64)
15 if [ "${KERNEL_MAJOR}" -ge "6" ] && [ "${KERNEL_MINOR}" -ge "6" ]; then
16 I2C_GPIO_BASE=640
17 else
18 I2C_GPIO_BASE=368
19 fi
20 ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "$(($I2C_GPIO_BASE + 8))"
21 ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "$(($I2C_GPIO_BASE + 9))"
22 ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "$((I2C_GPIO_BASE + 10))"
23 ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "$(($I2C_GPIO_BASE + 11))"
24 ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "$(($I2C_GPIO_BASE + 1))"
25 ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "$(($I2C_GPIO_BASE + 5))"
26 ;;
27 esac
28
29 board_config_flush
30
31 exit 0