-
Notifications
You must be signed in to change notification settings - Fork 0
/
acq2006_init_gpio
executable file
·134 lines (104 loc) · 3.43 KB
/
acq2006_init_gpio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
source /usr/local/bin/acq400_init_gpio_common.sh
common_begin
mk_chip_layer8() {
chip=$1
pin00=$2
pin01=$3
mkdir -p /dev/gpio/$chip
let ix=0
for pin in $(seq $pin00 $pin01)
do
pn=$(printf P%o $ix)
export_gpio $pin
ln -s /sys/class/gpio/gpio$pin /dev/gpio/$chip/$pn
let ix=$ix+1
done
}
# i2c gpio
CHIP20=$(basename $(echo /sys/bus/i2c/devices/1-0020/gpio/gpiochip*))
CHIP21=$(basename $(echo /sys/bus/i2c/devices/1-0021/gpio/gpiochip*))
CHIP22=$(basename $(echo /sys/bus/i2c/devices/1-0022/gpio/gpiochip*))
CHIP23=$(basename $(echo /sys/bus/i2c/devices/1-0023/gpio/gpiochip*))
CHIP24=$(basename $(echo /sys/bus/i2c/devices/1-0024/gpio/gpiochip*))
let CHIP20_00=${CHIP20#gpiochip*}
let CHIP21_00=${CHIP21#gpiochip*}
let CHIP22_00=${CHIP22#gpiochip*}
let CHIP23_00=${CHIP23#gpiochip*}
let CHIP24_00=${CHIP24#gpiochip*}
let CHIP20_01="$CHIP20_00+7"
let CHIP21_01="$CHIP21_00+7"
let CHIP22_01="$CHIP22_00+7"
let CHIP23_01="$CHIP23_00+7"
let CHIP24_01="$CHIP24_00+7"
mk_chip_layer8 CHIP20 $CHIP20_00 $CHIP20_01
mk_chip_layer8 CHIP21 $CHIP21_00 $CHIP21_01
mk_chip_layer8 CHIP22 $CHIP22_00 $CHIP22_01
mk_chip_layer8 CHIP23 $CHIP23_00 $CHIP23_01
mk_chip_layer8 CHIP24 $CHIP24_00 $CHIP24_01
for pin in $(seq $CHIP21_00 $CHIP21_01) $(seq $CHIP22_00 $CHIP22_01)
do
setO gpio$pin
done
for gpio in /dev/gpio/CHIP2[12]/*
do
setO $gpio
done
# ICS CLK - MBCLK
mkdir -p /dev/gpio/CLK/MB/RDW
lnAH /dev/gpio/CHIP21/P0 /dev/gpio/CLK/MB/RDW/R6
lnAH /dev/gpio/CHIP21/P1 /dev/gpio/CLK/MB/RDW/R5
lnAH /dev/gpio/CHIP21/P2 /dev/gpio/CLK/MB/RDW/R4
lnAH /dev/gpio/CHIP21/P3 /dev/gpio/CLK/MB/RDW/R3
lnAH /dev/gpio/CHIP21/P4 /dev/gpio/CLK/MB/RDW/R2
lnAH /dev/gpio/CHIP21/P5 /dev/gpio/CLK/MB/RDW/R1
lnAH /dev/gpio/CHIP21/P6 /dev/gpio/CLK/MB/RDW/R0
mkdir -p /dev/gpio/CLK/MB/FDW
lnAH /dev/gpio/CHIP21/P7 /dev/gpio/CLK/MB/FDW/F6
lnAH /dev/gpio/CHIP22/P0 /dev/gpio/CLK/MB/FDW/F5
lnAH /dev/gpio/CHIP22/P1 /dev/gpio/CLK/MB/FDW/F4
lnAH /dev/gpio/CHIP22/P2 /dev/gpio/CLK/MB/FDW/F3
lnAH /dev/gpio/CHIP22/P3 /dev/gpio/CLK/MB/FDW/F2
lnAH /dev/gpio/CHIP22/P4 /dev/gpio/CLK/MB/FDW/F1
lnAH /dev/gpio/CHIP22/P5 /dev/gpio/CLK/MB/FDW/F0
mkdir -p /dev/gpio/CLK/MB/ODW
lnAH /dev/gpio/CHIP22/P6 /dev/gpio/CLK/MB/ODW/S1
lnAH /dev/gpio/CHIP22/P7 /dev/gpio/CLK/MB/ODW/S2
# FMC PRESENT, Analog Power Good
let pin=0
for gpio in /dev/gpio/CHIP20/*
do
setO $gpio
case $pin in
6) lnAL $gpio /dev/gpio/15VP_PGD;;
7) lnAL $gpio /dev/gpio/15VN_PGD;;
*) let site=$pin+1
lnAL $gpio /dev/gpio/fmc${site}_present;;
esac
let pin="$pin+1"
done
for gpio in /dev/gpio/CHIP23/* /dev/gpio/CHIP24/P[0-3]
do
setO $gpio
done
lnAH /dev/gpio/CHIP23/P0 /dev/gpio/CLK/MB/ICS_CLK2_OE
lnAL /dev/gpio/CHIP23/P1 /dev/gpio/CLK/OSC_X_OE
lnAL /dev/gpio/CHIP23/P2 /dev/gpio/CLK/OSC_X_CLK_OE
lnAL /dev/gpio/CHIP23/P3 /dev/gpio/CLK/FP_CLK_OE
lnAL /dev/gpio/CHIP23/P4 /dev/gpio/CLK/FP_OE
lnAH /dev/gpio/CHIP23/P5 /dev/gpio/Si570_OE
lnAL /dev/gpio/CHIP23/P6 /dev/gpio/15VA_EN
lnAH /dev/gpio/CHIP23/P7 /dev/gpio/PSU_SYNC_CLK_OE
mkdir -p /dev/gpio/LED
# CLK TRG swapped pgm 20130928
lnAL /dev/gpio/CHIP24/P0 /dev/gpio/LED/TRG_G
lnAL /dev/gpio/CHIP24/P1 /dev/gpio/LED/TRG_R
lnAL /dev/gpio/CHIP24/P2 /dev/gpio/LED/CLK_G
lnAL /dev/gpio/CHIP24/P3 /dev/gpio/LED/CLK_R
lnAH /dev/gpio/CHIP24/P4 /dev/gpio/BV_EE
lnAH /dev/gpio/CHIP24/P5 /dev/gpio/BV_RSV1
lnAH /dev/gpio/CHIP24/P6 /dev/gpio/BV_RSV2
lnAH /dev/gpio/CHIP24/P7 /dev/gpio/JTAG14_ALL
source /usr/local/bin/acq2006_init_gpio_common.sh
common_end
echo "++ acq2006_init_gpio done"