From patchwork Wed May 17 13:33:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 95264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1149534vqo; Wed, 17 May 2023 06:48:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7S6Odc5WrxZSgVdtwJI4xVcENt9d/VHK6abkBK31GMJX/+b3bpP5dlnAgpHMexNN/oVHTL X-Received: by 2002:a17:902:e543:b0:1ac:8062:4f31 with SMTP id n3-20020a170902e54300b001ac80624f31mr46740880plf.37.1684331316898; Wed, 17 May 2023 06:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684331316; cv=none; d=google.com; s=arc-20160816; b=agnUYQcShJCNYPQ+Xv7f8ZROOwt7+wvHxP/Q+y/3PvxuO+OP8eFrFI9I1fvMckax4L 8SsG14UQkgHzKVIq9rxzSesP0RpQ4I1ndJbwOzmnFKlWfHBF3OKkP8xlkBM0y6DdYZpZ ixkJmzwRcz4Wpd9snCcHesZzLYee5kpyTxyG82okU/vlYwRkZ/ItCWbit02nuN8EdgZB X9J5WLc/FRrTwN8+NoDc+jJ5mfXk2fi+HThyYuPIP6m3ZBLwcwuf7qIa+wc+Jky06ypV kYi8BB1FBmlOlcmgk+mrtBLGncv2w7Fd0EIE5V1SXq/wciCooee3R1WLkB36hSNORORx 3O8Q== 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=OiRydcYMHrkSEGza3woW8d7FEXh0NWW+gkDF8JOLf+1TyDdVHovV3XhAZQCz+tA14d QwqmAtTKGx29q4AsBqKg+3m/s86Wg7vYB0gmfrfDPNdWSdnrtdERGBKQHMW/o7xM4G7+ 82BSfSgWg9isO6NSnO/Ookk/+Tg8NkwBhEnA6wXJ9FFd6N/micKSfhRLeEUcrFmqobr6 DNbCFx2C6ZMPyNDFTtiUJwQVSn7ryjLBRFzJR5JJi7LN+WDU3WcQEQRfLyCqyhjiCgJ3 YUKl08WcpYpMtDMbclk9irDWib+jjkI37MA+zH6ymQRiz1X8WlRtb06Dy6gJC5fj36Kq Mz5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=kOxUmry0; 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 br15-20020a17090b0f0f00b0024715c041c3si1782006pjb.137.2023.05.17.06.48.20; Wed, 17 May 2023 06:48:36 -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=kOxUmry0; 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 S231875AbjEQNdZ (ORCPT + 99 others); Wed, 17 May 2023 09:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbjEQNdX (ORCPT ); Wed, 17 May 2023 09:33:23 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C8941BE3; Wed, 17 May 2023 06:33:20 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 7CB745FD0E; Wed, 17 May 2023 16:33:18 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1684330398; bh=qcIGKcZIb5cUrNAdB7ZZAIiITgzMPRGFSQuzjV413Y4=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=kOxUmry0bB0U7YsNs+U2p6wYwYVFyN9q9QDGGaQp5k8XZYdqjRdUH+itPl97KarPg Nzz+eBrYa1XjWDN6jKKtcyG92/yrbBb22q66XyIU8WNnyR32M5LrsBRQxdgjojnzCb NFWoOaCp++jy+KQmyKBPcNZp7k2FBkfEp4dQG7v9xezXLdGroN51NntZ46qZX9B22Q 2YRXs7qyE7Vraj6uetHRtPI/7RQXjGMtS3UETTNMPfx4CZL9aS4FUMwk6yWql9kS0z LKeYtpNQzdGo4MEMWOftgmQg2BFw/TVIpryeGDMFeVHKooXwN7OHWkSJTbQ12jNTWK APQKKOc5W57zA== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Wed, 17 May 2023 16:33:18 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , CC: , , , , , , , , Dmitry Rokosov Subject: [PATCH v15 1/6] clk: meson: make pll rst bit as optional Date: Wed, 17 May 2023 16:33:04 +0300 Message-ID: <20230517133309.9874-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230517133309.9874-1-ddrokosov@sberdevices.ru> References: <20230517133309.9874-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/05/17 11:04:00 #21328336 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?1766149395066342853?= X-GMAIL-MSGID: =?utf-8?q?1766149395066342853?= 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);