From patchwork Wed Apr 26 09:58:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 87787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp129059vqo; Wed, 26 Apr 2023 03:09:26 -0700 (PDT) X-Google-Smtp-Source: AKy350Yr48zXgPXKJC7F/g2bdgPaDjZ6IGReQFmpT1RX4TA/q+26OTbWftkpJRrRGfJUqeTrdGm5 X-Received: by 2002:a05:6a20:1b07:b0:f1:377a:b762 with SMTP id ch7-20020a056a201b0700b000f1377ab762mr19498995pzb.33.1682503766228; Wed, 26 Apr 2023 03:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682503766; cv=none; d=google.com; s=arc-20160816; b=klwppVFUVvNEgizZ3L1U22lNmMZoQqfqvxjqesAcW2aSqhO9fwmHzTxEK9uReWWiTJ +bi4pWo0S+fZYk//+kO0hXo3ZtSQbKw3wtgb2U1guW55tq0CdfpGMJDF+JTVNASZfeOa Hu+cAs5rCv6RlCbq08N0TLmJljCAtkC8zURL2Ta0qdLp5Lx4WPQoaGgSZS2NgmMIZl2L fZc1sCe2yDYgEHKldudRU4e0gE9vI0ZT4lOIjTGqY3O0X9A4g+c7a59iDOnwodZNJo2q ykS8fPhyrAmxloFA1QXml6OGSK0COtuQDCox96AQdu+1m+M7ZTEURQ/9iNAhJqBChr5C 4EMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qcIGKcZIb5cUrNAdB7ZZAIiITgzMPRGFSQuzjV413Y4=; b=T1r/eKJKMQh7VwyH8l95zFzdxH05a3yKP+vSb6Pjx+F/4Th6idEsxRzusbPBdqVrW4 uSClpurKJXFgPrvWFmnqhq22W7GKOabDIEnqThdBmzswMOqximpjb2o40JFJnYmdANkn kQW6OphSdP8c02SklOrzRdbyS5PY2GxsL7Rs06vEgXb1yFhABzuD5r26NXsSrW+/lcS2 Me2Tk2hy24XHLclc3ErDodrMJWfAKYVDnob5s4GsG54mCBiuE0i2i5LomkmdbNAI9UUO mYrTSVGFMCcJ4Uk9/ZP5NRHkIjnno5pUFn9RsI+9PS0NLtQ+tQH7k1BbtRpwTCf/kus6 0Y1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=aXXG1eyX; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a17090aa41100b0023f000be67dsi17805565pjp.13.2023.04.26.03.09.11; Wed, 26 Apr 2023 03:09:26 -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=@sberdevices.ru header.s=mail header.b=aXXG1eyX; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239809AbjDZJ61 (ORCPT + 99 others); Wed, 26 Apr 2023 05:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239687AbjDZJ6T (ORCPT ); Wed, 26 Apr 2023 05:58:19 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F4069195; Wed, 26 Apr 2023 02:58:15 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 16EF45FD77; Wed, 26 Apr 2023 12:58:14 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1682503094; bh=qcIGKcZIb5cUrNAdB7ZZAIiITgzMPRGFSQuzjV413Y4=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=aXXG1eyXPb7xQslBoCKpWpcqLUhB7w34c0+MiM4G8tldrPyl4gCqvAZpDm2u/SStV AIMPGuUxoppYnDGspWFuL/mS2AKP+2x3vx4Khi56TwaSqaz/nng+0g79SGr6tfEdk7 FTXPXoDqegZQqH77EjVyA9gU7H6itme18oKjV3EHByRDbmIFBR9RurT0TXKJSNcJHT 1lODbFBDLU2eiRyZZfJvAWAZt8FKP7CY/iqgTtkXnnMLPrr415L9hoS2FyMYsN9rSJ BbDg7OuqFKUbJh3Mo0gWeA/LzwF/3NQQ0rxWO+8R3EEN+CHP88yQNJVOSxUJqb6HBN gdePMcXUgPzXQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Wed, 26 Apr 2023 12:58:14 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , CC: , , , , , , , , Dmitry Rokosov Subject: [PATCH v14 1/6] clk: meson: make pll rst bit as optional Date: Wed, 26 Apr 2023 12:58:00 +0300 Message-ID: <20230426095805.15338-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230426095805.15338-1-ddrokosov@sberdevices.ru> References: <20230426095805.15338-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/04/26 04:45:00 #21166225 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1764233069175770505?= X-GMAIL-MSGID: =?utf-8?q?1764233069175770505?= Compared with the previous SoCs, self-adaption current module is newly added for A1, and there is no reset parameter except the fixed pll. Since we use clk-pll generic driver for A1 pll implementation, rst bit should be optional to support new behavior. Signed-off-by: Jian Hu Acked-by: Martin Blumenstingl Signed-off-by: Dmitry Rokosov --- drivers/clk/meson/clk-pll.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index afefeba6e458..314ca945a4d0 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -295,10 +295,14 @@ static int meson_clk_pll_init(struct clk_hw *hw) struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); if (pll->init_count) { - meson_parm_write(clk->map, &pll->rst, 1); + if (MESON_PARM_APPLICABLE(&pll->rst)) + meson_parm_write(clk->map, &pll->rst, 1); + regmap_multi_reg_write(clk->map, pll->init_regs, pll->init_count); - meson_parm_write(clk->map, &pll->rst, 0); + + if (MESON_PARM_APPLICABLE(&pll->rst)) + meson_parm_write(clk->map, &pll->rst, 0); } return 0; @@ -309,8 +313,11 @@ static int meson_clk_pll_is_enabled(struct clk_hw *hw) struct clk_regmap *clk = to_clk_regmap(hw); struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); - if (meson_parm_read(clk->map, &pll->rst) || - !meson_parm_read(clk->map, &pll->en) || + if (MESON_PARM_APPLICABLE(&pll->rst) && + meson_parm_read(clk->map, &pll->rst)) + return 0; + + if (!meson_parm_read(clk->map, &pll->en) || !meson_parm_read(clk->map, &pll->l)) return 0; @@ -341,13 +348,15 @@ static int meson_clk_pll_enable(struct clk_hw *hw) return 0; /* Make sure the pll is in reset */ - meson_parm_write(clk->map, &pll->rst, 1); + if (MESON_PARM_APPLICABLE(&pll->rst)) + meson_parm_write(clk->map, &pll->rst, 1); /* Enable the pll */ meson_parm_write(clk->map, &pll->en, 1); /* Take the pll out reset */ - meson_parm_write(clk->map, &pll->rst, 0); + if (MESON_PARM_APPLICABLE(&pll->rst)) + meson_parm_write(clk->map, &pll->rst, 0); if (meson_clk_pll_wait_lock(hw)) return -EIO; @@ -361,7 +370,8 @@ static void meson_clk_pll_disable(struct clk_hw *hw) struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); /* Put the pll is in reset */ - meson_parm_write(clk->map, &pll->rst, 1); + if (MESON_PARM_APPLICABLE(&pll->rst)) + meson_parm_write(clk->map, &pll->rst, 1); /* Disable the pll */ meson_parm_write(clk->map, &pll->en, 0);