All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] usb: ehci-msm: Allow LS devices to work
@ 2015-12-09 23:41 Timur Tabi
  2015-12-09 23:41 ` [PATCH 2/5] usb: ehci-msm: Remove dependency on OTG PHY Timur Tabi
       [not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Timur Tabi @ 2015-12-09 23:41 UTC (permalink / raw)
  To: jackp, agross, iivanov, linux-arm-msm, Bjorn Andersson,
	linux-usb, Greg Kroah-Hartman, balbi, Mark Langsdorf,
	Jon Masters, pelcan

From: Jack Pham <jackp@codeaurora.org>

Disable the silicon quirk which is normally enabled for HSIC
host mode. This would otherwise prevent low speed devices
from enumerating properly.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
 drivers/usb/host/ehci-msm.c      | 2 ++
 include/linux/usb/msm_hsusb_hw.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index c4f84c8..d3ed6c9 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -61,6 +61,8 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
 	writel(0, USB_AHBMODE);
 	/* Disable streaming mode and select host mode */
 	writel(0x13, USB_USBMODE);
+	/* Disable ULPI_TX_PKT_EN_CLR_FIX which is valid only for HSIC */
+	writel(readl(USB_GENCONFIG_2) & ~ULPI_TX_PKT_EN_CLR_FIX, USB_GENCONFIG_2);
 
 	return 0;
 }
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index e159b39..974c379 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -22,6 +22,7 @@
 #define USB_AHBBURST         (MSM_USB_BASE + 0x0090)
 #define USB_AHBMODE          (MSM_USB_BASE + 0x0098)
 #define USB_GENCONFIG_2      (MSM_USB_BASE + 0x00a0)
+#define ULPI_TX_PKT_EN_CLR_FIX	BIT(19)
 
 #define USB_CAPLENGTH        (MSM_USB_BASE + 0x0100) /* 8 bit */
 
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] usb: ehci-msm: Remove dependency on OTG PHY
  2015-12-09 23:41 [PATCH 1/5] usb: ehci-msm: Allow LS devices to work Timur Tabi
@ 2015-12-09 23:41 ` Timur Tabi
       [not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2015-12-09 23:41 UTC (permalink / raw)
  To: jackp, agross, iivanov, linux-arm-msm, Bjorn Andersson,
	linux-usb, Greg Kroah-Hartman, balbi, Mark Langsdorf,
	Jon Masters, pelcan

From: Jack Pham <jackp@codeaurora.org>

Currently the EHCI MSM driver has a hard dependency to be created
by an OTG layer, namely the phy-msm-usb driver. In some cases or
board configurations we want to allow the EHCI host to be
instantiated without OTG capability. Instead, relax the dependency
on having an OTG PHY being present and call usb_add_hcd() directly.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
 drivers/usb/host/ehci-msm.c | 53 ++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index d3ed6c9..0a86b8e 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -106,9 +106,9 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	}
 
 	/*
-	 * OTG driver takes care of PHY initialization, clock management,
-	 * powering up VBUS, mapping of registers address space and power
-	 * management.
+	 * If there is an OTG driver, let it take care of PHY initialization,
+	 * clock management, powering up VBUS, mapping of registers address
+	 * space and power management.
 	 */
 	if (pdev->dev.of_node)
 		phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
@@ -116,27 +116,35 @@ static int ehci_msm_probe(struct platform_device *pdev)
 		phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 
 	if (IS_ERR(phy)) {
-		dev_err(&pdev->dev, "unable to find transceiver\n");
-		ret = -EPROBE_DEFER;
-		goto put_hcd;
-	}
-
-	ret = otg_set_host(phy->otg, &hcd->self);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "unable to register with transceiver\n");
-		goto put_hcd;
+		if (PTR_ERR(phy) == -EPROBE_DEFER) {
+			dev_err(&pdev->dev, "unable to find transceiver\n");
+			ret = -EPROBE_DEFER;
+			goto put_hcd;
+		}
+		phy = NULL;
 	}
 
 	hcd->usb_phy = phy;
 	device_init_wakeup(&pdev->dev, 1);
-	/*
-	 * OTG device parent of HCD takes care of putting
-	 * hardware into low power mode.
-	 */
-	pm_runtime_no_callbacks(&pdev->dev);
-	pm_runtime_enable(&pdev->dev);
 
-	/* FIXME: need to call usb_add_hcd() here? */
+	if (phy && phy->otg) {
+		/*
+		 * MSM OTG driver takes care of adding the HCD and
+		 * placing hardware into low power mode via runtime PM.
+		 */
+		ret = otg_set_host(phy->otg, &hcd->self);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "unable to register with transceiver\n");
+			goto put_hcd;
+		}
+
+		pm_runtime_no_callbacks(&pdev->dev);
+		pm_runtime_enable(&pdev->dev);
+	} else {
+		ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
+		if (ret)
+			goto put_hcd;
+	}
 
 	return 0;
 
@@ -154,9 +162,10 @@ static int ehci_msm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
-	otg_set_host(hcd->usb_phy->otg, NULL);
-
-	/* FIXME: need to call usb_remove_hcd() here? */
+	if (hcd->usb_phy && hcd->usb_phy->otg)
+		otg_set_host(hcd->usb_phy->otg, NULL);
+	else
+		usb_remove_hcd(hcd);
 
 	usb_put_hcd(hcd);
 
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] usb: ehci-msm: Add support for ACPI probing
       [not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2015-12-09 23:41   ` Timur Tabi
  2015-12-09 23:41   ` [PATCH 4/5] usb: ehci-msm: Fix register initialization Timur Tabi
  2015-12-09 23:41   ` [PATCH 5/5] usb: ehci-msm: Register usb shutdown function Timur Tabi
  2 siblings, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2015-12-09 23:41 UTC (permalink / raw)
  To: jackp-sgV2jX0FEOL9JmXXK+q4OQ, agross-sgV2jX0FEOL9JmXXK+q4OQ,
	iivanov-NEYub+7Iv8PQT0dZR+AlfA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	balbi-l0cyMroinI0, Mark Langsdorf, Jon Masters,
	pelcan-sgV2jX0FEOL9JmXXK+q4OQ

From: Jack Pham <jackp-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

Allow the EHCI MSM driver to probe against an ACPI enumerated
device with ID QCOM8040.

Signed-off-by: Jack Pham <jackp-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Signed-off-by: Timur Tabi <timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/usb/host/ehci-msm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 0a86b8e..fc666ef 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -33,6 +33,7 @@
 #include <linux/usb/msm_hsusb_hw.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
+#include <linux/acpi.h>
 
 #include "ehci.h"
 
@@ -202,6 +203,12 @@ static const struct dev_pm_ops ehci_msm_dev_pm_ops = {
 	.resume          = ehci_msm_pm_resume,
 };
 
+static const struct acpi_device_id msm_ehci_acpi_ids[] = {
+	{ "QCOM8040", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, msm_ehci_acpi_ids);
+
 static const struct of_device_id msm_ehci_dt_match[] = {
 	{ .compatible = "qcom,ehci-host", },
 	{}
@@ -215,6 +222,7 @@ static struct platform_driver ehci_msm_driver = {
 		   .name = "msm_hsusb_host",
 		   .pm = &ehci_msm_dev_pm_ops,
 		   .of_match_table = msm_ehci_dt_match,
+		   .acpi_match_table = ACPI_PTR(msm_ehci_acpi_ids),
 	},
 };
 
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] usb: ehci-msm: Fix register initialization
       [not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2015-12-09 23:41   ` [PATCH 3/5] usb: ehci-msm: Add support for ACPI probing Timur Tabi
@ 2015-12-09 23:41   ` Timur Tabi
       [not found]     ` <1449704468-4480-4-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2015-12-09 23:41   ` [PATCH 5/5] usb: ehci-msm: Register usb shutdown function Timur Tabi
  2 siblings, 1 reply; 7+ messages in thread
From: Timur Tabi @ 2015-12-09 23:41 UTC (permalink / raw)
  To: jackp-sgV2jX0FEOL9JmXXK+q4OQ, agross-sgV2jX0FEOL9JmXXK+q4OQ,
	iivanov-NEYub+7Iv8PQT0dZR+AlfA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	balbi-l0cyMroinI0, Mark Langsdorf, Jon Masters,
	pelcan-sgV2jX0FEOL9JmXXK+q4OQ

From: Jack Pham <jackp-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

The default value for the 'transceiver select' field of
the PORTSC register may not always be correct. Previously
the phy-msm-usb driver would do this for us, but since
ehci-msm can now be instantiated standalone without any PHY
driver, the register needs to be explicitly initialized to
ULPI mode to properly communicate with the PHY.

This is not readily apparent, as firmware or bootloader code
also happen to pre-initialize this for us. However, it can
manifest when performing a driver unbind/rebind as follows:

 cd /sys/bus/platform/drivers/msm_hsusb_host
 echo QCOM8040:00 > unbind
 echo QCOM8040:00 > bind

The EHCI core executes a controller reset as part of this,
and as a result the register in question would revert to
its default state and must be re-initialized properly.
Furthermore this may be useful in the future when adding
PM suspend/resume support.

Also, update to use the correct value of AHBMODE to allow
data transfers to be posted AHB transactions. This aligns
with the value used in the downstream MSM kernel.

Signed-off-by: Jack Pham <jackp-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Signed-off-by: Timur Tabi <timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/usb/host/ehci-msm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index fc666ef..b8c0df0 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -56,10 +56,12 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
 	if (retval)
 		return retval;
 
+	/* select ULPI phy and clear other status/control bits in PORTSC */
+	writel(PORTSC_PTS_ULPI, USB_PORTSC);
 	/* bursts of unspecified length. */
 	writel(0, USB_AHBBURST);
 	/* Use the AHB transactor */
-	writel(0, USB_AHBMODE);
+	writel(0x8, USB_AHBMODE);
 	/* Disable streaming mode and select host mode */
 	writel(0x13, USB_USBMODE);
 	/* Disable ULPI_TX_PKT_EN_CLR_FIX which is valid only for HSIC */
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] usb: ehci-msm: Register usb shutdown function
       [not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  2015-12-09 23:41   ` [PATCH 3/5] usb: ehci-msm: Add support for ACPI probing Timur Tabi
  2015-12-09 23:41   ` [PATCH 4/5] usb: ehci-msm: Fix register initialization Timur Tabi
@ 2015-12-09 23:41   ` Timur Tabi
  2 siblings, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2015-12-09 23:41 UTC (permalink / raw)
  To: jackp-sgV2jX0FEOL9JmXXK+q4OQ, agross-sgV2jX0FEOL9JmXXK+q4OQ,
	iivanov-NEYub+7Iv8PQT0dZR+AlfA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	balbi-l0cyMroinI0, Mark Langsdorf, Jon Masters,
	pelcan-sgV2jX0FEOL9JmXXK+q4OQ

From: Azriel Samson <asamson-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

Registering usb_hcd_platform_shutdown to be called during
shutdown. This is a generic function that performs the
generic host stack's shutdown. It ensures that USB
operations do not continue while kexec boots a new kernel.

Signed-off-by: Azriel Samson <asamson-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Signed-off-by: Timur Tabi <timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/usb/host/ehci-msm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index b8c0df0..cde3d18 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -220,6 +220,7 @@ MODULE_DEVICE_TABLE(of, msm_ehci_dt_match);
 static struct platform_driver ehci_msm_driver = {
 	.probe	= ehci_msm_probe,
 	.remove	= ehci_msm_remove,
+	.shutdown = usb_hcd_platform_shutdown,
 	.driver = {
 		   .name = "msm_hsusb_host",
 		   .pm = &ehci_msm_dev_pm_ops,
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/5] usb: ehci-msm: Fix register initialization
       [not found]     ` <1449704468-4480-4-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2015-12-10  1:31       ` Jack Pham
  2015-12-10  4:05         ` Timur Tabi
  0 siblings, 1 reply; 7+ messages in thread
From: Jack Pham @ 2015-12-10  1:31 UTC (permalink / raw)
  To: Timur Tabi
  Cc: agross-sgV2jX0FEOL9JmXXK+q4OQ, iivanov-NEYub+7Iv8PQT0dZR+AlfA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	balbi-l0cyMroinI0, Mark Langsdorf, Jon Masters,
	pelcan-sgV2jX0FEOL9JmXXK+q4OQ

Hi Timur,

Thanks for sending these patches upstream on my behalf.

On Wed, Dec 09, 2015 at 05:41:07PM -0600, Timur Tabi wrote:
> Also, update to use the correct value of AHBMODE to allow
> data transfers to be posted AHB transactions. This aligns
> with the value used in the downstream MSM kernel.

>  	/* Use the AHB transactor */
> -	writel(0, USB_AHBMODE);
> +	writel(0x8, USB_AHBMODE);

Andy already sent a patch for just this register change.
http://marc.info/?l=linux-usb&m=144678991912202&w=2

I see it's already been queued on Greg's usb-next. I think it would be
good to rebase.

Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/5] usb: ehci-msm: Fix register initialization
  2015-12-10  1:31       ` Jack Pham
@ 2015-12-10  4:05         ` Timur Tabi
  0 siblings, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2015-12-10  4:05 UTC (permalink / raw)
  To: Jack Pham
  Cc: agross, iivanov, linux-arm-msm, Bjorn Andersson, linux-usb,
	Greg Kroah-Hartman, balbi, Mark Langsdorf, Jon Masters, pelcan

Jack Pham wrote:
> Andy already sent a patch for just this register change.
> http://marc.info/?l=linux-usb&m=144678991912202&w=2
>
> I see it's already been queued on Greg's usb-next. I think it would be
> good to rebase.

Ok, I will do that in my next patch version.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-10  4:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 23:41 [PATCH 1/5] usb: ehci-msm: Allow LS devices to work Timur Tabi
2015-12-09 23:41 ` [PATCH 2/5] usb: ehci-msm: Remove dependency on OTG PHY Timur Tabi
     [not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-12-09 23:41   ` [PATCH 3/5] usb: ehci-msm: Add support for ACPI probing Timur Tabi
2015-12-09 23:41   ` [PATCH 4/5] usb: ehci-msm: Fix register initialization Timur Tabi
     [not found]     ` <1449704468-4480-4-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-12-10  1:31       ` Jack Pham
2015-12-10  4:05         ` Timur Tabi
2015-12-09 23:41   ` [PATCH 5/5] usb: ehci-msm: Register usb shutdown function Timur Tabi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.