Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1245308pxb; Fri, 22 Jan 2021 10:26:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzE1PfyPGzam2DuGhlXkrxuBPSjr6/G4Fhj+vETYp3zC4365/U19TPdKPtFL+sldQsobkc1 X-Received: by 2002:a17:906:b41:: with SMTP id v1mr3802208ejg.277.1611339969977; Fri, 22 Jan 2021 10:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611339969; cv=none; d=google.com; s=arc-20160816; b=fqOEZYtw31Zv0vpy4yWGXiBoYbCqfLutSX98BOarJCirsWZVP4Xz6mg45bZCG98PGs lKdFYs7nh2a//d8w1Ux8o3ED7+UJJN3i6S1W94cKj0wTT9PkkA1pC8t47F8Jig+govzp kkKBB/XLtUFuqKzD6/LLFYkaABtrbfMRCVZbVWXgXgZ1snV4qJ8AM8efnkwU/PVQwuEp onXWDdzC+KY1fHzOFEJZJO+Uajd69obISvPnM967/L17/R9Za+syP06a9xqwem5Kg+/U pT8l73LBxFa+9X1sj8FulX1J9L6q+2nJbVlHKZJegk3/i5JsJBQTR0IE7xZQvdSW197D n29g== 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=wHpa967lW2OzkF9gJucRSf3wXJkncLvNsVsxG2uwgTA=; b=hjEY/W8VG2tU2pGO0dsCSHEY5AqSPgGmkZKiScgRG0QmgPxuc43xQv+8AuOAtzuqJc 6wAaR01yfe/EHxh15pU1p0lsuDwZveKmiXqf5rrD5VlE0mZFlg5Y1IBpHrwXh5yvTS2d WpE7NXeMQGX9vQI44c0iac6ad8RRojFeTvOe5pg0fLlFPirIaWvGP27KwZlQE2wX/Ils BkTBbXS71pV62Xo2DQYHS53GI9Y7SYl3mrrE7jAlxYSKQRmdoLzgTQAuSieC/PfqD1eG Y+o0CEm1GvRqOFVZOj51FC2/rxdjJ9THsTM2Hvq+0pJH+EFAwtCUsuayUw5l3+CXwd3+ UTAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HYcE8pJg; 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 by2si3595502edb.143.2021.01.22.10.25.45; Fri, 22 Jan 2021 10:26:09 -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=HYcE8pJg; 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 S1729883AbhAVSXm (ORCPT + 99 others); Fri, 22 Jan 2021 13:23:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:40004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728587AbhAVOXQ (ORCPT ); Fri, 22 Jan 2021 09:23:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4262E23B7B; Fri, 22 Jan 2021 14:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611325056; bh=7wNmMAsfkNPJ8QYKHFYsi9gLUAod791kA9lr/bq0tiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HYcE8pJgLyt5Xa/Ysmk0tsv1eWXyf2cnoVoPX7Gn2zI8Y+1oNQ7qM598fUYVJpJxS 3JpcIRRHQ9D+s4+H09AVPB4OPRLouxIgn0tpucEktU6USx9XQIaALmZCxq92EAgI9f qMwlpZ4ziuXCAUAvQdchOy8BcgAqiSozlA28SriE= 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 5.4 33/33] spi: cadence: cache reference clock rate during probe Date: Fri, 22 Jan 2021 15:12:49 +0100 Message-Id: <20210122135734.900345130@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135733.565501039@linuxfoundation.org> References: <20210122135733.565501039@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 @@ -115,6 +115,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; @@ -250,7 +251,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); @@ -558,8 +559,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);