Received: by 10.213.65.68 with SMTP id h4csp884600imn; Wed, 28 Mar 2018 15:00:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+0pxHuD4VY5TznvcA5A/l/AL7wkg1Wmms19f/jOVw/gf/MQyGrLvF1R+/jzeTxigXNI0+F X-Received: by 10.98.178.20 with SMTP id x20mr4352214pfe.32.1522274403532; Wed, 28 Mar 2018 15:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522274403; cv=none; d=google.com; s=arc-20160816; b=peJn0IfmUEjrzGjWMpe95KocXJv3KbB8bQowhRtlL0ubs5RulDKGAg/7eVJ9UIz5G+ 4gwf99BZvW2caoEVgkGxgkUs3dxesEKTpJb7S3UHlvXihv1s3g06Ir6ms6+fw4WuiWiJ 9WsOhxeEOhkfrZ9g2Jb43bqS6ZFKgyasz1WxxRFiDYNdxeRjFkmFrwOlaRmNLT6jQmoB W0JodEzjJPuCGYsKuAz3ty6Oe/aeeSCEjwqopfKObrjT1vfim282y1qEGYYzu9bMFcp5 8w/HBfLmbhs4aI15U2q35vPPPsmF9rzoSA+0Ly8qZRKpa5QcWTP/7Xez+pVtsTDox8Ma 1VfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nlzyShky6WpJ/xyW7H/BZ8Cgqp/lzGgXZH6et/YUnDM=; b=ul5FjED1Sn8nulL/tn/jM6xi34kREH//vTvFsnXsXAttyYUx1GpvH2ZA0YCxU58K4b 6CDZAN7CyhifQBi2GAxb/cLGlxrzzyOqPwbZ39QuBkPj3dwdmCLw0w41wp1gEv+tw/v2 0wpYrQfb+N7xgGxs2CDmKJSL4PcLmZnIeDFpO7b1NaUBqgQ7w0arcC+a3+LPTHH0vkDi ym02vBYxgXW9xDZ4aAXETSAX7Pc/MXXqFLU/9/8aA1U5ciZI2dJ/zKXxtOkcQX12TRsi PgasVXlW1UpoSNA3oqS4lNu0zfFKE6SvZMdRnVWmZtJUNY09+Xia2YIJcdvq+1dbH/T4 pPxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6-v6si4331404plm.239.2018.03.28.14.59.18; Wed, 28 Mar 2018 15:00:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753589AbeC1Vwj (ORCPT + 99 others); Wed, 28 Mar 2018 17:52:39 -0400 Received: from 220.107.128.77.rev.sfr.net ([77.128.107.220]:48996 "EHLO gagarine.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752832AbeC1Vwi (ORCPT ); Wed, 28 Mar 2018 17:52:38 -0400 Received: by gagarine.paulk.fr (Postfix, from userid 114) id 21443C0B47; Wed, 28 Mar 2018 23:52:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gagarine.paulk.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.1 Received: from localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id 811EEC0AAA; Wed, 28 Mar 2018 23:52:29 +0200 (CEST) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Bin Liu , Chen-Yu Tsai , Maxime Ripard , Paul Kocialkowski Subject: [PATCH] usb: musb: Support gadget mode when the port is set to dual role Date: Wed, 28 Mar 2018 23:52:13 +0200 Message-Id: <20180328215213.29538-1-contact@paulk.fr> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allows dual-role ports to be reported as having gadget mode by the musb_has_gadget helper. This is required to enable MUSB at all with MUSB glue layers that set the port mode to MUSB_PORT_MODE_DUAL_ROLE at init. Most notably, this allows calling musb_start when needed in the virtual MUSB root HUB, regardless of whether the current mode should be gadget or host. This fixes USB OTG on Allwinner devices that I could test it with, mainly A20 devices. Signed-off-by: Paul Kocialkowski --- drivers/usb/musb/musb_virthub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index 5165d2b07ade..8fd5c5f86e82 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c @@ -249,7 +249,8 @@ static int musb_has_gadget(struct musb *musb) #ifdef CONFIG_USB_MUSB_HOST return 1; #else - return musb->port_mode == MUSB_PORT_MODE_HOST; + return musb->port_mode == MUSB_PORT_MODE_HOST || + musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE; #endif } -- 2.16.2