Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1099230rwb; Fri, 28 Jul 2023 04:58:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlHHrW4GodWG1pZUZ8XNqn6Ix9CNdZLES3wlomkoq6XgA9X0IHv6AUz4YOSkdj2sV0KsAl95 X-Received: by 2002:a17:906:3057:b0:99b:cf57:11e3 with SMTP id d23-20020a170906305700b0099bcf5711e3mr1851868ejd.59.1690545498197; Fri, 28 Jul 2023 04:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690545498; cv=none; d=google.com; s=arc-20160816; b=ejZeMnxsAmbzuLULi0Lcau+hQ9rByw4EaDgM2E0/ahUTdpgM4n2Xe/9bIOQkyyC4oK 8ly7fXJjj/F0QNQg+vileVmTi8vAj3Z+Lw+dR4pcFs2ljp/MGwxyVB22mi4PWFXDeCkd Z41/4RZpR+7M67pijurlILd6+hxlpTEixtlgmu/WVd3UfOy8Fwroe0rBfJP/pusUH7oS 5RU9ubzbEvCXZElK9oGZX2D3HHpoNawpz6Y6GWDm9vDMs2zv2A/CGBTymibJhgbMnxHU fP2r6E3ahw9MK2SwI9YQMBfoSYsDz/G2r9aOw2M6IGaCWr6yWapYkwvGXaDLV82dl4c3 tz9w== 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 :message-id:date:subject:to:from:dkim-signature; bh=m7NFWWi5/ew1y4GgTxiNQ2OAbWClpSHHYvjHncsQvw0=; fh=+hP2lP1o+Z6v79dUFZStd+pUi1wmCbLJG4/NF83SMpY=; b=gNtCoj7AAsB90H0WyoIKKb23WBeFPcbrZXWDcoskbCUXIbsrKi6M5wYUf7iBDZ/DXH iysv7KC/8QI7R/6PibSzf3PzQbXrdxkln3ro/UgDIhX+4q5pop2anmQuLvge/N15u9vW ZEUU+VTQgcIXS6P5OtDQtn45e/pAJvmg6U2xMZzPZ7GArYkk00nxzTavQSurq+2rQWTI yHgb+De6TA1o26J/WgV7+rHCpFsdj9Y34M/N1ZMa/vbXUSWy0izVIDBSOQhaLZEibdCI k07mfaTx4HT6hdW/ZUY6Yboph2UNePM8zfTqvJPdV4+tFgd3QuQzE0L4NX73bWF9nOrp onPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=SIdC84ST; 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 s23-20020a1709066c9700b009926703c4b9si2473556ejr.413.2023.07.28.04.57.52; Fri, 28 Jul 2023 04:58:18 -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=SIdC84ST; 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 S235552AbjG1KcA (ORCPT + 99 others); Fri, 28 Jul 2023 06:32:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235265AbjG1Kbl (ORCPT ); Fri, 28 Jul 2023 06:31:41 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 986B1524E; Fri, 28 Jul 2023 03:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1690540193; x=1722076193; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=f1dps+oGiDe/KHzYb18t8lFz4154pwNNCSulv4GCbrs=; b=SIdC84STOF9b087VL4m3alBzYCcrG+8TKXrfTSpTuGmLVWafh3qoISsH AEDqtkKyXg/G4gnzANUURsKWAi3QmCPxQ7787FY3U5STakVqnfX96oObc ES7182zY8m0HQSG6tg9RgczFFBBRWp8F8totxJVwD7/6uyfInoiRf2SKZ Q5AJwvSrFBkS1xiEqGu0xRCkLUNHBOBaoGpUir6Fv5kod7Ns9qBFXlelb ngKG/xAb7PK9qnGeXHA3FhA+/rJOVnGqW1c9ZiDgoY/eZuR8jBto4fN6a X+KjUSM8FLAXNKamDyVctdxcgNGq6AEJ4/L77AgGOhSJUsa8AoYsV0cMF Q==; X-IronPort-AV: E=Sophos;i="6.01,237,1684825200"; d="scan'208";a="226623427" 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; 28 Jul 2023 03:29:44 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 28 Jul 2023 03:29:42 -0700 Received: from che-lt-i67070.amer.actel.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Fri, 28 Jul 2023 03:29:38 -0700 From: Varshini Rajendran To: , , , , , , , , , Subject: [PATCH v3 39/50] clk: at91: sama7g5: move mux table macros to header file Date: Fri, 28 Jul 2023 15:59:35 +0530 Message-ID: <20230728102935.267294-1-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.25.1 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Move the mux table init and fill macro function definitions from the sama7g5 pmc driver to the pmc.h header file since they will be used by other SoC's pmc drivers as well like sam9x7. Signed-off-by: Varshini Rajendran --- drivers/clk/at91/pmc.h | 16 ++++++++++++++++ drivers/clk/at91/sama7g5.c | 35 ++++++++++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 91d1c6305d95..4fb29ca111f7 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -121,6 +121,22 @@ struct at91_clk_pms { #define ndck(a, s) (a[s - 1].id + 1) #define nck(a) (a[ARRAY_SIZE(a) - 1].id + 1) + +#define PMC_INIT_TABLE(_table, _count) \ + do { \ + u8 _i; \ + for (_i = 0; _i < (_count); _i++) \ + (_table)[_i] = _i; \ + } while (0) + +#define PMC_FILL_TABLE(_to, _from, _count) \ + do { \ + u8 _i; \ + for (_i = 0; _i < (_count); _i++) { \ + (_to)[_i] = (_from)[_i]; \ + } \ + } while (0) + struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, unsigned int nperiph, unsigned int ngck, unsigned int npck); diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index e6eb5afba93d..6706d1305baa 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -16,21 +16,6 @@ #include "pmc.h" -#define SAMA7G5_INIT_TABLE(_table, _count) \ - do { \ - u8 _i; \ - for (_i = 0; _i < (_count); _i++) \ - (_table)[_i] = _i; \ - } while (0) - -#define SAMA7G5_FILL_TABLE(_to, _from, _count) \ - do { \ - u8 _i; \ - for (_i = 0; _i < (_count); _i++) { \ - (_to)[_i] = (_from)[_i]; \ - } \ - } while (0) - static DEFINE_SPINLOCK(pmc_pll_lock); static DEFINE_SPINLOCK(pmc_mck0_lock); static DEFINE_SPINLOCK(pmc_mckX_lock); @@ -1119,17 +1104,17 @@ static void __init sama7g5_pmc_setup(struct device_node *np) if (!mux_table) goto err_free; - SAMA7G5_INIT_TABLE(mux_table, 3); - SAMA7G5_FILL_TABLE(&mux_table[3], sama7g5_mckx[i].ep_mux_table, - sama7g5_mckx[i].ep_count); + PMC_INIT_TABLE(mux_table, 3); + PMC_FILL_TABLE(&mux_table[3], sama7g5_mckx[i].ep_mux_table, + sama7g5_mckx[i].ep_count); for (j = 0; j < sama7g5_mckx[i].ep_count; j++) { u8 pll_id = sama7g5_mckx[i].ep[j].pll_id; u8 pll_compid = sama7g5_mckx[i].ep[j].pll_compid; tmp_parent_hws[j] = sama7g5_plls[pll_id][pll_compid].hw; } - SAMA7G5_FILL_TABLE(&parent_hws[3], tmp_parent_hws, - sama7g5_mckx[i].ep_count); + PMC_FILL_TABLE(&parent_hws[3], tmp_parent_hws, + sama7g5_mckx[i].ep_count); hw = at91_clk_sama7g5_register_master(regmap, sama7g5_mckx[i].n, num_parents, NULL, parent_hws, mux_table, @@ -1215,17 +1200,17 @@ static void __init sama7g5_pmc_setup(struct device_node *np) if (!mux_table) goto err_free; - SAMA7G5_INIT_TABLE(mux_table, 3); - SAMA7G5_FILL_TABLE(&mux_table[3], sama7g5_gck[i].pp_mux_table, - sama7g5_gck[i].pp_count); + PMC_INIT_TABLE(mux_table, 3); + PMC_FILL_TABLE(&mux_table[3], sama7g5_gck[i].pp_mux_table, + sama7g5_gck[i].pp_count); for (j = 0; j < sama7g5_gck[i].pp_count; j++) { u8 pll_id = sama7g5_gck[i].pp[j].pll_id; u8 pll_compid = sama7g5_gck[i].pp[j].pll_compid; tmp_parent_hws[j] = sama7g5_plls[pll_id][pll_compid].hw; } - SAMA7G5_FILL_TABLE(&parent_hws[3], tmp_parent_hws, - sama7g5_gck[i].pp_count); + PMC_FILL_TABLE(&parent_hws[3], tmp_parent_hws, + sama7g5_gck[i].pp_count); hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, &sama7g5_pcr_layout, -- 2.25.1