Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7326340rwd; Tue, 6 Jun 2023 09:09:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41X4rEoCV3vtZL4MM1WfkWyA8FNXQXjoX5RMDF69NgjoQbN5XNfDVJ2ssoJoDIUQlDJbjK X-Received: by 2002:a05:620a:2785:b0:75e:2a27:253e with SMTP id g5-20020a05620a278500b0075e2a27253emr181661qkp.38.1686067790590; Tue, 06 Jun 2023 09:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686067790; cv=none; d=google.com; s=arc-20160816; b=lzA+8vGKB/bmEEh1kbxJSYF0ZqC18VTXkfZ8dWChrqm7FRGGCkImdAvNRw9i8bShg/ PQik/FQ2x7svhbQX8SvWNNA0OpViCKA6vtX06yXAqYD/irIc9QRmM8p1nad3PvUSbAn3 6daK0UsYinb1bn4QOU1BpX1j6Yt90GUT68y5d+xb9sI22gUfARy+1/fafqmui7+mhKOO OGaHZAiyzqtMWG0L3hqh45WigbbcYk1VnQ8cPyyWsMzCGinpfzxgWlNctyR34a68PV7a pJhnZgAQbkZskL2uQ5NQXTpKI/s/vd7D9qJ4gbRf4WlAB5DRdybUhfoVCzxCQwbI6tLd hXxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Fb53Ze/gEd5ZbtU+koYVHdOb5F9vo2dFU1Jt2wM1uWw=; b=MCn6VhByYdDee3UGPTw0JQVqxzQ+2NjnxJA2cHg92GSKx5TrHpos/sYryNvPx446zC MF4mZ9g4ysaoHwPWNwOex02yMvxtpnjhDnuOpw1G3klz5rzXDiO5TdaMMZqCgbCs1lsd UsKiubbnALg753yjjiFLy2sTfjezOoRq8HhksuW/sDPXl2VlNPTlwlOJZ+xY0Ytt5284 zUloJSGHA401Nt/uqi6/IlAnRqvTnat6RfFxyTyDsptKCGULL+4vMfNiUo4z9utN9n/U Q3zMFXJbfB9As7ZZWvzZdEPsWiA0V/X1art0DSzUZjwdy+2FMfgnDv1pwVA+YcScBjMd 2fqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=MThwGBXa; 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 a18-20020a05620a103200b0075ed1245589si823296qkk.377.2023.06.06.09.09.33; Tue, 06 Jun 2023 09:09:50 -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=MThwGBXa; 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 S233626AbjFFPiy (ORCPT + 99 others); Tue, 6 Jun 2023 11:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237973AbjFFPis (ORCPT ); Tue, 6 Jun 2023 11:38:48 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB5C10D1; Tue, 6 Jun 2023 08:38:45 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id BDE8C5FD4D; Tue, 6 Jun 2023 18:38:42 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1686065922; bh=Fb53Ze/gEd5ZbtU+koYVHdOb5F9vo2dFU1Jt2wM1uWw=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; b=MThwGBXaeuiX+mmzlXXmbP3fN5BFUU4DZdlCMp4zUXvUdSF1Zh0YziB8vhfBnq2pH T8E2ODyUTPswCDzybjRRHdShm8C1cV7n19u5E7XIJZgRYh/WRuTZdrgILoz2XbkEwI NZIUYccSXQlgy2m4hDR9QpjXv9MbMCEK+Ai7qvj0ZLeV6ro4rpwkXeV0+dNctBZTyJ 5rmPe66EuZwnbijpnKcP2F0H7bsRee1u063dDkIlsMpYIDw0kw3ROc+/t94kn5oZYy 4vHnQOR0kDba4jtX5kytMeKWbPbQM82p7L6BzGFjQ0sMMRMceO3JPdP1VtTUK6Kv+O FFV1P7YMgEnwQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 6 Jun 2023 18:38:41 +0300 (MSK) Date: Tue, 6 Jun 2023 18:38:41 +0300 From: Dmitry Rokosov To: Yu Tu CC: Jerome Brunet , , , , , , Rob Herring , Neil Armstrong , Kevin Hilman , Michael Turquette , Stephen Boyd , Krzysztof Kozlowski , Conor Dooley , Martin Blumenstingl , , Subject: Re: [PATCH V9 4/4] clk: meson: s4: add support for Amlogic S4 SoC peripheral clock controller Message-ID: <20230606153841.plf5uh6eyzpzsm2e@CAB-WSD-L081021> References: <20230517070215.28463-1-yu.tu@amlogic.com> <20230517070215.28463-5-yu.tu@amlogic.com> <1jwn0g39t2.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1jwn0g39t2.fsf@starbuckisacylon.baylibre.com> User-Agent: NeoMutt/20220415 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/06/06 11:10:00 #21443593 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 Hello Yu, On Tue, Jun 06, 2023 at 04:38:15PM +0200, Jerome Brunet wrote: > > On Wed 17 May 2023 at 15:02, Yu Tu wrote: > > > Add the peripherals clock controller driver in the s4 SoC family. > > > > Signed-off-by: Yu Tu > > --- > > drivers/clk/meson/Kconfig | 12 + > > drivers/clk/meson/Makefile | 1 + > > drivers/clk/meson/s4-peripherals.c | 3830 ++++++++++++++++++++++++++++ > > drivers/clk/meson/s4-peripherals.h | 217 ++ > > 4 files changed, 4060 insertions(+) > > create mode 100644 drivers/clk/meson/s4-peripherals.c > > create mode 100644 drivers/clk/meson/s4-peripherals.h > > > > diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig > > index a663c90a3f3b..a6eb9fa15c74 100644 > > --- a/drivers/clk/meson/Kconfig > > +++ b/drivers/clk/meson/Kconfig > > @@ -128,4 +128,16 @@ config COMMON_CLK_S4_PLL > > aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. > > Say Y if you want the board to work, because plls are the parent of most > > peripherals. > > + > > +config COMMON_CLK_S4 > > + tristate "S4 SoC Peripherals clock controllers support" > > + depends on ARM64 > > + default y > > + select COMMON_CLK_MESON_REGMAP > > + select COMMON_CLK_MESON_DUALDIV > > + select COMMON_CLK_MESON_VID_PLL_DIV > > + help > > + Support for the Peripherals clock controller on Amlogic S805X2 and S905Y4 > > + devices, aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. > > + Say Y if you want peripherals to work. > > endmenu [...] > > +static struct clk_regmap s4_rtc_32k_by_oscin = { > > + .data = &(struct clk_regmap_gate_data){ > > + .offset = CLKCTRL_RTC_BY_OSCIN_CTRL0, > > + .bit_idx = 30, > > + }, > > + .hw.init = &(struct clk_init_data) { > > + .name = "rtc_32k_by_oscin", > > + .ops = &clk_regmap_gate_ops, > > + .parent_hws = (const struct clk_hw *[]) { > > + &s4_rtc_32k_by_oscin_sel.hw > > + }, > > + .num_parents = 1, > > + .flags = CLK_SET_RATE_PARENT, > > + }, > > +}; > > + > > +/* > > + * This RTC clock can be supplied by an external 32KHz crystal oscillator. > > + * If it is used, it should be documented in using fw_name and documented in the > > + * Bindings. Not currently in use on this board. > > + */ > > This is confusing and not really helpful > What you describe here is simply the purpose of fw_name ... so it does > not warrant a specific comment > > > +static const struct clk_parent_data rtc_clk_sel_parent_data[] = { > > + { .hw = &s4_rtc_32k_by_oscin.hw }, > > + { .hw = &s4_rtc_32k_by_oscin_div.hw }, > > + { .fw_name = "ext_32k", } > > +}; > > + > > +/* > > + * All clocks that can be inherited from a more accurate RTC clock are marked > > + * with the CLK_SET_RATE_NO_REPARENT flag. This is because in certain > > + * situations, we may need to freeze their parent. The parent setup of these > > + * clocks should be located on the device tree side. > > + */ > > It looks like the consensus is that CLK_SET_RATE_NO_REPARENT is not > required. Please have at look at the discussion between Dmitry and > Martin for the a1 controller > I hope below links will be helpful for you: CLK_SET_RATE_NO_REPARENT IRC discussion: https://libera.irclog.whitequark.org/linux-amlogic/2023-05-18 Clock driver LKML discussion about CLK_SET_RATE_NO_REPARENT: https://lore.kernel.org/all/20230530120640.irugyrio3qa7czjy@CAB-WSD-L081021/ https://lore.kernel.org/all/20230524092750.ldm362chnpkwkcj4@CAB-WSD-L081021/ PWM discussion about special RTC case: https://lore.kernel.org/all/20230522133739.7tc35zr2npsysopd@CAB-WSD-L081021/ And I apologize for any confusion I may have caused in our previous discussion. I want to clarify that I have updated the implementation of CLK_SET_RATE_NO_REPARENT after discussing it with Martin... [...] -- Thank you, Dmitry