📄 1006.usb.patch
字号:
+ */+ .get_frame_number = ehci_get_frame,++ /*+ * root hub support+ */+ .hub_status_data = ehci_hub_status_data,+ .hub_control = ehci_hub_control,+ .bus_suspend = ehci_bus_suspend,+ .bus_resume = ehci_bus_resume,+};++/*-------------------------------------------------------------------------*/+++int tangox_hcd_probe (struct device *dev)+{+ struct usb_hcd *hcd;+ struct ehci_hcd *ehci;+ int retval;++ tangox_usb_init();++ if (usb_disabled())+ return -ENODEV;++ hcd = usb_create_hcd (&ehci_tangox_hc_driver, dev, dev->bus_id);+ if (!hcd) {+ retval = -ENOMEM;+ goto err1;+ }++ ehci = hcd_to_ehci(hcd);+ //dev_set_drvdata(dev, ehci);++ hcd->rsrc_start = NON_CACHED(TANGOX_OHCI_BASE_ADDR);+ hcd->regs = (void *)NON_CACHED(TANGOX_EHCI_BASE_ADDR);+ hcd->irq = TANGOX_EHCI_IRQ;+ hcd->self.controller = dev;+ hcd->self.bus_name = dev->bus_id;+ hcd->product_desc ="TangoX USB 2.0";++ retval = usb_add_hcd (hcd, TANGOX_EHCI_IRQ, SA_SHIRQ);+ if (retval != 0)+ goto err2;+ return retval;+err2:+ usb_put_hcd (hcd);+err1:+ dev_err (dev, "init %s fail, %d\n", hcd_name, retval);+ return retval;+}++int tangox_hcd_remove (struct device *dev)+{+ struct usb_hcd *hcd = dev_get_drvdata(dev);+ if (!hcd)+ return -1;++ usb_remove_hcd (hcd);+ usb_put_hcd (hcd);+ return 0;+}++#ifdef CONFIG_PM+static int tangox_suspend(struct device *dev, pm_message_t state, u32 phase)+{+ printk("TangoX EHCI suspend.\n");+ return 0;+}++static int tangox_resume(struct device *dev, u32 phase)+{+ printk("TangoX EHCI resume.\n");+ return 0;+}+#endif++static struct device_driver tangox_driver = {+ .name = (char *)hcd_name,+ .bus = &platform_bus_type,+ .probe = tangox_hcd_probe,+ .remove = tangox_hcd_remove,+#ifdef CONFIG_PM + .suspend = tangox_suspend,+ .resume = tangox_resume,+#endif+};++#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC++MODULE_DESCRIPTION (DRIVER_INFO);+MODULE_AUTHOR (DRIVER_AUTHOR);+MODULE_LICENSE ("GPL");++static u64 ehci_dmamask = ~(u32)0;+static void tangox_ehci_release_dev(struct device * dev)+{+ dev->parent = NULL;+}++static struct platform_device tangox_ehci_device = {+ .name = (char *)hcd_name,+ .id = -1,+ .dev = {+ .dma_mask = &ehci_dmamask,+ .coherent_dma_mask = 0xffffffff,+ .release = tangox_ehci_release_dev,+ },+ .num_resources = 0,+ .resource = 0,++};++static struct platform_device *tangox_platform_devices[] __initdata = {+ &tangox_ehci_device,+};+++static int __init tangox_init(void)+{+#ifdef CONFIG_TANGOX_XENV_READ+ if (!tangox_usb_enabled())+ return -ENODEV;+#endif+ if (usb_disabled())+ return -ENODEV;++ platform_add_devices(tangox_platform_devices,+ ARRAY_SIZE(tangox_platform_devices));++ printk("driver %s, %s\n", hcd_name, DRIVER_VERSION);+ return driver_register(&tangox_driver);+}+module_init(tangox_init);++static void __exit tangox_cleanup(void)+{+ driver_unregister(&tangox_driver);+ platform_device_unregister(&tangox_ehci_device);++}+module_exit(tangox_cleanup);++diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/usb/host/Kconfig linux-2.6.15/drivers/usb/host/Kconfig--- linux-2.6.15.ref/drivers/usb/host/Kconfig 2006-01-25 20:51:42.000000000 -0800+++ linux-2.6.15/drivers/usb/host/Kconfig 2007-06-20 12:16:27.000000000 -0700@@ -4,6 +4,26 @@ comment "USB Host Controller Drivers" depends on USB +config TANGOX_EHCI_HCD+ tristate "SMP863x/SMP865x EHCI HCD (USB 2.0) support"+ depends on USB && TANGOX+ ---help---+ SMP863x/SMP865x chips has an USB 2.0 host controller integrated. + Enable this option if your board has this chip. If unsure, say N.++ To compile this driver as a module, choose M here: the+ module will be called tangox-ehci-hcd.++config TANGOX_OHCI_HCD+ tristate "SMP863x/SMP865x OHCI HCD support"+ depends on USB && USB_ARCH_HAS_OHCI && TANGOX && !USB_EHSET+ ---help---+ SMP863x/SMP865x chips has an USB 1.1 OHCI controller integrated. + Enable this option if your board has this chip. If unsure, say N.++ To compile this driver as a module, choose M here: the+ module will be called tangox-ohci-hcd.+ config USB_EHCI_HCD tristate "EHCI HCD (USB 2.0) support" depends on USB && PCI@@ -31,7 +51,7 @@ config USB_EHCI_SPLIT_ISO bool "Full speed ISO transactions (EXPERIMENTAL)"- depends on USB_EHCI_HCD && EXPERIMENTAL+ depends on (USB_EHCI_HCD || TANGOX_EHCI_HCD) && EXPERIMENTAL default n ---help--- This code is new and hasn't been used with many different@@ -40,7 +60,7 @@ config USB_EHCI_ROOT_HUB_TT bool "Root Hub Transaction Translators (EXPERIMENTAL)"- depends on USB_EHCI_HCD && EXPERIMENTAL+ depends on (USB_EHCI_HCD || TANGOX_EHCI_HCD) && EXPERIMENTAL ---help--- Some EHCI chips have vendor-specific extensions to integrate transaction translators, so that no OHCI or UHCI companion@@ -64,7 +84,7 @@ config USB_OHCI_HCD tristate "OHCI HCD support"- depends on USB && USB_ARCH_HAS_OHCI+ depends on USB && (USB_ARCH_HAS_OHCI || PCI) select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 ---help--- The Open Host Controller Interface (OHCI) is a standard for accessingdiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/usb/host/Makefile linux-2.6.15/drivers/usb/host/Makefile--- linux-2.6.15.ref/drivers/usb/host/Makefile 2006-01-25 20:51:42.000000000 -0800+++ linux-2.6.15/drivers/usb/host/Makefile 2007-06-20 12:15:13.000000000 -0700@@ -11,3 +11,6 @@ obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o obj-$(CONFIG_ETRAX_ARCH_V10) += hc_crisv10.o+obj-$(CONFIG_TANGOX_EHCI_HCD) += tangox-ehci-hcd.o+obj-$(CONFIG_TANGOX_OHCI_HCD) += tangox-ohci-hcd.o+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/usb/host/ohci-tangox.c linux-2.6.15/drivers/usb/host/ohci-tangox.c--- linux-2.6.15.ref/drivers/usb/host/ohci-tangox.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/drivers/usb/host/ohci-tangox.c 2007-06-20 12:15:13.000000000 -0700@@ -0,0 +1,301 @@+/*+ * OHCI HCD (Host Controller Driver) for TangoX USB 1.1.+ *+ * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>+ * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>+ * (C) Copyright 2002 Hewlett-Packard Company+ * (C) Copyright 2003-2005 MontaVista Software Inc.+ * + * Bus Glue for TANGOX OHCI driver. Sigma Designs, Inc.+ * This file is licenced under the GPL.+ */++#include <linux/platform_device.h>++/**+ * tangox_ohci_probe - initialize On-Chip HCDs+ * Context: !in_interrupt()+ *+ * Allocates basic resources for this USB host controller.+ *+ * Store this function in the HCD's struct pci_driver as probe().+ */+static int tangox_ohci_probe(const struct hc_driver *driver,+ struct platform_device *pdev)+{+ int retval;+ struct usb_hcd *hcd;+ struct ohci_hcd *ohci;++ hcd = usb_create_hcd(driver, &pdev->dev, "TANGOX OHCI");+ if (!hcd)+ return -ENOMEM;+ hcd->rsrc_start = NON_CACHED(TANGOX_OHCI_BASE_ADDR);+ hcd->regs =(void *)NON_CACHED(TANGOX_OHCI_BASE_ADDR);+ pr_debug("hcd->register=0x%x\n", (unsigned int)hcd->regs);++ ohci = hcd_to_ohci(hcd);+ ohci_hcd_init(ohci);++ retval = usb_add_hcd(hcd, TANGOX_OHCI_IRQ, SA_SHIRQ);+ if (retval == 0){+ if(polling_mode){+ init_timer(&ohci_timer);+ ohci_timer.function = ohci_polling;+ ohci_timer.data = (unsigned long)hcd;+ mod_timer(&ohci_timer, jiffies + polling_interval);+ }+ return retval;+ }++ pr_debug("Removing TANGOX USB OHCI Controller\n");+ usb_put_hcd(hcd);++ return retval;+}+++/* may be called without controller electrically present */+/* may be called with controller, bus, and devices active */++/**+ * tangox_ohci_remove - shutdown processing for On-Chip HCDs+ * @pdev: USB Host Controller being removed+ * Context: !in_interrupt()+ *+ * Reverses the effect of tangox_ohci_probe().+ * It is always called from a thread+ * context, normally "rmmod", "apmd", or something similar.+ *+ */+static void tangox_ohci_remove(struct usb_hcd *hcd,+ struct platform_device *pdev)+{+ if(polling_mode)+ del_timer_sync(&ohci_timer);+ + usb_remove_hcd(hcd);++ pr_debug("stopping TANGOX USB OHCI Controller\n");+ usb_put_hcd(hcd);+}++static int __devinit+tangox_ohci_start(struct usb_hcd *hcd)+{+ struct ohci_hcd *ohci = hcd_to_ohci(hcd);+ int ret;++ if ((ret = ohci_init(ohci)) < 0)+ return ret;+++ if ((ret = ohci_run(ohci)) < 0) {+ err("can't start %s", ohci_to_hcd(ohci)->self.bus_name);+ ohci_stop(hcd);+ return ret;+ }++ return 0;+}++/*since we cannot set read only irq member so + that copy this struct for polling mode here*/+static const struct hc_driver tangox_ohci_polling_hc_driver = {+ .description = ohci_hcd_name,+ .hcd_priv_size = sizeof(struct ohci_hcd),++ /*+ * generic hardware linkage+ */+ .irq = NULL,+ .flags = HCD_USB11 | HCD_MEMORY,++ /*+ * basic lifecycle operations+ */+ .start = tangox
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -