#!/bin/sh # This script is used to test i2c bus functionality for p2041rdb board. if I2C_ADAPTERS=$(i2cdetect -l |wc -l); then echo "PASS: found $I2C_ADAPTERS i2c adapters" else echo "FAIL: no i2c adapters found" exit 1 fi if [ -z "$adapters" ]; then adapters=0 fi while [ $adapters -lt $I2C_ADAPTERS ] do i2cdetect -y $adapters if [ $? -ne 0 ]; then echo "FAIL: detect i2c adapter $adapters failed" else echo "PASS: detect i2c adapter $adapters success" fi adapters=`expr $adapters + 1` sleep 1 done i2cdetect -y 0 if [ $? -ne 0 ]; then echo "FAIL: detect i2c bus 0 fail" exit 1 else echo "PASS: detect i2c bus 0 success" fi #i2c bus 0, device address 0x52, DDR3 DIMM Socket 1, SPD EEPROM i2cdump -f -y 0 0x52 |grep UG51U6400N8SU if [ $? -ne 0 ]; then echo "FAIL: read SPD EEPROM on i2c bus 0 fail" exit 1 else echo "PASS: read SPD EEPROM on i2c bus 0 success" fi