Author: wmb Date: 2009-10-29 00:19:25 +0100 (Thu, 29 Oct 2009) New Revision: 1442
Modified: 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/usb.fth Log: OLPC trac 9423 - lengthen USB power off time during a reboot, thus giving the power rail time to discharge enough to reset attached devices.
Modified: cpu/x86/pc/olpc/via/fw.bth =================================================================== --- cpu/x86/pc/olpc/via/fw.bth 2009-10-28 21:51:49 UTC (rev 1441) +++ cpu/x86/pc/olpc/via/fw.bth 2009-10-28 23:19:25 UTC (rev 1442) @@ -268,6 +268,13 @@ protect-fw ." Interacting" cr hex interact then + \ This is a good place to turn on USB power. It is about 2 seconds after + \ early startup, giving the USB power rail time to discharge and stay + \ off long enough to reset attached devices. The total "off" time is + \ about 2.6 seconds - part of that is EC time - but the rail droops + \ slowly depending on what is plugged in. It droops hardly at all + \ with nothing plugged in. + usb-power-on then ; warning !
Modified: cpu/x86/pc/olpc/via/ioinit.fth =================================================================== --- cpu/x86/pc/olpc/via/ioinit.fth 2009-10-28 21:51:49 UTC (rev 1441) +++ cpu/x86/pc/olpc/via/ioinit.fth 2009-10-28 23:19:25 UTC (rev 1442) @@ -207,6 +207,15 @@ 64 05 05 mreg \ Bump NULL-SOF valid time to 8 micro frames (04), Inhibit C4 state on USB 1.1 ISO activity (01) end-table
+[ifdef] xo-board + \ On a boot we turn off USB power to ensure that USB devices are reset + \ properly after a reboot. A "stand-init" routine in via/usb.fth turns + \ it back on, after the implicit delay of uncompressing OFW and other + \ startup activities. We must do this before selecting GPO10 below, else + \ the enable will start to float high before we can turn it off. + acpi-io-base h# 4c + port-rl h# 400 bitclr ax dx out \ Turn off USB power +[then] + d# 17 0 devfunc \ Bus control and power management 40 44 44 mreg \ Enable I/O Recovery time (40), Enable ports 4d0/4d1 for edge/level setting (04) [ifdef] xo-board @@ -404,6 +413,5 @@
\ acpi-io-base h# 26 + port-rb h# 07 bitset al dx out \ Settings to support C4 state acpi-io-base h# 26 + port-rb h# 06 bitset al dx out \ Settings to support C3 state -acpi-io-base h# 4c + port-rl h# 400 bitset ax dx out \ Set USB power high
3 # io-apic-mmio-base #) byte mov 1 # io-apic-mmio-base h# 10 + #) mov \ IO-APIC FSB delivery type
Modified: cpu/x86/pc/olpc/via/romreset.bth =================================================================== --- cpu/x86/pc/olpc/via/romreset.bth 2009-10-28 21:51:49 UTC (rev 1441) +++ cpu/x86/pc/olpc/via/romreset.bth 2009-10-28 23:19:25 UTC (rev 1442) @@ -230,6 +230,8 @@
fload ${BP}/cpu/x86/pc/olpc/via/startgfxrestore.fth \ Display restoration
+ acpi-io-base h# 4c + port-rl h# 400 bitset ax dx out \ Set USB power high + cli
facs-adr h# 18 + #) ax mov ax ax or 0<> if \ X_Firmware_Waking_Vector
Modified: cpu/x86/pc/olpc/via/usb.fth =================================================================== --- cpu/x86/pc/olpc/via/usb.fth 2009-10-28 21:51:49 UTC (rev 1441) +++ cpu/x86/pc/olpc/via/usb.fth 2009-10-28 23:19:25 UTC (rev 1442) @@ -100,6 +100,11 @@ ; ' usb-quiet to go-hook
+\ Turn on USB power after a delay, to ensure that USB devices are reset correctly on boot +: usb-power-off ( -- ) h# 4c acpi-l@ h# 400 invert and h# 4c acpi-l! ; +: usb-power-on ( -- ) h# 4c acpi-l@ h# 400 or h# 4c acpi-l! ; +: usb-power-cycle ( -- ) usb-power-off d# 1000 ms usb-power-on ; + \ LICENSE_BEGIN \ Copyright (c) 2007 FirmWorks \
openfirmware@openfirmware.info