blob: 9fd38f8210a40631c577ccdcbc281672b851ee17 (
plain)
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
|
function find_gpio_controllers_dt ()
{
for NEXT in $(find -L /proc/device-tree -name "compatible" | sort);
do
cat ${NEXT} | grep -xz "snps,dw-apb-gpio" > /dev/null && {
GPIO_DIRNAME="$(dirname ${NEXT})";
echo ${GPIO_DIRNAME};
GPIO_COMPATIBLE="$(cat ${GPIO_DIRNAME}/compatible)";
echo -e "\tcompatible = '${GPIO_COMPATIBLE}'";
WF="${GPIO_DIRNAME}/gpio-controller@0/snps,nr-gpios";
GPIO_HEX_WIDTH="$(hexdump -v -e '"0x"' -e '4/1 "%02x"' "${WF}")";
GPIO_WIDTH=$(printf "%d" ${GPIO_HEX_WIDTH});
echo -e "\t width = '${GPIO_WIDTH}'"
};
cat ${NEXT} | grep -e "altr,pio" > /dev/null && {
GPIO_DIRNAME="$(dirname ${NEXT})";
echo ${GPIO_DIRNAME};
GPIO_COMPATIBLE="$(cat ${GPIO_DIRNAME}/compatible)";
echo -e "\tcompatible = '${GPIO_COMPATIBLE}'";
WF="${GPIO_DIRNAME}/altr,gpio-bank-width";
GPIO_HEX_WIDTH="$(hexdump -v -e '"0x"' -e '4/1 "%02x"' "${WF}")";
GPIO_WIDTH=$(printf "%d" ${GPIO_HEX_WIDTH});
echo -e "\t width = '${GPIO_WIDTH}'"
};
done
}
|