ramips: enable power LED and second uart on GL-MT300N-V2
[openwrt/openwrt.git] / target / linux / octeontx / base-files / lib / octeontx.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2018 OpenWrt.org
4 #
5
6 octeontx_board_detect() {
7 local machine
8 local name
9
10 machine=$(cat /proc/device-tree/model)
11 board=$(cat /proc/device-tree/board)
12
13 case "$machine" in
14 "Cavium ThunderX CN81XX board")
15 name="cn81xx"
16 ;;
17
18 *)
19 name="generic"
20 ;;
21 esac
22
23 case "$board" in
24 GW630*)
25 name="gw630x"
26 ;;
27 esac
28
29 [ -e "/tmp/sysinfo" ] || mkdir -p "/tmp/sysinfo"
30
31 echo "$name" > /tmp/sysinfo/board_name
32 echo "$machine" > /tmp/sysinfo/model
33 }
34
35 octeontx_board_name() {
36 local name
37
38 [ -f /tmp/sysinfo/board_name ] || octeontx_board_detect
39 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
40 [ -z "$name" ] && name="unknown"
41
42 echo "$name"
43 }