Commit graph

28 commits

Author SHA1 Message Date
cinap_lenrek 999e98b9b8 usbehci: use 64-bit base address, remove resetlck, simplify scanpci() 2021-01-17 11:55:39 +01:00
cinap_lenrek f59101231a usbehci: release ctlr ilock before calling pollcheck() 2020-05-24 02:43:21 +02:00
cinap_lenrek 3869d7a843 usbehci: avoid kproc() while holding poll lock 2020-05-24 02:11:37 +02:00
cinap_lenrek 481a4c75fd usbehci: silence "param declared but not used" compiler warning in itdinit()/sitdinit() 2019-09-09 16:58:45 +02:00
cinap_lenrek 19a883ce7a usbehci: introduce dmaflush() function to handle portable cache invalidation for device drivers 2019-07-17 10:24:50 +02:00
aiju 56405e0919 usbehci: catch interrupt in tsleep 2018-03-07 08:45:06 +00:00
aiju 9226caf2a3 usbehci: add uframes control request to return uframes one at a time 2018-03-06 17:18:48 +00:00
cinap_lenrek 6f70699aec usbehci: fix medium- to low quality highspeed isochronous transfers
everything was broken. strting with hsinit not even chaining
the itd's into a ring. followed by broken buffer pointer pages.
finally, the interrupt handler's read transaction length
calculation was completely bugged, using the *FRAME* index
to access descriptors csw[] fields and not reseting tdi->ndata
thru the loop.

minor stuff:

iso->data needs to be freed with ctlr->dmafree()

put ival in iso->ival so ctl message cannot override the endpoints
pollival and screw up deallocation.
2018-03-05 06:09:31 +01:00
cinap_lenrek 6e65596827 xhci: experimental usb3 support 2017-07-31 03:22:23 +02:00
cinap_lenrek d46099e3af usbehci: fix crash in cancelisoio() for highspeed device due to wrong pollival 2017-07-31 03:07:14 +02:00
cinap_lenrek 6fb9ae8f43 usbehci: clean cache unconditionally before handing a buffer to the hardware
even in the read case, we need to clean the cache
so the cpu will not flush out old changes while
the hardware updates the buffer.
2015-09-05 10:14:19 +02:00
cinap_lenrek 995379e388 usbehci: initial support for usb on zynq, remove uncached.h
the following hooks have been added to the ehci Ctlr
structore to handle cache coherency (on arm):

	void*	(*tdalloc)(ulong,int,ulong);
	void*	(*dmaalloc)(ulong);
	void	(*dmafree)(void*);
	void	(*dmaflush)(int,void*,ulong);

tdalloc() is used to allocate descriptors and the periodic
frame schedule array. on arm, this needs to return uncached
memory. tdalloc()ed memory is never freed.

dmaalloc()/dmafree() is used for io buffers. this can return
cached memory when when hardware maintains cache coherency (pc)
or dmaflush() is provided to flush/invalidate the cache (zynq),
otherwise needs to return uncached memory.

dmaflush() is used to flush/invalidate the cache. the first
argument tells us if we need to flush (non zero) or
invalidate (zero).

uncached.h is gone now. this change makes the handling explicit.
2015-02-14 03:00:31 +01:00
cinap_lenrek 41908149de nusb: resolve endpoint id conflict with different input and output types
ftrvxmtrx repots devices that use the endpoint number for
input and output of different types like:

 nusb/ether:             parsedesc endpoint 5[7]  07 05 81 03 08 00 09	# ep1 in intr
 nusb/ether:             parsedesc endpoint 5[7]  07 05 82 02 00 02 00
 nusb/ether:             parsedesc endpoint 5[7]  07 05 01 02 00 02 00	# ep1 out bulk

the previous change tried to work arround this but had the
concequence that only the lastly defined endpoint was
usable.

this change addresses the issue by allowing up to 32 endpoints
per device (16 output + 16 input endpoints) in devusb. the
hci driver will ignore the 4th bit and will only use the
lower 4 bits as endpoint address when talking to the usb
device.

when we encounter a conflict, we map the input endpoint
to the upper id range 16..31 and the output endpoint
to id 0..15 so two distinct endpoints are created.
2014-04-23 20:03:01 +02:00
cinap_lenrek 06bc19c28f kernel: usb fixes for amd64 2014-02-01 10:20:43 +01:00
cinap_lenrek df6b68092c kernel: kproc error and exit
catch the error() that can be thrown by sleep() and tsleep()
in kprocs.

add missing pexit() calls.

always set the freemem argument to pexit() from kproc otherwise
the process gets added to the broken list.
2013-11-22 22:28:20 +01:00
cinap_lenrek f104cc9d79 usbehci: portreset timing
assert port reset for 50ms, not 10ms.
2013-08-30 16:00:03 +02:00
cinap_lenrek 12ecb3e568 usbehci: fix portreset.
Port Reset R/W. 1=Port is in Reset. 0=Port is not in Reset. Default = 0. When
software writes a one to this bit (from a zero), the bus reset sequence as defined in the
USB Specification Revision 2.0 is started. Software writes a zero to this bit to terminate
the bus reset sequence. Software must keep this bit at a one long enough to ensure the
reset sequence, as specified in the USB Specification Revision 2.0, completes. Note:
when software writes this bit to a one, it must also write a zero to the Port Enable bit.
Note that when software writes a zero to this bit there may be a delay before the bit
status changes to a zero. The bit status will not read as a zero until after the reset
has completed.
2013-08-27 19:01:41 +02:00
cinap_lenrek 808480f76b usbehci, usbuhci: paranoia
double the td abort delay and make sure the tsleep() isnt
shortened by a pending note. in that case, tsleep() would
raise error(Eintr); immidiately and would not sleep the
requested amount potentially cauing us to release active
dma memory too early! so we wrap the tsleep() call in a
while(waserror()) so we will at least wait the Abortdelay
amount if error is raised.

also, only try to idle the still active td's.

do not copy data in epio() when there was an error, theres
no reason to touch user buffer in that case.

for uhci, we also check that theres not more data in the
buffers than requested to avoid overflowing user buffer
in epio(). this should not happen but we'r paranoid.

for ehci, we also halt the queue head first in aborttds().
mark the queue heads as Qfree after unlinking and remove
some silly nil checks that are impossible.
2013-08-25 22:03:02 +02:00
cinap_lenrek 800670da4e usbehci: align page td buffer for >16K transfers, fix isohsinit()
from ehci spec:

The buffer pointer list in the qTD is long enough to support a maximum
transfer size of 20K bytes. This case occurs when all five buffer pointers
are used and the first offset is zero. A qTD handles a 16Kbyte buffer
with any starting buffer alignment.
2013-04-12 22:14:32 +02:00
cinap_lenrek 5a93a2a983 usbehci: remove panic() calls from interrupts if stuff isnt ready (spurious interrupts?) 2013-01-31 23:43:04 +01:00
cinap_lenrek a8fc4ddc6d usbehci: route ports to all ehci controllers, not just the first
i belive the seizing up was a side effect of broken
bios handover. ehci will not work on the other controllers
if we do not route the ports to them.
2012-11-28 07:35:28 +01:00
cinap_lenrek 0c52215ae3 usb: fix potential isoread overruns, error instead of panic on isoread in ohci 2012-09-03 04:23:02 +02:00
cinap_lenrek cfd25faa28 usb: fix isowrite putsamples race 2012-09-03 01:54:34 +02:00
cinap_lenrek f0facb2ed8 usbehci: import changes from sources (portreset, port handover handling), set interrupt threshold to 1 uframe 2012-03-07 23:50:58 +01:00
cinap_lenrek 79a044e38e usb: fix potential uninterruptable calls 2011-08-19 05:19:10 +02:00
cinap_lenrek 676a876df6 usb: added buffer delay control 2011-08-01 19:02:50 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00