ARM: imx: set CKO1 parent clock source in imx6q sabresd
Subsystems (3)
PATCH 2/4 ARM: imx: set CKO1 parent clock source in imx6q sabresd
in imx6q sabresd board, wm8962 uses CKO1 as MCLK. set ahb as CKO1 parent clock source
--- arch/arm/mach-imx/mach-imx6q.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-imx/mach-imx6q.c +32 -0
@@ -151,6 +151,36 @@ static void __init imx6q_sabrelite_init(void)imx6q_sabrelite_cko1_setup (); } +static void __init imx6q_sabresd_cko1_setup (void ) +{ +struct clk *cko1_sel, *ahb, *cko1; +unsigned long rate; + + cko1_sel =clk_get_sys (NULL ,"cko1_sel" ); + ahb =clk_get_sys (NULL ,"ahb" ); + cko1 =clk_get_sys (NULL ,"cko1" ); +if (IS_ERR (cko1_sel) ||IS_ERR (ahb) ||IS_ERR (cko1)) { +pr_err ("cko1 setup failed!\n" ); + goto put_clk; + } +clk_set_parent (cko1_sel, ahb); + rate =clk_round_rate (cko1,24000000 ); +clk_set_rate (cko1, rate); + +return ; +put_clk: +if (!IS_ERR (cko1_sel)) +clk_put (cko1_sel); +if (!IS_ERR (ahb)) +clk_put (ahb); +if (!IS_ERR (cko1)) +clk_put (cko1); +} +static void __init imx6q_sabresd_init (void ) +{ +imx6q_sabresd_cko1_setup (); +} +static void __init imx6q_1588_init (void ) {struct regmap *gpr;
@@ -193,6 +223,8 @@ static void __init imx6q_init_machine(void) {if (of_machine_is_compatible ("fsl,imx6q-sabrelite" ))imx6q_sabrelite_init (); +else if (of_machine_is_compatible ("fsl,imx6q-sabresd" )) +imx6q_sabresd_init ();of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL );
Signature · 1 line
1.7.0.4
Gary,
For arch/arm/ patches, list [email protected] rather than [email protected] should be copied.
One comment blow.
Quoted 31 lines · Gary Zhang
in imx6q sabresd board, wm8962 uses CKO1 as MCLK. set ahb as CKO1 parent clock source
Signed-off-by Gary Zhang <[email protected]>--- arch/arm/mach-imx/mach-imx6q.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)arch/arm/mach-imx/mach-imx6q.c +15
-0@@ -151,6 +151,36 @@ static void __init imx6q_sabrelite_init(void)imx6q_sabrelite_cko1_setup (); } +static void __init imx6q_sabresd_cko1_setup (void ) +{ +struct clk *cko1_sel, *ahb, *cko1; +unsigned long rate; + + cko1_sel =clk_get_sys (NULL ,"cko1_sel" ); + ahb =clk_get_sys (NULL ,"ahb" ); + cko1 =clk_get_sys (NULL ,"cko1" ); +if (IS_ERR (cko1_sel) ||IS_ERR (ahb) ||IS_ERR (cko1)) { +pr_err ("cko1 setup failed!\n" ); + goto put_clk; + } +clk_set_parent (cko1_sel, ahb); + rate =clk_round_rate (cko1,24000000 ); +clk_set_rate (cko1, rate);
arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 178
Quoted 10 lines
arch/arm/mach-imx/mach-imx6q.c +10
-0+ +return ; +put_clk: +if (!IS_ERR (cko1_sel)) +clk_put (cko1_sel); +if (!IS_ERR (ahb)) +clk_put (ahb); +if (!IS_ERR (cko1)) +clk_put (cko1); +}
So the only difference between this function and imx6q_sabrelite_cko1_setup() is the frequency set on cko1? If so, we should consolidate them with frequency passed in as a parameter.
Shawn
Quoted 21 lines
arch/arm/mach-imx/mach-imx6q.c +7
-0+static void __init imx6q_sabresd_init (void ) +{ +imx6q_sabresd_cko1_setup (); +} +static void __init imx6q_1588_init (void ) {struct regmap *gpr;@@ -193,6 +223,8 @@ static void __init imx6q_init_machine(void) {if (of_machine_is_compatible ("fsl,imx6q-sabrelite" ))imx6q_sabrelite_init (); +else if (of_machine_is_compatible ("fsl,imx6q-sabresd" )) +imx6q_sabresd_init ();of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL );Signature · 1 line
1.7.0.4
Shawn,
Thank your feedback, please see the comments inline
Best Regards
Gary
Quoted 8 lines
-----Original Message-----
From: Shawn Guo [mailto:[email protected]]
Sent: Tuesday, January 29, 2013 19:29
To: Zhang Quan-B13634
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/4] ARM: imx: set CKO1 parent clock source in imx6q sabresd
Quoted 4 lines
Gary,
For
arch/arm/patches, list [email protected] rather than [email protected] should be copied.
[Gary-b13634] agree
Quoted 40 lines
One comment blow.
Quoted 36 lines · Gary Zhang
in imx6q sabresd board, wm8962 uses CKO1 as MCLK. set ahb as CKO1 parent clock source
Signed-off-by Gary Zhang <[email protected]>--- arch/arm/mach-imx/mach-imx6q.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-imx/mach-imx6q.cindex 4eb1b3a..ee3f357 100644arch/arm/mach-imx/mach-imx6q.c +20
-0@@ -151,6 +151,36 @@ static void __init imx6q_sabrelite_init(void)imx6q_sabrelite_cko1_setup (); } +static void __init imx6q_sabresd_cko1_setup (void ) { +struct clk *cko1_sel, *ahb, *cko1; +unsigned long rate; + + cko1_sel =clk_get_sys (NULL ,"cko1_sel" ); + ahb =clk_get_sys (NULL ,"ahb" ); + cko1 =clk_get_sys (NULL ,"cko1" ); +if (IS_ERR (cko1_sel) ||IS_ERR (ahb) ||IS_ERR (cko1)) { +pr_err ("cko1 setup failed!\n" ); + goto put_clk; + } +clk_set_parent (cko1_sel, ahb); + rate =clk_round_rate (cko1,24000000 ); +clk_set_rate (cko1, rate); + +return ; +put_clk: +if (!IS_ERR (cko1_sel)) +clk_put (cko1_sel); +if (!IS_ERR (ahb))
Quoted 8 lines
arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 178
Quoted 4 lines
arch/arm/mach-imx/mach-imx6q.c +4
-0+clk_put (ahb); +if (!IS_ERR (cko1)) +clk_put (cko1); +}So the only difference between this function and
imx6q_sabrelite_cko1_setup()is the frequency set on cko1? If so, we should consolidate them with frequency passed in as a parameter.
[Gary-b13634] OK, I will do it.
Quoted 21 lines
Shawn
Quoted 18 lines
arch/arm/mach-imx/mach-imx6q.c +6
-1+static void __init imx6q_sabresd_init (void ) { +imx6q_sabresd_cko1_setup (); +} +static void __init imx6q_1588_init (void ) {struct regmap *gpr;@@ -193,6 +223,8 @@ static void __init imx6q_init_machine(void) {if (of_machine_is_compatible ("fsl,imx6q-sabrelite" ))imx6q_sabrelite_init (); +else if (of_machine_is_compatible ("fsl,imx6q-sabresd" )) +imx6q_sabresd_init ();of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); --1.7.0.4