r3909 - branches/src/target/kernel/2.6.24.x/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Mon Jan 21 23:16:39 CET 2008


Author: werner
Date: 2008-01-21 23:16:35 +0100 (Mon, 21 Jan 2008)
New Revision: 3909

Added:
   branches/src/target/kernel/2.6.24.x/patches/s3c2410-usb-switch.patch
Modified:
   branches/src/target/kernel/2.6.24.x/patches/series
Log:
"Lost OE" patch s3c2410-usb-switch.patch (by Harald Welte ?)

This patch is dicussed here:
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=876

Note: I've added the GPE5 -> GPB9 change (untested) and I've removed the
apparently unused file arch/arm/mach-s3c2410/usb-modeswitch.c

s3c2410-usb-switch.patch:
- arch/arm/mach-s3c2410/usb-modeswitch.c (s3c2410_usb_enable_host): implement
  host/device switch
- drivers/usb/host/ohci-s3c2410.c (show_usb_mode, set_usb_mode): implement
  host/device switch
- drivers/usb/host/ohci-s3c2410.c (usb_hcd_s3c2410_remove, 
  usb_hcd_s3c2410_probe): add/remove "usb_mode" sysfs file



Added: branches/src/target/kernel/2.6.24.x/patches/s3c2410-usb-switch.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/s3c2410-usb-switch.patch	2008-01-21 21:49:04 UTC (rev 3908)
+++ branches/src/target/kernel/2.6.24.x/patches/s3c2410-usb-switch.patch	2008-01-21 22:16:35 UTC (rev 3909)
@@ -0,0 +1,77 @@
+Index: linux-2.6.24-rc7/drivers/usb/host/ohci-s3c2410.c
+===================================================================
+--- linux-2.6.24-rc7.orig/drivers/usb/host/ohci-s3c2410.c
++++ linux-2.6.24-rc7/drivers/usb/host/ohci-s3c2410.c
+@@ -24,6 +24,7 @@
+ 
+ #include <asm/hardware.h>
+ #include <asm/arch/usb-control.h>
++#include <asm/arch/regs-gpio.h>
+ 
+ #define valid_port(idx) ((idx) == 1 || (idx) == 2)
+ 
+@@ -308,6 +309,40 @@
+ 	local_irq_restore(flags);
+ }
+ 
++/* switching of USB pads */
++static ssize_t show_usb_mode(struct device *dev, struct device_attribute *attr,
++			     char *buf)
++{
++	if (__raw_readl(S3C24XX_MISCCR) & S3C2410_MISCCR_USBHOST)
++		return sprintf(buf, "host\n");
++
++	return sprintf(buf, "device\n");
++}
++
++static ssize_t set_usb_mode(struct device *dev, struct device_attribute *attr,
++			    const char *buf, size_t count)
++{
++	if (!strncmp(buf, "host", 4)) {
++		printk("s3c2410: changing usb to host\n");
++		s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST,
++				      S3C2410_MISCCR_USBHOST);
++		/* FIXME:
++		 * - call machine-specific disable-pullup function i
++		 * - enable +Vbus (if hardware supports it)
++		 */
++		s3c2410_gpio_setpin(S3C2410_GPB9, 0);
++	} else if (!strncmp(buf, "device", 6)) {
++		printk("s3c2410: changing usb to device\n");
++		s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST, 0);
++		s3c2410_gpio_setpin(S3C2410_GPB9, 1);
++	} else
++		printk("s3c2410: unknown mode\n");
++		return -EINVAL;
++	return count;
++}
++
++static DEVICE_ATTR(usb_mode, S_IRUGO | S_IWUSR, show_usb_mode, set_usb_mode);
++
+ /* may be called without controller electrically present */
+ /* may be called with controller, bus, and devices active */
+ 
+@@ -325,6 +360,7 @@
+ static void
+ usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
+ {
++	device_remove_file(&dev->dev, &dev_attr_usb_mode);
+ 	usb_remove_hcd(hcd);
+ 	s3c2410_stop_hc(dev);
+ 	iounmap(hcd->regs);
+@@ -392,8 +428,15 @@
+ 	if (retval != 0)
+ 		goto err_ioremap;
+ 
++	retval = device_create_file(&dev->dev, &dev_attr_usb_mode);
++	if (retval != 0)
++		goto err_hcd;
++
+ 	return 0;
+ 
++ err_hcd:
++	usb_remove_hcd(hcd);
++
+  err_ioremap:
+ 	s3c2410_stop_hc(dev);
+ 	iounmap(hcd->regs);

Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series	2008-01-21 21:49:04 UTC (rev 3908)
+++ branches/src/target/kernel/2.6.24.x/patches/series	2008-01-21 22:16:35 UTC (rev 3909)
@@ -74,6 +74,7 @@
 fix-EVIOCGRAB-semantics.patch
 iis-suspend.patch
 s3c24xx-pcm-suspend.patch
+s3c2410-usb-switch.patch
 
 # Atheros WLAN driver
 pnp_fixes.patch





More information about the commitlog mailing list