Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp329163qtb; Wed, 19 Oct 2022 03:07:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vs6tytHyO2gR2cbxpZhVDTifJHryBdIqsjKf6vExGwLMgISf6a3GMvo6e+NVTUD5oveHq X-Received: by 2002:a17:902:f684:b0:17f:95cc:af8 with SMTP id l4-20020a170902f68400b0017f95cc0af8mr7643910plg.91.1666174046207; Wed, 19 Oct 2022 03:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666174046; cv=none; d=google.com; s=arc-20160816; b=bQ6hbQuU2qC8oNyhjLWeQyjdlrIaM+uztW6jAelQ4baoR5bBsXi9MhkKGXGX71CjnB UvZDwv5SUfDm12u0ZrGvtdravFtH2tLoLmA0CqVK5anM96RRJiSq2SO5KZGyN/c6lYCR iw40vHR2y72Xy7Rg+WeNiUtBxyEv+YlX9FMAOPK6lzAz78NjlKgpIUeDMBz176UE+W7N QDsc+NZCNdFbb7/TEM63YcqA5bvP3nrUHkGlW04G4Fnc5NcRxXZn73SvfCx/PsyEHmXD G1EGh91bMSbjn9tlM7C3sG4IDMP1tobgO98TjcLj0IteMTBUOtKdthkV86SqZFfKw/Wn tknQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4g0cVlHUXjv0gLOXBoPWodJKCKk8oHQXO+u+JUneURA=; b=xLthqDXm3dStmjQFMHnu3AUBNlrjuBRqyFfOkPUtGUdS2C25sBu8/cJ9gRaOpdrY+O 03VdMomh2YJcliJTbY+5xaKjbejPrrsgIw8HifMBL3HLn9bngqAbYzmVLZdEnlBeVsVj A1SLOvtw/3fUCi0OhikIAVqPgHqwMhUIJXqFD6byHko4l4d25zNrkhpy5Il7Pk+Mt1cC +twEFR+Qz5dbji6Hd3e8WIOuyBMRj0NIQwGSRrgPtukJZjhU1uGfhNvmwl/fp4j2gLr9 wpm2n7q5HhW8SgrXDuNv65ORPohUWVFSEiF6FZXw60guocgZJrathQbywA1GAF+dgbSm yGnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/V7kmJ+"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a170902c64300b001865a9586c1si293460pls.59.2022.10.19.03.07.10; Wed, 19 Oct 2022 03:07:26 -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=@linuxfoundation.org header.s=korg header.b="0/V7kmJ+"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233104AbiJSJRf (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233327AbiJSJOk (ORCPT ); Wed, 19 Oct 2022 05:14:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F28213ED5F; Wed, 19 Oct 2022 02:04:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AB4661852; Wed, 19 Oct 2022 09:04:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA37C433C1; Wed, 19 Oct 2022 09:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170278; bh=8OgA0C8IHIsrI+48hYao+3vnUM+6hvyUvzEmf2Rdq/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/V7kmJ+YqKq7ZlLxLddtI5ZTZ1XQzS9YCihm2r5s351dTJWy56VXRqSSfuSU/EMb sUok6BHMWfqL2VHkQGsN804QIgj3Va6TnLVRSZk89UM6+D0lBUfKELA2EpAObYYAsp Cl5ipeXhv0lgW39n6rnr80j0ELNDoGxEmXo22MrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 593/862] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Wed, 19 Oct 2022 10:31:20 +0200 Message-Id: <20221019083316.169283492@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Serge Semin [ Upstream commit e2eef312762e0b5a5a70d29fe59a245c0a3cffa0 ] Baikal-T1 CCU reference manual says that both xGMAC reference and xGMAC PTP clocks are generated by two different wrappers with the same constant divider thus each producing a 156.25 MHz signal. But for some reason both of these clock sources are gated by a single switch-flag in the CCU registers space - CCU_SYS_XGMAC_BASE.BIT(0). In order to make the clocks handled independently we need to define a shared parental gate so the base clock signal would be switched off only if both of the child-clocks are disabled. Note the ID is intentionally set to -2 since we are going to add a one more internal clock identifier in the next commit. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-4-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 1 + drivers/clk/baikal-t1/ccu-div.h | 6 ++++++ drivers/clk/baikal-t1/clk-ccu-div.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index 4062092d67f9..bbfa3526ee10 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -579,6 +579,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) goto err_free_div; } parent_data.fw_name = div_init->parent_name; + parent_data.name = div_init->parent_name; hw_init.parent_data = &parent_data; hw_init.num_parents = 1; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index 795665caefbd..b6a9c8e45318 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -13,6 +13,12 @@ #include #include +/* + * CCU Divider private clock IDs + * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock + */ +#define CCU_SYS_XGMAC_CLK -2 + /* * CCU Divider private flags * @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1. diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index ea77eec40ddd..3953ae5664be 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -204,10 +204,12 @@ static const struct ccu_div_info sys_info[] = { "eth_clk", CCU_SYS_GMAC1_BASE, 5), CCU_DIV_FIXED_INFO(CCU_SYS_GMAC1_PTP_CLK, "sys_gmac1_ptp_clk", "eth_clk", 10), - CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", - "eth_clk", CCU_SYS_XGMAC_BASE, 8), + CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_CLK, "sys_xgmac_clk", + "eth_clk", CCU_SYS_XGMAC_BASE, 1), + CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", + "sys_xgmac_clk", 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 8), + "sys_xgmac_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", -- 2.35.1