Skip to content

Commit

Permalink
usb: add OHCI support
Browse files Browse the repository at this point in the history
Fixes #2357
  • Loading branch information
alex-ab authored and chelmuth committed May 2, 2017
1 parent 7410587 commit 4e5fecd
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 14 deletions.
10 changes: 5 additions & 5 deletions repos/dde_linux/README
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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"/>
Expand Down
2 changes: 1 addition & 1 deletion repos/dde_linux/lib/mk/spec/x86/usb.inc
@@ -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

#
Expand Down
2 changes: 1 addition & 1 deletion repos/dde_linux/ports/dde_linux.hash
@@ -1 +1 @@
ed9880704fad6f3d85514dd47b65a5eb7bfbf16f
bf950a363006ca4414e3cbb7d96b4e9b009d788b
2 changes: 1 addition & 1 deletion repos/dde_linux/run/usb_hid.run
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion repos/dde_linux/run/usb_net.run
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion repos/dde_linux/run/usb_storage.run
Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion repos/dde_linux/run/usb_terminal.run
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions repos/dde_linux/src/include/lx_emul/byteorder.h
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions repos/dde_linux/src/lib/usb/include/lx_emul.h
Expand Up @@ -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)

Expand Down
10 changes: 8 additions & 2 deletions repos/dde_linux/src/lib/usb/include/platform.h
Expand Up @@ -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 */

Expand Down Expand Up @@ -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");
Expand All @@ -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");
}
};

Expand Down
10 changes: 10 additions & 0 deletions repos/dde_linux/src/lib/usb/lx_emul.cc
Expand Up @@ -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 **
******************/
Expand Down
2 changes: 2 additions & 0 deletions repos/dde_linux/src/lib/usb/raw/raw.cc
Expand Up @@ -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());
});
Expand Down
10 changes: 9 additions & 1 deletion repos/dde_linux/src/lib/usb/spec/x86/platform.cc
Expand Up @@ -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();
Expand All @@ -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();
}
}
7 changes: 7 additions & 0 deletions repos/dde_linux/usb.list
Expand Up @@ -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
Expand Down

0 comments on commit 4e5fecd

Please sign in to comment.