Author: wmb
Date: Mon Feb 28 18:36:42 2011
New Revision: 2175
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2175
Log:
>From Daniel Drake:
In Linux we plan to use the device tree for probing the DCON, battery, and
XO-1 RTC drivers.
Add the required information using the naming scheme suggested by
Grant Likely.
The dcon node and battery's compatible property apply for both XO-1 and
XO-1.5. The RTC's compatible property is only added for XO-1, in order
to trigger the XO-1-specific RTC wakeup driver.
Modified:
cpu/x86/pc/olpc/devices.fth
dev/olpc/dcon/dcon.fth
dev/olpc/dcon/viadcon.fth
dev/olpc/kb3700/batstat.fth
Modified: cpu/x86/pc/olpc/devices.fth
==============================================================================
--- cpu/x86/pc/olpc/devices.fth Mon Feb 14 08:15:27 2011 (r2174)
+++ cpu/x86/pc/olpc/devices.fth Mon Feb 28 18:36:42 2011 (r2175)
@@ -152,6 +152,12 @@
" /rtc" open-dev clock-node !
;
+\ Linux identifies XO-1 RTC with EC-based wakeup capabilities through this
+\ device property.
+dev /rtc
+" olpc,xo1-rtc" +compatible
+dend
+
fload ${BP}/cpu/x86/pc/cpunode.fth
fload ${BP}/cpu/x86/k6cputest.fth \ Burnin test for K6 CPU
Modified: dev/olpc/dcon/dcon.fth
==============================================================================
--- dev/olpc/dcon/dcon.fth Mon Feb 14 08:15:27 2011 (r2174)
+++ dev/olpc/dcon/dcon.fth Mon Feb 28 18:36:42 2011 (r2175)
@@ -1,5 +1,9 @@
\ See license at end of file
-\ " dcon" device-name
+
+new-device
+" dcon" device-name
+" olpc,xo1-dcon" +compatible
+finish-device
\ DCON internal registers, accessed via I2C
\ 0 constant DCON_ID
Modified: dev/olpc/dcon/viadcon.fth
==============================================================================
--- dev/olpc/dcon/viadcon.fth Mon Feb 14 08:15:27 2011 (r2174)
+++ dev/olpc/dcon/viadcon.fth Mon Feb 28 18:36:42 2011 (r2175)
@@ -1,5 +1,9 @@
\ See license at end of file
-\ " dcon" device-name
+
+new-device
+" dcon" device-name
+" olpc,xo1-dcon" +compatible
+finish-device
\ DCON internal registers, accessed via I2C
\ 0 constant DCON_ID
Modified: dev/olpc/kb3700/batstat.fth
==============================================================================
--- dev/olpc/kb3700/batstat.fth Mon Feb 14 08:15:27 2011 (r2174)
+++ dev/olpc/kb3700/batstat.fth Mon Feb 28 18:36:42 2011 (r2175)
@@ -145,6 +145,8 @@
dev /
new-device
" battery" device-name
+" olpc,xo1-battery" +compatible
+
0 0 reg \ Needed so test-all will run the selftest
\ Test that the battery is inserted and not broken.
Author: wmb
Date: Mon Feb 14 08:15:27 2011
New Revision: 2174
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2174
Log:
SDHCI - The SD switch-function command - CMD6 - is response type R1, not R1b (as opposed to the MMC SWITCH command - also CMD6 - which is R1b). The SDHCI spec isn't clear what happens when you (erroneously) specify a command with both data transfer and busy. On the first two SDHCI implementations we have seen, the data transfer overrides the busy, but the Marvell MMP2 SDHCI returns two Transfer Complete interrupts - one for the spurious "not busy", and one for the transfer complete. The spurious "not busy" interrupt confused the driver in thinking that the data was ready, when it was not. The fix is to issue the correct command form (R1 without busy) for SD CMD6.
Modified:
dev/mmc/sdhci/sdhci.fth
Modified: dev/mmc/sdhci/sdhci.fth
==============================================================================
--- dev/mmc/sdhci/sdhci.fth Mon Feb 7 08:36:03 2011 (r2173)
+++ dev/mmc/sdhci/sdhci.fth Mon Feb 14 08:15:27 2011 (r2174)
@@ -431,7 +431,7 @@
\ CMD6 (R1) is switch-function. It can be used to enter high-speed mode
: switch-function ( arg -- adr )
scratch-buf d# 64 d# 64 (dma-setup)
- h# 063b h# 11 cmd ( response drop )
+ h# 063a h# 11 cmd ( response drop )
2 wait
dma-release
scratch-buf
Author: wmb
Date: Mon Feb 7 08:36:03 2011
New Revision: 2173
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2173
Log:
XO-1.75 touchscreen gesture demo - made the behavior symmetrical with respect to the two fingers. Specifically, the image will now move after lifting either finger; it used to only move if the second finger was lifted.
Modified:
cpu/arm/olpc/1.75/pinch.fth
Modified: cpu/arm/olpc/1.75/pinch.fth
==============================================================================
--- cpu/arm/olpc/1.75/pinch.fth Mon Feb 7 06:15:08 2011 (r2172)
+++ cpu/arm/olpc/1.75/pinch.fth Mon Feb 7 08:36:03 2011 (r2173)
@@ -78,8 +78,8 @@
;
: close-touch ( -- ) touch-ih ?dup if close-dev 0 to touch-ih then ;
-: mark-touch ( -- )
- p0 to base-touch-xy
+: mark-touch ( point -- )
+ to base-touch-xy
image-center-xy to base-center-xy
;
: mark-size ( -- )
@@ -98,44 +98,56 @@
: do-touch0 ( x y down? -- )
-rot to p0 if ( ) \ Down
down1? if \ Double-touch - resize
- down0? if \ Not the initial touch pair - resize the screen image
+ down0? if \ Not the initial touch pair - resize the image
resize&recenter
else \ Initial touch pair - establish the baseline size
mark-size
+
+ \ Retouch of first finger - reestablish the base position
+ \ in case the image was moved by the other finger
+ p1 mark-touch
then
- else \ The second finger is up, so this is a move
+ else \ The other finnger is up, so this is a move
down0? if \ Not the initial touch - move the image
p0 move-image
else \ Initial touch - establish the base position
- mark-touch
+ p0 mark-touch
then
then
true to down0?
else \ Up
+ \ When this finger goes up, reestablish the base position on the other
+ \ finger so its subsequent movement will cause stable image movement
+ p1 mark-touch
false to down0?
then
;
: do-touch1 ( x y down? -- )
- -rot to p1 if ( ) \ Down
+ -rot to p1 if ( ) \ Down
down0? if \ Double-touch - resize
- down1? if \ Not the initial touch pair - resize the window
+ down1? if \ Not the initial touch pair - resize the image
resize&recenter
else \ Initial touch pair - establish the baseline size
mark-size
- \ Initial touch of second finger - reestablish the base position
- \ in case the image was moved after the first finger when down
- mark-touch
+ \ Initial or re-touch of second finger - reestablish the base position
+ \ in case the image was moved by the other finger
+ p0 mark-touch
+ then
+ else \ The other finnger is up, so this is a move
+ down1? if \ Not the initial touch - move the image
+ p1 move-image
+ else \ Initial touch - establish the base position
+ p1 mark-touch
then
- else \ The first finger is now up - do nothing in this case
then
true to down1?
else \ Up
- \ When the second finger goes up, we again must reestablish the base position
- \ so subsequent movement of the first finger will cause stable image movement
- mark-touch
+ \ When this finger goes up, reestablish the base position on the other
+ \ finger so its subsequent movement will cause stable image movement
+ p0 mark-touch
false to down1?
then
;
@@ -157,6 +169,8 @@
endcase
;
: pinch
+ ." Use one and two finger gestures to resize and move the scroller." cr
+ ." Type a key to exit." cr
open-touch
begin do-gesture key? until
close-touch
Author: wmb
Date: Fri Feb 4 22:10:33 2011
New Revision: 2171
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2171
Log:
USB keyboard driver - fixed typos in commentary caused by a search and replace error.
Modified:
dev/usb2/device/keyboard/keycode.fth
Modified: dev/usb2/device/keyboard/keycode.fth
==============================================================================
--- dev/usb2/device/keyboard/keycode.fth Fri Feb 4 02:42:59 2011 (r2170)
+++ dev/usb2/device/keyboard/keycode.fth Fri Feb 4 22:10:33 2011 (r2171)
@@ -102,7 +102,7 @@
then
;
-\ Searascii for a matascii for "byte" in the "key" position of the table at
+\ Search for a match for "byte" in the "key" position of the table at
\ "table-adr". If a match is found, return the corresponding "value" byte
\ and true. Otherwise return the argument byte and false. The table
\ consists of pairs of bytes - the first byte of the pair is "key" and
Author: wmb
Date: Fri Feb 4 02:42:30 2011
New Revision: 2169
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2169
Log:
XO-1.75 touchscreen demo - zooms and pans the screen image with gestures.
Added:
cpu/arm/olpc/1.75/pinch.fth
Modified:
cpu/arm/olpc/1.75/fw.bth
Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth Thu Feb 3 21:05:52 2011 (r2168)
+++ cpu/arm/olpc/1.75/fw.bth Fri Feb 4 02:42:30 2011 (r2169)
@@ -164,6 +164,9 @@
fload ${BP}/cpu/x86/pc/olpc/via/copynand.fth
fload ${BP}/cpu/arm/olpc/1.75/exc7200-touchscreen.fth \ Touchscreen driver and diagnostic
+fload ${BP}/cpu/arm/olpc/1.75/pinch.fth \ Touchscreen gestures
+: pinch " pinch" screen-ih $call-method ;
+
fload ${BP}/cpu/arm/mmp2/keypad.fth
[ifndef] cl2-a1
stand-init: keypad
Added: cpu/arm/olpc/1.75/pinch.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/pinch.fth Fri Feb 4 02:42:30 2011 (r2169)
@@ -0,0 +1,188 @@
+\ See license at end of file
+purpose: Zoom and pan the text scroller with touchscreen gestures
+
+dev screen
+: dst-size@ ( -- w h ) h# 108 lcd@ lwsplit ;
+: dst-size! ( w h -- ) wljoin h# 108 lcd! ;
+: dst-offset@ ( -- x y ) h# 100 lcd@ lwsplit ;
+: dst-offset! ( x y -- ) wljoin h# 100 lcd! ;
+: scr-size@ ( -- w h ) h# 104 lcd@ lwsplit ;
+: half-size ( -- w h ) dst-size@ swap 2/ swap 2/ ;
+: image-center-xy ( -- x y ) half-size dst-offset@ xy+ ;
+
+: xy-max ( x1 y1 x2 y2 -- xmax ymax ) rot max >r max r> ;
+: xy-min ( x1 y1 x2 y2 -- xmin ymin ) rot min >r min r> ;
+d# 60 d# 80 2constant min-wh
+: set-dst-size ( w h -- )
+ scr-size@ xy-min min-wh xy-max dst-size!
+;
+\ This is an attempt to delay the operation until "retrace", but
+\ it doesn't work very well; it's currently worse than nothing.
+: wait-frame ( -- )
+ 0 h# 1c4 lcd! begin h# 1c4 lcd@ until
+;
+: set-dst-offset ( x y -- )
+ \ Keep the full image on-screen
+ 0 0 xy-max ( x' y' )
+
+ 2dup dst-size@ xy+ ( x y extent-x extent-y )
+ scr-size@ 2swap xy- ( x y margin-x margin-y )
+ \ A negative margin means part of the image is off the screen
+ \ Positive margin is okay; we only adjust if margin is negative.
+ 0 0 xy-min ( x y adjust-x adjust-y )
+ xy+ ( x' y' )
+
+ dst-offset! ( )
+;
+: resize-image ( xnum ynum xdenom ydenom old-w old-h -- )
+ 2>r ( xnum xdenom ynum ydenom r: w h )
+ rot swap ( xnum xdenom ynum ydenom r: w h )
+ 2r> ( xnum xdenom ynum ydenom w h )
+ swap >r ( xnum xdenom ynum ydenom h r: w )
+ -rot */ ( xnum xdenom h' r: w )
+ r> swap >r ( xnum xdenom w r: h' )
+ -rot */ ( w' r: h' )
+ r> ( w' h' )
+ set-dst-size ( )
+;
+: rx ( 6*n -- 6*n ) 0 5 do i pick .d -1 +loop cr resize-image ;
+: arx ." A " rx resize-image ;
+: brx ." B " rx resize-image ;
+
+0 0 2value p0
+0 0 2value p1
+0 0 2value base-distance
+0 0 2value base-wh
+0 0 2value base-touch-xy
+0 0 2value base-center-xy
+
+\ Try to keep the center of the image in the same place after resizing
+: recenter-image ( -- )
+ base-center-xy half-size xy-
+ set-dst-offset
+;
+
+0 value down0?
+0 value down1?
+
+: distance ( -- x y ) p1 p0 xy- ;
+
+: xy-abs ( x y -- abs-x abs-y ) swap abs swap abs ;
+
+0 value touch-ih
+: open-touch ( -- )
+ touch-ih 0= if
+ " /touchscreen" open-dev to touch-ih
+ then
+ touch-ih 0= abort" Can't open touchscreen"
+;
+: close-touch ( -- ) touch-ih ?dup if close-dev 0 to touch-ih then ;
+
+: mark-touch ( -- )
+ p0 to base-touch-xy
+ image-center-xy to base-center-xy
+;
+: mark-size ( -- )
+ dst-size@ to base-wh
+ distance xy-abs to base-distance
+;
+: move-image ( newx,y -- )
+\ wait-frame
+ base-touch-xy xy- base-center-xy half-size xy- xy+ set-dst-offset
+;
+: resize&recenter ( -- )
+\ wait-frame
+ distance xy-abs base-distance base-wh resize-image \ brx
+ recenter-image
+;
+: do-touch0 ( x y down? -- )
+ -rot to p0 if ( ) \ Down
+ down1? if \ Double-touch - resize
+ down0? if \ Not the initial touch pair - resize the screen image
+ resize&recenter
+ else \ Initial touch pair - establish the baseline size
+ mark-size
+ then
+ else \ The second finger is up, so this is a move
+ down0? if \ Not the initial touch - move the image
+ p0 move-image
+ else \ Initial touch - establish the base position
+ mark-touch
+ then
+ then
+
+ true to down0?
+ else \ Up
+ false to down0?
+ then
+;
+: do-touch1 ( x y down? -- )
+ -rot to p1 if ( ) \ Down
+ down0? if \ Double-touch - resize
+ down1? if \ Not the initial touch pair - resize the window
+ resize&recenter
+ else \ Initial touch pair - establish the baseline size
+ mark-size
+
+ \ Initial touch of second finger - reestablish the base position
+ \ in case the image was moved after the first finger when down
+ mark-touch
+ then
+ else \ The first finger is now up - do nothing in this case
+ then
+
+ true to down1?
+ else \ Up
+ \ When the second finger goes up, we again must reestablish the base position
+ \ so subsequent movement of the first finger will cause stable image movement
+ mark-touch
+ false to down1?
+ then
+;
+: touch>screen ( x y -- x' y' )
+ scr-size@ 1 1 xy- xy*
+ swap d# 15 rshift swap d# 15 rshift
+;
+: do-gesture ( -- )
+ " get-touch?" touch-ih $call-method 0= if exit then ( x y z down? touch# )
+ 2>r ( x y z r: down? touch# )
+ drop ( x y r: down? touch# )
+ \ Convert from touchscreen to pixel coordinates
+ touch>screen ( x y r: down? touch# )
+ 2r> ( x y down? touch# )
+ case
+ 0 of do-touch0 endof
+ 1 of do-touch1 endof
+ ( default ) >r 3drop r>
+ endcase
+;
+: pinch
+ open-touch
+ begin do-gesture key? until
+ close-touch
+;
+dend
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Author: wmb
Date: Thu Feb 3 21:05:52 2011
New Revision: 2168
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2168
Log:
OLPC XO-1 - restart after botched resume, instead of interacting. The problem happens extremely infrequently, so there is no longer any interest in debugging it (it's probably an obscure race condition between OS shutdown and power-button-to-suspend handling).
Modified:
cpu/x86/pc/olpc/fw.bth
Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth Thu Feb 3 08:00:20 2011 (r2167)
+++ cpu/x86/pc/olpc/fw.bth Thu Feb 3 21:05:52 2011 (r2168)
@@ -603,9 +603,9 @@
: ?resume-botch
h# 1454 pl@ 2 and if
red-letters
- ." Interacting due to botched resume" cr
+ ." Restarting due to botched resume" cr
black-letters
- hex interact
+ bye
then
;
Author: wmb
Date: Thu Feb 3 08:00:20 2011
New Revision: 2167
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2167
Log:
XO-1.75 RTC driver - call set-address in bcd-time&date so other TWSI users don't interfere with it.
Modified:
cpu/arm/olpc/1.75/rtc.fth
Modified: cpu/arm/olpc/1.75/rtc.fth
==============================================================================
--- cpu/arm/olpc/1.75/rtc.fth Thu Feb 3 07:59:14 2011 (r2166)
+++ cpu/arm/olpc/1.75/rtc.fth Thu Feb 3 08:00:20 2011 (r2167)
@@ -31,6 +31,7 @@
: >bcd ( binary -- bcd ) d# 10 /mod 4 << + ;
: bcd-time&date ( -- s m h d m y century )
+ set-address
[ifdef] cl2-a1
7 0 smb-read-n ( s m h dow d m y )
[else]