From patchwork Tue Jul 3 10:46:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10503785 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 D4C426035E for ; Tue, 3 Jul 2018 10:48:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C29E728760 for ; Tue, 3 Jul 2018 10:48:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B66612876E; Tue, 3 Jul 2018 10:48:12 +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=-5.3 required=2.0 tests=AXB_X_OUTLOOKPROT_ENVSDR, BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 451A528760 for ; Tue, 3 Jul 2018 10:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752872AbeGCKsI (ORCPT ); Tue, 3 Jul 2018 06:48:08 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:36489 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752596AbeGCKsF (ORCPT ); Tue, 3 Jul 2018 06:48:05 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 03 Jul 2018 19:47:59 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 3BF9C9C735; Tue, 3 Jul 2018 19:47:59 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.51,303,1526310000"; d="scan'208";a="285817329" Received: from mail-os2jpn01lp0143.outbound.protection.outlook.com (HELO JPN01-OS2-obe.outbound.protection.outlook.com) ([23.103.139.143]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 03 Jul 2018 19:47:58 +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=hofuByjhlELSaAP7Cp17gcs4lzMtPBG24r6D/io7jTk=; b=coAh6wC4xvUzKdcM6oY5MYCkXCqWDu+da2CrS6GbOOaHJRbKk4Fb6q7d4qSyxagbsQD5mc+ckg386uvKjTYLxCUFMrutMfTqk/B7CgTEd9/iYx6w/eadres5BLIDP0g9iY3eUvQ/ofuk4ZuDX/FsgVedfEa/Mw3EWvUGcGch7n8= Received: from localhost.localdomain (211.11.155.144) by TYAPR01MB2304.jpnprd01.prod.outlook.com (2603:1096:404:8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Tue, 3 Jul 2018 10:47:57 +0000 From: Yoshihiro Shimoda To: mathias.nyman@intel.com, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH 3/3] usb: host: xhci-rcar: Add a condition check about PLL active Date: Tue, 3 Jul 2018 19:46:58 +0900 Message-Id: <1530614818-7634-4-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1530614818-7634-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1530614818-7634-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY2PR06CA0008.apcprd06.prod.outlook.com (2603:1096:404:42::20) To TYAPR01MB2304.jpnprd01.prod.outlook.com (2603:1096:404:8::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 341d6734-5d51-4d4d-c4de-08d5e0d27058 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(8559017)(8990107)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB2304; X-Microsoft-Exchange-Diagnostics: 1; TYAPR01MB2304; 3:DRcSdJ2MZc0qSf2Oz4ymPkxtEMPB3ARm3hJX0ZnkJ111Xa4nu3vyrQB+5XOmSAaPLA+ZmlaQzPQpxEtgjl6Ag9pzK7337JLARORIUDIPI8SpZvKH9XhV/XJn3AAcpJwVRkWA4HhrzOFZQ1cK7+sUJw5E8Rd99q0ZSFYL7eHkI2s8N/QUw+8+wRg9O1D6+KuCHyGBxwqd8zAxz8yp/0qiTT8MfAxqL5yZNI3rTFX+osVI7oHc2+OaZPSnW0gD27nw; 25:R29m85oWOYtLVSWzoqALE4Iq7WdA3zm0l3G+n+GxbSoquVactdagdozp4lLhOCfp/8qCWEfc2X3/0A7GPYvSFZ+SBrEJa9nlIv42PNvyMZd1bTOeSfzR85vtFNeXCpMwuP55nxA5efQkaSpwfH7KicGDHt5xJwgocDwtuuSDfhute7kUkSgRv5AfNPIwZ3YwCGeD/CFayZ+Nk7wW+cKta9Y21k60eY8VN6QL9uN4ehuCMXYM12wIedGlSG5eQw679LRjd86zBT8BaT4SwksUwwN6ig8K5ZcIM/wgO8TH0NprvAWy/AF23G7+rITGI9Hkrrgokw4/CF70axLIUttYSg==; 31:hx5cJnjIJXS03VoTzuLDu7+n3UAma6aZ2RRio06h6kdGOF8Y+EU2Dt0TDbAm+f/2+Q/LBnkfw3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Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(3231280)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:TYAPR01MB2304; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB2304; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(136003)(396003)(376002)(366004)(39860400002)(346002)(199004)(189003)(2906002)(50226002)(6506007)(386003)(52116002)(4326008)(47776003)(16586007)(11346002)(68736007)(76176011)(316002)(26005)(2616005)(956004)(498600001)(16526019)(97736004)(5660300001)(6346003)(66066001)(51416003)(486006)(42882007)(476003)(446003)(78352004)(105586002)(305945005)(6486002)(50466002)(48376002)(6512007)(7736002)(36756003)(106356001)(81166006)(25786009)(3846002)(6116002)(8676002)(107886003)(53936002)(8936002)(81156014)(3720700003); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB2304; 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) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TYAPR01MB2304; 23:m7MjI8dpF/v1ML+GEHJN98DdS42h152Y5f0yewnQq?= =?us-ascii?Q?z+u9KGYJKABZNBsVSepf6OukjoswS42tLJbW6WN8l/LsQSXZ0xW4dgdIjDd/?= =?us-ascii?Q?nqu33quPUbqyyZ/G7pSnWFk7m8okEsDWPVQ2gRjmk4/EuUruzc94fVoTuWrW?= =?us-ascii?Q?o/QD8AAyk8tu+slok0yZ8tNiSKEvW4yBXWG7Tom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ghD/G+cdGsHwW3CXAnFmMAZvsyW8vH/b8uq9pN5urXOPClA7XVYA==; 5:qBrq4Zj8WQkpq08/rMYmqPiw9xKH/VS46CgYvbSQdOmezL2KCTzvg6jRuoDd5tVGsA7y5ncBOOxMf0LKB1GCfcu1/e2AmZxX+B8iFbZTbRT4YxBZr75VIy4KU2tD/MiVziNvPtfVdYI7q7lWKXnQDpvZ67EiP/EQA4Qhk/Hff+Q=; 24:cIOO6Ys5wCWmLQ9NzUGoMRIGbWxAz9kpwp2mxjO+e2HakZx2hqiW1WkbnOKFcvgUhA4tOrPK/dGJ8gUQCtSYBy3P05b313FieTyNI2GqzKQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; TYAPR01MB2304; 7:LgMR3zfpE14Ey/OPTYvmY141N/PiSa+OF0vlJ4wknD5rY51YjG/eHn7p8PHt5GtKKiSq798RshWAIdIJ/E3KrfEcbr59P02lnd5A+bDu2F4lAVT/eLvr8UhsfkrYVMsOqST9N4hTXwh7h4610xWYtHIwhKN/vD16ghWIuTcWXm73mBp0RCSfaBmDpeWO2cOZvYkIwGk+G4/9RVAceLF1r2Zfh5ViGW+gF45J1fodxnXZmObN+XJosTRNPX6gnUJN; 20:kyj+UCsUzWc35sQI7ggxbXDjbnMR05Ti0ZdtbnhDokPOt0jZJDsC1QJipNv4hne5c0XUfj2Wn3W/D/vG0fk3RD5vIq/2P4/kVD3MY4V8idic4HYqcmdLZ2aMGdEH87TWqNp90NR7CW2AR/mxzmdHfiDuQaQo8nuxkCZsLTA6JHE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 10:47:57.4944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 341d6734-5d51-4d4d-c4de-08d5e0d27058 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2304 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 This patch adds a condition check about the PLL acvice of this controller. Otherwise, the controller might cause hang when any USB clocks are not supplied yet and accesses the xHCI registers. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Simon Horman Reviewed-by: Ulrich Hecht --- drivers/usb/host/xhci-rcar.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index 4a22f25..a6e4637 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -29,6 +29,7 @@ MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V3); /*** Register Offset ***/ +#define RCAR_USB3_AXH_STA 0x104 /* AXI Host Control Status */ #define RCAR_USB3_INT_ENA 0x224 /* Interrupt Enable */ #define RCAR_USB3_DL_CTRL 0x250 /* FW Download Control & Status */ #define RCAR_USB3_FW_DATA0 0x258 /* FW Data0 */ @@ -41,6 +42,12 @@ #define RCAR_USB3_TX_POL 0xab8 /* USB3.0 TX Polarity */ /*** Register Settings ***/ +/* AXI Host Control Status */ +#define RCAR_USB3_AXH_STA_B3_PLL_ACTIVE 0x00010000 +#define RCAR_USB3_AXH_STA_B2_PLL_ACTIVE 0x00000001 +#define RCAR_USB3_AXH_STA_PLL_ACTIVE_MASK (RCAR_USB3_AXH_STA_B3_PLL_ACTIVE | \ + RCAR_USB3_AXH_STA_B2_PLL_ACTIVE) + /* Interrupt Enable */ #define RCAR_USB3_INT_XHC_ENA 0x00000001 #define RCAR_USB3_INT_PME_ENA 0x00000002 @@ -200,6 +207,22 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd) return retval; } +static bool xhci_rcar_wait_for_pll_active(struct usb_hcd *hcd) +{ + int timeout = 1000; + u32 val, mask = RCAR_USB3_AXH_STA_PLL_ACTIVE_MASK; + + while (timeout > 0) { + val = readl(hcd->regs + RCAR_USB3_AXH_STA); + if ((val & mask) == mask) + return true; + udelay(1); + timeout--; + } + + return false; +} + /* This function needs to initialize a "phy" of usb before */ int xhci_rcar_init_quirk(struct usb_hcd *hcd) { @@ -220,6 +243,9 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd) xhci_rcar_is_gen3(hcd->self.controller)) xhci->quirks |= XHCI_NO_64BIT_SUPPORT; + if (!xhci_rcar_wait_for_pll_active(hcd)) + return -ETIMEDOUT; + return xhci_rcar_download_firmware(hcd); }