Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5907863rdb; Thu, 14 Dec 2023 03:14:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEh2aQfbvH03EpI0wKGMRQlNIBDMXiCLxxzihTlNOCHpPZdhxjLq1R/Bt2gVrkP5dmLy75H X-Received: by 2002:a17:903:40ca:b0:1cf:e100:a96b with SMTP id t10-20020a17090340ca00b001cfe100a96bmr10848315pld.9.1702552482571; Thu, 14 Dec 2023 03:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702552482; cv=none; d=google.com; s=arc-20160816; b=c2aY+smc/geWJOXNj7h/1ZtOiI+VESBlcMxgidZa8NoVYDQidL/3dlMNhzGOVYW2+e 7WvK6AMriojIJYUjL3tnB4lj7PlrQshQ5q5mXoQruL1opEhe9Ms5LoMm0MjpjuRyfYcr /A046HxyuF7jPatHVzvM6dvYa57nyjUP/XJI9jwjVQss3cfYq+o/gE1FprFN6EpK40Uq eKmklrGB3mjqjltX/iU7qjFyCzM2sPGAX0IDhB7WTXyGxa5KTKezrZW95Q3KozmxwJJD OfXWXYC9AnImDy3OeN0dD+AMH2XxE4oB0m3XHqSg1Z97rqLFHKnH+U0aYnR6qTA4WgUX hA2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WHnitpS5CTIsdTa6Wxd5rPjEBsVjY1RlCyZkVmjhDIM=; fh=3W0hiHGUjqycuDbHozkRrW5IgDdaOSR7ROLCTr21pUU=; b=vbWj//UOZT3hnOCSlUA2HKVO0NgGirnhUQQU0amabG2E3owKNMBIDepsqlKrjbqUli eVptOqOFv3BK6XIuzz9jbGu7t7xTAFsmmz70tqiv6VD9vMqMnFC2SwtGQOBFvz2ZXwUG 4OAu3kqgeJiul+/uMHhWJiv4NDcgS4zcmHraDnuC6UMiC6qo/HEl2K2DmEmILAvT7JhS 3Vt48zihIprf1uynZV7//CGFlkxdQfZdz+CnYCfQ7O6gZYb0CRU+IFLt1+qFcwOmghvP Q3WVLu6jL8KZHuOmlMhpS7GmAcYSLra1o5Fv4alviEcl1W0CqG3zyF0r26emByBLUbsv wMUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h6-20020a170902704600b001d36d944044si611690plt.119.2023.12.14.03.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:14:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 415F68026A2F; Thu, 14 Dec 2023 03:14:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443959AbjLNLOY (ORCPT + 99 others); Thu, 14 Dec 2023 06:14:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443857AbjLNLOX (ORCPT ); Thu, 14 Dec 2023 06:14:23 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5172D8E for ; Thu, 14 Dec 2023 03:14:30 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 508ABC433C7; Thu, 14 Dec 2023 11:14:21 +0000 (UTC) Date: Thu, 14 Dec 2023 16:44:09 +0530 From: Manivannan Sadhasivam To: Johan Hovold Cc: Manivannan Sadhasivam , andersson@kernel.org, konrad.dybcio@linaro.org, vkoul@kernel.org, sboyd@kernel.org, mturquette@baylibre.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Shazad Hussain , quic_cang@quicinc.com Subject: Re: [PATCH 00/16] Fix Qcom UFS PHY clocks Message-ID: <20231214111409.GB48078@thinkpad> References: <20231214091101.45713-1-manivannan.sadhasivam@linaro.org> <20231214103907.GL2938@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:14:39 -0800 (PST) + Can On Thu, Dec 14, 2023 at 12:00:40PM +0100, Johan Hovold wrote: > [ +CC: Shazad ] > > On Thu, Dec 14, 2023 at 04:09:07PM +0530, Manivannan Sadhasivam wrote: > > On Thu, Dec 14, 2023 at 11:15:34AM +0100, Johan Hovold wrote: > > > On Thu, Dec 14, 2023 at 02:40:45PM +0530, Manivannan Sadhasivam wrote: > > > > > > > This series fixes the clocks supplied to QMP PHY IPs in the Qcom SoCs. All > > > > of the Qcom SoCs except MSM8996 require 3 clocks for QMP UFS: > > > > > > > > * ref - 19.2MHz reference clock from RPM/RPMh > > > > * ref_aux - Auxiliary reference clock from GCC > > > > * qref - QREF clock from GCC or TCSR (TCSR since SM8550) > > > > > > > > MSM8996 only requires 'ref' and 'qref' clocks. > > > > > > > > Hence, this series fixes the binding, DT and GCC driver to reflect the > > > > actual clock topology. > > > > > > Is this based on documentation for all the SoCs or on inference from the > > > current (upstream and downstream) devicetrees? > > > > It is based on the internal documentation. Even downstream devicetrees are > > wrong. I should've mentioned it in the cover letter. > > > > > Are you sure that you should not just describe that some of these UFS > > > reference clocks are sourced from CXO in the clock driver instead? > > > > I don't get your comment fully. Could you please elaborate? > > Unless the PHY consumes CXO directly, it should not be included in the > binding as you are suggesting here. > PHY is indeed directly consuming CXO. That's why I included it in the binding. > We discussed this at some length at the time with Bjorn and Shazad who > had access to the documentation and the conclusion was that, at least on > sc8280xp, the PHY does not use CXO directly and instead it should be > described as a parent to the UFS refclocks in the clock driver: > > https://lore.kernel.org/lkml/Y2OEjNAPXg5BfOxH@hovoldconsulting.com/ > > The downstream devicetrees have a bad habit of including parent clocks > directly in the consumer node instead of modelling this in clock driver > also for other peripherals. > No, I can assure that you got the wrong info. UFS PHY consumes the clock directly from RPMh. It took me several days to dig through the UFS and PHY docs and special thanks to Can Guo from UFS team, who provided much valuable information about these clocks. > > > Take a look at commits > > > > > > f446022b932a ("arm64: dts: qcom: sc8280xp: fix UFS reference clocks") > > > f6abcc21d943 ("clk: qcom: gcc-sc8280xp: add cxo as parent for three ufs ref clks") > > > > Btw, these commits are not accurate. In all the SoCs before SM8550, reference > > clock for the UFS device comes from the UFS controller. There is a dedicated > > register in UFSHC memory map that is being toggled by the driver to > > enable/disable reference clock for the UFS device. > > > > Since SM8550, reference clock is directly sourced from RPMh. I'm preparing a > > series to fix it. > > What exactly is wrong with those commits? We know that the controller > does not consume GCC_UFS_REF_CLKREF_CLK directly, but describing that as > such for now was a deliberate choice: > > GCC_UFS_REF_CLKREF_CLK is the clock to the devices, but as we > don't represent the memory device explicitly it seems suitable > to use as "ref_clk" in the ufshc nodes - which would then match > the special handling of the "link clock" in the UFS driver. > No, GCC_UFS_REF_CLKREF_CLK is _not_ the clock to UFS devices. I haven't found information about this specific register in GCC. Initially I thought this is for enabling QREF clocks for the UFS MEM phy, but I haven't found the answer yet. But as I said earlier, reference clock to UFS devices comes directly from the controller and there is a specfic register for controlling that. Starting from SM8550, reference clock comes from RPMh. > > Unfortunately, this information is not depicted correctly in the downstream > > devicetrees. > > I was hoping the information that those commits are based on would be > correct as it came from Qualcomm and Bjorn. I have no illusions about > the downstream devicetrees being correct. :) > Unfortunately, you got inaccurate information. But that's very common, since these kind of info are buried down in some docs and people's mind :) - Mani > Johan -- மணிவண்ணன் சதாசிவம்