Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752698AbbGODW6 (ORCPT ); Tue, 14 Jul 2015 23:22:58 -0400 Received: from mail-by2on0120.outbound.protection.outlook.com ([207.46.100.120]:18272 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751918AbbGODWy (ORCPT ); Tue, 14 Jul 2015 23:22:54 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Date: Wed, 15 Jul 2015 10:13:40 +0800 From: Peter Chen To: Andrew Bresticker CC: Roger Quadros , Alan Stern , Felipe Balbi , Greg Kroah-Hartman , Dan Williams , , "Mathias Nyman" , , , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , , "linux-tegra@vger.kernel.org" Subject: Re: [PATCH v3 00/11] USB: OTG/DRD Core functionality Message-ID: <20150715021339.GB30154@shlinux2> References: <1436350777-28056-1-git-send-email-rogerq@ti.com> <20150714005942.GB31197@shlinux2> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD052;1:Bq8vsTORC+DiNt1UPNYttFQ/WYu3ExUBdK2Pi6HOo62ZziqF48icwTPCOrBGEMrlohXdkZbOOLaYJUW3/111CYSVWKWbV+SuWbdoeysnxVwkBGV8mkueqETY+r+I3ruy0aeYwojcEf1PsDiJT011l7J2owZc5bOzu+3/AWjGfRyg3xD+ZEki9YhjjxuirUz7CUIfX00Y/lRkkphy8Bx3LtGTj7n6kMFvqOVRiFjSicSWBDsjtjH9VYafDtyzIoLaVGdK/t+fJMT6tkI5YqYEEgV7qCvZqKGo4pdvb3SEaMVGISuibUycxE/GDzY2DKASaBSWhCdp1akFX/1X5dSWlF2FhlWUb1bP58oCfs10clLsmSpYRV/lfNQKvL+8QJTC0qSzFrOnZc7LiUibKhPZWg68xtcZFmr32eHqBQlBWMHcKGMWT1eplEr+UWAb5aWYypxJAW5/+5rBmPFUdOKQyA== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1060300003)(339900001)(377454003)(189002)(24454002)(51704005)(199003)(92566002)(50986999)(4290100001)(33656002)(106466001)(110136002)(5001960100002)(77096005)(104016003)(47776003)(77156002)(93886004)(110436001)(97756001)(62966003)(76176999)(6806004)(105606002)(33716001)(561944003)(50466002)(2950100001)(4001350100001)(85426001)(19580395003)(86362001)(54356999)(23726002)(87936001)(46406003)(83506001)(19580405001)(46102003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1223;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;2:25jzDGpg1m9qsDW565qNrWudkWhUu012V1fS9nsD4IflKT8x/lGJ8SjIFjHRPmWc;3:l5XqCIvrQzJ6TI72CmgqdyJgs724O9YoyrPs2pQklI8DpBB93SjyTy6qkAjUq+j17P3aSOEKKrFN0VNziiDNae9oskITq67boJalwbkO5a7b1FTyFa0I8MCk1QmKjklcV+piB5Iz74ucmtWFFuuSYFoPAq4QhKiNYPEv2eMyw4g30Cx7ZjwgJabTHnNwOmo+N6Vw0aTJQ74TXghmc1CpSlITWpmpcKMMCbjQkJCJM0E=;25:pf9gL03I1n+tI1XvuJp+GjrooLthZ6upCwK/4NWWr50BujVvDhMlne1ArEfs/8HcPNx4yG/5oj66sPKopY1rasGH5fFKf5I5XKdZGrWbVRx2cuZvblGogM694YcIBzxxZb8gabjSjkZxzm/Iqr6y+pm/C6Apa0uu5bIyaGwernvaRNWRPbiEVbwFLe/xH7hh4YYeoNZJeZ4gvT6H2cAgnqNEK4QuOWrnvXZMKPo//pBkd969TAAMKqDn1V0Q8ZUMvyceJZQGnUz4bR1MCGvpPg==;20:5E9SH5J8MAlCT/RvJ4zky45B4zjHnP6H1xZEEUn0HXrKPmWHF10R9OYIXXDMlUzhprbdsNaPqr28fE5VIi0T2Wvt4CxMcwgkQW1EWQduMBFxMDbXkQptQw+zcH0ulH2qdSLWAJNsqONuNqO0ABqLICMKg4t5fSdHlbBr7vHVDixjNxnOKOc26qk2uRqlCKsZHUeOG4rG8bofIpI4sEn6io933z0oDkz5nHkE+LvOCHQFkhUqgIs76uiemZgI/7Q/M9o1YMMHt1u99XjROsUtQ7j974RZcR7c1fd9FDhTQqbwUFAWS9GnkYrNb0oiufJpD8kMR/cPyZSESzhYZ4n0VRSwZzhPLnHq/zJE8//ZBrY= X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; BY1PR0301MB1223: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(1201001)(5005006)(3002001);SRVR:BY1PR0301MB1223;BCL:1;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;4:eG7Pud6ApmA50dg9zNuBpequIrv8mPMnbvn0Uls2pUnHL0KJvkGe+G8vkGuwvz0MPznCDmLfYVuENwzZa21GLMI7jd5dF7Wqc61eRAw2t6zSJAtsFIc9qLhfqwGwEcYH0GMuOAuszkVQ7FHNFpP/Nu05pMgV5vWWCq3ogZVeIaMetqyPDkxRh+02kDF3qF7HYpnWVTgC/6NWwN00IgM4E3qmeecBEhiNhmAARJfgSSJ6mqxhWH2t7mmF5opR2WdKqqGBD2WceRUE7Na3ViU6sGcxJGGsNLTMlXsvFuN7rSnVn1BZrNSwjHXc/IrP9moT X-Forefront-PRVS: 0638FD5066 X-Microsoft-Exchange-Diagnostics: =?us-asc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Qy7DeLNSe?= =?us-ascii?Q?b6uNN38fwyBcDKpg9qfELKfjUjykMabXl9ySYGODCJdfA7dbIeYC44vYUf5m?= =?us-ascii?Q?W0T6Ix8tFT3iUjBuM/R+01d4gCaQYsnwqCFJQK8Lgnml35h0puNDy3bKlyy5?= =?us-ascii?Q?8UkkaYRbHz64sy4934KnPp0FnYaylVI8tm0TJvQ4wYExaZkfJhVummZ+9NVI?= =?us-ascii?Q?fIPfuhtzERFcfFVfSS1kmjE1TuSTxBEVCsmoGhIVh9305iUjRxg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;5:c3Ion0/q2tI4oDMvX0CDfuMRpv4+nhJj9Pfpdsb9oqZWX6HrnlbNQOJ4MLYwGEohos/kbGkb58QydWMOqMxSOj7L+pSbliRdKv1KpngSgtj2WMbfxga02a4QMHTUHnmGN6BkT9SNs4TQ2JAieK0R/Q==;24:sUK/66oIBpXH0QSc7nlcFLHZdp7tBIpW3rTNlsfCgHlMKc67dtxEOau6/5flc8E/1JWr/Jj5LWYR80EdHWx2LrUtpH7Jwvh/kXp23TaFvro=;20:vlI5jpPaIARgBLsQYI6DQ3Ij5OsscNxxZuvjfNcAKNv/v05IsdKOkcBFCGkJ7+wnn77XygrG4VrdiR2PedjMxw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2015 03:22:51.2961 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1223 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3360 Lines: 72 On Tue, Jul 14, 2015 at 11:18:30AM -0700, Andrew Bresticker wrote: > Hi Peter, > > On Mon, Jul 13, 2015 at 5:59 PM, Peter Chen wrote: > > On Mon, Jul 13, 2015 at 12:14:43PM -0700, Andrew Bresticker wrote: > >> Hi Roger, > >> > >> On Wed, Jul 8, 2015 at 3:19 AM, Roger Quadros wrote: > >> > Usage model: > >> > ----------- > >> > > >> > - The OTG controller device is assumed to be the parent of > >> > the host and gadget controller. It must call usb_otg_register() > >> > before populating the host and gadget devices so that the OTG > >> > core is aware that it is an OTG device before the host & gadget > >> > register. The OTG controller must provide struct otg_fsm_ops * > >> > which will be called by the OTG core depending on OTG bus state. > >> > >> I'm wondering if the requirement that the OTG controller be the parent > >> of the USB host/device-controllers makes sense. For some context, I'm > >> working on adding dual-role support for Tegra210, specifically on a > >> system with USB Type-C. On Tegra, the USB host-controller and USB > >> device-controller are two separate IP blocks (XUSB host and XUSB > >> device) with another, separate, IP block (XUSB padctl) for the USB PHY > >> and OTG support. In the non-Type-C case, your OTG framework could > >> work well, though it's debatable as to whether or not the XUSB padctl > >> device should be a parent to the XUSB host/device-controller devices > >> (currently it isn't - it's just a PHY provider). But in the Type-C > >> case, it's an off-chip embedded controller that determines the > >> dual-role status of the Type-C port, so the above requirement doesn't > >> make sense at all. > > > > Hi Andrew, > > > > I think your problem is how to add your core driver to manage device and > > host functionality together, and once you find how (through padctl/type-c > > controller) to do it based on current code, it will be clear how to use roger > > proposal framework at that time. > > > > Most of current core drivers, we use extcon driver (through gpio) or USB > > vbus/id pin (through internal registers) to manager roles. > > Right, currently I'm modeling the Type-C controller as an extcon > device and handle the role-changes in the core drivers, but that > doesn't really make sense for the non-Type-C case where we use the > XUSB padctl controller and need a full OTG state-machine. The full OTG FSM is only applied if your board needs it, you can disable it through dts. Jun [1] and Roger's patchset are for it. > Roger's new > OTG/DRD framework would fit my situation perfectly since it makes the > host/device-controller drivers independent from all the > OTG/role-changing logic. The only issue is the requirement that the > OTG/DRD controller be the parent device of the host/device > controllers. > The core device is the parent for host/device device, the OTG core just use the pointer of it, Roger does an example using dwc3 [2]. [1] http://www.spinics.net/lists/linux-usb/msg127110.html [2] http://www.spinics.net/lists/linux-usb/msg126999.html -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/