From patchwork Fri Dec 15 05:45:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10113869 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53D9560231 for ; Fri, 15 Dec 2017 05:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45EC129E6D for ; Fri, 15 Dec 2017 05:50:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 399C129E71; Fri, 15 Dec 2017 05:50:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71AFD29E6D for ; Fri, 15 Dec 2017 05:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751315AbdLOFus (ORCPT ); Fri, 15 Dec 2017 00:50:48 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:10869 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752268AbdLOFtq (ORCPT ); Fri, 15 Dec 2017 00:49:46 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 15 Dec 2017 14:49:44 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 931B875929; Fri, 15 Dec 2017 14:49:44 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.45,403,1508770800"; d="scan'208";a="265201480" Received: from mail-ty1jpn01lp0184.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.184]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 15 Dec 2017 14:49:44 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UClnwK/YH9v0Lvlk/4YGPZ43vEb5waAs9CuNEIwLxFg=; b=U1hSgOIxYDSoL3KP0bdZM/rwFTUpR9vzyU3y5o24a/kqwOaS2BDzniPSzoK0q6aikarBUDsfhhDlZfspHP/frtlVy5AecCFV0llX+ABCok2AkspzvQOLIkf4Qzb+wdYyPqFWz+66aTf/L8OKk6u4BXiYuXnojAU8nf9uX1YgHYc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.138) by TY1PR06MB0992.apcprd06.prod.outlook.com (10.164.99.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Fri, 15 Dec 2017 05:49:41 +0000 From: Yoshihiro Shimoda To: kishon@ti.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH v2 6/6] phy: renesas: rcar-gen3-usb2: add gpio handling Date: Fri, 15 Dec 2017 14:45:26 +0900 Message-Id: <1513316726-14387-7-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513316726-14387-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1513316726-14387-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR01CA0135.jpnprd01.prod.outlook.com (10.174.152.29) To TY1PR06MB0992.apcprd06.prod.outlook.com (10.164.99.26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b8b97e6-af94-4b77-179b-08d5437fa2f7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(48565401081)(2017052603307); SRVR:TY1PR06MB0992; X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0992; 3:qFXPV0FFrG94tfDGwQQR3i8V3wNnO/QqNoSmwkk5URgP0nRjpnMUZ4fEZPyGu6npJqtE/O9LGTDqniizqyfR75yONkt4DQOXGyR4nZcv/CSH9tZas2YargBCL6hBmROYvUT7zCakrEb1iiYBfVfcNL9CMjXrc5N15+f40KyK4c3xC1NcpWpsJkUedYgk8+YbZVrURBLpOVoL5bInSj1rhzBFHqTe11TuQLVz0yYbiQ5NNMrsU62QZhtkZ4PaMY5Q; 25:6Hm4Hn6sS7rqrBqViOFo3LJ2qJuBXF7eltY6GaSG3c2u8A/RyuxgXyEfoEzEs5Uh3stuNjynHgoXnmXZQVROCoOVxjWRebx6lk7xFhkXiVTNkbt1pjF4t54fW59bysGlr7kUzpdgPZDwPTQtAPd3ur5Y9zanbWAFjKpLgevqQY1/dvGDn7FkSMyevb0BE/wnoFGamvjpXmbWalKdHagbIbp5mmY5bhgjJbYRyyktgiqoInjBrjSZxns6eTMrgui5/1dOKucsnAGuP11Tg8mU6+arL8cUYnMA2lhTt+RMgya5YJv6vn0MCKfDq+/bkuMiWa4+d6IqThvaIJwdGI+Nbg==; 31:kh2xPdi83tV8o6pktr54EY9cibd/oy4CoCczksfyisID9Q4jiu+4/bsc9+NJJ+Ebvae9dX7H+UizSTvftX7dKqiHMAv3qhhxKQ+RHeVX5LpJRC5HS1xP4keb0ZWFGMM5UBjIzMmX3/SIazc5kS44ZNAY0ShGM2yc/A/D4LrnXtxRBWTZey82PTNB+6LVl6kwDnwGyPskti9E2MAYs6TVcQYAK+BCdBJNxCS/L+m5cek= X-MS-TrafficTypeDiagnostic: TY1PR06MB0992: X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0992; 20:VBFeuHrijYY5iwfQ0kg5nxE3OF0olGFcUqBNXKHbvMoh0bS46qtRm8b46l1HNm4/6wu284lJGUUzfmryxDyr6vzN+4iVNQpYt/qGGhhMlDt6j75dgtg6Q9QUrgAl6REQLYIS3g/e80aCxjnpmkR5hhJocd0WA0xl0ZW5O8iKXCZSOEAKCbDHgasvm/goc107ArckgMBooK+cusNY2sPViLwC13QzRG3b8OSOatO1B61mbGgYRtNNaP+zS00zosxAn97hI7C3GED9CT+OJpBWu4h7zBli73vdvw2Pm3wwN4qsXkGVI0OWNs61wIoVv4tqtbj6YMSFm+UurFpAwmVYApEMSE2JrZNgYbtpZ7X75m4ILEJ/+ZsRh++J/7oLQjcxI69L/chiRr9yfNPBpkxkCM1X2dXH9qHIKT1PL89bkiddY5ll+mhg4dBwNJtqBj8JYDiYkt4D+58PRupjIoeJqBudDk9+H/P89j8CNNYvrRH+dQ9nuf3XuAXVHx9CUK8y; 4:asNf3FgeSoDkaMAfbNkIXKETv1lAZEQ59/vrHOezRpryG7D1pO+jWkUUXa8v1frQXUTq1G43q/p7twqLcDKW7jg93Qdw1VjKBCSO2+VQ8d/nw9qFyMdikdNxnB0TUUj3fLKxpQ175Y2Q2XHDQF7TrCNP51dd0SkYE2dWoLSusCAAofqk7qm/toSmed1ZzqVF2kdVcBNyx+HFDTqOq8NrxfGkAAwfziSfAXgkvcOmQHfT4oFt64aUu1Z0oqGcz9gCoSm19RWGglRk9WzVXHn1pQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(3231023)(6055026)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123558100)(20161123555025)(20161123560025)(6072148)(201708071742011); SRVR:TY1PR06MB0992; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:TY1PR06MB0992; X-Forefront-PRVS: 05220145DE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(366004)(346002)(376002)(39860400002)(189003)(199004)(78352004)(16526018)(305945005)(68736007)(7736002)(53936002)(48376002)(498600001)(2950100002)(107886003)(8936002)(50226002)(66066001)(76176011)(51416003)(81166006)(6666003)(386003)(50466002)(59450400001)(6506007)(97736004)(2906002)(52116002)(47776003)(16586007)(81156014)(8676002)(316002)(3846002)(6116002)(6486002)(5660300001)(106356001)(105586002)(6512007)(4326008)(36756003)(25786009)(230783001)(42882006)(3720700003)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR06MB0992; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:0; A:0; LANG:en; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TY1PR06MB0992; 23:a65d1NO47Z4f8gKPSn/m1gLPozsR6W2/yOW2ICGfZ?= =?us-ascii?Q?L4UuLvLXthzThc4aR+5YfnjxPo1tUfxmO/2dxgvghmlEvQSt6Hoz/9IzZaxp?= =?us-ascii?Q?7qEQZzDYUc7jd0kDYLQy/Qq/RiTnP0W6GD6Y/oQXWOmyQ5oZm789DPQoTWhP?= =?us-ascii?Q?Jus3Y3ZqgUwjITRN7Qjlzygb8zjnTNcyuNPKuadfztM1dMLaOEvd8J+KQ0zG?= =?us-ascii?Q?vaq+KFgjjfLwRwQrCG9pf0EksdRWAsMGJUweC031XXUiukr0RnayXY5k48Qh?= =?us-ascii?Q?DzEditU9QW58dYREIb5uySzSFg6O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YGV7ukB+178Q8i4VHbbwNAdRk4C+ZaJ2l49fXG06YxG+d9xqtjivZxADSjDlqbAaxPWC/PR0eEut0wSZnmigQk6G33SsvMSAyTA+bToJMhr+r3bCeWShR/Yf7gMhAd10z1VqLk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2017 05:49:41.4615 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b8b97e6-af94-4b77-179b-08d5437fa2f7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR06MB0992 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some R-Car SoCs (e.g. R-Car D3) doesn't have dedicated pins of VBUS and ID. So, they may be connected to gpio pins. To handle the gpio pins, this patch adds the handling of VBUS and ID pins instead of dedicated pins. Signed-off-by: Yoshihiro Shimoda --- .../devicetree/bindings/phy/rcar-gen3-phy-usb2.txt | 2 + drivers/phy/renesas/phy-rcar-gen3-usb2.c | 77 ++++++++++++++++++++-- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt index 99b651b..999a6ef 100644 --- a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt +++ b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt @@ -27,6 +27,8 @@ 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. +- vbus-gpios: use gpio to control vbus instead of dedicated pin. +- id-gpios: use gpio to detect id instead of dedicated pin. Example (R-Car H3): diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index f470fb3..ea76973 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -100,9 +101,12 @@ struct rcar_gen3_chan { struct phy *phy; struct regulator *vbus; const struct rcar_gen3_role_swap_ops *rs_ops; + struct gpio_desc *gpio_vbus; + struct gpio_desc *gpio_id; struct work_struct work; bool extcon_host; bool has_otg_pins; + bool has_gpio; }; static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm) @@ -199,6 +203,36 @@ static void has_otg_pins_init(struct rcar_gen3_chan *ch) usb2_base + USB2_LINECTRL1); } +static void gpio_set_vbus_ctrl(struct rcar_gen3_chan *ch, int enable) +{ + gpiod_set_value(ch->gpio_vbus, enable); +} + +static bool gpio_check_id(struct rcar_gen3_chan *ch) +{ + return gpiod_get_value(ch->gpio_id); +} + +static void gpio_set_host(struct rcar_gen3_chan *ch, int host) +{ + /* In gpio ops, this driver will modify the extcon_host by sysfs */ + if (ch->extcon_host != !!host) { + ch->extcon_host = !!host; + schedule_work(&ch->work); + } +} + +static bool gpio_is_host(struct rcar_gen3_chan *ch) +{ + return ch->extcon_host; +} + +static irqreturn_t gpio_irq_handler(struct rcar_gen3_chan *ch) +{ + /* Nop because the driver will get gpio value after exited */ + return IRQ_HANDLED; +} + static void rcar_gen3_phy_usb2_work(struct work_struct *work) { struct rcar_gen3_chan *ch = container_of(work, struct rcar_gen3_chan, @@ -323,7 +357,7 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr, bool is_b_device; enum phy_mode cur_mode, new_mode; - if (!ch->has_otg_pins || !ch->phy->init_count) + if (!(ch->has_otg_pins || ch->has_gpio) || !ch->phy->init_count) return -EIO; if (!strncmp(buf, "host", strlen("host"))) @@ -361,7 +395,7 @@ static ssize_t role_show(struct device *dev, struct device_attribute *attr, { struct rcar_gen3_chan *ch = dev_get_drvdata(dev); - if (!ch->has_otg_pins || !ch->phy->init_count) + if (!(ch->has_otg_pins || ch->has_gpio) || !ch->phy->init_count) return -EIO; return sprintf(buf, "%s\n", rcar_gen3_is_host(ch) ? "host" : @@ -388,7 +422,7 @@ static int rcar_gen3_phy_usb2_init(struct phy *p) writel(USB2_OC_TIMSET_INIT, usb2_base + USB2_OC_TIMSET); /* Initialize otg part */ - if (channel->has_otg_pins) + if (channel->has_otg_pins || channel->has_gpio) rcar_gen3_init_otg(channel); return 0; @@ -489,6 +523,14 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) .irq_handler = has_otg_pins_irq_handler, }; +static const struct rcar_gen3_role_swap_ops gpio_ops = { + .set_host = gpio_set_host, + .is_host = gpio_is_host, + .set_vbus_ctrl = gpio_set_vbus_ctrl, + .check_id = gpio_check_id, + .irq_handler = gpio_irq_handler, +}; + static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -513,9 +555,30 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) INIT_WORK(&channel->work, rcar_gen3_phy_usb2_work); - /* call request_irq for OTG */ + channel->gpio_vbus = devm_gpiod_get(dev, "vbus", GPIOD_OUT_LOW); + if (IS_ERR(channel->gpio_vbus) && + PTR_ERR(channel->gpio_vbus) == -EPROBE_DEFER) + return PTR_ERR(channel->gpio_vbus); + + channel->gpio_id = devm_gpiod_get(dev, "id", GPIOD_IN); + if (!IS_ERR(channel->gpio_vbus) && !IS_ERR(channel->gpio_id)) { + irq = gpiod_to_irq(channel->gpio_id); + if (irq > 0) { + ret = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + dev_name(dev), channel); + if (ret < 0) { + dev_err(dev, "No gpio irq handler (%d)\n", irq); + } else { + channel->has_gpio = true; + channel->rs_ops = &gpio_ops; + } + } + } + + /* call request_irq for OTG if doesn't have gpio */ irq = platform_get_irq(pdev, 0); - if (irq >= 0) { + if (!channel->has_gpio && irq >= 0) { irq = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq, IRQF_SHARED, dev_name(dev), channel); if (irq < 0) @@ -569,7 +632,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) dev_err(dev, "Failed to register PHY provider\n"); ret = PTR_ERR(provider); goto error; - } else if (channel->has_otg_pins) { + } else if (channel->has_otg_pins || channel->has_gpio) { int ret; ret = device_create_file(dev, &dev_attr_role); @@ -589,7 +652,7 @@ static int rcar_gen3_phy_usb2_remove(struct platform_device *pdev) { struct rcar_gen3_chan *channel = platform_get_drvdata(pdev); - if (channel->has_otg_pins) + if (channel->has_otg_pins || channel->has_gpio) device_remove_file(&pdev->dev, &dev_attr_role); pm_runtime_disable(&pdev->dev);