Title: [9019] trunk/drivers/usb/musb: [#6001] Add usb suspend/resume support on blackfin.
Revision
9019
Author
lliubbo
Date
2010-07-28 05:14:59 -0400 (Wed, 28 Jul 2010)

Log Message

[#6001] Add usb suspend/resume support on blackfin.
By implement musb_platform_restore_context() to reinit 
blackfin-platform related registers, the suspend/resume
can work now.

Because the registers' value are global,I didn't save it
during suspend to save time.

Modified Paths

Diff

Modified: trunk/drivers/usb/musb/blackfin.c (9018 => 9019)


--- trunk/drivers/usb/musb/blackfin.c	2010-07-28 08:17:42 UTC (rev 9018)
+++ trunk/drivers/usb/musb/blackfin.c	2010-07-28 09:14:59 UTC (rev 9019)
@@ -323,28 +323,8 @@
 	return -EIO;
 }
 
-int __init musb_platform_init(struct musb *musb)
+static void musb_platform_reg_init(struct musb *musb)
 {
-
-	/*
-	 * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
-	 * and OTG HOST modes, while rev 1.1 and greater require PE7 to
-	 * be low for DEVICE mode and high for HOST mode. We set it high
-	 * here because we are in host mode
-	 */
-
-	if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
-		printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d \n",
-			musb->config->gpio_vrsel);
-		return -ENODEV;
-	}
-	gpio_direction_output(musb->config->gpio_vrsel, 0);
-
-	usb_nop_xceiv_register();
-	musb->xceiv = otg_get_transceiver();
-	if (!musb->xceiv)
-		return -ENODEV;
-
 	if (ANOMALY_05000346) {
 		bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
 		SSYNC();
@@ -378,7 +358,32 @@
 				EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
 				EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
 	SSYNC();
+}
 
+int __init musb_platform_init(struct musb *musb)
+{
+
+	/*
+	 * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
+	 * and OTG HOST modes, while rev 1.1 and greater require PE7 to
+	 * be low for DEVICE mode and high for HOST mode. We set it high
+	 * here because we are in host mode
+	 */
+
+	if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
+		printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d \n",
+			musb->config->gpio_vrsel);
+		return -ENODEV;
+	}
+	gpio_direction_output(musb->config->gpio_vrsel, 0);
+
+	usb_nop_xceiv_register();
+	musb->xceiv = otg_get_transceiver();
+	if (!musb->xceiv)
+		return -ENODEV;
+
+	musb_platform_reg_init(musb);
+
 	if (is_host_enabled(musb)) {
 		musb->board_set_vbus = bfin_set_vbus;
 		setup_timer(&musb_conn_timer,
@@ -401,6 +406,7 @@
 void musb_platform_restore_context(struct musb *musb,
 			struct musb_context_registers *musb_context)
 {
+	musb_platform_reg_init(musb);
 }
 #endif
 

Modified: trunk/drivers/usb/musb/musb_core.c (9018 => 9019)


--- trunk/drivers/usb/musb/musb_core.c	2010-07-28 08:17:42 UTC (rev 9018)
+++ trunk/drivers/usb/musb/musb_core.c	2010-07-28 09:14:59 UTC (rev 9019)
@@ -2322,10 +2322,10 @@
 	struct platform_device *pdev = to_platform_device(dev);
 	unsigned long	flags;
 	struct musb	*musb = dev_to_musb(&pdev->dev);
-
+#ifndef CONFIG_BLACKFIN
 	if (!musb->clock)
 		return 0;
-
+#endif
 	spin_lock_irqsave(&musb->lock, flags);
 
 	if (is_peripheral_active(musb)) {
@@ -2352,10 +2352,10 @@
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct musb	*musb = dev_to_musb(&pdev->dev);
-
+#ifndef CONFIG_BLACKFIN
 	if (!musb->clock)
 		return 0;
-
+#endif
 	if (musb->set_clock)
 		musb->set_clock(musb->clock, 1);
 	else
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to