Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1632869pxb; Wed, 9 Feb 2022 00:40:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJynwxujXtQEs+BhRevHTAwdyc5o72Xk75iSrVDkigtDqTggw4u7JOaJoOK1qmxIv4H7vhpq X-Received: by 2002:a62:2581:: with SMTP id l123mr1100456pfl.71.1644396003580; Wed, 09 Feb 2022 00:40:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644396003; cv=none; d=google.com; s=arc-20160816; b=Msw4cSDP7DdzuteUwPXjUVtGR7hmG81d7rCNBNN6B+PytpaC48j/uatKMt0hOpRFX7 5L4K2c1aJe3Yf2cKrRWihZJ5I74+h19NjNWqZ1yXBnqV8fzKgnhtBLKGUsyiYFbZ+7hN d5VebxM2ndXY8R2IZ+o9IicmC4gNeqyYC47ZzJE1wP2X5h3kwYRQPzFVLNQbQAT4eBxP K8W89EjTUe75pmF8qj0l+m6STVhPtFsbGsL65hig8DQKOPU6DYZKEIPbGaDq9BsUeKs1 fm04FcaWnM3a2KsHXacqpnUWVDL58iQXkTKTVqnTli/XeKZuVuUcnjXzBidLEOAJH+CD CHWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/R2LriswMiHtMayk3cQe3ZgDGVpDn6vfPdguZ1VAL8c=; b=V4WMAlmiL3krnmzG22jeFjR/VIfHwcT1MAeQUgAZMLLwW4JnmvRem5cgl2M4Pgh8eW 2r6nM0Ey5i7rvtDl0dPmQ32Wm6tA7ruyZ5J954DEaIbnHUsLAMWzb0pNV64vUdExZaCP gt5d3N0MwZghQHxwnHYMWXxkSCyJ1Pc5Jt4MDwxOp/rb+CA7Q6vA/sbH8atZ4BLZm/Y2 jH8bak74HS2zmtcCMv+tSrwawNUJDwRbtR1zBDSGF5ZSYrAPGMz5IsM1rKps2a2qCEpK fvvqlj0E+xMOXns1/XZK5nI9YW10ZpFtusPZHfQ1u2cBwgTP2LEWf/fym3W9z618Llfc ykDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Z4htK1Pv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w19si17881284pfu.4.2022.02.09.00.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 00:40:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Z4htK1Pv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A45A1C03BFE7; Wed, 9 Feb 2022 00:38:52 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345008AbiBIDNq (ORCPT + 99 others); Tue, 8 Feb 2022 22:13:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343995AbiBIDNQ (ORCPT ); Tue, 8 Feb 2022 22:13:16 -0500 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D76DC061355 for ; Tue, 8 Feb 2022 19:13:15 -0800 (PST) Received: by mail-yb1-xb30.google.com with SMTP id g14so2206654ybs.8 for ; Tue, 08 Feb 2022 19:13:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/R2LriswMiHtMayk3cQe3ZgDGVpDn6vfPdguZ1VAL8c=; b=Z4htK1PvPjLN2hbBeC6YYrji+agQMuMV5YG42X2kwEw2dpzm0JxFKo8hsFa2C1Jfx6 aiqSpFNGQmDBS2DDI+xB/nArXQTRf8UlOzrFaZGH+fyy6IVPwIXsISWvJMcGQ6vwcd4N brBY26HkIFXOwhYOm+A2RznepAOysyGRvyKdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/R2LriswMiHtMayk3cQe3ZgDGVpDn6vfPdguZ1VAL8c=; b=wcwMcInRSsdfSwe8AgoovRbUP+6h9HXoiYUF9Og2Q1ikTSo3iAMSNjejDGpEHYU+N2 Mp/77KMoOO8k8T5hde7fnjTvBUXX46skUg6MGV578W/4O6FL42HNdvKnFI2uemD3GEe5 363Qpx+pU01yAV1CJiHh+JdfLfMVF2LAKNiQQD3tYImUKd2/lflEwwPjAnhVxj7rx3KS ap4uXSVOo8cnOYHWmmUGagIv6nCGEJxp2buc2GAlh9w8qrdwB7Qy98WmVM0Qd6qyzkFW H9Tp4dWeaX+nFU7ePROPL063MxzMluj8LXsO1dFf/QrNQMrvEfn7ez7jJQiGJVwBCZzp SwEg== X-Gm-Message-State: AOAM530gk60iDru8Fcs5EHUtnuk5ETCF0erIgvthnltRBksrKd6wdWaU 6hUUs7YfUm75nIwX3bMBF6zSA3TtA1m5hFqDOM2Lsg== X-Received: by 2002:a25:5382:: with SMTP id h124mr384351ybb.291.1644376394583; Tue, 08 Feb 2022 19:13:14 -0800 (PST) MIME-Version: 1.0 References: <20220208124034.414635-1-wenst@chromium.org> <20220208223252.7f179c63@pc> In-Reply-To: <20220208223252.7f179c63@pc> From: Chen-Yu Tsai Date: Wed, 9 Feb 2022 11:13:03 +0800 Message-ID: Subject: Re: [PATCH v3 00/31] clk: mediatek: Cleanups and Improvements - Part 1 To: Boris Lysov Cc: Stephen Boyd , Michael Turquette , Matthias Brugger , Chun-Jie Chen , AngeloGioacchino Del Regno , Miles Chen , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi, On Wed, Feb 9, 2022 at 3:32 AM Boris Lysov wrote: > > Hi, I couldn't find a particular patch to reply to so I'm replying cover > letter to give some input on the PLL subsystem. > > On Tue, 8 Feb 2022 20:40:03 +0800 > Chen-Yu Tsai wrote: > > drivers/clk/mediatek/clk-pll.c | 100 +++++- > > drivers/clk/mediatek/clk-pll.h | 57 ++++ > > In clk-pll.c there is an mtk_clk_register_pll function which at some point > executes this: > > > init.ops = &mtk_pll_ops; > > In my opinion there should be a possibility to define a custom mtk_pll_ops for a > given SoC instead of using a hardcoded one because not all Mediatek SoCs share > the same PLL startup/powerdown flow. For example, the existing mtk_pll_prepare > implementation won't work for the entire Mediatek Cortex-A9 SoC family (this > includes but not limited to mt6515, mt6517, mt6575, and mt6577). Ack. My scope is limited to SoCs used in Chromebooks. However Miles and Chun-Jie, who are Cc-ed on the series, should know more. That said, we can implement support for these varying parameters as we see them, not before. > > static int mtk_pll_prepare(struct clk_hw *hw) > > { > > struct mtk_clk_pll *pll = to_mtk_clk_pll(hw); > > u32 r; > > u32 div_en_mask; > > > > r = readl(pll->pwr_addr) | CON0_PWR_ON; > > writel(r, pll->pwr_addr); > > This code sets a bit to 1 to start a PLL but the SoCs I mentioned above would > need to have that bit cleared (set to 0) [1] [2]. > > Another interesting thing in mtk_pll_prepare is > > udelay(20); > Is 20 ms a settle time for PLL? If yes then it would also be cool to specify an > arbitrary value easily as some PLLs have longer settle time [3] [4]. This is a question for whomever upstreamed the driver. > Worth noting the SoCs I mentioned aren't in mainline yet, and I think there are > more modern mainline-worthy Mediatek SoCs that might also need these changes in > the future. Again, we can implement varying parameters as they appear. Thanks ChenYu > > Thanks. > > [1] MT6577 HSPA Smartphone Application Processor Datasheet, pages 1212-1227 > (*_CON0 registers). > [2] MT6515 GSM/EDGE Smartphone Application Processor Datasheet, pages > 1202-1216 (*_CON0 registers). > [3] pages 1303-1306 of [1] > [4] MT6589 HSPA+ Smartphone Application Processor Datasheet, page 1344 > (MDPLL1 & MDPLL2)