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