From patchwork Tue Nov 8 21:56:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 17228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a40e:b0:83:7221:86ba with SMTP id ck14csp14742dyb; Tue, 8 Nov 2022 13:59:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM7oq7NzDEcM8GD4r6cl7/dP43UkMYWTXMkrTzmPgRjbK1IIz0+dgjcJsYNC3pMSbUZrfsbu X-Received: by 2002:a63:3e8b:0:b0:46f:f101:c426 with SMTP id l133-20020a633e8b000000b0046ff101c426mr34205201pga.517.1667944752079; Tue, 08 Nov 2022 13:59:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667944752; cv=none; d=google.com; s=arc-20160816; b=RO3Rgn/nMg8DlMrnOWAi0dG8U+2qlntZEOjExPgcllo+WcJGBs00eAsWQ9l0ngaysH q5EH1m2jhJay47O/xzwM1QcIcwt/RQ0WPo5xQ0wO2B/KlY3jDFvEfjkIn+j78A/+xr/o MqkbdYj4vPfVZZaGP1IYJbBzDoZK8Mb/bvC7joU85yTEGjAMiSbDmXM5bJgp1WSzmdku CqzRx77wkf7+lM/apxeg/MLWG0vgKbsLPY6apwd0VnMZIckDVUU+PAMNnLGdCkiV8HCB 0Ne5OI4UJvte9qAM1vqMsLvINRrc7/lLLblPYt0XJxhrLZlwq9jT1PACwPT4rncE5U2C pdGA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fWi8AsnAXr1L5oWziawccETw/TpocZBIIBOJfBTzhJE=; b=V9o0+dVlq///eW8iKtQ3ZdjWMG6vkP81KKFy4Q5hAS4whIU5Lr4DHdonZmMLGeFe9/ uVdjI3Qd5bqLB3GTIFa8i6xiE9UNLMI0wY77k8TbtS/QTzcwZeBeas8n2KXKrtgW8gUW WZuNV7Ki7KJmxmoAH1WoLAnOQMPT7q038+yJcg8JdVKaISdOkjKOUNqskJvL6K8WV2QK 4W9OcpWCfP6QC9a4792LPtXAsfdU774Y84zZRcShldPciy4xJi7T5jbjIlzRE6HBAp2q J7eHn4vv7hQHrQjU2Xxd/xzH6syqbw8NqG9TiseAG6JacrNdBv30fprLXXr6MngL5VMP pbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pjyFWfPl; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc2-20020a17090325c200b001872e6c5c63si13814634plb.49.2022.11.08.13.58.37; Tue, 08 Nov 2022 13:59:12 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=pjyFWfPl; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbiKHV4g (ORCPT + 99 others); Tue, 8 Nov 2022 16:56:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229880AbiKHV4d (ORCPT ); Tue, 8 Nov 2022 16:56:33 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B08F16317B; Tue, 8 Nov 2022 13:56:32 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id j15so23070276wrq.3; Tue, 08 Nov 2022 13:56:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fWi8AsnAXr1L5oWziawccETw/TpocZBIIBOJfBTzhJE=; b=pjyFWfPlWsQy1nigSqke8Z0vXoHkUnsJH/2DB4nkoRCuL+5G3QbHge3HcayNZzFM57 fp1M3nPpxluF6CSUTGvF+qk+TVJ3UjY17/hoQJcGOWZvr5U0Qa7fvgKH/98XqfDcO6xp zJjl+zRGWCCYwX4QWwvvDCSZ5QNT9J3bYb+p6qnbszVghd8dC9JhZn9LXjRJj9mXVgxS KP4getsFS2tUGMkXJVR/EE44/nMw6XOhJYYl9R5L///w9YU7yIl9PNywnaPsyGI3JXJ3 h8RpWwTPGffZoQYt1voeCE8arRE4qjkrHX31rYSQKBumqkz9q87EeTFy9eW2oWRs1P4J 6pkw== 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:message-id :reply-to; bh=fWi8AsnAXr1L5oWziawccETw/TpocZBIIBOJfBTzhJE=; b=cQ1FMls8X9GSbIgPvYmlcBDBPSdTW4pvf44RIFILA+4GXxpMqZDaOig0nuKKJbLRRe n05AwhbH/l+3MTc0k5D6kxMAKMNA7jzOLp3bijsFr9OAXgZRMiBiJfsrj8wTTjI4sORj DLyfEVJz6Fr4e9uI3JShZAOmRoafhnf7cVtOFK35U9SCIs0fHNxV7Z7Y9m7dxrwST02d L03IObU5vPM0CECC3sSCZB8HzjFKbyAtVbQatB4gavWi8PfjpQiblWwDlIS6BGoMMSG7 SVEz7sm05gw/sQkJAHXG+z8Y15zJv6S18uHSr803Ii9fbR0OHxR79aXKD0hmQ3WvhcaA m+SA== X-Gm-Message-State: ACrzQf01qfKhJaJhjNKnSFjS4c9RIdfwXuGLSL/4jrh69IYfX8VZ7+tT LCjhLl/GdTqPYenBZGtzVMg= X-Received: by 2002:adf:f701:0:b0:236:e2b2:3b69 with SMTP id r1-20020adff701000000b00236e2b23b69mr27489598wrp.532.1667944591163; Tue, 08 Nov 2022 13:56:31 -0800 (PST) Received: from localhost.localdomain (93-42-71-18.ip85.fastwebnet.it. [93.42.71.18]) by smtp.googlemail.com with ESMTPSA id m3-20020a05600c4f4300b003b47b80cec3sm17050256wmq.42.2022.11.08.13.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 13:56:30 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , Konrad Dybcio , Michael Turquette , Stephen Boyd , Sricharan R , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [PATCH] clk: qcom: clk-krait: fix wrong div2 functions Date: Tue, 8 Nov 2022 22:56:25 +0100 Message-Id: <20221108215625.30186-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1748966836055219460?= X-GMAIL-MSGID: =?utf-8?q?1748966836055219460?= Currently div2 value is applied to the wrong bits. This is caused by a bug in the code where the shift is done only for lpl, for anything else the mask is not shifted to the correct bits. Fix this by correctly shift if lpl is not supported. Fixes: 4d7dc77babfe ("clk: qcom: Add support for Krait clocks") Signed-off-by: Christian Marangi --- drivers/clk/qcom/clk-krait.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/qcom/clk-krait.c b/drivers/clk/qcom/clk-krait.c index 45da736bd5f4..293a9dfa7151 100644 --- a/drivers/clk/qcom/clk-krait.c +++ b/drivers/clk/qcom/clk-krait.c @@ -114,6 +114,8 @@ static int krait_div2_set_rate(struct clk_hw *hw, unsigned long rate, if (d->lpl) mask = mask << (d->shift + LPL_SHIFT) | mask << d->shift; + else + mask <<= d->shift; spin_lock_irqsave(&krait_clock_reg_lock, flags); val = krait_get_l2_indirect_reg(d->offset);