forked from petermilne/Z7IO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
z7io.init
executable file
·114 lines (93 loc) · 3.26 KB
/
z7io.init
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
#!/bin/sh
# currently we can't locate the real u-boot env, so we bring in a proxy..
[ -e /mnt/z7io/uboot.env ] && UBOOT_ENV=/mnt/z7io/uboot.env
[ -e /mnt/uboot.env ] && UBOOT_ENV=/mnt/uboot.env
z7io_zynq_flavour() {
case $(cat /sys/devices/soc0/soc_id) in
0x12)
echo Z7IO35;;
0x11)
echo Z7IO45;;
0xc|0x0c)
echo Z7IO;;
*)
echo "z7io_zynq_flavour unknown flavour $(cat /sys/devices/soc0/soc_id)"
PS1="error1>" /bin/sh;;
esac
}
if [ ! -z $UBOOT_ENV ] && [ -e $UBOOT_ENV ]; then
dump-cstrings < $UBOOT_ENV |
grep -v \\$ | grep -v ' ' | grep -v devicetree_image >/tmp/u-boot_env
grep devicetree_acq400 /tmp/u-boot_env > /tmp/u-boot_env_tmp
sed -e 's/devicetree_acq400/devicetree_image/' \
/tmp/u-boot_env_tmp >> /tmp/u-boot_env
else
echo "devicetree_image=dtb.d/z7io.dtb" >/tmp/u-boot_env
fi
echo z7io > /etc/acq400/0/MODEL
HN=$(hostname)
echo $HN > /etc/acq400/0/HN
echo $HN > /etc/acq400/0/dtsn
export SITE2BUS=3
echo $SITE2BUS >/etc/sysconfig/i2c_site2bus
[ -d /mnt/EBREAK ] && PS1="breakme1>" /bin/sh
ZF=$(z7io_zynq_flavour)
ZBARE=${ZF}_TOP_BARE.bit.gz
/usr/local/CARE/load-fpga-stock
BARE=/mnt/fpga.d/${ZBARE}
if [ -e /mnt/z7io/${ZBARE} ]; then
BARE=/mnt/z7io/${ZBARE}
echo using patch $BARE
fi
if [ -e $BARE ]; then
LEDD=/dev/gpio/LED; mkdir -p $LEDD
gunzip -c $BARE | xiloader -L 2>>/tmp/fpga_status
cp /tmp/fpga_status /tmp/fpga_status_bare
# PS1="breakme2>" /bin/sh
echo 9 > /proc/sys/kernel/printk
/sbin/insmod /usr/local/lib/modules/i2c-xiic.ko
MMC_MBOX_KO=/usr/local/lib/modules/mmc-mailbox-driver.ko
[ -e /mnt/local/mmc-mailbox-driver.ko ] &&
MMC_MBOX_KO=/mnt/local/mmc-mailbox-driver.ko
echo /sbin/insmod $MMC_MBOX_KO
/sbin/insmod $MMC_MBOX_KO
#/sbin/insmod /usr/local/lib/modules/mmc-mailbox-driver.ko
# PS1="breakme3>" /bin/sh
/usr/local/CARE/load.overlay z7io_mbox_overlay
mmcinfo >/tmp/mmcinfo1.txt
/usr/local/CARE/Z7IO/register_mmc_fru_units /tmp/mmcinfo1.txt
if [ -e /dev/sites/RTM/details ]; then
source /dev/sites/RTM/details
if [ "$FRU_PART_NUM" = "ACQ400-MTCA-RTM-2-NG" ]; then
echo RTM NON-GEOGRAPHICAL new
geo=_
else
echo RTM GEOGRAPHICAL legacy
geo=_geo_
fi
# PS1="breakme4>" /bin/sh
/usr/local/CARE/Z7IO/load.rtmi2c_overlay
/usr/local/CARE/Z7IO/z7io_init_gpio
# PS1="breakme5>" /bin/sh
for site in 1 2; do
[ $(cat /dev/gpio/fmc${site}_present) -eq 1 ] &&
/usr/local/CARE/load.overlay z7io_rtm_elf${site}${geo}overlay
done
/usr/local/CARE/Z7IO/z7io_init_hwmon
else
echo 1 > $LEDD/FMC1_R
echo 1 > $LEDD/FMC2_R
echo 0 > $LEDD/FMC1_G
echo 0 > $LEDD/FMC2_G
fi
# PS1="breakme6>" /bin/sh
FMC_SCAN_SITES="1 2"
[ -e /dev/sites/3/eeprom ] && FMC_SCAN_SITES="$FMC_SCAN_SITES 3"
export FMC_SCAN_SITES
else
echo WARNING: $BARE did not exist, trying to continue..
export FMC_SCAN_SITES="1 2"
fi
echo "ready to scan FMC_SCAN_FPGA=$ZF FMC_SCAN_SITES=$FMC_SCAN_SITES /usr/local/bin/fmc-scan"
FMC_SCAN_FPGA=$ZF /usr/local/bin/fmc-scan
[ -d /mnt/EBREAK ] && PS1="breakme7>" /bin/sh