Received: by 10.223.176.5 with SMTP id f5csp1009223wra; Fri, 2 Feb 2018 09:37:46 -0800 (PST) X-Google-Smtp-Source: AH8x227PK+hAMKVrrmSbn/hrru+y+os1Q1c4T/NR4BoeW0T0koWRnZ4HnwP4BvpLFf9TF6zT99A8 X-Received: by 10.98.200.153 with SMTP id i25mr40183068pfk.241.1517593066262; Fri, 02 Feb 2018 09:37:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517593066; cv=none; d=google.com; s=arc-20160816; b=edhH+Ak4aQOo3UpIzEpmbaG2EEJG72gpt+0Yn66/UTy+BtFrhlOctv/ALcsRJRHsO2 9wY+9aNhtsyzvWxsBHF1vwlT1pekJKaX1pKRgPvTK/FXVboHFXDeh9tcEfzABXM7AE4Q gKgo7C8OoxVKVxTo4KgIr5oQ/LNt8lrcpXk9SAVg4ZTCytzCAu2UUBiT8lkoybFgmToB ydevV1UBU2975isJ80BlntAEtxCs3h6R5i/E9TNNDkmLUQDBcXK0WWRv/QejmREO6C5M 0/Oz7FwL6BBU9eIRKCWodbNVf3Gp1AA3EOqP2yM+frAR53gaSIsEQTe4MjFtnwopZYoX 8VIA== 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=pZB2uSLs++JSmkph55mNKLkwflIW9JLzU4BCAB7vn1k=; b=GHcpCgZqfCGIBz/jyEb82qlO3+z0iwVb2/wVQ/AImz0QP6/Y42EdUKat/oWLo5b397 9S3e96JIHrRNG91Dn3MCuE4E8X5xx328jsJePM1Usotu/PBdoT2ytVjbpcVIHOtdqsmP ULxs/4x4++41xjHT/rUhlAUSw9Wz8u9lT/3/xDKd7gmyk3wVcCyH65p15rFq4p23otDr CLEe7HU64P4fcNKXbgdp41yIwlyp00o4Fcq3ZZW4HxOtwKIGlIp9fe5Mbc32fhw+GS+o Lbp57RewTXrANamJqQTfENeHFr5Jd66c+RAPnjCJD4sULO/7yULHdoFkcMPvTB2yKtV9 YqlQ== 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 h80si2179643pfj.207.2018.02.02.09.37.31; Fri, 02 Feb 2018 09:37:46 -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 S1753938AbeBBRgm (ORCPT + 99 others); Fri, 2 Feb 2018 12:36:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41154 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753874AbeBBRRG (ORCPT ); Fri, 2 Feb 2018 12:17:06 -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 58784BC4; Fri, 2 Feb 2018 17:17:05 +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.15 49/55] spi: imx: do not access registers while clocks disabled Date: Fri, 2 Feb 2018 17:59:07 +0100 Message-Id: <20180202140830.828629367@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140826.117602411@linuxfoundation.org> References: <20180202140826.117602411@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.15-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 @@ -1668,12 +1668,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);