From patchwork Mon Oct 24 11:30:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481832wru; Mon, 24 Oct 2022 07:23:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e+/0HDg0cPunxwu60KyGg2wt12wNLQG9+Rl5f+Wy1BMuBb2ywQ3NU0+PElYWsUvNUeiUR X-Received: by 2002:a17:907:7e87:b0:791:a477:1109 with SMTP id qb7-20020a1709077e8700b00791a4771109mr25118071ejc.354.1666621430295; Mon, 24 Oct 2022 07:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621430; cv=none; d=google.com; s=arc-20160816; b=mhBI/xPzTbMej234mFRcGBmqd62Rvg4D5F5g/lgaAE74L77viOfTGJlTdlV0DAEEhw r9IszU7UzuJDZCV2XoxS/PKchR+3gfFByVdu3TkAe1FYRmCVlpNb7GLmuen+2AXgOtER MdGrR4ULgBw5p9YeMp07nQ3yXlZWeij+cX9OW+5tnwEYzLzNNxObQQAUEajPz8ThWa7c 22AWq/sih8zr40TGUX8Wc5inWYjeuKkZpi3aMb8noZwQs+eFM6leoh5t+6Qe0qsuUW1w Z1oWXsdva0sEkptl9hNbJ9hJJbqjxt6Kfd5OkKv7kI5ugZI32HfmeyDInM6XorApQnEF Z2qQ== 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=h69Db44z5U2ICMT+D1zWXSrtFyS2FWVVU246Osy9pd8snYZ+Pr6AKVMks+/Lhcpz1I kOlg+lxejPdq9elNeKPJoDwWm8sq83k+gb1GEiWVM7ydVaVYJqpWaOcfbyB0N49iiwN2 HcHcObEKxcLVM1G75rrK8XhVKAkFz1L/OJ5/t2HSWg3LqtzbfPPwGqWQI7z2oGtbk30D FWymWv8GrGn8Rsm8Zlvy450lm3Vf/GabwA6pGW74owsjWBxgsAVZHl5CzCDSb69heMvN /8XqrUUsuYMwmRiJaR4b3xzlkgkvtKkSKdlUIxYVxiC0deuBvzef2mEJzkqFf6bbaPg4 Rm0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ydzGtqcA; 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 d20-20020aa7ce14000000b0045d0c00ead2si4186373edv.157.2022.10.24.07.23.24; Mon, 24 Oct 2022 07:23:50 -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=ydzGtqcA; 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 S234932AbiJXOUN (ORCPT + 99 others); Mon, 24 Oct 2022 10:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235693AbiJXOO6 (ORCPT ); Mon, 24 Oct 2022 10:14:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3CDC2528E; Mon, 24 Oct 2022 05:54: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 ams.source.kernel.org (Postfix) with ESMTPS id DF3E4B81699; Mon, 24 Oct 2022 12:28:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39E28C433D6; Mon, 24 Oct 2022 12:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614507; bh=8OgA0C8IHIsrI+48hYao+3vnUM+6hvyUvzEmf2Rdq/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ydzGtqcAib9wGnk2uBmrorii/b19OvfFvzwNis5V78Fv8X6pcblMuGbrzf60styaI pCYQXIhEWh3rT5n5+C0PLNB2zayJygiPwX/UF+2yb1jPzwHcnuP6WHIFtduA9FayG2 leT2EiIFv1ireF1WP87R0nmuU/Mv1s9EAw2VeOOM= 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.10 258/390] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024113033.875865376@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747579233099607040?= X-GMAIL-MSGID: =?utf-8?q?1747579233099607040?= 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",