All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode
@ 2020-03-09 13:00 Lubomir Rintel
  2020-03-09 13:00 ` [PATCH 2/2] USB: EHCI: ehci-mv: use a unique bus name Lubomir Rintel
  2020-03-10 14:03 ` [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode Alan Stern
  0 siblings, 2 replies; 4+ messages in thread
From: Lubomir Rintel @ 2020-03-09 13:00 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, Lubomir Rintel

Turns out the undocumented and reserved bits of port status/control
register of the root port need to be set to use the HCI in HSIC mode.

Typically the firmware does this, but that is not always good enough,
because the bits get lost if the HSIC clock is disabled (e.g. when
ehci-mv is build as a module).

This supplements commit 7b104f890ade ("USB: EHCI: ehci-mv: add HSIC
support").

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/usb/host/ehci-mv.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index bd4f6ef534d96..ddb668963955f 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -110,6 +110,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
 	struct resource *r;
 	int retval = -ENODEV;
 	u32 offset;
+	u32 status;
 
 	if (usb_disabled())
 		return -ENODEV;
@@ -213,6 +214,14 @@ static int mv_ehci_probe(struct platform_device *pdev)
 		device_wakeup_enable(hcd->self.controller);
 	}
 
+	if (of_usb_get_phy_mode(pdev->dev.of_node) == USBPHY_INTERFACE_MODE_HSIC) {
+		status = ehci_readl(ehci, &ehci->regs->port_status[0]);
+		/* These "reserved" bits actually enable HSIC mode. */
+		status |= BIT(25);
+		status &= ~GENMASK(31, 30);
+		ehci_writel(ehci, status, &ehci->regs->port_status[0]);
+	}
+
 	dev_info(&pdev->dev,
 		 "successful find EHCI device with regs 0x%p irq %d"
 		 " working in %s mode\n", hcd->regs, hcd->irq,
-- 
2.25.1


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

* [PATCH 2/2] USB: EHCI: ehci-mv: use a unique bus name
  2020-03-09 13:00 [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode Lubomir Rintel
@ 2020-03-09 13:00 ` Lubomir Rintel
  2020-03-10 14:04   ` Alan Stern
  2020-03-10 14:03 ` [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode Alan Stern
  1 sibling, 1 reply; 4+ messages in thread
From: Lubomir Rintel @ 2020-03-09 13:00 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, Lubomir Rintel

In case there are multiple Marvell EHCI blocks in system, we need a
different bus name for each one. Otherwise debugfs gets mildly upset about
a directory name in usb/ehci:

  debugfs: Directory 'mv ehci' with parent 'ehci' already present!

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/usb/host/ehci-mv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index ddb668963955f..1300c457d9ed6 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -115,7 +115,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
 	if (usb_disabled())
 		return -ENODEV;
 
-	hcd = usb_create_hcd(&ehci_platform_hc_driver, &pdev->dev, "mv ehci");
+	hcd = usb_create_hcd(&ehci_platform_hc_driver, &pdev->dev, dev_name(&pdev->dev));
 	if (!hcd)
 		return -ENOMEM;
 
-- 
2.25.1


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

* Re: [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode
  2020-03-09 13:00 [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode Lubomir Rintel
  2020-03-09 13:00 ` [PATCH 2/2] USB: EHCI: ehci-mv: use a unique bus name Lubomir Rintel
@ 2020-03-10 14:03 ` Alan Stern
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Stern @ 2020-03-10 14:03 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Mon, 9 Mar 2020, Lubomir Rintel wrote:

> Turns out the undocumented and reserved bits of port status/control
> register of the root port need to be set to use the HCI in HSIC mode.
> 
> Typically the firmware does this, but that is not always good enough,
> because the bits get lost if the HSIC clock is disabled (e.g. when
> ehci-mv is build as a module).
> 
> This supplements commit 7b104f890ade ("USB: EHCI: ehci-mv: add HSIC
> support").
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Acked-by: Alan Stern <stern@rowland.harvard.edu>

> ---
>  drivers/usb/host/ehci-mv.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
> index bd4f6ef534d96..ddb668963955f 100644
> --- a/drivers/usb/host/ehci-mv.c
> +++ b/drivers/usb/host/ehci-mv.c
> @@ -110,6 +110,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
>  	struct resource *r;
>  	int retval = -ENODEV;
>  	u32 offset;
> +	u32 status;
>  
>  	if (usb_disabled())
>  		return -ENODEV;
> @@ -213,6 +214,14 @@ static int mv_ehci_probe(struct platform_device *pdev)
>  		device_wakeup_enable(hcd->self.controller);
>  	}
>  
> +	if (of_usb_get_phy_mode(pdev->dev.of_node) == USBPHY_INTERFACE_MODE_HSIC) {
> +		status = ehci_readl(ehci, &ehci->regs->port_status[0]);
> +		/* These "reserved" bits actually enable HSIC mode. */
> +		status |= BIT(25);
> +		status &= ~GENMASK(31, 30);
> +		ehci_writel(ehci, status, &ehci->regs->port_status[0]);
> +	}
> +
>  	dev_info(&pdev->dev,
>  		 "successful find EHCI device with regs 0x%p irq %d"
>  		 " working in %s mode\n", hcd->regs, hcd->irq,
> 


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

* Re: [PATCH 2/2] USB: EHCI: ehci-mv: use a unique bus name
  2020-03-09 13:00 ` [PATCH 2/2] USB: EHCI: ehci-mv: use a unique bus name Lubomir Rintel
@ 2020-03-10 14:04   ` Alan Stern
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Stern @ 2020-03-10 14:04 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Mon, 9 Mar 2020, Lubomir Rintel wrote:

> In case there are multiple Marvell EHCI blocks in system, we need a
> different bus name for each one. Otherwise debugfs gets mildly upset about
> a directory name in usb/ehci:
> 
>   debugfs: Directory 'mv ehci' with parent 'ehci' already present!
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Acked-by: Alan Stern <stern@rowland.harvard.edu>

> ---
>  drivers/usb/host/ehci-mv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
> index ddb668963955f..1300c457d9ed6 100644
> --- a/drivers/usb/host/ehci-mv.c
> +++ b/drivers/usb/host/ehci-mv.c
> @@ -115,7 +115,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
>  	if (usb_disabled())
>  		return -ENODEV;
>  
> -	hcd = usb_create_hcd(&ehci_platform_hc_driver, &pdev->dev, "mv ehci");
> +	hcd = usb_create_hcd(&ehci_platform_hc_driver, &pdev->dev, dev_name(&pdev->dev));
>  	if (!hcd)
>  		return -ENOMEM;
>  
> 


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

end of thread, other threads:[~2020-03-10 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 13:00 [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode Lubomir Rintel
2020-03-09 13:00 ` [PATCH 2/2] USB: EHCI: ehci-mv: use a unique bus name Lubomir Rintel
2020-03-10 14:04   ` Alan Stern
2020-03-10 14:03 ` [PATCH 1/2] USB: EHCI: ehci-mv: switch the HSIC HCI to HSIC mode Alan Stern

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.