/alps/pcitool

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to tests/reload.sh

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-04 15:43:14 UTC
  • Revision ID: csa@suren.me-20160304154314-uor59rrkaw2hexm7
RPM generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/bash
2
 
 
3
 
device=`lspci -n | grep -m 1 "10ee:" | awk '{print $1}'`
4
 
if [ -z "$device" ]; then
 
2
devdir=`ls -d /sys/bus/pci/devices/*/driver/module/drivers/pci:pciDriver`
 
3
if [ $? -ne 0 ]; then
5
4
    echo "Xilinx device doesn't exist, rescanning..."
6
5
    echo 1 > /sys/bus/pci/rescan
7
6
    exit
8
7
else
 
8
    device=`echo $devdir | head -n 1 | cut -c 27-33`
9
9
    echo "Xilinx is located at: " $device
10
10
fi
11
 
echo "remove driver"
12
 
rmmod pciDriver 
13
11
echo "remove devices"
14
12
echo  1 > /sys/bus/pci/devices/0000\:${device:0:2}\:${device:3:4}/remove
15
13
sleep 1
16
14
echo "rescan"
17
15
echo 1 > /sys/bus/pci/rescan
18
16
sleep 1
 
17
echo "remove driver"
 
18
rmmod pciDriver 
 
19
sleep 1
19
20
echo "instantiate driver"
20
21
modprobe pciDriver
21
 
# for devices with different ID
22
 
#echo "10ee 6028" > /sys/bus/pci/drivers/pciDriver/new_id
23
 
pci -i
24
 
#echo Enabling bus mastering on device $dev
25
 
#setpci -s $device 4.w=0x07
 
22
sleep 1
 
23
echo "set bus master dma"
 
24
dev=$device  
 
25
echo Enabling bus mastering on device $dev
 
26
setpci -s $dev 4.w=0x07