From patchwork Thu Mar 3 10:09:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 8490891 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EBB739F314 for ; Thu, 3 Mar 2016 10:10:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4D0D2035D for ; Thu, 3 Mar 2016 10:10:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2A40202AE for ; Thu, 3 Mar 2016 10:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757224AbcCCKJi (ORCPT ); Thu, 3 Mar 2016 05:09:38 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:9966 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757091AbcCCKJd (ORCPT ); Thu, 3 Mar 2016 05:09:33 -0500 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 03 Mar 2016 19:09:32 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 0BF7C63E54; Thu, 3 Mar 2016 19:09:32 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 0D3AF1806F; Thu, 3 Mar 2016 19:09:32 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 05F551800A; Thu, 3 Mar 2016 19:09:32 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id VAM24915; Thu, 3 Mar 2016 19:09:31 +0900 X-IronPort-AV: E=Sophos;i="5.22,531,1449500400"; d="scan'";a="206911683" Received: from mail-pu1apc01lp0020.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.20]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 03 Mar 2016 19:09:30 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesasgroup-onmicrosoft-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hr4+GF+2MGwvrU8bMreLCmIUQhA8KqMzzZtwHSB8N/U=; b=TcRd1SYJ9exkARhB3wA/bNTYkz8+KlnaSpkXpZ8PgNTuY9BAtf5ZqOj9x1YvOCfrEOsx9eDOWiFvWPDpLeReCbt2tGzMDafNN12O/BRfUgrAQbp30qvyHkXLcizGMRXG784RvQpmuRTIrKAIKJ/zPECWfp58do0n4s5f/y4jTbs= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none; ti.com; dmarc=none action=none header.from=renesas.com; Received: from localhost (211.11.155.144) by HK2PR06MB0914.apcprd06.prod.outlook.com (10.162.246.29) with Microsoft SMTP Server (TLS) id 15.1.427.16; Thu, 3 Mar 2016 10:09:29 +0000 From: Yoshihiro Shimoda To: , , , , , CC: , , , Yoshihiro Shimoda Subject: [PATCH 2/3] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off Date: Thu, 3 Mar 2016 19:09:05 +0900 Message-ID: <1456999746-2800-3-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1456999746-2800-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1456999746-2800-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: KAWPR01CA0034.jpnprd01.prod.outlook.com (25.165.48.144) To HK2PR06MB0914.apcprd06.prod.outlook.com (25.162.246.29) X-MS-Office365-Filtering-Correlation-Id: 8300632d-82fc-4171-9134-08d3434be8a4 X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0914; 2:LeD6413O68schJ810GvGd6KAx7vWsDSiaXaMx5ohTCNRW8UPNtB+7rfag0OIjq/jUacq700hLo/5jbUYV4/0BnWKsbr3fsK+o9J2sGR05QWpPF9qtaO9Qdbt2esHn9G8vM9GpEmvnOvLaD9N+SPlnkoZeq6hcYzABS6etzmNOBntG9E2b0Gan0dJNltoTBVK; 3:I98FJsLInk77o2pG6LyqzhxMqrhKlNUSXD6QcioLeJM7/dIiNiIlPfgMFAJ0DAEt0sp7tInz8OfcBNbTV8kpAeaWnVvN+iHVKcgBm0kAYg16jlGQgcBe9w8u4GQPGgaw; 25:W6QFkrjcHQf8Bv6eMeymrpgwI+o+39CiZdOpv1NpMTug9dOyeYq4EDSA/ztzzyTmpyAt3KiTzui3KgXaqPC3XQHOBMzYbhMndN2OBTEduFoU8bIh8jEP8JGCjwCiyZccqNyuJUI4aRe84EUerR6WQmimg1U7N8YHMtLfTMXbwzjQlqBNSdlnpAODIn5j9+p65P2fq/QiIRRPxaEejNK/12RBMdzeLsmyhj7jwkMdBwDMoSyhkUoGLyB8OaTAaSXQhR1uTL/XL1H+T3De2tvP+mKLhTjWckOfK5gqbxx9zH2x0WwcYSZpklSFKw6tEk+M67ABakRtizXvauHEWE/mDx5km8vcByceXeuJ3g3jIuA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB0914; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0914; 20:KB+b+saEiRCwWF9sXnxmtndLfm9MJaWpWmcZacVWGJZ2AL97QdORvY1IdMiWPyzqoWuJZT+woKmlM4hXHt24qdDjC1FAFtbMU2K0v9BthyVPRjAFnKupYx6is/CjpT+/xD1HS3x01As/EZ8kkmab5kXMWEl3sR9OHXEk/6dCa4qyvbDpcIvi6TEmWrR2zZ0dmjL/dvLZ8MkJIx4zKRaLF6zaGPFYXuf6MiFuFhx/cM6qr4oRY7+meUcenxDek/jSqeLD5LIa6Bjs9qXNIl2TtJ88JQmciMGwxJ/RNr7/5tItdB43Z2BW1nQMo7uwmAqz4ZT+LcDTjsciLbkr5ZwzR5jmpa7yf87cgSbJSiOmaPiOQnwM48e4bGs9BYv0CETAdy4IDw+zT1cjsAxisxPTbIGSAMfCmdup/VHE+pFcidR6ViXtDXYmNjChiYr+v6hrkDh8d+CBNA2dtNKY5498yVpr+XTIk1EYSnbyGjcUqwry8CS5TaQstBDCBmKA4FGa; 4:c5tlsrVHcjMmObMeRPjxR+sA4B7SSx9O5gJ9rwZiEcntSK8MAFG3P69glKwXNe5IfRGQhFXWs213U24bwuRnZfn9d1NOX1aA3yeprKqoAcbn4ovPhBNA3a8Snj2IantJEyNZnDFATP7ZlEfu43+wauArj2jO5fbG1cNze/wsJX49HC0g7gCLcscwqmZoRURwHR4o0V9befVsJwfCuKLgPEmv/NJ06F9sWy2nqug2+4uy65xaCehTH5kQF0hca+tCcexGgplfhTSgll21539fwlMY4Sq2D29sQpWVXjqc+zHqmLoJCLPVIDImKFBW7m1ejCdmZZdjTdJ0Vf0fTk/rB3Ba74vbHBkE+saOyLfIbLoTPrWe/0QOIawRjanBfA6v X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:HK2PR06MB0914; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0914; X-Forefront-PRVS: 0870212862 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(50986999)(66066001)(76176999)(1096002)(4326007)(87976001)(2906002)(47776003)(78352003)(5001960100004)(40100003)(36756003)(92566002)(6116002)(4001430100002)(122386002)(586003)(3846002)(42382002)(42186005)(189998001)(19580395003)(77096005)(5003940100001)(33646002)(76506005)(50226001)(5001770100001)(48376002)(2950100001)(229853001)(5008740100001)(107886002)(5004730100002)(50466002)(230783001)(19580405001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0914; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB0914; 23:NLBnGFLw6N0bjaCT1iW4Ob962DGfZptuaWEdpiV6f?= =?us-ascii?Q?RTS/Ngj/D0wmuo0h+m2bG/paVARdct+U7aMUSXhqaldDs1JzyLC3lJwrZaBz?= =?us-ascii?Q?tIgpBjDGRdgUPm/9tkPZ0aieRGHWm3Aszvx3+p5q0PRY5xpl+eiS6UrsJwbi?= =?us-ascii?Q?xIgKhKGhvjBiyvN/rzFpCwkkwRMB5wOXlKhaHlVnVwLbfprY2R7OJZiJpLbp?= =?us-ascii?Q?tS8f6AfbrreOHnmOuTc1Eft2OFXhYnl/kNF5omLZfLHblAWXhvdp9A4rio9S?= =?us-ascii?Q?8Xu6254hS+K3MB4G3dMS4iRElr8bUtLJCgOTsEqYlBzMxJ+Kvt0g1XiNYtd/?= =?us-ascii?Q?cexiSSRjdMAooNVWRcH/0ZsQGoTzL0gQjTUr1CREUrYuvrCr0o1JQ3IVi1BA?= =?us-ascii?Q?iB5m5d8oWyYUkLjlD6HjKce2kq0E6jK7QmEl5l0vvV2A3vHAqIY8hy80lgcI?= =?us-ascii?Q?rBlx+EUfJyexv9JilGswJzIBJmy5h5yTB70RKUR0vB9LZOquZw0INRe2McIi?= =?us-ascii?Q?DyaPpelI92aXER42+wExDUyQYwfoK7n3Dhu3dIL4YgwxGwcrpStHmGWlqbOF?= =?us-ascii?Q?6t5OWLrFcyZb4DBfQ21vJ9uZckfZGkvs3Wm6IA8CtI+PDxU0Vf4PIieAr8kl?= =?us-ascii?Q?X0t9GvZnmZ9ilHKMGFDgGkk5gWx94shU0wHvWOrgiNj66D1aBCjvvXrJmzz9?= =?us-ascii?Q?OTq8BYOWh/N0XnO5EiS51wIyhEFGGS6kWbXy31JqLvUGwYJOuMU4l1cdwpm3?= =?us-ascii?Q?xGegeaNBrmzo2D1YnmTk8FoeRE5lCCBCSKRe2Ab3+SAv0Y958geKdpcwE1+J?= =?us-ascii?Q?CGWBqOUDyetRgH40Jisxivo8Q6tBTfdvd5godYjLLQH9+Y+GbHXt1YaUyfrW?= =?us-ascii?Q?ckHA+UvdbCgEm7UHaZylikuNaBVS55jfEk5pwVgaqxWwu+RBTmgnkkvNU5cz?= =?us-ascii?Q?KjwyuqQgPUJqT088qrFVX3OdXuSJHTUk6XNe6fToOWiBF4mQth2OBpMP9naG?= =?us-ascii?Q?3zl0kLoGCv/PGO+t7GioGA0pZK0M89XdcRyOdYRyybIGXHqjxhYyD691Q+qX?= =?us-ascii?Q?3xJ81+y2K/w3lHZv3gY/POOjtvIpws9vuO7hBUOt3Z8d4PL6A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0914; 5:f5BKmokBIErpV0+32wFiibupNw+C/At0eYNIlpAdImBaIOaaAzkEE5OLakTQrkMQ1wrRhhA2L9nefbrQZ4RNupm29QpvH6CIw3w+MvqhFylkyWiYPllqLjRqafWZlVxrdseyCMHc/8tWzJvsqoJ8kg==; 24:nvNNsx+IoJS/dke3AkuRDBnqxVtkGD1Nf8mONETnkylaKXCzL3ZRM1wG49BUvZNkjtkSbfvOIqylhy6o15Elf2FvolHtR0TfVuQBGbaiKWc=; 20:mNjqwBIfBM9Vqt91PiyKbT/vvYjvhaXqqERyX/bkmLxdb+4BssUqKW0PPL/cMPdNSijshX8SXekEr7xu/zeVeHCNqlyF+wA1DwfAiEJbM0+AJQbciAiTAyQvBpeuextjZ+xKDeuIAO+qrrIy0Zq+DFuiuuoFiIHUmTUz6SSBYFw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2016 10:09:29.2828 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0914 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To handle the VBUS on/off by a regulator driver, this patch adds regulator APIs calling in the driver and description about vbus-supply in the rcar-gen3-phy-usb2.txt. Signed-off-by: Yoshihiro Shimoda Acked-by: Rob Herring --- .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt | 2 ++ drivers/phy/phy-rcar-gen3-usb2.c | 28 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt index 86826ca..7243b3b 100644 --- a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt +++ b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt @@ -21,6 +21,8 @@ To use a USB channel where USB 2.0 Host and HSUSB (USB 2.0 Peripheral) are combined, the device tree node should set interrupt properties to use the channel as USB OTG: - interrupts: interrupt specifier for the PHY. +- vbus-supply: Phandle to a regulator that provides power to the VBUS. This + regulator will be managed during the PHY power on/off sequence. Example (R-Car H3): diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c index 3c647cd..7b14244 100644 --- a/drivers/phy/phy-rcar-gen3-usb2.c +++ b/drivers/phy/phy-rcar-gen3-usb2.c @@ -19,6 +19,7 @@ #include #include #include +#include /******* USB2.0 Host registers (original offset is +0x200) *******/ #define USB2_INT_ENABLE 0x000 @@ -77,6 +78,7 @@ struct rcar_gen3_chan { void __iomem *base; struct phy *phy; + struct regulator *vbus; bool has_otg; }; @@ -210,6 +212,13 @@ static int rcar_gen3_phy_usb2_power_on(struct phy *p) struct rcar_gen3_chan *channel = phy_get_drvdata(p); void __iomem *usb2_base = channel->base; u32 val; + int ret; + + if (channel->vbus) { + ret = regulator_enable(channel->vbus); + if (ret) + return ret; + } val = readl(usb2_base + USB2_USBCTR); val |= USB2_USBCTR_PLL_RST; @@ -220,10 +229,22 @@ static int rcar_gen3_phy_usb2_power_on(struct phy *p) return 0; } +static int rcar_gen3_phy_usb2_power_off(struct phy *p) +{ + struct rcar_gen3_chan *channel = phy_get_drvdata(p); + int ret = 0; + + if (channel->vbus) + ret = regulator_disable(channel->vbus); + + return ret; +} + static struct phy_ops rcar_gen3_phy_usb2_ops = { .init = rcar_gen3_phy_usb2_init, .exit = rcar_gen3_phy_usb2_exit, .power_on = rcar_gen3_phy_usb2_power_on, + .power_off = rcar_gen3_phy_usb2_power_off, .owner = THIS_MODULE, }; @@ -290,6 +311,13 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) return PTR_ERR(channel->phy); } + channel->vbus = devm_regulator_get_optional(dev, "vbus"); + if (IS_ERR(channel->vbus)) { + if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) + return PTR_ERR(channel->vbus); + channel->vbus = NULL; + } + phy_set_drvdata(channel->phy, channel); provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);