Author: wmb Date: Tue Jun 28 21:32:22 2011 New Revision: 2317 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2317
Log: OLPC keyboard selftest - to test for the presence of /ec-spi, use locate-device instead of find-package, because the latter searches the dropin driver list to find possible demand-loadable packages. That has the bad effect of starving the EC of cycles while the SPI FLASH behind the EC is being accessed. Also, do the presence test once when the test is started and cache the result in a value, thus reducing the "dead time" between polls.
Modified: dev/olpc/keyboard/selftest.fth ============================================================================== --- dev/olpc/keyboard/selftest.fth Tue Jun 28 18:57:21 2011 (r2316) +++ dev/olpc/keyboard/selftest.fth Tue Jun 28 21:32:22 2011 (r2317) @@ -664,18 +664,17 @@ then ( false | scancode true ) ;
+0 value ec-spi-buttons? + \ Check for a change in button state if necessary. : or-button? ( [scancode] key? -- [scancode] flag ) \ If there is already a key from get-data?, handle it before checking the game buttons - dup if exit then ( [scancode] key? phandle ) + dup if exit then ( false )
\ If the /ec-spi device node is present, the game buttons are directly connected \ so we must handle them here. Otherwise the EC will handle them and fold their \ events into the keyboard scancode stream. - " /ec-spi" find-package if ( false phandle ) - 2drop ( ) - button-event? ( [scancode] flag ) - then ( [scancode] flag ) + ec-spi-buttons? if drop button-event? then ;
0 value last-timestamp @@ -729,6 +728,13 @@ : selftest ( -- error? ) open 0= if true exit then
+ " /ec-spi" locate-device if ( ) + false ( flag ) + else ( phandle ) + drop true ( flag ) + then ( flag ) + to ec-spi-buttons? ( ) + set-keyboard-type