usb: add OHCI support

Fixes #2357
This commit is contained in:
Alexander Boettcher 2017-03-30 22:29:19 +02:00 committed by Christian Helmuth
parent 74b790f70b
commit 80eddd8731
14 changed files with 50 additions and 14 deletions

View File

@ -9,7 +9,7 @@ Controller configuration
The driver can be started using different or all USB controller types a platform
offers (USB 1.0/2.0/3.0). Note that not all controllers are supported by all
platforms. Controllers can be enabled as attribute in the config node of the
driver. Supported attributes are: 'uhci', 'ehci', and 'xhci'.
driver. Supported attributes are: 'uhci', 'ohci', 'ehci', and 'xhci'.
Configuration snippet to enable UHCI and EHCI
@ -40,7 +40,7 @@ Configuration snippet:
!<start name="usb_drv">
! <resource name="RAM" quantum="3M"/>
! <provides><service name="Input"/></provides>
! <config uhci="yes" ehci="yes" xhci="yes">
! <config uhci="yes" ohci="yes" ehci="yes" xhci="yes">
! <hid/>
! </config>
!</start>
@ -80,7 +80,7 @@ Configuration snippet:
! <resource name="RAM" quantum="2M"/>
! <provides> <service name="Block"/> </provides>
! <config><storage /></config>
!</start uhci="yes">
!</start>
Network (Nic)
@ -119,7 +119,7 @@ Configuration snippet:
!<start name="usb_drv">
! <resource name="RAM" quantum="8M"/>
! <provides><service name="Usb"/></provides>
! <config uhci="yes" ehci="yes" xhci="yes">
! <config uhci="yes" ohci="yes" ehci="yes" xhci="yes">
! <raw>
! <report devices="yes"/>
! </raw>
@ -150,7 +150,7 @@ access the device 'usb-1-6':
!<start name="usb_drv">
! <resource name="RAM" quantum="8M"/>
! <provides><service name="Usb"/></provides>
! <config uhci="yes" ehci="yes" xhci="yes">
! <config uhci="yes" ohci="yes" ehci="yes" xhci="yes">
! <raw>
! <report devices="yes"/>
! <policy label="comp1 -> usb-1-6" vendor_id="0x13fe" product_id="0x5200" bus="0x0001" dev="0x0006"/>

View File

@ -1,4 +1,4 @@
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c ehci-pci.c)
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c ehci-pci.c ohci-hcd.c ohci-pci.c)
SRC_C += usb/core/hcd-pci.c
#

View File

@ -1 +1 @@
ed9880704fad6f3d85514dd47b65a5eb7bfbf16f
bf950a363006ca4414e3cbb7d96b4e9b009d788b

View File

@ -115,7 +115,7 @@ append config {
<start name="usb_drv">
<resource name="RAM" quantum="16M"/>
<provides><service name="Input"/></provides>
<config uhci="yes" ehci="yes" xhci="yes">
<config uhci="yes" ohci="yes" ehci="yes" xhci="yes">
<hid/>
</config>
</start>

View File

@ -59,7 +59,7 @@ set config {
<provides>
<service name="Nic"/>
</provides>
<config uhci="no" ehci="yes" xhci="yes">
<config uhci="no" ohci="no" ehci="yes" xhci="yes">
<nic mac="02:00:00:00:01:01" />
</config>
</start>

View File

@ -66,7 +66,7 @@ append config {
<start name="usb_drv">
<resource name="RAM" quantum="12M"/>
<provides> <service name="Block"/> </provides>
<config uhci="yes" ehci="yes" xhci="yes"><storage /></config>
<config uhci="yes" ohci="yes" ehci="yes" xhci="yes"><storage /></config>
</start>
<start name="test-usb">
<resource name="RAM" quantum="2M" />

View File

@ -73,7 +73,7 @@ append config {
<start name="usb_drv">
<resource name="RAM" quantum="32M"/>
<provides><service name="Usb"/></provides>
<config uhci="yes" ehci="yes" xhci="yes">
<config uhci="yes" ohci="yes" ehci="yes" xhci="yes">
<raw>
<policy label="usb_terminal -> usb_serial" vendor_id="0x67b" product_id="0x2303"/>
</raw>

View File

@ -37,7 +37,9 @@
#define cpu_to_le16s __cpu_to_le16s
#define cpu_to_be16 __cpu_to_be16
#define cpu_to_le32 __cpu_to_le32
#define cpu_to_le32p __cpu_to_le32p
#define cpu_to_be32 __cpu_to_be32
#define cpu_to_be32p __cpu_to_be32p
#define cpu_to_le32s __cpu_to_le32s
#define cpu_to_le64 __cpu_to_le64
#define le16_to_cpup __le16_to_cpup

View File

@ -1518,6 +1518,7 @@ enum {
GFP_NOWAIT = 0x2000000u,
};
unsigned long get_zeroed_page(gfp_t gfp_mask);
unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
#define __get_free_page(gfp_mask) __get_free_pages((gfp_mask), 0)

View File

@ -35,6 +35,7 @@ struct Services
/* Controller types */
bool uhci = false; /* 1.0 */
bool ohci = false;
bool ehci = false; /* 2.0 */
bool xhci = false; /* 3.0 */
@ -105,6 +106,11 @@ struct Services
log("Enabled UHCI (USB 1.0/1.1) support");
}
if (config_node.attribute_value("ohci", false)) {
ohci = true;
log("Enabled OHCI (USB 1.0/1.1) support");
}
if (config_node.attribute_value("ehci", false)) {
ehci = true;
log("Enabled EHCI (USB 2.0) support");
@ -115,9 +121,9 @@ struct Services
log("Enabled XHCI (USB 3.0) support");
}
if (!(uhci | ehci | xhci))
if (!(uhci | ohci | ehci | xhci))
warning("Warning: No USB controllers enabled.\n"
"Use <config (u/e/x)hci=\"yes\"> in your 'usb_drv' configuration");
"Use <config (u/o/e/x)hci=\"yes\"> in your 'usb_drv' configuration");
}
};

View File

@ -256,6 +256,16 @@ void *memscan(void *addr, int c, size_t size)
}
/*****************
** linux/gfp.h **
*****************/
unsigned long get_zeroed_page(gfp_t gfp_mask)
{
return (unsigned long)kzalloc(PAGE_SIZE, 0);
}
/******************
** linux/log2.h **
******************/

View File

@ -786,11 +786,13 @@ class Usb::Root : public Genode::Root_component<Session_component>
bool const uhci = config.attribute_value<bool>("uhci", false);
bool const ehci = config.attribute_value<bool>("ehci", false);
bool const xhci = config.attribute_value<bool>("xhci", false);
bool const ohci = config.attribute_value<bool>("ohci", false);
Genode::Reporter::Xml_generator xml(_config_reporter, [&] {
if (uhci) xml.attribute("uhci", "yes");
if (ehci) xml.attribute("ehci", "yes");
if (xhci) xml.attribute("xhci", "yes");
if (ohci) xml.attribute("ohci", "yes");
xml.append(config.content_base(), config.content_size());
});

View File

@ -18,6 +18,8 @@ extern "C" void module_ax88179_178a_driver_init();
extern "C" void module_usbnet_init();
extern "C" void module_ehci_hcd_init();
extern "C" void module_ehci_pci_init();
extern "C" void module_ohci_hcd_mod_init();
extern "C" void module_ohci_pci_init();
extern "C" void module_uhci_hcd_init();
extern "C" void module_xhci_hcd_init();
extern "C" void module_xhci_pci_init();
@ -40,6 +42,12 @@ void platform_hcd_init(Services *s)
module_ehci_pci_init();
}
if (s->uhci)
if (s->ohci) {
module_ohci_hcd_mod_init();
module_ohci_pci_init();
}
if (s->uhci) {
module_uhci_hcd_init();
}
}

View File

@ -68,6 +68,13 @@ linux-4.4.3/drivers/usb/host/ehci-q.c
linux-4.4.3/drivers/usb/host/ehci-sched.c
linux-4.4.3/drivers/usb/host/ehci-sysfs.c
linux-4.4.3/drivers/usb/host/ehci-timer.c
linux-4.4.3/drivers/usb/host/ohci-hcd.c
linux-4.4.3/drivers/usb/host/ohci.h
linux-4.4.3/drivers/usb/host/ohci-hub.c
linux-4.4.3/drivers/usb/host/ohci-dbg.c
linux-4.4.3/drivers/usb/host/ohci-mem.c
linux-4.4.3/drivers/usb/host/ohci-q.c
linux-4.4.3/drivers/usb/host/ohci-pci.c
linux-4.4.3/drivers/usb/host/pci-quirks.h
linux-4.4.3/drivers/usb/host/pci-quirks.c
linux-4.4.3/drivers/usb/host/uhci-debug.c