Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp839128rwl; Fri, 24 Mar 2023 02:43:21 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=vG6iC67r X-Google-Smtp-Source: AKy350YeMf4iJixh9gYaeazsHiBERDvcX/ISN5IMM0umyRhrr00XTVkxlQFaqbbMCks/rXVpHR/W X-Received: by 2002:a17:90a:8544:b0:23b:3672:3b53 with SMTP id a4-20020a17090a854400b0023b36723b53mr2069675pjw.39.1679651000916; Fri, 24 Mar 2023 02:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679651000; cv=none; d=google.com; s=arc-20160816; b=FJA5jnGqIQ2i6V45mpaubWe2Axi/9tks0rIY/qZPT4irZtPUAS4NEnmJyoZSLeznqI 5gicsLoFQ3DBxrmdCRpyk37xqp5sGjKn1PhrI4zw84RpsCgTxtDDoctBgNfw5G3ZUqyX dkM3w1umyEIdR9W1mS+rizUDKA6YBIT1hc+H02cfuU8cthUyjnx/8BSILbnOgglI5SW8 sRQnOtaqGhTMVA2CTb6CJ8rX459H7VkWYJ/bjb8oz2ZZ4vI/CQ4wHl63KdcrBD/1OtIK QzdYueuCDC2jTNpThWbNDu/Ak9ShR8s+0ysLM5UvElSsXUjjGUCsEb7JyF0inU/n5UbF iX4w== 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=x1u3QRP74rxw2nee5OeJkGqMtHejmjh8sNTSy7NjgGo=; b=Cb0X045btw0lW5+rZiD63CIInjr3ucrXxq6eXG1WAKgGnOmd+3WaHlFydtfpI7N5ah d2elcCtMj3yo5GdfVtokf8VkxWzezIzWdZCAn0jEnzVJLAb2VpoH30q/vCteavZmvbvN 92a43JE9mnQisl1GffFi65dzOg451FmEqyrj/D2lJ6bWeQRhVep2Z3UoP7JMrlatMXxC AoV3wyjUXt/wdGy9CAbSu+N1kYyxttMFncElqxQBKmW+GTmWDf+grjPe4nRGSuiJKQ0O 54diDufTKUxYtcmD+p1gyBqgpXzaharBXkyKLrTVeqhExKJ7uWlgPnvEeR7egie/fIoc XoMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=vG6iC67r; 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=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a17090a098b00b0023b340b6388si3894249pjo.97.2023.03.24.02.43.09; Fri, 24 Mar 2023 02:43:20 -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=@canonical.com header.s=20210705 header.b=vG6iC67r; 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=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231516AbjCXJlB (ORCPT + 99 others); Fri, 24 Mar 2023 05:41:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231954AbjCXJkd (ORCPT ); Fri, 24 Mar 2023 05:40:33 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54B5827493 for ; Fri, 24 Mar 2023 02:40:00 -0700 (PDT) Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id AC07444307 for ; Fri, 24 Mar 2023 09:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1679650793; bh=x1u3QRP74rxw2nee5OeJkGqMtHejmjh8sNTSy7NjgGo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=vG6iC67rXememkhEElEkDbNPHDyMLNnnoH/X6XNUdATsEKzjjSlrI8ljaTFL5ag4A dZL8p7lQz1oBl4Cxk86jJNWA5qehqZaoMkuE/yVBvKeov/ZdP/+yRzxmKI8rudYDZi qZcAqDoP6gpzfXKcg9OABw4dW9zicbCBA6/pwKkS2SqzopCjjjRStiWvOuLGU9JChE hDe4KztVIo/iqseA/290TG8xSdcoRa2DO7Pq3Rv0M0ZhuW/X55QNOxKzSvKXIZY4yk nGwoV/Mvkd/xTWVYf6/XBM7OHBwqsEKv7LpwJnM3bJ621Qss40TExNI4kcR4mZI2hM lBuQXrGhvtEDQ== Received: by mail-qt1-f199.google.com with SMTP id u22-20020a05622a011600b003dfd61e8594so709717qtw.15 for ; Fri, 24 Mar 2023 02:39:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679650792; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x1u3QRP74rxw2nee5OeJkGqMtHejmjh8sNTSy7NjgGo=; b=taeULWhilY+S1LY6SMabPYIXU8VgQzxBliKLPfpV2OeU9R6gLn1zNyWiP+fD8kWVPk Ue29WrCMdKMhiu7kuAXxkYa43ya4TUJL9vYeb0VK7uw2DWWKVsHGko/QWjAqnoF87fwi xDGVl6L+veepsWelo/jdbtbgI+9KOYU4QNSlwyHS6QJto/NdWhEEA9EYnDVZTIlaxL7S Eiz5EQU67n6X0HnlCkS5gUwGcuRDz69VKhvp+q1m+k9AN2K/+D5HkYty8/fOtdGSFluj GvACEHzLNkdXTV3MYkLfDb1jntorO+Zio7UlqnjviMtP1juDiJu2w1eITD80EYa1EIvw bHvA== X-Gm-Message-State: AO0yUKUB2k0tVVsR91y4Y35DoWFCu4yh6HKiSF1+uokfm6zVhhKVEJbr E8EwTE/ANmyZS+4tpXOHeVxezPhkg31vTMefiNb+LpYcdpWQLnl2YkKFhsEkbK1XYop2NONHqI7 RUvgM6A+o6r9zRZm11Hi1ZcMgUb1bKN0VKsNFy/2DVPmidmNhvfix2tlBNQ== X-Received: by 2002:a05:622a:451:b0:3bf:e265:9bf with SMTP id o17-20020a05622a045100b003bfe26509bfmr880588qtx.5.1679650792594; Fri, 24 Mar 2023 02:39:52 -0700 (PDT) X-Received: by 2002:a05:622a:451:b0:3bf:e265:9bf with SMTP id o17-20020a05622a045100b003bfe26509bfmr880578qtx.5.1679650792313; Fri, 24 Mar 2023 02:39:52 -0700 (PDT) MIME-Version: 1.0 References: <20230320103750.60295-1-hal.feng@starfivetech.com> <20230320103750.60295-12-hal.feng@starfivetech.com> <5b75161e-3d0d-50e5-fd4e-af92edf62317@starfivetech.com> <828e8cb9-a4c6-4c2d-8a23-2cfdc4395fe1@spud> In-Reply-To: <828e8cb9-a4c6-4c2d-8a23-2cfdc4395fe1@spud> From: Emil Renner Berthing Date: Fri, 24 Mar 2023 10:39:36 +0100 Message-ID: Subject: Re: [PATCH v6 11/21] dt-bindings: clock: Add StarFive JH7110 system clock and reset generator To: Conor Dooley Cc: Hal Feng , Conor Dooley , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Stephen Boyd , Michael Turquette , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Albert Ou , Ben Dooks , Daniel Lezcano , Thomas Gleixner , Marc Zyngier , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On Thu, 23 Mar 2023 at 10:02, Conor Dooley wrote: > > Hal, Emil, > > On Thu, Mar 23, 2023 at 03:44:41PM +0800, Hal Feng wrote: > > On Wed, 22 Mar 2023 21:53:37 +0000, Conor Dooley wrote: > > > On Mon, Mar 20, 2023 at 06:37:40PM +0800, Hal Feng wrote: > > >> From: Emil Renner Berthing > > >> > > >> Add bindings for the system clock and reset generator (SYSCRG) on the > > >> JH7110 RISC-V SoC by StarFive Ltd. > > >> > > >> Reviewed-by: Conor Dooley > > >> Reviewed-by: Rob Herring > > >> Signed-off-by: Emil Renner Berthing > > >> Signed-off-by: Hal Feng > > >> --- > > >> .../clock/starfive,jh7110-syscrg.yaml | 104 +++++++++ > > >> MAINTAINERS | 8 +- > > >> .../dt-bindings/clock/starfive,jh7110-crg.h | 203 ++++++++++++++++++ > > >> .../dt-bindings/reset/starfive,jh7110-crg.h | 142 ++++++++++++ > > >> 4 files changed, 454 insertions(+), 3 deletions(-) > > >> create mode 100644 Documentation/devicetree/bindings/clock/starfive,jh7110-syscrg.yaml > > >> create mode 100644 include/dt-bindings/clock/starfive,jh7110-crg.h > > >> create mode 100644 include/dt-bindings/reset/starfive,jh7110-crg.h > > >> > > >> diff --git a/Documentation/devicetree/bindings/clock/starfive,jh7110-syscrg.yaml b/Documentation/devicetree/bindings/clock/starfive,jh7110-syscrg.yaml > > >> new file mode 100644 > > >> index 000000000000..84373ae31644 > > >> --- /dev/null > > >> +++ b/Documentation/devicetree/bindings/clock/starfive,jh7110-syscrg.yaml > > >> @@ -0,0 +1,104 @@ > > >> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > > >> +%YAML 1.2 > > >> +--- > > >> +$id: http://devicetree.org/schemas/clock/starfive,jh7110-syscrg.yaml# > > >> +$schema: http://devicetree.org/meta-schemas/core.yaml# > > >> + > > >> +title: StarFive JH7110 System Clock and Reset Generator > > >> + > > >> +maintainers: > > >> + - Emil Renner Berthing > > >> + > > >> +properties: > > >> + compatible: > > >> + const: starfive,jh7110-syscrg > > >> + > > >> + reg: > > >> + maxItems: 1 > > >> + > > >> + clocks: > > >> + oneOf: > > >> + - items: > > >> + - description: Main Oscillator (24 MHz) > > >> + - description: GMAC1 RMII reference or GMAC1 RGMII RX > > >> + - description: External I2S TX bit clock > > >> + - description: External I2S TX left/right channel clock > > >> + - description: External I2S RX bit clock > > >> + - description: External I2S RX left/right channel clock > > >> + - description: External TDM clock > > >> + - description: External audio master clock > > >> + > > >> + - items: > > >> + - description: Main Oscillator (24 MHz) > > >> + - description: GMAC1 RMII reference > > >> + - description: GMAC1 RGMII RX > > >> + - description: External I2S TX bit clock > > >> + - description: External I2S TX left/right channel clock > > >> + - description: External I2S RX bit clock > > >> + - description: External I2S RX left/right channel clock > > >> + - description: External TDM clock > > >> + - description: External audio master clock > > >> + > > >> + clock-names: > > >> + oneOf: > > >> + - items: > > >> + - const: osc > > >> + - enum: > > >> + - gmac1_rmii_refin > > >> + - gmac1_rgmii_rxin > > >> + - const: i2stx_bclk_ext > > >> + - const: i2stx_lrck_ext > > >> + - const: i2srx_bclk_ext > > >> + - const: i2srx_lrck_ext > > >> + - const: tdm_ext > > >> + - const: mclk_ext > > >> + > > >> + - items: > > >> + - const: osc > > >> + - const: gmac1_rmii_refin > > >> + - const: gmac1_rgmii_rxin > > >> + - const: i2stx_bclk_ext > > >> + - const: i2stx_lrck_ext > > >> + - const: i2srx_bclk_ext > > >> + - const: i2srx_lrck_ext > > >> + - const: tdm_ext > > >> + - const: mclk_ext > > > > > > I'm sorry to be a bit of a bore about these bindings, but Emil mentioned > > > to me today that he had some doubts about whether any of these audio > > > clocks are actually required. > > > I've had a bit of a look at the driver, cos the TRM that I have doesn't > > > describe the clock tree (from what recall at least) and I think he is > > > right. > > > For example, the TDM clock: > > > + JH71X0_GATE(JH7110_SYSCLK_TDM_AHB, "tdm_ahb", 0, JH7110_SYSCLK_AHB0), > > > + JH71X0_GATE(JH7110_SYSCLK_TDM_APB, "tdm_apb", 0, JH7110_SYSCLK_APB0), > > > + JH71X0_GDIV(JH7110_SYSCLK_TDM_INTERNAL, "tdm_internal", 0, 64, JH7110_SYSCLK_MCLK), > > > + JH71X0__MUX(JH7110_SYSCLK_TDM_TDM, "tdm_tdm", 2, > > > + JH7110_SYSCLK_TDM_INTERNAL, > > > + JH7110_SYSCLK_TDM_EXT), > > > > > > Hopefully, I'm not making a balls of something here, but it looks like I > > > can choose an internal TDM clock, that is based on JH7110_SYSCLK_MCLK, > > > which in turn comes from either an internal or external source. > > > If I am following correctly, that'd be: > > > + JH71X0__DIV(JH7110_SYSCLK_MCLK_INNER, "mclk_inner", 64, JH7110_SYSCLK_AUDIO_ROOT), > > > > > > Which in turn comes from: > > > + JH71X0__DIV(JH7110_SYSCLK_AUDIO_ROOT, "audio_root", 8, JH7110_SYSCLK_PLL2_OUT), > > > > > > This leaves me wondering which clocks are *actually* required for a > > > functioning system - is it actually just osc and one of gmac1_rmii_refin > > > or gmac1_rgmii_rxin. > > > > As I had mentioned somewhere before, some audio clocks need to change their > > parents at different stages of work. I should explain in detail here. > > > > For the i2s*_ext clocks, we should use these external clocks as parents when > > the I2S module is working in the slave mode, while we should use the internal > > clocks as parents when the I2S module is working in the master mode. Right, so what Hal is saying here is that the i2s*_ext clocks are only needed if the board is designed to have i2s modules in slave mode. > > For the tdm_ext clock, we use it as the clock source for an accurate playback > > rate. If we use the internal clock as clock source, the TDM can't work > > normally, because it can't get a required rate from the internal divider. > > By the way, note that we need to use the internal clock as clock source when > > we try to reset the tdm clock, otherwise, the reset will fail. > > > > For the mclk_ext clock, which is 12.288MHz, it's used as the clock source > > through all the running time, otherwise, the daughter clocks can't get the > > required rate from the internal PLL2 clock (1188MHz) through dividers. Right, so PLL2 is 1188MHz on the VisionFive 2. Hal: But is it not possible to program the PLL2 to run at a multiple of 12.288MHz in some other configuration? > > So all these audio external clocks (i2s*_ext / tdm_ext / mclk_ext) are > > actually required. > > Okay. I think I am okay with leaving the binding as-is then, and if > someone needs to omit the entire audio subsystem on the SoC, they can > follow Stephen's suggestion. > > @Emil, is that okay with you? Conor: I'm fine with the bindings like this. I just want to make sure that we all have the same idea of what is "optional" and should be marked as such in the bindings. /Emil