Add a common macro for creating struct clk_lookup entries
Subsystems (7)
v2 cover Add a common macro for creating struct clk_lookup entries
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.
Rajeshwari Shinde (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
PATCH v2 1/2 ARM: CLKDEV: Add Common Macro for clk_lookup
Added a standardized macro CLKDEV_INIT which can used across all the platforms to support clkdev
--- include/linux/clkdev.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/clkdev.h +7 -0
@@ -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
PATCH v2 2/2 ARM: Using CLKDEV_INIT for creating clk_lookup instance
In reply to Rajeshwari ShindeReplace platform specific macros that creates struct clk_lookup instance with the new common CLKDEV_INIT macro
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
v2 cover Add a common macro for creating struct clk_lookup entries
In reply to Rajeshwari ShindeQuoted 31 lines · Rajeshwari Shinde
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 theCLKDEV_INITmacro.
- Replaced the platform specific macros to use the newCLKDEV_INITmacro.
- Rebased the patches on the latest master branch of Linux-Next.Rajeshwari Shinde (2):
ARM: CLKDEV: Add Common Macro forclk_lookup
ARM: UsingCLKDEV_INITfor creatingclk_lookupinstancearch/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 ++++++++++-----------
Quoted 9 lines
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(-)
Consider applying the macro to following files too.
CLKDEV_CON_DEV_IDarch/arm/mach-at91/at91cap9.carch/arm/mach-at91/at91rm9200.carch/arm/mach-at91/at91sam9260.carch/arm/mach-at91/at91sam9261.carch/arm/mach-at91/at91sam9263.carch/arm/mach-at91/at91sam9g45.carch/arm/mach-at91/at91sam9rl.carch/arm/mach-at91/clock.h
CLKDEV_CON_IDarch/arm/mach-at91/at91sam9g45.carch/arm/mach-at91/clock.harch/arm/mach-shmobile/clock-sh7367.carch/arm/mach-shmobile/clock-sh7372.carch/arm/mach-shmobile/clock-sh7377.carch/arm/mach-shmobile/clock-sh73a0.c
INIT_CLKREGarch/arm/mach-mmp/clock.harch/arm/mach-mmp/mmp2.carch/arm/mach-mmp/pxa168.carch/arm/mach-mmp/pxa910.carch/arm/mach-pxa/clock.harch/arm/mach-pxa/eseries.carch/arm/mach-pxa/pxa25x.carch/arm/mach-pxa/pxa27x.carch/arm/mach-pxa/pxa300.carch/arm/mach-pxa/pxa320.carch/arm/mach-pxa/pxa3xx.carch/arm/mach-pxa/pxa95x.c
DEF_LOOKUPDEF_LOOKUP_CONarch/arm/mach-u300/clock.c
DEF_CLKLOOKarch/arm/mach-nuc93x/clock.harch/arm/mach-nuc93x/cpu.carch/arm/mach-w90x900/clock.harch/arm/mach-w90x900/cpu.c
CLKarch/arm/mach-ux500/clock.carch/arm/mach-ux500/clock.h
Array unfolded:arch/arm/mach-bcmring/core.carch/arm/mach-integrator/core.carch/arm/mach-integrator/integrator_cp.carch/arm/mach-nomadik/clock.carch/arm/mach-prima2/clock.carch/arm/mach-realview/core.carch/arm/mach-versatile/core.carch/arm/mach-vexpress/ct-ca9x4.carch/arm/mach-vexpress/v2m.carch/arm/mach-spear3xx/clock.carch/arm/mach-spear6xx/clock.carch/arm/mach-pnx4008/clock.carch/arm/mach-tegra/tegra2_clocks.c
Signature · 1 line
Tushar Behera