[PATCH 3/4 v2] EHCI: Add EHCI OTG HNP support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 2e17b64b4a1da3748f6d996c420506ff72c32a4e Mon Sep 17 00:00:00 2001
From: Alek Du <alek.du@xxxxxxxxx>
Date: Wed, 10 Jun 2009 16:47:12 +0800
Subject: [PATCH] EHCI: Add EHCI OTG HNP support

It should be the first time that we have a EHCI OTG device, this patch adds
essential changes to support HNP protocol working with the tranceiver driver.

Signed-off-by: Jacob Pan <jacob.pan.jun@xxxxxxxxx>
Signed-off-by: Alek Du <alek.du@xxxxxxxxx>
---
 drivers/usb/core/hub.c               |    1 +
 drivers/usb/core/notify.c            |    9 +++++++++
 drivers/usb/core/usb.h               |    1 +
 drivers/usb/host/ehci-langwell-pci.c |   12 ++++++++++++
 include/linux/usb.h                  |    3 +++
 5 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index be86ae3..0ffb40f 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1545,6 +1545,7 @@ static int usb_configure_device_otg(struct usb_device *udev)
 						err);
 					bus->b_hnp_enable = 0;
 				}
+				usb_notify_otg_hnp_enable(udev);
 			}
 		}
 	}
diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c
index 7542dce..1ebe71a 100644
--- a/drivers/usb/core/notify.c
+++ b/drivers/usb/core/notify.c
@@ -66,3 +66,12 @@ void usb_notify_remove_bus(struct usb_bus *ubus)
 {
 	blocking_notifier_call_chain(&usb_notifier_list, USB_BUS_REMOVE, ubus);
 }
+
+void usb_notify_otg_hnp_enable(struct usb_device *udev)
+{
+	struct usb_bus	*ubus = udev->bus;
+
+	blocking_notifier_call_chain(&usb_notifier_list,\
+		ubus->b_hnp_enable ? \
+		USB_B_HNP_ENABLE : USB_B_HNP_DISABLE, udev);
+}
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 79d8a9e..b2d6848 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -161,4 +161,5 @@ extern void usb_notify_add_device(struct usb_device *udev);
 extern void usb_notify_remove_device(struct usb_device *udev);
 extern void usb_notify_add_bus(struct usb_bus *ubus);
 extern void usb_notify_remove_bus(struct usb_bus *ubus);
+extern void usb_notify_otg_hnp_enable(struct usb_device *udev);
 
diff --git a/drivers/usb/host/ehci-langwell-pci.c b/drivers/usb/host/ehci-langwell-pci.c
index f78a756..9169a6f 100644
--- a/drivers/usb/host/ehci-langwell-pci.c
+++ b/drivers/usb/host/ehci-langwell-pci.c
@@ -97,6 +97,18 @@ static int usb_otg_notify(struct notifier_block *self,
 			iotg->hsm.a_conn = 0;
 		update = 1;
 		break;
+	case USB_B_HNP_ENABLE:
+		pr_debug("Notify OTG B HNP enable\n");
+		if (iotg->otg.default_a == 1)
+			iotg->hsm.a_set_b_hnp_en = 1;
+		update = 0;
+		break;
+	case USB_B_HNP_DISABLE:
+		pr_debug("Notify OTG B HNP disable\n");
+		if (iotg->otg.default_a == 1)
+			iotg->hsm.a_set_b_hnp_en = 0;
+		update = 0;
+		break;
 	default:
 		otg_put_transceiver(otg);
 		return NOTIFY_DONE;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3aa2cd1..9ee47f2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1545,6 +1545,9 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
 #define USB_DEVICE_REMOVE	0x0002
 #define USB_BUS_ADD		0x0003
 #define USB_BUS_REMOVE		0x0004
+#define USB_B_HNP_ENABLE	0x0005
+#define USB_B_HNP_DISABLE	0x0006
+
 extern void usb_register_notify(struct notifier_block *nb);
 extern void usb_unregister_notify(struct notifier_block *nb);
 
-- 
1.6.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux