Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5643478rwr; Tue, 9 May 2023 04:35:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZDHSDCoTnbjiArR9srxalGZUVOny+CiJoR89kzUPOjJUKQKCzF9CXp+RnvEqqGbFkZT7c X-Received: by 2002:a17:90a:db07:b0:250:50c5:cabc with SMTP id g7-20020a17090adb0700b0025050c5cabcmr11900189pjv.3.1683632157870; Tue, 09 May 2023 04:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683632157; cv=none; d=google.com; s=arc-20160816; b=SJMEelTcnlUQ3Q78uu2fPx2oqZ1oqPQnCX2ZBzH5ZL9BgpIHljW+FwpxBW3eoPlrSE tX+kkKtYcdES1J88DEzx0OxvRKElSOtjz6vQukxVluXH0aUw2bgkzpFOOz7JJEOeb09I aCS0MTUDUG/0SH7x73Nzndih8yoOXEmBaLm5HAHhAm8YHQ9+LBFgZI3Au98o/XJQ8Q8Y e3wanxVXGfVRpomdrqzrE9QrCxsJm+WwfpM2iJybDO6V4IHUzOmOp/JFdqY5YyqF1J+8 9pOng06L/aY0fI2NgivpB0CL8IkBls92aLQoctkK/6IX1YJLJVIBzAtl+peSGxGXdeAg HfMQ== 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=zDYwURL6aB5EYY0Cme2ttwuND/PMKWLi8Em3Bv+6xTA=; b=GnVmtPutd7LwmnD3kArX9pzoe3TDKqY66pNzuo4yiBsftbXqH6SdkyP1xnruKwgM70 RoijYzScm2Ad5D45EerI/Sf0coqS8CycO1tZEajFaeIHxWMvNFNPNX7BqOuYklLEbwx8 A76jrLyF7XGtE1qp3GpU0wIDmaBmD4WewRS41LNrEArYmPn5253QYIU8lMfCURLEpPfr ocJOXdMmEy5O28nDdRvfWKK5rQrGmvcQcPOcp+i703liXARaf0TWik8epp2Js8sqjWjL HGb2NgM+iTLymIcA63aAItgBajc4Y25SHaoRUAduh5A9m4P19BhhinIY9yeK1vcaXCV0 MgsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R+/w/DCi"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a170902989200b001a1b5191202si1251913plp.151.2023.05.09.04.35.42; Tue, 09 May 2023 04:35:57 -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=@linaro.org header.s=google header.b="R+/w/DCi"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234398AbjEILZI (ORCPT + 99 others); Tue, 9 May 2023 07:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234848AbjEILZE (ORCPT ); Tue, 9 May 2023 07:25:04 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21CFC49E6 for ; Tue, 9 May 2023 04:25:01 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-b9a6eec8611so29924204276.0 for ; Tue, 09 May 2023 04:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683631500; x=1686223500; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zDYwURL6aB5EYY0Cme2ttwuND/PMKWLi8Em3Bv+6xTA=; b=R+/w/DCiQYMNVSHwP8o461Wr84ZWVO+hxSAQb3irmmqSahWvRocgABTOi+O/cdDhGX pEPm1+c/LPdOxAGAiNcq5ke85kYwlYSNAIic8gGJAFkCyRlVSvm+VKOUUtjYTbAKSWVo Uotbe7NXdcUnv/SLsFEUKPcXwhBCwUKu2x0i8/fg7fbbswe0S5ZpN4O2SJ4NPZiwTSUU BUxD22T1Zy3eCOnRdXo/n4H81gWpjctD4zVz9DMBsLRRPOezoS3PtIC5T21h7SJAv5hI mTJwALR0BkRiTQZXhwEmgsqkUebkM5zHHhTcyB2B8mi0enq8r5eOafjjjnacd41W0aWL su7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683631500; x=1686223500; 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=zDYwURL6aB5EYY0Cme2ttwuND/PMKWLi8Em3Bv+6xTA=; b=YWIDfnC5arCZwPLmTfxlVmCO6aUQhOUf+5lggzX3NzIaZAzxQugUNA+RZCDYQoU+0m 0w5M7s5c+TbhwWDjPUiVKhirTjZDShRIY0PyNO7XREhlISpme/n+iJ4VbSdWKBmAdNOH NcC8IzEebt0DuguGGiciVE5RS6u7sJy3ekgWmrHuQvTYHpjD+QU+mW3f806l1FFAnVnR 2vNK0bx4/clJo6rjAh6W1lFb51YKogNs50Rz87Z2zWuUKBQW/QDlbLsj5dKQO2k/ufsS Ez3nf0me3HUvchDYw0m3SwCnuh4Pcd7m6ifFPeODwOD3KGbXRgtm78rtaIbbWL6wL8Gg 9SPQ== X-Gm-Message-State: AC+VfDzgDL0MUL1aTpRBy32S7DHPvBElgg+tPx0sYFDhBY8K0yrJQQUW WxoLn7kJ0iYICftnRseCn034K8/brXaYupDi9SBSmg== X-Received: by 2002:a0d:c604:0:b0:55a:3502:d2ca with SMTP id i4-20020a0dc604000000b0055a3502d2camr13380602ywd.13.1683631500305; Tue, 09 May 2023 04:25:00 -0700 (PDT) MIME-Version: 1.0 References: <20230419133013.2563-1-quic_tdas@quicinc.com> <20230419133013.2563-5-quic_tdas@quicinc.com> In-Reply-To: From: Dmitry Baryshkov Date: Tue, 9 May 2023 14:24:49 +0300 Message-ID: Subject: Re: [PATCH 4/4] clk: qcom: Add GCC driver support for SDX75 To: Taniya Das Cc: Stephen Boyd , Rob Herring , Bjorn Andersson , Andy Gross , Krzysztof Kozlowski , Richard Cochran , Michael Turquette , quic_skakitap@quicinc.com, Imran Shaik , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_rohiagar@quicinc.com, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Tue, 9 May 2023 at 12:14, Taniya Das wrote: > > Thanks Dmitry for the review. > > On 4/20/2023 3:40 PM, Dmitry Baryshkov wrote: > >> +static const struct clk_parent_data gcc_parent_data_5[] = { > >> + { .fw_name = "emac0_sgmiiphy_rclk" }, > > > > So, this looks like a mixture of fw_name and index clocks. Please > > migrate all of fw_names to the .index usage. > > > > I will take care of it to move to index, but does it not bind us to use > the right index always from DT. > > The current approach I was thinking to bind the XO clock to 0th index, > but we cannot gurantee these external clocks would be placed at the > right index. Please define all parent clocks as <0> inside the DT. This way you ensure ordering of the external clocks. Replace <0> with proper clock references as devices are added to DT. > > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_6[] = { > >> + { P_EMAC0_SGMIIPHY_TCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_6[] = { > >> + { .fw_name = "emac0_sgmiiphy_tclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_7[] = { > >> + { P_EMAC0_SGMIIPHY_MAC_RCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_7[] = { > >> + { .fw_name = "emac0_sgmiiphy_mac_rclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_8[] = { > >> + { P_EMAC0_SGMIIPHY_MAC_TCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_8[] = { > >> + { .fw_name = "emac0_sgmiiphy_mac_tclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_9[] = { > >> + { P_EMAC1_SGMIIPHY_RCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_9[] = { > >> + { .fw_name = "emac1_sgmiiphy_rclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_10[] = { > >> + { P_EMAC1_SGMIIPHY_TCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_10[] = { > >> + { .fw_name = "emac1_sgmiiphy_tclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_11[] = { > >> + { P_EMAC1_SGMIIPHY_MAC_RCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_11[] = { > >> + { .fw_name = "emac1_sgmiiphy_mac_rclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_12[] = { > >> + { P_EMAC1_SGMIIPHY_MAC_TCLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_12[] = { > >> + { .fw_name = "emac1_sgmiiphy_mac_tclk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_13[] = { > >> + { P_PCIE_1_PIPE_CLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_13[] = { > >> + { .fw_name = "pcie_1_pipe_clk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_14[] = { > >> + { P_PCIE_2_PIPE_CLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_14[] = { > >> + { .fw_name = "pcie_2_pipe_clk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_15[] = { > >> + { P_PCIE20_PHY_AUX_CLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_15[] = { > >> + { .fw_name = "pcie20_phy_aux_clk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_16[] = { > >> + { P_PCIE_PIPE_CLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_16[] = { > >> + { .fw_name = "pcie_pipe_clk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_17[] = { > >> + { P_BI_TCXO, 0 }, > >> + { P_GPLL0_OUT_MAIN, 1 }, > >> + { P_GPLL6_OUT_MAIN, 2 }, > >> + { P_GPLL0_OUT_EVEN, 6 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_17[] = { > >> + { .index = DT_BI_TCXO }, > >> + { .hw = &gpll0.clkr.hw }, > >> + { .hw = &gpll6.clkr.hw }, > >> + { .hw = &gpll0_out_even.clkr.hw }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_18[] = { > >> + { P_BI_TCXO, 0 }, > >> + { P_GPLL0_OUT_MAIN, 1 }, > >> + { P_GPLL8_OUT_MAIN, 2 }, > >> + { P_GPLL0_OUT_EVEN, 6 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_18[] = { > >> + { .index = DT_BI_TCXO }, > >> + { .hw = &gpll0.clkr.hw }, > >> + { .hw = &gpll8.clkr.hw }, > >> + { .hw = &gpll0_out_even.clkr.hw }, > >> +}; > >> + > >> +static const struct parent_map gcc_parent_map_19[] = { > >> + { P_USB3_PHY_WRAPPER_GCC_USB30_PIPE_CLK, 0 }, > >> + { P_BI_TCXO, 2 }, > >> +}; > >> + > >> +static const struct clk_parent_data gcc_parent_data_19[] = { > >> + { .fw_name = "usb3_phy_wrapper_gcc_usb30_pipe_clk" }, > >> + { .index = DT_BI_TCXO }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac0_cc_sgmiiphy_rx_clk_src = { > >> + .reg = 0x71060, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_5, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac0_cc_sgmiiphy_rx_clk_src", > >> + .parent_data = gcc_parent_data_5, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_5), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac0_cc_sgmiiphy_tx_clk_src = { > >> + .reg = 0x71058, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_6, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac0_cc_sgmiiphy_tx_clk_src", > >> + .parent_data = gcc_parent_data_6, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_6), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac0_sgmiiphy_mac_rclk_src = { > >> + .reg = 0x71098, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_7, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac0_sgmiiphy_mac_rclk_src", > >> + .parent_data = gcc_parent_data_7, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_7), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac0_sgmiiphy_mac_tclk_src = { > >> + .reg = 0x71094, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_8, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac0_sgmiiphy_mac_tclk_src", > >> + .parent_data = gcc_parent_data_8, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_8), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac1_cc_sgmiiphy_rx_clk_src = { > >> + .reg = 0x72060, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_9, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac1_cc_sgmiiphy_rx_clk_src", > >> + .parent_data = gcc_parent_data_9, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_9), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac1_cc_sgmiiphy_tx_clk_src = { > >> + .reg = 0x72058, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_10, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac1_cc_sgmiiphy_tx_clk_src", > >> + .parent_data = gcc_parent_data_10, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_10), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac1_sgmiiphy_mac_rclk_src = { > >> + .reg = 0x72098, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_11, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac1_sgmiiphy_mac_rclk_src", > >> + .parent_data = gcc_parent_data_11, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_11), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_emac1_sgmiiphy_mac_tclk_src = { > >> + .reg = 0x72094, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_12, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_emac1_sgmiiphy_mac_tclk_src", > >> + .parent_data = gcc_parent_data_12, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_12), > >> + .ops = &clk_regmap_mux_closest_ops, > >> + }, > >> + }, > >> +}; > >> + > >> +static struct clk_regmap_mux gcc_pcie_1_pipe_clk_src = { > >> + .reg = 0x67084, > >> + .shift = 0, > >> + .width = 2, > >> + .parent_map = gcc_parent_map_13, > >> + .clkr = { > >> + .hw.init = &(const struct clk_init_data) { > >> + .name = "gcc_pcie_1_pipe_clk_src", > >> + .parent_data = gcc_parent_data_13, > >> + .num_parents = ARRAY_SIZE(gcc_parent_data_13), > >> + .ops = &clk_regmap_mux_closest_ops, > > > > Are these clocks a clk_regmap_mux_closest_ops in reality > > clk_regmap_phy_mux_ops? > > clk_regmap_phy_mux_ops cannot be used here, as multi parent mux requires > the .get_parent ops to be supported. If we strike out the tcxo (= disable from regmap_phy_mux POV), there is only a single parent. -- With best wishes Dmitry