#!/bin/sh
. /usr/local/bin/sig_catcher

platform=$(cat /var/run/platform)
case $platform in
	Lodi|Madera|Livermore)
		# read offset 0x14 from prom
		# REVISIT: regvals currently not used.  In older platforms, 
		# it's used to detect that the firmware is already programmed.  
		# However, BBA does not use this.
		# Not sure if LML support this?
		# regvals=$(/usr/local/bin/i2c-test -b 5 -s 0xa0 -rc 4 -m 0 -d 14 | head -2 |tail -1)

		echo "Auto programming DDR PROM"
		filename=$(ls /firmware/$platform/ddr/*.txt|tail -1)
		if [ -f $filename ]; then
			/usr/local/bin/program_ddr_autoload_eeprom.sh $filename
		fi
	;;
	*)
		echo "This feature is not supported in ${platform:-unknown platform}"
	;;
esac
echo ""
