diff --git a/dde_linux/README b/dde_linux/README index 55fcfc772..b81708316 100644 --- a/dde_linux/README +++ b/dde_linux/README @@ -3,6 +3,19 @@ Device drivers ported from the Linux kernel USB ### +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'. + + +Configuration snippet to enable UHCI and EHCI + +! + HID ~~~ @@ -13,7 +26,7 @@ Configuration snippet: ! ! ! -! +! ! ! ! @@ -34,14 +47,12 @@ Configuration snippet: ! ! ! -! +! Network (Nic) ~~~~~~~~~~~~~ -Supported on PandaBoard only using the 'smsc95xx' driver. - Configuration snippet: ! @@ -50,7 +61,7 @@ Configuration snippet: ! ! ! -! +! ! ! ! diff --git a/dde_linux/lib/mk/x86_32/usb.mk b/dde_linux/lib/mk/x86_32/usb.mk index 1856672e3..b87eaca3d 100644 --- a/dde_linux/lib/mk/x86_32/usb.mk +++ b/dde_linux/lib/mk/x86_32/usb.mk @@ -4,4 +4,6 @@ include $(REP_DIR)/lib/mk/usb.inc CC_OPT += -DCONFIG_PCI -DCONFIG_USB_EHCI_PCI=1 -DCONFIG_USB_XHCI_HCD=0 INC_DIR += $(LIB_INC_DIR)/x86_32 $(LIB_INC_DIR)/x86 -SRC_CC += pci_driver.cc +SRC_CC += pci_driver.cc platform.cc + +vpath platform.cc $(LIB_DIR)/x86 diff --git a/dde_linux/lib/mk/x86_64/usb.mk b/dde_linux/lib/mk/x86_64/usb.mk index 71d8a81ac..25cb21fc2 100644 --- a/dde_linux/lib/mk/x86_64/usb.mk +++ b/dde_linux/lib/mk/x86_64/usb.mk @@ -4,4 +4,6 @@ include $(REP_DIR)/lib/mk/usb.inc CC_OPT += -DCONFIG_PCI -DCONFIG_USB_EHCI_PCI=1 -DCONFIG_USB_XHCI_HCD=0 INC_DIR += $(LIB_INC_DIR)/x86_64 $(LIB_INC_DIR)/x86 -SRC_CC += pci_driver.cc +SRC_CC += pci_driver.cc platform.cc + +vpath platform.cc $(LIB_DIR)/x86 diff --git a/dde_linux/run/linux_nic_panda.run b/dde_linux/run/linux_nic_panda.run index bd358a558..7cedc16e1 100644 --- a/dde_linux/run/linux_nic_panda.run +++ b/dde_linux/run/linux_nic_panda.run @@ -57,7 +57,7 @@ set config { - + diff --git a/dde_linux/run/usb_hid.run b/dde_linux/run/usb_hid.run index bd077cf2d..ed5f791f7 100644 --- a/dde_linux/run/usb_hid.run +++ b/dde_linux/run/usb_hid.run @@ -68,7 +68,7 @@ append config { - + diff --git a/dde_linux/run/usb_net.run b/dde_linux/run/usb_net.run index bb2af4cd1..d37737a74 100644 --- a/dde_linux/run/usb_net.run +++ b/dde_linux/run/usb_net.run @@ -54,7 +54,7 @@ set config { - + diff --git a/dde_linux/run/usb_storage.run b/dde_linux/run/usb_storage.run index 7a4eba039..f7cdff65a 100644 --- a/dde_linux/run/usb_storage.run +++ b/dde_linux/run/usb_storage.run @@ -72,7 +72,7 @@ append config { - + diff --git a/dde_linux/src/lib/usb/arm/platform_arndale/platform.cc b/dde_linux/src/lib/usb/arm/platform_arndale/platform.cc index bbc409e9c..b31f50f23 100644 --- a/dde_linux/src/lib/usb/arm/platform_arndale/platform.cc +++ b/dde_linux/src/lib/usb/arm/platform_arndale/platform.cc @@ -20,6 +20,7 @@ /* Emulation */ #include #include +#include /* Linux */ #include @@ -356,6 +357,9 @@ void platform_hcd_init(Services *services) if (services->nic) module_usbnet_init(); - //ehci_setup(services); - xhci_setup(services); + if (services->ehci) + ehci_setup(services); + + if (services->xhci) + xhci_setup(services); } diff --git a/dde_linux/src/lib/usb/arm/platform_panda/platform.cc b/dde_linux/src/lib/usb/arm/platform_panda/platform.cc index 1d018388b..78f3be0c6 100644 --- a/dde_linux/src/lib/usb/arm/platform_panda/platform.cc +++ b/dde_linux/src/lib/usb/arm/platform_panda/platform.cc @@ -12,6 +12,7 @@ */ #include +#include #include #include @@ -367,6 +368,9 @@ extern "C" int module_smsc95xx_driver_init(); void platform_hcd_init(Services *services) { + if (!services->ehci) + return; + /* register network */ if (services->nic) { module_usbnet_init(); @@ -381,7 +385,7 @@ void platform_hcd_init(Services *services) /* setup EHCI-controller platform device */ platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); - pdev->name = "ehci-omap"; + pdev->name = (char *)"ehci-omap"; pdev->id = 0; pdev->num_resources = 2; pdev->resource = _ehci; diff --git a/dde_linux/src/lib/usb/include/arm/platform/platform.h b/dde_linux/src/lib/usb/include/arm/platform/platform.h index d93673fb5..f3ab9a22a 100644 --- a/dde_linux/src/lib/usb/include/arm/platform/platform.h +++ b/dde_linux/src/lib/usb/include/arm/platform/platform.h @@ -18,8 +18,6 @@ extern "C" { #endif -#include - static inline void platform_execute(void *sp, void *func, void *arg) { diff --git a/dde_linux/src/lib/usb/include/platform.h b/dde_linux/src/lib/usb/include/platform.h index c435d2344..9733a6f31 100644 --- a/dde_linux/src/lib/usb/include/platform.h +++ b/dde_linux/src/lib/usb/include/platform.h @@ -16,13 +16,74 @@ #ifndef _PLATFORM_H_ #define _PLATFORM_H_ +#include +#include +#include + struct Services { + /* USB profiles */ bool hid; bool stor; bool nic; - Services() : hid(false), stor(false), nic(false) { } + /* Controller types */ + bool uhci; /* 1.0 */ + bool ehci; /* 2.0 */ + bool xhci; /* 3.0 */ + + Services() + : hid(false), stor(false), nic(false), + uhci(false), ehci(false), xhci(false) + { + using namespace Genode; + + try { + config()->xml_node().sub_node("hid"); + hid = true; + } catch (Config::Invalid) { + PDBG("No node found - not starting any USB services"); + return; + } catch (Xml_node::Nonexistent_sub_node) { + PDBG("No config node found - not starting the USB HID (Input) service"); + } + + try { + config()->xml_node().sub_node("storage"); + stor = true; + } catch (Xml_node::Nonexistent_sub_node) { + PDBG("No config node found - not starting the USB Storage (Block) service"); + } + + try { + config()->xml_node().sub_node("nic"); + nic = true; + } catch (Xml_node::Nonexistent_sub_node) { + PDBG("No config node found - not starting the USB Nic (Network) service"); + } + + try { + config()->xml_node().attribute("uhci").has_value("yes"); + uhci = true; + PINF("Enabled UHCI (USB 1.0/1.1) support"); + } catch (...) { } + + try { + config()->xml_node().attribute("ehci").has_value("yes"); + ehci = true; + PINF("Enabled EHCI (USB 2.0) support"); + } catch (...) { } + + try { + config()->xml_node().attribute("xhci").has_value("yes"); + xhci = true; + PINF("Enabled XHCI (USB 3.0) support"); + } catch (...) { } + + if (!(uhci | ehci | xhci)) + PWRN("Warning: No USB controllers enabled.\n" + "Use in your 'usb_drv' configuration"); + } }; void platform_hcd_init(Services *services); diff --git a/dde_linux/src/lib/usb/include/x86_32/platform/platform.h b/dde_linux/src/lib/usb/include/x86_32/platform/platform.h index 8c5d30c34..6934a20c1 100644 --- a/dde_linux/src/lib/usb/include/x86_32/platform/platform.h +++ b/dde_linux/src/lib/usb/include/x86_32/platform/platform.h @@ -26,17 +26,4 @@ void platform_execute(void *sp, void *func, void *arg) : : "r" (sp), "r" (func), "r" (arg)); } -extern "C" void module_ehci_hcd_init(); -extern "C" void module_ehci_pci_init(); -extern "C" void module_uhci_hcd_init(); - -inline void platform_hcd_init(Services *s) -{ - - /* ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, not after */ - module_ehci_hcd_init(); - module_ehci_pci_init(); - module_uhci_hcd_init(); -} - #endif /* _X86_32__PLATFORM_H_ */ diff --git a/dde_linux/src/lib/usb/include/x86_64/platform/platform.h b/dde_linux/src/lib/usb/include/x86_64/platform/platform.h index 44b7004ec..e2f477a59 100644 --- a/dde_linux/src/lib/usb/include/x86_64/platform/platform.h +++ b/dde_linux/src/lib/usb/include/x86_64/platform/platform.h @@ -27,17 +27,4 @@ void platform_execute(void *sp, void *func, void *arg) : "+r" (sp), "+r" (func), "+r" (arg) : : "memory"); } -extern "C" void module_ehci_hcd_init(); -extern "C" void module_ehci_pci_init(); -extern "C" void module_uhci_hcd_init(); - -inline void platform_hcd_init(Services *s) -{ - - /* ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, not after */ - module_ehci_hcd_init(); - module_ehci_pci_init(); - module_uhci_hcd_init(); -} - #endif /* _X86_64__PLATFORM_H_ */ diff --git a/dde_linux/src/lib/usb/main.cc b/dde_linux/src/lib/usb/main.cc index 1f5fbf5a7..8d0f934fa 100644 --- a/dde_linux/src/lib/usb/main.cc +++ b/dde_linux/src/lib/usb/main.cc @@ -18,14 +18,14 @@ #include #include #include -#include -#include #include + /* Local */ -#include "storage/component.h" -#include "routine.h" -#include "signal.h" +#include +#include +#include +#include extern "C" { #include @@ -92,30 +92,8 @@ void start_usb_driver() Services services; - try { - config()->xml_node().sub_node("hid"); + if (services.hid) start_input_service(&ep_hid); - services.hid = true; - } catch (Config::Invalid) { - PDBG("No node found - not starting any USB services"); - return; - } catch (Xml_node::Nonexistent_sub_node) { - PDBG("No config node found - not starting the USB HID (Input) service"); - } - - try { - config()->xml_node().sub_node("storage"); - services.stor = true; - } catch (Xml_node::Nonexistent_sub_node) { - PDBG("No config node found - not starting the USB Storage (Block) service"); - } - - try { - config()->xml_node().sub_node("nic"); - services.nic = true; - } catch (Xml_node::Nonexistent_sub_node) { - PDBG("No config node found - not starting the USB Nic (Network) service"); - } Timer::init(&recv); Irq::init(&recv); diff --git a/dde_linux/src/lib/usb/x86/platform.cc b/dde_linux/src/lib/usb/x86/platform.cc new file mode 100644 index 000000000..3e28b11d7 --- /dev/null +++ b/dde_linux/src/lib/usb/x86/platform.cc @@ -0,0 +1,36 @@ +/** + * \brief X86 platform initialization + * \author Sebastian Sumpf + * \date 2013-05-17 + */ + +/* + * Copyright (C) 2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include +#include + + +extern "C" void module_ehci_hcd_init(); +extern "C" void module_ehci_pci_init(); +extern "C" void module_uhci_hcd_init(); + +void platform_hcd_init(Services *s) +{ + /* ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, not after */ + if (s->ehci) { + module_ehci_hcd_init(); + module_ehci_pci_init(); + } + + if (s->uhci) + module_uhci_hcd_init(); +} + + + + diff --git a/libports/run/lwip.run b/libports/run/lwip.run index 9f1feb208..7ac1496ed 100644 --- a/libports/run/lwip.run +++ b/libports/run/lwip.run @@ -81,7 +81,7 @@ append_if $use_usb_driver config { - + }