Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

2017-08-17 Thread Roger Quadros

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

On 17/08/17 00:54, Franklin S Cooper Jr wrote:
> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
> clocks and the power domains. Therefore, add PM runtime support. Remove
> legacy clock api's calls since other users of this driver worked without
> these clock apis calls.
> 
> Signed-off-by: Franklin S Cooper Jr 

Acked-by: Roger Quadros 

> ---
>  drivers/usb/dwc3/dwc3-keystone.c | 22 ++
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-keystone.c 
> b/drivers/usb/dwc3/dwc3-keystone.c
> index 12ee23f..d2ed952 100644
> --- a/drivers/usb/dwc3/dwc3-keystone.c
> +++ b/drivers/usb/dwc3/dwc3-keystone.c
> @@ -15,7 +15,6 @@
>   * GNU General Public License for more details.
>   */
>  
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -23,6 +22,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  /* USBSS register offsets */
>  #define USBSS_REVISION   0x
> @@ -41,7 +41,6 @@
>  
>  struct dwc3_keystone {
>   struct device   *dev;
> - struct clk  *clk;
>   void __iomem*usbss;
>  };
>  
> @@ -106,17 +105,13 @@ static int kdwc3_probe(struct platform_device *pdev)
>   if (IS_ERR(kdwc->usbss))
>   return PTR_ERR(kdwc->usbss);
>  
> - kdwc->clk = devm_clk_get(kdwc->dev, "usb");
> - if (IS_ERR(kdwc->clk)) {
> - dev_err(kdwc->dev, "unable to get usb clock\n");
> - return PTR_ERR(kdwc->clk);
> - }
> + pm_runtime_enable(kdwc->dev);
>  
> - error = clk_prepare_enable(kdwc->clk);
> + error = pm_runtime_get_sync(kdwc->dev);
>   if (error < 0) {
> - dev_err(kdwc->dev, "unable to enable usb clock, error %d\n",
> + dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",
>   error);
> - return error;
> + goto err_irq;
>   }
>  
>   irq = platform_get_irq(pdev, 0);
> @@ -147,7 +142,8 @@ static int kdwc3_probe(struct platform_device *pdev)
>  err_core:
>   kdwc3_disable_irqs(kdwc);
>  err_irq:
> - clk_disable_unprepare(kdwc->clk);
> + pm_runtime_put_sync(kdwc->dev);
> + pm_runtime_disable(kdwc->dev);
>  
>   return error;
>  }
> @@ -167,7 +163,9 @@ static int kdwc3_remove(struct platform_device *pdev)
>  
>   kdwc3_disable_irqs(kdwc);
>   device_for_each_child(&pdev->dev, NULL, kdwc3_remove_core);
> - clk_disable_unprepare(kdwc->clk);
> + pm_runtime_put_sync(kdwc->dev);
> + pm_runtime_disable(kdwc->dev);
> +
>   platform_set_drvdata(pdev, NULL);
>  
>   return 0;
> 

-- 
cheers,
-roger

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


[PATCH 4/7] ARM: dts: stm32: Enable USB HS on stm32746g-eval

2017-08-17 Thread Amelie Delaunay
This patch enables USB HS on stm32746g-eval (Host mode).

Signed-off-by: Amelie Delaunay 
---
 arch/arm/boot/dts/stm32746g-eval.dts | 16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/stm32746g-eval.dts 
b/arch/arm/boot/dts/stm32746g-eval.dts
index 69a9579..944501d 100644
--- a/arch/arm/boot/dts/stm32746g-eval.dts
+++ b/arch/arm/boot/dts/stm32746g-eval.dts
@@ -83,6 +83,13 @@
gpios = <&gpioc 13 0>;
};
};
+
+   usbotg_hs_phy: usbphy {
+   #phy-cells = <0>;
+   compatible = "usb-nop-xceiv";
+   clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
+   clock-names = "main_clk";
+   };
 };
 
 &clk_hse {
@@ -102,3 +109,12 @@
pinctrl-names = "default";
status = "okay";
 };
+
+&usbotg_hs {
+   dr_mode = "host";
+   phys = <&usbotg_hs_phy>;
+   phy-names = "usb2-phy";
+   pinctrl-0 = <&usbotg_hs_pins_a>;
+   pinctrl-names = "default";
+   status = "okay";
+};
-- 
2.7.4

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


[PATCH 5/7] ARM: dts: stm32: Enable USB HS on stm32f746-disco

2017-08-17 Thread Amelie Delaunay
This patch enables USB HS on stm32f746-disco (Host mode).

Signed-off-by: Amelie Delaunay 
---
 arch/arm/boot/dts/stm32f746-disco.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f746-disco.dts 
b/arch/arm/boot/dts/stm32f746-disco.dts
index 18f6560..0d38e9a 100644
--- a/arch/arm/boot/dts/stm32f746-disco.dts
+++ b/arch/arm/boot/dts/stm32f746-disco.dts
@@ -61,6 +61,12 @@
serial0 = &usart1;
};
 
+   usbotg_hs_phy: usbphy {
+   #phy-cells = <0>;
+   compatible = "usb-nop-xceiv";
+   clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
+   clock-names = "main_clk";
+   };
 };
 
 &clk_hse {
@@ -72,3 +78,12 @@
pinctrl-names = "default";
status = "okay";
 };
+
+&usbotg_hs {
+   dr_mode = "host";
+   phys = <&usbotg_hs_phy>;
+   phy-names = "usb2-phy";
+   pinctrl-0 = <&usbotg_hs_pins_b>;
+   pinctrl-names = "default";
+   status = "okay";
+};
-- 
2.7.4

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


[PATCH 6/7] ARM: dts: stm32: Add USB FS support for STM32F746 MCU

2017-08-17 Thread Amelie Delaunay
This patch adds the USB pins and nodes for USB FS core on STM32F746 SoC.

Signed-off-by: Amelie Delaunay 
---
 arch/arm/boot/dts/stm32f746.dtsi | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi
index fcfe5a6..a9476ea 100644
--- a/arch/arm/boot/dts/stm32f746.dtsi
+++ b/arch/arm/boot/dts/stm32f746.dtsi
@@ -419,6 +419,28 @@
slew-rate = <2>;
};
};
+
+   usbotg_fs_pins_a: usbotg_fs@0 {
+   pins {
+   pinmux = 
,
+
,
+
;
+   bias-disable;
+   drive-push-pull;
+   slew-rate = <2>;
+   };
+   };
+
+   usbotg_fs_pins_b: usbotg_fs@1 {
+   pins {
+   pinmux = 
,
+
,
+
;
+   bias-disable;
+   drive-push-pull;
+   slew-rate = <2>;
+   };
+   };
};
 
crc: crc@40023000 {
@@ -480,6 +502,15 @@
clock-names = "otg";
status = "disabled";
};
+
+   usbotg_fs: usb@5000 {
+   compatible = "st,stm32f4x9-fsotg";
+   reg = <0x5000 0x4>;
+   interrupts = <67>;
+   clocks = <&rcc 0 STM32F7_AHB2_CLOCK(OTGFS)>;
+   clock-names = "otg";
+   status = "disabled";
+   };
};
 };
 
-- 
2.7.4

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


[PATCH 7/7] ARM: dts: stm32: Enable USB FS on stm32f746-disco

2017-08-17 Thread Amelie Delaunay
This patch enables USB FS on stm32f746-disco (Host mode) with 5V VBUS
enable.

Signed-off-by: Amelie Delaunay 
---
 arch/arm/boot/dts/stm32f746-disco.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f746-disco.dts 
b/arch/arm/boot/dts/stm32f746-disco.dts
index 0d38e9a..c683040 100644
--- a/arch/arm/boot/dts/stm32f746-disco.dts
+++ b/arch/arm/boot/dts/stm32f746-disco.dts
@@ -67,6 +67,14 @@
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
clock-names = "main_clk";
};
+
+   /* This turns on vbus for otg fs for host mode (dwc2) */
+   vcc5v_otg_fs: vcc5v-otg-fs-regulator {
+   compatible = "regulator-fixed";
+   gpio = <&gpiod 5 0>;
+   regulator-name = "vcc5_host1";
+   regulator-always-on;
+   };
 };
 
 &clk_hse {
@@ -87,3 +95,10 @@
pinctrl-names = "default";
status = "okay";
 };
+
+&usbotg_fs {
+   dr_mode = "host";
+   pinctrl-0 = <&usbotg_fs_pins_a>;
+   pinctrl-names = "default";
+   status = "okay";
+};
-- 
2.7.4

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


[PATCH 3/7] ARM: dts: stm32: Add USB HS support for STM32F746 MCU

2017-08-17 Thread Amelie Delaunay
This patch adds the USB pins and nodes for USB HS core on STM32F746 SoC.

Signed-off-by: Amelie Delaunay 
---
 arch/arm/boot/dts/stm32f746.dtsi | 49 
 1 file changed, 49 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi
index 5633860..fcfe5a6 100644
--- a/arch/arm/boot/dts/stm32f746.dtsi
+++ b/arch/arm/boot/dts/stm32f746.dtsi
@@ -379,6 +379,46 @@
bias-disable;
};
};
+
+   usbotg_hs_pins_a: usbotg_hs@0 {
+   pins {
+   pinmux = 
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
;
+   bias-disable;
+   drive-push-pull;
+   slew-rate = <2>;
+   };
+   };
+
+   usbotg_hs_pins_b: usbotg_hs@1 {
+   pins {
+   pinmux = 
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
,
+
;
+   bias-disable;
+   drive-push-pull;
+   slew-rate = <2>;
+   };
+   };
};
 
crc: crc@40023000 {
@@ -431,6 +471,15 @@
st,mem2mem;
status = "disabled";
};
+
+   usbotg_hs: usb@4004 {
+   compatible = "st,stm32f7xx-hsotg";
+   reg = <0x4004 0x4>;
+   interrupts = <77>;
+   clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHS)>;
+   clock-names = "otg";
+   status = "disabled";
+   };
};
 };
 
-- 
2.7.4

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


[PATCH 1/7] dt-bindings: usb: Document the STM32F7xx DWC2 USB OTG HS core binding

2017-08-17 Thread Amelie Delaunay
This patch adds binding documentation for DWC2 controller in HS mode found
on STMicroelectronics STM32F7xx SoC.

Signed-off-by: Amelie Delaunay 
---
 Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
b/Documentation/devicetree/bindings/usb/dwc2.txt
index fcf199b..e64d903 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.txt
+++ b/Documentation/devicetree/bindings/usb/dwc2.txt
@@ -19,6 +19,8 @@ Required properties:
   configured in FS mode;
   - "st,stm32f4x9-hsotg": The DWC2 USB HS controller instance in STM32F4x9 SoCs
   configured in HS mode;
+  - "st,stm32f7xx-hsotg": The DWC2 USB HS controller instance in STM32F7xx SoCs
+configured in HS mode;
 - reg : Should contain 1 register range (address and length)
 - interrupts : Should contain 1 interrupt
 - clocks: clock provider specifier
-- 
2.7.4

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


[PATCH 0/7] Add support for USB OTG on STM32F7xx

2017-08-17 Thread Amelie Delaunay
The STM32F7xx MCU family embeds two DWC2 USB OTG cores. One core is USB
OTG FS and the other is USB OTG HS. The USB FS core only works with its
internal phy whilst the USB HS core can work in HS with external ULPI phy
or in FS/LS with the on-chip FS phy.

Amelie Delaunay (7):
  dt-bindings: usb: Document the STM32F7xx DWC2 USB OTG HS core binding
  usb: dwc2: add support for STM32F7xx USB OTG HS
  ARM: dts: stm32: Add USB HS support for STM32F746 MCU
  ARM: dts: stm32: Enable USB HS on stm32746g-eval
  ARM: dts: stm32: Enable USB HS on stm32f746-disco
  ARM: dts: stm32: Add USB FS support for STM32F746 MCU
  ARM: dts: stm32: Enable USB FS on stm32f746-disco

 Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
 arch/arm/boot/dts/stm32746g-eval.dts   | 16 ++
 arch/arm/boot/dts/stm32f746-disco.dts  | 30 ++
 arch/arm/boot/dts/stm32f746.dtsi   | 80 ++
 drivers/usb/dwc2/params.c  | 11 
 5 files changed, 139 insertions(+)

-- 
2.7.4

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


[PATCH 2/7] usb: dwc2: add support for STM32F7xx USB OTG HS

2017-08-17 Thread Amelie Delaunay
This patch adds the dwc2_set_params function for STM32F7xx USB OTG HS.

Signed-off-by: Amelie Delaunay 
---
 drivers/usb/dwc2/params.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index a3ffe97..015d23e 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -136,6 +136,15 @@ static void dwc2_set_stm32f4x9_fsotg_params(struct 
dwc2_hsotg *hsotg)
p->activate_stm_fs_transceiver = true;
 }
 
+static void dwc2_set_stm32f7xx_hsotg_params(struct dwc2_hsotg *hsotg)
+{
+   struct dwc2_core_params *p = &hsotg->params;
+
+   p->host_rx_fifo_size = 622;
+   p->host_nperio_tx_fifo_size = 128;
+   p->host_perio_tx_fifo_size = 256;
+}
+
 const struct of_device_id dwc2_of_match_table[] = {
{ .compatible = "brcm,bcm2835-usb", .data = dwc2_set_bcm_params },
{ .compatible = "hisilicon,hi6220-usb", .data = dwc2_set_his_params  },
@@ -154,6 +163,8 @@ const struct of_device_id dwc2_of_match_table[] = {
{ .compatible = "st,stm32f4x9-fsotg",
  .data = dwc2_set_stm32f4x9_fsotg_params },
{ .compatible = "st,stm32f4x9-hsotg" },
+   { .compatible = "st,stm32f7xx-hsotg",
+ .data = dwc2_set_stm32f7xx_hsotg_params },
{},
 };
 MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
-- 
2.7.4

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


Re: [PATCH 4/7] ARM: dts: stm32: Enable USB HS on stm32746g-eval

2017-08-17 Thread Sergei Shtylyov

Hello!

On 8/17/2017 12:33 PM, Amelie Delaunay wrote:


This patch enables USB HS on stm32746g-eval (Host mode).

Signed-off-by: Amelie Delaunay 
---
  arch/arm/boot/dts/stm32746g-eval.dts | 16 
  1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/stm32746g-eval.dts 
b/arch/arm/boot/dts/stm32746g-eval.dts
index 69a9579..944501d 100644
--- a/arch/arm/boot/dts/stm32746g-eval.dts
+++ b/arch/arm/boot/dts/stm32746g-eval.dts
@@ -83,6 +83,13 @@
gpios = <&gpioc 13 0>;
};
};
+
+   usbotg_hs_phy: usbphy {


   Name it "usb-phy" please, tpo be m,ore in line with the DT spec.

[...]

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


Re: [PATCH 6/7] ARM: dts: stm32: Add USB FS support for STM32F746 MCU

2017-08-17 Thread Sergei Shtylyov

On 8/17/2017 12:33 PM, Amelie Delaunay wrote:


This patch adds the USB pins and nodes for USB FS core on STM32F746 SoC.

Signed-off-by: Amelie Delaunay 
---
  arch/arm/boot/dts/stm32f746.dtsi | 31 +++
  1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi
index fcfe5a6..a9476ea 100644
--- a/arch/arm/boot/dts/stm32f746.dtsi
+++ b/arch/arm/boot/dts/stm32f746.dtsi
@@ -419,6 +419,28 @@
slew-rate = <2>;
};
};
+
+   usbotg_fs_pins_a: usbotg_fs@0 {


   Dashes are preferred to underlines in the node names.

[...]

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


Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

2017-08-17 Thread Felipe Balbi

Hi,

Franklin S Cooper Jr  writes:
> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
> clocks and the power domains. Therefore, add PM runtime support. Remove
> legacy clock api's calls since other users of this driver worked without
> these clock apis calls.
>
> Signed-off-by: Franklin S Cooper Jr 
> ---

I already have the previous version of this in my tree. Seems like the
only difference was on binding document, right? Do I need to change
anything in my 'next' and/or 'testing/next' branches?

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


Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

2017-08-17 Thread Franklin S Cooper Jr


On 08/17/2017 07:04 AM, Felipe Balbi wrote:
> 
> Hi,
> 
> Franklin S Cooper Jr  writes:
>> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
>> clocks and the power domains. Therefore, add PM runtime support. Remove
>> legacy clock api's calls since other users of this driver worked without
>> these clock apis calls.
>>
>> Signed-off-by: Franklin S Cooper Jr 
>> ---
> 
> I already have the previous version of this in my tree. Seems like the
> only difference was on binding document, right? Do I need to change
> anything in my 'next' and/or 'testing/next' branches?

Correct the binding document is the only difference. Both of your
branches looks good.

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


Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

2017-08-17 Thread Felipe Balbi

Hi,

Franklin S Cooper Jr  writes:
>> Franklin S Cooper Jr  writes:
>>> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
>>> clocks and the power domains. Therefore, add PM runtime support. Remove
>>> legacy clock api's calls since other users of this driver worked without
>>> these clock apis calls.
>>>
>>> Signed-off-by: Franklin S Cooper Jr 
>>> ---
>> 
>> I already have the previous version of this in my tree. Seems like the
>> only difference was on binding document, right? Do I need to change
>> anything in my 'next' and/or 'testing/next' branches?
>
> Correct the binding document is the only difference. Both of your
> branches looks good.

cool, thanks :-)

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


Re: usb 3-1: 1:1: cannot get freq at ep 0x81

2017-08-17 Thread Cristian
Hello,

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1708499/comments/6

Regards,
--
Cristian




2017-08-16 14:02 GMT-03:00 Greg KH :
> On Wed, Aug 16, 2017 at 01:40:48PM -0300, Cristian wrote:
>> Hello,
>>
>> Launchpad.net:
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1711151
>
> What are we supposed to do with a one line description and a pointer to
> some random distro bug site?
>
> Please, if you want our help, give us the needed information here in an
> email, nothing we can do with other bug tracking systems at all.
>
> greg k-h



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


Re: [PATCH 4/7] ARM: dts: stm32: Enable USB HS on stm32746g-eval

2017-08-17 Thread Amelie DELAUNAY
Hi!

On 08/17/2017 12:44 PM, Sergei Shtylyov wrote:
> Hello!
> 
> On 8/17/2017 12:33 PM, Amelie Delaunay wrote:
> 
>> This patch enables USB HS on stm32746g-eval (Host mode).
>>
>> Signed-off-by: Amelie Delaunay 
>> ---
>>   arch/arm/boot/dts/stm32746g-eval.dts | 16 
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/stm32746g-eval.dts 
>> b/arch/arm/boot/dts/stm32746g-eval.dts
>> index 69a9579..944501d 100644
>> --- a/arch/arm/boot/dts/stm32746g-eval.dts
>> +++ b/arch/arm/boot/dts/stm32746g-eval.dts
>> @@ -83,6 +83,13 @@
>>   gpios = <&gpioc 13 0>;
>>   };
>>   };
>> +
>> +usbotg_hs_phy: usbphy {
> 
> Name it "usb-phy" please, tpo be m,ore in line with the DT spec.
OK, will be fixed in v2. Thanks!
> 
> [...]
> 
> MBR, Sergei

Regards,
AmelieN�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h�&���G���h�(�階�ݢj"���m��z�ޖ���f���h���~�m�

Re: [PATCH 6/7] ARM: dts: stm32: Add USB FS support for STM32F746 MCU

2017-08-17 Thread Amelie DELAUNAY
On 08/17/2017 12:47 PM, Sergei Shtylyov wrote:
> On 8/17/2017 12:33 PM, Amelie Delaunay wrote:
> 
>> This patch adds the USB pins and nodes for USB FS core on STM32F746 SoC.
>>
>> Signed-off-by: Amelie Delaunay 
>> ---
>>   arch/arm/boot/dts/stm32f746.dtsi | 31 +++
>>   1 file changed, 31 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/stm32f746.dtsi 
>> b/arch/arm/boot/dts/stm32f746.dtsi
>> index fcfe5a6..a9476ea 100644
>> --- a/arch/arm/boot/dts/stm32f746.dtsi
>> +++ b/arch/arm/boot/dts/stm32f746.dtsi
>> @@ -419,6 +419,28 @@
>>   slew-rate = <2>;
>>   };
>>   };
>> +
>> +usbotg_fs_pins_a: usbotg_fs@0 {
> 
> Dashes are preferred to underlines in the node names.
You're right. I'll fix it in v2. Thanks.
> 
> [...]
> 
> MBR, Sergei

Regards,
Amelie

Re: usb 3-1: 1:1: cannot get freq at ep 0x81

2017-08-17 Thread Greg KH
On Thu, Aug 17, 2017 at 09:51:11AM -0300, Cristian wrote:
> Hello,
> 
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1708499/comments/6

You didn't read my last response :(
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv3 usb-next 1/3] dt-bindings: usb: add the documentation for USB root-hub

2017-08-17 Thread Rob Herring
On Tue, Aug 15, 2017 at 12:45:40AM +0200, Martin Blumenstingl wrote:
> A USB root-hub may have several PHYs which need to be configured before
> the root-hub starts working.
> This adds the documentation for such a USB root-hub.
> 
> Signed-off-by: Martin Blumenstingl 
> ---
>  .../devicetree/bindings/usb/usb-roothub.txt| 46 
> ++
>  1 file changed, 46 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/usb-roothub.txt

Acked-by: Rob Herring 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] dt-bindings: phy-mt65xx-usb: supports PCIe, SATA and rename file

2017-08-17 Thread Rob Herring
On Wed, Aug 09, 2017 at 01:29:49PM +0800, Chunfeng Yun wrote:
> add support for PCIe and SATA, also add some new compatibles.

s/add/Add/

> 
> due to phy-mt65xx-usb.txt holds the bindings for all mediatek SoCs

s/due/Due/

> with T-PHY controller, change the name to phy-mtk-tphy.txt to
> reflect that.
> 
> Signed-off-by: Chunfeng Yun 
> ---
>  .../phy/{phy-mt65xx-usb.txt => phy-mtk-tphy.txt}| 17 
> -
>  1 file changed, 12 insertions(+), 5 deletions(-)
>  rename Documentation/devicetree/bindings/phy/{phy-mt65xx-usb.txt => 
> phy-mtk-tphy.txt} (88%)
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-mt65xx-usb.txt 
> b/Documentation/devicetree/bindings/phy/phy-mtk-tphy.txt
> similarity index 88%
> rename from Documentation/devicetree/bindings/phy/phy-mt65xx-usb.txt
> rename to Documentation/devicetree/bindings/phy/phy-mtk-tphy.txt
> index 0acc5a9..faf1808 100644
> --- a/Documentation/devicetree/bindings/phy/phy-mt65xx-usb.txt
> +++ b/Documentation/devicetree/bindings/phy/phy-mtk-tphy.txt
> @@ -1,13 +1,18 @@
> -mt65xx USB3.0 PHY binding
> +MediaTek T-PHY binding
>  --
>  
> -This binding describes a usb3.0 phy for mt65xx platforms of Medaitek SoC.
> +T-phy controller supports physical layer functionality for a number of
> +controllers on MediaTek SoCs, such as, USB2.0, USB3.0, PCIe, and SATA.
>  
>  Required properties (controller (parent) node):
>   - compatible: should be one of
> -   "mediatek,mt2701-u3phy"
> -   "mediatek,mt2712-u3phy"
> -   "mediatek,mt8173-u3phy"
> +   "mediatek,generic-tphy-v1"
> +   "mediatek,generic-tphy-v2"
> +   "mediatek,mt2701-u3phy" (deprecated)
> +   "mediatek,mt2712-u3phy" (deprecated)

SoC specific compatibles should not be deprecated.

> +   "mediatek,mt8173-u3phy";
> +   make use of "mediatek,generic-tphy-v1" on mt2701 instead and
> +   "mediatek,generic-tphy-v2" on mt2712 instead.
>   - clocks: (deprecated, use port's clocks instead) a list of phandle +
> clock-specifier pairs, one for each entry in clock-names
>   - clock-names   : (deprecated, use port's one instead) must contain
> @@ -35,6 +40,8 @@ Required properties (port (child) node):
> cell after port phandle is phy type from:
>   - PHY_TYPE_USB2
>   - PHY_TYPE_USB3
> + - PHY_TYPE_PCIE
> + - PHY_TYPE_SATA
>  
>  Example:
>  
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv3 usb-next 3/3] usb: host: xhci: plat: integrate the platform-roothub

2017-08-17 Thread Rob Herring
On Tue, Aug 15, 2017 at 12:45:42AM +0200, Martin Blumenstingl wrote:
> This enables the platform-roothub for the xhci-plat driver. This allows
> specifying a PHY for each port via devicetree. All PHYs will then be
> enabled/disabled by the platform-roothub driver.
> 
> One example where this is required is the Amlogic GXL and GXM SoCs:
> They are using a dwc3 USB controller with up to three ports enabled on
> the internal roothub. Using only the top-level "phy" properties does not
> work here since one can only specify one "usb2-phy" and one "usb3-phy",
> while actually at least two "usb2-phy" have to be specified.
> 
> Signed-off-by: Martin Blumenstingl 
> ---
>  Documentation/devicetree/bindings/usb/usb-xhci.txt |  7 +

This can be part of the binding patch. Otherwise,

Acked-by: Rob Herring 

>  drivers/usb/host/Kconfig   |  1 +
>  drivers/usb/host/xhci-plat.c   | 35 
> --
>  drivers/usb/host/xhci.h|  2 ++
>  4 files changed, 43 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] USB: Gadget core: fix inconsistency in the interface tousb_add_gadget_udc_release()

2017-08-17 Thread Alan Stern
The usb_add_gadget_udc_release() routine in the USB gadget core will
sometimes but not always call the gadget's release function when an
error occurs.  More specifically, if the struct usb_udc allocation
fails then the release function is not called, and for other errors it
is.

As a result, users of this routine cannot know whether they need to
deallocate the memory containing the gadget structure following an
error.  This leads to unavoidable memory leaks or double frees.

This patch fixes the problem by splitting the existing
device_register() call into device_initialize() and device_add(), and
doing the udc allocation in between.  That way, even if the allocation
fails it is still possible to call device_del(), and so the release
function will be always called following an error.

Signed-off-by: Alan Stern 
Reported-by: Alexey Khoroshilov 

---


[as1837]


 drivers/usb/gadget/udc/core.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

Index: usb-4.x/drivers/usb/gadget/udc/core.c
===
--- usb-4.x.orig/drivers/usb/gadget/udc/core.c
+++ usb-4.x/drivers/usb/gadget/udc/core.c
@@ -1130,6 +1130,7 @@ static int check_pending_gadget_drivers(
  * @release: a gadget release function.
  *
  * Returns zero on success, negative errno otherwise.
+ * Calls the gadget release function in the latter case.
  */
 int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget 
*gadget,
void (*release)(struct device *dev))
@@ -1137,10 +1138,6 @@ int usb_add_gadget_udc_release(struct de
struct usb_udc  *udc;
int ret = -ENOMEM;
 
-   udc = kzalloc(sizeof(*udc), GFP_KERNEL);
-   if (!udc)
-   goto err1;
-
dev_set_name(&gadget->dev, "gadget");
INIT_WORK(&gadget->work, usb_gadget_state_work);
gadget->dev.parent = parent;
@@ -1150,7 +1147,13 @@ int usb_add_gadget_udc_release(struct de
else
gadget->dev.release = usb_udc_nop_release;
 
-   ret = device_register(&gadget->dev);
+   device_initialize(&gadget->dev);
+
+   udc = kzalloc(sizeof(*udc), GFP_KERNEL);
+   if (!udc)
+   goto err1;
+
+   ret = device_add(&gadget->dev);
if (ret)
goto err2;
 
@@ -1197,10 +1200,10 @@ err3:
device_del(&gadget->dev);
 
 err2:
-   put_device(&gadget->dev);
kfree(udc);
 
 err1:
+   put_device(&gadget->dev);
return ret;
 }
 EXPORT_SYMBOL_GPL(usb_add_gadget_udc_release);

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


[PATCH 1/3] usb: dwc2: Improve gadget state disconnection handling

2017-08-17 Thread John Stultz
In the earlier commit dad3f793f20f ("usb: dwc2: Make sure we
disconnect the gadget state"), I was trying to fix up the
fact that we somehow weren't disconnecting the gadget state,
so that when the OTG port was plugged in the second time we
would get warnings about the state tracking being wrong.

The fix there was somewhat simple, as it just made sure to
call dwc2_hsotg_disconnect() before we connected things up
in OTG mode.

But in looking at a different issue I was seeing with UDC
state handling, I realized that it would be much better
to call dwc2_hsotg_disconnect when we get the state change
signal moving to host mode.

Thus, this patch removes the earlier disconnect call I added
and moves it (and the needed locking) to the host mode
transition.

Cc: Wei Xu 
Cc: Guodong Xu 
Cc: Amit Pundir 
Cc: YongQin Liu 
Cc: John Youn 
Cc: Minas Harutyunyan 
Cc: Douglas Anderson 
Cc: Chen Yu 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: linux-usb@vger.kernel.org
Signed-off-by: John Stultz 
---
 drivers/usb/dwc2/hcd.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 740c7e8..9fd84a9 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -3277,7 +3277,6 @@ static void dwc2_conn_id_status_change(struct work_struct 
*work)
dwc2_core_init(hsotg, false);
dwc2_enable_global_interrupts(hsotg);
spin_lock_irqsave(&hsotg->lock, flags);
-   dwc2_hsotg_disconnect(hsotg);
dwc2_hsotg_core_init_disconnected(hsotg, false);
spin_unlock_irqrestore(&hsotg->lock, flags);
dwc2_hsotg_core_connect(hsotg);
@@ -3296,8 +3295,13 @@ static void dwc2_conn_id_status_change(struct 
work_struct *work)
if (count > 250)
dev_err(hsotg->dev,
"Connection id status change timed out\n");
-   hsotg->op_state = OTG_STATE_A_HOST;
 
+   spin_lock_irqsave(&hsotg->lock, flags);
+   dwc2_hsotg_disconnect(hsotg);
+   dwc2_hsotg_core_init_disconnected(hsotg, false);
+   spin_unlock_irqrestore(&hsotg->lock, flags);
+
+   hsotg->op_state = OTG_STATE_A_HOST;
/* Initialize the Core for Host mode */
dwc2_core_init(hsotg, false);
dwc2_enable_global_interrupts(hsotg);
-- 
2.7.4

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


[PATCH 2/3] usb: dwc2: Fix UDC state tracking

2017-08-17 Thread John Stultz
It has been noticed that the dwc2 udc state reporting doesn't
seem to work (at least on HiKey boards). Where after the initial
setup, the sysfs /sys/class/udc/f72c.usb/state file would
report "configured" no matter the state of the OTG port.

This patch adds a call so that we report to the UDC layer when
the gadget device is disconnected.

Cc: Wei Xu 
Cc: Guodong Xu 
Cc: Amit Pundir 
Cc: YongQin Liu 
Cc: John Youn 
Cc: Minas Harutyunyan 
Cc: Douglas Anderson 
Cc: Chen Yu 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: linux-usb@vger.kernel.org
Reported-by: Amit Pundir 
Signed-off-by: John Stultz 
---
 drivers/usb/dwc2/gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index c4066cd..e6f2cd8 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3202,6 +3202,8 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
 
call_gadget(hsotg, disconnect);
hsotg->lx_state = DWC2_L3;
+
+   usb_gadget_set_state(&hsotg->gadget, USB_STATE_NOTATTACHED);
 }
 
 /**
-- 
2.7.4

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


[PATCH 3/3] usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode

2017-08-17 Thread John Stultz
We've found that while in host mode, using Android, if one runs
the command:
  stop adbd

The existing usb devices being utilized in host mode are disconnected.
This is most visible with usb networking devices.

This seems to be due to adbd closing the file:
  /dev/usb-ffs/adb/ep0
Which calls ffs_ep0_release() and the following backtrace:

[] dwc2_hsotg_ep_disable+0x148/0x150
[] dwc2_hsotg_udc_stop+0x60/0x110
[] usb_gadget_remove_driver+0x58/0x78
[] usb_gadget_unregister_driver+0x74/0xe8
[] unregister_gadget+0x28/0x58
[] unregister_gadget_item+0x2c/0x40
[] ffs_data_clear+0xe8/0xf8
[] ffs_data_reset+0x20/0x58
[] ffs_data_closed+0x98/0xe8
[] ffs_ep0_release+0x20/0x30

Then when dwc2_hsotg_ep_disable() is called, we call
kill_all_requests() which causes a bunch of the following
messages:

dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode
init: Service 'adbd' (pid 1915) killed by signal 9
init: Sending signal 9 to service 'adbd' (pid 1915) process group...
init: Successfully killed process cgroup uid 0 pid 1915 in 0ms
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15)
dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason 
is unknown
dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029
dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason 
is unknown
dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029
dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason 
is unknown
dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029
dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason 
is unknown
dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029
dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason 
is unknown
dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029
dwc2 f72c.usb: dwc2_update_urb_state_abn(): trimming xfer length

And the usb devices connected are basically hung at this point.

It seems like if we're in host mode, we probably shouldn't run
the dwc2_hostg_ep_disable logic, so this patch returns an error
in that case.

With this patch (along with the two previous patches mailed out
earlier:
  https://lkml.org/lkml/2017/8/3/1008
  https://lkml.org/lkml/2017/8/3/1010
), we avoid the mismatched interrupts and connected usb devices
continue to function.

I'm not sure if some other solution would be better here, but this seems
to work, so I wanted to send it out for input on what the right approach
should be.

Cc: Wei Xu 
Cc: Guodong Xu 
Cc: Amit Pundir 
Cc: YongQin Liu 
Cc: John Youn 
Cc: Minas Harutyunyan 
Cc: Douglas Anderson 
Cc: Chen Yu 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: linux-usb@vger.kernel.org
Reported-by: YongQin Liu 
Signed-off-by: John Stultz 
---
 drivers/usb/dwc2/gadget.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index e6f2cd8..61fb76f 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -4006,6 +4006,11 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep)
return -EINVAL;
}
 
+   if (hsotg->op_state != OTG_STATE_B_PERIPHERAL) {
+   dev_err(hsotg->dev, "%s: called in host mode?\n", __func__);
+   return -EINVAL;
+   }
+
epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);
 
spin_lock_irqsave(&hsotg->lock, flags);
-- 
2.7.4

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


Re: uvc-gadget for UVC testing doesn't seem to work with vivid

2017-08-17 Thread Rail Shafigulin
On Wed, Aug 16, 2017 at 12:03 AM, Felipe Balbi
 wrote:
>
> Hi,
>
> Rail Shafigulin  writes:
>>> Rail Shafigulin  writes:
 Let me apologize for emailing directly to the list as I'm not one of
 the developers and just starting out with USB and UVC. After searching
>>>
>>> the list is open to anybody and we welcome newcomers :-)
>>>
 online for about a week I just couldn't find answers and I hope the
 original authors of the uvc-gadget tool are on the list and can help
 out.

 Needed to test a UVC in a custom built kernel (Xilinx petalinux), .
 Followed these directions,
 https://github.com/torvalds/linux/blob/ef954844c7ace62f773f4f23e28d2d915adc419f/Documentation/usb/gadget-testing.txt#L717-L730.

 Patches didn't work. Had to look around for correct ones. Found them
 here, 
 http://markmail.org/message/hb7evzvigbuxptz5#query:+page:1+mid:s73fdeffjgb2v2yw+state:results.

 Combined and applied the patches into a repo here,
 https://github.com/cyboflash/uvc-gadget.git.

 When I ran a test command, given in the instructions above,
 uvc-gadget -u /dev/video -v /dev/video>>> #>

 got the following error:
 V4L2_CORE: (jpeg decoder) error while decoding frame

 and a black screen.

 One thing to note is that I was not using luvcview, but guvcview.

 It looks like the error is coming from here,
 https://sourceforge.net/p/guvcview/git-master/ci/master/tree/gview_v4l2core/jpeg_decoder.c#l1503

 My thoughts
 1. I don't think the error is coming from v4l2. I tested it on another
 machine and it worked. But I'm not an expert so I can't say for sure.
 2. I don't think the error is coming from UVC. I think since I see a
 black screen, it is working. Again, I'm not an expert, so I can't say
 for sure.
 3. I think the error is due to uvc-gadget test application. It could
 be that the applied patches are outdated, but I just didn't find
 anything else online. But, I'm not an expert so definitely can't say
 for sure.

 I would greatly appreciate any help with this as I'm just starting out
 with UVC and USB.
>>>
>>> Which kernel are you using? Which UDC driver are you using?
>>
>> Balbi,
>>
>> The board is configured as a USB Camera Gadget. Here is the output of uname 
>> -a
>> Linux Xilinx-ZCU102-2016_3 4.6.0 #33 SMP Thu Aug 10 11:47:57 PDT 2017
>> aarch64 GNU/Linux
>
> okay, then you need to ask for support from whoever gave you this
> kernel. 4.6 is a really old release which this forum doesn't support.
>
>> When you say UDC (USB Device Controller) driver, what exactly do you mean?
>
> which driver is g_webcam binding to? What do you have under
> /sys/class/udc ?

I have this under /sys/class/udc

fe20.dwc3

under /sys/class/udc/fe20.dwc3

a_alt_hnp_support  b_hnp_enable   device is_otg
 maximum_speed  srpsubsystem
a_hnp_support  current_speed  is_a_peripheral
is_selfpowered soft_connect   state  uevent

cat /sys/class/udc/fe20.dwc3/is_otg
0

cat /sys/class/udc/fe20.dwc3/is_a_peripheral
0

Given that I configured my board as a device, shouldn't those values be 0?

>
> [...]
>
>> Here is what I do on my board:
>>
>> modprobe g_webcam
>> modprobe vivid
>
> [...] I'm assuming it's this "vivid" driver which isn't in the upstream
> kernel and, again, we can't support :-s
>
> If this is part of an SDK, you've probably already paid for support from
> the vendor, I suggest you use their support channel.
>
> Best of luck
>
> --
> balbi



-- 
Rail Shafigulin
Software Engineer
Esencia Technologies

-- 




*ESENCIA TECHNOLOGIES, INC.*3945 Freedom Circle, Suite #360,
Santa Clara CA 95054


Phone: +1 408 736 8284 Fax: +1 408 519 3475 
http://www.esenciatech.com | http://www.lnttechservices.com


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


Re: This is probably crazy

2017-08-17 Thread Alan Stern
On Thu, 17 Aug 2017, Steven Timms wrote:

> I've just re-done them just in case it was wrong the first time. I wasn't
> sure if 'control' was fresh data as the clear command didn't seem to do
> anything. Plus the file size seems the same even on the second attempt (I'm
> not knowledgeable enough to know if this is correct)
> 
> Hope all is good, thx again
> 
> On Thu, Aug 17, 2017 at 6:33 PM, Steven Timms 
> wrote:
> 
> > Thanks Alan,
> >
> > I hope I've done this correctly. The control file got pretty large even
> > though it was a few seconds.

I guess the device you're concerned about is either the C-1U made by
BEHRINGER or else the Audiolab M-DAC made by Lakewest Audio, since
those are the only USB audio devices in your listings.

The thing is, both of those devices are attached to bus 3, which is 
connected to an xHCI controller.  Buses 1 and 2, by contrast, are 
connected to EHCI controllers.

This means that no matter what changes you make to the ehci-hcd driver, 
it won't have any effect at all on how your audio devices behave.  It 
should be easy enough to verify this -- just boot into an unpatched 
kernel, leaving everything else the same, and see what happens when you 
use the audio devices.

The situation would be different if you plugged the DAC into a USB-2
port instead of a USB-3 port.  If you do try this, and you run the
tests again, note that you did not follow my instructions for the
second test correctly.  In that test, I asked you to post the output
from the "dmesg" command, not the contents of
/sys/kernel/debug/dynamic_debug/control.

Alan Stern

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


Re: [PATCH] usb: dwc3: of-simple: remove include of clk-provider.h

2017-08-17 Thread Stephen Boyd
On 08/13, Shawn Guo wrote:
> From: Shawn Guo 
> 
> The header clk-provider.h is there for clock drivers (providers) to
> include, not client drivers (consumers).  That said,
> of_clk_get_parent_count() is a helper function for clock providers, not
> a clk API for consumers.
> 
> Let's replace of_clk_get_parent_count() with of_count_phandle_with_args()
> call, so that we can remove the include of clk-provider.h.
> 
> Signed-off-by: Shawn Guo 
> ---

Acked-by: Stephen Boyd 

-- 
Qualcomm Innovation Center, Inc. is a member of 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/3] power: wm831x_power: Support USB charger current limit management

2017-08-17 Thread Rob Herring
On Tue, Aug 15, 2017 at 07:07:55PM +0800, Baolin Wang wrote:
> Integrate with the newly added USB charger interface to limit the current
> we draw from the USB input based on the input device configuration
> identified by the USB stack, allowing us to charge more quickly from high
> current inputs without drawing more current than specified from others.
> 
> Signed-off-by: Mark Brown 
> Signed-off-by: Baolin Wang 
> Acked-by: Lee Jones 
> Acked-by: Charles Keepax 
> Acked-by: Sebastian Reichel 
> ---
>  Documentation/devicetree/bindings/mfd/wm831x.txt |1 +

Acked-by: Rob Herring 

>  drivers/power/supply/wm831x_power.c  |   72 
> ++
>  2 files changed, 73 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties

2017-08-17 Thread Rob Herring
On Wed, Aug 16, 2017 at 04:54:08PM -0500, Franklin S Cooper Jr wrote:
> Update various properties to properly indicate their requirement depending
> on the SoC.
> 
> Signed-off-by: Franklin S Cooper Jr 
> ---
> Version 2:
> Clarify clock requirements in binding document
> 
>  Documentation/devicetree/bindings/usb/keystone-usb.txt | 17 +++--
>  1 file changed, 15 insertions(+), 2 deletions(-)

Acked-by: Rob Herring 

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


[PATCH] USB: serial: ti_usb_3410_5052: Port uart_mode from io_ti.

2017-08-17 Thread Stuart Longland
This introduces the `uart_mode` sysfs attribute as seen in the `io_ti`
USB serial driver, allowing this USB serial interface to be switched
between RS-232, 2-wire RS-485 and 4-wire RS-485.

/sys/class/tty/ttyUSB${num}/device/uart takes a single integer:

0:  RS-232 mode (default for RS-232-compatible dongles)
1:  RS-485 2w mode (default for RS-485-only dongles)
2:  RS-485 4w mode / RS-422 mode

Write this *before* opening your serial device.

This has been successfully tested on a Moxa UPort 1150 in 4-wire RS-485
mode.

Signed-off-by: Stuart Longland 
---
 drivers/usb/serial/ti_usb_3410_5052.c | 48 +++
 1 file changed, 48 insertions(+)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
index 8fc3854e5e69..fb30d7ff32d7 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -514,6 +514,46 @@ MODULE_DEVICE_TABLE(usb, ti_id_table_combined);
 
 module_usb_serial_driver(serial_drivers, ti_id_table_combined);
 
+/* Sysfs Attributes */
+
+static ssize_t uart_mode_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct usb_serial_port *port = to_usb_serial_port(dev);
+   struct ti_port *tport = usb_get_serial_port_data(port);
+
+   return sprintf(buf, "%d\n", tport->tp_uart_mode);
+}
+
+static ssize_t uart_mode_store(struct device *dev,
+   struct device_attribute *attr, const char *valbuf, size_t count)
+{
+   struct usb_serial_port *port = to_usb_serial_port(dev);
+   struct ti_port *tport = usb_get_serial_port_data(port);
+   unsigned int v = simple_strtoul(valbuf, NULL, 0);
+
+   dev_dbg(dev, "%s: setting uart_mode = %d\n", __func__, v);
+
+   if (v < 256)
+   tport->tp_uart_mode = v;
+   else
+   dev_err(dev, "%s - uart_mode %d is invalid\n", __func__, v);
+
+   return count;
+}
+static DEVICE_ATTR_RW(uart_mode);
+
+static int ti_create_sysfs_attrs(struct usb_serial_port *port)
+{
+   return device_create_file(&port->dev, &dev_attr_uart_mode);
+}
+
+static int ti_remove_sysfs_attrs(struct usb_serial_port *port)
+{
+   device_remove_file(&port->dev, &dev_attr_uart_mode);
+   return 0;
+}
+
 static int ti_startup(struct usb_serial *serial)
 {
struct ti_device *tdev;
@@ -607,6 +647,7 @@ static void ti_release(struct usb_serial *serial)
 static int ti_port_probe(struct usb_serial_port *port)
 {
struct ti_port *tport;
+   int status;
 
tport = kzalloc(sizeof(*tport), GFP_KERNEL);
if (!tport)
@@ -628,6 +669,12 @@ static int ti_port_probe(struct usb_serial_port *port)
 
usb_set_serial_port_data(port, tport);
 
+   status = ti_create_sysfs_attrs(port);
+   if (status) {
+   kfree(tport);
+   return status;
+   }
+
port->port.drain_delay = 3;
 
return 0;
@@ -638,6 +685,7 @@ static int ti_port_remove(struct usb_serial_port *port)
struct ti_port *tport;
 
tport = usb_get_serial_port_data(port);
+   ti_remove_sysfs_attrs(port);
kfree(tport);
 
return 0;
-- 
2.13.0

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


Re: [PATCH] USB: serial: ti_usb_3410_5052: Port uart_mode from io_ti.

2017-08-17 Thread Stuart Longland
Hi all,

On 18/08/17 12:56, Stuart Longland wrote:
> This introduces the `uart_mode` sysfs attribute as seen in the `io_ti`
> USB serial driver, allowing this USB serial interface to be switched
> between RS-232, 2-wire RS-485 and 4-wire RS-485.
> 
> /sys/class/tty/ttyUSB${num}/device/uart takes a single integer:
… and of course, I meant 'uart_mode' here, not 'uart'.

> 
>   0:  RS-232 mode (default for RS-232-compatible dongles)
>   1:  RS-485 2w mode (default for RS-485-only dongles)
>   2:  RS-485 4w mode / RS-422 mode

This is of course, not a very elegant solution, but it gets me out of a
bind for now and at least gets the RS-485 functionality of this USB
serial dongle working.

Long term, I think the earlier ideas of expanding the RS-485 related
ioctls should be pursued.  I'm open to ideas here.

Regards,
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.



signature.asc
Description: OpenPGP digital signature


[PATCH] usb: xhci: Renesas uPD720202 needs short TX quirk

2017-08-17 Thread Kai-Heng Feng
When plugging Logitech C920 webcam, warning messages filled up dmesg:
[77117.655018] xhci_hcd :0c:00.0: WARN Successful completion on short TX: 
needs XHCI_TRUST_TX_LENGTH quirk?
[77117.659018] xhci_hcd :0c:00.0: WARN Successful completion on short TX: 
needs XHCI_TRUST_TX_LENGTH quirk?
[77122.622952] handle_tx_event: 541 callbacks suppressed

No more warning messages with XHCI_TRUST_TX_LENGTH applied.

BugLink: https://bugs.launchpad.net/bugs/1710548
Signed-off-by: Kai-Heng Feng 
---
 drivers/usb/host/xhci-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 8071c8fdd15e..8566b43e19ba 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -202,8 +202,10 @@ static void xhci_pci_quirks(struct device *dev, struct 
xhci_hcd *xhci)
xhci->quirks |= XHCI_BROKEN_STREAMS;
}
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
-   pdev->device == 0x0015)
+   pdev->device == 0x0015) {
xhci->quirks |= XHCI_RESET_ON_RESUME;
+   xhci->quirks |= XHCI_TRUST_TX_LENGTH;
+   }
if (pdev->vendor == PCI_VENDOR_ID_VIA)
xhci->quirks |= XHCI_RESET_ON_RESUME;
 
-- 
2.14.1

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


Re: [RFCv3 usb-next 2/3] usb: host: add a generic platform USB roothub driver

2017-08-17 Thread Chunfeng Yun
On Tue, 2017-08-15 at 00:45 +0200, Martin Blumenstingl wrote:
> Many SoC platforms have separate devices for the USB PHY which are
> registered through the generic PHY framework. These PHYs have to be
> enabled to make the USB controller actually work. They also have to be
> disabled again on shutdown/suspend.
> 
> Currently (at least) the following HCI platform drivers are using custom
> code to obtain all PHYs via devicetree for the roothub/controller and
> disable/enable them when required:
> - ehci-platform.c has ehci_platform_power_{on,off}
> - xhci-mtk.c has xhci_mtk_phy_{init,exit,power_on,power_off}
> - ohci-platform.c has ohci_platform_power_{on,off}
> 
> These drivers are not using the generic devicetree USB device bindings
> yet which were only introduced recently (documentation is available in
> devicetree/bindings/usb/usb-device.txt).
> With this new driver the usb2-phy and usb3-phy can be specified directly
> in the child-node of the corresponding port of the roothub via
> devicetree. This can be extended by not just parsing PHYs (some of the
> other drivers listed above are for example also parsing a list of clocks
> as well) when required.
> 
> Signed-off-by: Martin Blumenstingl 
> ---
>  drivers/usb/host/Kconfig|   3 +
>  drivers/usb/host/Makefile   |   2 +
>  drivers/usb/host/platform-roothub.c | 180 
> 
>  drivers/usb/host/platform-roothub.h |  12 +++
>  4 files changed, 197 insertions(+)
>  create mode 100644 drivers/usb/host/platform-roothub.c
>  create mode 100644 drivers/usb/host/platform-roothub.h
> 

Tested-by: Chunfeng Yun


> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index fa5692dec832..b8b05c786b2a 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -805,6 +805,9 @@ config USB_HCD_SSB
>  
> If unsure, say N.
>  
> +config USB_PLATFORM_ROOTHUB
> + bool
> +
>  config USB_HCD_TEST_MODE
>   bool "HCD test mode support"
>   ---help---
> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> index cf2691fffcc0..dc817f82d632 100644
> --- a/drivers/usb/host/Makefile
> +++ b/drivers/usb/host/Makefile
> @@ -29,6 +29,8 @@ obj-$(CONFIG_USB_WHCI_HCD)  += whci/
>  
>  obj-$(CONFIG_USB_PCI)+= pci-quirks.o
>  
> +obj-$(CONFIG_USB_PLATFORM_ROOTHUB)   += platform-roothub.o
> +
>  obj-$(CONFIG_USB_EHCI_HCD)   += ehci-hcd.o
>  obj-$(CONFIG_USB_EHCI_PCI)   += ehci-pci.o
>  obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)  += ehci-platform.o
> diff --git a/drivers/usb/host/platform-roothub.c 
> b/drivers/usb/host/platform-roothub.c
> new file mode 100644
> index ..70d2d97aa8b2
> --- /dev/null
> +++ b/drivers/usb/host/platform-roothub.c
> @@ -0,0 +1,180 @@
[...]


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


Re: [PATCH] usb: gadget: f_midi: Use snd_card_free_when_closed with refcount

2017-08-17 Thread Manu Gautam
Hi,


On 8/15/2017 2:44 AM, Jerry Zhang wrote:
> Currenly, f_midi_free uses snd_card_free, which will wait
> until the user has released the sound card before
> returning. However, if the user doesn't release the sound
> card, then f_midi_free can block for an arbitrary amount
> of time, which also blocks any gadget operations on that
> thread.
>
> Instead, we can use snd_card_free_when_closed which returns
> before all handles are released. Since f_midi can be
> accessed through rmidi if usb_put_function is called before
> release_card_device, add refcounting to f_midi_free and
> have rawmidi's private free call it. The f_midi memory
> is only kfreed when usb_put_function and release_card_device
> have both been called.
>
> Signed-off-by: Jerry Zhang 
> ---
>  drivers/usb/gadget/function/f_midi.c | 21 -
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_midi.c 
> b/drivers/usb/gadget/function/f_midi.c
> index a5719f271bf0..cf52ee2b7e93 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -98,6 +98,7 @@ struct f_midi {
>   DECLARE_KFIFO_PTR(in_req_fifo, struct usb_request *);
>   spinlock_t transmit_lock;
>   unsigned int in_last_port;
> + unsigned char free_ref;
>  
>   struct gmidi_in_portin_ports_array[/* in_ports */];
>  };
> @@ -818,6 +819,8 @@ static int f_midi_register_card(struct f_midi *midi)
>   SNDRV_RAWMIDI_INFO_INPUT |
>   SNDRV_RAWMIDI_INFO_DUPLEX;
>   rmidi->private_data = midi;
> + rmidi->private_free = f_midi_rmidi_free;
> + midi->free_ref++;
>  
>   /*
>* Yes, rawmidi OUTPUT = USB IN, and rawmidi INPUT = USB OUT.
> @@ -1197,14 +1200,21 @@ static void f_midi_free(struct usb_function *f)
>  
>   midi = func_to_midi(f);
>   opts = container_of(f->fi, struct f_midi_opts, func_inst);

opts could be freed as well if f_midi_free_inst already happened. Say another 
user
deleted midi instance  before pcm_file was released.

> - kfree(midi->id);
>   mutex_lock(&opts->lock);
> - kfifo_free(&midi->in_req_fifo);
> - kfree(midi);
> - --opts->refcnt;
> + if (!--midi->free_ref) {
> + kfree(midi->id);
> + kfifo_free(&midi->in_req_fifo);
> + kfree(midi);
> + --opts->refcnt;
> + }
>   mutex_unlock(&opts->lock);
>  }
>  
> +static void f_midi_rmidi_free(struct snd_rawmidi *rmidi)
> +{
> + f_midi_free(rmidi->private_data);
> +}
> +
>  static void f_midi_unbind(struct usb_configuration *c, struct usb_function 
> *f)
>  {
>   struct usb_composite_dev *cdev = f->config->cdev;
> @@ -1219,7 +1229,7 @@ static void f_midi_unbind(struct usb_configuration *c, 
> struct usb_function *f)
>   card = midi->card;
>   midi->card = NULL;
>   if (card)
> - snd_card_free(card);
> + snd_card_free_when_closed(card);
>  
>   usb_free_all_descriptors(f);
>  }
> @@ -1263,6 +1273,7 @@ static struct usb_function *f_midi_alloc(struct 
> usb_function_instance *fi)
>   midi->buflen = opts->buflen;
>   midi->qlen = opts->qlen;
>   midi->in_last_port = 0;
> + midi->free_ref = 1;
>  
>   status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL);
>   if (status)

-- 
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html