Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2180569rwd; Wed, 17 May 2023 06:54:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6u0//kiMJMFOuDFUFCcxaTa0boCxlQSMg3llkpnqx9wPpfRhs261OzKz+nWW+kSPJa6+6t X-Received: by 2002:a17:90a:d908:b0:253:44e7:9446 with SMTP id c8-20020a17090ad90800b0025344e79446mr2237551pjv.8.1684331644183; Wed, 17 May 2023 06:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684331644; cv=none; d=google.com; s=arc-20160816; b=gBuMI1CfxtAVeb6zop+vU3uDye1UVMtpWhbEVgmux0hBG16iQKLHYaijLXiFB7NR3o WTHc90FO0ry6ZPhN2mUHf66lRI47IZd859o3lL2Gaw7iwv2m3/PygcCIJefP5jroklG1 3C3kCadFNmiLbAsy4BJkGA/lS1XgsqtbFGflu5EqcObPSFZBn/Y/9n60HziEfqeijKlk ECTPqCIB6uqegsT9VnPetz6NANxW28yOmQsxEGc4wGwR2FGlM+VhQBwyLB0c+y2fneHv RYjbCbXnavnymtim3Tv9BE3PX9FhVFOlo7aW23VlJQGD6rguSIbOEfbAGd4Ye7Qdx3kh COvA== 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=0fQOq9uy+e4Hiahn1ypgnMheTIyU2eH20MJMywiAIGC8LG12KGDocq0wYgryKC0k5z WkMAx1v+ihfKR73EyWivHtFyB5c/2JgHptps9P1j0tIYG9Mxlhaoihxhv7qhbF4ueiy3 /mt4oq2o3L0BFiTqVoU4Vs/hyRanbmO5bJQRfpMpYyx7/Wo02CgH/wF7Pi9EYJyETmy/ CH8tb03FJnuqQ1zA+DdJ3JNY8ww3x9Std3AR3Tboe7eiNeN/Z3jBa6p1GgmFU5XWLo/3 dDoH55p1w6Ji+vHy4WVc2FcB41w18QiFCKOFMvX5iPQ36BZ2mMZqP8HF2nhjpXrra06X oZ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=To0UAMRR; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020a63ab08000000b0053439ea59fdsi4377286pgf.19.2023.05.17.06.53.51; Wed, 17 May 2023 06:54:04 -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=To0UAMRR; 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 S231929AbjEQNd3 (ORCPT + 99 others); Wed, 17 May 2023 09:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjEQNdX (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 4270135B1; Wed, 17 May 2023 06:33:21 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 91C985FD41; Wed, 17 May 2023 16:33:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1684330399; bh=QACcL2z5H0WiVPZBqWtG1qVoEZA/+FwC6rxiZKbXGhQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=To0UAMRRCsiOa8mJt5lOncXyFFFzVAvZviJhaP/4gz0jRfmzC5LoL+VpQ71VHDBZt m5/rAYPTvjA3NjfyPeLK1HB4wGNx0mT9pCg+DxfdTd2zWsDMKD03BAv5+8U1Mm9jxo ctpmYKApMqYeV5jmIAvtg5PYEaWxiTKYqbAO6UpoiXP6Kmy3Kun8wfLfRzfdtdIxFp DU2Mg2quaumgRXsIa59m35zjzCZvYak3v9y4u7hV2xJ1/j2wu1G2B+5VtRdFPzQeUT iPRiwfhS2l4GynCItIVzfDho52V7Pkr5zEpMAVmo0xVoaSJeg1uaGEFUHRFxwzKqp8 ppRA4ZVkOBysA== 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:19 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , CC: , , , , , , , , Dmitry Rokosov Subject: [PATCH v15 2/6] clk: meson: introduce new pll power-on sequence for A1 SoC family Date: Wed, 17 May 2023 16:33:05 +0300 Message-ID: <20230517133309.9874-3-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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; -- 2.36.0