Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp842818ybl; Tue, 13 Aug 2019 03:34:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWwgRwlGZfy+DZA9BwAxhuplYJHKpEdMI8air/tYZuMG+HF9oplYKC4xGzQi3UCKVijG9V X-Received: by 2002:a65:5202:: with SMTP id o2mr32352590pgp.29.1565692442961; Tue, 13 Aug 2019 03:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565692442; cv=none; d=google.com; s=arc-20160816; b=RDFqVKxef2cM1XoHKReAqtHAufLAW4MAxv7xEwKhkqVy/0ylyccGkuXpnRNfMOvGL9 zweFVVdq+jJnaamDgne5OamHFm1BDx0mk445nDFunuZKWHGtEoHFD11ODKjiGZYOKR3O z6wuHH+cgKroknHDvytLaPw6fxdAkb6LPaDzylpuzkA4bodR81N+ceWBZPaYp2kyKphg RzRQjuu78G7ycMozbqwp1V0wxyIDjuzu9iPdVuAuPyAZVUbyFttEgg0hz30TIRQfwUCI Dsf5K+7ijKJpQtaK5B1H1NkpM/Iu7SX4yV2j5H+7eGpI2SHw30qCedpZs1dhwDrUKsiW /6RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=oZGBgMtVTQjqcvmQOSWTZ0idl4MlLSwg8eJFGiHh28c=; b=h00jKbbOMfe8FUiJX3tpGP1l8BLaPr33EeogLNaOA5yx+DiIPbKH+Gpi3bpR5scnZY H6NR3X2popfH80uDgfBM8+hNB9IwcmNB/5Bx/olCVNHzeCNGsCNhhmqZgrYm+faSwSN2 hIBe5WAak85JYmPY2Y/L4Zio84zHwFR5M+P38V2F9j0DIhz4UGdioOCeEqUjOEL45PJT 1U3hTdLRw1vCCBJ/dSvnhG/ATdzc1LGrz4xcE/mm4pRGYGH24QHHfdl2N9I+gYZXek4e a21UFN3ndbZcxvgbVad/Yikn+LYWvjW3rgQ9ZO8qEeWXg16cz+2RhO67ODBay7h56Bhn 329A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si708756pjn.93.2019.08.13.03.33.46; Tue, 13 Aug 2019 03:34:02 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727520AbfHMIuo (ORCPT + 99 others); Tue, 13 Aug 2019 04:50:44 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:24649 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726826AbfHMIuo (ORCPT ); Tue, 13 Aug 2019 04:50:44 -0400 X-UUID: c7dc1ecabd254d12831d5525f4167213-20190813 X-UUID: c7dc1ecabd254d12831d5525f4167213-20190813 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 5116929; Tue, 13 Aug 2019 16:50:36 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS32DR.mediatek.inc (172.27.6.104) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 13 Aug 2019 16:50:26 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 13 Aug 2019 16:50:25 +0800 Message-ID: <1565686228.7317.2.camel@mhfsdcap03> Subject: Re: [PATCH v10 5/6] usb:cdns3 Add Cadence USB3 DRD Driver From: Chunfeng Yun To: Roger Quadros CC: Felipe Balbi , Heikki Krogerus , Pawel Laszczak , "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "jbergsagel@ti.com" , "nsekhar@ti.com" , "nm@ti.com" , Suresh Punnoose , Jayshri Dajiram Pawar , "Rahul Kumar" , Anil Joy Varughese Date: Tue, 13 Aug 2019 16:50:28 +0800 In-Reply-To: <7c0c5de2-1100-333a-eb0e-52bab4eb9cd5@ti.com> References: <1563733939-21214-1-git-send-email-pawell@cadence.com> <1563733939-21214-6-git-send-email-pawell@cadence.com> <88742d5b-ee10-cf4e-6724-58e7bdd19cb9@ti.com> <1e557bcf-2d50-f600-0e81-1f9fba5499a1@ti.com> <20190812103147.GA4691@kuha.fi.intel.com> <874l2mtuu6.fsf@gmail.com> <679b82bc-9f33-91ad-4acf-bf6a29e51bc1@ti.com> <1565681434.23705.66.camel@mhfsdcap03> <7c0c5de2-1100-333a-eb0e-52bab4eb9cd5@ti.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: 030000A40FB1AEB73A53E4779BA0623DEFCE27B2CE20C86AB7935D99E4C5725F2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-08-13 at 10:48 +0300, Roger Quadros wrote: > > On 13/08/2019 10:30, Chunfeng Yun wrote: > > On Mon, 2019-08-12 at 16:04 +0300, Roger Quadros wrote: > >> > >> On 12/08/2019 15:46, Felipe Balbi wrote: > >>> > >>> Hi, > >>> > >>> Roger Quadros writes: > >>>>> The sysfs file we expose from the class for the role switches is > >>>>> primarily meant for supporting proprietary protocols that require us > >>>>> to basically override the connector USB data role. The default role > >>>>> should always be selected in the drivers. > >>>> > >>>> OK. Let's take this example > >>>> - Port is dual-role port micro AB. > >>>> - microAB to type-A adapter is connected which pulls ID low. port transitions > >>>> to "host" role by the controller driver. > >>>> - proprietary protocol want to switch role to device role so writes "device" to > >>>> mode switch sysfs. port transitions to "device" role. > >>>> > >>>> Now, how does controller driver know to fall back to HW based role switching? > >>> > >>> Use a 'disconnect' or 'suspend' event to go reset it? But that should, > >>> probably, be done at kernel space, no? > >>> > >> > >> Yes that could be one option. > >> So after a disconnect, sysfs role should reflect actual hardware role. correct? > > > > Maybe it's difficult to support both HW based role switch and SW based > > role switch by sysfs at the same if the HW's FSM rely on, such as, the > > state of Vbus pin or ID pin. Likes the upper example, when user writes > > "device" to mode switch sysfs, the driver should skip the HW state of ID > > pin, due to it's state is Low, or force it as High. > > > > We do need a clear way of indicating that SW wants to override so HW > state is ignored. > > > Another option way is that introduces a property in DTS to indicate the > > way the driver want to use (HW based or SW based, usb_role_switch > > doesn't provide this information for the controller driver), but is not > > flexible enough. > > That is not good enough for us. We need both HW and SW based role switching. > > Can we introduce a new state (e.g. "auto") in usb_role_switch. This would > explicitly indicate the driver to do HW based switching. But "auto" is not a role? How about introducing a new attribute in usb_role_switch? > > This way we don't need to depend on connect/disconnect events and can > do role switch tests even without cable/device connected. >