Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp833376rwd; Thu, 15 Jun 2023 02:42:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4465+b4mlSETMIa2r7lliYrgYON1t9tsCcLpEc9XFCaeftYoPu5Yj7QWqdov9E+yIOdrx0 X-Received: by 2002:a05:6214:29ce:b0:616:4b40:5ea9 with SMTP id gh14-20020a05621429ce00b006164b405ea9mr17397018qvb.40.1686822159303; Thu, 15 Jun 2023 02:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686822159; cv=none; d=google.com; s=arc-20160816; b=M/iRhHNEvXvNzLpm7pmwApA4poP/GeDAotQeBEvUrzPi4yyzrHEcQdB/dra1MTxd7R e8GVF5FyI8gBSGtPLBGFwBPYKrluZE2b/7432cFkqPTJMGw7jGdMVmRyDDSjh5ZDzW8p apANuEZSPDIYjyH/kCKHyK0IC7cas+UY8TqmuH2LZsPQkDDo/pmz47OoFrKoeBOjwjaA 9ItQqmMREP2c7WCa+k8i8cC+LZLW8uWTrc/3kdq71/cXY3c6VwtSiHGnZQAufa81eWsk 8KLSSmpBylU+zWlhhieYm7o/uoQOFUOQXgsJ81lEEFbhLVMURkcLpQBQPB3+4x47Rs/Q zokQ== 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; bh=PrnBqUpwPVQvsPKBxHynq+wOUTSc0l9FDF2a5UhELxo=; b=EeG6V6YSjNcpTzGUCjDC6Fk4v6BMoBlNEOjPpD5Uv0ufWca89YJcHqrimo4kn4AaRt GiYZaJ9hcLbGWPPPxeztmdwkSFcnmcDxm7cPYM/nLdj+ujPCBNwXTiJ3hPjCJyuDkaW+ eURQd4VgtQWoihEZvVA/9Qz/ry1trfH1Ubnb4avgbo/qAOQeC8SLqF3TnibsKWr+uQzY dTGQIjXdCRrF7gS0rxyQ7g7heCIyaj1ehfB+kV7Pn3+AJWBSKj/pyMbn1RnQu8tIatuD BuWDiVQVNETWVWj628JynHl5yTU8+iV1hMWO/ENytGJakQv+uqGpoiSAyO3jzK4fNKz7 ZA/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=GZ0mpkcN; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a63930c000000b0054f75f671easi8130942pge.90.2023.06.15.02.42.26; Thu, 15 Jun 2023 02:42:39 -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=@microchip.com header.s=mchp header.b=GZ0mpkcN; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245694AbjFOJe3 (ORCPT + 99 others); Thu, 15 Jun 2023 05:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245599AbjFOJeE (ORCPT ); Thu, 15 Jun 2023 05:34:04 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D606F2717; Thu, 15 Jun 2023 02:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686821644; x=1718357644; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OZEwf00C1ErmmH4mYSARTCAo0oEN6THlqsuneJ/xols=; b=GZ0mpkcNKUh+P/Hs6ew06j6WbEU4tbzbP2ANVtfeZ3EjzVAgbzGxLO+J pEBrxobLItAs2gYZeiehSmNaq5mndLsbvJIs4j2R7VHtMSjqg015iluJf IhOSk8+2zZISX7rTySMiESNw/M52Cuj4zPEkcxKdUj0M7agQndUcmgPmh NCQNLa9XdtzBDLig/ExVPUcrcDSj88tKU1TZbVZlb0eZYip/de20EiWxK /sNJ8qpAv4mogwhqJK31D5//kUgiIJ95lZBAXditN4shI5GvkSVyZaT10 EwknzBCGqrabw1MN8dF34lfLzq3TC7L3hMPvE/TO7GqLhrnreIh75PuBR A==; X-IronPort-AV: E=Sophos;i="6.00,244,1681196400"; d="scan'208";a="218626802" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Jun 2023 02:34:03 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 15 Jun 2023 02:33:59 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Thu, 15 Jun 2023 02:33:54 -0700 From: Claudiu Beznea To: , , , , , , CC: , , , Claudiu Beznea Subject: [PATCH 02/11] clk: at91: clk-generated: add support for parent_hw Date: Thu, 15 Jun 2023 12:32:18 +0300 Message-ID: <20230615093227.576102-3-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230615093227.576102-1-claudiu.beznea@microchip.com> References: <20230615093227.576102-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Add support for parent_hw in generic clock drivers. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-generated were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea --- drivers/clk/at91/clk-generated.c | 11 +++++++++-- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 3 ++- drivers/clk/at91/sam9x60.c | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama7g5.c | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c index 943ea67bf135..4b4edeecc889 100644 --- a/drivers/clk/at91/clk-generated.c +++ b/drivers/clk/at91/clk-generated.c @@ -319,22 +319,29 @@ struct clk_hw * __init at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, const struct clk_pcr_layout *layout, const char *name, const char **parent_names, + struct clk_hw **parent_hws, u32 *mux_table, u8 num_parents, u8 id, const struct clk_range *range, int chg_pid) { struct clk_generated *gck; - struct clk_init_data init; + struct clk_init_data init = {}; struct clk_hw *hw; int ret; + if (!(parent_names || parent_hws)) + return ERR_PTR(-ENOMEM); + gck = kzalloc(sizeof(*gck), GFP_KERNEL); if (!gck) return ERR_PTR(-ENOMEM); init.name = name; init.ops = &generated_ops; - init.parent_names = parent_names; + if (parent_hws) + init.parent_hws = (const struct clk_hw **)parent_hws; + else + init.parent_names = parent_names; init.num_parents = num_parents; init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; if (chg_pid >= 0) diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index ecb0bebb8a7d..e5a56aaff96d 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -171,7 +171,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np) hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, &dt_pcr_layout, name, - parent_names, NULL, + parent_names, NULL, NULL, num_parents, id, &range, chg_pid); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 487e44deeca0..e947c78a82d0 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -144,7 +144,8 @@ struct clk_hw * __init at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, const struct clk_pcr_layout *layout, const char *name, const char **parent_names, - u32 *mux_table, u8 num_parents, u8 id, + struct clk_hw **parent_hws, u32 *mux_table, + u8 num_parents, u8 id, const struct clk_range *range, int chg_pid); struct clk_hw * __init diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c index e2f40f167c08..dcc8f8142180 100644 --- a/drivers/clk/at91/sam9x60.c +++ b/drivers/clk/at91/sam9x60.c @@ -351,7 +351,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, &sam9x60_pcr_layout, sam9x60_gck[i].n, - parent_names, NULL, 6, + parent_names, NULL, NULL, 6, sam9x60_gck[i].id, &sam9x60_gck[i].r, INT_MIN); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 2ee8f10d3b03..18695c9c9beb 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -358,7 +358,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, &sama5d2_pcr_layout, sama5d2_gck[i].n, - parent_names, NULL, 6, + parent_names, NULL, NULL, 6, sama5d2_gck[i].id, &sama5d2_gck[i].r, sama5d2_gck[i].chg_pid); diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 42dc74dbfc28..e754c127b2b8 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1111,7 +1111,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np) hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, &sama7g5_pcr_layout, sama7g5_gck[i].n, - parent_names, mux_table, + parent_names, NULL, mux_table, num_parents, sama7g5_gck[i].id, &sama7g5_gck[i].r, -- 2.34.1