From patchwork Wed Dec 13 06:27:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10109285 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 965B660352 for ; Wed, 13 Dec 2017 06:32:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 933A426E55 for ; Wed, 13 Dec 2017 06:32:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87A3028AFF; Wed, 13 Dec 2017 06:32:53 +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=unavailable 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 09A4026E55 for ; Wed, 13 Dec 2017 06:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751898AbdLMGci (ORCPT ); Wed, 13 Dec 2017 01:32:38 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:14563 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751524AbdLMGcF (ORCPT ); Wed, 13 Dec 2017 01:32:05 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 13 Dec 2017 15:32:03 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id EA74E7FBC7; Wed, 13 Dec 2017 15:32:00 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.45,397,1508770800"; d="scan'208";a="264978440" Received: from mail-os2jpn01lp0148.outbound.protection.outlook.com (HELO JPN01-OS2-obe.outbound.protection.outlook.com) ([23.103.139.148]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 13 Dec 2017 15:32:00 +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=dBvWK5iMcZpn75lShdNweHxJ9JE4jv072dESheXwKTI=; b=F7ju8+EBIBvu0c4EugTP6ev04bL7h7nozUPCJjYQp1u7lRpsBccrA7PIO9sZXxWT60YmhdEXYwXfncu7YAuKLtqR7DVFcdHvFx/KtBvXrfH5024dYcUIpBhHGa5Dp3WvtPlKZWa0op125h7gieay8ULfxZYL4K2yWHMpBdk7PL0= 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; Wed, 13 Dec 2017 06:31:56 +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 5/5] phy: renesas: rcar-gen3-usb2: add gpio handling Date: Wed, 13 Dec 2017 15:27:40 +0900 Message-Id: <1513146460-20326-6-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513146460-20326-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1513146460-20326-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR01CA0090.jpnprd01.prod.outlook.com (10.165.51.178) To TY1PR06MB0992.apcprd06.prod.outlook.com (10.164.99.26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a5e596c4-8403-46eb-2dd1-08d541f33571 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(48565401081)(5600026)(4604075)(2017052603307); SRVR:TY1PR06MB0992; X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0992; 3:/nUgNPNr7B46TKdREwTTR7XpKS1likQkIiKZsb2ImyRIfB5Cs1n1Oobr1cwdoJs9kVgkp2nlTX4L1xGhpmVgDMym/WfdMJMN98KsRjdKXXy0fhugG9VdI63fEdXlEkZbnem31eDVXuRayvAaG+UfG7BR0fyNTdBktI07dov9ZH8uFXa5pv3IkBlebKzkQKnCemnm/Zj0lhBTgEQvImmpYj+1fWR3IpHbXdJnZN8SlNnutF2gbaR2Rq1/MUZ0H1TL; 25:Qrn90qF+vtPFftrA4oTzboWsMtnstLROVU/1EE34QX51G/TgV3nQVtbuvpFN0xT8WPTF+duTfVn+FpRSJsHDTTN+Fd/PgmVdYEVhPjzeNyHvUpmis7uhdNRNiwP9NDngb7G2AoP9VTIlS+DHp7TwxyPe2cBWbqVoiIC6DmAOaR2XE696jN0nQ9J/tkOtI/otpB+r2cMIVNlN3rDq3um8gw5njHKlorreXfa8ttqmiQmUBPPenGMGio+p1Ph8e5trCUBeSuqwB02ZTHR0xe0tynPS5+EDU7Dmy4esj30591cwYJw6EI6H3zk1AOHdcdDi6AQCsVNe+yj8Yg0CqGredQ==; 31:522sJ3toMV0xjOFusnxrh7DiY6HWyQZUzPmaznePZmlVuxdSlNuwFadF5mMQBcfkzWkG5z8KigtnIcM4mGGDkvdvPM8NFjL9OWx5Y9UohH8tpLeZS8rFzuUgW4ikLoVaToVj8h+Y8LxpGbjx+/3sy1dw0WHauVNwmvN5OcLvAS3CqSLLowUIHqOehdfQjnR+wA7uvnSXxwkdHd+PROhqnuS6bt0lYsUpWj5MyKWbQ5g= X-MS-TrafficTypeDiagnostic: TY1PR06MB0992: X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0992; 20:3/DfwkR8giu6j/23joPhbo7OSipDk9y+YVnKQ63ZONBwTnK8GCCbrKuMvjoF103Zsj3qmjZPECv0ceUmbjz7dfgqFNYilEtb+Ogn0bI8MD7Zb6NFyQ/bGhbdOQpRztwLwgpMYaBO+TyNrTb6/DQnEvGm/PXWNSmiEskoGJiU/8V7tFeq1LhxVWnaBlD8KEOizDPSBbrw44LFYkNLy11cwLCEDbihGggRFq6SpHR4VvT1V1dVJB6Bx13tbXXPvUgYDKf8I10bv/XZ5BbFfeqO1CniWmHTDuN/SaO0eFrHfSqYeTMW0sTK9EazD8/sTaewZ+1fUfDevYbYASWcQS6Ti+gvwZSWcqfjD5tyhgv7Jtki7IdP6BtZd+XGuQA/XZbS51zePu29/+MPgVuez65yMB5NMaBkIGVeWexhpsfgY0saitAxibns12rhzAShyDqChRrcCbXH6Hx5PHa445vqauMBAK3l9NqH/a3DEZkKcKYsUFMiSryz25KjGysX/R/d; 4:kNenPqwyxyHjMnvFcIVsPt+UruxlwEl28yr6SLBS2ZSfwc4TymBJf6RRFC/4pTDR55sO9wcr1F8xrlTGOmbGzqbSXQBp2g+T/SKAjWZYsa/93tHPLCQCRX8Zdc9jJpChrFyyI9uohVB53UegoufDcg0f+3QcPBIIg7aoXzBbMkStMC6mjn/fvhCaTJrbkKDAxlATGnmPIaBXnHe8E5xEzU3zgByuwyUmzv0knoHVckmJZtBxin9EEEtlAEIJIti0tF3my0Jy/VUOZMRpxaWUcQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231023)(93006095)(3002001)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(6072148)(201708071742011); SRVR:TY1PR06MB0992; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:TY1PR06MB0992; X-Forefront-PRVS: 052017CAF1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(366004)(376002)(346002)(39860400002)(199004)(189003)(81166006)(48376002)(2906002)(76176011)(66066001)(230783001)(97736004)(5660300001)(6666003)(47776003)(51416003)(52116002)(50466002)(6486002)(59450400001)(3846002)(2950100002)(6116002)(6512007)(42882006)(107886003)(25786009)(8676002)(78352004)(4326008)(53936002)(36756003)(106356001)(68736007)(105586002)(8936002)(81156014)(16526018)(316002)(50226002)(305945005)(7736002)(16586007)(498600001)(6506007)(386003)(3720700003)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR06MB0992; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX: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:GKKjHc7W1yHDYxpnXTRdHfQ4f+1UY85r6fs7NRSNs?= =?us-ascii?Q?xc095ZHSPJXG/13Rp6PO6Ru7p5U0h3E85tqQ/lNw3NmzazOqzgZPUkzf3S4e?= =?us-ascii?Q?8lAP0Zz4TGKPVBlDh8Z5WizCHa7qhFfdnWnUzRGjzrWeg0xOlM4kgeFA9lGx?= =?us-ascii?Q?SJRe0HKpEJae+K2B3L1ZmiYlueMdQUH2DFZFPKgNwWjEZGfmLYB4lZUdyXrH?= =?us-ascii?Q?CroYy7xOp/wST125zpQtR1CjSoFqLmD/SZlqIQxmjdoOm6XWuqIekcZCcljg?= =?us-ascii?Q?Pp1hbdHjsmTKKb0K4NbnadIjkVhuJHDCuwdbtHs4eiUSacIuUx8VNfwCdzBX?= =?us-ascii?Q?5gLiF893nMYirALOwl2j/07IznsUR3nh0viJqnew6HjCDM/9LaZ+vcagOZcn?= =?us-ascii?Q?v18ZcQRxiGz8O9l+yHpdifSKlZNKscX4KO58EV6r8sk4JlfAJZDoY0aqdgs/?= =?us-ascii?Q?G2Zg3a2Ua7i1c0wCyIxInlc6l51njZc5r83xD+nrj3DlD8PpEmy1/SUqm3Vl?= =?us-ascii?Q?ssnKR00qjBlJGx+XG/MqSE7BF1cPu47uI0bJI3P4/g3LjTQOSN/NT6m7p7iX?= =?us-ascii?Q?c+3+28bLYaFzZ9QDTBJcDYa94DT5uNp+nqrTJ1U9cCXRaVkLogX4eP0Y6SlN?= =?us-ascii?Q?KqGdu5O+Ii7CrYanZLfCEAS3lCRcWV8jqDySLMGEH57N1r2wQeAsoID03/fg?= =?us-ascii?Q?8ekbrBsY5Q9FA7emmsYkVz9HZm37JJX/E2L5TIto+fHf8Cmu8cUys237KBG7?= =?us-ascii?Q?c9ei+s8OeRwF+3vfyXr32pRlneUk/B9Mt6z6Cbd1g7OhOR9hUbRIU19vk6xV?= =?us-ascii?Q?k8qIO9b8zcIi/p7nrRAz9yCTHA8GeYqwna/uql9T8S8+EukJuI5hwSL/ooKK?= =?us-ascii?Q?rp+34wCM8K9l8G0gE+8DfZ9SzhwLg5yuDnjLEX9Dpx3hWPMEQmze+bsDpSX9?= =?us-ascii?Q?SA8aqZCA46VFr7hzx59PjmPxGHiAKWY+8adGJEhHmy+RQQkpi0UrmiM5KAW4?= =?us-ascii?Q?pjURcx+7cD1Uvp+cJIiYzGFdDTp1H7QoHT2eN3SfM6jpl9Y2Lv2+ZZm+EBEf?= =?us-ascii?Q?WonsxQ+Pt8dVLmsGB6I3Hd47VD06wSJv4aUPd9XsPcyD3KmhL+vBmMlzlngA?= =?us-ascii?Q?YhDUwpwzNAvce/Ob9BNOtQRHSvNl5GuL/L0i4iq8pSsGMJSVhNCsA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0992; 6:QO7sdaSpgnkqAuUeCAG+Gbk/NA1klRBHuP2atTLQNENM8M7zpiMNo0in+/kBCwOmkp4TtiXRSa/yg/KgUIcJsRiro7jEa9ryFgoIXfFR+M2ctI5aw9YCJgGoMQTkjvx4N2lEc4e9ymwO+fv07BbYsgCYIh7ADgctUezm1Mp9CM1/sbd5dJZAMYVwMRiUeF74+tRgabiwmKkMxOGD8kRHAfr/45/fJ+38MFnBu9uxf7mgcLhsegm/pMG3oohmqIDV3fxqpYwdhfzb3oanNs4mDRTjueMpN8d3yZBUW6kklkbLxQ04z8Wq6PenSNIsR/0mPLdVyHeZHMJ+Y4J/aFayUjtcvgA9Ke5yM3xcEM3dG4o=; 5:X1iN8x5aET9suqYSofEYn9qVzWSOAs4nDxnHASQ1ChoyBG9tGiVscExA8eN/N4RwISjn2DRT8XSxE3Y792poVSDrivgzdWI9xk4+FslrXuAyi7pCQoPlbatlsEtGkvrG5gocFevRYEumY+9a1BAXcGuXgc5njud4qWs4kAPymiQ=; 24:Ybp/kwGqCYtwfUhhxU7Pl7sNM6AqmPHlfO3J8DtNtvx2xVBms30qF1aShItFmnW4AV2PF5kv3cshpWbwDZl7pzkndYXNZkxbMLq+d0wrGc4=; 7:9L+ie7JeJJagV+um2EuLu0V0+kmUPPERHKNZf9rgCfsEyLWQaHSsev9BSGUkpSE0i8AWVg4fgutcI+diMkJETXr57j/sDwAgFzie9zabB9F5aNdlsR3/jBQO8vw0gBGtYerPEwnUZl6x7AUGmZo9YUvTFtzHkcyyt0/dP9qCGWBpCq4RO5drdo0w+62ishLWC3gmNqWM91nNfb6tCHxghjeWs66WJwwzwRPC6ymYkMbRJxgUUN1XrysgfOjxQKyN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0992; 20:Hhje79KiL5fZ7KZ4GAYKGzMt/1JswJt8OISIot/vZ5AOgWv+FilW3YKu/8Warz/D/o4RFxcFnFtiLF0ljVOP/hCcgPFN26oOIrcuWVEvMztvcW6tsPvdVecwqtDrtCtK1sbXJ5IRDmB3Ls6v1/teQ4j8H+Sk8fxW+p4YORZRpOI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 06:31:56.9761 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5e596c4-8403-46eb-2dd1-08d541f33571 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..851582f 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. +- renesas,vbus-gpios: use gpio to control vbus instead of dedicated pin. +- renesas,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 5e509a9..0b6333d 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_enable_vbus(struct rcar_gen3_chan *ch, int vbus) +{ + gpiod_set_value(ch->gpio_vbus, vbus); +} + +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, + .enable_vbus = gpio_enable_vbus, + .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, "renesas,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, "renesas,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);