From patchwork Thu Sep 8 12:18:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12970004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 793E7C38145 for ; Thu, 8 Sep 2022 12:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231552AbiIHMSP (ORCPT ); Thu, 8 Sep 2022 08:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231536AbiIHMSN (ORCPT ); Thu, 8 Sep 2022 08:18:13 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 368C7E55B8 for ; Thu, 8 Sep 2022 05:18:12 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id e20so25705831wri.13 for ; Thu, 08 Sep 2022 05:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=36szBVL2Cn+cs2NB42v+LawQS2D430mbQOaqyu/Olfs=; b=Pde3JYxD/Xd7HKAURItyoFTzSLlbMdkJZf1gK9a32JrxfqoSR6WT7zjXJ30ox8O3HB zs49UqsyBuLz6xVMI0aQekGt+BTmG/KUBFlcAcB4ZlBhVS4aceqzdh64Ic+v0Q9TghVe Aj/TPe9IXO7rMvvRs7GxgWDEzruAd5C+rvoMrKPgJBNEga4t2DPEKGfBsVAGA3D/wXvf xd+pRbnIomRsdTKedKKrUE5WcNF5tavoZCeGkht64YQiI7mu9TrAQggoHu26KZqdzI1g uUfXz4zxxI5PDVkuze5GMqJ+cv5HZyf+XodaHVXZFDWgij62kVXc3yFRzpgs0gCuv8ws xr1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=36szBVL2Cn+cs2NB42v+LawQS2D430mbQOaqyu/Olfs=; b=vCRz4hHzZn48B+3dtWVV6xU8ce61T+gHZyhePNHzUE7++zXB8Zppd1uy7stnCCDerX 0fQBrBslpzFFSqM2HcnhXL64tmhE0zURkMYIdxO+3vp1fkzgSqtdMb3bOYGH7mnT6w63 Zr0T3RDay/WTF0/zL2EUmtKmwCRkEVlsKPTzPi36VD6VZqWQO4ypWPBv4prrVGGYU2af gqW/rwWliimfhblploMNwKv92Y6OdDtvChWx9viVhII/tcS9SyVZZzGR/RYoJv4ljuXe 8VXaV+nkdW/C6ex6VTfI2lHgYPmI0SBNbvB0Prn3Zw/9KrOxKH80c/rpbod3FMfhBCCj NMAQ== X-Gm-Message-State: ACgBeo17Bmg8sAYDeslN2ynpmN+xsZBF6TjWU0PCHzvlmg0vJvsZ83NM dJu1B0L5hiJNEtVX3ES33M2xGw== X-Google-Smtp-Source: AA6agR5EjA56judCPtRCeCyzyYiLIg54xxck9hVsX0853urdIxfPbSabM8hT3pDh8JwKOyA8tSzDaQ== X-Received: by 2002:a5d:6e8c:0:b0:225:5f3f:1d8f with SMTP id k12-20020a5d6e8c000000b002255f3f1d8fmr5262682wrz.610.1662639490672; Thu, 08 Sep 2022 05:18:10 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:982:cbb0:666e:a053:1034:922f]) by smtp.gmail.com with ESMTPSA id b1-20020a05600c4e0100b003ab1a870daasm3212208wmq.5.2022.09.08.05.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 05:18:10 -0700 (PDT) From: Neil Armstrong To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Neil Armstrong , Markus Schneider-Pargmann Subject: [PATCH] spi: meson-spicc: do not rely on busy flag in pow2 clk ops Date: Thu, 8 Sep 2022 14:18:03 +0200 Message-Id: <20220908121803.919943-1-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2239; h=from:subject; bh=yaCMBlN3USyF395Qdq99BsDpbkdWYyZKbFBk4XoweKc=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBjGd1q0Ohn/nMUpBJQiilkpVXCK3b8I2QACUHiwbG7 HNL0O1GJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCYxndagAKCRB33NvayMhJ0RtJD/ 4mdK7zWsfF1Ga9qsaLSDth+NlZNgABEsh3oscJvCZlBD9qZNExO3Glepq2g1FnFmbD7FIoK6kN+NP2 nRT3URxR0tX2COW7gxtfywqW3N8Pu7l4HDr2MXnjhL+3q8dw/+TtjRfHPgWb+uyXg1N1vScKU6dnRy lBUilgIhBTygZl2E1g6vtGN3tFZG1idUwIT+YIgxbb7EcWCXac6Z+L6omlKS2j8L4gpszEIM10YE0x nE5TE5gsbHciqfxc0X8pd7wI2oxugaw7fz7ecDy3pWZh6/+ofNiRrGjwjgbwGMlV45UTncwv4O8SF7 5Dd1I3IyZjWQ5I0v+oQNCOKb/gs3QG7zOwgkvBSR9UQjbVFBOXIoJZ3UafQQP/wmFXaeRr4oJKR+OD NymFVCG3+6NC/vqTZnmkGBSzpNbmOeaD4SWXHM8M2eDEDgY98wclVDLCkyi2fV9fOeIVWKnzeRJ3RB a74K42rUBbN+t37jcwZxObMWH8XHSAWqjcWxz80Dc4hjhaEvGjMO2QNz2LzsYEjJhzkxwcB0+HV5D2 lPKPpS1AXR1EF7U8pfxcpl5G/BtrabXa6bGz42Pb6163yqzFc4NjjNWb4POhBpZgWzgO+gzgT3HQBl xy00lqqUJqtsPMaQBtJUHSMUSD54ssFtW/sHjSpttcvgZMTjwEAi28AtZ43w== X-Developer-Key: i=narmstrong@baylibre.com; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org 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 --- 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);