Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1265258pxb; Fri, 22 Jan 2021 10:58:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJ1a2m408vjKcNKTJD9t0aEdp4MV0BFIUH0vfutdjR3h/SsPnFXDXOHMM9I7ydcUMAdQpN X-Received: by 2002:a05:6402:490:: with SMTP id k16mr4221815edv.71.1611341894199; Fri, 22 Jan 2021 10:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611341894; cv=none; d=google.com; s=arc-20160816; b=tSTmETZVsHo73PIVPqCGbGhqX944t86jxQukm0JhId8CjfhFnQ9EuWLEVwn20H/CSk lA3cTfrZP5hYqWQtbkMCr8PPPV14IAKb3wTOPII1hd6Mip0XbnLLZlosQakokTzh8ukz +6BthYc9M8uVemPrccfvB4NrcUTz2Fo95eulOkq5o06AucSN/SMQJ6hCWeNbBCQoo3aq 0On29SCDIq6UL7yVehxKeanFezegXJOC9xpS8DhxyVg6bQjpPcPcmJfqoY8CIcqWGk+3 cJhFgwo049WX3UtRdjSBsdq7XPyPg3ed7CWjLio58MKM40187pCcSpxN8jCC6oYFkTax caWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DQ54+0OFYk8Pzi9iOK11I+v22jAuIDNID1F0gmmsiPM=; b=q8ShSWhjkm0oBfgKQz/pCfDIo9wUHHoJuN8GlzKMYMcoKvk2AvUd7x+5xDmqYPvBq2 SuMCOxKnUfHS4YOqV9uIV7gMYjyE/f5toJ4Yf16spEItYwpYxpR3SYSv9BOMlh0P9zmn bc+zOEjW/gjRz69TC0oAga8EtxmgCFNIPNXbOb61SALYn/mzpBfXVwL5NVSirZULh0NF giVJ7ZaqNU/TWmTxN/dY8y8TH12ygscZ3utS7MQFkprwFWnYq1/zg/BXBtDWfO7JDXt+ Vc8DPnyJIUzK6cco4N01APoCNw2cw8NihOo0z+DIA4st5ckVm4sYtPejsAFCrrQPo+Ia EQcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aqnLXO+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si3925057eds.230.2021.01.22.10.57.49; Fri, 22 Jan 2021 10:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aqnLXO+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730263AbhAVSxc (ORCPT + 99 others); Fri, 22 Jan 2021 13:53:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:39060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728525AbhAVOWB (ORCPT ); Fri, 22 Jan 2021 09:22:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 838B023B52; Fri, 22 Jan 2021 14:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324968; bh=nnGMVQlWgPgHufE3sp+L4vPltDrGHjcCpMgLKlHs15E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqnLXO+/Vz8I0Khu8AaUD3ELkQJy3KvJ/Njsyl3il6lfS2w9E8ALDeLdKcPGMe42u kiPYsNFkDNw/jKu77Dw6+fHZkL6OCRhHFd+B356JqXlbohmHUicpaUP72f/NJ59lXa g/VVajHFj7OOi0BNUAwX29Ya2i8Pb0KDvuq3p/pE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Hennerich , Alexandru Ardelean , Mark Brown Subject: [PATCH 4.19 22/22] spi: cadence: cache reference clock rate during probe Date: Fri, 22 Jan 2021 15:12:40 +0100 Message-Id: <20210122135732.786726542@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135731.921636245@linuxfoundation.org> References: <20210122135731.921636245@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Hennerich commit 4d163ad79b155c71bf30366dc38f8d2502f78844 upstream. The issue is that using SPI from a callback under the CCF lock will deadlock, since this code uses clk_get_rate(). Fixes: c474b38665463 ("spi: Add driver for Cadence SPI controller") Signed-off-by: Michael Hennerich Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20210114154217.51996-1-alexandru.ardelean@analog.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-cadence.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -119,6 +119,7 @@ struct cdns_spi { void __iomem *regs; struct clk *ref_clk; struct clk *pclk; + unsigned int clk_rate; u32 speed_hz; const u8 *txbuf; u8 *rxbuf; @@ -258,7 +259,7 @@ static void cdns_spi_config_clock_freq(s u32 ctrl_reg, baud_rate_val; unsigned long frequency; - frequency = clk_get_rate(xspi->ref_clk); + frequency = xspi->clk_rate; ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); @@ -628,8 +629,9 @@ static int cdns_spi_probe(struct platfor master->auto_runtime_pm = true; master->mode_bits = SPI_CPOL | SPI_CPHA; + xspi->clk_rate = clk_get_rate(xspi->ref_clk); /* Set to default valid value */ - master->max_speed_hz = clk_get_rate(xspi->ref_clk) / 4; + master->max_speed_hz = xspi->clk_rate / 4; xspi->speed_hz = master->max_speed_hz; master->bits_per_word_mask = SPI_BPW_MASK(8);