diff --git a/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives b/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives index 1f79737b50..911aad26a9 100644 --- a/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives +++ b/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives @@ -1,4 +1,5 @@ _/src/imx8_fb_drv +_/src/platform_drv _/src/usb_host_drv _/src/usb_hid_drv _/raw/drivers_interactive-imx8q_evk diff --git a/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config b/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config index 9365b94c42..3acccd3cbd 100644 --- a/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config +++ b/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config @@ -1,4 +1,4 @@ - + @@ -26,6 +26,35 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/dde_linux/run/usb_hid_raw.run b/repos/dde_linux/run/usb_hid_raw.run index fef8c0240f..b90f9a4b2d 100644 --- a/repos/dde_linux/run/usb_hid_raw.run +++ b/repos/dde_linux/run/usb_hid_raw.run @@ -49,7 +49,6 @@ if { [get_cmd_switch --autopilot] && [have_include "power_on/qemu"] } { } if { [get_cmd_switch --autopilot] && - ![have_spec arndale] && ![have_spec rpi] && ![have_spec x86] && ![have_spec imx6q_sabrelite] && @@ -58,6 +57,78 @@ if { [get_cmd_switch --autopilot] && exit 0 } +proc platform_drv_config_non_x86 {} { + if {[have_spec imx8q_evk]} { + return { + + + + + + + + + + + + + + } + } + if {[have_spec imx6q_sabrelite]} { + return { + + + + + + + + + + + + + + + + + + + + + + + } + } + if {[have_spec rpi]} { + return { + + + + + + + + } + } + return "" +} + +proc platform_drv_binary_non_x86 {} { + if {[have_spec imx8q_evk]} { return imx8mq_platform_drv } + if {[have_spec imx6q_sabrelite]} { return platform_drv } + if {[have_spec rpi]} { return rpi_new_platform_drv } + return no_platform_drv_available +} + # # Build # @@ -71,11 +142,12 @@ set build_components { server/report_rom } -lappend_if [have_spec gpio] build_components drivers/gpio +lappend_if [have_spec gpio] build_components drivers/gpio source ${genode_dir}/repos/base/run/platform_drv.inc -append_platform_drv_build_components - +if { [have_spec x86] } { append_platform_drv_build_components +} else { append build_components { drivers/platform } +} build $build_components create_boot_directory @@ -99,16 +171,32 @@ append config { - } + +} append_if [have_spec gpio] config " - " + +" -append_platform_drv_config +if { [have_spec x86] } { append_platform_drv_config +} else { +append config "" +append config { + + + +} +append config "[platform_drv_config_non_x86]" +append config { + + + +} +} append config { @@ -202,10 +290,11 @@ set boot_modules { core ld.lib.so init timer usb_hid_drv event_dump dynamic_rom report_rom } -append boot_modules [usb_host_drv_binary] +append boot_modules " [usb_host_drv_binary] " lappend_if [have_spec gpio] boot_modules [gpio_drv] -append_platform_drv_boot_modules +if {[have_spec x86]} { append_platform_drv_boot_modules +} else { append boot_modules " [platform_drv_binary_non_x86] " } build_boot_image $boot_modules 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 e27fe1380e..10617519e5 100644 --- a/repos/dde_linux/src/drivers/usb_host/lx_emul.cc +++ b/repos/dde_linux/src/drivers/usb_host/lx_emul.cc @@ -805,9 +805,8 @@ int pci_irq_vector(struct pci_dev *dev, unsigned int nr) static int platform_match(struct device *dev, struct device_driver *drv) { - if (!dev->name) - return 0; - + if (of_match_device(drv->of_match_table, dev)) return 1; + if (!dev->name) return 0; printk("MATCH %s %s\n", dev->name, drv->name); return (Genode::strcmp(dev->name, drv->name) == 0); @@ -889,6 +888,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) return r ? r->start : -1; } +static struct platform_device * platform_device_list = nullptr; int platform_device_register(struct platform_device *pdev) { @@ -897,6 +897,16 @@ int platform_device_register(struct platform_device *pdev) /*Set parent to ourselfs */ if (!pdev->dev.parent) pdev->dev.parent = &pdev->dev; + + if (!platform_device_list) { platform_device_list = pdev; + } else { + for (struct platform_device * pd = platform_device_list; + pd; pd = pd->next) { + if (!pd->next) { pd->next = pdev; break; } + } + } + pdev->next = nullptr; + device_add(&pdev->dev); return 0; } @@ -1008,6 +1018,8 @@ int device_property_read_string(struct device *dev, const char *propname, const const void *of_get_property(const struct device_node *node, const char *name, int *lenp) { + if (Genode::strcmp(name, "fsl,anatop") == 0) { return (const void*) 0xdeaddead; } + for (property * p = node ? node->properties : nullptr; p; p = p->next) if (Genode::strcmp(name, p->name) == 0) return p->value; @@ -1035,9 +1047,12 @@ const struct of_device_id *of_match_device(const struct of_device_id *matches, const struct device *dev) { const char * compatible = (const char*) of_get_property(dev->of_node, "compatible", 0); - for (; matches && matches->compatible[0]; matches++) + if (!compatible) return nullptr; + + for (; matches && matches->compatible[0]; matches++) { if (Genode::strcmp(matches->compatible, compatible) == 0) return matches; + } return nullptr; } @@ -1047,10 +1062,17 @@ int of_parse_phandle_with_args(struct device_node *np, const char *cells_name, int index, struct of_phandle_args *out_args) { - out_args->np = (device_node*) of_get_property(np, "fsl,usbmisc", 0); - out_args->args[0] = 1; + if (Genode::strcmp(list_name, "fsl,usbmisc") == 0) { + for (struct platform_device * pd = platform_device_list; pd; pd = pd->next) { + if (Genode::strcmp(pd->name, "usbmisc_imx") == 0) { + out_args->np = pd->dev.of_node; + out_args->args[0] = 1; + return 0; + } + } + } - return 0; + return -1; } diff --git a/repos/dde_linux/src/drivers/usb_host/lx_emul.h b/repos/dde_linux/src/drivers/usb_host/lx_emul.h index 43156e18b1..7fc072de65 100644 --- a/repos/dde_linux/src/drivers/usb_host/lx_emul.h +++ b/repos/dde_linux/src/drivers/usb_host/lx_emul.h @@ -921,6 +921,7 @@ struct platform_device { struct device dev; u32 num_resources; struct resource *resource; + struct platform_device * next; }; struct platform_device *platform_device_alloc(const char *name, int id); @@ -1581,7 +1582,7 @@ const struct of_device_id *of_match_device(const struct of_device_id *matches, c extern struct platform_device *of_find_device_by_node(struct device_node *np); struct property *of_find_property(const struct device_node *np, const char *name, int *lenp); -#define of_match_ptr(ptr) NULL +#define of_match_ptr(ptr) (ptr) #define for_each_available_child_of_node(parent, child) while (0) const void *of_device_get_match_data(const struct device *dev); @@ -1820,6 +1821,7 @@ static inline void trace_xhci_dbg_address(struct va_format *v) {} #define trace_dwc3_writel(v0, v1, v2) void lx_backtrace(void); +void lx_platform_device_init(void); #include diff --git a/repos/dde_linux/src/drivers/usb_host/spec/arm/platform.cc b/repos/dde_linux/src/drivers/usb_host/spec/arm/platform.cc index 3165b0854b..b8cb6455e2 100644 --- a/repos/dde_linux/src/drivers/usb_host/spec/arm/platform.cc +++ b/repos/dde_linux/src/drivers/usb_host/spec/arm/platform.cc @@ -1,71 +1,187 @@ /* * \brief ARM specific implemenations used on all SOCs - * \author Sebastian Sumpf - * \date 2016-04-25 + * \author Stefan Kalkowski + * \date 2020-08-18 */ /* - * Copyright (C) 2016-2017 Genode Labs GmbH + * Copyright (C) 2020 Genode Labs GmbH * * This file is distributed under the terms of the GNU General Public License * version 2. */ -#include -#include -#include +#include +#include #include - #include -#include #include #include +using namespace Genode; + +struct Io_mem : List::Element +{ + static addr_t io_mem_start; + + Io_mem_dataspace_capability cap; + addr_t start; + size_t size; + Constructible ds {}; + + Io_mem(Io_mem_dataspace_capability cap, + addr_t off, + size_t size, + List & list) + : cap(cap), start(io_mem_start+off), size(size) + { + io_mem_start += align_addr(off+size+PAGE_SIZE, PAGE_SHIFT); + list.insert(this); + } +}; + + +struct Irq : List::Element +{ + static unsigned irq_start; + + Irq_session_capability cap; + unsigned nr { irq_start++ }; + + Irq(Irq_session_capability cap, List & list) + : cap(cap) { list.insert(this); } +}; + + +struct Resource_env +{ + Platform::Connection platform; + List io_mem_list; + List irq_list; + + Resource_env(Env & env) : platform(env) { }; +}; + + +enum { + MAX_RESOURCES = 64, + IO_MEM_START = 0xf0000, + IRQ_START = 32, +}; + + +addr_t Io_mem::io_mem_start = IO_MEM_START; +unsigned Irq::irq_start = IRQ_START; + + +static Resource_env & resource_env(Genode::Env * env = nullptr) +{ + static Resource_env r_env { *env }; + return r_env; +} + + +void lx_platform_device_init() +{ + using String = String<64>; + using Device = Platform::Device; + + unsigned p_id = 0; + + resource_env().platform.with_xml([&] (Xml_node & xml) + { + xml.for_each_sub_node("device", [&] (Xml_node node) + { + Device::Name name = node.attribute_value("name", Device::Name()); + Platform::Device_client device { + resource_env().platform.acquire_device(name.string()) }; + + platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); + pdev->name = (char *)kzalloc(64,0); + copy_cstring((char*)pdev->name, name.string(), 64); + pdev->id = p_id++; + + unsigned res_count = 0; + pdev->resource = (resource*) kzalloc(MAX_RESOURCES*sizeof(resource), 0); + + node.for_each_sub_node("io_mem", [&] (Xml_node node) + { + if (res_count >= MAX_RESOURCES) { return; } + + unsigned id = node.attribute_value("id", res_count); + size_t sz = node.attribute_value("size", (size_t)0); + addr_t p_off = node.attribute_value("page_offset", (addr_t)0); + Io_mem & iom = *new (Lx_kit::env().heap()) + Io_mem(device.io_mem_dataspace(id), p_off, sz, resource_env().io_mem_list); + pdev->resource[res_count++] = { iom.start, iom.start+iom.size-1, + "io_mem", IORESOURCE_MEM }; + }); + + pdev->num_resources = res_count; + res_count = 0; + + node.for_each_sub_node("irq", [&] (Xml_node node) + { + if (res_count+pdev->num_resources >= MAX_RESOURCES) { return; } + + unsigned id = node.attribute_value("id", res_count); + Irq & irq = *new (Lx_kit::env().heap()) + Irq(device.irq(id), resource_env().irq_list); + pdev->resource[pdev->num_resources+res_count++] = + { irq.nr, irq.nr, "irq", IORESOURCE_IRQ }; + }); + + pdev->num_resources += res_count; + + pdev->dev.of_node = (device_node*)kzalloc(sizeof(device_node), 0); + pdev->dev.of_node->dev = &pdev->dev; + property ** prop = &pdev->dev.of_node->properties; + + node.for_each_sub_node("property", [&] (Xml_node node) { + *prop = (property*) kzalloc(sizeof(property), 0); + (*prop)->name = (char*)kzalloc(64,0); + (*prop)->value = kzalloc(64,0); + copy_cstring((char*)(*prop)->name, node.attribute_value("name", String()).string(), 64); + copy_cstring((char*)(*prop)->value, node.attribute_value("value", String()).string(), 64); + prop = &(*prop)->next; + }); + + /* + * 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); + }); + }); + + resource_env().platform.update(); +} + /**************************** ** lx_kit/backend_alloc.h ** ****************************/ -void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&, - Genode::Allocator&) +void backend_alloc_init(Env & env, Ram_allocator&, Allocator&) { - /* intentionally left blank */ + resource_env(&env); } -Genode::Ram_dataspace_capability -Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) { - return Lx_kit::env().env().ram().alloc(size, cached); } - - -void Lx::backend_free(Genode::Ram_dataspace_capability cap) { - return Lx_kit::env().env().ram().free(cap); } - - -/*********************** - ** linux/interrupt.h ** - ***********************/ - -extern "C" int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, - const char *name, void *dev) +Ram_dataspace_capability +Lx::backend_alloc(addr_t size, Cache_attribute) { - Genode::Irq_connection * irq_con = - new(Lx::Malloc::mem()) - Genode::Irq_connection(Lx_kit::env().env(), irq); - Lx::Irq::irq().request_irq(irq_con->cap(), irq, handler, dev); - - return 0; + return resource_env().platform.alloc_dma_buffer(size); } -int devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id) +void Lx::backend_free(Ram_dataspace_capability cap) { - Genode::Irq_connection * irq_con = - new(Lx::Malloc::mem()) - Genode::Irq_connection(Lx_kit::env().env(), irq); - Lx::Irq::irq().request_irq(irq_con->cap(), irq, handler, dev_id); - return 0; + return resource_env().platform.free_dma_buffer(cap); } @@ -73,17 +189,19 @@ int devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler ** asm-generic/io.h ** **********************/ -void *_ioremap(phys_addr_t phys_addr, unsigned long size, int wc) +void * _ioremap(phys_addr_t phys_addr, unsigned long size, int) { - try { - Genode::Attached_io_mem_dataspace *ds = - new(Lx::Malloc::mem()) - Genode::Attached_io_mem_dataspace(Lx_kit::env().env(), phys_addr, size, !!wc); - return ds->local_addr(); - } catch (...) { - panic("Failed to request I/O memory: [%lx,%lx)", phys_addr, phys_addr + size); - return 0; + for (Io_mem * iom = resource_env().io_mem_list.first(); iom; iom = iom->next()) { + if (iom->start <= phys_addr && iom->start+iom->size >= phys_addr+size) { + iom->ds.construct(Lx_kit::env().env().rm(), iom->cap); + addr_t off = phys_addr - iom->start; + off += iom->start & (addr_t)(PAGE_SIZE-1); + return (void*)((addr_t)iom->ds->local_addr() + off); + } } + + warning("did not found physical resource ", (void*)phys_addr); + return nullptr; } @@ -93,3 +211,23 @@ void *ioremap(phys_addr_t offset, unsigned long size) } +/*********************** + ** linux/interrupt.h ** + ***********************/ + +extern "C" int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, + const char *name, void *dev) +{ + for (Irq * i = resource_env().irq_list.first(); i; i = i->next()) { + if (i->nr != irq) { continue; } + Lx::Irq::irq().request_irq(i->cap, irq, handler, dev); + } + + return 0; +} + + +int devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id) +{ + return request_irq(irq, handler, irqflags, devname, dev_id); +} diff --git a/repos/dde_linux/src/drivers/usb_host/spec/imx6q_sabrelite/platform.cc b/repos/dde_linux/src/drivers/usb_host/spec/imx6q_sabrelite/platform.cc index 836520af64..d8a76093b5 100644 --- a/repos/dde_linux/src/drivers/usb_host/spec/imx6q_sabrelite/platform.cc +++ b/repos/dde_linux/src/drivers/usb_host/spec/imx6q_sabrelite/platform.cc @@ -30,87 +30,7 @@ void platform_hcd_init(Genode::Env &, Services *services) module_usbmisc_imx_driver_init(); module_ci_hdrc_imx_driver_init(); - /* USB PHY initialization */ - { - static resource usbphy_res[] = - { - { 0x020ca000, 0x020cafff, "usbphy", IORESOURCE_MEM }, - { 77, 77, "usbphy-irq", IORESOURCE_IRQ }, - }; - - platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); - pdev->name = (char *)"mxs_phy"; - pdev->id = 0; - pdev->num_resources = 2; - pdev->resource = usbphy_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,imx6q-usbphy"; - pdev->dev.of_node->properties->next = (property*)kzalloc(sizeof(property), 0); - pdev->dev.of_node->properties->next->name = "fsl,anatop"; - pdev->dev.of_node->properties->next->value = (void*)0xdeaddead; - - platform_device_register(pdev); - } - - device_node * usbmisc_of_node = nullptr; - - /* USB MISC initialization */ - { - static resource usbmisc_res[] = { { 0x02184800, 0x021849ff, "usbmisc", IORESOURCE_MEM }, }; - - platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); - pdev->name = (char *)"usbmisc_imx"; - pdev->id = 1; - pdev->num_resources = 1; - pdev->resource = usbmisc_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,imx6q-usbmisc"; - pdev->dev.of_node->dev = &pdev->dev; - usbmisc_of_node = pdev->dev.of_node; - - platform_device_register(pdev); - } - - /* setup EHCI-controller platform device */ - { - static resource ehci_res[] = - { - { 0x02184200, 0x021843ff, "imx_usb", IORESOURCE_MEM }, - { 72, 72, "imx_usb-irq", IORESOURCE_IRQ }, - }; - - platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); - pdev->name = (char *)"imx_usb"; - pdev->id = 2; - pdev->num_resources = 2; - pdev->resource = ehci_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,imx6q-usb"; - pdev->dev.of_node->properties->next = (property*)kzalloc(sizeof(property), 0); - pdev->dev.of_node->properties->next->name = "fsl,usbmisc"; - pdev->dev.of_node->properties->next->value = (void*)usbmisc_of_node; - pdev->dev.of_node->properties->next->next = (property*)kzalloc(sizeof(property), 0); - pdev->dev.of_node->properties->next->next->name = "dr_mode"; - pdev->dev.of_node->properties->next->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); - } + lx_platform_device_init(); } extern "C" int devm_extcon_register_notifier(struct device *dev, struct extcon_dev *edev, unsigned int id, struct notifier_block *nb) 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 index 0b184dea6e..7d3af0ef65 100644 --- 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 @@ -21,40 +21,9 @@ extern "C" void module_dwc3_driver_init(); extern "C" void module_xhci_plat_init(); -void platform_hcd_init(Genode::Env &, Services *services) +void platform_hcd_init(Genode::Env &, 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); - } + lx_platform_device_init(); } diff --git a/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc b/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc index 8382551443..82bc00ded4 100644 --- a/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc +++ b/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc @@ -11,12 +11,6 @@ * version 2. */ -/* Genode includes */ -#include -#include -#include - - /* emulation */ #include #include @@ -29,17 +23,6 @@ using namespace Genode; -/************************************************ - ** Resource info passed to the dwc_otg driver ** - ************************************************/ - -enum { - DWC_BASE = 0x20980000, - DWC_SIZE = 0x20000, - DWC_IRQ = 9, -}; - - /******************* ** Init function ** *******************/ @@ -49,33 +32,10 @@ extern bool fiq_enable, fiq_fsm_enable; void platform_hcd_init(Genode::Env &env, Services *services) { - static resource _dwc_otg_resource[] = - { - { DWC_BASE, DWC_BASE + DWC_SIZE - 1, "dwc_otg", IORESOURCE_MEM }, - { DWC_IRQ, DWC_IRQ, "dwc_otg-irq" /* name unused */, IORESOURCE_IRQ } - }; - - /* enable USB power */ - Platform::Connection platform(services->env); - platform.power_state(Platform::Session::POWER_USB_HCD, true); - /* disable fiq optimization */ fiq_enable = false; fiq_fsm_enable = false; module_dwc_otg_driver_init(); - - /* setup host-controller platform device */ - platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0); - pdev->name = (char *)"dwc_otg"; - pdev->id = 0; - pdev->num_resources = sizeof(_dwc_otg_resource)/sizeof(resource); - pdev->resource = _dwc_otg_resource; - - /* 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); + lx_platform_device_init(); } diff --git a/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk b/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk index 97653d8dda..e39ab7221d 100644 --- a/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk +++ b/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk @@ -5,7 +5,6 @@ REQUIRES = arm_v6 INC_DIR += $(REP_DIR)/src/drivers/usb_host/spec/arm INC_DIR += $(REP_DIR)/src/include/spec/arm -INC_DIR += $(call select_from_repositories,include/spec/rpi) SRC_CC += spec/arm/platform.cc SRC_CC += spec/rpi/platform.cc diff --git a/repos/dde_linux/src/drivers/usb_host/target.inc b/repos/dde_linux/src/drivers/usb_host/target.inc index 6fb00de9e0..a3f061915c 100644 --- a/repos/dde_linux/src/drivers/usb_host/target.inc +++ b/repos/dde_linux/src/drivers/usb_host/target.inc @@ -45,6 +45,7 @@ SRC_C += lib/find_bit.c CC_OPT += -U__linux__ CC_OPT += -D__KERNEL__ +CC_OPT += -DCONFIG_OF=1 CC_OPT += -DCONFIG_USB_DEVICEFS=1 CC_OPT += -DCONFIG_HOTPLUG=1 CC_OPT += -DCONFIG_USB_PHY=1