Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755068AbcKBAnX (ORCPT ); Tue, 1 Nov 2016 20:43:23 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:8795 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754493AbcKBAnV (ORCPT ); Tue, 1 Nov 2016 20:43:21 -0400 X-IronPort-AV: E=Sophos;i="5.31,433,1473087600"; d="scan'208";a="223986348" From: Yoshihiro Shimoda To: Peter Chen CC: "kishon@ti.com" , "gregkh@linuxfoundation.org" , "balbi@kernel.org" , "Peter.Chen@nxp.com" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Subject: RE: [PATCH v2] phy: rcar-gen3-usb2: add sysfs for usb role swap Thread-Topic: [PATCH v2] phy: rcar-gen3-usb2: add sysfs for usb role swap Thread-Index: AQHSNA4EKI4bcQHEuUyfW4PB9zAIa6DEAJuAgADahjA= Date: Wed, 2 Nov 2016 00:43:15 +0000 Message-ID: References: <1477983718-4145-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> <20161101113743.GC28525@b29397-desktop> In-Reply-To: <20161101113743.GC28525@b29397-desktop> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yoshihiro.shimoda.uh@renesas.com; x-originating-ip: [211.11.155.144] x-ms-office365-filtering-correlation-id: 781572d4-6f0a-4c04-9e48-08d402b93b68 x-microsoft-exchange-diagnostics: 1;HK2PR06MB0545;7:IENNegoqP++weMMqDx/pcm0+BcXrn6yjc6XevK9ckARbZpVB35yVclf9W4j+j1/H2t8A9bpJZ1ZKOZ4aM5Vm4oq8Nt9wnRkozxM5TwBHm0QgLOK2GfgteramauMZBOgGjYk208V2Wd5JwhxDKnhnqfuaTr/Q6vbgwmD9Imd/av0xAohCAbrUStf17Ro77wazC2QRc5HQ7z2erYUZE3KtWcgRS4TwcxBXt30X9Jtj/h84zGx7DZC7Zlz2PMdnlKLqk/VrASjlU0nhnyYM9cV27fC6F6Ux2EuDdvIDzfgdkXLE8aBvEi4IyqYu2dmgfm4yJ2lZNVW2S4SpbV8aGKs/q1AB3ReA8MCk5jUp+2HErOE=;20:TLN92yqX4w7VmQEFMJtMj1CERBj4Yx51d32zx3SVpn3NKqjo391YYjG5rfoKiaIm0LoerGqnHVa1p0Qxl6QLtC9KmUZgw0H0uCYuo+7FniMT55UOsnKOGyjE/V2kZOULAqbxHABMx1cTRSLNhkeHwEoqWIBPBh2fzeqF5kOd8Qc= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB0545; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(21532816269658); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026);SRVR:HK2PR06MB0545;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB0545; x-forefront-prvs: 0114FF88F6 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(377454003)(199003)(189002)(24454002)(50944005)(102836003)(3660700001)(189998001)(101416001)(76176999)(6116002)(110136003)(66066001)(3846002)(7696004)(50986999)(8936002)(586003)(10400500002)(54356999)(5660300001)(9686002)(2906002)(76576001)(5002640100001)(68736007)(4326007)(11100500001)(3280700002)(230783001)(97736004)(345774005)(106116001)(77096005)(19580395003)(106356001)(105586002)(122556002)(8666005)(19580405001)(7846002)(33656002)(305945005)(81156014)(81166006)(1411001)(6916009)(8676002)(92566002)(2900100001)(86362001)(7736002)(74316002)(2950100002)(87936001)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR06MB0545;H:HK2PR06MB0548.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2016 00:43:15.2217 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0545 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uA20j2U8005926 Content-Length: 3315 Lines: 76 Hi Peter, > From: Peter Chen [mailto:hzpeterchen@gmail.com] > Sent: Tuesday, November 01, 2016 8:38 PM > > On Tue, Nov 01, 2016 at 04:01:58PM +0900, Yoshihiro Shimoda wrote: > > This patch adds sysfs "otg_inputs" for usb role swap. This parameter > > is write-only and if you use them as the following, you can swap > > the usb role. > > > > For example: > > 1) connect a usb cable using 2 salvator-x boards > > 2) On A-device (as host), you input the following command: > > # echo a_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs > > 3) On B-device (as peripheral), you input the following command: > > # echo b_bus_req > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs > > > > Then, the A-device acts as a peripheral (A-peripheral) and the B-device > > acts as a host (B-host). > > Please note that A-device must input the following command if you > > want the board to act as a host again. (even if you disconnect the usb > > cable, since id state may be the same, the condition keeps "A-peripheral".) > > # echo a_bus_drop > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs > > > > Also you can use the following command if you want the B-device board to > > act as a peripheral again. > > # echo b_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs > > > > Signed-off-by: Yoshihiro Shimoda > > --- > > This patch is based on the latest linux-phy.git / next branch. > > (commit id = 7809cd2ce6abd4f431e4b14e6b1276a7cc842ac4) > > > > Since this patch is related to usb, I added email addresses of Greg, Felipe, > > Peter and USB ML as CC. (This patch doesn't use USB OTG FSM though.) > > > > Changed from v1: > > - rebase the latest next branch. > > > > .../ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 | 11 ++ > > drivers/phy/phy-rcar-gen3-usb2.c | 124 ++++++++++++++++++++- > > 2 files changed, 134 insertions(+), 1 deletion(-) > > create mode 100644 Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 > > > > diff --git a/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 > b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 > > new file mode 100644 > > index 0000000..c7e715af > > --- /dev/null > > +++ b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 > > @@ -0,0 +1,11 @@ > > +What: /sys/devices/platform//otg-inputs > > +Date: October 2016 > > +KernelVersion: 4.10 > > +Contact: Yoshihiro Shimoda > > +Description: > > + This write-only file changes the phy mode for role swap of usb. > > + This file accepts the following strings: > > + "a_bus_req/" - switching from A-Host to A-Peripheral > > + "a_bus_drop" - switching from A-Peripheral to A-Host > > + "b_bus_req" - switching from B-Peripheral to B-Host > > + "b_bus_req/" - switching from B-Host to B-Peripheral > > Would you really care OTG FSM state machine? If not, you could just use > "host" and "peripheral" to stand for current USB role, and implement > role switch sysfs like: /sys/devices/platform//role. Thank you for the comment! Since I would not care OTG FSM state machine for now, I will modify the patch to use "host" and "peripheral" that you suggested. Best regards, Yoshihiro Shimoda > Peter >