Author: wmb Date: 2009-05-29 04:26:07 +0200 (Fri, 29 May 2009) New Revision: 1205
Added: cpu/x86/pc/olpc/via/boardrev.fth cpu/x86/pc/olpc/via/ec.bth Modified: cpu/x86/pc/olpc/via/config.fth cpu/x86/pc/olpc/via/devices.fth cpu/x86/pc/olpc/via/fw.bth cpu/x86/pc/olpc/via/ioinit.fth cpu/x86/pc/olpc/via/romreset.bth cpu/x86/pc/olpc/via/startgfxinit.fth cpu/x86/pc/olpc/via/versions.fth Log: VIA - checkpoint - video works
Added: cpu/x86/pc/olpc/via/boardrev.fth =================================================================== --- cpu/x86/pc/olpc/via/boardrev.fth (rev 0) +++ cpu/x86/pc/olpc/via/boardrev.fth 2009-05-29 02:26:07 UTC (rev 1205) @@ -0,0 +1,50 @@ +purpose: Determine the board revision based on hardware and EC info +\ See license at end of file + +0 value board-revision + +\ Constructs a string like "B4" or "preB4" or "postB4" +: model-name$ ( -- model$ ) + board-revision h# 10 /mod ( minor major ) + swap dup 8 = if ( major minor ) + drop " " ( major prefix$ ) + else ( major minor ) + 8 < if " pre" else " post" then ( major prefix$ ) + then ( major prefix$ ) + push-hex + rot <# u# u# drop hold$ 0 u#> ( adr len ) + pop-base + 2dup + 2- 2 upper ( model$ ) \ Upper case for base model +; + +stand-init: board revision + ['] board-id@ catch if 0 then case + 0 of 0 endof \ EC broken + ( board-id ) dup h# 10 * 8 + swap \ E.g. b3 -> b38 + endcase + to board-revision +; + +\ LICENSE_BEGIN +\ Copyright (c) 2007 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
Modified: cpu/x86/pc/olpc/via/config.fth =================================================================== --- cpu/x86/pc/olpc/via/config.fth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/config.fth 2009-05-29 02:26:07 UTC (rev 1205) @@ -6,6 +6,9 @@ create compute-timings \ create demo-board create xo-board +[ifdef] xo-board +\ create use-ec +[then]
\ --- The environment that "boots" us --- \ - Image Format - Example Media - previous stage bootloader
Modified: cpu/x86/pc/olpc/via/devices.fth =================================================================== --- cpu/x86/pc/olpc/via/devices.fth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/devices.fth 2009-05-29 02:26:07 UTC (rev 1205) @@ -260,9 +260,11 @@
fload ${BP}/dev/olpc/kb3700/ecserial.fth \ Serial access to EC chip
+.( Implement ignore-power-button) cr +: ignore-power-button ( -- ) ; fload ${BP}/dev/olpc/kb3700/ecio.fth \ I/O space access to EC chip
-fload ${BP}/cpu/x86/pc/olpc/boardrev.fth \ Board revision decoding +fload ${BP}/cpu/x86/pc/olpc/via/boardrev.fth \ Board revision decoding [then]
: cpu-mhz ( -- n ) @@ -305,7 +307,7 @@ [ifdef] use-ec fload ${BP}/cpu/x86/pc/olpc/mfgdata.fth \ Manufacturing data fload ${BP}/cpu/x86/pc/olpc/mfgtree.fth \ Manufacturing data in device tree -fload ${BP}/cpu/x86/pc/olpc/kbdtype.fth \ Export keyboard type +\ fload ${BP}/cpu/x86/pc/olpc/kbdtype.fth \ Export keyboard type
fload ${BP}/dev/olpc/kb3700/battery.fth \ Battery status reports
Added: cpu/x86/pc/olpc/via/ec.bth =================================================================== --- cpu/x86/pc/olpc/via/ec.bth (rev 0) +++ cpu/x86/pc/olpc/via/ec.bth 2009-05-29 02:26:07 UTC (rev 1205) @@ -0,0 +1,18 @@ +purpose: Fetch the EC (Embedded Controller, i.e. KB3700) microcode + +command: &builder &this +build-now + +fload ${BP}/cpu/x86/pc/olpc/via/versions.fth + +\ If there is a GET_EC macro, use it instead of fetching the released version. +" ${GET_EC}" expand$ nip [if] + " ${GET_EC}" expand$ $sh +[else] + " wget -q http://dev.laptop.org/pub/ec/ec_v$%7BEC_VERSION%7D.img -O ec.img" expand$ $sh +[then] + +\ This forces the creation of an ec.log file, so we don't re-fetch ec.img +writing ec.version +" ${EC_VERSION}"n" expand$ ofd @ fputs +ofd @ fclose
Modified: cpu/x86/pc/olpc/via/fw.bth =================================================================== --- cpu/x86/pc/olpc/via/fw.bth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/fw.bth 2009-05-29 02:26:07 UTC (rev 1205) @@ -697,6 +697,12 @@ \ " flash http:\18.85.46.172\new.rom" eval ;
+: sci-wakeup ( -- ) ; +: acpi-l@ ( index -- l ) drop 0 ; +: acpi-l! ( l index -- ) 2drop ; +: s3 ( -- ) ; + + [ifdef] use-ec \ Fancy battery charge logger. fload ${BP}/cpu/x86/pc/olpc/charge.fth
Modified: cpu/x86/pc/olpc/via/ioinit.fth =================================================================== --- cpu/x86/pc/olpc/via/ioinit.fth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/ioinit.fth 2009-05-29 02:26:07 UTC (rev 1205) @@ -103,11 +103,13 @@ c1 20 00 mreg \ Disable USB PIRQ end-table
+[ifndef] xo-board d# 16 2 devfunc \ UHCI Ports 4,5 4a 02 02 mreg \ Enable Stop Bus Master Cycle if HALT Bit is Asserted 4b 60 60 mreg \ Enable New UHCI Dynamic Scheme - 66MHz (40) & 33MHz (20) c1 20 00 mreg \ Disable USB PIRQ end-table +[then]
d# 16 4 devfunc \ EHCI 42 40 40 mreg \ Enable Check PRESOF of ITDOUT Transaction during Fetching Data from DRAM @@ -139,17 +141,27 @@ \ 4d 01 01 mreg \ Enable LPC TPM \ 4e 08 08 mreg \ Enable ports 74/75 for CMOS RAM access 4e 18 18 mreg \ Enable ports 74/75 for CMOS RAM access - 10 res be like Phx -\ 50 40 40 mreg \ Disable USB device mode - 50 c0 c0 mreg \ Disable USB device mode - 80 res be like Phx + +[ifdef] demo-board + 50 40 40 mreg \ Disable USB device mode +[then] [ifdef] xo-board + 50 40 40 mreg \ Disable USB device mode 51 9f 88 mreg \ Enable SDIO and internal RTC, disable card reader, int mouse & kbd [then] + 52 1b 19 mreg \ No wait state between SIRQ transactions (10), Enable SIRQ (08), SIRQ frame is 6 clocks (3>1) +.( Check PC/PCI DMA necessity) cr 53 80 80 mreg \ Enable PC/PCI DMA +.( Check interrupt routing) cr 55 ff a0 mreg \ INTA and External General interrupt routing - INTA:IRQ10 56 ff b9 mreg \ INTB,C routing - INTC:IRQ11, INTB:IRQ9 57 f0 a0 mreg \ INTD routing - INTD:IRQ10 +.( Check RTC century byte mapping to cmos 32 - see d17f0 rx58) cr 58 40 40 mreg \ Enable Internal APIC +[ifdef] xo-board + 59 ff 18 mreg \ Keyboard (ports 60,64) and ports 62,66 on LPC bus (EC) +[then] \ 5b 10 10 mreg \ Enable APIC Clock Gating 5b 53 53 mreg \ Enable APIC Clock Gating - 43 res be like Phx 68 80 80 mreg \ Enable HPETs @@ -179,12 +191,14 @@ [ifdef] demo-board 97 ff 80 mreg \ be like Phx [then] -[ifdef] xo-board - 97 ff 81 mreg \ GPIO4/5 not KBDT/KBCK -[then]
- 9b ff 88 mreg \ 80 res be like Phx +\ NO! This doesn't work. If these lines are set as GPIOs, the system +\ will crash when you disable the internal KBC. +\ [ifdef] xo-board +\ 97 ff 81 mreg \ GPIO4/5 not KBDT/KBCK +\ [then]
+ 9b ff 88 mreg \ 80 undoc but is LVDS power. 0 forces LVDS power off, 1 lets 3d5.D2[7,6,3] control it [ifdef] xo-board 9f ff 08 mreg \ Slot 3 is SDIO, no pullup on KB/MS, fastest SD [then]
Modified: cpu/x86/pc/olpc/via/romreset.bth =================================================================== --- cpu/x86/pc/olpc/via/romreset.bth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/romreset.bth 2009-05-29 02:26:07 UTC (rev 1205) @@ -164,7 +164,6 @@
\ fload ${BP}/cpu/x86/pc/olpc/via/startgtlinit.fth
-.( Not doing io init) fload ${BP}/cpu/x86/pc/olpc/via/ioinit.fth
\ Enable the keyboard controller
Modified: cpu/x86/pc/olpc/via/startgfxinit.fth =================================================================== --- cpu/x86/pc/olpc/via/startgfxinit.fth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/startgfxinit.fth 2009-05-29 02:26:07 UTC (rev 1205) @@ -51,7 +51,12 @@ 5a 3c4 port-wb 00 3c5 port-wb \ Point back to primary registers
6d 3c4 port-wb e0 3c5 port-wb \ Base address [28:21] of SL in System Memory - base is 1c00.0000 - fbsize, memsize +[ifdef] demo-board 6e 3c4 port-wb 00 3c5 port-wb \ Base address [36:29] of SL in System Memory +[then] +[ifdef] xo-board + 6e 3c4 port-wb 01 3c5 port-wb \ Base address [36:29] of SL in System Memory +[then] 6f 3c4 port-wb 00 3c5 port-wb \ Base address [47:37] of SL in System Memory
36 3c4 port-wb 11 3c5 port-wb \ Subsystem Vendor ID 1
Modified: cpu/x86/pc/olpc/via/versions.fth =================================================================== --- cpu/x86/pc/olpc/via/versions.fth 2009-05-27 23:07:49 UTC (rev 1204) +++ cpu/x86/pc/olpc/via/versions.fth 2009-05-29 02:26:07 UTC (rev 1205) @@ -2,7 +2,7 @@
\ The overall firmware revision macro: FW_MAJOR A -macro: FW_MINOR 03d +macro: FW_MINOR 03e
\ The EC microcode macro: EC_VERSION a00
openfirmware@openfirmware.info