⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 host_compliance.patch

📁 ISP 1761 usb host driver for linux
💻 PATCH
字号:
diff -Naur linux-2.6.20_old/drivers/usb/core/hub.c linux-2.6.20_new/drivers/usb/core/hub.c--- linux-2.6.20_old/drivers/usb/core/hub.c	2007-02-05 02:44:54.000000000 +0800+++ linux-2.6.20_new/drivers/usb/core/hub.c	2007-06-22 11:36:59.000000000 +0800@@ -32,6 +32,17 @@ #include "hcd.h" #include "hub.h" +#ifdef EMBD_HOST_COMPLIANCE+int     VID;+int     PID;+int     portno;+int     Return;+int     No_Data_Phase ;+int     No_Status_Phase ;+EXPORT_SYMBOL(No_Data_Phase);+EXPORT_SYMBOL(No_Status_Phase);+#endif+ struct usb_hub { 	struct device		*intfdev;	/* the "interface" device */ 	struct usb_device	*hdev;@@ -2351,7 +2362,10 @@ 	}  	retval = 0;-+#ifdef EMBD_HOST_COMPLIANCE+        VID = udev->descriptor.idVendor;+        PID = udev->descriptor.idProduct;+#endif fail: 	if (retval) 		hub_port_disable(hub, port1, 0);@@ -2597,7 +2611,29 @@ 		status = hub_power_remaining(hub); 		if (status) 			dev_dbg(hub_dev, "%dmA power budget left\n", status);-+#ifdef EMBD_HOST_COMPLIANCE+                                                                                                                            +                if(VID==0x1A0A && PID==0x0107) /*SINGLE_STEP_GET_DEV_DESC*/+                {+                        printk("Testing SINGLE_STEP_GET_DEV_DESC\n");+                        /*Test Single Step Get Device Descriptor ,+                         * take care it should not get status phase */+                        No_Data_Phase = 1;+                        No_Status_Phase = 1;+                                                                                                                                         +                        Return = usb_get_device_descriptor(udev, 8);+                        No_Data_Phase = 0;+                        No_Status_Phase = 0;+                }+                if(VID==0x1A0A && PID==0x0108) /*SINGLE_STEP_SET_FEATURE*/+                {+                        printk("Testing SINGLE_STEP_SET_FEATURE \n");+                        /*Test Single Step Set Feature */+                        No_Status_Phase = 1;+                        Return = usb_get_device_descriptor(udev, 8);+                        No_Status_Phase = 0;+                }+#endif 		return;  loop_disable:@@ -2790,9 +2826,18 @@ 					USB_PORT_FEAT_C_RESET); 			} +#ifdef EMBD_HOST_COMPLIANCE 			if (connect_change)+			{ 				hub_port_connect_change(hub, i, 						portstatus, portchange);+				portno = i;+			}+#else+			if (connect_change)+				hub_port_connect_change(hub, i,+						portstatus, portchange);+#endif 		} /* end for i */  		/* deal with hub status changes */@@ -2825,6 +2870,68 @@ 		if (!hdev->parent && !hub->busy_bits[0]) 			usb_enable_root_hub_irq(hdev->bus); +#ifdef EMBD_HOST_COMPLIANCE+                /* printk("The VID:0x%x\n",VID);+                   printk("The PID:0x%x\n",PID);+                   printk("The Portno :%d\n",portno);+                */+                if(VID==0x1A0A && PID==0x0101) /* TEST_SE0_NAK */+                {+                        printk("Testing for TEST_SE0_NAK\n");+                        ret =  clear_port_feature(hdev, portno, USB_PORT_FEAT_C_CONNECTION);+                        ret = set_port_feature(hdev, portno, USB_PORT_FEAT_SUSPEND);+                        ret = set_port_feature(hdev, portno | 0x300, USB_PORT_FEAT_TEST);+                        ret = get_port_status(hdev,portno,&Return);+                        printk("The port status : %x\n",Return);+                }+                if(VID==0x1A0A && PID==0x0102)  /*TEST_J*/+                {+                        printk("Testing TEST_J\n");+                        ret =  clear_port_feature(hdev, portno, USB_PORT_FEAT_C_CONNECTION);+                        ret = set_port_feature(hdev, portno, USB_PORT_FEAT_SUSPEND);+                        ret = set_port_feature(hdev, portno | 0x100, USB_PORT_FEAT_TEST);+                        ret = get_port_status(hdev,portno,&Return);+                        printk("The port status : %x\n",Return);+                }+                if(VID==0x1A0A && PID==0x0103) /*TEST_K*/+                {+                        printk("Testing TEST_K\n");+                        ret =  clear_port_feature(hdev, portno, USB_PORT_FEAT_C_CONNECTION);+                        ret = set_port_feature(hdev, portno, USB_PORT_FEAT_SUSPEND);+                        ret = set_port_feature(hdev, portno | 0x200, USB_PORT_FEAT_TEST);+                        ret = get_port_status(hdev,portno,&Return);+                        printk("The port status : %x\n",Return);+                }++                if(VID==0x1A0A && PID==0x0104) /*TEST_PACKET*/+                {+                        printk("Testing TEST_PACKET\n");+                        ret =  clear_port_feature(hdev, portno, USB_PORT_FEAT_C_CONNECTION);+                        ret = set_port_feature(hdev, portno, USB_PORT_FEAT_SUSPEND);+                        ret = set_port_feature(hdev, portno | 0x400, USB_PORT_FEAT_TEST);+                        ret = get_port_status(hdev,portno,&Return);+                        printk("The port status : %x\n",Return);+                }+                                                                                                                            +                if(VID==0x1A0A && PID==0x0105) /* TEST_FORCE_ENABLE*/+                {+                        printk("Testing TEST_FORCE_ENABLE\n");+                        ret =  clear_port_feature(hdev, portno, USB_PORT_FEAT_C_CONNECTION);+                        ret = set_port_feature(hdev, portno, USB_PORT_FEAT_SUSPEND);+                        ret = set_port_feature(hdev, portno | 0x500, USB_PORT_FEAT_TEST);+                        ret = get_port_status(hdev,portno,&Return);+                        printk("The port status : %x\n",Return);+                }+                if(VID==0x1A0A && PID==0x0106) /*HS_HOST_PORT_SUSPEND_RESUME*/+                {+                        printk("Testing HS_HOST_PORT_SUSPEND_RESUME\n");+                        ret =  clear_port_feature(hdev, portno, USB_PORT_FEAT_C_CONNECTION);+                        ret = set_port_feature(hdev, portno, USB_PORT_FEAT_SUSPEND);+                        mdelay(10);+                        ret =  clear_port_feature(hdev, portno,USB_PORT_FEAT_SUSPEND);+                }+#endif+                 loop_autopm: 		/* Allow autosuspend if we're not going to run again */ 		if (list_empty(&hub->event_list))diff -Naur linux-2.6.20_old/drivers/usb/pehcd/host/pehci.c linux-2.6.20_new/drivers/usb/pehcd/host/pehci.c--- linux-2.6.20_old/drivers/usb/pehcd/host/pehci.c	2007-06-22 11:45:43.000000000 +0800+++ linux-2.6.20_new/drivers/usb/pehcd/host/pehci.c	2007-06-22 11:34:31.000000000 +0800@@ -2718,8 +2718,29 @@ 
         case PIPE_CONTROL:
             /*calculate the number of tds, follow 1 pattern*/
+#ifdef EMBD_HOST_COMPLIANCE            
+            if(No_Data_Phase && No_Status_Phase)
+            {
+                printk("Only SetUP Phase\n");
+                num_tds  = (urb->transfer_buffer_length == 0) ? 1 :
+                    ((urb->transfer_buffer_length -1)/HC_ATL_PL_SIZE + 1);
+            }
+            else if (!No_Data_Phase && No_Status_Phase)
+            {
+                printk("SetUP Phase and Data Phase\n");
+                num_tds  = (urb->transfer_buffer_length == 0) ? 2 :
+                    ((urb->transfer_buffer_length -1)/HC_ATL_PL_SIZE + 3);
+            }
+            else if (!No_Data_Phase && !No_Status_Phase)
+            {
+                num_tds  = (urb->transfer_buffer_length == 0) ? 2 :
+                    ((urb->transfer_buffer_length -1)/HC_ATL_PL_SIZE + 3);
+            }
+                        
+#else            
             num_tds  = (urb->transfer_buffer_length == 0) ? 2 :
                 ((urb->transfer_buffer_length -1)/HC_ATL_PL_SIZE + 3);
+#endif
             break;
         case PIPE_BULK:
             num_tds = (urb->transfer_buffer_length -1)/HC_ATL_PL_SIZE + 1;
diff -Naur linux-2.6.20_old/include/linux/usb.h linux-2.6.20_new/include/linux/usb.h--- linux-2.6.20_old/include/linux/usb.h	2007-02-05 02:44:54.000000000 +0800+++ linux-2.6.20_new/include/linux/usb.h	2007-06-22 11:34:31.000000000 +0800@@ -308,6 +308,11 @@ #endif }; +/*For Embedded Host Compliance */+#define EMBD_HOST_COMPLIANCE    1+extern int      No_Data_Phase ;+extern int      No_Status_Phase ;+ /* ----------------------------------------------------------------------- */  /* This is arbitrary.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -