Received: by 10.223.176.5 with SMTP id f5csp996292wra; Fri, 2 Feb 2018 09:26:09 -0800 (PST) X-Google-Smtp-Source: AH8x227Th/nJ79boWOgWnjQBxuc6tYMwYeOD8Mg8hGmF8oirD2vbbnajBAmg3+56EPeakWrn36HT X-Received: by 10.98.32.151 with SMTP id m23mr41236811pfj.182.1517592369819; Fri, 02 Feb 2018 09:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517592369; cv=none; d=google.com; s=arc-20160816; b=WNrav+H751O1QhNh22D3d/2l8noGVJ0OMQOmLFi7zdKqp8hyzVb/6/xSkZkClTdUDM v5LTkbFUXQ72gBaet8ntnj2VFZCUnQkfiULWVlL8iWVNtd6H4AJoUBNxOvUrDwkbE0K0 nLHAoplIXfYG7rEad+ZlXyAZebUAPCMZBItXow/eSgAUDhKJYAh8rqxOTsFkCVsDTuPK ghV3abWZwvvj8JFN21ioGYLTNAI5fn7AKOXOlq25ds+o/AggB3c8BDcMNKRBNTRoiqIE vwVTpxMUQNXLlflLFZfcBK4zA1mkAwzoxIaAZBTQqDprQpdQGx//iSOkeRCD8K4dNj3B e76A== 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=SQFKErIa/lBDoyAQ9uYPQAR6r+TlOWv9qdJMs6eAaio=; b=CKhzPZzDDhzpKEpiABESnnAbPDTgyXy+sST0vb7jRAgsvXaNrXCoh5//0G3ExEcFG3 Howi6VlJienRuLAmev9eBYAH2R2kkZ+Oe7D1epX1ucZvssCrDz1QVt+nLPfe2ghK72xy DLHqWAP1WUCeZBsb2H2SlJ0qXyb3S88xWm7Ig4iURETQ0/UnujRugbFmhiKT12QtDWMC RnYST89VCtr+D77zsd6UAbCv1MVQgwZ5X9vAVINEd4A9ROVJ9lK2PGm8YDRLHGPN+5lW EnYcu/1yU/AvScA5JPc8bAtq9mXGXtkD8gy5Tf0d1DB4jdzlQXkPm/5m9NG8EVSeIdNI GGmw== 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 v2si1701249pgs.511.2018.02.02.09.25.54; Fri, 02 Feb 2018 09:26:09 -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 S1754057AbeBBRXm (ORCPT + 99 others); Fri, 2 Feb 2018 12:23:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40378 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753582AbeBBRON (ORCPT ); Fri, 2 Feb 2018 12:14:13 -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 8E72DC97; Fri, 2 Feb 2018 17:13:58 +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.14 150/156] spi: imx: do not access registers while clocks disabled Date: Fri, 2 Feb 2018 17:58:51 +0100 Message-Id: <20180202140847.143336945@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@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.14-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 @@ -1496,12 +1496,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);