From patchwork Mon Mar 13 20:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 69098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1387273wrd; Mon, 13 Mar 2023 13:19:27 -0700 (PDT) X-Google-Smtp-Source: AK7set9R2MOmPvyYub3v2UCuTI4T6c03CX7YIHnD0xi9ATataaE/AApJsGUHqrtB3BbMbaTOMV5E X-Received: by 2002:a17:902:f693:b0:19d:e11:32de with SMTP id l19-20020a170902f69300b0019d0e1132demr43959893plg.34.1678738767468; Mon, 13 Mar 2023 13:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678738767; cv=none; d=google.com; s=arc-20160816; b=PSxhTVKjpGhNrpj7JVyggWoiVSoLjaFbhvqchVTaiteKuHZrKkMyrX1sPYK13swKGe RwO4qK6b9NUObTk5R+vqJXls2REEHemtAlaXmOaKuOmU+xNEya846RgIuJE2ZIOFqO9b KVIz6BRGAyrOrcbu3J+q7v9z5LZIJ6VQlv/lXy4GCsG0ewq7SyzJmpHv1yef0ip0/X1O XVMAUhKNo41MZcWl/2A7sRCUFSXP+irZxOTFwox/pWxUKKCIOeEFXvWdBYRjk1tzhZLk +G/xlOFooUJA8r2Mbpinkjg5OUS5e3/NOM3vRfyXUnDL7VUvXMVUYUKCn7v+SNRKPt6E a+dA== 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=ftwQv4+crpR7S8VLWuFFKdAx8ImC7+hnQbwwuDtbTa3OHmJu1Yuhq0rP4xpRrruLtw mXfv7+bNykVg//OSo0zFG72LG4E8BcHuPDnkAsf/coydmPWSgPMLmpKxa9Yp6g9HO1SD M/ISXSAR96dvLNGJC3az04WFUtmDStAz29sLqVVuqUPgXUkfk+wfYwL/uCYkYdBIvNLL P8URycMJv+qLDMajNnpCYEIgndTrjWqBlKOwbWgYI5OcIT+P20og3Lj573oQGTajaWnJ yjN8ybzwvTjHs8EIK5IGe50MSkaEtk3TBvKZb33VRrDGI15Eyhzfao4yG5If/q8rd3bR 7q4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=aDFbwqf4; 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 kv11-20020a17090328cb00b0019cce1df447si571869plb.5.2023.03.13.13.19.14; Mon, 13 Mar 2023 13:19:27 -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=aDFbwqf4; 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 S230047AbjCMUOW (ORCPT + 99 others); Mon, 13 Mar 2023 16:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbjCMUOT (ORCPT ); Mon, 13 Mar 2023 16:14:19 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E030E24121; Mon, 13 Mar 2023 13:13:50 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 196FE5FD14; Mon, 13 Mar 2023 23:13:12 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1678738392; bh=qcIGKcZIb5cUrNAdB7ZZAIiITgzMPRGFSQuzjV413Y4=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=aDFbwqf4suEffITUw430m/mQvA2yrKtAOcnjLqfIOgG4dgR4u1WIT14QGp6n0Tqa2 3HIcw4VMFOxXUpGeJKv7knpm5JNRXR1uQNUmAf0wHtMu7jdKhDA7VSkNtHWK/RmAgK sNjemi/8ANEm9vPFgYb6E1oorrPdxCFTEhBRjYXEtDNxOLVobDudcHOgJTpIwkLZtR JubmIYBH2BONfdId1JIc/Zz9vxw0NHcXKgz3U95u2w4mm0hiirQwvHYipmZpW8ZEpe V7rmppVzA20MGBdC3wJK0FWlTiIeZliC3SG+rtzbnspkugR91oeoQDE8b7Db9PQWVL 24mMf7WO1xIzg== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Mon, 13 Mar 2023 23:13:12 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , CC: , , , , , , , , Dmitry Rokosov Subject: [PATCH v10 1/5] clk: meson: make pll rst bit as optional Date: Mon, 13 Mar 2023 23:12:55 +0300 Message-ID: <20230313201259.19998-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230313201259.19998-1-ddrokosov@sberdevices.ru> References: <20230313201259.19998-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) 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/03/13 10:14:00 #20942017 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_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?1760285181740044198?= X-GMAIL-MSGID: =?utf-8?q?1760285181740044198?= 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);