lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Dec 2016 00:25:08 +0530
From:   Manish Narani <manish.narani@...inx.com>
To:     <mathias.nyman@...el.com>, <gregkh@...uxfoundation.org>,
        <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     <anuragku@...inx.com>, <punnaia@...inx.com>, <anirudh@...inx.com>,
        <mnarani@...inx.com>
Subject: [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call

This patch will add support for OTG host initialization. This will
help OTG drivers to populate their host subsystem.

Signed-off-by: Manish Narani <mnarani@...inx.com>
---
 drivers/usb/host/xhci-plat.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index ddfab30..b4cadbd 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -20,6 +20,10 @@
 #include <linux/slab.h>
 #include <linux/acpi.h>
 
+#ifdef CONFIG_USB_OTG
+#include <linux/usb/otg.h>
+#endif
+
 #include "xhci.h"
 #include "xhci-plat.h"
 #include "xhci-mvebu.h"
@@ -255,6 +259,24 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	if (ret)
 		goto dealloc_usb2_hcd;
 
+#ifdef CONFIG_USB_OTG
+	hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB3);
+	if (!IS_ERR_OR_NULL(hcd->usb_phy) && hcd->usb_phy->otg) {
+		dev_dbg(&pdev->dev, "%s otg support available\n", __func__);
+		ret = otg_set_host(hcd->usb_phy->otg, &hcd->self);
+		if (ret) {
+			dev_err(&pdev->dev, "%s otg_set_host failed\n",
+					__func__);
+			usb_put_phy(hcd->usb_phy);
+			hcd->usb_phy = NULL;
+			goto dealloc_usb2_hcd;
+		}
+	} else {
+		usb_put_phy(hcd->usb_phy);
+		hcd->usb_phy = NULL;
+	}
+#endif
+
 	return 0;
 
 
@@ -283,6 +305,19 @@ static int xhci_plat_remove(struct platform_device *dev)
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
 	struct clk *clk = xhci->clk;
 
+#ifdef CONFIG_USB_OTG
+	if (hcd->usb_phy) {
+		if (!IS_ERR(hcd->usb_phy)) {
+			if (hcd->usb_phy->otg)
+				otg_set_host(hcd->usb_phy->otg, NULL);
+			usb_put_phy(hcd->usb_phy);
+		}
+		hcd->usb_phy = NULL;
+		if (xhci->shared_hcd)
+			xhci->shared_hcd->usb_phy = NULL;
+	}
+#endif
+
 	usb_remove_hcd(xhci->shared_hcd);
 	usb_phy_shutdown(hcd->usb_phy);
 
-- 
1.7.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ