[oe-commits] Koen Kooi : overo-writeprom: rename to omap3-writeprom and make it work on both overo and beagleboard

git version control git at git.openembedded.org
Thu Apr 29 12:50:15 UTC 2010


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 58fa34bf8aa9719f4dddfaf7d4f03614c1c6bc65
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=58fa34bf8aa9719f4dddfaf7d4f03614c1c6bc65

Author: Koen Kooi <koen at openembedded.org>
Date:   Thu Apr 29 14:41:49 2010 +0200

overo-writeprom: rename to omap3-writeprom and make it work on both overo and beagleboard

---

 recipes/i2c-tools/omap3-writeprom.bb               |   16 +++++++
 .../omap3-writeprom}/writeprom.sh                  |   48 ++++++++++++-------
 recipes/overo-scripts/overo-writeprom.bb           |   16 -------
 3 files changed, 46 insertions(+), 34 deletions(-)

diff --git a/recipes/i2c-tools/omap3-writeprom.bb b/recipes/i2c-tools/omap3-writeprom.bb
new file mode 100644
index 0000000..485d06f
--- /dev/null
+++ b/recipes/i2c-tools/omap3-writeprom.bb
@@ -0,0 +1,16 @@
+DESCRIPTION = "Writeprom script for omap3 boards with EEPROM on there expansionboard - see http://www.elinux.org/BeagleBoardPinMux#Vendor_and_Device_IDs"
+
+
+SRC_URI = "file://writeprom.sh"
+
+S = "${WORKDIR}"
+
+do_install () {
+  install -d ${D}${bindir}/
+  install -m 0755 ${WORKDIR}/writeprom.sh ${D}${bindir}/
+}
+
+PACKAGE_ARCH = "all"
+RDEPENDS_${PN} = "i2c-tools"
+FILES_${PN} = "${bindir}"
+
diff --git a/recipes/overo-scripts/files/writeprom.sh b/recipes/i2c-tools/omap3-writeprom/writeprom.sh
similarity index 61%
rename from recipes/overo-scripts/files/writeprom.sh
rename to recipes/i2c-tools/omap3-writeprom/writeprom.sh
index e18dcb0..d1e2b09 100755
--- a/recipes/overo-scripts/files/writeprom.sh
+++ b/recipes/i2c-tools/omap3-writeprom/writeprom.sh
@@ -1,20 +1,16 @@
 #!/bin/sh
 
-if [ $# -ne 3 ] && [ $# -ne 5 ];
+machine_id() {          # return the machine ID
+    awk 'BEGIN { FS=": " } /Hardware/ { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo
+}
+
+if [ $# -ne 4 ] && [ $# -ne 6 ];
 then
 	echo "Usage:"
 	echo ""
-	echo "writeprom.sh deviceid rev fab_rev [envvar envsetting]"
+	echo "writeprom.sh vendorid deviceid rev fab_rev [envvar envsetting]"
 	echo	
-	echo " deviceid   - expansion board device number from table:"
-	echo 
-	echo "   Summit     0x01"
-	echo "   Tobi       0x02"
-	echo "   Tobi Duo   0x03"
-	echo "   Palo35     0x04"
-	echo "   Palo43     0x05"
-	echo "   Chestnut43 0x06"
-	echo "   Pinto      0x07"
+	echo " vendorid, deviceid - expansion board device number from http://www.elinux.org/BeagleBoardPinMux#Vendor_and_Device_IDs"
 	echo
 	echo " rev          - board revision (e.g. 0x00)"
 	echo " fab_rev      - revision marking from pcb (e.g. R2411)"
@@ -22,36 +18,52 @@ then
 	echo "                (e.g. dvimode)"
 	echo " envsetting   - optional u-boot env variable setting"
 	echo "                (e.g. 1024x768MR-16 at 60)"
+	echo
+	echo "Don't forget to make the EEPROM writeable if it has a writeprotect jumper!"
 	exit 1
 fi
 
-fabrevision=$3
+fabrevision=$4
 if [ ${#fabrevision} -ge 8 ]; then
 	echo "Error: fab revision string must less than 8 characters"
 	exit 1
 fi
 
-envvar=$4
+envvar=$5
 if [ ${#envar} -ge 16 ]; then
 	echo "Error: environment variable name string must less than 16 characters"
 	exit 1
 fi
 
-envsetting=$5
+envsetting=$6
 if [ ${#ensetting} -ge 64 ]; then
 	echo "Error: environment setting string must less than 64 characters"
 	exit 1
 fi
 
-bus=3
+case `machine_id` in                                                        
+  "omap3_beagle_board")                                                         
+      bus=2
+      device=0x50
+      ;;
+  *)                                                              
+      bus=3
+      device=0x51
+      ;;                                               
+esac
+
 device=0x50
-vendorid=0x02
+vendorid=$1
+if [ ${#vendorid} -ge 6 ]; then
+    echo "Error: vendorid number must be less than 6 digits"
+    exit 1
+fi
 
 i2cset -y $bus $device 0x00 0x00
 i2cset -y $bus $device 0x01 $vendorid
 i2cset -y $bus $device 0x02 0x00
-i2cset -y $bus $device 0x03 $1
-i2cset -y $bus $device 0x04 $2
+i2cset -y $bus $device 0x03 $2
+i2cset -y $bus $device 0x04 $3
 i2cset -y $bus $device 0x05 00
 
 let i=6
diff --git a/recipes/overo-scripts/overo-writeprom.bb b/recipes/overo-scripts/overo-writeprom.bb
deleted file mode 100644
index c72c850..0000000
--- a/recipes/overo-scripts/overo-writeprom.bb
+++ /dev/null
@@ -1,16 +0,0 @@
-DESCRIPTION = "writeprom script for overo"
-
-PR="r0"
-
-SRC_URI = "file://writeprom.sh"
-
-S = "${WORKDIR}"
-
-do_install () {
-  install -d ${D}${bindir}/
-  install -m 0755 ${WORKDIR}/writeprom.sh ${D}${bindir}/
-}
-
-PACKAGES = "${PN}"
-FILES_${PN} = "/*"
-





More information about the Openembedded-commits mailing list