📄 1006.usb.patch
字号:
+ set_current_state(TASK_UNINTERRUPTIBLE);+ schedule_timeout(msecs_to_jiffies(15000));+ ehci_info (ehci, "Suspend Root Hub\n");+ ehci_bus_suspend (hcd);+ set_current_state(TASK_UNINTERRUPTIBLE);+ schedule_timeout(msecs_to_jiffies(15000));+ ehci_info (ehci, "Resume Root Hub\n");+ ehci_bus_resume (hcd);+ spin_lock_irqsave (&ehci->lock, flags);+ break;+ }+ case (EHSET_SINGLE_STEP_GET_DEV_DESC&0xFF):+ {+ struct list_head qtd_list;+ struct list_head test_list;+ struct usb_device *dev;+ struct ehci_qtd *qtd;+ struct urb urb;+ struct usb_ctrlrequest setup_packet;+ char data_buffer[USB_DT_DEVICE_SIZE];++ spin_unlock_irqrestore (&ehci->lock, flags);+ ehci_info (ehci, "Testing SINGLE_STEP_GET_DEV"+ "_DESC\n");+ if (!buf) {+ ehci_err (ehci, "No usb_device pointer"+ " found\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }+ set_current_state(TASK_UNINTERRUPTIBLE);+ schedule_timeout(msecs_to_jiffies(15000));++ dev = (struct usb_device *)buf;+ setup_packet.bRequestType = USB_DIR_IN;+ setup_packet.bRequest = USB_REQ_GET_DESCRIPTOR;+ setup_packet.wValue = (USB_DT_DEVICE << 8);+ setup_packet.wIndex = 0;+ setup_packet.wLength = USB_DT_DEVICE_SIZE;++ INIT_LIST_HEAD (&qtd_list);+ INIT_LIST_HEAD (&test_list);+ urb.transfer_buffer_length =+ USB_DT_DEVICE_SIZE;+ urb.dev = dev;+ urb.pipe = usb_rcvctrlpipe(dev, 0);+ urb.hcpriv = dev->ep0.hcpriv;+ urb.setup_packet = (char *)&setup_packet;+ urb.transfer_buffer = data_buffer;+ urb.transfer_flags = URB_HCD_DRIVER_TEST;+ spin_lock_init(&urb.lock);+ urb.setup_dma = dma_map_single (+ hcd->self.controller,+ urb.setup_packet,+ sizeof (struct usb_ctrlrequest),+ DMA_TO_DEVICE);+ urb.transfer_dma = dma_map_single (+ hcd->self.controller,+ urb.transfer_buffer,+ sizeof (struct usb_ctrlrequest),+ DMA_TO_DEVICE);+ if (!urb.setup_dma || !urb.transfer_dma) {+ ehci_err (ehci, "dma_map_single Failed"+ "\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }++ if (!qh_urb_transaction (ehci, &urb, &qtd_list,+ GFP_ATOMIC))+ {+ ehci_err (ehci, "qh_urb_transaction "+ "Failed\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }++ qtd = container_of (qtd_list.next,+ struct ehci_qtd, qtd_list);+ list_del_init (&qtd->qtd_list);+ list_add (&qtd->qtd_list, &test_list);+ qtd = container_of (qtd_list.next,+ struct ehci_qtd, qtd_list);+ list_del_init (&qtd->qtd_list);+ list_add_tail (&qtd->qtd_list, &test_list);+ qtd = container_of (qtd_list.next,+ struct ehci_qtd, qtd_list);+ list_del_init (&qtd->qtd_list);+ ehci_qtd_free (ehci, qtd);++ ehci_info (ehci, "Sending SETUP&DATA PHASE\n");+ if (submit_async (ehci, &dev->ep0, &urb,+ &test_list, GFP_ATOMIC))+ {+ ehci_err (ehci, "Failed to queue up "+ "qtds\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }+ spin_lock_irqsave (&ehci->lock, flags);+ break;+ }+ case (EHSET_SINGLE_STEP_SET_FEATURE&0xFF):+ {+ struct list_head qtd_list;+ struct list_head setup_list;+ struct list_head data_list;+ struct usb_device *dev;+ struct ehci_qtd *qtd;+ struct urb urb;+ struct usb_ctrlrequest setup_packet;+ char data_buffer[USB_DT_DEVICE_SIZE];++ spin_unlock_irqrestore (&ehci->lock, flags);+ ehci_info (ehci, "Testing SINGLE_STEP_SET_"+ "FEATURE\n");+ if (!buf) {+ ehci_err (ehci, "No usb_device pointer"+ " found\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }+ dev = (struct usb_device *)buf;+ setup_packet.bRequestType = USB_DIR_IN;+ setup_packet.bRequest = USB_REQ_GET_DESCRIPTOR;+ setup_packet.wValue = (USB_DT_DEVICE << 8);+ setup_packet.wIndex = 0;+ setup_packet.wLength = USB_DT_DEVICE_SIZE;++ INIT_LIST_HEAD (&qtd_list);+ INIT_LIST_HEAD (&setup_list);+ INIT_LIST_HEAD (&data_list);+ urb.transfer_buffer_length =+ USB_DT_DEVICE_SIZE;+ urb.dev = dev;+ urb.pipe = usb_rcvctrlpipe(dev, 0);+ urb.hcpriv = dev->ep0.hcpriv;+ urb.setup_packet = (char *)&setup_packet;+ urb.transfer_buffer = data_buffer;+ urb.transfer_flags = URB_HCD_DRIVER_TEST;+ spin_lock_init(&urb.lock);+ urb.setup_dma = dma_map_single (+ hcd->self.controller,+ urb.setup_packet,+ sizeof (struct usb_ctrlrequest),+ DMA_TO_DEVICE);+ urb.transfer_dma = dma_map_single (+ hcd->self.controller,+ urb.transfer_buffer,+ sizeof (struct usb_ctrlrequest),+ DMA_TO_DEVICE);+ if (!urb.setup_dma || !urb.transfer_dma) {+ ehci_err (ehci, "dma_map_single Failed"+ "\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }++ if (!qh_urb_transaction (ehci, &urb, &qtd_list,+ GFP_ATOMIC))+ {+ ehci_err (ehci, "qh_urb_transaction "+ "Failed\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }++ qtd = container_of (qtd_list.next,+ struct ehci_qtd, qtd_list);+ list_del_init (&qtd->qtd_list);+ list_add (&qtd->qtd_list, &setup_list);+ qtd = container_of (qtd_list.next,+ struct ehci_qtd, qtd_list);+ list_del_init (&qtd->qtd_list);+ list_add (&qtd->qtd_list, &data_list);+ qtd = container_of (qtd_list.next,+ struct ehci_qtd, qtd_list);+ list_del_init (&qtd->qtd_list);+ ehci_qtd_free (ehci, qtd);++ ehci_info (ehci, "Sending SETUP PHASE\n");+ if (submit_async (ehci, &dev->ep0, &urb,+ &setup_list, GFP_ATOMIC))+ {+ ehci_err (ehci, "Failed to queue up "+ "qtds\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }++ set_current_state(TASK_UNINTERRUPTIBLE);+ schedule_timeout(msecs_to_jiffies(15000));+ urb.status = 0;+ urb.actual_length = 0;++ ehci_info (ehci, "Sending DATA PHASE\n");+ if (submit_async (ehci, &dev->ep0, &urb,+ &data_list, GFP_ATOMIC))+ {+ ehci_err (ehci, "Failed to queue up "+ "qtds\n");+ spin_lock_irqsave (&ehci->lock, flags);+ goto error;+ }+ spin_lock_irqsave (&ehci->lock, flags);+ break;+ }+ default:+ ehci_err (ehci, "EHSET: Unknown test %x\n",+ (wIndex>>8)&0xFF);+ goto error;+ }+ break;+#endif /* CONFIG_USB_EHSET */+ default:+ ehci_err (ehci, "SetPortFeature: Unknown Feature %x\n",+ wValue); goto error; } readl (&ehci->regs->command); /* unblock posted writes */ break; default:+ ehci_err (ehci, "Unknown Device Request %x\n", typeReq); error: /* "stall" on error */ retval = -EPIPE;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/ehci-tangox.c linux-2.6.15/drivers/usb/host/ehci-tangox.c--- linux-2.6.15.ref/drivers/usb/host/ehci-tangox.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/drivers/usb/host/ehci-tangox.c 2007-06-20 12:15:13.000000000 -0700@@ -0,0 +1,249 @@+/*+ * EHCI HCD (Host Controller Driver) PCI Bus Glue.+ *+ * Copyright (c) 2000-2004 by David Brownell+ *+ * This program is free software; you can redistribute it and/or modify it+ * under the terms of the GNU General Public License as published by the+ * Free Software Foundation; either version 2 of the License, or (at your+ * option) any later version.+ *+ * This program is distributed in the hope that it will be useful, but+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License+ * for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software Foundation,+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.+ */++#include <linux/platform_device.h>+#ifndef CONFIG_TANGOX+#error "This file is TANGOX EHCI bus glue. CONFIG_TANGOX must be defined."+#endif++#ifdef CONFIG_PM+static int tangox_suspend(struct device *dev, pm_message_t state, u32 phase);+static int tangox_resume(struct device *dev, u32 phase);+#endif++/* called during probe() after chip reset completes */+static int ehci_tangox_setup(struct usb_hcd *hcd)+{+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);+ u32 temp;+ int retval;++ ehci->caps = hcd->regs;+ ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase));+ dbg_hcs_params(ehci, "reset");+ dbg_hcc_params(ehci, "reset");++ /* cache this readonly data; minimize chip reads */+ ehci->hcs_params = readl(&ehci->caps->hcs_params);++ retval = ehci_halt(ehci);+ if (retval)+ return retval;++ /* data structure init */+ retval = ehci_init(hcd);+ if (retval)+ return retval;++ if (ehci_is_TDI(ehci))+ ehci_reset(ehci);++ /* at least the Genesys GL880S needs fixup here */+ temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);+ temp &= 0x0f;+ if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {+ ehci_dbg(ehci, "bogus port configuration: "+ "cc=%d x pcc=%d < ports=%d\n",+ HCS_N_CC(ehci->hcs_params),+ HCS_N_PCC(ehci->hcs_params),+ HCS_N_PORTS(ehci->hcs_params));+ }++ return retval;+}++++static const struct hc_driver ehci_tangox_hc_driver = {+ .description = hcd_name,+ .product_desc = "SMP863x/SMP865x EHCI Host Controller",+ .hcd_priv_size = sizeof(struct ehci_hcd),++ /*+ * generic hardware linkage+ */+ .irq = ehci_irq,+ .flags = HCD_MEMORY | HCD_USB2,++ /*+ * basic lifecycle operations+ */+ .reset = ehci_tangox_setup,+ .start = ehci_run,+#ifdef CONFIG_PM+ .suspend = tangox_suspend,+ .resume = tangox_resume,+#endif+ .stop = ehci_stop,++ /*+ * managing i/o requests and associated device resources+ */+ .urb_enqueue = ehci_urb_enqueue,+ .urb_dequeue = ehci_urb_dequeue,+ .endpoint_disable = ehci_endpoint_disable,++ /*+ * scheduling support
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -