diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
commit | 2a7348129a42f21095fcd62e47a035f78d254130 (patch) | |
tree | 544dc8019a8f8cb684ace8674193605e607f9964 /recipes-test/ddt-runner/files/scripts/p4080ds/spi | |
download | meta-enea-2a7348129a42f21095fcd62e47a035f78d254130.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p4080ds/spi')
-rwxr-xr-x | recipes-test/ddt-runner/files/scripts/p4080ds/spi | 48 |
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 | |||
7 | MTD_CHAR_DEVICE="/dev/mtd4" | ||
8 | MTD_BLOCK_DEVICE="/dev/mtdblock4" | ||
9 | |||
10 | if [ ! -e $MTD_CHAR_DEVICE ]; then | ||
11 | echo "FAIL: spi flash device $MTD_CHAR_DEVICE does not exist" | ||
12 | exit 1 | ||
13 | else | ||
14 | echo "PASS: spi flash device $MTD_CHAR_DEVICE exists" | ||
15 | fi | ||
16 | |||
17 | if [ ! -e $MTD_BLOCK_DEVICE ]; then | ||
18 | echo "FAIL: spi flash device $MTD_BLOCK_DEVICE does not exist" | ||
19 | exit 1 | ||
20 | else | ||
21 | echo "PASS: spi flash device $MTD_BLOCK_DEVICE exists" | ||
22 | fi | ||
23 | |||
24 | /usr/sbin/flash_erase -j $MTD_CHAR_DEVICE 0 0 | ||
25 | if [ $? -ne 0 ]; then | ||
26 | echo "FAIL: format spi flash device $MTD_BLOCK_DEVICE fail" | ||
27 | exit 1 | ||
28 | else | ||
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 | ||
45 | fi | ||
46 | |||
47 | echo "PASS: spi bus test passed" | ||
48 | exit 0 | ||