From patchwork Mon Oct 24 11:28:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp614283wru; Mon, 24 Oct 2022 12:23:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PCgNn+XXo/2Vlt8wEfLJeIHY9XA4Zsy4SQRfvHF4Iho1keROMIJnrlzOUC9D1csr1EA3B X-Received: by 2002:a17:907:d26:b0:78e:20c6:9f77 with SMTP id gn38-20020a1709070d2600b0078e20c69f77mr28285689ejc.243.1666639409667; Mon, 24 Oct 2022 12:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639409; cv=none; d=google.com; s=arc-20160816; b=ZDXQZj3LVAzJmrz3ruWJIWisUrim8ht9DlmH7I/uj6XSxgVPuW1am7iAt0b4gPOc8B f5Nn17qL7/R0fYmSUdx4w/NgOqOxGxx085b0Dc1OPLYIzy2BEnBLXJZirIXMv9Nziq+E E3FtWx27lQ0p5AQV9r3FyXyhAREIDklzarJmVCtwUE9LBqWS3UAjkBdccOF5P8i4Asc/ PPTGe8Gida4w4CgoU9Qu0RC5ypOZzvNs7JvnGm7JzIqUEdMGnNKaRPb9nxSA40IYQT5P y8Zou95uvckNVSZ7uLADIWi59dE094emHjBSmtj7FG3qXZ+YzqymzV3Ds8vbBFxacOSe ejgQ== 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=bJmKRR/q+kBCiK96k8O/LhdQvMvn+L/FTaOJGRjEInI=; b=EdpNYK70J3v+t6Y3a09KIkwpKISAV0+yF89qgI2EbB8cMVQZP9cLPBHzLo6KEEKJEA qI05bsDcbzzvjRo6NN4qNN2YdWhoqi3ZVjB8H/Y6vsECDnrNE6m1g8K2BJnA7p5x+uWC F3bpJG/RitytLYZ4c6E0FQHHz71CbwjA3vahFQARCrvA3bvOeFY9gp91mAd5TlplmrGO 4V88ve8TdtCzNe5k9Qs2e/P9+g+QW/3TTXc36yjsIw+HRGtEnvPLLZexHdZ4bvtb/GsQ eh7viBYRamxWmYuBUyI38TnhJnJO/znLHbeOlyhxKPM3KrQxwQjNmAXpy3pmwqRM8v6l k9pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m3Jqyta5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i37-20020a0564020f2500b00461c43d1113si526579eda.569.2022.10.24.12.23.05; Mon, 24 Oct 2022 12:23:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m3Jqyta5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229961AbiJXTPX (ORCPT + 99 others); Mon, 24 Oct 2022 15:15:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbiJXTO3 (ORCPT ); Mon, 24 Oct 2022 15:14:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C2C7F25E; Mon, 24 Oct 2022 10:53:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 84654B81975; Mon, 24 Oct 2022 12:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4211C433C1; Mon, 24 Oct 2022 12:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615306; bh=t3dMiH4XJXVQqT24zBIQwudtQaBoBJjPnA3eH7aaObo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3Jqyta5v4tOn1sGi/8z9sj1yyxgiSGAG/jo3Neby/ClORV8OBYsOi804LhnGlX8J 2v+VcG9t4WpxB/I8Su5ZoluCiy93aOEMPPWPirWZN7e8R9eRm+FEGjrgCTmX9lZp5n wwtsVLxFNe+x08Wpw7NA4CuC1CA4cnGMived+4vE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Schneider-Pargmann , Neil Armstrong , Mark Brown , Sasha Levin Subject: [PATCH 5.15 170/530] spi: meson-spicc: do not rely on busy flag in pow2 clk ops Date: Mon, 24 Oct 2022 13:28:34 +0200 Message-Id: <20221024113052.735450811@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598085329177182?= X-GMAIL-MSGID: =?utf-8?q?1747598085329177182?= From: Neil Armstrong [ Upstream commit 36acf80fc0c4b5ebe6fa010b524d442ee7f08fd3 ] Since [1], controller's busy flag isn't set anymore when the __spi_transfer_message_noqueue() is used instead of the __spi_pump_transfer_message() logic for spi_sync transfers. Since the pow2 clock ops were limited to only be available when a transfer is ongoing (between prepare_transfer_hardware and unprepare_transfer_hardware callbacks), the only way to track this down is to check for the controller cur_msg. [1] ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Fixes: 09992025dacd ("spi: meson-spicc: add local pow2 clock ops to preserve rate between messages") Fixes: ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Reported-by: Markus Schneider-Pargmann Signed-off-by: Neil Armstrong Tested-by: Markus Schneider-Pargmann Link: https://lore.kernel.org/r/20220908121803.919943-1-narmstrong@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-meson-spicc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index e4cb52e1fe26..6974a1c947aa 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -537,7 +537,7 @@ static unsigned long meson_spicc_pow2_recalc_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return 0; return clk_divider_ops.recalc_rate(hw, parent_rate); @@ -549,7 +549,7 @@ static int meson_spicc_pow2_determine_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.determine_rate(hw, req); @@ -561,7 +561,7 @@ static int meson_spicc_pow2_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.set_rate(hw, rate, parent_rate);