Received: by 10.223.176.5 with SMTP id f5csp975037wra; Fri, 2 Feb 2018 09:06:55 -0800 (PST) X-Google-Smtp-Source: AH8x2264WA2M2LOIXtZXjFe9zaVcbB11vCDKfcUS7nVfg/lus99bCPpKn1/sN9Q/gU4cb66GiHnA X-Received: by 10.101.97.209 with SMTP id j17mr29303350pgv.266.1517591214904; Fri, 02 Feb 2018 09:06:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591214; cv=none; d=google.com; s=arc-20160816; b=UEduOuv1spFLikyGNinJJyv4crlma6xc7BxFZnOcgGLfK5vHZDaG+W8uftk/nabCER P1/ynBDs8Ql0mEVr+K0VelpOVg3XiEVhtiPWtY2k9JKscqqKVyikA1D9GoQpM9M5NSTP 4nHOwCTTfmfgFaewvtds9B+9g0SsuS4TKvxuweAXLY4onutp5TbCcbsphbDHLa6rG0JP bo2Hy+YTqOWNOO7PMY9rJTrST1mDi+G1+xkgDrLRzGNwHE67WYLziBY/nxEdKhK6SjDl Z6IIZjJV4I5CrtWcV+wrf7cQ0FtMmu8ScfzMxEn0FLbsOXEfnfSiE0W9ccTTqK+HTO7p b0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8fRPHXBwQ2hjFq9IUG95M97mZeh5MYfwXsRWG3klTeg=; b=h4BxrcTtU0rO22xVE9Uuz2+t6Q3T+DlYrKTeNouMChbKq9jbhjNYTOgPXXGRLdZWHd bU+Q4aDLCcMpGq3/c5BedG3TFL6utBqxTOiTSFO8uF1ZR6FgeuuGCpsQ7K1fiuWFuedm SwfIYEUVXrwf0bD5UZc01gJybR6cSfOxljRc0N+nn8bMQgv2PjeS5hppUYkEHxEjG8lV 7LkcfDPWvAW/lH9zXKj9ycLDDr37FD8Wc+E00Ep+RsG0BdKDp8KOBk3f5W9WVzLzKTJv h8tCJs+EtsUGqnLI2crgrZCqO3eHryu64QBpysWeoq9wFeC9mZSiiXruEPkbZWq/v9qf U4ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si18595pgb.832.2018.02.02.09.06.40; Fri, 02 Feb 2018 09:06:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752983AbeBBRFV (ORCPT + 99 others); Fri, 2 Feb 2018 12:05:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35504 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752776AbeBBRCp (ORCPT ); Fri, 2 Feb 2018 12:02:45 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1F3EBE4E; Fri, 2 Feb 2018 17:02:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Agner , Mark Brown Subject: [PATCH 4.4 67/67] spi: imx: do not access registers while clocks disabled Date: Fri, 2 Feb 2018 17:58:36 +0100 Message-Id: <20180202140822.554477179@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Agner commit d593574aff0ab846136190b1729c151c736727ec upstream. Since clocks are disabled except during message transfer clocks are also disabled when spi_imx_remove gets called. Accessing registers leads to a freeeze at least on a i.MX 6ULL. Enable clocks before disabling accessing the MXC_CSPICTRL register. Fixes: 9e556dcc55774 ("spi: spi-imx: only enable the clocks when we start to transfer a message") Signed-off-by: Stefan Agner Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-imx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1228,12 +1228,23 @@ static int spi_imx_remove(struct platfor { struct spi_master *master = platform_get_drvdata(pdev); struct spi_imx_data *spi_imx = spi_master_get_devdata(master); + int ret; spi_bitbang_stop(&spi_imx->bitbang); + ret = clk_enable(spi_imx->clk_per); + if (ret) + return ret; + + ret = clk_enable(spi_imx->clk_ipg); + if (ret) { + clk_disable(spi_imx->clk_per); + return ret; + } + writel(0, spi_imx->base + MXC_CSPICTRL); - clk_unprepare(spi_imx->clk_ipg); - clk_unprepare(spi_imx->clk_per); + clk_disable_unprepare(spi_imx->clk_ipg); + clk_disable_unprepare(spi_imx->clk_per); spi_imx_sdma_exit(spi_imx); spi_master_put(master);