From patchwork Wed Apr 5 19:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 79897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp558378vqo; Wed, 5 Apr 2023 13:02:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YJ5z4sjvR1ZUpWB++Gsd36t9dNee9vadMgobVx5rHLl6Z+Zj+YVg4UAduvz3UcQW8oXYSK X-Received: by 2002:a05:6a20:1303:b0:d9:8d85:eb42 with SMTP id g3-20020a056a20130300b000d98d85eb42mr386074pzh.26.1680724974284; Wed, 05 Apr 2023 13:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724974; cv=none; d=google.com; s=arc-20160816; b=jJ5tlOMZhVM0iuLSQTFjqftvKvlkPL8QReS/Fp+jvc6+LXYTvRKVvZr86jAwyppTOR KFpNp19DSiHlUS4GKvSHanz9eOkiRnb6VcDCFgbNkbQcx01YCpfaJPG1d+124Ed8tLBU vnVLJDbUSt6ICQVD8ordDd+GGnHr3mfadvmw9/BvXw95puMpoPpmukWIqwHD1Sa5JVSm 6k71mM04M7UKFd76z7EWUbDMf/dNmrjrQMYjCv8ilSYNyP4fYjjY/O64HDlU6ZJr4D98 ECSIHmFdm1o0jwqvGUJAdwEXckgd5BHBMcIXgKXhve8gXcP1YUPg0Q2ABxv2j8BoN5w4 maug== 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=KTFlkQl5Cg2M5MIYLwVBhgjFzu1ymDdXkJoZJnRjWTOsN31k+v7xTqxY4mmr2SI5S3 FEVD79tJK7ezSTjf/gRt1r37boyxbIAJwaA3c6uV8kO1szPOhEA8ymSMwWDevsKQettD fbrh0+wV+mlxokCmHGPaewbNmm4qN+NU1+7ze+Oe6MWnGZidk39CX8zG/tpdHBC5hgZr BUTo6DeZsg1VGAdtH/mIW1p9N0YcI2PxUvWK3cKeQxUOWpg08OkvDKuUCwNNTX9kBj6N aXrUZQiwHVwghB6YnSMljjUyL0hC6MDBa5CiXhg5b8f6ew3THOKLaNrK3+0Qu1NAVv33 plpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=cT283VFl; 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 j63-20020a638042000000b00513234112b9si12562604pgd.901.2023.04.05.13.02.40; Wed, 05 Apr 2023 13:02:54 -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=cT283VFl; 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 S233739AbjDET7z (ORCPT + 99 others); Wed, 5 Apr 2023 15:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbjDET7o (ORCPT ); Wed, 5 Apr 2023 15:59:44 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF5CE4209; Wed, 5 Apr 2023 12:59:41 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 2AC495FD4B; Wed, 5 Apr 2023 22:59:40 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680724780; bh=qcIGKcZIb5cUrNAdB7ZZAIiITgzMPRGFSQuzjV413Y4=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cT283VFl7u9lLs3v6B0wcz3HHrxijJE+CgTYyK8R/2YQS6E8P39dLFUZBpxx4fGE5 uyfmHkerJCChpfdHoB9+vq43ugg3EWpRWQVD4xHS8NPK/egJXnKShpMVLVypWqazF8 gkKCPsXL6g0OKuJgQBN5u+T/nIJmwK0NmDYbBW2ojzhsxoYP5iTMONw/tVzLwrJ5Z8 78aW/AtBUtyeNIMyywZaep4G6ntHa+Si3ISBkQgI510UopsIAXaAXUskIHAjL4D50M KVQ/jf0u5WbYtXle4ZVJxQo/au9u9dxLKKC/JYSVlKzIxJVwa8g6LC6DWyJ6zuYN/f CXtzECbyCeAow== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Wed, 5 Apr 2023 22:59:40 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , CC: , , , , , , , , Dmitry Rokosov Subject: [PATCH v13 1/6] clk: meson: make pll rst bit as optional Date: Wed, 5 Apr 2023 22:59:22 +0300 Message-ID: <20230405195927.13487-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230405195927.13487-1-ddrokosov@sberdevices.ru> References: <20230405195927.13487-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/04/05 16:44:00 #21035356 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762367870731623732?= X-GMAIL-MSGID: =?utf-8?q?1762367870731623732?= 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);