From patchwork Mon Apr 3 12:20:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 96626 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp72532qgd; Mon, 3 Apr 2017 05:21:18 -0700 (PDT) X-Received: by 10.99.44.140 with SMTP id s134mr17368190pgs.178.1491222078659; Mon, 03 Apr 2017 05:21:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 80si14130231pga.172.2017.04.03.05.21.18; Mon, 03 Apr 2017 05:21:18 -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; dkim=pass header.i=@ti.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753159AbdDCMVQ (ORCPT + 25 others); Mon, 3 Apr 2017 08:21:16 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:13241 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753032AbdDCMVO (ORCPT ); Mon, 3 Apr 2017 08:21:14 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v33CKe3p017166; Mon, 3 Apr 2017 07:20:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1491222041; bh=YPVoKoYfGjvLLHDKCBJBHFEQb3wZSjCA0TqDlAhRAWs=; h=From:To:CC:Subject:Date; b=p4ksgP9bsiXFVbFxT3KyPPcbNLiXIeHLxzjkFs60LGTdZ6R73U/NbXWRxj8rtGJMB HD5p3JAx4R3R/viXA+DEG7Mx/JB0ZBd/cjjog5EKomTGUXorzshPQIigekhwyGPVi/ fefZdAZ3+m7MKtX4/K4CarQVsD6JA+d1qF30r5wQ= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v33CKZYh030617; Mon, 3 Apr 2017 07:20:35 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Mon, 3 Apr 2017 07:20:35 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v33CKXup010968; Mon, 3 Apr 2017 07:20:34 -0500 From: Roger Quadros To: CC: , , , Roger Quadros Subject: [PATCH v3 0/3] usb: dwc3: dual-role support Date: Mon, 3 Apr 2017 15:20:28 +0300 Message-ID: <1491222031-18120-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Taking a simplistic approach this time. We don't use the OTG controller block at all. Instead we just rely on ID events via extcon framework. I tried to get rid of workqueue but unfortunately it causes too much pain when the UDC is unregistered. https://hastebin.com/upugaqogol.xml https://hastebin.com/yayaduqodo.xml So I've still kept the workqueue around. We also have debugfs role switching, but I don't yet see how we can use this for real testing as I still need to manually plug/unplug the USB cables (host vs device) to test switching :). v3: - restructure and simplify. Remove OTG controller code, only rely on extcon. cheers, -roger Roger Quadros (3): usb: udc: allow adding and removing the same gadget device usb: dwc3: make role-switching work with debugfs/mode usb: dwc3: Add dual-role support drivers/usb/dwc3/Makefile | 4 + drivers/usb/dwc3/core.c | 18 ++--- drivers/usb/dwc3/core.h | 22 ++++++ drivers/usb/dwc3/debugfs.c | 49 +++++++++++-- drivers/usb/dwc3/drd.c | 167 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/gadget/udc/core.c | 1 + 6 files changed, 242 insertions(+), 19 deletions(-) create mode 100644 drivers/usb/dwc3/drd.c -- 2.7.4