📄 1006.usb.patch
字号:
+ status = hcd->driver->hub_control(hcd, SetPortFeature,+ USB_PORT_FEAT_TEST,+ (USB_PORT_TEST_J<<8)|port,+ NULL, 0);+ if (status)+ dev_err(&udev->dev, "SetPortFeature Failed\n");+ /* This test runs until the host is powered off */+ break;+ case EHSET_TEST_K:+ status = hcd->driver->hub_control(hcd, SetPortFeature,+ USB_PORT_FEAT_TEST,+ (USB_PORT_TEST_K<<8)|port,+ NULL, 0);+ if (status)+ dev_err(&udev->dev, "SetPortFeature Failed\n");+ /* This test runs until the host is powered off */+ break;+ case EHSET_TEST_PACKET:+ status = hcd->driver->hub_control(hcd, SetPortFeature,+ USB_PORT_FEAT_TEST,+ (USB_PORT_TEST_PACKET<<8)|port,+ NULL, 0);+ if (status)+ dev_err(&udev->dev, "SetPortFeature Failed\n");+ down(&ehset_sem);+ hcd->EHSET_in_progress = 0;+ up(&ehset_sem);+ break;+ /* Note the FORCE ENABLE test is no longer used in the EHSET spec. */+ case EHSET_TEST_FORCE_ENABLE:+ status = hcd->driver->hub_control(hcd, SetPortFeature,+ USB_PORT_FEAT_TEST,+ (USB_PORT_TEST_FORCE_ENABLE<<8)|port,+ NULL, 0);+ if (status)+ dev_err(&udev->dev, "SetPortFeature Failed\n");+ down(&ehset_sem);+ hcd->EHSET_in_progress = 0;+ up(&ehset_sem);+ break;+ case EHSET_HS_HOST_PORT_SUSPEND_RESUME:+ case EHSET_SINGLE_STEP_GET_DEV_DESC:+ case EHSET_SINGLE_STEP_SET_FEATURE:+ status = hcd->driver->hub_control(hcd, SetPortFeature,+ USB_PORT_FEAT_TEST,+ ((udev->descriptor.idProduct&0xFF)<<8)|+ port, (char *)udev, 0);+ if (status)+ dev_err(&udev->dev, "SetPortFeature Failed\n");+ down(&ehset_sem);+ hcd->EHSET_in_progress = 0;+ up(&ehset_sem);+ break;+ default:+ dev_err(&udev->dev, "EHSET: Unsupported test mode %x\n",+ udev->descriptor.idProduct);+ down(&ehset_sem);+ hcd->EHSET_in_progress = 0;+ up(&ehset_sem);+ }+}+#endif /* CONFIG_USB_EHSET */+++++ #ifdef CONFIG_USB_OTG #include "otg_whitelist.h" #endif@@ -1352,6 +1460,51 @@ /* USB device state == configured ... usable */ usb_notify_add_device(udev); +#ifdef CONFIG_USB_EHSET+ usb_unlock_device(udev);+ if (udev->speed == USB_SPEED_HIGH &&+ udev->parent == udev->bus->root_hub &&+ udev->descriptor.idVendor == /*0x067B*/0x1A0A)/*??? Replace with test device Vendor ID*/ + {+ static struct work_struct EHSET_work;+ struct usb_hcd *hcd = udev->bus->hcpriv;++ dev_info(&udev->dev, "Found EHSET Test Device (test=%x)\n",+ udev->descriptor.idProduct);++ if (!EHSET_workqueue) {+ EHSET_workqueue = create_singlethread_workqueue(+ "USB EHSET");+ if (!EHSET_workqueue) {+ dev_err(&udev->dev, "EHSET: Failed to create "+ "a workqueue\n");+ }+ }++ if (EHSET_workqueue) {+ if (down_trylock(&ehset_sem) == 0) {+ if (!hcd->EHSET_in_progress) {+ hcd->EHSET_in_progress = 1;+ up(&ehset_sem);+ INIT_WORK(&EHSET_work, EHSET_tests,+ udev);+ queue_work(EHSET_workqueue,+ &EHSET_work);+ } else {+ up(&ehset_sem);+ dev_err(&udev->dev, "EHSET: test "+ "already in progress"+ "\n");+ }+ } else {+ dev_err(&udev->dev, "EHSET: Failed to get "+ "lock\n");+ }+ }+ }+ else+#endif /* CONFIG_USB_EHSET */+ return 0; fail:@@ -2873,6 +3026,14 @@ * individual hub resources. -greg */ usb_deregister(&hub_driver);++#ifdef CONFIG_USB_EHSET+ if (EHSET_workqueue)+ destroy_workqueue(EHSET_workqueue);+#endif /* CONFIG_USB_EHSET */+++ } /* usb_hub_cleanup() */ static int config_descriptors_changed(struct usb_device *udev)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/core/hub.h linux-2.6.15/drivers/usb/core/hub.h--- linux-2.6.15.ref/drivers/usb/core/hub.h 2006-01-25 20:51:42.000000000 -0800+++ linux-2.6.15/drivers/usb/core/hub.h 2007-06-20 12:15:13.000000000 -0700@@ -55,6 +55,36 @@ #define USB_PORT_FEAT_TEST 21 #define USB_PORT_FEAT_INDICATOR 22 ++/*+ * Hub Port Test Mode Selector Codes+ * See USB 2.0 spec Table 11-24+ */++#define USB_PORT_TEST_J 0x01+#define USB_PORT_TEST_K 0x02+#define USB_PORT_TEST_SE0_NAK 0x03+#define USB_PORT_TEST_PACKET 0x04+#define USB_PORT_TEST_FORCE_ENABLE 0x05+++/*+ * Product IDs used to trigger USB Hi-Speed Host Electrical Tests+ * on the root hub. See USB 2.0 spec 7.1.20 and the+ * Embedded High-speed Host Electrical Test Procedure.+ */+#define EHSET_TEST_SE0_NAK 0x0101+#define EHSET_TEST_J 0x0102+#define EHSET_TEST_K 0x0103+#define EHSET_TEST_PACKET 0x0104+/* Note that the FORCE ENABLE test is no longer used in the EHSET+pec. */+#define EHSET_TEST_FORCE_ENABLE 0x0105+#define EHSET_HS_HOST_PORT_SUSPEND_RESUME 0x0106+#define EHSET_SINGLE_STEP_GET_DEV_DESC 0x0107+#define EHSET_SINGLE_STEP_SET_FEATURE 0x0108++ /* * Hub Status and Hub Change results * See USB 2.0 spec Table 11-19 and Table 11-20diff -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/core/Kconfig linux-2.6.15/drivers/usb/core/Kconfig--- linux-2.6.15.ref/drivers/usb/core/Kconfig 2006-01-25 20:51:42.000000000 -0800+++ linux-2.6.15/drivers/usb/core/Kconfig 2007-06-20 12:15:13.000000000 -0700@@ -99,4 +99,23 @@ normal Linux-USB hosts do (other than the warning), and is convenient for many stages of product development. +config USB_EHSET+ bool "SMP863x/SMP865x Embedded High-speed Host Electrical Test Support (EXPERIMENTAL)"+ depends on USB+ default n+ help+ This option is only used if you are developing firmware for+ an embedded device with a Hi-speed USB Host or OTG port.++ If you say Y here, software support for the Embedded+ High-speed Host Electrical Tests will be added to the USB+ Host stack. This is one of the tests performed during+ High-speed USB Host certification testing.++ Please note that the USB Host Controller Driver must also+ support this option. For an example of how to add support+ for this to a USB Host Controller Driver see the EHCI driver.++ If you are at all unsure then say N here.+ 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/core/Makefile linux-2.6.15/drivers/usb/core/Makefile--- linux-2.6.15.ref/drivers/usb/core/Makefile 2006-01-25 20:51:42.000000000 -0800+++ linux-2.6.15/drivers/usb/core/Makefile 2007-06-20 12:15:13.000000000 -0700@@ -3,7 +3,7 @@ # usbcore-objs := usb.o hub.o hcd.o urb.o message.o \- config.o file.o buffer.o sysfs.o devio.o notify.o+ config.o file.o buffer.o sysfs.o devio.o notify.o ifeq ($(CONFIG_PCI),y) usbcore-objs += hcd-pci.o@@ -13,6 +13,10 @@ usbcore-objs += inode.o devices.o endif +ifeq ($(CONFIG_TANGO2),y)+ usbcore-objs += tangox-usb.o+endif+ obj-$(CONFIG_USB) += usbcore.o ifeq ($(CONFIG_USB_DEBUG),y)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/core/tangox-usb.c linux-2.6.15/drivers/usb/core/tangox-usb.c--- linux-2.6.15.ref/drivers/usb/core/tangox-usb.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/drivers/usb/core/tangox-usb.c 2007-06-20 12:15:13.000000000 -0700@@ -0,0 +1,91 @@+#include <linux/config.h>+#include <linux/types.h>+#include <linux/kernel.h>+#include <linux/string.h>+#include <linux/init.h>+#include <linux/spinlock.h>+#include <linux/usb.h>++#include "tangox-usb.h"++#undef DEBUG++#ifdef DEBUG+#define DBG(x...) printk(x)+#else+#define DBG(x...)+#endif++void tangox_usb_init(void)+{+ int i;+ unsigned long temp;+#ifdef CONFIG_TANGOX_XENV_READ+ if (!tangox_usb_enabled())+ return;+#endif+ /*check see if it's inited*/+ temp = gbus_read_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + 0x0);+ if(temp && (1<<19)){+ printk("TangoX USB was initialized.\n");+ return;+ }+ else+ printk("TangoX USB initializing...\n");++ /*+ 1. Program the clean divider and clock multiplexer to provide + a 48 MHz reference to the USB block.+ This is done in bootloader.+ */+++#if 0 /* If you want to use external crystal at 24MHZ*/+ printk("TangoX USB using 24MHz external crystal.\n");+ gbus_write_uint32(pGBus , REG_BASE_system_block + SYS_hostclk_mux, 0x300);+ gbus_write_uint32(pGBus , TANGOX_USB_CTL_STATUS_REG_BASE + 0x0, 0x70);+ wait_ms(5);+ gbus_write_uint32(pGBus , TANGOX_USB_CTL_STATUS_REG_BASE + 0xc, 0xf9931);+ wait_ms(30);+#endif++ /*2. PHY software reset*/+ DBG("Performing PHY Reseting...\n");+ temp = gbus_read_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + 0x0);+ gbus_write_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + 0x0, temp | 0x01);+ udelay (30);+ gbus_write_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + 0x0, temp);+ wait_ms(5);++ /*3. Reset Bit 1 of USB register 0x21700 to enable the USB Host controller.+ This is done in bootloader + */++ /*4. OHCI Software reset*/+ DBG("Performing USB OHCI Reseting...\n");+ temp = gbus_read_uint32(pGBus, TANGOX_OHCI_BASE_ADDR + 0x08);+ gbus_write_uint32(pGBus, TANGOX_OHCI_BASE_ADDR + 0x08, temp | 0x01);+ wait_ms(5);++ /*5. OHCI DPLL Software reset, it says the bit is for simulation*/+ DBG("Performing USB OHCI DPLL Reseting...\n");+ temp = gbus_read_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + 0x0);+ gbus_write_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + 0x0, temp | (1<<19));+ wait_ms(5);+ + /*6. EHCI Host Software Reset*/+ DBG("Performing USB EHCI Reseting...\n");+ temp = gbus_read_uint32(pGBus, TANGOX_EHCI_BASE_ADDR + 0x10);+ gbus_write_uint32(pGBus, TANGOX_EHCI_BASE_ADDR + 0x10, temp | 0x02);+ wait_ms(5);++ for(i = 0; i < 4; i++){+ temp = gbus_read_uint32(pGBus, TANGOX_USB_CTL_STATUS_REG_BASE + i*4);+ DBG("TangoX USB register %d = 0x%x\n", i, temp);+ }++ return;+}++EXPORT_SYMBOL(tangox_usb_init);+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/core/tangox-usb.h linux-2.6.15/drivers/usb/core/tangox-usb.h--- linux-2.6.15.ref/drivers/usb/core/tangox-usb.h 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/drivers/usb/core/tangox-usb.h 2007-06-20 12:15:13.000000000 -0700@@ -0,0 +1,69 @@+#ifndef __TANGOX_USB_H+#define __TANGOX_USB_H+ +#include <asm/addrspace.h>++#ifdef CONFIG_TANGO2+#include <asm/tango2/hardware.h>+#include <asm/tango2/tango2_gbus.h>+#elif defined(CONFIG_TANGO3)+#include <asm/tangox/hardware.h>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -