From patchwork Sat Oct 22 07:26:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104858wrr; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FzhxdVT7mDFMDUh3+y6rAB728hcD3Bs0vzPMI2nsPRw1+Tx2oqHpbjgRgAvzrLiOOzGMS X-Received: by 2002:a17:90b:1bc9:b0:20d:b990:5028 with SMTP id oa9-20020a17090b1bc900b0020db9905028mr51301706pjb.111.1666427612389; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427612; cv=none; d=google.com; s=arc-20160816; b=XDcNYg98JSgfzvOlE21NOa1ANL36FG3lgVo90+BRmbQeNwatiUoo1AJqXMA9dSk2D+ /zsQ+58hF+VgKTEm3N1lnibxyRS1aii8LfpPHy8p5pzKFAUtKQXtkcQ0c0ZrKr3WODXL VeHx6ax63b3s/VPpRp5A3K1k+35qDQ40aq8NSRsvb9faiQKlOz/BS+VkVfPxm+omn/Hq Eaj3BseFQ/G1SSQhJNRzuOeJMYVbTP2m1D830URgb34vH78kP3xAiyQ7/DMHRYNr1pWT AAmxk5wSnzF5WEge28vTwsDM9nOi9gEXN9PA7uXQ5jHtY6CnBarCEfZ9Wi7QmHwPH90x fC4w== 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=WzR2scu0FDdfp4UvtxaJEfjMe/D/LyklITol31rpbmHYNcsqETXbX6YJoLc7sg5rsC Z6YcpbUepM4d2DnkYglsxiBA2iQI+QoBB65BUILYjUUK9zOuVEmfcx1xY7nHoTcQ24N6 o4GdLM9pRKvaIQFgcWzkg5Fsireqc/iO0VuKqJ0/THlOa2iaBeh6Y8X9a4MtsEb+FeOo e9QAnHAtc+ZnsL8bjVXyhvQxwXPp3qf0nt74dnSikcKYhk7yx74kP37WjGbzrpEwX6n3 geZz8bjVw8F74swpWspETKoG8lN3/ZtxhxlQrVS1cuhX8cvwi555w6R2SPoWQlnxXYfS bk1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2O5Qaifh; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e129-20020a636987000000b004597ddac1fasi26671689pgc.533.2022.10.22.01.33.19; Sat, 22 Oct 2022 01:33:32 -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=2O5Qaifh; 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 S233392AbiJVISK (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234028AbiJVIP6 (ORCPT ); Sat, 22 Oct 2022 04:15:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DA92DB976; Sat, 22 Oct 2022 00:56:58 -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 C2D3F60B98; Sat, 22 Oct 2022 07:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C952EC433C1; Sat, 22 Oct 2022 07:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425381; bh=8OgA0C8IHIsrI+48hYao+3vnUM+6hvyUvzEmf2Rdq/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2O5Qaifhu9AtjBbxquWGayqhjBjn4Ry8zX2lY4ZVjKh/EDAAM8eEy43Xj6GeFZb10 X4dtUhYTmeJmkihmK3FsenofNjDTC6rLIIA3y6DJvtBLcv3jz2I393HGqG5RP7c/Ju xJRk6uFDQeKjUcQUuMN875no/kvXDWdqljCCEq6U= 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 5.19 482/717] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Sat, 22 Oct 2022 09:26:01 +0200 Message-Id: <20221022072519.700631964@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376000274275729?= X-GMAIL-MSGID: =?utf-8?q?1747376000274275729?= 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",