Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp675314ybl; Tue, 13 Aug 2019 00:31:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFVB/pNg/W35unZpQS1mTkmtWdX1arFj/TPQ9Mhqi+hgnoH6RuqceQViKsgjL5kWDEu9Vw X-Received: by 2002:a63:550d:: with SMTP id j13mr33758520pgb.173.1565681500998; Tue, 13 Aug 2019 00:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565681500; cv=none; d=google.com; s=arc-20160816; b=jUkf9tRXuIpwafZWOjNZVGqRj0iZ4vkCeL5jAyEixwnkIKu3hOqXzVHlozeI2A40T8 8u00O0j7vFPNZM3MKTg3C0dLV7Y/M2/PqLqbt6wRmFF1F2YypvZKpL2ixE6LxmeiYvuF HhvN13U1sT9NySpT34CQGUaBd0lg27M1Uiqkc5mJDydtSn69QLKpxY9GwqNi29mPeqRm Z333coImc2UBmYPKvDjLRyxy7XeLjx0Kbk2qR1PrZMQ991MKZFgAG+2rytnoS42SZIyg ST/kbHBt6p1Q9Ucc/9g3AMC59NdVm/BealUh+Nu3k9WAgdqCO7HW6o8PeghoLDubXXzC 8Eqw== 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=3cC8VLcX85N+GylVg1Wd6KkJ+M+2nuwvvYEh59IFn74=; b=FiOJy10FTjL+/0yzKEyLtKZSE0I0ui+KR1fMVOtlo1Cgkdw5FKj80qczL2orBkykUp aGiwjAoau3AQKvpBonOvny0+oCyqIT+dllU0mMU5w0VWJZfkFc6uQ7PR8gsQ1oRiwYYy cGfYz1Si+SzVw65uCPeicF9SMJ7JhtUYb6SIm+yZI3LEfhE6nIbVXtlp7gT10GUVlIsX DLRbdPAIQ3hAmpfwJaxGlinoqVR//LPe5cG9Zi01gk56HENuTdpPfFS6Qd6E4ulWhoR5 65dWiTsube6W3+jKNKj1HFwo7O7gR8UKep3tliGbz8kMdUtmWrbj/34BtU5ya0+5UFOH Sjxg== 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 f98si42293232plb.256.2019.08.13.00.31.24; Tue, 13 Aug 2019 00:31:40 -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 S1727741AbfHMHas (ORCPT + 99 others); Tue, 13 Aug 2019 03:30:48 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:55542 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726789AbfHMHas (ORCPT ); Tue, 13 Aug 2019 03:30:48 -0400 X-UUID: 2f2b0143cd3e40c9bcb0e0e98dbafa8a-20190813 X-UUID: 2f2b0143cd3e40c9bcb0e0e98dbafa8a-20190813 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 972925513; Tue, 13 Aug 2019 15:30:34 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 13 Aug 2019 15:30:32 +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 15:30:31 +0800 Message-ID: <1565681434.23705.66.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 15:30:34 +0800 In-Reply-To: <679b82bc-9f33-91ad-4acf-bf6a29e51bc1@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> 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: 233011D5CB765319D937F8AAFF09E4447CF6C202C05D790FC71AAF3EC6A173412000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. > > cheers, > -roger