From 63bf7379885326ea16c3ffe8fc41c830b349f86d Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 30 Dec 2011 08:54:11 +0000 Subject: [PATCH 1/6] eeprom: use strings for usage and pullup/down Signed-off-by: Koen Kooi --- bonescript/eeprom.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bonescript/eeprom.js b/bonescript/eeprom.js index 4a68cbfb..bb793f8c 100644 --- a/bonescript/eeprom.js +++ b/bonescript/eeprom.js @@ -122,10 +122,10 @@ var parseCapeEeprom = function(x) { var pinOffset = bone[pin].eeprom; var pinData = x.readUint16BE(pinOffset); var pinObject = {}; - pinObject.used = (pinData & 0x8000) >> 15; + pinObject.used = (pinData & 0x8000) >> 15 ? 'used' : 'available';; if(pinData) { pinObject.direction = ((pinData & 0x4000) >> 14) ? 'in' : 'out'; - pinObject.pullup = (pinData & 0x3000) >> 12; + pinObject.pullup = (pinData & 0x3000) >> 12 ? 'pullup' : 'pulldown'; pinObject.mode = (pinData & 0x0007); pinObject.data = x.hexSlice(pinOffset, pinOffset+2); data.eeprom[bone[pin].name] = pinObject; From 28c5406876af46f489df1be7d765272096d0326b Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 30 Dec 2011 08:59:54 +0000 Subject: [PATCH 2/6] eeprom: report pins as PN_XX instead of internal mux name Signed-off-by: Koen Kooi --- bonescript/eeprom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonescript/eeprom.js b/bonescript/eeprom.js index bb793f8c..95189de9 100644 --- a/bonescript/eeprom.js +++ b/bonescript/eeprom.js @@ -128,7 +128,7 @@ var parseCapeEeprom = function(x) { pinObject.pullup = (pinData & 0x3000) >> 12 ? 'pullup' : 'pulldown'; pinObject.mode = (pinData & 0x0007); pinObject.data = x.hexSlice(pinOffset, pinOffset+2); - data.eeprom[bone[pin].name] = pinObject; + data.eeprom[pin] = pinObject; } } } From fb58852515977c464caa9a4c28f486eb80e9565a Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 30 Dec 2011 11:59:59 +0000 Subject: [PATCH 3/6] eeprom.js: retrieve mux function from debugfs for pins that are marked as used Signed-off-by: Koen Kooi --- bonescript/eeprom.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bonescript/eeprom.js b/bonescript/eeprom.js index 95189de9..6e4c68b1 100644 --- a/bonescript/eeprom.js +++ b/bonescript/eeprom.js @@ -1,4 +1,5 @@ var fs = require('fs'); +var path = require('path'); var buffer = require('buffer'); var util = require('util'); bone = require('./bone').bone; @@ -127,6 +128,19 @@ var parseCapeEeprom = function(x) { pinObject.direction = ((pinData & 0x4000) >> 14) ? 'in' : 'out'; pinObject.pullup = (pinData & 0x3000) >> 12 ? 'pullup' : 'pulldown'; pinObject.mode = (pinData & 0x0007); + + pinObject.function = {}; + if(pinObject.used == "used") { + try { + // read mux from debugfs + muxReadout= fs.readFileSync("/sys/kernel/debug/omap_mux/" + bone[pin].mux, 'utf8'); + pinObject.function = muxReadout.split("\n")[2].split("|")[pinObject.mode].replace('signals:', '').trim(); + } catch(ex) { + //default mux + pinObject.function = bone[pin].name; + } + } + pinObject.data = x.hexSlice(pinOffset, pinOffset+2); data.eeprom[pin] = pinObject; } From d60975a2f90dac36edcbfdab4e89b24ffec4f334 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 30 Dec 2011 13:53:49 +0000 Subject: [PATCH 4/6] bone.js: fix P8_29 mux name Signed-off-by: Koen Kooi --- bonescript/bone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonescript/bone.js b/bonescript/bone.js index 6ea32700..38db3cf6 100644 --- a/bonescript/bone.js +++ b/bonescript/bone.js @@ -33,7 +33,7 @@ exports.bone = P8_26: { name: "GPIO1_29", gpio: gpio1+29, mux: "gpmc_csn0", eeprom: 162 }, P8_27: { name: "GPIO2_22", gpio: gpio2+22, mux: "lcd_vsync", eeprom: 202 }, P8_28: { name: "GPIO2_24", gpio: gpio2+24, mux: "lcd_pclk", eeprom: 206 }, - P8_29: { name: "GPIO2_23", gpio: gpio2+23, mux: "lcd_hclk", eeprom: 204 }, + P8_29: { name: "GPIO2_23", gpio: gpio2+23, mux: "lcd_vsync", eeprom: 204 }, P8_30: { name: "GPIO2_25", gpio: gpio2+25, mux: "lcd_ac_bias_en", eeprom: 208 }, P8_31: { name: "UART5_CTSN", gpio: gpio0+10, mux: "lcd_data14", eeprom: 102 }, P8_32: { name: "UART5_RTSN", gpio: gpio0+11, mux: "lcd_data15", eeprom: 104 }, From b9d8dfc84609be40456ad5169bee11bd48d6dc7f Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 30 Dec 2011 14:18:01 +0000 Subject: [PATCH 5/6] eeprom.js: remove spurious semicolon Signed-off-by: Koen Kooi --- bonescript/eeprom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonescript/eeprom.js b/bonescript/eeprom.js index 6e4c68b1..2d45d063 100644 --- a/bonescript/eeprom.js +++ b/bonescript/eeprom.js @@ -123,7 +123,7 @@ var parseCapeEeprom = function(x) { var pinOffset = bone[pin].eeprom; var pinData = x.readUint16BE(pinOffset); var pinObject = {}; - pinObject.used = (pinData & 0x8000) >> 15 ? 'used' : 'available';; + pinObject.used = (pinData & 0x8000) >> 15 ? 'used' : 'available'; if(pinData) { pinObject.direction = ((pinData & 0x4000) >> 14) ? 'in' : 'out'; pinObject.pullup = (pinData & 0x3000) >> 12 ? 'pullup' : 'pulldown'; From 24fa5da100e506d91fe46121243d3f565ba4b243 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 30 Dec 2011 14:20:46 +0000 Subject: [PATCH 6/6] eeprom.js: mark unused pins as available Signed-off-by: Koen Kooi --- bonescript/eeprom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonescript/eeprom.js b/bonescript/eeprom.js index 2d45d063..731d8490 100644 --- a/bonescript/eeprom.js +++ b/bonescript/eeprom.js @@ -142,8 +142,8 @@ var parseCapeEeprom = function(x) { } pinObject.data = x.hexSlice(pinOffset, pinOffset+2); - data.eeprom[pin] = pinObject; } + data.eeprom[pin] = pinObject; } } return(data);