[PATCH] fix-usb-gadget-udc-not-provoking-curlim-action.patch

Andy Green andy at openmoko.com
Mon Dec 1 12:20:58 CET 2008


When we are informed by UDC stuff that we have been enumerated as
a gadget, we recorded the new current limit but then did nothing.

It meant that on boot, the enumeration happened but we remained
stuck at 100mA current limit.  This patch provokes a call to the
work queue to change the current limit and means that coldplugged
USB to a PC now recognizes it can pull 500mA when enumerated.

Signed-off-by: Andy Green <andy at openmoko.com>
---

 arch/arm/mach-s3c2440/mach-gta02.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index fec9cb4..4c4e1de 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -972,16 +972,17 @@ static struct s3c24xx_mci_pdata gta02_s3c_mmc_cfg = {
 
 static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
 {
-	printk(KERN_DEBUG "%s(%d)\n", __func__, cmd);
-
 	switch (cmd) {
 	case S3C2410_UDC_P_ENABLE:
+		printk(KERN_DEBUG "%s S3C2410_UDC_P_ENABLE\n", __func__);
 		neo1973_gpb_setpin(GTA02_GPIO_USB_PULLUP, 1);
 		break;
 	case S3C2410_UDC_P_DISABLE:
+		printk(KERN_DEBUG "%s S3C2410_UDC_P_DISABLE\n", __func__);
 		neo1973_gpb_setpin(GTA02_GPIO_USB_PULLUP, 0);
 		break;
 	case S3C2410_UDC_P_RESET:
+		printk(KERN_DEBUG "%s S3C2410_UDC_P_RESET\n", __func__);
 		/* FIXME! */
 		break;
 	default:
@@ -993,10 +994,15 @@ static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
 
 static void gta02_udc_vbus_draw(unsigned int ma)
 {
-        if (!gta02_pcf_pdata.pcf)
+        if (!gta02_pcf_pdata.pcf) {
+		printk(KERN_ERR "********** NULL gta02_pcf_pdata.pcf *****\n");
 		return;
+	}
 
 	gta02_usb_vbus_draw = ma;
+
+	schedule_delayed_work(&gta02_charger_work,
+				GTA02_CHARGER_CONFIGURE_TIMEOUT);
 }
 
 static struct s3c2410_udc_mach_info gta02_udc_cfg = {
@@ -1681,6 +1687,7 @@ static void __init gta02_machine_init(void)
 	}
 
 	spin_lock_init(&motion_irq_lock);
+	INIT_DELAYED_WORK(&gta02_charger_work, gta02_charger_worker);
 
 	/* Glamo chip select optimization */
 /*	 *((u32 *)(S3C2410_MEMREG(((1 + 1) << 2)))) = 0x1280; */
@@ -1729,8 +1736,6 @@ static void __init gta02_machine_init(void)
 	if (rc < 0)
 		printk(KERN_ERR "GTA02: can't request ar6k wakeup IRQ\n");
 	enable_irq_wake(GTA02_IRQ_WLAN_GPIO1);
-
-	INIT_DELAYED_WORK(&gta02_charger_work, gta02_charger_worker);
 }
 
 void DEBUG_LED(int n)




More information about the openmoko-kernel mailing list