Author: wmb Date: Wed Apr 25 01:26:40 2012 New Revision: 2950 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2950
Log: ASIX USB-LAN driver - power off the PHY when closing the device, thus eliminating excess power consumption during S3 selftest in manufacturing. The disadvantage is that subsequent opens take longer. Test case: ok select net unselect alarm-in-3 strp
Modified: dev/usb2/device/net/ax8817x.fth dev/usb2/device/net/common.fth dev/usb2/device/net/ethernet.fth
Modified: dev/usb2/device/net/ax8817x.fth ============================================================================== --- dev/usb2/device/net/ax8817x.fth Mon Apr 23 08:36:30 2012 (r2949) +++ dev/usb2/device/net/ax8817x.fth Wed Apr 25 01:26:40 2012 (r2950) @@ -179,6 +179,11 @@ d# 10 ms \ Just in case the link status bit isn't ready just yet ;
+: ax-stop-phy ( -- ) + ax88772? if + h# 40 ax-sw-reset \ Power off internal PHY, reset external one (08 == 0) + then +; : select-phy ( -- ) ax88772? if \ Linksys USB200M uses the built-in PHY, DLink DUB-E100 uses an external one @@ -316,6 +321,7 @@ ['] ax-link-up? to link-up? ['] ax-start-mac to start-mac ['] ax-start-phy to start-phy + ['] ax-stop-phy to stop-phy ['] ax-stop-mac to stop-mac ['] ax-get-mac-address to get-mac-address ['] ax-mii@ to mii@
Modified: dev/usb2/device/net/common.fth ============================================================================== --- dev/usb2/device/net/common.fth Mon Apr 23 08:36:30 2012 (r2949) +++ dev/usb2/device/net/common.fth Wed Apr 25 01:26:40 2012 (r2950) @@ -23,6 +23,7 @@ defer unwrap-msg ( adr len -- adr' len' ) ' noop to unwrap-msg defer link-up? ( -- up? ) ' true to link-up? defer start-phy ( -- ) ' noop to start-phy +defer stop-phy ( -- ) ' noop to stop-phy defer start-mac ( -- ) ' noop to start-mac defer stop-mac ( -- ) ' noop to stop-mac defer mii{ ( -- ) ' noop to mii{ \ Acquire
Modified: dev/usb2/device/net/ethernet.fth ============================================================================== --- dev/usb2/device/net/ethernet.fth Mon Apr 23 08:36:30 2012 (r2949) +++ dev/usb2/device/net/ethernet.fth Wed Apr 25 01:26:40 2012 (r2950) @@ -31,6 +31,7 @@ stop-mac end-bulk-in free-buf + stop-phy ;
external @@ -41,7 +42,7 @@
: copy-packet ( adr len -- len' ) dup multi-packet? if 4 + then ( adr len len' ) - /outbuf > if ." USB Ethernet write packet too long" cr stop-mac abort then ( adr len ) + /outbuf > if ." USB Ethernet write packet too long" cr stop-net abort then ( adr len )
multi-packet? if ( adr len ) dup wbsplit ( adr len len.low len.high ) @@ -71,7 +72,7 @@ \ The data format is: \ length.leword ~length.leword data [ pad-to-even ] : extract-packet ( -- data-adr len ) - residue 4 < if ." Short residue from USB Ethernet" cr stop-mac abort then + residue 4 < if ." Short residue from USB Ethernet" cr stop-net abort then
pkt-adr dup 4 + swap >r r@ c@ r@ 1+ c@ bwjoin ( data-adr length ) @@ -130,7 +131,7 @@ 0 ( adr 0 ) then ( adr ihandle|0 )
- dup 0= if ." Can't open obp-tftp support package" stop-mac abort then + dup 0= if ." Can't open obp-tftp support package" stop-net abort then ( adr ihandle )
>r @@ -185,6 +186,7 @@
link-up? 0= if ." Network not connected." cr + stop-phy true exit then