[OpenBIOS] r367 - dev/usb2/hcd/uhci
svn at openbios.org
svn at openbios.org
Mon May 7 23:32:22 CEST 2007
Author: wmb
Date: 2007-05-07 23:32:22 +0200 (Mon, 07 May 2007)
New Revision: 367
Modified:
dev/usb2/hcd/uhci/probe.fth
dev/usb2/hcd/uhci/uhci.fth
Log:
USB - Added auto-reprobe feature to UHCI host controller driver.
Modified: dev/usb2/hcd/uhci/probe.fth
===================================================================
--- dev/usb2/hcd/uhci/probe.fth 2007-05-07 02:13:06 UTC (rev 366)
+++ dev/usb2/hcd/uhci/probe.fth 2007-05-07 21:32:22 UTC (rev 367)
@@ -29,21 +29,12 @@
;
external
-: power-usb-ports ( -- ) ;
+: power-ports ( -- ) ;
-: probe-usb ( -- )
- alloc-pkt-buf
- 2 0 do
- i reset-root-hub-port
- i ['] probe-root-hub-port catch if
- drop ." Failed to probe root port " i .d cr
- then
- i portsc@ i portsc! \ Clear change bits
- loop
- free-pkt-buf
-;
+: probe-root-hub ( -- )
+ \ Set active-package so device nodes can be added and removed
+ my-self ihandle>phandle push-package
-: reprobe-usb ( -- )
alloc-pkt-buf
2 0 do
i portsc@ h# a and if
@@ -56,8 +47,35 @@
then
loop
free-pkt-buf
+
+ pop-package
;
+: open ( -- flag )
+ parse-my-args
+ open-count 0= if
+ map-regs
+ first-open? if
+ false to first-open?
+ reset-usb
+ init-struct
+ init-lists
+ start-usb
+ then
+ alloc-dma-buf
+
+ probe-root-hub
+ then
+ open-count 1+ to open-count
+ true
+;
+
+: close ( -- )
+ open-count 1- to open-count
+ end-extra
+ open-count 0= if free-dma-buf unmap-regs then
+;
+
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
Modified: dev/usb2/hcd/uhci/uhci.fth
===================================================================
--- dev/usb2/hcd/uhci/uhci.fth 2007-05-07 02:13:06 UTC (rev 366)
+++ dev/usb2/hcd/uhci/uhci.fth 2007-05-07 21:32:22 UTC (rev 367)
@@ -53,6 +53,7 @@
: portsc! ( data port -- ) 2* 10 + uhci-w! ;
: reset-usb ( -- )
+ uhci-reg dup 0= if map-regs then
4 usbcmd! \ Global reset
50 ms
0 usbcmd!
@@ -63,6 +64,7 @@
usbcmd@ 2 and 0= ?leave
1 ms
loop
+ 0= if unmap-regs then
;
: (process-hc-status) ( -- )
@@ -86,29 +88,6 @@
: stop-usb ( -- ) h# c0 usbcmd! ;
: suspend-usb ( -- ) ;
-: open ( -- flag )
- parse-my-args
- open-count 0= if
- map-regs
- first-open? if
- false to first-open?
- reset-usb
- init-struct
- init-lists
- start-usb
- then
- alloc-dma-buf
- then
- open-count 1+ to open-count
- true
-;
-
-: close ( -- )
- open-count 1- to open-count
- end-extra
- open-count 0= if free-dma-buf unmap-regs then
-;
-
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
More information about the OpenBIOS
mailing list