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

📄 usb_host.patch

📁 patches for linux-2.6.
💻 PATCH
📖 第 1 页 / 共 4 页
字号:
 -	pr_debug ("%s (Au1xxx) at 0x%p, irq %d",+	pr_info ("%s (Au1xxx) at 0x%p, irq %d\n", 	     hcd->driver->description, hcd->regs, hcd->irq);  	hcd->self.bus_name = "au1xxx";  	usb_register_bus (&hcd->self); +#ifdef CONFIG_USB_OTG+	if ((retval = driver->start_otg (hcd)) < 0)+		pr_info ("OTG init failed\n");+#endif+ 	if ((retval = driver->start (hcd)) < 0) 	{-		usb_hcd_au1xxx_remove(hcd, dev);-		printk("bad driver->start\n");+		usb_ohci_au1xxx_remove(hcd, dev);+		pr_info ("bad driver->start\n"); 		return retval; 	} @@ -177,10 +255,10 @@  err2: 	usb_put_hcd(hcd);  err1:-	au1xxx_stop_hc(dev);+	au1xxx_stop_ohc(dev); 	release_mem_region(dev->resource[0].start,-				dev->resource[0].end-			   - dev->resource[0].start + 1);+			   dev->resource[0].end + 1+			   - dev->resource[0].start); 	return retval; } @@ -198,19 +276,22 @@  * context, normally "rmmod", "apmd", or something similar.  *  */-void usb_hcd_au1xxx_remove (struct usb_hcd *hcd, struct platform_device *dev)+void usb_ohci_au1xxx_remove (struct usb_hcd *hcd, struct platform_device *dev) {-	pr_debug ("remove: %s, state %x", hcd->self.bus_name, hcd->state);+	pr_info ("remove: %s, state %x\n", hcd->self.bus_name, hcd->state);  	if (in_interrupt ()) 		BUG ();  	hcd->state = USB_STATE_QUIESCING; -	pr_debug ("%s: roothub graceful disconnect", hcd->self.bus_name);+	pr_debug ("%s: roothub graceful disconnect\n", hcd->self.bus_name); 	usb_disconnect (&hcd->self.root_hub);  	hcd->driver->stop (hcd);+#ifdef CONFIG_USB_OTG+	hcd->driver->stop_otg (hcd);+#endif 	hcd->state = USB_STATE_HALT;  	free_irq (hcd->irq, hcd);@@ -218,10 +299,10 @@  	usb_deregister_bus (&hcd->self); -	au1xxx_stop_hc(dev);+	au1xxx_stop_ohc(dev); 	release_mem_region(dev->resource[0].start,-			   dev->resource[0].end-			   - dev->resource[0].start + 1);+			   dev->resource[0].end + 1+			   - dev->resource[0].start); }  /*-------------------------------------------------------------------------*/@@ -232,13 +313,13 @@ 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd); 	int		ret; -	ohci_dbg (ohci, "ohci_au1xxx_start, ohci:%p", ohci);-			+	ohci_dbg (ohci, "ohci_au1xxx_start, ohci:%p\n", ohci);+ 	if ((ret = ohci_init (ohci)) < 0) 		return ret;  	if ((ret = ohci_run (ohci)) < 0) {-		err ("can't start %s", hcd->self.bus_name);+		err ("can't start %s\n", hcd->self.bus_name); 		ohci_stop (hcd); 		return ret; 	}@@ -286,6 +367,15 @@ 	 */ 	.hub_status_data =	ohci_hub_status_data, 	.hub_control =		ohci_hub_control,+#ifdef	CONFIG_USB_SUSPEND+	.hub_suspend =		ohci_hub_suspend,+	.hub_resume =		ohci_hub_resume,+#endif+	.start_port_reset =	ohci_start_port_reset,+#ifdef	CONFIG_USB_OTG+	.start_otg =		ohci_start_otg,+	.stop_otg =		ohci_stop_otg,+#endif };  /*-------------------------------------------------------------------------*/@@ -296,12 +386,12 @@ 	struct usb_hcd *hcd = NULL; 	int ret; -	pr_debug ("In ohci_hcd_au1xxx_drv_probe");+	pr_debug ("In ohci_hcd_au1xxx_drv_probe\n");  	if (usb_disabled()) 		return -ENODEV; -	ret = usb_hcd_au1xxx_probe(&ohci_au1xxx_hc_driver, &hcd, pdev);+	ret = usb_ohci_au1xxx_probe(&ohci_au1xxx_hc_driver, &hcd, pdev);  	if (ret == 0) 		dev_set_drvdata(dev, hcd);@@ -314,7 +404,7 @@ 	struct platform_device *pdev = to_platform_device(dev); 	struct usb_hcd *hcd = dev_get_drvdata(dev); -	usb_hcd_au1xxx_remove(hcd, pdev);+	usb_ohci_au1xxx_remove(hcd, pdev); 	dev_set_drvdata(dev, NULL); 	return 0; }@@ -346,7 +436,7 @@  static int __init ohci_hcd_au1xxx_init (void) {-	pr_debug (DRIVER_INFO " (Au1xxx)");+	pr_debug (DRIVER_INFO " (Au1xxx)\n"); 	pr_debug ("block sizes: ed %d td %d\n", 		sizeof (struct ed), sizeof (struct td)); diff -Nru linux26-cvs/drivers/usb/host/ohci-hcd.c linux26-amd/drivers/usb/host/ohci-hcd.c--- linux26-cvs/drivers/usb/host/ohci-hcd.c	2005-03-23 13:53:14.000000000 +0100+++ linux26-amd/drivers/usb/host/ohci-hcd.c	2005-06-15 16:14:15.810272000 +0200@@ -871,13 +871,89 @@  /*-------------------------------------------------------------------------*/ +#if defined(CONFIG_USB_OTG) && (CONFIG_USB_PORT_AMD5536OTG)++static int ohci_start_otg (struct usb_hcd *hcd)+{+	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);++	if (!hcd->self.otg_port) {+		hcd->self.otg_port = USB_OTG_PORT;+		/* FIXME disable power budget of the OHCI for the moment+		 * since this will cause bus-powered hubs to be rejected+		 */+		/* ohci->power_budget = OTG_PWR_BUDGET; */+	}+	if (usb_otg_get_transceiver) {+		ohci->transceiver = usb_otg_get_transceiver();+		if (ohci->transceiver) {+			int	status;++#ifdef CONFIG_USB_OTG_HIGHSPEED+			if (ohci->transceiver->companion) {+				ohci_err (ohci, "OTG already registered\n");+				return -EBUSY;+			}+			ohci->transceiver->companion = &hcd->self;+			hcd->self.hand_over = 0;+#else+			if (ohci->transceiver->host) {+				ohci_err (ohci, "OTG already registered\n");+				return -EBUSY;+			}+			ohci->transceiver->host = &hcd->self;+#endif+			status = ohci->transceiver->set_host(+					ohci->transceiver, &hcd->self);++			ohci_dbg(ohci, "init %s transceiver, status %d\n",+				ohci->transceiver->label, status);++			/* if (status)+				put_device(ohci->transceiver->dev); */+			return status;+		}+		else  {+			ohci_err (ohci, "can't find transceiver\n");+			return -ENODEV;+		}+	}+	else {+		ohci_info (ohci, "OTG driver not loaded\n");+		return 0;+	}+}++static void ohci_stop_otg (struct usb_hcd *hcd)+{+	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);++	if (ohci->transceiver) {+		ohci_dbg (ohci, "clean up %s transceiver\n",+			ohci->transceiver->label);+#ifdef CONFIG_USB_OTG_HIGHSPEED+		ohci->transceiver->companion = NULL;+#else+		ohci->transceiver->host = NULL;+#endif+		ohci->transceiver->set_host(ohci->transceiver, NULL);+		ohci->transceiver = NULL;+		ohci->power_budget = 0;+		hcd->self.otg_port = 0;+	}+}++#endif++/*-------------------------------------------------------------------------*/+ #define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC  MODULE_AUTHOR (DRIVER_AUTHOR); MODULE_DESCRIPTION (DRIVER_INFO); MODULE_LICENSE ("GPL"); -#ifdef CONFIG_PCI+#if defined(CONFIG_PCI) && !defined(CONFIG_SOC_AU1X00) #include "ohci-pci.c" #endif diff -Nru linux26-cvs/drivers/usb/host/ohci-hub.c linux26-amd/drivers/usb/host/ohci-hub.c--- linux26-cvs/drivers/usb/host/ohci-hub.c	2005-03-23 13:53:14.000000000 +0100+++ linux26-amd/drivers/usb/host/ohci-hub.c	2005-06-15 16:14:15.820270000 +0200@@ -434,22 +434,62 @@ { 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd); 	u32			status;+	int			usec = 500;  /* 500 usec handshake time */  	if (!port) 		return -EINVAL; 	port--;  	/* start port reset before HNP protocol times out */-	status = ohci_readl(ohci, &ohci->regs->roothub.portstatus [port]);++#ifdef	CONFIG_USB_OTG_HIGHSPEED++	if (hcd->self.hand_over && (port + 1 == hcd->self.otg_port)) {+		udelay (usec);+		usec = 0;+		status = ohci_readl (ohci, &ohci->regs->roothub.portstatus [port]);+	}+	else {+#endif+	status = ohci_readl (ohci, &ohci->regs->roothub.portstatus [port]);+	while (usec && !(status & RH_PS_CCS)) {+		status = ohci_readl (ohci, &ohci->regs->roothub.portstatus [port]);+		usec--;+		udelay(1);+	}+#ifdef	CONFIG_USB_OTG_HIGHSPEED+	}+#endif 	if (!(status & RH_PS_CCS)) 		return -ENODEV;  	/* khubd will finish the reset later */-	ohci_writel(ohci, RH_PS_PRS, &ohci->regs->roothub.portstatus [port]);+	ohci_writel (ohci, RH_PS_PRS, &ohci->regs->roothub.portstatus [port]); 	return 0; } -static void start_hnp(struct ohci_hcd *ohci);+#ifdef	CONFIG_USB_PORT_AMD5536OTG++static void start_hnp (struct ohci_hcd *ohci)+{+	const unsigned	port = ohci_to_hcd(ohci)->self.otg_port - 1;+	unsigned long	flags;+	u32		status;++	otg_start_hnp (ohci->transceiver);++	local_irq_save (flags);+	status = ohci_readl (ohci, &ohci->regs->roothub.portstatus [port]);+	if (status & RH_PS_PES)+		ohci_writel (ohci, RH_PS_PSS,+			&ohci->regs->roothub.portstatus [port]);+	local_irq_restore (flags);+}+#else++static void start_hnp (struct ohci_hcd *ohci);++#endif  #else @@ -485,10 +525,27 @@ 	u16	now = ohci_readl(ohci, &ohci->regs->fmnumber); 	u16	reset_done = now + PORT_RESET_MSEC; +#ifdef CONFIG_USB_OTG+	struct usb_hcd *hcd = ohci_to_hcd (ohci);+#endif+ 	/* build a "continuous enough" reset signal, with up to 	 * 3msec gap between pulses.  scheduler HZ==100 must work; 	 * this might need to be deadline-scheduled. 	 */++#ifdef CONFIG_USB_OTG+#ifdef CONFIG_USB_OTG_HIGHSPEED+	if (hcd->self.hand_over && (port + 1 == hcd->self.otg_port)) {+		hcd->self.hand_over = 0;+		reset_done = now + PORT_RESET_HW_MSEC - 1;+	}+	else+#else+	if (hcd->self.is_b_host)+		reset_done = now + PORT_RESET_HW_MSEC - 1;+#endif+#endif 	do { 		/* spin until any current reset finishes */ 		for (;;) {diff -Nru linux26-cvs/drivers/usb/host/ohci-pci.c linux26-amd/drivers/usb/host/ohci-pci.c--- linux26-cvs/drivers/usb/host/ohci-pci.c	2005-03-23 13:53:14.000000000 +0100+++ linux26-amd/drivers/usb/host/ohci-pci.c	2005-06-03 16:54:08.866046000 +0200@@ -215,6 +215,10 @@ 	.hub_resume =		ohci_hub_resume, #endif 	.start_port_reset =	ohci_start_port_reset,+#if defined(CONFIG_USB_OTG) && defined(CONFIG_USB_PORT_AMD5536OTG)+	.start_otg =		ohci_start_otg,+	.stop_otg =		ohci_stop_otg,+#endif };  /*-------------------------------------------------------------------------*/diff -Nru linux26-cvs/drivers/usb/Makefile linux26-amd/drivers/usb/Makefile--- linux26-cvs/drivers/usb/Makefile	2005-03-23 13:52:58.000000000 +0100+++ linux26-amd/drivers/usb/Makefile	2005-06-03 16:48:29.143913000 +0200@@ -70,3 +70,9 @@  obj-$(CONFIG_USB_ATM)		+= atm/ obj-$(CONFIG_USB_SPEEDTOUCH)	+= atm/++ifneq ($(CONFIG_USB_GADGET_AMD5536UDC),y)+ifeq ($(CONFIG_USB_PORT_AMD5536OTG),y)+obj-$(CONFIG_USB)		+= gadget/+endif+endifdiff -Nru linux26-cvs/include/asm-mips/mach-generic/cpu-feature-overrides.h linux26-amd/include/asm-mips/mach-generic/cpu-feature-overrides.h--- linux26-cvs/include/asm-mips/mach-generic/cpu-feature-overrides.h	2005-03-23 14:06:08.000000000 +0100+++ linux26-amd/include/asm-mips/mach-generic/cpu-feature-overrides.h	2005-06-03 16:48:29.343913000 +0200@@ -8,6 +8,10 @@ #ifndef __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H #define __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H +#ifndef CONFIG_CPU_HAS_LLSC+#define cpu_has_llsc		0+#endif+ /* Intensionally empty file ...  */  #endif /* __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H */diff -Nru linux26-cvs/include/asm-mips/mach-mips/cpu-feature-overrides.h linux26-amd/include/asm-mips/mach-mips/cpu-feature-overrides.h--- linux26-cvs/include/asm-mips/mach-mips/cpu-feature-overrides.h	2005-03-23 14:06:18.000000000 +0100+++ linux26-amd/include/asm-mips/mach-mips/cpu-feature-overrides.h	2005-06-03 16:48:29.353912000 +0200@@ -29,7 +29,11 @@ /* #define cpu_has_prefetch	? */ #define cpu_has_mcheck		1 /* #define cpu_has_ejtag	? */+#ifdef CONFIG_CPU_HAS_LLSC #define cpu_has_llsc		1+#else+#define cpu_has_llsc		0+#endif /* #define cpu_has_vtag_icache	? */ /* #define cpu_has_dc_aliases	? */ /* #define cpu_has_ic_fills_f_dc ? */diff -Nru linux26-cvs/include/linux/usb.h linux26-amd/include/linux/usb.h--- linux26-cvs/include/linux/usb.h	2005-03-23 14:15:32.000000000 +0100+++ linux26-amd/include/linux/usb.h	2005-06-15 16:14:15.840274000 +0200@@ -262,6 +262,7 @@ 	u8 otg_port;			/* 0, or number of OTG/HNP port */ 	unsigned is_b_host:1;		/* true during some HNP roleswitches */ 	unsigned b_hnp_enable:1;	/* OTG: did A-Host enable HNP? */+	unsigned hand_over:1;		/* HS controller detected FS device */  	int devnum_next;		/* Next open device number in round-robin allocation */ @@ -985,6 +986,12 @@ extern int usb_reset_configuration(struct usb_device *dev); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); +#if defined(CONFIG_USB_OTG) && defined(CONFIG_USB_PORT_AMD5536OTG)+extern struct otg_transceiver * (*usb_otg_get_transceiver)(void);+extern int usb_host_register_otg (struct otg_transceiver * (*get_transceiver)(void));+extern void usb_host_deregister_otg(void);+#endif+ /*  * timeouts, in seconds, used for sending/receiving control messages  * they typically complete within a few frames (msec) after they're issued

⌨️ 快捷键说明

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