summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/p4080ds/spi
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p4080ds/spi')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/p4080ds/spi48
1 files changed, 48 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/p4080ds/spi b/recipes-test/ddt-runner/files/scripts/p4080ds/spi
new file mode 100755
index 0000000..b4df851
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/p4080ds/spi
@@ -0,0 +1,48 @@
1#!/bin/sh
2
3#An spi flash M25P80 connect to p4080 cpu by spi bus, so the method
4#is to read/write spi flash to verify whether the spi bus driver worked
5#or not.
6
7MTD_CHAR_DEVICE="/dev/mtd4"
8MTD_BLOCK_DEVICE="/dev/mtdblock4"
9
10if [ ! -e $MTD_CHAR_DEVICE ]; then
11 echo "FAIL: spi flash device $MTD_CHAR_DEVICE does not exist"
12 exit 1
13else
14 echo "PASS: spi flash device $MTD_CHAR_DEVICE exists"
15fi
16
17if [ ! -e $MTD_BLOCK_DEVICE ]; then
18 echo "FAIL: spi flash device $MTD_BLOCK_DEVICE does not exist"
19 exit 1
20else
21 echo "PASS: spi flash device $MTD_BLOCK_DEVICE exists"
22fi
23
24/usr/sbin/flash_erase -j $MTD_CHAR_DEVICE 0 0
25if [ $? -ne 0 ]; then
26 echo "FAIL: format spi flash device $MTD_BLOCK_DEVICE fail"
27 exit 1
28else
29 mkdir -p /mnt/spi
30 mount -t jffs2 $MTD_BLOCK_DEVICE /mnt/spi
31 if [ $? -ne 0 ]; then
32 echo "FAIL: mount spi flash device $MTD_BLOCK_DEVICE fail"
33 exit 1
34 else
35 cp /bin/busybox /mnt/spi
36 ls /mnt/spi |grep busybox
37 if [ $? -ne 0 ]; then
38 echo "FAIL: read or write spi flash device $MTD_BLOCK_DEVICE fail"
39 exit 1
40 else
41 umount $MTD_BLOCK_DEVICE
42 echo "PASS: read or write spi flash device $MTD_BLOCK_DEVICE success"
43 fi
44 fi
45fi
46
47echo "PASS: spi bus test passed"
48exit 0