From patchwork Tue Sep 11 08:47:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10595313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CE42920 for ; Tue, 11 Sep 2018 08:49:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E1122924C for ; Tue, 11 Sep 2018 08:49:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22AA929255; Tue, 11 Sep 2018 08:49:03 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 A3B0B2924C for ; Tue, 11 Sep 2018 08:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbeIKNrT (ORCPT ); Tue, 11 Sep 2018 09:47:19 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:46763 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726645AbeIKNrS (ORCPT ); Tue, 11 Sep 2018 09:47:18 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 11 Sep 2018 17:48:52 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 811F76BAC7; Tue, 11 Sep 2018 17:48:52 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.53,359,1531753200"; d="scan'208";a="290617687" Received: from mail-os2jpn01lp0147.outbound.protection.outlook.com (HELO JPN01-OS2-obe.outbound.protection.outlook.com) ([23.103.139.147]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 11 Sep 2018 17:48:52 +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:X-MS-Exchange-SenderADCheck; bh=0rLM+bfQJNAFwvvpowk9opqtB2Fdj4+8aKFZdkUGR2M=; b=FsJk9nWskEV7BepW5Ug1iDgtLqvfXE382vPd6SOfIqKac6r287GgnKViFK+sWqtmymFvNzyB2+baN347Y53o/S2Nr0fIMnqvbJlNrk0rYo9LX2u7LU3Bci+U3nucmHkOgv5T1Rx7jBrKTtX5ZrwlN9fGY6iNzb2OY0+OGdct9gE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.144) by TYAPR01MB2302.jpnprd01.prod.outlook.com (2603:1096:404:3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Tue, 11 Sep 2018 08:48:46 +0000 From: Yoshihiro Shimoda To: balbi@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH v5 1/3] usb: renesas_usbhs: Add reset_control Date: Tue, 11 Sep 2018 17:47:03 +0900 Message-Id: <1536655625-10550-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1536655625-10550-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1536655625-10550-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0132.jpnprd01.prod.outlook.com (2603:1096:602::26) To TYAPR01MB2302.jpnprd01.prod.outlook.com (2603:1096:404:3::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f02fd75e-c4a7-4e4c-a4dc-08d617c36317 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(8559020)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:TYAPR01MB2302; X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;3:9HvSHxYwojLU1tEv3cs2fDK6BbS+eYI3dflIdXh89Mo/4IQIB++hVDWqKpcqA3OG4O61U6wP4pbOEC81jWxNacH8AeaXbiwy+8e6OZZABc6fWIi5rhEXbbYErxqrmxUZZST7ZA6RVhGjPQjm9vQxHcaaSPIsfBb7Z1kGBytGtO7wLa5nDczwcWVKxQsLrPC5ZmRq+keYEIe+aEXIfahoMVqbnBdt8zO76ZB0jY+E36+V3GHDMQ97zpBGbOZZ1/mc;25:nZI3aZavkQYBAuHtLsbOpSB+q8i+gXCcyzqsrMd4Su1eKraqVAAvT7QGbven0tg5fqmhAwrZrMTzIhS+y82L1gY7tGNKq78X7fek5N2H1P7kwR55nsZlfReeaFVwyIkXuMDiUzxoKXJgMiiiDn8QugUX3NiEeK07fy/KiI7rXoNG4GIsoIq6M2GGTw5yni+nXrhLMyR6vieaw9InF2N0IHohTCOIOXMZZaSoDSrE9TqZwbmzZZgNwnC50vl3on0mqgW78TVmXtA0xe3WETlFhQE65pbClXesicTjl1usBBYWZgRvBuFWm6VDqkkxZMEq6HtdYuamwk8HNI7y33VXuQ==;31:2jeCEt9hkGo2zcG/lSFq7v51IlaNIYwE7NQMGClMhS+0MyPvDTFrFeh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-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123564045)(20161123560045)(201708071742011)(7699050);SRVR:TYAPR01MB2302;BCL:0;PCL:0;RULEID:;SRVR:TYAPR01MB2302; X-Forefront-PRVS: 0792DBEAD0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(396003)(366004)(376002)(39860400002)(346002)(136003)(199004)(189003)(107886003)(97736004)(2906002)(5660300001)(53936002)(4326008)(25786009)(6486002)(78352004)(8676002)(305945005)(7736002)(16586007)(316002)(105586002)(106356001)(76176011)(6666003)(6512007)(6506007)(52116002)(51416003)(26005)(386003)(476003)(2616005)(956004)(486006)(3846002)(446003)(11346002)(47776003)(68736007)(42882007)(498600001)(48376002)(6116002)(50466002)(36756003)(16526019)(66066001)(81156014)(81166006)(50226002)(69590400006)(8936002)(3720700003);DIR:OUT;SFP:1102;SCL:1;SRVR:TYAPR01MB2302;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:0;MX:0; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;23:GsxTUP6YP4q3nb+AE5SvnqCeNvJyhPS+yBd3yxyKaW8WypGrL9hntgYn8WZoLMoqX/+5rRXwXvCFFYNGh/lKfGbnEBmabLQVlEo/+dTcte6M+JYQSFJ9z9LxztAeLn72flg7xJ9oWXfRHxFGmOWKoDn1e/ewh6bFF8ye56deAnLAcm0pCT9r7eHK9Eotc3EeOR/zXHZKYMIA8PU0cjPSaJEarQyPnz51FMVwHY/3xcPRwtSv8d9NuzS7CDoEKuS3J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IGIOxfgNtmJqfejvThf1j+XggfeJDaEXlW3x2a9TcYZNovasU81g9H5+SDHTQ6ZGANDd4GbmGM1iQOnNBmWH5xEQ3RURWDuRaU8GXx935a60/suHy9O9C0/Z2lr9qgjHuIutyFkXgo7qIztXbLREv0Xl7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;20:YfA5QGg2ywP5D11sY7rzUhQ7upNb/DOaguUnlwEVcVALcqSHUVwbQGSg8PZXax8cWBnS4Kjs2lNReRwPNgc6xu6MXsXzln5YZTAGfoWiwfF8ccQA3KSbRRWRPjzewk4X7QjdhgdshprqM6hNhva5SROcydS9lkARsvXPWDe7JLk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 08:48:46.5537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f02fd75e-c4a7-4e4c-a4dc-08d617c36317 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2302 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP R-Car Gen3 needs to deassert resets of both host and peripheral. Since [eo]hci-platform is possible to assert the reset(s) when the probing failed, renesas_usbhs driver doesn't work correctly regardless of finished probing. To fix this issue, this patch adds reset_control on this renesas_usbhs driver. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/common.c | 12 ++++++++++++ drivers/usb/renesas_usbhs/common.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 4310df4..1d355d5 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include "common.h" @@ -574,6 +575,10 @@ static int usbhs_probe(struct platform_device *pdev) return PTR_ERR(priv->edev); } + priv->rsts = devm_reset_control_array_get_optional_shared(&pdev->dev); + if (IS_ERR(priv->rsts)) + return PTR_ERR(priv->rsts); + /* * care platform info */ @@ -658,6 +663,10 @@ static int usbhs_probe(struct platform_device *pdev) /* dev_set_drvdata should be called after usbhs_mod_init */ platform_set_drvdata(pdev, priv); + ret = reset_control_deassert(priv->rsts); + if (ret) + goto probe_fail_rst; + /* * deviece reset here because * USB device might be used in boot loader. @@ -711,6 +720,8 @@ static int usbhs_probe(struct platform_device *pdev) return ret; probe_end_mod_exit: + reset_control_assert(priv->rsts); +probe_fail_rst: usbhs_mod_remove(priv); probe_end_fifo_exit: usbhs_fifo_remove(priv); @@ -739,6 +750,7 @@ static int usbhs_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); usbhs_platform_call(priv, hardware_exit, pdev); + reset_control_assert(priv->rsts); usbhs_mod_remove(priv); usbhs_fifo_remove(priv); usbhs_pipe_remove(priv); diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index 6137f79..bce7d35 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -10,6 +10,7 @@ #include #include +#include #include struct usbhs_priv; @@ -277,6 +278,7 @@ struct usbhs_priv { struct usbhs_fifo_info fifo_info; struct phy *phy; + struct reset_control *rsts; }; /*