Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp850479imw; Fri, 8 Jul 2022 12:59:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8kqhsTNZf4rEqMWoa+n+XG0piuuKhO9DA9ime2uulzEH6ZjpCvxTbz0fT7/HBqKtOb9lv X-Received: by 2002:a17:907:86a7:b0:726:317f:aee0 with SMTP id qa39-20020a17090786a700b00726317faee0mr5332720ejc.229.1657310384572; Fri, 08 Jul 2022 12:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657310384; cv=none; d=google.com; s=arc-20160816; b=xzmZgsTlOIlqlym8YAntyImhMshk50FZCKUQv2uG8ZsaxDXTbJGuHmPpGSonKJ2jcF PjxkSU6NOrxjiXdzFCyNygYUWac7eGiVXTwqeuC7HqSQTOJn+fw7T0A6wdT49rZE8GKB DKsEmehNeaKoQdsifeS9Is9cX01crFEonspSW1P79lXTZyqpaIS+3nguxRQrymsTYkbh SXLD4gMdN0VkbdVDFCWkKEA50vg/nM85GxAmPdd870JNBNZMZnJ1DqFtMdUunOeg+Jbr ncNRQCbAyA4Q9oEsz+h9WmUpy/3JvN9Hrnfh677Rugmn9CFdWlv8nGjWaCgGa/hE6lVS p8rA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=7Wd5s3mAaxc2zSZkSbVnCZdx2+51jTZeJ//9LMynMAo=; b=qpT7cIsjUn+usKIsL3ALfNgZXVN1xueUGg1A+zzCwUp08hyxoNC5QQt4yjEObcxeSl 2/9RIXvy2NcW0aIGEmsdCbAxLLk5bZpOzUZJZnT0ebiiw6STpJIAC8rNFi2r++BskgnX 14QcwuD3OCrbzM0nP02pWESGelLDlU+bki6+NvCipbA7f+IUvrCUT+hIdZPWBiyvbV4K LBgsjYx3CFOb+CVJYML3q2D79C9ty/mhrAZ1dKLGHOZXOAnagupwg0RPIBNCvL/ch8AI pNba0fWAmPiuUbXoqLoPu17hg3rx1RFtlTRTYJvTC+bK3Stg4vHMjkfRHbdZW1R7MS7p Rr/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=KHZdTyPW; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a05640234c800b0043575b6d886si7826567edc.454.2022.07.08.12.59.19; Fri, 08 Jul 2022 12:59:44 -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=@baikalelectronics.ru header.s=mail header.b=KHZdTyPW; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239866AbiGHT3C (ORCPT + 99 others); Fri, 8 Jul 2022 15:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239805AbiGHT21 (ORCPT ); Fri, 8 Jul 2022 15:28:27 -0400 Received: from mail.baikalelectronics.com (mail.baikalelectronics.com [87.245.175.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CEC924941; Fri, 8 Jul 2022 12:28:22 -0700 (PDT) Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id 2516616C6; Fri, 8 Jul 2022 22:30:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 2516616C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1657308605; bh=7Wd5s3mAaxc2zSZkSbVnCZdx2+51jTZeJ//9LMynMAo=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=KHZdTyPWqLXmVqlVHOeBx7Y0rpkXez+GcU4LZLFA5J+2K7WZqrEDHbtK6Mw+dY12G z25PTxxTRog8BsG7eHW2FPfwuJv9GCRuReA2xvauQ2kecFWr9nQVqDVnVZWbDC15p2 5y+YbY88yt5VnR70Yyfui2f3pXyTsCGtpsqvpbfk= Received: from localhost (192.168.53.207) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 8 Jul 2022 22:28:18 +0300 From: Serge Semin To: Stephen Boyd , Philipp Zabel , Michael Turquette CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Thomas Bogendoerfer , , , Subject: [PATCH v6 3/7] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Fri, 8 Jul 2022 22:27:21 +0300 Message-ID: <20220708192725.9501-4-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220708192725.9501-1-Sergey.Semin@baikalelectronics.ru> References: <20220708192725.9501-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR 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 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 --- Changelog v4: - Change the ID macro name to the more descriptive CCU_SYS_XGMAC_CLK. --- 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