usb: dwc3: Add support for AM654 USB
Subsystems (3)
v2 cover usb: dwc3: Add support for AM654 USB
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.
Changelog:
v2:
- Moved compatible to separate lines in DT binding.
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 | 6 ++++-- drivers/usb/dwc3/Kconfig | 6 +++--- drivers/usb/dwc3/dwc3-keystone.c | 11 ++++++++++- drivers/usb/dwc3/gadget.c | 2 ++ 4 files changed, 19 insertions(+), 6 deletions(-)
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v2 1/3 usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded
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.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -3337,6 +3337,8 @@ int dwc3_gadget_init(struct dwc3 *dwc) goto err4; } +dwc3_gadget_set_speed (&dwc->gadget, dwc->maximum_speed); +return 0 ; err4:
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v2 2/3 dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support
In reply to Roger QuadrosThe AM654 SoC from TI contains a DWC3 controller. Add support for it.
--- Documentation/devicetree/bindings/usb/keystone-usb.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/usb/keystone-usb.txt +4 -2
@@ -3,7 +3,9 @@ TI Keystone Soc USB Controller DWC3 GLUE Required properties: - - compatible: should be "ti,keystone-dwc3". + - compatible: should be + "ti,keystone-dwc3" for Keystone 2 SoCs + "ti,am654-dwc3" for AM654 SoC - #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 +23,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
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH v2 2/3] dt-bindings: usb: keystone-usb: Add ti,am654-dwc3 support
Quoted 8 lines · Roger Quadros
The AM654 SoC from TI contains a DWC3 controller. Add support for it.
Signed-off-by Roger Quadros <[email protected]>--- Documentation/devicetree/bindings/usb/keystone-usb.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
PATCH v2 3/3 usb: dwc3: keystone: Add support for ti,am654-dwc3
In reply to Roger QuadrosThe 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.
--- drivers/usb/dwc3/Kconfig | 6 +++--- drivers/usb/dwc3/dwc3-keystone.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/usb/dwc3/Kconfig +3 -3
@@ -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/AM654 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 and AM654 platforms. Say 'Y' or 'M' here if you have one such device config USB_DWC3_OF_SIMPLE
drivers/usb/dwc3/dwc3-keystone.c +10 -1
@@ -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);
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki