Skip to contentSkip to conversation

Add a common macro for creating struct clk_lookup entries

PATCH RESEND New Padmavathi Venna 3 participants 6 messages Oct 11, 2011 – Oct 13, 2011

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover Add a common macro for creating struct clk_lookup entries

From: Padmavathi Venna <[email protected]>

This patchset consolidates the macro that creates 'struct clk_lookup' entries by introducing a common macro 'CLKDEV_INIT' as suggested by Russell King. Few of the platforms have been modified to use this new macro.

I have done the replacement by using python script. I have only build tested for below platforms with existing defconfigs.

Changes since V1:
- Removed "&" and "," from the CLKDEV_INIT macro.
- Replaced the platform specific macros to use the new CLKDEV_INIT macro.
- Rebased the patches on the latest master branch of Linux-Next.

Padmavathi Venna (2):
ARM: CLKDEV: Add Common Macro for clk_lookup
ARM: Using CLKDEV_INIT for creating clk_lookup instance

 arch/arm/mach-davinci/board-dm646x-evm.c |    5 +-
 arch/arm/mach-davinci/clock.h            |    7 --
 arch/arm/mach-davinci/da830.c            |  101 ++++++++++----------
 arch/arm/mach-davinci/da850.c            |   95 ++++++++++----------
 arch/arm/mach-davinci/dm355.c            |   87 +++++++++---------
 arch/arm/mach-davinci/dm365.c            |  113 +++++++++++-----------
 arch/arm/mach-davinci/dm644x.c           |   77 ++++++++--------
 arch/arm/mach-davinci/dm646x.c           |   81 ++++++++--------
 arch/arm/mach-davinci/tnetv107x.c        |  133 +++++++++++++-------------
 arch/arm/mach-ep93xx/clock.c             |   61 ++++++-------
 arch/arm/mach-imx/clock-imx1.c           |   38 +++-----
 arch/arm/mach-imx/clock-imx21.c          |   91 +++++++++----------
 arch/arm/mach-imx/clock-imx25.c          |   79 +++++++---------
 arch/arm/mach-imx/clock-imx27.c          |  111 ++++++++++------------
 arch/arm/mach-imx/clock-imx31.c          |  103 ++++++++++-----------
 arch/arm/mach-imx/clock-imx35.c          |  117 +++++++++++------------
 arch/arm/mach-lpc32xx/clock.c            |   75 +++++++--------
 arch/arm/mach-mx5/clock-mx51-mx53.c      |  149 ++++++++++++++----------------
 arch/arm/mach-mxs/clock-mx23.c           |   39 +++-----
 arch/arm/mach-mxs/clock-mx28.c           |   71 +++++++--------
 arch/arm/mach-tcc8k/clock.c              |  107 ++++++++++-----------
 include/linux/clkdev.h                   |    7 ++
 22 files changed, 838 insertions(+), 909 deletions(-)
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH RESEND v2 1/2 ARM: CLKDEV: Add Common Macro for clk_lookup

From: Padmavathi Venna <[email protected]>

Added a standardized macro CLKDEV_INIT which can used across all the platforms to support clkdev

Suggested by: Russell King <[email protected]>

---
 include/linux/clkdev.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/clkdev.h +7 -0
index 457bcb0..34c9918 100644
@@ -24,6 +24,13 @@ struct clk_lookup {
 	struct clk		*clk;
 };
 
+#define CLKDEV_INIT(d, n, c)	\
+	{	\
+		.dev_id = d,	\
+		.con_id = n,	\
+		.clk = c,	\
+	}
+
 struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
 	const char *dev_fmt, ...);
 
Signature · 1 line
1.7.4.4
#3 lore raw

PATCH RESEND v2 2/2 ARM: Using CLKDEV_INIT for creating clk_lookup instance

In reply to Padmavathi Venna

From: Padmavathi Venna <[email protected]>

Replace platform specific macros that creates struct clk_lookup instance with the new common CLKDEV_INIT macro

Suggested by: Russell King <[email protected]>

---
 arch/arm/mach-davinci/board-dm646x-evm.c |    5 +-
 arch/arm/mach-davinci/clock.h            |    7 --
 arch/arm/mach-davinci/da830.c            |  101 ++++++++++----------
 arch/arm/mach-davinci/da850.c            |   95 ++++++++++----------
 arch/arm/mach-davinci/dm355.c            |   87 +++++++++---------
 arch/arm/mach-davinci/dm365.c            |  113 +++++++++++-----------
 arch/arm/mach-davinci/dm644x.c           |   77 ++++++++--------
 arch/arm/mach-davinci/dm646x.c           |   81 ++++++++--------
 arch/arm/mach-davinci/tnetv107x.c        |  133 +++++++++++++-------------
 arch/arm/mach-ep93xx/clock.c             |   61 ++++++-------
 arch/arm/mach-imx/clock-imx1.c           |   38 +++-----
 arch/arm/mach-imx/clock-imx21.c          |   91 +++++++++----------
 arch/arm/mach-imx/clock-imx25.c          |   79 +++++++---------
 arch/arm/mach-imx/clock-imx27.c          |  111 ++++++++++------------
 arch/arm/mach-imx/clock-imx31.c          |  103 ++++++++++-----------
 arch/arm/mach-imx/clock-imx35.c          |  117 +++++++++++------------
 arch/arm/mach-lpc32xx/clock.c            |   75 +++++++--------
 arch/arm/mach-mx5/clock-mx51-mx53.c      |  149 ++++++++++++++----------------
 arch/arm/mach-mxs/clock-mx23.c           |   39 +++-----
 arch/arm/mach-mxs/clock-mx28.c           |   71 +++++++--------
 arch/arm/mach-tcc8k/clock.c              |  107 ++++++++++-----------
 21 files changed, 831 insertions(+), 909 deletions(-)
arch/arm/mach-davinci/board-dm646x-evm.c +3 -2
index e574d7f..63951d0 100644
@@ -24,6 +24,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/at24.h>
 #include <linux/i2c/pcf857x.h>
+#include <linux/clkdev.h>
 
 #include <media/tvp514x.h>
 
@@ -704,8 +705,8 @@ static struct clk cdce_clk_in = {
 };
 
 static struct clk_lookup cdce_clks[] = {
-	CLK(NULL, "xin", &cdce_clk_in),
-	CLK(NULL, NULL, NULL),
+	CLKDEV_INIT(NULL, "xin", &cdce_clk_in),
+	CLKDEV_INIT(NULL, NULL, NULL),
 };
 
 static void __init cdce_clk_init(void)
arch/arm/mach-davinci/clock.h +0 -7
index a705f36..df153d5 100644
@@ -113,13 +113,6 @@ struct clk {
 #define PSC_SWRSTDISABLE	BIT(6) /* Disable state is SwRstDisable */
 #define PSC_FORCE		BIT(7) /* Force module state transtition */
 
-#define CLK(dev, con, ck) 	\
-	{			\
-		.dev_id = dev,	\
-		.con_id = con,	\
-		.clk = ck,	\
-	}			\
-
 int davinci_clk_init(struct clk_lookup *clocks);
 int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
 				unsigned int mult, unsigned int postdiv);
arch/arm/mach-davinci/da830.c +51 -50

113 lines not on this page · raw message

arch/arm/mach-davinci/da850.c +48 -47

107 lines not on this page · raw message

arch/arm/mach-davinci/dm355.c +44 -43

99 lines not on this page · raw message

arch/arm/mach-davinci/dm365.c +57 -56

125 lines not on this page · raw message

arch/arm/mach-davinci/dm644x.c +39 -38

89 lines not on this page · raw message

arch/arm/mach-davinci/dm646x.c +41 -40

93 lines not on this page · raw message

arch/arm/mach-davinci/tnetv107x.c +67 -66

145 lines not on this page · raw message

arch/arm/mach-ep93xx/clock.c +29 -32

68 lines not on this page · raw message

arch/arm/mach-imx/clock-imx1.c +16 -22
index 4aabeb2..8bdcfa2 100644
@@ -575,29 +575,23 @@ static struct clk rtc_clk = {
 	.parent = &clk32,
 };
 
-#define _REGISTER_CLOCK(d, n, c) \
-	{ \
-		.dev_id = d, \
-		.con_id = n, \
-		.clk = &c, \
-	},
 static struct clk_lookup lookups[] __initdata = {
-	_REGISTER_CLOCK(NULL, "dma", dma_clk)
-	_REGISTER_CLOCK("mx1-camera.0", NULL, csi_clk)
-	_REGISTER_CLOCK(NULL, "mma", mma_clk)
-	_REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk)
-	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("imx1-uart.0", NULL, uart_clk)
-	_REGISTER_CLOCK("imx1-uart.1", NULL, uart_clk)
-	_REGISTER_CLOCK("imx1-uart.2", NULL, uart_clk)
-	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
-	_REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk)
-	_REGISTER_CLOCK("imx1-cspi.1", NULL, spi_clk)
-	_REGISTER_CLOCK("imx-mmc.0", NULL, sdhc_clk)
-	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
-	_REGISTER_CLOCK(NULL, "mshc", mshc_clk)
-	_REGISTER_CLOCK(NULL, "ssi", ssi_clk)
-	_REGISTER_CLOCK("mxc_rtc.0", NULL, rtc_clk)
+	CLKDEV_INIT(NULL, "dma", &dma_clk),
+	CLKDEV_INIT("mx1-camera.0", NULL, &csi_clk),
+	CLKDEV_INIT(NULL, "mma", &mma_clk),
+	CLKDEV_INIT("imx_udc.0", NULL, &usbd_clk),
+	CLKDEV_INIT(NULL, "gpt", &gpt_clk),
+	CLKDEV_INIT("imx1-uart.0", NULL, &uart_clk),
+	CLKDEV_INIT("imx1-uart.1", NULL, &uart_clk),
+	CLKDEV_INIT("imx1-uart.2", NULL, &uart_clk),
+	CLKDEV_INIT("imx-i2c.0", NULL, &i2c_clk),
+	CLKDEV_INIT("imx1-cspi.0", NULL, &spi_clk),
+	CLKDEV_INIT("imx1-cspi.1", NULL, &spi_clk),
+	CLKDEV_INIT("imx-mmc.0", NULL, &sdhc_clk),
+	CLKDEV_INIT("imx-fb.0", NULL, &lcdc_clk),
+	CLKDEV_INIT(NULL, "mshc", &mshc_clk),
+	CLKDEV_INIT(NULL, "ssi", &ssi_clk),
+	CLKDEV_INIT("mxc_rtc.0", NULL, &rtc_clk),
 };
 
 int __init mx1_clocks_init(unsigned long fref)
arch/arm/mach-imx/clock-imx21.c +42 -49

100 lines not on this page · raw message

arch/arm/mach-imx/clock-imx25.c +36 -43

89 lines not on this page · raw message

arch/arm/mach-imx/clock-imx27.c +52 -59

119 lines not on this page · raw message

arch/arm/mach-imx/clock-imx31.c +48 -55

111 lines not on this page · raw message

arch/arm/mach-imx/clock-imx35.c +55 -62

126 lines not on this page · raw message

arch/arm/mach-lpc32xx/clock.c +34 -41

82 lines not on this page · raw message

arch/arm/mach-mx5/clock-mx51-mx53.c +71 -78

168 lines not on this page · raw message

arch/arm/mach-mxs/clock-mx23.c +16 -23
index 0163b6d..7714dc2 100644
@@ -430,32 +430,25 @@ _DEFINE_CLOCK(audio_clk, XTAL, FILT_CLK24M_GATE, &ref_xtal_clk);
 _DEFINE_CLOCK(pwm_clk, XTAL, PWM_CLK24M_GATE, &ref_xtal_clk);
 _DEFINE_CLOCK(clk32k_clk, XTAL, TIMROT_CLK32K_GATE, &ref_xtal_clk);
 
-#define _REGISTER_CLOCK(d, n, c) \
-	{ \
-		.dev_id = d, \
-		.con_id = n, \
-		.clk = &c, \
-	},
-
 static struct clk_lookup lookups[] = {
 	/* for amba bus driver */
-	_REGISTER_CLOCK("duart", "apb_pclk", xbus_clk)
+	CLKDEV_INIT("duart", "apb_pclk", &xbus_clk),
 	/* for amba-pl011 driver */
-	_REGISTER_CLOCK("duart", NULL, uart_clk)
-	_REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
-	_REGISTER_CLOCK("rtc", NULL, rtc_clk)
-	_REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk)
-	_REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk)
-	_REGISTER_CLOCK("mxs-mmc.0", NULL, ssp_clk)
-	_REGISTER_CLOCK("mxs-mmc.1", NULL, ssp_clk)
-	_REGISTER_CLOCK(NULL, "usb", usb_clk)
-	_REGISTER_CLOCK(NULL, "audio", audio_clk)
-	_REGISTER_CLOCK("mxs-pwm.0", NULL, pwm_clk)
-	_REGISTER_CLOCK("mxs-pwm.1", NULL, pwm_clk)
-	_REGISTER_CLOCK("mxs-pwm.2", NULL, pwm_clk)
-	_REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk)
-	_REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk)
-	_REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk)
+	CLKDEV_INIT("duart", NULL, &uart_clk),
+	CLKDEV_INIT("mxs-auart.0", NULL, &uart_clk),
+	CLKDEV_INIT("rtc", NULL, &rtc_clk),
+	CLKDEV_INIT("mxs-dma-apbh", NULL, &hbus_clk),
+	CLKDEV_INIT("mxs-dma-apbx", NULL, &xbus_clk),
+	CLKDEV_INIT("mxs-mmc.0", NULL, &ssp_clk),
+	CLKDEV_INIT("mxs-mmc.1", NULL, &ssp_clk),
+	CLKDEV_INIT(NULL, "usb", &usb_clk),
+	CLKDEV_INIT(NULL, "audio", &audio_clk),
+	CLKDEV_INIT("mxs-pwm.0", NULL, &pwm_clk),
+	CLKDEV_INIT("mxs-pwm.1", NULL, &pwm_clk),
+	CLKDEV_INIT("mxs-pwm.2", NULL, &pwm_clk),
+	CLKDEV_INIT("mxs-pwm.3", NULL, &pwm_clk),
+	CLKDEV_INIT("mxs-pwm.4", NULL, &pwm_clk),
+	CLKDEV_INIT("imx23-fb", NULL, &lcdif_clk),
 };
 
 static int clk_misc_init(void)
arch/arm/mach-mxs/clock-mx28.c +32 -39

80 lines not on this page · raw message

arch/arm/mach-tcc8k/clock.c +50 -57

114 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#4 lore raw

v2 cover Add a common macro for creating struct clk_lookup entries

In reply to Padmavathi Venna
Quoted 6 lines · Padmavathi Venna

From: Padmavathi Venna <[email protected]>

This patchset consolidates the macro that creates 'struct clk_lookup' entries by introducing a common macro 'CLKDEV_INIT' as suggested by Russell King. Few of the platforms have been modified to use this new

macro.

Quoted 2 lines

I have done the replacement by using python script. I have only build

tested

Quoted 11 lines

for below platforms with existing defconfigs.

Changes since V1:
- Removed "&" and "," from the CLKDEV_INIT macro.
- Replaced the platform specific macros to use the new CLKDEV_INIT macro.
- Rebased the patches on the latest master branch of Linux-Next.

Padmavathi Venna (2):
ARM: CLKDEV: Add Common Macro for clk_lookup
ARM: Using CLKDEV_INIT for creating clk_lookup instance

Quoted 9 lines
 arch/arm/mach-davinci/board-dm646x-evm.c |    5 +-
 arch/arm/mach-davinci/clock.h            |    7 --
 arch/arm/mach-davinci/da830.c            |  101 ++++++++++----------
 arch/arm/mach-davinci/da850.c            |   95 ++++++++++----------
 arch/arm/mach-davinci/dm355.c            |   87 +++++++++---------
 arch/arm/mach-davinci/dm365.c            |  113 +++++++++++-----------
 arch/arm/mach-davinci/dm644x.c           |   77 ++++++++--------
 arch/arm/mach-davinci/dm646x.c           |   81 ++++++++--------
 arch/arm/mach-davinci/tnetv107x.c        |  133

+++++++++++++-------------

Quoted 9 lines
 arch/arm/mach-ep93xx/clock.c             |   61 ++++++-------
 arch/arm/mach-imx/clock-imx1.c           |   38 +++-----
 arch/arm/mach-imx/clock-imx21.c          |   91 +++++++++----------
 arch/arm/mach-imx/clock-imx25.c          |   79 +++++++---------
 arch/arm/mach-imx/clock-imx27.c          |  111 ++++++++++------------
 arch/arm/mach-imx/clock-imx31.c          |  103 ++++++++++-----------
 arch/arm/mach-imx/clock-imx35.c          |  117 +++++++++++------------
 arch/arm/mach-lpc32xx/clock.c            |   75 +++++++--------
 arch/arm/mach-mx5/clock-mx51-mx53.c      |  149

++++++++++++++--------------

Quoted 9 lines

--

 arch/arm/mach-mxs/clock-mx23.c           |   39 +++-----
 arch/arm/mach-mxs/clock-mx28.c           |   71 +++++++--------
 arch/arm/mach-tcc8k/clock.c              |  107 ++++++++++-----------
 include/linux/clkdev.h                   |    7 ++
 22 files changed, 838 insertions(+), 909 deletions(-)

--
1.7.4.4

(Cc'ed Arnd)

Looks ok to me and on Samsung stuff also.

If required,

Russell,
Maybe as you know, this is required on upcoming Samsung stuff. Actually it's just change/consolidate on other stuff but add on Samsung stuff. So if you're ok, how about sending this to upstream via arm-soc or your tree in this merge window?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#5 lore raw

v2 cover Add a common macro for creating struct clk_lookup entries

Quoted 5 lines · Kukjin Kim

Russell,
Maybe as you know, this is required on upcoming Samsung stuff. Actually it's just change/consolidate on other stuff but add on Samsung stuff. So if you're ok, how about sending this to upstream via arm-soc or your tree in this merge window?

I think taking the first patch is the right thing before the merge window opens, because that's the one which everything else will depend upon.

The second patch probably needs splitting up between the various SoCs and either submitted to their maintainers or to Arnd after the merge window has closed.

I suspect that we're looking at one of:
a) a matter of days to the merge window opening - though the timing of it (9 days before the kernel summit) doesn't look good, unless it's going to be a short window.
b) -rc9 will persist for the next fortnight
c) we'll see the first 3.x-rc10 kernel.

#2 lore raw

PATCH RESEND v2 1/2 ARM: CLKDEV: Add Common Macro for clk_lookup

In reply to Padmavathi Venna
Quoted 6 lines · Padmavathi Venna

From: Padmavathi Venna <[email protected]>

Added a standardized macro CLKDEV_INIT which can used across all the platforms to support clkdev

Suggested by: Russell King <[email protected]>

Should be Suggested-by: (with a '-' rather than a ' ').

Other than that, it's fine. Please submit to the patch system, thanks.