Re: [PATCH v3] USB: Force disconnect Huawei 4G modem during suspend

2017-10-23 Thread Daniel Drake
Hi Oliver,

On Wed, Oct 18, 2017 at 5:31 PM, Oliver Neukum  wrote:
> Am Mittwoch, den 18.10.2017, 15:15 +0800 schrieb Daniel Drake:
>> Notes:
>> v2:
>> - Handle quirk later in suspend, to avoid interfering with other parts
>>   of the suspend routine.
>> - Don't do the disconnect on runtime suspend, only for S3 suspend
>
> well, can we effectively runtime suspend these devices?

How can I test for effective runtime suspend?

> Furthermore, it seems to me that we indeed cannot do a runtime
> suspend on external devices needing this quirk, but what about
> internal devices?

In this case the modem is an internal device.

Daniel
--
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: goku_udc: mark expected switch fall-throughs

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 145713
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/gadget/udc/goku_udc.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index 8433c22..a85407e 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -127,11 +127,15 @@ goku_ep_enable(struct usb_ep *_ep, const struct 
usb_endpoint_descriptor *desc)
mode = 0;
max = get_unaligned_le16(>wMaxPacketSize);
switch (max) {
-   case 64:mode++;
-   case 32:mode++;
-   case 16:mode++;
-   case 8: mode <<= 3;
-   break;
+   case 64:
+   mode++; /* fall through */
+   case 32:
+   mode++; /* fall through */
+   case 16:
+   mode++; /* fall through */
+   case 8:
+   mode <<= 3;
+   break;
default:
return -EINVAL;
}
-- 
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] usb: gadget: serial: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1350962
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/gadget/function/u_serial.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/function/u_serial.c 
b/drivers/usb/gadget/function/u_serial.c
index 4176216..961457e 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1078,6 +1078,7 @@ static void gs_complete_out(struct usb_ep *ep, struct 
usb_request *req)
default:
pr_warn("%s: unexpected %s status %d\n",
__func__, ep->name, req->status);
+   /* fall through */
case 0:
/* normal completion */
spin_lock(>con_lock);
-- 
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] usb: musb_core: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1397608
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/musb/musb_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index ff5a1a8..889ca9b 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -767,6 +767,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
case OTG_STATE_B_IDLE:
if (!musb->is_active)
break;
+   /* fall through */
case OTG_STATE_B_PERIPHERAL:
musb_g_suspend(musb);
musb->is_active = musb->g.b_hnp_enable;
-- 
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] usb: gadget: f_tcm: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 703128
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/gadget/function/f_tcm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/function/f_tcm.c 
b/drivers/usb/gadget/function/f_tcm.c
index a82e2bd..c9d741d 100644
--- a/drivers/usb/gadget/function/f_tcm.c
+++ b/drivers/usb/gadget/function/f_tcm.c
@@ -1145,6 +1145,7 @@ static int usbg_submit_command(struct f_uas *fu,
default:
pr_debug_once("Unsupported prio_attr: %02x.\n",
cmd_iu->prio_attr);
+   /* fall through */
case UAS_SIMPLE_TAG:
cmd->prio_attr = TCM_SIMPLE_TAG;
break;
-- 
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] usb: core: urb: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1162594
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/core/urb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 8b800e3..06e0151 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -514,6 +514,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
if ((urb->interval < 6)
&& (xfertype == USB_ENDPOINT_XFER_INT))
return -EINVAL;
+   /* fall through */
default:
if (urb->interval <= 0)
return -EINVAL;
-- 
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] usb: image: mdc800: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/image/mdc800.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index e92540a..185c4e2 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -893,6 +893,7 @@ static ssize_t mdc800_device_write (struct file *file, 
const char __user *buf, s
return -EIO;
}
mdc800->pic_len=-1;
+   /* fall through */
 
case 0x09: /* Download Thumbnail */
mdc800->download_left=answersize+64;
-- 
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] usb: phy: phy-msm-usb: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1222118
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/phy/phy-msm-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 3d0dd2f..8bc3403 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1261,6 +1261,7 @@ static void msm_chg_detect_work(struct work_struct *w)
/* fall through */
case USB_CHG_STATE_SECONDARY_DONE:
motg->chg_state = USB_CHG_STATE_DETECTED;
+   /* fall through */
case USB_CHG_STATE_DETECTED:
msm_chg_block_off(motg);
dev_dbg(phy->dev, "charger = %d\n", motg->chg_type);
-- 
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] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals

2017-10-23 Thread Chunfeng Yun
When system is running, if usb2 phy is forced to bypass utmi signals,
all PLL will be turned off, and it can't detect device connection
anymore, so replace force mode with auto mode which can bypass utmi
signals automatically if no device attached for normal flow.
But keep the force mode to fix RX sensitivity degradation issue.

Signed-off-by: Chunfeng Yun 
---
 drivers/phy/mediatek/phy-mtk-tphy.c |   19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c 
b/drivers/phy/mediatek/phy-mtk-tphy.c
index 402385f..54cc44b 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
u32 index = instance->index;
u32 tmp;
 
-   /* switch to USB function. (system register, force ip into usb mode) */
+   /* switch to USB function, and enable usb pll */
tmp = readl(com + U3P_U2PHYDTM0);
-   tmp &= ~P2C_FORCE_UART_EN;
+   tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
writel(tmp, com + U3P_U2PHYDTM0);
 
@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
u32 index = instance->index;
u32 tmp;
 
-   /* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
tmp = readl(com + U3P_U2PHYDTM0);
-   tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
-   tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
+   tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
writel(tmp, com + U3P_U2PHYDTM0);
 
/* OTG Enable */
@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 
tmp = readl(com + U3P_U2PHYDTM0);
tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
-   tmp |= P2C_FORCE_SUSPENDM;
writel(tmp, com + U3P_U2PHYDTM0);
 
/* OTG Disable */
@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy 
*tphy,
tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
writel(tmp, com + U3P_USBPHYACR6);
 
-   /* let suspendm=0, set utmi into analog power down */
-   tmp = readl(com + U3P_U2PHYDTM0);
-   tmp &= ~P2C_RG_SUSPENDM;
-   writel(tmp, com + U3P_U2PHYDTM0);
-   udelay(1);
-
tmp = readl(com + U3P_U2PHYDTM1);
tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
tmp |= P2C_RG_SESSEND;
writel(tmp, com + U3P_U2PHYDTM1);
 
if (tphy->pdata->avoid_rx_sen_degradation && index) {
+   tmp = readl(com + U3P_U2PHYDTM0);
+   tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
+   writel(tmp, com + U3P_U2PHYDTM0);
+
tmp = readl(com + U3D_U2PHYDCR0);
tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
writel(tmp, com + U3D_U2PHYDCR0);
-- 
1.7.9.5

--
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] drivers/net/usb: add device id for TP-LINK UE300 USB 3.0 Ethernet

2017-10-23 Thread Ran Wang
Hi Oliver
> -Original Message-
> From: Oliver Neukum [mailto:oneu...@suse.com]
> Sent: Monday, October 23, 2017 6:56 PM
> To: Ran Wang 
> Cc: David S . Miller ; hayeswang
> ; linux-ker...@vger.kernel.org; linux-
> u...@vger.kernel.org; net...@vger.kernel.org
> Subject: Re: [PATCH] drivers/net/usb: add device id for TP-LINK UE300 USB
> 3.0 Ethernet
> 
> Am Montag, den 23.10.2017, 18:10 +0800 schrieb Ran Wang:
> > This product is named 'TP-LINK USB 3.0 Gigabit Ethernet Network
> > Adapter (Model No.is UE300)'. It uses chip RTL8153 and works with
> > driver drivers/net/usb/r8152.c
> >
> 
> Hi,
> 
> just for the record, have you confirm that it fails with cdc-ether?
> 

Yes, when I use default cdc-ether and do data transfer test, I see system 
flooding message 
'[ 1076.627366] cdc_ether 4-1:2.0 eth8: kevent 11 may have been dropped' and 
related eth#
Shows most packets received has been dropped. After load r8152.c, everything 
work fine.
BR
Ran
>   Regards
>   Oliver



Re: [PATCH v7 usb-next 2/4] usb: core: add a wrapper for the USB PHYs on the root-hub

2017-10-23 Thread Chunfeng Yun
On Mon, 2017-10-23 at 23:57 +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
> (for the root-hub) yet which were only introduced recently (documentation
> is available in devicetree/bindings/usb/usb-device.txt).
> 
> With this new wrapper the usb2-phy and usb3-phy can be specified directly
> in the child-node of the corresponding port of the roothub via
> devicetree.
> This allows SoCs like the Amlogic Meson GXL family to operate correctly
> because all USB PHYs are initialized (instead of the first USB PHY
> only).
> 
> Signed-off-by: Martin Blumenstingl 
> Tested-by: Neil Armstrong 
> ---
>  drivers/usb/core/Makefile |   2 +-
>  drivers/usb/core/phy.c| 176 
> ++
>  drivers/usb/core/phy.h|   7 ++
>  3 files changed, 184 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/usb/core/phy.c
>  create mode 100644 drivers/usb/core/phy.h
> 
> diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
> index 250ec1d662d9..b6e181d08bf6 100644
> --- a/drivers/usb/core/Makefile
> +++ b/drivers/usb/core/Makefile
> @@ -5,7 +5,7 @@
>  usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o
>  usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
>  usbcore-y += devio.o notify.o generic.o quirks.o devices.o
> -usbcore-y += port.o
> +usbcore-y += phy.o port.o
>  
>  usbcore-$(CONFIG_OF) += of.o
>  usbcore-$(CONFIG_USB_PCI)+= hcd-pci.o
> diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
> new file mode 100644
> index ..31245b4abdbf
> --- /dev/null
> +++ b/drivers/usb/core/phy.c
...
> diff --git a/drivers/usb/core/phy.h b/drivers/usb/core/phy.h
> new file mode 100644
> index ..6fde59bfbff8
> --- /dev/null
> +++ b/drivers/usb/core/phy.h
> @@ -0,0 +1,7 @@
> +struct usb_phy_roothub;
> +
> +struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev);
> +int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub);
> +
> +int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub);
> +void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub);

Tested-by: Chunfeng Yun 
Acked-by: Chunfeng Yun  



--
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 v7 usb-next 3/4] usb: core: hcd: integrate the PHY roothub wrapper

2017-10-23 Thread Chunfeng Yun
On Mon, 2017-10-23 at 23:57 +0200, Martin Blumenstingl wrote:
> This integrates the PHY roothub wrapper into the core hcd
> infrastructure. Multiple PHYs which are part of the roothub devicetree
> node (which is a sub-node of the sysdev's node) are now managed
> (= powered on/off when needed), by the new usb_phy_roothub code.
> 
> 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 
> Tested-by: Neil Armstrong 
> Acked-by: Alan Stern 
> ---
>  drivers/usb/core/hcd.c  | 26 ++
>  include/linux/usb/hcd.h |  1 +
>  2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 67aa3d039b9b..6ee97222cdad 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -50,6 +50,7 @@
>  #include 
>  
>  #include "usb.h"
> +#include "phy.h"
>  
> 
>  /*-*/
> @@ -2271,6 +2272,8 @@ int hcd_bus_suspend(struct usb_device *rhdev, 
> pm_message_t msg)
>   usb_set_device_state(rhdev, USB_STATE_SUSPENDED);
>   hcd->state = HC_STATE_SUSPENDED;
>  
> + usb_phy_roothub_power_off(hcd->phy_roothub);
> +
>   /* Did we race with a root-hub wakeup event? */
>   if (rhdev->do_remote_wakeup) {
>   charbuffer[6];
> @@ -2307,6 +2310,11 @@ int hcd_bus_resume(struct usb_device *rhdev, 
> pm_message_t msg)
>   dev_dbg(>dev, "skipped %s of dead bus\n", "resume");
>   return 0;
>   }
> +
> + status = usb_phy_roothub_power_on(hcd->phy_roothub);
> + if (status)
> + return status;
> +
>   if (!hcd->driver->bus_resume)
>   return -ENOENT;
>   if (HCD_RH_RUNNING(hcd))
> @@ -2344,6 +2352,7 @@ int hcd_bus_resume(struct usb_device *rhdev, 
> pm_message_t msg)
>   }
>   } else {
>   hcd->state = old_state;
> + usb_phy_roothub_power_off(hcd->phy_roothub);
>   dev_dbg(>dev, "bus %s fail, err %d\n",
>   "resume", status);
>   if (status != -ESHUTDOWN)
> @@ -2780,6 +2789,16 @@ int usb_add_hcd(struct usb_hcd *hcd,
>   }
>   }
>  
> + hcd->phy_roothub = usb_phy_roothub_init(hcd->self.sysdev);
> + if (IS_ERR(hcd->phy_roothub)) {
> + retval = PTR_ERR(hcd->phy_roothub);
> + goto err_phy_roothub_init;
> + }
> +
> + retval = usb_phy_roothub_power_on(hcd->phy_roothub);
> + if (retval)
> + goto err_usb_phy_roothub_power_on;
> +
>   dev_info(hcd->self.controller, "%s\n", hcd->product_desc);
>  
>   /* Keep old behaviour if authorized_default is not in [0, 1]. */
> @@ -2944,6 +2963,10 @@ int usb_add_hcd(struct usb_hcd *hcd,
>  err_register_bus:
>   hcd_buffer_destroy(hcd);
>  err_create_buf:
> + usb_phy_roothub_power_off(hcd->phy_roothub);
> +err_usb_phy_roothub_power_on:
> + usb_phy_roothub_exit(hcd->phy_roothub);
> +err_phy_roothub_init:
>   if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {
>   phy_power_off(hcd->phy);
>   phy_exit(hcd->phy);
> @@ -3028,6 +3051,9 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>   usb_deregister_bus(>self);
>   hcd_buffer_destroy(hcd);
>  
> + usb_phy_roothub_power_off(hcd->phy_roothub);
> + usb_phy_roothub_exit(hcd->phy_roothub);
> +
>   if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {
>   phy_power_off(hcd->phy);
>   phy_exit(hcd->phy);
> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> index a1f03ebfde47..6915b2afc209 100644
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -103,6 +103,7 @@ struct usb_hcd {
>*/
>   struct usb_phy  *usb_phy;
>   struct phy  *phy;
> + struct usb_phy_roothub  *phy_roothub;
>  
>   /* Flags that need to be manipulated atomically because they can
>* change while the host controller is running.  Always use

Tested-by: Chunfeng Yun 
Acked-by: Chunfeng Yun 



--
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: dwc2: usb: Unable to clear channel error

2017-10-23 Thread Dinh Nguyen


On 10/23/2017 09:03 AM, Minas Harutyunyan wrote:
> On 10/19/2017 5:35 PM, Dinh Nguyen wrote:
>>
>>
>> On 10/19/2017 06:55 AM, Grigor Tovmasyan wrote:
>>> On 10/18/2017 6:07 PM, Marek Vasut wrote:
 On 10/18/2017 04:05 PM, Dinh Nguyen wrote:
> Hi,
>
> I'm trying to bringup the DWC2 USB IP version 330A on a new Stratix10
> SoC and have encountered this error in both Linux and U-Boot:
>
> U-Boot(version v2017.09)
>
> # usb start
> starting USB...
> USB0:   Core Release: 3.30a
> dwc_otg_core_host_init: Timeout!
> dwc_otg_core_host_init: Timeout!
>
> Linux(kernel v4.13)
>
> [1.299891] dwc2 ffb0.usb: DWC OTG Controller
> [1.304628] dwc2 ffb0.usb: new USB bus registered, assigned bus
> number 1
> [1.311698] dwc2 ffb0.usb: irq 13, io mem 0xffb0
> [1.318309] dwc2 ffb0.usb: Unable to clear enable on channel 0
> [1.325749] dwc2 ffb0.usb: Unable to clear enable on channel 1
> [1.333187] dwc2 ffb0.usb: Unable to clear enable on channel 2
> [1.340626] dwc2 ffb0.usb: Unable to clear enable on channel 3
> [1.348064] dwc2 ffb0.usb: Unable to clear enable on channel 4
> [1.355503] dwc2 ffb0.usb: Unable to clear enable on channel 5
> [1.362941] dwc2 ffb0.usb: Unable to clear enable on channel 6
> [1.370379] dwc2 ffb0.usb: Unable to clear enable on channel 7
> [1.377818] dwc2 ffb0.usb: Unable to clear enable on channel 8
> [1.385256] dwc2 ffb0.usb: Unable to clear enable on channel 9
> [1.392694] dwc2 ffb0.usb: Unable to clear enable on channel 10
> [1.400218] dwc2 ffb0.usb: Unable to clear enable on channel 11
> [1.407743] dwc2 ffb0.usb: Unable to clear enable on channel 12
> [1.415269] dwc2 ffb0.usb: Unable to clear enable on channel 13
> [1.422794] dwc2 ffb0.usb: Unable to clear enable on channel 14
>
> Just wondering if anyone might have an idea on what could be causing
> this error?

 Maybe some clock are not enabled ?

>>>
>>> Hi ,
>>>
>>> Are you following board/hisilicon/hikey/README file instructions when
>>> using U-Boot? Specially paragraph FLASHING point 4, where discussed
>>> "dwc_otg_core_host_init: Timeout!" message.
>>>
>>
>> I saw that, but I don't know how that applies to a Stratix10 platform?
>>
>> Dinh
>>
>>
> Hi,
> 
> Did you able to resolve this issue? If not, please provide verbose debug 
> log and register dump.
> 

I double-checked the clocks and it looks like all of the necessary
clocks are enabled. Here are the log and register dump for U-Boot, I'll
follow-up with the Linux log shortly.

For U-Boot:

SOCFPGA_STRATIX10 # usb start
starting USB...
USB0:   Core Release: 3.30a
dwc_otg_core_host_init: Timeout (reg=ffb00500 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00520 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00540 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00560 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00580 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb005a0 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb005c0 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb005e0 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00600 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00620 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00640 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00660 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb00680 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb006a0 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
dwc_otg_core_host_init: Timeout (reg=ffb006c0 mask=8000
wait_set=0)
dwc_otg_core_host_init: Timeout!
scanning bus 0 for devices... dwc2_submit_control_msg:
dev='usb@ffb0', udev=3fa50380, udev->dev='usb@ffb0',
portnr=0
dwc2_submit_control_msg: dev='usb@ffb0', udev=3fa50380,
udev->dev='usb@ffb0', portnr=0
dwc2_submit_control_msg: dev='usb@ffb0', udev=3fa50380,
udev->dev='usb@ffb0', portnr=0
dwc2_submit_control_msg: dev='usb@ffb0', udev=3fa50380,
udev->dev='usb@ffb0', portnr=0

[PATCH v3 1/2] usb: max3421: Add devicetree support

2017-10-23 Thread Jules Maselbas
Adds support for devicetree to the max3421 driver.

Signed-off-by: Jules Maselbas 
---
 drivers/usb/host/max3421-hcd.c | 75 +-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 0ece9a9341e5..d77b3f27c6e7 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -60,6 +60,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -85,6 +86,8 @@
  USB_PORT_STAT_C_OVERCURRENT | \
  USB_PORT_STAT_C_RESET) << 16)
 
+#define MAX3421_GPOUT_COUNT8
+
 enum max3421_rh_state {
MAX3421_RH_RESET,
MAX3421_RH_SUSPENDED,
@@ -1672,7 +1675,7 @@ max3421_gpout_set_value(struct usb_hcd *hcd, u8 
pin_number, u8 value)
u8 mask, idx;
 
--pin_number;
-   if (pin_number > 7)
+   if (pin_number >= MAX3421_GPOUT_COUNT)
return;
 
mask = 1u << (pin_number % 4);
@@ -1831,11 +1834,35 @@ static const struct hc_driver max3421_hcd_desc = {
.bus_resume =   max3421_bus_resume,
 };
 
+static int
+max3421_of_vbus_en_pin(struct device *dev, struct max3421_hcd_platform_data 
*pdata)
+{
+   int retval;
+   uint32_t value[2];
+
+   if (!pdata)
+   return -EINVAL;
+
+   retval = of_property_read_u32_array(dev->of_node, "maxim,vbus-en-pin", 
value, 2);
+   if (retval) {
+   dev_err(dev, "device tree node property 'maxim,vbus-en-pin' is 
missing\n");
+   return retval;
+   }
+   dev_info(dev, "property 'maxim,vbus-en-pin' value is <%d %d>\n", 
value[0], value[1]);
+
+   pdata->vbus_gpout = value[0];
+   pdata->vbus_active_level = value[1];
+
+   return 0;
+}
+
 static int
 max3421_probe(struct spi_device *spi)
 {
+   struct device *dev = >dev;
struct max3421_hcd *max3421_hcd;
struct usb_hcd *hcd = NULL;
+   struct max3421_hcd_platform_data *pdata = NULL;
int retval = -ENOMEM;
 
if (spi_setup(spi) < 0) {
@@ -1843,6 +1870,40 @@ max3421_probe(struct spi_device *spi)
return -EFAULT;
}
 
+   if (!spi->irq) {
+   dev_err(dev, "Failed to get SPI IRQ");
+   return -EFAULT;
+   }
+
+   if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   retval = -ENOMEM;
+   goto error;
+   }
+   retval = max3421_of_vbus_en_pin(dev, pdata);
+   if (retval)
+   goto error;
+   spi->dev.platform_data = pdata;
+   }
+
+   pdata = dev->platform_data;
+   if (!pdata) {
+   dev_err(dev, "driver configuration data is not provided\n");
+   retval = -EFAULT;
+   goto error;
+   }
+   if (pdata->vbus_active_level > 1) {
+   dev_err(dev, "vbus active level value %d is out of range 
(0/1)\n", pdata->vbus_active_level);
+   retval = -EINVAL;
+   goto error;
+   }
+   if (pdata->vbus_gpout < 1 || pdata->vbus_gpout > MAX3421_GPOUT_COUNT) {
+   dev_err(dev, "vbus gpout value %d is out of range (1..8)\n", 
pdata->vbus_gpout);
+   retval = -EINVAL;
+   goto error;
+   }
+
hcd = usb_create_hcd(_hcd_desc, >dev,
 dev_name(>dev));
if (!hcd) {
@@ -1885,6 +1946,11 @@ max3421_probe(struct spi_device *spi)
return 0;
 
 error:
+   if (IS_ENABLED(CONFIG_OF) && dev->of_node && pdata) {
+   devm_kfree(>dev, pdata);
+   spi->dev.platform_data = NULL;
+   }
+
if (hcd) {
kfree(max3421_hcd->tx);
kfree(max3421_hcd->rx);
@@ -1929,11 +1995,18 @@ max3421_remove(struct spi_device *spi)
return 0;
 }
 
+static const struct of_device_id max3421_of_match_table[] = {
+   { .compatible = "maxim,max3421", },
+   {},
+};
+MODULE_DEVICE_TABLE(of, max3421_of_match_table);
+
 static struct spi_driver max3421_driver = {
.probe  = max3421_probe,
.remove = max3421_remove,
.driver = {
.name   = "max3421-hcd",
+   .of_match_table = of_match_ptr(max3421_of_match_table),
},
 };
 
-- 
2.14.2

--
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 v3 2/2] dt-bindings: max3421: Add bindings documentation

2017-10-23 Thread Jules Maselbas
Adds bindings documentation for the max3421 driver.

Signed-off-by: Jules Maselbas 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/usb/maxim,max3421.txt  | 25 ++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/maxim,max3421.txt

diff --git a/Documentation/devicetree/bindings/usb/maxim,max3421.txt 
b/Documentation/devicetree/bindings/usb/maxim,max3421.txt
new file mode 100644
index ..5c699e52ce3f
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/maxim,max3421.txt
@@ -0,0 +1,25 @@
+Maxim Integrated SPI-based USB 2.0 host controller MAX3421E
+
+Required properties:
+ - compatible: Should be "maxim,max3421"
+ - spi-max-frequency: maximum frequency for this device must not exceed 26 MHz.
+ - reg: chip select number to which this device is connected.
+ - maxim,vbus-en-pin: 
+   GPOUTx is the number (1-8) of the GPOUT pin of MAX3421E to drive Vbus.
+   ACTIVE_LEVEL is 0 or 1.
+ - interrupts: the interrupt line description for the interrupt controller.
+   The driver configures MAX3421E for active low level triggered interrupts,
+   configure your interrupt line accordingly.
+
+Optional property:
+ - interrupt-parent: the phandle to the associated interrupt controller.
+
+Example:
+   usb@0 {
+   compatible = "maxim,max3421";
+   reg = <0>;
+   maxim,vbus-en-pin = <3 1>;
+   spi-max-frequency = <2600>;
+   interrupt-parent = <>;
+   interrupts = <42>;
+   };
-- 
2.14.2

--
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 v3 0/2] max3421: add devicetree support

2017-10-23 Thread Jules Maselbas
Hi,

This patchset adds devicetree support to the max3421 driver.
Theses modification are based on a previous (unapplied) patch
series by Alexander Amelkin [1].

Changes in v3:
 * Documentation modification, interrupt-parent is optional.

Changes in v2:
 * The platform_data is no longer freed in max3421_remove() as it is
   allocated with devm_kzalloc.
 * Removed the dev_err print if devm_kzalloc fail.
 * Removed a test for platform_data null pointer in max3421_hub_control()
   as the driver probe will fail if no platform_data is found.

Thank you.

[1]: [https://lkml.org/lkml/2017/5/26/285]

---

Jules Maselbas (2):
  usb: max3421: Add devicetree support
  dt-bindings: max3421: Add bindings documentation

 .../devicetree/bindings/usb/maxim,max3421.txt  | 25 
 drivers/usb/host/max3421-hcd.c | 75 +-
 2 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/usb/maxim,max3421.txt

-- 
2.14.2

--
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 v7 usb-next 2/4] usb: core: add a wrapper for the USB PHYs on the root-hub

2017-10-23 Thread Martin Blumenstingl
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
(for the root-hub) yet which were only introduced recently (documentation
is available in devicetree/bindings/usb/usb-device.txt).

With this new wrapper the usb2-phy and usb3-phy can be specified directly
in the child-node of the corresponding port of the roothub via
devicetree.
This allows SoCs like the Amlogic Meson GXL family to operate correctly
because all USB PHYs are initialized (instead of the first USB PHY
only).

Signed-off-by: Martin Blumenstingl 
Tested-by: Neil Armstrong 
---
 drivers/usb/core/Makefile |   2 +-
 drivers/usb/core/phy.c| 176 ++
 drivers/usb/core/phy.h|   7 ++
 3 files changed, 184 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/core/phy.c
 create mode 100644 drivers/usb/core/phy.h

diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index 250ec1d662d9..b6e181d08bf6 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -5,7 +5,7 @@
 usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o
 usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
 usbcore-y += devio.o notify.o generic.o quirks.o devices.o
-usbcore-y += port.o
+usbcore-y += phy.o port.o
 
 usbcore-$(CONFIG_OF)   += of.o
 usbcore-$(CONFIG_USB_PCI)  += hcd-pci.o
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
new file mode 100644
index ..31245b4abdbf
--- /dev/null
+++ b/drivers/usb/core/phy.c
@@ -0,0 +1,176 @@
+/*
+ * USB PHY roothub driver - a wrapper for multiple PHYs which passes all phy_*
+ * function calls to multiple (actual) PHY devices. This is comes handy when
+ * initializing all PHYs on a root-hub and to keep them all in the same state.
+ *
+ * Copyright (C) 2017 Martin Blumenstingl 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "phy.h"
+
+#define ROOTHUB_PORTNUM0
+
+struct usb_phy_roothub {
+   struct phy  *phy;
+   struct list_headlist;
+};
+
+static struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev)
+{
+   struct usb_phy_roothub *roothub_entry;
+
+   roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL);
+   if (!roothub_entry)
+   return ERR_PTR(-ENOMEM);
+
+   INIT_LIST_HEAD(_entry->list);
+
+   return roothub_entry;
+}
+
+static int usb_phy_roothub_add_phy(struct device *dev,
+  struct device_node *port_np,
+  const char *con_id, struct list_head *list)
+{
+   struct usb_phy_roothub *roothub_entry;
+   struct phy *phy = devm_of_phy_get(dev, port_np, con_id);
+
+   if (IS_ERR_OR_NULL(phy)) {
+   if (!phy || PTR_ERR(phy) == -ENODEV)
+   return 0;
+   else
+   return PTR_ERR(phy);
+   }
+
+   roothub_entry = usb_phy_roothub_alloc(dev);
+   if (IS_ERR(roothub_entry))
+   return PTR_ERR(roothub_entry);
+
+   roothub_entry->phy = phy;
+
+   list_add_tail(_entry->list, list);
+
+   return 0;
+}
+
+struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev)
+{
+   struct device_node *roothub_np, *port_np;
+   struct usb_phy_roothub *phy_roothub;
+   struct usb_phy_roothub *roothub_entry;
+   struct list_head *head;
+   int err;
+
+   roothub_np = usb_of_get_child_node(dev->of_node, ROOTHUB_PORTNUM);
+   if (!of_device_is_available(roothub_np))
+   return NULL;
+
+   phy_roothub = usb_phy_roothub_alloc(dev);
+   if (IS_ERR(phy_roothub))
+   return phy_roothub;
+
+   for_each_available_child_of_node(roothub_np, port_np) {
+   err = usb_phy_roothub_add_phy(dev, port_np, "usb2-phy",
+ _roothub->list);
+   if (err)
+ 

[PATCH v7 usb-next 3/4] usb: core: hcd: integrate the PHY roothub wrapper

2017-10-23 Thread Martin Blumenstingl
This integrates the PHY roothub wrapper into the core hcd
infrastructure. Multiple PHYs which are part of the roothub devicetree
node (which is a sub-node of the sysdev's node) are now managed
(= powered on/off when needed), by the new usb_phy_roothub code.

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 
Tested-by: Neil Armstrong 
Acked-by: Alan Stern 
---
 drivers/usb/core/hcd.c  | 26 ++
 include/linux/usb/hcd.h |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 67aa3d039b9b..6ee97222cdad 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -50,6 +50,7 @@
 #include 
 
 #include "usb.h"
+#include "phy.h"
 
 
 /*-*/
@@ -2271,6 +2272,8 @@ int hcd_bus_suspend(struct usb_device *rhdev, 
pm_message_t msg)
usb_set_device_state(rhdev, USB_STATE_SUSPENDED);
hcd->state = HC_STATE_SUSPENDED;
 
+   usb_phy_roothub_power_off(hcd->phy_roothub);
+
/* Did we race with a root-hub wakeup event? */
if (rhdev->do_remote_wakeup) {
charbuffer[6];
@@ -2307,6 +2310,11 @@ int hcd_bus_resume(struct usb_device *rhdev, 
pm_message_t msg)
dev_dbg(>dev, "skipped %s of dead bus\n", "resume");
return 0;
}
+
+   status = usb_phy_roothub_power_on(hcd->phy_roothub);
+   if (status)
+   return status;
+
if (!hcd->driver->bus_resume)
return -ENOENT;
if (HCD_RH_RUNNING(hcd))
@@ -2344,6 +2352,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t 
msg)
}
} else {
hcd->state = old_state;
+   usb_phy_roothub_power_off(hcd->phy_roothub);
dev_dbg(>dev, "bus %s fail, err %d\n",
"resume", status);
if (status != -ESHUTDOWN)
@@ -2780,6 +2789,16 @@ int usb_add_hcd(struct usb_hcd *hcd,
}
}
 
+   hcd->phy_roothub = usb_phy_roothub_init(hcd->self.sysdev);
+   if (IS_ERR(hcd->phy_roothub)) {
+   retval = PTR_ERR(hcd->phy_roothub);
+   goto err_phy_roothub_init;
+   }
+
+   retval = usb_phy_roothub_power_on(hcd->phy_roothub);
+   if (retval)
+   goto err_usb_phy_roothub_power_on;
+
dev_info(hcd->self.controller, "%s\n", hcd->product_desc);
 
/* Keep old behaviour if authorized_default is not in [0, 1]. */
@@ -2944,6 +2963,10 @@ int usb_add_hcd(struct usb_hcd *hcd,
 err_register_bus:
hcd_buffer_destroy(hcd);
 err_create_buf:
+   usb_phy_roothub_power_off(hcd->phy_roothub);
+err_usb_phy_roothub_power_on:
+   usb_phy_roothub_exit(hcd->phy_roothub);
+err_phy_roothub_init:
if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {
phy_power_off(hcd->phy);
phy_exit(hcd->phy);
@@ -3028,6 +3051,9 @@ void usb_remove_hcd(struct usb_hcd *hcd)
usb_deregister_bus(>self);
hcd_buffer_destroy(hcd);
 
+   usb_phy_roothub_power_off(hcd->phy_roothub);
+   usb_phy_roothub_exit(hcd->phy_roothub);
+
if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {
phy_power_off(hcd->phy);
phy_exit(hcd->phy);
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index a1f03ebfde47..6915b2afc209 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -103,6 +103,7 @@ struct usb_hcd {
 */
struct usb_phy  *usb_phy;
struct phy  *phy;
+   struct usb_phy_roothub  *phy_roothub;
 
/* Flags that need to be manipulated atomically because they can
 * change while the host controller is running.  Always use
-- 
2.14.2

--
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 v7 usb-next 1/4] dt-bindings: usb: add the documentation for USB root-hub

2017-10-23 Thread Martin Blumenstingl
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 as well as a hint
regarding the child-nodes on XHCI controllers which can include the
roothub.

Signed-off-by: Martin Blumenstingl 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/usb/usb-roothub.txt| 46 ++
 Documentation/devicetree/bindings/usb/usb-xhci.txt |  7 
 2 files changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-roothub.txt

diff --git a/Documentation/devicetree/bindings/usb/usb-roothub.txt 
b/Documentation/devicetree/bindings/usb/usb-roothub.txt
new file mode 100644
index ..fc0797d7cee9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-roothub.txt
@@ -0,0 +1,46 @@
+Generic USB root-hub Properties
+
+similar to the USB device bindings (documented in usb-device.txt from the
+current directory) this provides support for configuring the root-hub.
+
+Required properties:
+- compatible: should be at least one of "usb1d6b,3", "usb1d6b,2"
+- reg: must be 0.
+- address-cells: must be 1
+- size-cells: must be 0
+
+Required sub-nodes:
+a sub-node per actual USB port is required. each sub-node supports the
+following properties:
+  Required properties:
+- reg: the port number on the root-hub (mandatory)
+  Optional properties:
+- phys: optional, from the *Generic PHY* bindings (mandatory needed
+  when phy-names is given)
+- phy-names: optional, from the *Generic PHY* bindings; supported names
+  are "usb2-phy" or "usb3-phy"
+
+Example:
+{
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   roothub@0 {
+   compatible = "usb1d6b,3", "usb1d6b,2";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+
+   port@1 {
+   reg = <1>;
+   phys = <_phy1>, <_phy1>;
+   phy-names = "usb2-phy", "usb3-phy";
+   };
+
+   port@2 {
+   reg = <2>;
+   phys = <_phy2>, <_phy2>;
+   phy-names = "usb2-phy", "usb3-phy";
+   };
+   };
+   }
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index ae6e484a8d7c..5b49ba9f2f9a 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -30,6 +30,13 @@ Optional properties:
   - usb3-lpm-capable: determines if platform is USB3 LPM capable
   - quirk-broken-port-ped: set if the controller has broken port disable 
mechanism
 
+sub-nodes:
+- optionally there can be a node for the root-hub, see usb-roothub.txt in the
+  current directory
+- one or more nodes with reg 1-31 for each port to which a device is connected.
+  See usb-device.txt in the current directory for more information.
+
+
 Example:
usb@f0931000 {
compatible = "generic-xhci";
-- 
2.14.2

--
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 v7 usb-next 0/4] initialize (multiple) PHYs on the roothub

2017-10-23 Thread Martin Blumenstingl
This series is the outcome of a discussion with Felipe Balbi,
see [0] and [1] as well as Mathias Nyman, see [7] and [8].
The quick-summary of this is:
- dwc3 already takes one USB2 and one USB3 PHY and initializes these
  correct
- some other HCI platform drivers (like ehci-platform.c, xhci-mtk.c and
  ohci-platform.c) do not have a limitation on the number of PHYs - they
  support one PHY per actual host port
- Amlogic Meson GXL and GXM SoCs come with a dwc3 IP block which has two
  or three USB2 ports enabled on the internal root-hub. The SoCs also
  provide separate USB2 PHYs, one per port. All USB2 PHYs (which are
  internally "connected" to the dwc3 roothub) need to be powered on,
  otherwise USB devices cannot be enumerated (even if just one PHY is
  disabled and if the device is plugged into another, enabled port)

In my first attempt to get USB supported on the GXL and GXM SoCs I tried
to work-around the problem that I could not pass multiple PHYs to the
dwc3 controller.
This was rejected by Rob Herring (which was definitely the thing to do in
my opinion), see [2]

This series adds a new "roothub PHY wrapper". This can be configured
through devicetree by passing a child-node with "reg = <0>" (in other
words: it describes the roothub) to the USB controller.
Additionally there has to be a child-node for each port on
the root-hub. Each of the child-nodes takes a "phys" and "phy-names"
property. This allows modeling the root-hub in devicetree similar to the
USB device binding (documented in devicetree/bindings/usb/usb-device.txt)
This avoids and backwards-compatibility problems (which was a concern
regardless of the solution, see [3]) since the binding for the root-hub
was previously not specified (and we're not using the "phys" property of
the controller, which might have served different purposes before,
depending on the drivers).

Additionally this integrates the new roothub PHY wrapper into hcd.c
which automatically enables it for all USB controller drivers (tested
on an Amlogic Meson GXL SoC which uses a dwc3 controller).

Changes since v6 at [11]:
- fixed unnecessary whitespace change (noticed by Alan Stern - thanks)
- added PATCH #4 to clarify (with an example) how I understood how Rob
  wanted the dt-binding to look like (see [2]). please wait for an ACK
  from Rob on this one to make sure that we're not introducing some
  broken binding (as discussed with Arnd: [12])
- added Alan Stern's ACK on PATCH #3
- added Neil's Tested-by on PATCH #2 and #3

Changes since RfC v5 at [10]:
- dropped RfC prefix
- removed noisy dev_err if no roothub node was found (spotted by
  Xiaolong Ye's kbuild test robot - thank you for that!)
- moved the call to usb_phy_roothub_power_off() within
  hcd_bus_suspend() to make sure that the PHYs are turned off
  if the "race with a root-hub wakeup event" condition is met (in
  this case the PHYs are turned on again, with the old code we did
  break the PHYs internal ref-counting because we never turned the
  PHYs off before turning them on again in case of that special
  "race with a root-hub wakeup event").
  additionally we're not handling the status returned by
  usb_phy_roothub_power_off() anymore (the bus is already turned off
  and we tried to turn off all PHYs as well - only the PHYs which
  failed to power off will stay in the current state).
  thanks to Alan Stern for the suggestion
- removed return value from usb_phy_roothub_power_off() because none
  of my code uses it anymore. thanks to Alan Stern for the suggestion

Changes since v4 at [9]:
- renamed the subject of the cover-letter (old name was:
  "initialize (multiple) PHYs in xhci-plat")
- back into RFC status (see below for the reasons)
- dropped Tested-by from Chunfeng Yun (same reasons as RFC status)
- reworded cover-letter and commit messages from "platform-roothub"
  to "roothub PHY wrapper"
- moved code from drivers/usb/host/platform-roothub.* to
  drivers/usb/core/phy.* and the changes to
  drivers/usb/host/xhci-plat.c to drivers/usb/core/hcd.c as suggested
  by Mathias Nyman (as a benefit this will enable the new logic for
  non-xHCI controllers as well - however this was not tested yet)
- rename the structs, function names, etc from platform_roothub_* to
  usb_phy_roothub*

Changes since RFCv3 at [6]:
- moved the DT binding change from patch #3 to patch #1 as suggested
  by Rob Herring (and slightly adjusted the commit message to account
  for that)
- added Tested-by from Chunfeng Yun (who confirmed that the whole
  concept and implementation works fine on Mediatek SoCs - many thanks
  again!) to patch #2
- added Rob Herring's ACK to patches 1 and 3
- dropped RFC status (RFCv3 -> PATCH v4)

Changes since RFCv2 at [5]:
- split phy_{init,exit} and phy_power_{on,off} handling. up until RFCv2
  I called phy_init plus phy_power_on in platform_roothub_power_on and
  phy_power_off plus phy_exit in platform_roothub_power_off. However,
  Chunfeng Yun (a Mediatek SoC developer - many thanks for testing my
 

[PATCH v7 usb-next 4/4] dt-bindings: usb: xhci: include the roothub and a device in the example

2017-10-23 Thread Martin Blumenstingl
This extends the existing example from the USB xHCI binding
documentation so it includes the roothub and an actual device.
The goal of this is to show that the roothub is specified alongside the
actual devices on the USB bus (which is important because a device on
the USB bus - for example a hub - might need it's own phys / phy-names
properties. modelling the roothub as separate device and not nesting the
other devices on the bus below the roothub allows us to keep the
properties, for example the PHYs, separated).

Signed-off-by: Martin Blumenstingl 
---
 Documentation/devicetree/bindings/usb/usb-xhci.txt | 23 ++
 1 file changed, 23 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index 5b49ba9f2f9a..20e5ce2b016a 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -42,4 +42,27 @@ Example:
compatible = "generic-xhci";
reg = <0xf0931000 0x8c8>;
interrupts = <0x0 0x4e 0x0>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* see usb-roothub.txt */
+   roothub@0 {
+   compatible = "usb1d6b,3", "usb1d6b,2";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+
+   port@1 {
+   reg = <1>;
+   phys = <_phy1>, <_phy1>;
+   phy-names = "usb2-phy", "usb3-phy";
+   };
+   };
+
+   /* see usb-device.txt */
+   hub: genesys@1 {
+   compatible = "usb5e3,608";
+   reg = <1>;
+   };
};
-- 
2.14.2

--
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] rndis_host: support Novatel Verizon USB730L — Linux USB

2017-10-23 Thread Gal Shalif
The following was used to switch the Novatel USB730L from user mode
(product ID 0x9030) into enterprise mode (product ID 0x9032):
* Tested with Linux kernel 3.14.15 on a 32bit ARM machine (kernel is
compiled without IPV6) and with static HID driver
* Kernel patches 1: ignore HID interface of Novatel USB730L modem to
allow a USB modeswitch when the HID driver is statically compiled into
the kernel.

$ git show HEAD
commit 23231636db13c8c47d64aaa75347b3c184dd6387
Author: Gal Shalif 
Date:   Thu Oct 19 17:28:13 2017 +0300

HID: ignore Novatel USB730L modem

  Ignore the Novatel USB730L modem - otherwise,
  a kernel that is compile with a static HID driver
  will not allow a USB mode switch of the modem from the default
  user mode (product ID: 9030) into enterprise mode (producr ID: 9032).

diff --git drivers/hid/hid-core.c drivers/hid/hid-core.c
index 9bc9116..08be36d7b 100644
--- drivers/hid/hid-core.c
+++ drivers/hid/hid-core.c
@@ -2772,6 +2772,9 @@ static const struct hid_device_id
hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS,
USB_DEVICE_ID_SYNAPTICS_DPAD) },
 #endif
{ HID_USB_DEVICE(USB_VENDOR_ID_YEALINK,
USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_NOVATEL,
USB_DEVICE_ID_NOVATEL_USB730L_USER_MODE) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_NOVATEL,
USB_DEVICE_ID_NOVATEL_USB730L_ENTERPRISE_MODE) },
+
{ }
 };

diff --git drivers/hid/hid-ids.h drivers/hid/hid-ids.h
index a989191..b6908d0 100644
--- drivers/hid/hid-ids.h
+++ drivers/hid/hid-ids.h
@@ -1145,6 +1145,10 @@
 #define USB_DEVICE_ID_PRIMAX_MOUSE_4D220x4d22
 #define USB_DEVICE_ID_PRIMAX_KEYBOARD  0x4e05

+#define USB_VENDOR_ID_NOVATEL 0x1410   /*
blacklist Novatel Wireless USB730L */
+#define USB_DEVICE_ID_NOVATEL_USB730L_USER_MODE 0x9030 /*
blacklist Novatel Wireless USB730L */
+#define USB_DEVICE_ID_NOVATEL_USB730L_ENTERPRISE_MODE 0x9032   /*
blacklist Novatel Wireless USB730L */
+

 #define USB_VENDOR_ID_RISO_KAGAKU  0x1294  /* Riso Kagaku
Corp. */
 #define USB_DEVICE_ID_RI_KA_WEBMAIL0x1320  /* Webmail Notifier */

* Kernel patches 2: add Novatel USB730L enterprise mode serial interface

$ git show 9bacb30
commit 9bacb3082a90fc39047721a0887d5414f5e7008d
Author: Gal Shalif 
Date:   Thu Oct 19 17:18:48 2017 +0300

USB: serial: option: add support for Novatel USB730L enterprise mode

  Add device ID for Novatel USB730L enterprise mode
  See details at:
https://www.verizonwireless.com/dam/support/pdf/verizon-usb730l-integration-guide.pdf

diff --git drivers/usb/serial/option.c drivers/usb/serial/option.c
index 54bfef1..bf5f637 100644
--- drivers/usb/serial/option.c
+++ drivers/usb/serial/option.c
@@ -162,6 +162,7 @@ static void option_instat_callback(struct urb *urb);
 #define NOVATELWIRELESS_PRODUCT_E362   0x9010
 #define NOVATELWIRELESS_PRODUCT_E371   0x9011
 #define NOVATELWIRELESS_PRODUCT_U620L  0x9022
+#define NOVATELWIRELESS_PRODUCT_ENTERPRISE_U730L 0x9032 /* Novtel
USB730L enterprize mode (from
https://www.verizonwireless.com/dam/support/pdf/verizon-usb730l-integration-guide.pdf)
*/
 #define NOVATELWIRELESS_PRODUCT_G2 0xA010
 #define NOVATELWIRELESS_PRODUCT_MC551  0xB001

@@ -1120,6 +1121,7 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID,
NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID,
NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID,
NOVATELWIRELESS_PRODUCT_U620L, 0xff, 0x00, 0x00) },
+   { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID,
NOVATELWIRELESS_PRODUCT_ENTERPRISE_U730L, 0xff, 0x00, 0x00) }, /*
Novtel USB730L enterprize mode (from
https://www.verizonwireless.com/dam/support/pdf/verizon-usb730l-integration-guide.pdf)
*/

{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },

* Mode switch file is:
$ cat 1410:9030
# Novatel Wireless MiFi USB730L
DefaultVendor=0x1410
DefaultProduct=0x9030
TargetVendor=0x1410
TargetProduct=0x9032
NeedResponse=0
Configuration=0x03

Notes:
* Tested with Linux kernel 3.14.15 on a 32bit ARM machine (kernel is
compiled without IPV6) and with static HID driver
* Novatel Linux integration guide -
https://www.verizonwireless.com/dam/support/pdf/verizon-usb730l-integration-guide.pdf
* Unlike the Novatel paper above - the mode switch configuration for
the enterprise mode is 3 and NOT 4
--
To unsubscribe from this list: send the line "unsubscribe 

Re: [PATCH 09/10 v3] usb: usb251xb: Add max power/current dts property support

2017-10-23 Thread Richard Leitner

Hi,
again some nit-picks below...

On 10/22/2017 10:38 PM, Serge Semin wrote:

This parameters may be varied in accordance with hardware specifics.
So lets add the corresponding settings to the usb251xb driver dts
specification.

Signed-off-by: Serge Semin 
---
  drivers/usb/misc/usb251xb.c | 24 
  1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 29432fd3b..669b98be2 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -500,6 +500,26 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
}
}
  
+	hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;

+   if (!of_property_read_u32(np, "sp-max-total-current-microamp",
+   _u32))


Please match the "correct" (of_property_read_u32) opening parenthesis 
here...



+   hub->max_power_sp = min_t(u8, property_u32 / 2000, 50);
+
+   hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
+   if (!of_property_read_u32(np, "bp-max-total-current-microamp",
+   _u32))


... and here ...


+   hub->max_power_bp = min_t(u8, property_u32 / 2000, 255);
+
+   hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
+   if (!of_property_read_u32(np, "sp-max-removable-current-microamp",
+   _u32))


... and here ...


+   hub->max_current_sp = min_t(u8, property_u32 / 2000, 50);
+
+   hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
+   if (!of_property_read_u32(np, "bp-max-removable-current-microamp",
+   _u32))


... and here ...


+   hub->max_current_bp = min_t(u8, property_u32 / 2000, 255);
+
hub->power_on_time = USB251XB_DEF_POWER_ON_TIME;
if (!of_property_read_u32(np, "power-on-time-ms", _u32))
hub->power_on_time = min_t(u8, property_u32 / 2, 255);


Thanks!

kind regards,
Richard.L
--
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 02/10 v3] usb: usb251xb: Add USB2517i specific struct and IDs

2017-10-23 Thread Richard Leitner

Hi,
please see comments below for some nit-picks.

On 10/22/2017 10:38 PM, Serge Semin wrote:

There are USB2517 and USB2517i hubs, which have almost the same
registers space as already supported USB251xBi series. The difference
it in DIDs and in a few functions. This patch adds the USB2517/i data
structures to the driver, so it would have different setting depending
on the device discovered on i2c-bus.

Signed-off-by: Serge Semin 
---
  drivers/usb/misc/Kconfig|  4 ++--
  drivers/usb/misc/usb251xb.c | 23 +--
  2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 37dd1c018..27b9fcbdf 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -247,8 +247,8 @@ config USB_HUB_USB251XB
depends on I2C
help
  This option enables support for configuration via SMBus of the
- Microchip USB251xB/xBi USB 2.0 Hub Controller series.
- Configuration parameters may be set in devicetree or platform data.
+ Microchip USB251x/xBi USB 2.0 Hub Controller series. Configuration
+ parameters may be set in devicetree or platform data.


Here you have "USB251x/xBi"...


  Say Y or M here if you need to configure such a device via SMBus.
  
  config USB_HSIC_USB3503

diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 91f66d68b..22c32ea3f 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c


...


@@ -82,7 +83,7 @@
  
  #define USB251XB_ADDR_PRODUCT_STRING_LEN	0x14

  #define USB251XB_ADDR_PRODUCT_STRING  0x54
-#define USB251XB_DEF_PRODUCT_STRING"USB251xB/xBi"
+#define USB251XB_DEF_PRODUCT_STRING"USB251xB/xBi/7i"


but here you have "USB251xB/xBi/7i"...

  
  #define USB251XB_ADDR_SERIAL_STRING_LEN		0x15

  #define USB251XB_ADDR_SERIAL_STRING   0x92


...


@@ -590,5 +609,5 @@ static struct i2c_driver usb251xb_i2c_driver = {
  module_i2c_driver(usb251xb_i2c_driver);
  
  MODULE_AUTHOR("Richard Leitner ");

-MODULE_DESCRIPTION("USB251xB/xBi USB 2.0 Hub Controller Driver");
+MODULE_DESCRIPTION("USB251x/xBi USB 2.0 Hub Controller Driver");


... and here again "USB251x/xBi"...


  MODULE_LICENSE("GPL");



I'd prefer to use just one "name" for the driver. If you be precise that 
would be "USB251xB/xBi/xi". But that seems a bit overloaded to me. AFAIK 
the "B" and "i" prepended to the type have no affect on the I2C 
interface/register map, so maybe "USB251x" would be sufficient?


kind regards,
Richard.L
--
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-next v6 0/3] initialize (multiple) PHYs on the roothub

2017-10-23 Thread Martin Blumenstingl
Hi,

On Sun, Oct 22, 2017 at 5:16 AM, Chunfeng Yun  wrote:
> Hi,
>
> On Thu, 2017-10-19 at 23:32 +0200, Martin Blumenstingl wrote:
>> Hi Chunfeng Yun,
>>
>> many thanks for your efforts (testing and explaining the Mediatek SoC
>> implementatino) on the earlier versions of this series!
>>
>> On Tue, Oct 17, 2017 at 11:20 PM, Martin Blumenstingl
>>  wrote:
>> > This series is the outcome of a discussion with Felipe Balbi,
>> > see [0] and [1] as well as Mathias Nyman, see [7] and [8].
>> > The quick-summary of this is:
>> > - dwc3 already takes one USB2 and one USB3 PHY and initializes these
>> >   correct
>> > - some other HCI platform drivers (like ehci-platform.c, xhci-mtk.c and
>> >   ohci-platform.c) do not have a limitation on the number of PHYs - they
>> >   support one PHY per actual host port
>> > - Amlogic Meson GXL and GXM SoCs come with a dwc3 IP block which has two
>> >   or three USB2 ports enabled on the internal root-hub. The SoCs also
>> >   provide separate USB2 PHYs, one per port. All USB2 PHYs (which are
>> >   internally "connected" to the dwc3 roothub) need to be powered on,
>> >   otherwise USB devices cannot be enumerated (even if just one PHY is
>> >   disabled and if the device is plugged into another, enabled port)
>> >
>> > In my first attempt to get USB supported on the GXL and GXM SoCs I tried
>> > to work-around the problem that I could not pass multiple PHYs to the
>> > dwc3 controller.
>> > This was rejected by Rob Herring (which was definitely the thing to do in
>> > my opinion), see [2]
>> >
>> > This series adds a new "roothub PHY wrapper". This can be configured
>> > through devicetree by passing a child-node with "reg = <0>" (in other
>> > words: it describes the roothub) to the USB controller.
>> > Additionally there has to be a child-node for each port on
>> > the root-hub. Each of the child-nodes takes a "phys" and "phy-names"
>> > property. This allows modeling the root-hub in devicetree similar to the
>> > USB device binding (documented in devicetree/bindings/usb/usb-device.txt)
>> > This avoids and backwards-compatibility problems (which was a concern
>> > regardless of the solution, see [3]) since the binding for the root-hub
>> > was previously not specified (and we're not using the "phys" property of
>> > the controller, which might have served different purposes before,
>> > depending on the drivers).
>> >
>> > Additionally this integrates the new roothub PHY wrapper into hcd.c
>> > which automatically enables it for all USB controller drivers (tested
>> > on an Amlogic Meson GXL SoC which uses a dwc3 controller).
>> >
>> > Changes since RfC v5 at [10]:
>> > - dropped RfC prefix
>> > - removed noisy dev_err if no roothub node was found (spotted by
>> >   Xiaolong Ye's kbuild test robot - thank you for that!)
>> > - moved the call to usb_phy_roothub_power_off() within
>> >   hcd_bus_suspend() to make sure that the PHYs are turned off
>> >   if the "race with a root-hub wakeup event" condition is met (in
>> >   this case the PHYs are turned on again, with the old code we did
>> >   break the PHYs internal ref-counting because we never turned the
>> >   PHYs off before turning them on again in case of that special
>> >   "race with a root-hub wakeup event").
>> >   additionally we're not handling the status returned by
>> >   usb_phy_roothub_power_off() anymore (the bus is already turned off
>> >   and we tried to turn off all PHYs as well - only the PHYs which
>> >   failed to power off will stay in the current state).
>> >   thanks to Alan Stern for the suggestion
>> > - removed return value from usb_phy_roothub_power_off() because none
>> >   of my code uses it anymore. thanks to Alan Stern for the suggestion
>> >
>> > Changes since v4 at [9]:
>> > - renamed the subject of the cover-letter (old name was:
>> >   "initialize (multiple) PHYs in xhci-plat")
>> > - back into RFC status (see below for the reasons)
>> > - dropped Tested-by from Chunfeng Yun (same reasons as RFC status)
>> > - reworded cover-letter and commit messages from "platform-roothub"
>> >   to "roothub PHY wrapper"
>> is there a chance you can test v6 of this series on the Mediatek SoCs
>> one more time?
>> in v5 the code was moved from xhci-plat.c to drivers/usb/core/hub.c
>> which should even enable it on non-xHCI controllers.
>> however, I cannot test suspend/resume support on my Meson GXL SoCs -
>> and in addition to that it would be awesome to have confirmation from
>> you that the latest version still works fine on the Mediatek SoCs
>>
> Sorry for the late reply.
we are all busy - no need to be sorry

> I tested it last week.
many thanks for that again!

> It works well, and will consume less power than the current way of
> xhci-mtk's, because when no devices are attached, hcd_bus_suspend is
> also called and power off phys even though the system doesn't enter
> suspend mode.
interesting, I didn't even think about this. it 

Re: [PATCH 03/10 v3] usb: usb251xb: Add USB251x specific port count setting

2017-10-23 Thread Richard Leitner

On 10/22/2017 10:38 PM, Serge Semin wrote:

USB251xb as well as USB2517 datasheet states, that all these
hubs differ by number of ports declared as the last digit in the
model name. So USB2512 got two ports, USB2513 - three, and so on.
Such setting must be reflected in the device specific data
structure and corresponding dts property should be checked whether
it doesn't get out of available ports.

Signed-off-by: Serge Semin 
---
  drivers/usb/misc/usb251xb.c | 24 +---
  1 file changed, 21 insertions(+), 3 deletions(-)


...

@@ -422,8 +431,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
for (i = 0; i < len / sizeof(u32); i++) {
u32 port = be32_to_cpu(cproperty_u32[i]);
  
-			if ((port >= 1) && (port <= 4))

+   if ((port >= 1) && (port <= data->port_cnt))
hub->non_rem_dev |= BIT(port);
+   else
+   dev_warn(dev, "NRD port %u doesn't exist\n",
+   port);


Please match the alignment of the second line with the open parenthesis.


}
}
  
@@ -433,8 +445,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,

for (i = 0; i < len / sizeof(u32); i++) {
u32 port = be32_to_cpu(cproperty_u32[i]);
  
-			if ((port >= 1) && (port <= 4))

+   if ((port >= 1) && (port <= data->port_cnt))
hub->port_disable_sp |= BIT(port);
+   else
+   dev_warn(dev, "PDS port %u doesn't exist\n",
+   port);


... same here ...


}
}
  
@@ -444,8 +459,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,

for (i = 0; i < len / sizeof(u32); i++) {
u32 port = be32_to_cpu(cproperty_u32[i]);
  
-			if ((port >= 1) && (port <= 4))

+   if ((port >= 1) && (port <= data->port_cnt))
hub->port_disable_bp |= BIT(port);
+   else
+   dev_warn(dev, "PDB port %u doesn't exist\n",
+   port);


... and here.


}
}


Otherwise feel free to add:

Acked-by: Richard Leitner 

regards,
Richard.L
--
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: [RFC usb-next v5 1/3] dt-bindings: usb: add the documentation for USB root-hub

2017-10-23 Thread Martin Blumenstingl
Hi Arnd,

thank you for taking 10 minutes to discuss this in person with me!

On Fri, Oct 20, 2017 at 12:10 AM, Arnd Bergmann  wrote:
> On Thu, Oct 19, 2017 at 11:25 PM, Martin Blumenstingl
>  wrote:
>>> Does dwc2 also use separate nodes for the roothub? From your
>>> description it sounds like it would not be affected by your patch.
>> currently it doesn't use separate notes for the roothub - however,
>> with this patch it could (although I haven't explicitly tested this)
>
> Ok.
>
>>> Since you used a dtb that already listed an endpoint device below
>>> an xhci, that would answer my earlier question of whether it worked
>>> before your patch series, and you tested that it still works with your
>>> patches applied and the roothub node added in the dtb.  Now we
>>> just need to make sure we don't break existing dtb files that don't
>>> have the roothub node but do have endpoint device nodes.
>> the endpoint you're seeing is the root-hub - you can see the full .dts here: 
>> [0]
>>
>> maybe my patch description or documentation is not clear - could you
>> please explain what makes you think that specifying the root-hub
>> didn't work before (so I can update the comments where needed)?
>> to sum up what this series does: find the node with reg = <0>; (= the
>> root-hub) and get all PHY instances from the child-nodes
>> this should not change any existing behavior except if someone had a
>> node with reg = <0>; below any USB controller node (which was
>> undocumented behavior before my patches)
>
> Maybe I misunderstand what the actual change to the hierarchy
> is. Quoting from your example for the new code
>
> +{
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +
> +   roothub@0 {
> +   compatible = "usb1d6b,3", "usb1d6b,2";
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   reg = <0>;
> +
> +   port@1 {
> +   reg = <1>;
> +   phys = <_phy1>, <_phy1>;
> +   phy-names = "usb2-phy", "usb3-phy";
> +   };
>
> The way I understand it, an endpoing device would now be
> located in
>
>  /roothub@0/port@1/hub@2/device@1
>
> where previously it was in
>
>  /port@1/hub@2/device@1
>
> Is that correct?
this is not how it's currently implemented - let's find out if this is
a misunderstanding on my side
the second example is still valid with this series, while the first
example won't work with the code as it is

> I don't see any code that can deal with both cases and still
> assign the correct of_node pointer to the device device@1 in
> the end (maybe it's there and you just need to point me
> to the right patch).
it's not you - that code is (currently) not there

> The reason why we have to be careful here is that the
> Linux device hierarchy is not just derived from DT here, but
> it gets created from the physical devices under 
> and the 'struct device' hierarchy has to match the DT hierarchy
> exactly.
yes, I fully agree with you here
I will post an updated version of this series which includes an
updated usb-xhci dt-binding documentation to show how the end result
(after this series) can look like. I'll include Rob in the loop again
so we don't introduce a broken binding.


Regards,
Martin
--
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: [RESEND x2][PATCH 0/3] dwc2 fixes for edge cases on hikey

2017-10-23 Thread John Stultz
On Mon, Oct 23, 2017 at 1:41 PM, John Stultz  wrote:
> On Mon, Oct 23, 2017 at 2:19 AM, Minas Harutyunyan
>  wrote:
>> Could you please verify on your setup follow patches:
>> 1. Vardan's patch.
>> 2. Patch for TOUTCAL programming (new version see below).
>> 4. Your patch 2/3 to avoid "Mode Mismatch" interrupts.
>> 5. Your patch 3/3 to set udc state to "not attached".
>> 6. Your patch 1/3, but remove dwc2_hsotg_core_init_disconnected()
>> function call from Host starting brnch, keep *only*
>> dwc2_hsotg_disconnect() to change UDC state to "not attached".
>
> So yes, this set does seem to work ok for me. Though neither Vardan's
> patch or the TOUTCAL/USBTRDTIM patch seem to have much effect either
> way (I need to do more testing just to be sure, but for the use cases
> I've had trouble with they don't seem to do much).
>
> I'm happy to rework my earlier patch #1/3 to remove
> dwc2_hsotg_core_init_disconnected() and resend.

Just resent the set of my changes with the above tweak.

The stack including Vardan's and your fixes that I also tested with
(but to little effect) can be found here:
https://git.linaro.org/people/john.stultz/android-dev.git/log/?id=4302a823816e944a6f548b05049c4e4c006bbadd

thanks
-john
--
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 v2] usb: dwc2: Fix UDC state tracking

2017-10-23 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.

This patch does depend on the previous patch ("usb: dwc2:
Improve gadget state disconnection handling") in this patch set
in order to properly work.

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
Tested by: Minas Harutyunyan 
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 7fd0e38..603c216 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(>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 v2 0/3] dwc2 fixes for edge cases on hikey

2017-10-23 Thread John Stultz
So here is v2 of a few dwc2 fixes that I've been using with HiKey.
I'm not totally sure these are all ideal, but they avoid edge case
issues that we have been running into with switching between
gadget mode and host mode.

I'd guess the first two are potentially -stable material, and
the last might be worth sending to -stable too, as its a relatively
simple fix, but to my understanding the UDC state tracking has
always been broken so its not really a regression. But still.

thanks
-john

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

John Stultz (3):
  usb: dwc2: Improve gadget state disconnection handling
  usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode
  usb: dwc2: Fix UDC state tracking

 drivers/usb/dwc2/gadget.c | 7 +++
 drivers/usb/dwc2/hcd.c| 7 +--
 2 files changed, 12 insertions(+), 2 deletions(-)

-- 
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/3 v2] usb: dwc2: Improve gadget state disconnection handling

2017-10-23 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.

(This seems to be due to a quirk of the HiKey board where
we do not ever get any otg interrupts, particularly the session
end detected signal. Instead we only see status change
interrupt.)

The fix there was somewhat simple, as it just made sure to
call dwc2_hsotg_disconnect() before we connected things up
in OTG mode, ensuring the state handling didn't throw errors.

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 
---
v2: Remove the extra dwc2_hsotg_core_init_disconnected() call
I had added, as suggested by Minas.
---
 drivers/usb/dwc2/hcd.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index c263114..9bd60ec 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(>lock, flags);
-   dwc2_hsotg_disconnect(hsotg);
dwc2_hsotg_core_init_disconnected(hsotg, false);
spin_unlock_irqrestore(>lock, flags);
dwc2_hsotg_core_connect(hsotg);
@@ -3296,8 +3295,12 @@ 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(>lock, flags);
+   dwc2_hsotg_disconnect(hsotg);
+   spin_unlock_irqrestore(>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 v2] usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode

2017-10-23 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 previous patch in this set), 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
Tested by: Minas Harutyunyan 
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 0d8e09c..7fd0e38 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -4004,6 +4004,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(>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: [RESEND x2][PATCH 0/3] dwc2 fixes for edge cases on hikey

2017-10-23 Thread John Stultz
On Mon, Oct 23, 2017 at 2:19 AM, Minas Harutyunyan
 wrote:
> Could you please verify on your setup follow patches:
> 1. Vardan's patch.
> 2. Patch for TOUTCAL programming (new version see below).
> 4. Your patch 2/3 to avoid "Mode Mismatch" interrupts.
> 5. Your patch 3/3 to set udc state to "not attached".
> 6. Your patch 1/3, but remove dwc2_hsotg_core_init_disconnected()
> function call from Host starting brnch, keep *only*
> dwc2_hsotg_disconnect() to change UDC state to "not attached".

So yes, this set does seem to work ok for me. Though neither Vardan's
patch or the TOUTCAL/USBTRDTIM patch seem to have much effect either
way (I need to do more testing just to be sure, but for the use cases
I've had trouble with they don't seem to do much).

I'm happy to rework my earlier patch #1/3 to remove
dwc2_hsotg_core_init_disconnected() and resend.

thanks
-john
--
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] cdc_ether: flag the Huawei ME906/ME909 as WWAN

2017-10-23 Thread Aleksander Morgado
The Huawei ME906 (12d1:15c1) comes with a standard ECM interface that
requires management via AT commands sent over one of the control TTYs
(e.g. connected with AT^NDISDUP).

Signed-off-by: Aleksander Morgado 
---
 drivers/net/usb/cdc_ether.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 52ea80bcd639..788953afaba3 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -863,6 +863,12 @@ static const struct usb_device_id  products[] = {
USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, 0x81ba, USB_CLASS_COMM,
USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
.driver_info = (kernel_ulong_t)_info,
+}, {
+   /* Huawei ME906 and ME909 */
+   USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, USB_CLASS_COMM,
+ USB_CDC_SUBCLASS_ETHERNET,
+ USB_CDC_PROTO_NONE),
+   .driver_info = (unsigned long)_info,
 }, {
/* ZTE modules */
USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, USB_CLASS_COMM,
--
2.14.2
--
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: dwc2: usb: Unable to clear channel error

2017-10-23 Thread Minas Harutyunyan
On 10/19/2017 5:35 PM, Dinh Nguyen wrote:
> 
> 
> On 10/19/2017 06:55 AM, Grigor Tovmasyan wrote:
>> On 10/18/2017 6:07 PM, Marek Vasut wrote:
>>> On 10/18/2017 04:05 PM, Dinh Nguyen wrote:
 Hi,

 I'm trying to bringup the DWC2 USB IP version 330A on a new Stratix10
 SoC and have encountered this error in both Linux and U-Boot:

 U-Boot(version v2017.09)

 # usb start
 starting USB...
 USB0:   Core Release: 3.30a
 dwc_otg_core_host_init: Timeout!
 dwc_otg_core_host_init: Timeout!

 Linux(kernel v4.13)

 [1.299891] dwc2 ffb0.usb: DWC OTG Controller
 [1.304628] dwc2 ffb0.usb: new USB bus registered, assigned bus
 number 1
 [1.311698] dwc2 ffb0.usb: irq 13, io mem 0xffb0
 [1.318309] dwc2 ffb0.usb: Unable to clear enable on channel 0
 [1.325749] dwc2 ffb0.usb: Unable to clear enable on channel 1
 [1.333187] dwc2 ffb0.usb: Unable to clear enable on channel 2
 [1.340626] dwc2 ffb0.usb: Unable to clear enable on channel 3
 [1.348064] dwc2 ffb0.usb: Unable to clear enable on channel 4
 [1.355503] dwc2 ffb0.usb: Unable to clear enable on channel 5
 [1.362941] dwc2 ffb0.usb: Unable to clear enable on channel 6
 [1.370379] dwc2 ffb0.usb: Unable to clear enable on channel 7
 [1.377818] dwc2 ffb0.usb: Unable to clear enable on channel 8
 [1.385256] dwc2 ffb0.usb: Unable to clear enable on channel 9
 [1.392694] dwc2 ffb0.usb: Unable to clear enable on channel 10
 [1.400218] dwc2 ffb0.usb: Unable to clear enable on channel 11
 [1.407743] dwc2 ffb0.usb: Unable to clear enable on channel 12
 [1.415269] dwc2 ffb0.usb: Unable to clear enable on channel 13
 [1.422794] dwc2 ffb0.usb: Unable to clear enable on channel 14

 Just wondering if anyone might have an idea on what could be causing
 this error?
>>>
>>> Maybe some clock are not enabled ?
>>>
>>
>> Hi ,
>>
>> Are you following board/hisilicon/hikey/README file instructions when
>> using U-Boot? Specially paragraph FLASHING point 4, where discussed
>> "dwc_otg_core_host_init: Timeout!" message.
>>
> 
> I saw that, but I don't know how that applies to a Stratix10 platform?
> 
> Dinh
> 
> 
Hi,

Did you able to resolve this issue? If not, please provide verbose debug 
log and register dump.

Thanks,
Minas

--
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] drivers/net/usb: add device id for TP-LINK UE300 USB 3.0 Ethernet

2017-10-23 Thread Oliver Neukum
Am Montag, den 23.10.2017, 18:10 +0800 schrieb Ran Wang:
> This product is named 'TP-LINK USB 3.0 Gigabit Ethernet Network
> Adapter (Model No.is UE300)'. It uses chip RTL8153 and works with
> driver drivers/net/usb/r8152.c
> 

Hi,

just for the record, have you confirm that it fails with cdc-ether?

Regards
Oliver

--
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 14/17] phy: qcom-qusb2: Set vbus sw-override signal in device mode

2017-10-23 Thread Manu Gautam
Hi Kishon,

Please review this so that I can re-submit patch-set based on this approach.

On 10/9/2017 1:33 PM, Manu Gautam wrote:
> Hi Kishon
>
> On 10/5/2017 2:38 PM, Manu Gautam wrote:
>> Kishon,
>> What would you suggest here?
>> Should we add new calls e.g. phy_get/set_current_speed like::
>>
>> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
>> index 78bb0d7..41d9ec2 100644
>> --- a/include/linux/phy/phy.h
>> +++ b/include/linux/phy/phy.h
>> @@ -29,6 +29,14 @@ enum phy_mode {
>>     PHY_MODE_USB_OTG,
>>  };
>>
>> +enum phy_speed {
>> +   PHY_SPEED_INVALID,
>> +   PHY_SPEED_USB_LS,
>> +   PHY_SPEED_USB_FS_HS,
>> +   PHY_SPEED_USB_SS,
>> +};
>> +
>>  /**
>>   * struct phy_ops - set of function pointers for performing phy operations
>>   * @init: operation to be performed for initializing phy
>> @@ -45,6 +53,7 @@ struct phy_ops {
>>     int (*power_on)(struct phy *phy);
>>     int (*power_off)(struct phy *phy);
>>     int (*set_mode)(struct phy *phy, enum phy_mode mode);
>> +   int (*set_speed)(struct phy *phy, enum phy_speed speed);
>>     int (*reset)(struct phy *phy);
>>     struct module *owner;
>>  };
>>
> @Kishon,
> Let me know if we can add set_speed to phy_ops. We need this for glue
> driver to notify PHY of current connection speed to enable appropriate
> wakeup interrupts.
>
>

-- 
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


[PATCH] drivers/net/usb: add device id for TP-LINK UE300 USB 3.0 Ethernet

2017-10-23 Thread Ran Wang
This product is named 'TP-LINK USB 3.0 Gigabit Ethernet Network
Adapter (Model No.is UE300)'. It uses chip RTL8153 and works with
driver drivers/net/usb/r8152.c

Signed-off-by: Ran Wang 
---
 drivers/net/usb/cdc_ether.c | 8 
 drivers/net/usb/r8152.c | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 52ea80bcd639..5529bd136624 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -561,6 +561,7 @@ static const struct driver_info wwan_info = {
 #define HP_VENDOR_ID   0x03f0
 #define MICROSOFT_VENDOR_ID0x045e
 #define UBLOX_VENDOR_ID0x1546
+#define TPLINK_VENDOR_ID   0x2357
 
 static const struct usb_device_id  products[] = {
 /* BLACKLIST !!
@@ -813,6 +814,13 @@ static const struct usb_device_id  products[] = {
.driver_info = 0,
 },
 
+   /* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
+{
+   USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM,
+   USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
+   .driver_info = 0,
+},
+
 /* WHITELIST!!!
  *
  * CDC Ether uses two interfaces, not necessarily consecutive.
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 941ece08ba78..d51d9abf7986 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -615,6 +615,7 @@ enum rtl8152_flags {
 #define VENDOR_ID_LENOVO   0x17ef
 #define VENDOR_ID_LINKSYS  0x13b1
 #define VENDOR_ID_NVIDIA   0x0955
+#define VENDOR_ID_TPLINK   0x2357
 
 #define MCU_TYPE_PLA   0x0100
 #define MCU_TYPE_USB   0x
@@ -5319,6 +5320,7 @@ static const struct usb_device_id rtl8152_table[] = {
{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7214)},
{REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},
{REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA,  0x09ff)},
+   {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK,  0x0601)},
{}
 };
 
-- 
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: "hub doesn't have any ports" error message on the disabled USB addressable root hub port

2017-10-23 Thread Mathias Nyman

On 23.10.2017 12:37, Thang Q. Nguyen wrote:

Hi,
In our latest ARM64-based CPU, we use the DesignWare USB which is
xHCI-compatible. For some reasons, we disable USB3.0 support so remove the
unnecessary USB3.0 capability structure information as specified in the
xHCI specification 1.1, section 7.2:
"At least one of these capability structures is required for all xHCI
implementations. More than one may be defined for implementations that
support more that one bus protocol."



So there is no supported protocol capability with revision major == 3, in your 
case.


When booting kernel, linux kernel displays an error message to claim about
no USB port on the USB3.0 roothub:
[3.497767] hub 2-0:1.0: config failed, hub doesn't have any ports!
(err -19)
Although the error message does not affect USB functionality, error
message will make users confused.

Looking into the XHCI driver, there are always two USB hub ports
implemented. This implements the xHCI specification as in 4.19.7:
"In a USB3 hub, two independently addressable hub ports exist for each
physical down stream connector; a USB2 compatible port accessed through
the USB2 connection and a USB3 compatible port accessed through the
SuperSpeed connection. The Root Hub of the xHCI emulates this operation by
defining a Root Hub PORTSC register for each connection type; USB2
(Low-/Full-/High-Speed) or USB3 (SuperSpeed)."

But the problem is that, xhci-hcd always pass both USB hub ports to
usb-core driver. In case any of USB2 or USB3 compatible port is missing,
there is no port on the corresponding hub and kernel will displays the
error message.

Below are some approaches we suggest to overcome the issue:
Approach 1: Allow roothub has no port. The change will look like:
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b5c7336..995d62d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1347,6 +1347,9 @@ static int hub_configure(struct usb_hub
*hub,
ret = -ENODEV;
goto fail;
} else if (hub->descriptor->bNbrPorts == 0) {
+   if (hdev->parent)
+   return -ENODEV;
+
message = "hub doesn't have any
ports!";
ret = -ENODEV;
goto fail;
Approach 2: do not pass a USB hub port to usb-core if it has no port.
Don't know if this approach is feasible or not.
Approach 3: implement maximum-speed attribute support and this will be set
to high-speed in case of missing USB3 support. But this works only for the
case of USB3.0 disabled.

Can you help review and suggest what approach should be used to fix this
issue?


Current xhci driver design assumes there are two hcds available.
Several functions assume a shared hcd exists.

Creating a hcd with a roothub with zero ports is probably a faster way to get
things running, but I think we should redesign parts of the xhci driver to
work with only one hcd.

So best would be to never add the secodary hcd if there are no USB 3 ports,
meaning no:
  xhci->shared_hcd = usb_create_shared_hcd(..);
  usb_add_hcd(xhci->shared_hcd, dev->irq,

Instead we need to make sure xhci->shared_hcd is set to NULL,
and modify at least the following functions to work with only one xhci hcd:

xhci_run()
xhci_stop()
xhci_suspend()
xhci_resume()
xhci_gen_setup()

More changes are very likely needed,  but this is a place to start

-Mathias  

  



--
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


"hub doesn't have any ports" error message on the disabled USB addressable root hub port

2017-10-23 Thread Thang Q. Nguyen
Hi,
In our latest ARM64-based CPU, we use the DesignWare USB which is
xHCI-compatible. For some reasons, we disable USB3.0 support so remove the
unnecessary USB3.0 capability structure information as specified in the
xHCI specification 1.1, section 7.2:
"At least one of these capability structures is required for all xHCI
implementations. More than one may be defined for implementations that
support more that one bus protocol."

When booting kernel, linux kernel displays an error message to claim about
no USB port on the USB3.0 roothub:
[3.497767] hub 2-0:1.0: config failed, hub doesn't have any ports!
(err -19)
Although the error message does not affect USB functionality, error
message will make users confused.

Looking into the XHCI driver, there are always two USB hub ports
implemented. This implements the xHCI specification as in 4.19.7:
"In a USB3 hub, two independently addressable hub ports exist for each
physical down stream connector; a USB2 compatible port accessed through
the USB2 connection and a USB3 compatible port accessed through the
SuperSpeed connection. The Root Hub of the xHCI emulates this operation by
defining a Root Hub PORTSC register for each connection type; USB2
(Low-/Full-/High-Speed) or USB3 (SuperSpeed)."

But the problem is that, xhci-hcd always pass both USB hub ports to
usb-core driver. In case any of USB2 or USB3 compatible port is missing,
there is no port on the corresponding hub and kernel will displays the
error message.

Below are some approaches we suggest to overcome the issue:
Approach 1: Allow roothub has no port. The change will look like:
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b5c7336..995d62d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1347,6 +1347,9 @@ static int hub_configure(struct usb_hub
*hub,
ret = -ENODEV;
goto fail;
} else if (hub->descriptor->bNbrPorts == 0) {
+   if (hdev->parent)
+   return -ENODEV;
+
message = "hub doesn't have any
ports!";
ret = -ENODEV;
goto fail;
Approach 2: do not pass a USB hub port to usb-core if it has no port.
Don't know if this approach is feasible or not.
Approach 3: implement maximum-speed attribute support and this will be set
to high-speed in case of missing USB3 support. But this works only for the
case of USB3.0 disabled.

Can you help review and suggest what approach should be used to fix this
issue?

Thanks,
Thang Q. Nguyen
--
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 v7 4/4] soc/tegra: pmc: Use the new reset APIs to manage reset controllers

2017-10-23 Thread Philipp Zabel
On Fri, Oct 20, 2017 at 04:51:24PM +0100, Jon Hunter wrote:
> Hi Philipp,
> 
> On 19/10/17 16:17, Philipp Zabel wrote:
> > Hi Jon, Thierry,
> > 
> > On Wed, 2017-07-19 at 17:59 +0200, Philipp Zabel wrote:
> >> From: Vivek Gautam 
> >>
> >> Make use of of_reset_control_array_get_exclusive() to manage
> >> an array of reset controllers available with the device.
> >>
> >> Cc: Jon Hunter 
> >> Cc: Thierry Reding 
> >> Signed-off-by: Vivek Gautam 
> >> [p.za...@pengutronix.de: switch to hidden reset control array]
> >> Signed-off-by: Philipp Zabel 
> > 
> > will you pick this up now that the prerequisite patch 1 is contained in
> > master?
> > Please let me know if there are any issues with this patch.
> > 
> > regards
> > Philipp
> > 
> >> ---
> >> No changes since v6.
> >> ---
> >>  drivers/soc/tegra/pmc.c | 82 
> >> -
> >>  1 file changed, 20 insertions(+), 62 deletions(-)
> >>
> >> diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> >> index e233dd5dcab3d..749b218147a19 100644
> >> --- a/drivers/soc/tegra/pmc.c
> >> +++ b/drivers/soc/tegra/pmc.c
> >> @@ -124,8 +124,7 @@ struct tegra_powergate {
> >>unsigned int id;
> >>struct clk **clks;
> >>unsigned int num_clks;
> >> -  struct reset_control **resets;
> >> -  unsigned int num_resets;
> >> +  struct reset_control *reset;
> >>  };
> >>  
> >>  struct tegra_io_pad_soc {
> >> @@ -348,32 +347,14 @@ static int tegra_powergate_enable_clocks(struct 
> >> tegra_powergate *pg)
> >>return err;
> >>  }
> >>  
> >> -static int tegra_powergate_reset_assert(struct tegra_powergate *pg)
> >> +static inline int tegra_powergate_reset_assert(struct tegra_powergate *pg)
> >>  {
> >> -  unsigned int i;
> >> -  int err;
> >> -
> >> -  for (i = 0; i < pg->num_resets; i++) {
> >> -  err = reset_control_assert(pg->resets[i]);
> >> -  if (err)
> >> -  return err;
> >> -  }
> >> -
> >> -  return 0;
> >> +  return reset_control_assert(pg->reset);
> >>  }
> >>  
> >> -static int tegra_powergate_reset_deassert(struct tegra_powergate *pg)
> >> +static inline int tegra_powergate_reset_deassert(struct tegra_powergate 
> >> *pg)
> >>  {
> >> -  unsigned int i;
> >> -  int err;
> >> -
> >> -  for (i = 0; i < pg->num_resets; i++) {
> >> -  err = reset_control_deassert(pg->resets[i]);
> >> -  if (err)
> >> -  return err;
> >> -  }
> >> -
> >> -  return 0;
> >> +  return reset_control_deassert(pg->reset);
> >>  }
> 
> Nit-pick ... I think we should just get rid of this inline functions now
> and just call reset_control_assert/deassert() where these are used.
> 
[...]
> 
> Otherwise ...
> 
> Acked-by: Jon Hunter 
> 
> Thierry has just sent out his pull requests for v4.15 so we may have
> missed this release :-(

Thanks, I'll drop the inline functions and send a new version, then.

regards
Philipp
--
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: [RESEND x2][PATCH 0/3] dwc2 fixes for edge cases on hikey

2017-10-23 Thread Minas Harutyunyan
On 10/20/2017 3:57 PM, Minas Harutyunyan wrote:
> On 10/20/2017 12:20 AM, John Stultz wrote:
>> On Wed, Oct 18, 2017 at 11:46 PM, Minas Harutyunyan
>>  wrote:
>>> Could you please apply this patch. Please not apply your patch series
>>> "[PATCH 0/3] dwc2 fixes for edge cases on hikey" to check only below patch.
>>> If you confirm that this patch fix your issue with "Transaction Error"
>>> and " ChHltd set, but reason is unknown" I'll submit to LKML as final patch.
>>> Then can be applied your patch series, without patch 1/3 (changing in
>>> connector id status change) to correctly set UDC states.
>>>
>>> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index
>>> f4ef159b538e..7da22152df68 100644
>>> --- a/drivers/usb/dwc2/hcd.c
>>> +++ b/drivers/usb/dwc2/hcd.c
>>> @@ -331,6 +331,9 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
>>>usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>>usbcfg &= ~(GUSBCFG_HNPCAP | GUSBCFG_SRPCAP);
>>>
>>> +   /* Set HS/FS Timeout Calibration */
>>> +   usbcfg |= GUSBCFG_TOUTCAL(7);
>>> +
>>>switch (hsotg->hw_params.op_mode) {
>>>case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE:
>>>if (hsotg->params.otg_cap ==
>>
>>
>> So while using this patch and the earlier one from Vardan, I don't see
>> the "Transaction Error"
>> and " ChHltd set, but reason is unknown" messages, but I do see:
>>
>> [  272.290459] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290476] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290491] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290507] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290522] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290538] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290554] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290570] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290585] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290687] dwc2 f72c.usb: dwc2_hsotg_ep_stop_xfr: timeout 
>> DIEPINT.NAKEFF
>> [  272.290702] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>> [  272.290717] dwc2 f72c.usb: Mode Mismatch Interrupt: currently
>> in Host mode
>>
>> After which the USB eth device stops functioning.
>>
>> So its not really much functional change from without the patch from
>> my perspective.
>>
>> Additionally, I'm still not seeing any disconnect calls when removing
>> the B plug.
>>
>> Re-adding my three patches ontop of this change and Vardan's does fix
>> both the UDC state handling and avoids usb devices from failing when
>> the board is in host mode and the /dev/usb-ffs/adb/ep0 file is closed
>> by adbd.
>>
>>
>> thanks
>> -john
>>
> 
> Hi John Stultz,
> 
> It's good news that you not see more "Transaction error" and "ChHlt set,
> but reason is unknown"!
> 
> To avoid "Mode Mismatch" interrupt please apply your patch 2/3.
> 
> Additionally I see that in your setup used UTMI+ 8-bit PHY but
> GUSBCFG.USBTRDTIM set to 5, but should be 9.
> In device mode in function dwc2_hsotg_core_init_disconnected() GUSBCFG
> related fields TOUTCAL and USBTRDTIM setting again, but in Host mode
> these fields are not set at all. This can be reason why using your patch
> 1/3 you overcome TOUTCAL and USBTRDTIM issue.
> 
> So, suggesting another patch for USBTRDTIM field bellow:
> 
> @@ -2311,10 +2314,17 @@ static int dwc2_core_init(struct dwc2_hsotg
> *hsotg, bool initial_setup)
> */
>static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
>{
> -   u32 hcfg, hfir, otgctl;
> +   u32 hcfg, hfir, otgctl, usbcfg, trdtrim;
> 
>   dev_dbg(hsotg->dev, "%s(%p)\n", __func__, hsotg);
> 
> +   /* Set USBTrdTim value */
> +   usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
> +   usbcfg &= ~GUSBCFG_USBTRDTIM_MASK;
> +   trdtrim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
> +   usbcfg |= (trdtrim << GUSBCFG_USBTRDTIM_SHIFT);
> +   dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
> +
>   /* Restart the Phy Clock */
>   dwc2_writel(0, hsotg->regs + PCGCTL);
> 
> 
> Please apply follow patches:
> 1. Vardan's patch.
> 2. Patch for TOUTCAL.
> 3. Patch for USBTRDTIM (see above).
> 4. Your patch 2/3 to avoid "Mode Mismatch" interrupts.
> 5. Your patch 3/3 to set udc state to "not attached".
> 
> Unfortunately, we haven't hikey board in our lab and can't fully test
> patches on our side.
> 
> 
> Thanks,
> Minas
> 
Hi John Stultz,

Could you please verify on your setup follow patches:
1. Vardan's patch.
2. Patch for TOUTCAL programming (new version see below).
4. Your patch 2/3 to avoid "Mode Mismatch" interrupts.
5. Your patch 3/3 to set udc state to "not attached".

[GIT PULL] USB/PHY driver fixes for 4.14-rc6

2017-10-23 Thread Greg KH
The following changes since commit 33d930e59a98fa10a0db9f56c7fa2f21a4aef9b9:

  Linux 4.14-rc5 (2017-10-15 21:01:12 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ 
tags/usb-4.14-rc6

for you to fetch changes up to 1ac7db6db1eeff901bfd6bbcd502b4634fa4:

  usb: hub: Allow reset retry for USB2 devices on connect bounce (2017-10-19 
09:49:11 +0200)


USB/PHY fixes for 4.14-rc6

Here are a small number of USB and PHY driver fixes for 4.14-rc6

There is the usual musb and xhci fixes in here, as well as some needed
phy patches.  Also is a nasty regression fix for usbfs that has started
to hit a lot of people using virtual machines.

All of these have been in linux-next with no reported problems.

Signed-off-by: Greg Kroah-Hartman 


Alan Stern (1):
  USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor()

Alexandre Bailon (3):
  usb: musb: musb_cppi41: Fix the address of teardown and autoreq registers
  usb: musb: musb_cppi41: Fix cppi41_set_dma_mode() for DA8xx
  usb: musb: musb_cppi41: Configure the number of channels for DA8xx

Antoine Tenart (2):
  phy: mvebu-cp110-comphy: fix mux error check
  phy: mvebu-cp110-comphy: explicitly set the pipe selector

Arvind Yadav (1):
  phy: tegra: Handle return value of kasprintf

Bin Liu (1):
  MAINTAINERS: fix git tree url for musb module

Chunfeng Yun (1):
  phy: phy-mtk-tphy: fix NULL point of chip bank

Dan Carpenter (1):
  phy: mvebu-cp110: checking for NULL instead of IS_ERR()

Douglas Anderson (3):
  phy: rockchip-typec: Set the AUX channel flip state earlier
  phy: rockchip-typec: Don't set the aux voltage swing to 400 mV
  phy: rockchip-typec: Check for errors from tcphy_phy_init()

Felipe Balbi (1):
  usb: quirks: add quirk for WORLDE MINI MIDI keyboard

Greg Kroah-Hartman (2):
  Merge tag 'phy-for-4.14-rc' of git://git.kernel.org/.../kishon/linux-phy 
into usb-linus
  Merge tag 'usb-serial-4.14-rc6' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus

Hans de Goede (1):
  USB: devio: Revert "USB: devio: Don't corrupt user memory"

Jeffy Chen (1):
  xhci: Cleanup current_cmd in xhci_cleanup_command_queue()

Johan Hovold (3):
  USB: serial: metro-usb: add MS7820 device id
  USB: musb: fix session-bit runtime-PM quirk
  USB: musb: fix late external abort on suspend

Jonathan Liu (2):
  usb: musb: Check for host-mode using is_host_active() on reset interrupt
  usb: musb: sunxi: Explicitly release USB PHY on exit

Lu Baolu (1):
  usb: xhci: Reset halted endpoint if trb is noop

Maksim Salau (1):
  usb: cdc_acm: Add quirk for Elatec TWN3

Mathias Nyman (2):
  xhci: Identify USB 3.1 capable hosts by their port protocol capability
  usb: hub: Allow reset retry for USB2 devices on connect bounce

Mayank Rana (1):
  usb: xhci: Handle error condition in xhci_stop_device()

 MAINTAINERS  |  1 -
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 18 --
 drivers/phy/mediatek/phy-mtk-tphy.c  |  3 +-
 drivers/phy/rockchip/phy-rockchip-typec.c| 82 
 drivers/phy/tegra/xusb.c |  2 +
 drivers/usb/class/cdc-acm.c  |  3 +
 drivers/usb/core/config.c|  6 +-
 drivers/usb/core/devio.c |  6 +-
 drivers/usb/core/hub.c   | 11 ++--
 drivers/usb/core/quirks.c|  4 ++
 drivers/usb/host/xhci-hub.c  | 23 +--
 drivers/usb/host/xhci-ring.c | 21 ---
 drivers/usb/host/xhci.c  |  3 +-
 drivers/usb/musb/musb_core.c | 21 ---
 drivers/usb/musb/musb_core.h |  2 +
 drivers/usb/musb/musb_cppi41.c   | 94 
 drivers/usb/musb/sunxi.c |  2 +
 drivers/usb/serial/metro-usb.c   |  1 +
 18 files changed, 226 insertions(+), 77 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