[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230623203056.689705-11-varshini.rajendran@microchip.com>
Date: Sat, 24 Jun 2023 02:00:21 +0530
From: Varshini Rajendran <varshini.rajendran@...rochip.com>
To: <robh+dt@...nel.org>, <krzysztof.kozlowski+dt@...aro.org>,
<conor+dt@...nel.org>, <nicolas.ferre@...rochip.com>,
<alexandre.belloni@...tlin.com>, <claudiu.beznea@...rochip.com>,
<mturquette@...libre.com>, <sboyd@...nel.org>,
<herbert@...dor.apana.org.au>, <davem@...emloft.net>,
<vkoul@...nel.org>, <tglx@...utronix.de>, <maz@...nel.org>,
<lee@...nel.org>, <ulf.hansson@...aro.org>,
<tudor.ambarus@...aro.org>, <miquel.raynal@...tlin.com>,
<richard@....at>, <vigneshr@...com>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <linus.walleij@...aro.org>,
<p.zabel@...gutronix.de>, <olivia@...enic.com>,
<a.zummo@...ertech.it>, <radu_nicolae.pirea@....ro>,
<richard.genoud@...il.com>, <gregkh@...uxfoundation.org>,
<lgirdwood@...il.com>, <broonie@...nel.org>,
<wim@...ux-watchdog.org>, <linux@...ck-us.net>, <arnd@...db.de>,
<olof@...om.net>, <soc@...nel.org>, <linux@...linux.org.uk>,
<sre@...nel.org>, <jerry.ray@...rochip.com>,
<horatiu.vultur@...rochip.com>, <durai.manickamkr@...rochip.com>,
<varshini.rajendran@...rochip.com>, <andrew@...n.ch>,
<alain.volmat@...s.st.com>, <neil.armstrong@...aro.org>,
<mihai.sain@...rochip.com>, <eugen.hristev@...labora.com>,
<devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-clk@...r.kernel.org>,
<linux-crypto@...r.kernel.org>, <dmaengine@...r.kernel.org>,
<linux-i2c@...r.kernel.org>, <linux-mmc@...r.kernel.org>,
<linux-mtd@...ts.infradead.org>, <netdev@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <linux-rtc@...r.kernel.org>,
<linux-spi@...r.kernel.org>, <linux-serial@...r.kernel.org>,
<alsa-devel@...a-project.org>, <linux-usb@...r.kernel.org>,
<linux-watchdog@...r.kernel.org>, <linux-pm@...r.kernel.org>
CC: <Hari.PrasathGE@...rochip.com>, <cristian.birsan@...rochip.com>,
<balamanikandan.gunasundar@...rochip.com>,
<manikandan.m@...rochip.com>, <dharma.b@...rochip.com>,
<nayabbasha.sayed@...rochip.com>, <balakrishnan.s@...rochip.com>
Subject: [PATCH v2 10/45] clk: at91: sama7g5: move mux table macros to header file
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 <varshini.rajendran@...rochip.com>
---
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 1dd01f30bdee..f3c23ff0da02 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 468a3c5449b5..75011df708cc 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);
@@ -1022,11 +1007,11 @@ 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);
- SAMA7G5_FILL_TABLE(&parent_names[3], sama7g5_mckx[i].ep,
- 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);
+ PMC_FILL_TABLE(&parent_names[3], sama7g5_mckx[i].ep,
+ sama7g5_mckx[i].ep_count);
hw = at91_clk_sama7g5_register_master(regmap, sama7g5_mckx[i].n,
num_parents, parent_names, mux_table,
@@ -1109,11 +1094,11 @@ 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);
- SAMA7G5_FILL_TABLE(&parent_names[3], sama7g5_gck[i].pp,
- 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);
+ PMC_FILL_TABLE(&parent_names[3], sama7g5_gck[i].pp,
+ sama7g5_gck[i].pp_count);
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&sama7g5_pcr_layout,
--
2.25.1
Powered by blists - more mailing lists