Author: quozl
Date: Thu May 31 08:47:17 2012
New Revision: 2991
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2991
Log:
OLPC - lid close consistent across models, made into common code, #11095
Added:
dev/olpc/lid.fth
Modified:
cpu/arm/olpc/1.75/switches.fth
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/via/cstate.fth
Modified: cpu/arm/olpc/1.75/switches.fth
==============================================================================
--- cpu/arm/olpc/1.75/switches.fth Thu May 31 07:28:43 2012 (r2990)
+++ cpu/arm/olpc/1.75/switches.fth Thu May 31 08:47:17 2012 (r2991)
@@ -36,39 +36,7 @@
['] all-switch-states catch
;
-false value lid-already-down?
-0 value lid-down-time
-d# 10000 constant lid-shutdown-ms
-d# 2000 constant lid-warning-ms
-0 value lid-warned?
-
-: ?lid-shutdown ( -- )
- lid? if
- lid-already-down? if
- get-msecs lid-down-time - ( ms )
-
- dup lid-warning-ms >= lid-warned? 0= and if
- ." Lid switch is active - Powering off in 8 seconds" cr
- ." Type lid-off to disable this function" cr
- true to lid-warned?
- then ( ms )
-
- lid-shutdown-ms >= if
- ." Powering off after 10 seconds of lid down" cr
- power-off
- then
- else
- get-msecs to lid-down-time
- true to lid-already-down?
- then
- else
- false to lid-already-down?
- false to lid-warned?
- then
-;
-: lid-on ( -- ) ['] ?lid-shutdown to do-lid ;
-' lid-on to do-lid
-
+fload ${BP}/dev/olpc/lid.fth
end-package
\ LICENSE_BEGIN
Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth Thu May 31 07:28:43 2012 (r2990)
+++ cpu/x86/pc/olpc/fw.bth Thu May 31 08:47:17 2012 (r2991)
@@ -479,7 +479,10 @@
" dhcp" ' ip-address set-config-string-default
-: c1-idle ( -- ) interrupts-enabled? if halt then ;
+: lid? ( -- flag ) h# 30 >hi gpio@ h# 400 and 0= ;
+fload ${BP}/dev/olpc/lid.fth
+
+: c1-idle ( -- ) interrupts-enabled? if halt then do-lid ;
' c1-idle to stdin-idle
: fast-boot? ( -- flag )
Modified: cpu/x86/pc/olpc/via/cstate.fth
==============================================================================
--- cpu/x86/pc/olpc/via/cstate.fth Thu May 31 07:28:43 2012 (r2990)
+++ cpu/x86/pc/olpc/via/cstate.fth Thu May 31 08:47:17 2012 (r2991)
@@ -28,42 +28,8 @@
then
;
-: lid-down? ( -- flag ) h# 48 acpi-l@ h# 80 and 0= ;
-false value lid-already-down?
-0 value lid-down-time
-d# 10000 constant lid-shutdown-ms
-d# 2000 constant lid-warning-ms
-0 value lid-warned?
-
-: ?lid-shutdown ( -- )
- lid-down? if
- lid-already-down? if
- acpi-timer@ lid-down-time - d# 3580 / ( ms )
-
- dup lid-warning-ms >= lid-warned? 0= and if
- ." Lid switch is active - Powering off in 8 seconds" cr
- ." Type lid-off to disable this function" cr
- true to lid-warned?
- then ( ms )
-
- lid-shutdown-ms >= if
- ." Powering off after 10 seconds of lid down" cr
- power-off
- then
- else
- acpi-timer@ to lid-down-time
- true to lid-already-down?
- then
- else
- false to lid-already-down?
- false to lid-warned?
- then
-;
-
-defer do-lid
-: lid-on ( -- ) ['] ?lid-shutdown to do-lid ;
-: lid-off ( -- ) ['] noop to do-lid ;
-lid-on
+: lid? ( -- flag ) h# 48 acpi-l@ h# 80 and 0= ;
+fload ${BP}/dev/olpc/lid.fth
defer do-idle ' noop to do-idle
Added: dev/olpc/lid.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/olpc/lid.fth Thu May 31 08:47:17 2012 (r2991)
@@ -0,0 +1,68 @@
+\ See license at end of file
+purpose: lid close triggers power off
+
+false value lid-already-down?
+0 value lid-down-time
+d# 10000 constant lid-shutdown-ms
+d# 2000 constant lid-warning-ms
+0 value lid-warned?
+
+: ?lid-shutdown ( -- )
+ lid? if
+ lid-already-down? if
+ get-msecs lid-down-time - ( ms )
+
+ dup lid-warning-ms >= lid-warned? 0= and if
+ cr
+ ." Lid switch is active - powering off in 8 seconds" cr
+ ." Type lid-off to disable this" cr
+ true to lid-warned?
+ then ( ms )
+
+ lid-shutdown-ms >= if
+ ." Powering off after 10 seconds of lid down" cr
+ power-off
+ then
+ else
+ get-msecs to lid-down-time
+ true to lid-already-down?
+ then
+ else
+ false to lid-already-down?
+ false to lid-warned?
+ then
+;
+
+[ifndef] do-lid
+defer do-lid
+[then]
+
+: lid-on ( -- ) ['] ?lid-shutdown to do-lid ;
+[ifndef] lid-off
+: lid-off ( -- ) ['] noop to do-lid ;
+[then]
+' lid-on to do-lid
+
+\ 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 May 31 07:28:43 2012
New Revision: 2990
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2990
Log:
SDHCI - OLPC trac #11844 - fixed SD card detection on XO-1. The chipset's SDHCI controller requires you to turn on some enable bits before the card insertion bits become visible.
Modified:
dev/mmc/sdhci/sdhci.fth
Modified: dev/mmc/sdhci/sdhci.fth
==============================================================================
--- dev/mmc/sdhci/sdhci.fth Tue May 29 20:44:37 2012 (r2989)
+++ dev/mmc/sdhci/sdhci.fth Thu May 31 07:28:43 2012 (r2990)
@@ -88,6 +88,26 @@
\ : led-on ( -- ) h# 28 cb@ 1 or h# 28 cb! ;
\ : led-off ( -- ) h# 28 cb@ 1 invert and h# 28 cb! ;
+\ We leave the remove and insert interrupt enables on because the
+\ hardware has a bug that blocks the card detection status bits
+\ unless the interrupt enables are on.
+0 instance value intstat-count
+: intstat-on ( -- )
+ intstat-count 0= if
+ h# 00cb h# 34 cw! \ normal interrupt status en reg
+ \ Enable: Remove, Insert, DMA Interrupt, Transfer Complete, CMD Complete
+ \ Disable: Card Interrupt, Read Ready, Write Ready, Block Gap
+ h# f1ff h# 36 cw! \ error interrupt status en reg
+ then
+ intstat-count 1+ to intstat-count
+;
+: intstat-off ( -- )
+ intstat-count 1- 0 max to intstat-count
+ intstat-count 0= if
+ h# c0 h# 34 cl! \ Remove, Insert on, others off
+ then
+;
+
\ There is no need to use the debounced version (the 3.0000 bits).
\ We poll for the card when the SDMMC driver opens, rather than
\ sitting around waiting for insertion/removal events.
@@ -95,11 +115,13 @@
defer card-inserted?
: sdhci-card-inserted? ( -- flag )
+ intstat-on
get-msecs d# 500 + begin ( time-limit )
\ When the stable bit is set, we can believe the answer
present-state@ h# 20000 and if ( time-limit )
drop ( )
present-state@ h# 10000 and 0<> ( flag )
+ intstat-off ( flag )
exit ( -- flag )
then ( time-limit )
dup get-msecs - 0< ( time-limit timeout? )
@@ -107,6 +129,7 @@
drop ( )
." SD Card detect unstable!" cr ( )
false ( flag )
+ intstat-off ( flag )
;
' sdhci-card-inserted? to card-inserted?
: write-protected? ( -- flag )
@@ -170,17 +193,6 @@
: data-timeout! ( n -- ) h# 2e cb! ;
-\ We leave the remove and insert interrupt enables on because the
-\ hardware has a bug that blocks the card detection status bits
-\ unless the interrupt enables are on.
-: intstat-on ( -- )
- h# 00cb h# 34 cw! \ normal interrupt status en reg
- \ Enable: Remove, Insert, DMA Interrupt, Transfer Complete, CMD Complete
- \ Disable: Card Interrupt, Read Ready, Write Ready, Block Gap
- h# f1ff h# 36 cw! \ error interrupt status en reg
-;
-: intstat-off ( -- ) h# c0 h# 34 cl! ; \ Remove, Insert on, others off
-
: setup-host ( -- )
reset-host
internal-clock-on
Author: wmb
Date: Tue May 29 20:44:37 2012
New Revision: 2989
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2989
Log:
OLPC trac #11902 - ALPS touchpad driver - use mouse emulation mode on initial open so the menu works, switching to ALPS mode only during selftest.
Modified:
dev/olpc/touchpad/touchpad.fth
Modified: dev/olpc/touchpad/touchpad.fth
==============================================================================
--- dev/olpc/touchpad/touchpad.fth Fri May 25 03:24:28 2012 (r2988)
+++ dev/olpc/touchpad/touchpad.fth Tue May 29 20:44:37 2012 (r2989)
@@ -72,17 +72,21 @@
touchpad-id h# ffff and h# 0067 =
;
+variable mode \ 0 - unknown 1 - GS 2 - PT 3 - mouse
+
\ Ref: 5.2.10 (2-1) of Hybrid-GP2B-T-1.pdf
-: advanced-mode ( -- ) stream-off stream-off stream-off stream-off ; \ 4 f5 commands
+: advanced-mode ( -- ) stream-off stream-off stream-off stream-off 0 mode ! ; \ 4 f5 commands
\ Ref: 5.2.10 (2-2) of Hybrid-GP2B-T-1.pdf
-: mouse-mode ( -- ) h# ff read2 drop drop ; \ Response is 0,aa
+: mouse-mode ( -- ) \ Response is 0,aa
+ h# ff read2 drop drop
+ stream-mode 3 mode !
+;
\ Send the common "three f2 commands" prefix. "f2" is normally the
\ "identify" command; the response (for a mouse-like device) is 0x00
: alps-prefix ( -- ) 3 0 do h# f2 read1 drop loop ;
-variable mode \ 0 - unknown 1 - GS 2 - PT 3 - mouse
0 instance value packet-type
\ Ref: 5.2.10 (3) of Hybrid-GP2B-T-1.pdf
@@ -104,16 +108,16 @@
: start ( -- )
setup
olpc-touchpad? if
- 0 mode ! advanced-mode stream-on
+ advanced-mode stream-on
else
- stream-mode 3 mode !
+ mouse-mode
then
;
\ Substitute "start" for "stream-mode" in the driver's open
\ method, so we can use advance-mode for the ALPS touchpad.
-patch start stream-mode open
+patch mouse-mode stream-mode open
\ I have been unable to get this to work. The response is always
@@ -543,6 +547,8 @@
if track then
exit-test? until
+ mouse-mode \ Restore the standard mouse mode so the menu will work
+
close
cursor-on
page