From patchwork Wed Apr 26 09:58:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 87786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp128812vqo; Wed, 26 Apr 2023 03:08:53 -0700 (PDT) X-Google-Smtp-Source: AKy350YSx11mojyBXNIW6qRTqlMNefrAhVRkl6v04DQZ3vh+IhbhomJL0lGYwaHcjRbgkS01f6pH X-Received: by 2002:a17:902:f38b:b0:1a8:1b63:8aec with SMTP id f11-20020a170902f38b00b001a81b638aecmr17583161ple.25.1682503733034; Wed, 26 Apr 2023 03:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682503733; cv=none; d=google.com; s=arc-20160816; b=QEGpXJwgr4+UaeSxJPZQbhEkb+KlF+IAUo4Gm57ZzkB2fEabY9Afksq1fwESghYum/ jaq4HvPDWKwsDiJCwipHi/NCCIRgT0WZYtjwOzGD5Bi5hy9QK0+RTUSN3XRdV9G1t3Jb 8p5F9vfykI3eE8iHOiVY8i+0BlF/ezgoRpXlx4lQ+qvyyMVkOXXF+/A8GUoigfEwPpf8 aR4In4j19yjpFX7/wpleTBfmNBv6lTtjUngZ2GnUs3PGx4fwoiVHGL2DGJBgd39ejWR4 Weu7SsgGRipTZWkjxTY66U+QimUDlfNOyXJqdTplDhGpk2axBKC9bbscGDpjwuMBNeWz Vnjw== 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=QACcL2z5H0WiVPZBqWtG1qVoEZA/+FwC6rxiZKbXGhQ=; b=rq2h/HK4AxymGA3aUOXlx5bn8wK0SaQE3XjyFN0RJwuR4y4E41KViC77aNfg07+ArP P7B+d6248f4/zcEorGpMC5EYJ+7p1YZt+IJwoDkPZ7hBIbucRAPjk5fl4LFJIZbJKjqr wkAvuXwpnJNie6jwukQA73HsrS29Pi5rG7WXGDGyGG98bnS//nillaAlO4dXKIg6mbQG ebsGUarfb5mLwGp448wbBGOBRe7s6uqBpWDpnjh0Erh/zL3OjggMA21aK63gP0x7G+BG bXH40EoxU/V6wokcF+GVGIEmE4BOlqlyDjks7HP3rPHWfvra+mp3QU4MP28CyWHN2aJN jR5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=afsKYodG; 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 q15-20020a170902eb8f00b0019e272a22c7si10570813plg.53.2023.04.26.03.08.36; Wed, 26 Apr 2023 03:08:52 -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=afsKYodG; 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 S239794AbjDZJ6a (ORCPT + 99 others); Wed, 26 Apr 2023 05:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239819AbjDZJ6T (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 A202A30FC; Wed, 26 Apr 2023 02:58:16 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 097275FD78; Wed, 26 Apr 2023 12:58:15 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1682503095; bh=QACcL2z5H0WiVPZBqWtG1qVoEZA/+FwC6rxiZKbXGhQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=afsKYodGlReqNT+HwIdhJqyiEf0hhbYTqLg4GaeaDP4D8w73QuLRJUUNUfuOPL8dq Ql1DUlwS3a6pP9wBgVulfkSBy71KoTxloW97hV2cVlCyofm7QDIdPkAkAMu0LaFfOO qDRq3GlH9C6DmmSOVH1A4yYcW2ioGVbQwxH3xJJAd3pHf5m5Le5dR7/HyNZ07iiCY3 2rZwJbamzKe6v1cKbpwoBG/ZZ1X97QO+oi2YihWUjCRNSYFE7MdQ/BR4/qghcm7KDO w09bwlCYo0JNjsBGQylwLHrDEZWen86X4kef1JvOhTc4txFLgDaPLqLKAE6JHwzjKR llcAOMrYvH29Q== 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 2/6] clk: meson: introduce new pll power-on sequence for A1 SoC family Date: Wed, 26 Apr 2023 12:58:01 +0300 Message-ID: <20230426095805.15338-3-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?1764233034165798302?= X-GMAIL-MSGID: =?utf-8?q?1764233034165798302?= Modern meson PLL IPs are a little bit different from early known PLLs. The main difference is located in the init/enable/disable sequences; the rate logic is the same. In A1 PLL, the PLL enable sequence is different, so add new optional pll reg bits and use the new power-on sequence to enable the PLL: 1. enable the pll, delay for 10us 2. enable the pll self-adaption current module, delay for 40us 3. enable the lock detect module Signed-off-by: Jian Hu Acked-by: Martin Blumenstingl Signed-off-by: Dmitry Rokosov --- drivers/clk/meson/clk-pll.c | 23 +++++++++++++++++++++++ drivers/clk/meson/clk-pll.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 314ca945a4d0..56ec2210f1ad 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -358,6 +358,25 @@ static int meson_clk_pll_enable(struct clk_hw *hw) if (MESON_PARM_APPLICABLE(&pll->rst)) meson_parm_write(clk->map, &pll->rst, 0); + /* + * Compared with the previous SoCs, self-adaption current module + * is newly added for A1, keep the new power-on sequence to enable the + * PLL. The sequence is: + * 1. enable the pll, delay for 10us + * 2. enable the pll self-adaption current module, delay for 40us + * 3. enable the lock detect module + */ + if (MESON_PARM_APPLICABLE(&pll->current_en)) { + usleep_range(10, 20); + meson_parm_write(clk->map, &pll->current_en, 1); + usleep_range(40, 50); + }; + + if (MESON_PARM_APPLICABLE(&pll->l_detect)) { + meson_parm_write(clk->map, &pll->l_detect, 1); + meson_parm_write(clk->map, &pll->l_detect, 0); + } + if (meson_clk_pll_wait_lock(hw)) return -EIO; @@ -375,6 +394,10 @@ static void meson_clk_pll_disable(struct clk_hw *hw) /* Disable the pll */ meson_parm_write(clk->map, &pll->en, 0); + + /* Disable PLL internal self-adaption current module */ + if (MESON_PARM_APPLICABLE(&pll->current_en)) + meson_parm_write(clk->map, &pll->current_en, 0); } static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, diff --git a/drivers/clk/meson/clk-pll.h b/drivers/clk/meson/clk-pll.h index 367efd0f6410..a2228c0fdce5 100644 --- a/drivers/clk/meson/clk-pll.h +++ b/drivers/clk/meson/clk-pll.h @@ -36,6 +36,8 @@ struct meson_clk_pll_data { struct parm frac; struct parm l; struct parm rst; + struct parm current_en; + struct parm l_detect; const struct reg_sequence *init_regs; unsigned int init_count; const struct pll_params_table *table;