diff --git a/repos/dde_linux/src/drivers/usb_host/lx_emul.cc b/repos/dde_linux/src/drivers/usb_host/lx_emul.cc index 29be18912..e9cadbc76 100644 --- a/repos/dde_linux/src/drivers/usb_host/lx_emul.cc +++ b/repos/dde_linux/src/drivers/usb_host/lx_emul.cc @@ -19,7 +19,6 @@ #include #include #include -#include /* Local includes */ #include "signal.h" @@ -41,7 +40,6 @@ namespace Genode { unsigned long jiffies; -void lx_backtrace() { Genode::backtrace(); } void pci_dev_put(struct pci_dev *pci_dev) diff --git a/repos/dde_linux/src/drivers/usb_host/spec/imx8q_evk/platform.cc b/repos/dde_linux/src/drivers/usb_host/spec/imx8q_evk/platform.cc new file mode 100644 index 000000000..0b184dea6 --- /dev/null +++ b/repos/dde_linux/src/drivers/usb_host/spec/imx8q_evk/platform.cc @@ -0,0 +1,60 @@ +/* + * \brief XHCI for Freescale i.MX8 + * \author Alexander Boettcher + * \date 2019-12-02 + * + * The driver is supposed to work solely if in the bootloader (uboot) the + * usb controller got powered on and the bootloader does not disable it on + * Genode boot. + */ + +/* + * Copyright (C) 2019 Genode Labs GmbH + * + * This file is distributed under the terms of the GNU General Public License + * version 2. + */ + +#include +#include + +extern "C" void module_dwc3_driver_init(); +extern "C" void module_xhci_plat_init(); + +void platform_hcd_init(Genode::Env &, Services *services) +{ + module_dwc3_driver_init(); + module_xhci_plat_init(); + + /* setup XHCI-controller platform device */ + { + static resource xhci_res[] = + { + { 0x38200000ul, 0x38200000ul + 0x10000 - 1, "dwc3", IORESOURCE_MEM }, + { 41 + 32, 41 + 32, "dwc3-irq", IORESOURCE_IRQ }, + }; + + platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); + pdev->name = (char *)"dwc3"; + pdev->id = 2; + pdev->num_resources = 2; + pdev->resource = xhci_res; + + pdev->dev.of_node = (device_node*)kzalloc(sizeof(device_node), 0); + pdev->dev.of_node->properties = (property*)kzalloc(sizeof(property), 0); + pdev->dev.of_node->properties->name = "compatible"; + pdev->dev.of_node->properties->value = (void*)"fsl,imx8mq-dwc3"; + pdev->dev.of_node->properties->next = (property*)kzalloc(sizeof(property), 0); + pdev->dev.of_node->properties->next->name = "dr_mode"; + pdev->dev.of_node->properties->next->value = (void*)"host"; + + /* + * Needed for DMA buffer allocation. See 'hcd_buffer_alloc' in 'buffer.c' + */ + static u64 dma_mask = ~(u64)0; + pdev->dev.dma_mask = &dma_mask; + pdev->dev.coherent_dma_mask = ~0; + + platform_device_register(pdev); + } +} diff --git a/repos/dde_linux/src/drivers/usb_host/spec/imx8q_evk/target.mk b/repos/dde_linux/src/drivers/usb_host/spec/imx8q_evk/target.mk new file mode 100644 index 000000000..563131adc --- /dev/null +++ b/repos/dde_linux/src/drivers/usb_host/spec/imx8q_evk/target.mk @@ -0,0 +1,17 @@ +include $(REP_DIR)/src/drivers/usb_host/target.inc + +TARGET = imx8q_evk_usb_host_drv +REQUIRES = imx8q_evk + +SRC_C += usb/dwc3/core.c +SRC_C += usb/dwc3/host.c +SRC_C += usb/host/xhci-plat.c + +INC_DIR += $(REP_DIR)/src/drivers/usb_host/spec/arm +INC_DIR += $(REP_DIR)/src/include/spec/arm_64 + +SRC_CC += spec/arm/platform.cc +SRC_CC += spec/imx8q_evk/platform.cc + +CC_OPT += -DCONFIG_ARM64 +CC_OPT += -DCONFIG_USB_DWC3_HOST=1