linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] usb: dwc3: Add support for AM654 USB
@ 2018-12-05 15:19 Roger Quadros
  2018-12-05 15:19 ` [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded Roger Quadros
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Roger Quadros @ 2018-12-05 15:19 UTC (permalink / raw)
  To: balbi
  Cc: tony, robh+dt, nsekhar, t-kristo, vigneshr, linux-omap,
	linux-kernel, devicetree, linux-usb, rogerq

Hi Felipe,

TI's AM654 USB SoC has 2 instances of the DWC3 controller.
This series adds AM654 USB wrapper support to the keystone-usb driver.

cheers,
-roger

Roger Quadros (3):
  usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded
  dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support
  usb: dwc3: keystone: Add support for ti,am654-dwc3

 Documentation/devicetree/bindings/usb/keystone-usb.txt |  4 ++--
 drivers/usb/dwc3/Kconfig                               |  6 +++---
 drivers/usb/dwc3/dwc3-keystone.c                       | 11 ++++++++++-
 drivers/usb/dwc3/gadget.c                              |  2 ++
 4 files changed, 17 insertions(+), 6 deletions(-)

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded
  2018-12-05 15:19 [PATCH 0/3] usb: dwc3: Add support for AM654 USB Roger Quadros
@ 2018-12-05 15:19 ` Roger Quadros
  2018-12-05 15:19 ` [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support Roger Quadros
  2018-12-05 15:19 ` [PATCH 3/3] usb: dwc3: keystone: Add support for ti,am654-dwc3 Roger Quadros
  2 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2018-12-05 15:19 UTC (permalink / raw)
  To: balbi
  Cc: tony, robh+dt, nsekhar, t-kristo, vigneshr, linux-omap,
	linux-kernel, devicetree, linux-usb, rogerq

On v3.10a in dual-role mode, if port is in device mode
and gadget driver isn't loaded, the OTG event interrupts don't
come through.

It seems that if the core is configured to be OTG2.0 only,
then we can't leave the DCFG.DEVSPD at Super-speed (default)
if we expect OTG to work properly. It must be set to High-speed.

Fix this issue by configuring DCFG.DEVSPD to the supported
maximum speed at gadget init. Device tree still needs to provide
correct supported maximum speed for this to work.

This issue wasn't present on v2.40a but is seen on v3.10a.
It doesn't cause any side effects on v2.40a.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 679c12e..79120c0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3240,6 +3240,8 @@ int dwc3_gadget_init(struct dwc3 *dwc)
 		goto err4;
 	}
 
+	dwc3_gadget_set_speed(&dwc->gadget, dwc->maximum_speed);
+
 	return 0;
 
 err4:
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support
  2018-12-05 15:19 [PATCH 0/3] usb: dwc3: Add support for AM654 USB Roger Quadros
  2018-12-05 15:19 ` [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded Roger Quadros
@ 2018-12-05 15:19 ` Roger Quadros
  2018-12-06 10:32   ` Vignesh R
  2018-12-05 15:19 ` [PATCH 3/3] usb: dwc3: keystone: Add support for ti,am654-dwc3 Roger Quadros
  2 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2018-12-05 15:19 UTC (permalink / raw)
  To: balbi
  Cc: tony, robh+dt, nsekhar, t-kristo, vigneshr, linux-omap,
	linux-kernel, devicetree, linux-usb, rogerq

The AM654 SoC from TI contains a DWC3 controller. Add
support for it.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 Documentation/devicetree/bindings/usb/keystone-usb.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
index f96e09f..fa29ff8 100644
--- a/Documentation/devicetree/bindings/usb/keystone-usb.txt
+++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
@@ -3,7 +3,7 @@ TI Keystone Soc USB Controller
 DWC3 GLUE
 
 Required properties:
- - compatible: should be "ti,keystone-dwc3".
+ - compatible: should be "ti,keystone-dwc3" or "ti,am654-dwc3".
  - #address-cells, #size-cells : should be '1' if the device has sub-nodes
    with 'reg' property.
  - reg : Address and length of the register set for the USB subsystem on
@@ -21,7 +21,7 @@ SoCs only:
 - clock-names:		Must be "usb".
 
 
-The following are mandatory properties for Keystone 2 66AK2G SoCs only:
+The following are mandatory properties for 66AK2G and AM654:
 
 - power-domains:	Should contain a phandle to a PM domain provider node
 			and an args specifier containing the USB device id
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH 3/3] usb: dwc3: keystone: Add support for ti,am654-dwc3
  2018-12-05 15:19 [PATCH 0/3] usb: dwc3: Add support for AM654 USB Roger Quadros
  2018-12-05 15:19 ` [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded Roger Quadros
  2018-12-05 15:19 ` [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support Roger Quadros
@ 2018-12-05 15:19 ` Roger Quadros
  2 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2018-12-05 15:19 UTC (permalink / raw)
  To: balbi
  Cc: tony, robh+dt, nsekhar, t-kristo, vigneshr, linux-omap,
	linux-kernel, devicetree, linux-usb, rogerq

The AM654 SoC contains a DWC3 controller with TI specific
wrapper. Add support for that.

Unlike the Keystone 2 case, for AM654 We don't need to
process any IRQs for basic USB operation.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/dwc3/Kconfig         |  6 +++---
 drivers/usb/dwc3/dwc3-keystone.c | 11 ++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 1a0404f..a83a84f 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -86,11 +86,11 @@ config USB_DWC3_HAPS
 	  platform, please say 'Y' or 'M' here.
 
 config USB_DWC3_KEYSTONE
-	tristate "Texas Instruments Keystone2 Platforms"
-	depends on ARCH_KEYSTONE || COMPILE_TEST
+	tristate "Texas Instruments Keystone2/3 Platforms"
+	depends on ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	default USB_DWC3
 	help
-	  Support of USB2/3 functionality in TI Keystone2 platforms.
+	  Support of USB2/3 functionality in TI Keystone2/3 platforms.
 	  Say 'Y' or 'M' here if you have one such device
 
 config USB_DWC3_OF_SIMPLE
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 193a9a8..cbee5fb 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -106,6 +106,10 @@ static int kdwc3_probe(struct platform_device *pdev)
 		goto err_irq;
 	}
 
+	/* IRQ processing not required currently for AM65 */
+	if (of_device_is_compatible(node, "ti,am654-dwc3"))
+		goto skip_irq;
+
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "missing irq\n");
@@ -123,6 +127,7 @@ static int kdwc3_probe(struct platform_device *pdev)
 
 	kdwc3_enable_irqs(kdwc);
 
+skip_irq:
 	error = of_platform_populate(node, NULL, NULL, dev);
 	if (error) {
 		dev_err(&pdev->dev, "failed to create dwc3 core\n");
@@ -152,8 +157,11 @@ static int kdwc3_remove_core(struct device *dev, void *c)
 static int kdwc3_remove(struct platform_device *pdev)
 {
 	struct dwc3_keystone *kdwc = platform_get_drvdata(pdev);
+	struct device_node *node = pdev->dev.of_node;
+
+	if (!of_device_is_compatible(node, "ti,am654-dwc3"))
+		kdwc3_disable_irqs(kdwc);
 
-	kdwc3_disable_irqs(kdwc);
 	device_for_each_child(&pdev->dev, NULL, kdwc3_remove_core);
 	pm_runtime_put_sync(kdwc->dev);
 	pm_runtime_disable(kdwc->dev);
@@ -165,6 +173,7 @@ static int kdwc3_remove(struct platform_device *pdev)
 
 static const struct of_device_id kdwc3_of_match[] = {
 	{ .compatible = "ti,keystone-dwc3", },
+	{ .compatible = "ti,am654-dwc3" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, kdwc3_of_match);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* Re: [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support
  2018-12-05 15:19 ` [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support Roger Quadros
@ 2018-12-06 10:32   ` Vignesh R
  2018-12-10  9:05     ` Roger Quadros
  0 siblings, 1 reply; 7+ messages in thread
From: Vignesh R @ 2018-12-06 10:32 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, tony, robh+dt, nsekhar, t-kristo, linux-omap,
	linux-kernel, devicetree, linux-usb

Hi Roger,

On 05/12/18 8:49 PM, Roger Quadros wrote:
> The AM654 SoC from TI contains a DWC3 controller. Add
> support for it.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  Documentation/devicetree/bindings/usb/keystone-usb.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
> index f96e09f..fa29ff8 100644
> --- a/Documentation/devicetree/bindings/usb/keystone-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
> @@ -3,7 +3,7 @@ TI Keystone Soc USB Controller
>  DWC3 GLUE
>  
>  Required properties:
> - - compatible: should be "ti,keystone-dwc3".
> + - compatible: should be "ti,keystone-dwc3" or "ti,am654-dwc3".

Convention is to have one compatible per line:
 compatible: Should be
	"ti,am654-dwc3" for AM654 SoCs
	"ti,keystone-dwc3" for K2 SoCs



>   - #address-cells, #size-cells : should be '1' if the device has sub-nodes
>     with 'reg' property.
>   - reg : Address and length of the register set for the USB subsystem on
> @@ -21,7 +21,7 @@ SoCs only:
>  - clock-names:		Must be "usb".
>  
>  
> -The following are mandatory properties for Keystone 2 66AK2G SoCs only:
> +The following are mandatory properties for 66AK2G and AM654:
>  
>  - power-domains:	Should contain a phandle to a PM domain provider node
>  			and an args specifier containing the USB device id
> 

-- 
Regards
Vignesh

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

* Re: [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support
  2018-12-06 10:32   ` Vignesh R
@ 2018-12-10  9:05     ` Roger Quadros
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2018-12-10  9:05 UTC (permalink / raw)
  To: Vignesh R
  Cc: balbi, tony, robh+dt, nsekhar, t-kristo, linux-omap,
	linux-kernel, devicetree, linux-usb

Hi Vignesh,

On 06/12/18 12:32, Vignesh R wrote:
> Hi Roger,
> 
> On 05/12/18 8:49 PM, Roger Quadros wrote:
>> The AM654 SoC from TI contains a DWC3 controller. Add
>> support for it.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  Documentation/devicetree/bindings/usb/keystone-usb.txt | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
>> index f96e09f..fa29ff8 100644
>> --- a/Documentation/devicetree/bindings/usb/keystone-usb.txt
>> +++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
>> @@ -3,7 +3,7 @@ TI Keystone Soc USB Controller
>>  DWC3 GLUE
>>  
>>  Required properties:
>> - - compatible: should be "ti,keystone-dwc3".
>> + - compatible: should be "ti,keystone-dwc3" or "ti,am654-dwc3".
> 
> Convention is to have one compatible per line:
>  compatible: Should be
> 	"ti,am654-dwc3" for AM654 SoCs
> 	"ti,keystone-dwc3" for K2 SoCs
> 

OK. Will fix it up. Thanks.

cheers,
-roger

> 
> 
>>   - #address-cells, #size-cells : should be '1' if the device has sub-nodes
>>     with 'reg' property.
>>   - reg : Address and length of the register set for the USB subsystem on
>> @@ -21,7 +21,7 @@ SoCs only:
>>  - clock-names:		Must be "usb".
>>  
>>  
>> -The following are mandatory properties for Keystone 2 66AK2G SoCs only:
>> +The following are mandatory properties for 66AK2G and AM654:
>>  
>>  - power-domains:	Should contain a phandle to a PM domain provider node
>>  			and an args specifier containing the USB device id
>>
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded
  2018-12-05 15:14 [PATCH 0/3] usb: dwc3: Add support for AM654 USB Roger Quadros
@ 2018-12-05 15:14 ` Roger Quadros
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2018-12-05 15:14 UTC (permalink / raw)
  To: balbi
  Cc: tony, robh+dt, nsekhar, t-kristo, vigneshr, linux-omap,
	linux-kernel, devicetree, linux-usb, rogerq

On v3.10a in dual-role mode, if port is in device mode
and gadget driver isn't loaded, the OTG event interrupts don't
come through.

It seems that if the core is configured to be OTG2.0 only,
then we can't leave the DCFG.DEVSPD at Super-speed (default)
if we expect OTG to work properly. It must be set to High-speed.

Fix this issue by configuring DCFG.DEVSPD to the supported
maximum speed at gadget init. Device tree still needs to provide
correct supported maximum speed for this to work.

This issue wasn't present on v2.40a but is seen on v3.10a.
It doesn't cause any side effects on v2.40a.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 679c12e..79120c0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3240,6 +3240,8 @@ int dwc3_gadget_init(struct dwc3 *dwc)
 		goto err4;
 	}
 
+	dwc3_gadget_set_speed(&dwc->gadget, dwc->maximum_speed);
+
 	return 0;
 
 err4:
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 15:19 [PATCH 0/3] usb: dwc3: Add support for AM654 USB Roger Quadros
2018-12-05 15:19 ` [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded Roger Quadros
2018-12-05 15:19 ` [PATCH 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support Roger Quadros
2018-12-06 10:32   ` Vignesh R
2018-12-10  9:05     ` Roger Quadros
2018-12-05 15:19 ` [PATCH 3/3] usb: dwc3: keystone: Add support for ti,am654-dwc3 Roger Quadros
  -- strict thread matches above, loose matches on Subject: below --
2018-12-05 15:14 [PATCH 0/3] usb: dwc3: Add support for AM654 USB Roger Quadros
2018-12-05 15:14 ` [PATCH 1/3] usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded Roger Quadros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).