Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757577AbcJRGTS (ORCPT ); Tue, 18 Oct 2016 02:19:18 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:14299 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753763AbcJRGTI (ORCPT ); Tue, 18 Oct 2016 02:19:08 -0400 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'208";a="222637589" From: Yoshihiro Shimoda To: Geert Uytterhoeven CC: Kishon Vijay Abraham I , "linux-kernel@vger.kernel.org" , Linux-Renesas Subject: RE: [PATCH] phy: rcar-gen3-usb2: add sysfs for usb role swap Thread-Topic: [PATCH] phy: rcar-gen3-usb2: add sysfs for usb role swap Thread-Index: AQHSKEXDtMrNXScBeEyBdiN+9FnUHqCskyeAgAEdrXA= Date: Tue, 18 Oct 2016 06:19:04 +0000 Message-ID: References: <1476688248-983-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> In-Reply-To: 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.141] x-ms-office365-filtering-correlation-id: 9638a658-095b-4735-cad1-08d3f71ea8fc x-microsoft-exchange-diagnostics: 1;HK2PR06MB0545;7:UxYQMXTTuNaGE3jU+znqqKeW7McN/iBjTZtmF7CdTCd4xmt9GC1vPRs3Wqeh7J7ZWkMknqY4XT05AnJIAW7PmokADHFdpnj3r5JA/YMb6H1/ODDkq4Cyx4+KjEcgrWnHu/jFYJj2kn6aftjJuGX+eXcHDyCW3pW0nsV8XlAiO3VF3rFWM8n2n7GBceWojr/9owLGpWoH62qxNJ61Wxh48SwrBgLDeodu9vHUEuDleXV/hYnGHFE8zjsU33lEnUNEHGyU9TIJDl+qWPVIwP/QXslEhNEMIBdCioXRiK0JDr5xyckXLEhgs632Cgnojiqz+/SwDeSp8a1marcKYHSAzxzLo8iXg2F4J23fTJwS4pA=;20:oY+ZR3zjCltoyt4zP2ex1EXSbCsIpvV805h/4HTyyvaFDm6r1MYUV2Oq1WQjPOjulGsDtfS5NwBRPwUC8AEr0Db9CxtZM8BpmC1RZ3AYafGVs0+AZk37857rp3P2dTrDktMVia0A1LuGI4iF0pTIAEUn0s2qxnvMTAXx3hWa7YM= 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)(3002001)(10201501046)(6055026);SRVR:HK2PR06MB0545;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB0545; x-forefront-prvs: 00997889E7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(24454002)(189002)(50944005)(377454003)(199003)(8558605004)(230783001)(86362001)(77096005)(5660300001)(76576001)(189998001)(7846002)(15975445007)(110136003)(7736002)(8936002)(74316002)(81156014)(81166006)(2900100001)(10400500002)(305945005)(8676002)(7696004)(33656002)(11100500001)(6916009)(2950100002)(50986999)(76176999)(54356999)(106116001)(9686002)(92566002)(66066001)(106356001)(5002640100001)(87936001)(68736007)(19580405001)(97736004)(586003)(3280700002)(6116002)(4326007)(3846002)(101416001)(122556002)(2906002)(105586002)(19580395003)(102836003)(3660700001)(345774005)(19627235001);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR06MB0545;H:HK2PR06MB0548.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2016 06:19:04.3148 (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 base64 to 8bit by mail.home.local id u9I6JLDD008220 Content-Length: 3395 Lines: 89 Hi Geert-san, > From: geert.uytterhoeven@gmail.com > Sent: Monday, October 17, 2016 9:28 PM > > Hi Shimoda-san, > > On Mon, Oct 17, 2016 at 9:10 AM, 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. > > Thank you for your patch! Thank you for the review! > > 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 > > At first, I thought the trailing "/" was a typo... > > > --- /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 > > ... until I read the above. > > What's the rationale of doing it like this? I.e. > 1. Why differentiate by trailing "/"? This usb role swap feature is not compatible with USB OTG though, but this strings are from the manual that usb.org released: http://www.usb.org/developers/docs/usb20_docs/ --> usb_20_091216.zip --> USB OTG and Embedded Host/USB_OTG_and_EH_2-0-version 1_1a.pdf Please refer to the following figures: - Figure 7-1: OTG A-device with HNP State Diagram - Figure 7-4: OTG B-device with HNP State Diagram So, it seems the "/" means FALSE. > 2. Why the asymmetry ("a_bus_drop" vs. "a_bus_req")? This is also related the document. - From "a_host" to "a_suspend" state if "a_bus_req/" event happens. - From "a_suspend" to "a_host" state if "a_bus_req" event happens. (But the driver doesn't support it and we can use "a_bus_drop".) - From "a_peripheral" to "a_wait_vfall" state if "a_bus_drop" event happens. > I do not really follow USB development, so I please accepty my apologies if > I missed the discussion and valid arguments that lead to this. > > I did find Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg, > which uses similar naming, but a slightly different mechanism (multiple > sysfs virtual files with 0/1 states). I also did look at the document. But, I prefer one parameter to control it. Best regards, Yoshihiro Shimoda > Thanks! > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds