Author: wmb
Date: Tue Dec 6 08:11:02 2011
New Revision: 2738
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2738
Log:
USB - added some access words - currently unused - for the ULPI viewport register.
Added:
dev/usb2/hcd/ehci/ulpi.fth
Added: dev/usb2/hcd/ehci/ulpi.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/usb2/hcd/ehci/ulpi.fth Tue Dec 6 08:11:02 2011 (r2738)
@@ -0,0 +1,75 @@
+\ See license at end of file
+purpose: Support for ULPI Viewports
+
+\ ULPI is a hardware interface between a USB controller and external PHY.
+\ The semantics of the interface mimics that of the UTMI+ hardware interface,
+\ but the ULPI interface has fewer pins and is thus better-suited for
+\ external PHYs. The UTMI+ interface was optimized for controller and PHY
+\ on the same chip.
+\ UTMI+ has a number of hardware control signals that change infrequently.
+\ ULPI implements those almost-static signals with bits in PHY-resident
+\ registers. Typically that is transparent to software, as the ULPI side
+\ of the hardware interface does the work of translating the UTMI hardware
+\ signaling into register accesses across the ULPI interconnect. However,
+\ it is possible to read and write those registers explicitly, e.g. for
+\ debugging. The "ULPI Viewport" register in the EHCI register block lets
+\ you do that
+
+\ Low-level access to the viewport registers
+: view@ ( -- n ) h# 30 op-reg@ ;
+: view! ( -- n ) h# 30 op-reg! ;
+
+\ Wait for the indicated viewport register bit to go to 0.
+: ulpi-poll ( bit -- )
+ d# 10000 0 do ( bit )
+ dup view@ and if ( bit )
+ drop unloop exit ( -- )
+ then ( bit )
+ d# 5 us ( bit )
+ loop ( bit )
+ drop true abort" ULPI poll timeout"
+;
+\ Wakeup the ULPI interface if it is not in "synchronized" state
+: ?ulpi-wakeup ( -- )
+ view@ h# 0800.0000 and 0= if \ SYNC state
+ h# 8000.0000 view! \ wakeup
+ h# 8000.0000 ulpi-poll \ wait for wakeup
+ then
+;
+\ Read a register in the ULPI PHY
+: ulpi@ ( reg -- n )
+ ?ulpi-wakeup ( reg )
+ d# 16 lshift h# 4000.0000 or view! ( ) \ address and RUN bit
+ h# 4000.0000 ulpi-poll ( )
+ view@ 8 rshift h# ff and ( n )
+;
+\ Write a register in the ULPI PHY
+: ulpi! ( n reg -- )
+ ?ulpi-wakeup ( n reg )
+ d# 16 lshift or h# 4000.0000 or view! ( ) \ address and WRITE bit and RUN bit
+ h# 4000.0000 ulpi-poll ( )
+;
+
+\ 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: Tue Dec 6 08:10:34 2011
New Revision: 2734
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2734
Log:
OLPC XO-3 - USB SPH / ULPI PHY now working.
Added:
cpu/arm/mmp2/ulpiphy.fth
Modified:
cpu/arm/olpc/3.0/usb.fth
Added: cpu/arm/mmp2/ulpiphy.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/mmp2/ulpiphy.fth Tue Dec 6 08:10:34 2011 (r2734)
@@ -0,0 +1,38 @@
+\ See license at end of file
+purpose: Access to miscellaneous control/enable registers for the ULPI PHY portion of the USB SPH controller
+
+h# 3800 io2-va + constant usbsph-misc-va
+: usbsph-misc@ ( -- n ) usbsph-misc-va 4 + l@ ;
+: usbsph-misc! ( n -- ) usbsph-misc-va 4 + l! ;
+: usbsph-int@ ( -- n ) usbsph-misc-va h# 28 + l@ ;
+: usbsph-int! ( n -- ) usbsph-misc-va h# 28 + l! ;
+: usbsph-ctrl@ ( -- n ) usbsph-misc-va h# 30 + l@ ;
+: usbsph-ctrl! ( n -- ) usbsph-misc-va h# 30 + l! ;
+: ulpi-on ( -- ) h# 0800.0000 usbsph-misc! ;
+: ulpi-resume-interrupt-on ( -- ) 2 usbsph-int! ;
+: ulpi-clock-on ( -- ) usbsph-ctrl@ 1 or usbsph-ctrl! ;
+: ulpi-clock-select ( -- ) usbsph-ctrl@ h# 400 or usbsph-ctrl! ;
+
+\ 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
Modified: cpu/arm/olpc/3.0/usb.fth
==============================================================================
--- cpu/arm/olpc/3.0/usb.fth Tue Dec 6 08:10:23 2011 (r2733)
+++ cpu/arm/olpc/3.0/usb.fth Tue Dec 6 08:10:34 2011 (r2734)
@@ -20,7 +20,7 @@
: wake ( -- ) ;
end-package
-0 0 " f0001000" " /" begin-package \ USB Host Controller 1 - ULPI
+0 0 " f0003000" " /" begin-package \ USB Host Controller 1 - ULPI
h# 200 constant /regs
my-address my-space /regs reg
: my-map-in ( len -- adr )
@@ -44,6 +44,9 @@
;
: reset-usb-hub ( -- )
d# 146 gpio-clr d# 10 ms d# 146 gpio-set \ Resets ULPI hub
+ ulpi-clock-on
+ ulpi-clock-select
+ ulpi-on
;
: init-usb ( -- )