[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH v2 0/9] USB support
This series adds some long-missing USB drivers to the CDI repository
(and defines the required interfaces).
For now, it only supports control and bulk transfers (which are enough
for mass storage devices), no hotplugging, no suspend/resume, neither a
lot of other things. So among others, there is no USB keyboard support.
Maybe writing the driver and implementing support for it in the USB bus
driver would not be so difficult, but I'm really hesitant to define the
necessary CDI interface for it (CDI.hid? CDI.keyboard? CDI.serial?).
The drivers added by this series are an EHCI driver, a USB 2.0 bus
driver (including a hub driver), and a bulk-only mass storage driver
(with a SCSI interface; should be the right thing to drive your average
thumb drive (and maybe even HDDs), but will not work for e.g. USB floppy
drives).
I tested these drivers using µxoµcota and týndur in qemu and on a real
machine (which only has EHCIs and xHCIs; every EHCI has a high speed
hub to communicate with low and full speed devices, so there is no need
for companion controllers).
v2:
- Added patch 1 so that the ext2 driver can be compiled
- Patch 2: Added 64 bit endianness conversion functions
- Patch 4: Added a LUN addressing field to cdi_scsi_packet (it turns out
that the LUN is not part of the SCSI command)
- Patch 7:
- Added some timeouts
- Dropped some redundant macros
- Added the 64 bit fields to ehci_qtd
- Calculate the alignment for ehci_qtd and ehci_qh during compile time
instead of hard-coding it
- Call the IRQ handler sometimes manually to ensure the HC is not
getting stuck somewhere because the driver didn't acknowledge some
IRQ
- Patch 8: stdio.h should always be included (due to the usage of
fprintf())
- Patch 9:
- Removed printf() statements left over from debugging
- Read LUN from cdi_scsi_packet instead of the SCSI command
- Include stdbool.h
git-backport-diff against v1:
Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/9:[down] 'Makefile: Heed Makefile.conf'
002/9:[0020] [FC] 'cdi/misc: Add CDI_UPCAST and endianness functions'
003/9:[----] [--] 'cdi/scsi, cdi.h: Remove týndur-specific fields'
004/9:[down] 'cdi/scsi: Add support for multiple LUNs'
^^^^ false negative, actually [0003] [FC]
005/9:[----] [-C] 'cdi.h: Add cdi_handle_bus_device()'
006/9:[----] [--] 'cdi/usb: Add headers'
007/9:[0189] [FC] 'ehci: Add EHCI driver'
008/9:[0002] [FC] 'usb: Add USB 2.0 bus driver'
009/9:[0007] [FC] 'usb-storage: Add USB mass storage driver'
Max Reitz (9):
Makefile: Heed Makefile.conf
cdi/misc: Add CDI_UPCAST and endianness functions
cdi/scsi, cdi.h: Remove týndur-specific fields
cdi/scsi: Add support for multiple LUNs
cdi.h: Add cdi_handle_bus_device()
cdi/usb: Add headers
ehci: Add EHCI driver
usb: Add USB 2.0 bus driver
usb-storage: Add USB mass storage driver
Makefile | 4 +-
ehci/ehci.c | 661 +++++++++++++++++++++++++++++++++
ehci/ehci.h | 170 +++++++++
ehci/main.c | 68 ++++
include/cdi.h | 27 +-
include/cdi/misc.h | 78 ++++
include/cdi/scsi.h | 11 +-
include/cdi/usb-structures.h | 118 ++++++
include/cdi/usb.h | 217 +++++++++++
include/cdi/usb_hcd.h | 159 ++++++++
usb-storage/main.c | 76 ++++
usb-storage/usb-storage.c | 213 +++++++++++
usb-storage/usb-storage.h | 34 ++
usb/main.c | 61 +++
usb/usb-hubs.h | 78 ++++
usb/usb.c | 864 +++++++++++++++++++++++++++++++++++++++++++
usb/usb.h | 86 +++++
17 files changed, 2915 insertions(+), 10 deletions(-)
create mode 100644 ehci/ehci.c
create mode 100644 ehci/ehci.h
create mode 100644 ehci/main.c
create mode 100644 include/cdi/usb-structures.h
create mode 100644 include/cdi/usb.h
create mode 100644 include/cdi/usb_hcd.h
create mode 100644 usb-storage/main.c
create mode 100644 usb-storage/usb-storage.c
create mode 100644 usb-storage/usb-storage.h
create mode 100644 usb/main.c
create mode 100644 usb/usb-hubs.h
create mode 100644 usb/usb.c
create mode 100644 usb/usb.h
--
2.3.5