linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] davinci: da850: move input frequency to board specific files.
@ 2011-05-25  8:37 Christian Riesch
  2011-05-27  9:20 ` [PATCH V2] " Christian Riesch
  0 siblings, 1 reply; 17+ messages in thread
From: Christian Riesch @ 2011-05-25  8:37 UTC (permalink / raw)
  To: linux-arm-kernel

Currently the input frequency of the SoC is hardcoded in the SoC specific
da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide 
range from 12 to 50 MHz, boards with different oscillator/crystal 
frequencies may be built.

This patch moves the definition of the input frequency to the board 
specific files to support boards with oscillator/crystal frequencies other 
than 24 MHz.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
---
 arch/arm/mach-davinci/board-da850-evm.c     |    4 +++-
 arch/arm/mach-davinci/board-mityomapl138.c  |    4 +++-
 arch/arm/mach-davinci/board-omapl138-hawk.c |    4 +++-
 arch/arm/mach-davinci/da850.c               |    7 +++----
 arch/arm/mach-davinci/include/mach/da8xx.h  |    2 +-
 5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index a7b41bf..8984096 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -42,6 +42,8 @@
 #include <mach/aemif.h>
 #include <mach/spi.h>
 
+#define DA850_EVM_REF_FREQ		24000000
+
 #define DA850_EVM_PHY_ID		"0:00"
 #define DA850_LCD_PWR_PIN		GPIO_TO_PIN(2, 8)
 #define DA850_LCD_BL_PIN		GPIO_TO_PIN(2, 15)
@@ -1252,7 +1254,7 @@ console_initcall(da850_evm_console_init);
 
 static void __init da850_evm_map_io(void)
 {
-	da850_init();
+	da850_init(DA850_EVM_REF_FREQ);
 }
 
 MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 606a6f2..58fdabb 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -29,6 +29,8 @@
 #include <mach/mux.h>
 #include <mach/spi.h>
 
+#define MITYOMAPL138_REF_FREQ	24000000
+
 #define MITYOMAPL138_PHY_ID		""
 
 #define FACTORY_CONFIG_MAGIC	0x012C0138
@@ -561,7 +563,7 @@ console_initcall(mityomapl138_console_init);
 
 static void __init mityomapl138_map_io(void)
 {
-	da850_init();
+	da850_init(MITYOMAPL138_REF_FREQ);
 }
 
 MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index 67c38d0..27dd43c 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -21,6 +21,8 @@
 #include <mach/da8xx.h>
 #include <mach/mux.h>
 
+#define HAWKBOARD_REF_FREQ		24000000
+
 #define HAWKBOARD_PHY_ID		"0:07"
 #define DA850_HAWK_MMCSD_CD_PIN		GPIO_TO_PIN(3, 12)
 #define DA850_HAWK_MMCSD_WP_PIN		GPIO_TO_PIN(3, 13)
@@ -334,7 +336,7 @@ console_initcall(omapl138_hawk_console_init);
 
 static void __init omapl138_hawk_map_io(void)
 {
-	da850_init();
+	da850_init(HAWKBOARD_REF_FREQ);
 }
 
 MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 133aac4..0bcdc34 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -39,8 +39,6 @@
 #define DA850_TIMER64P2_BASE	0x01f0c000
 #define DA850_TIMER64P3_BASE	0x01f0d000
 
-#define DA850_REF_FREQ		24000000
-
 #define CFGCHIP3_ASYNC3_CLKSRC	BIT(4)
 #define CFGCHIP3_PLL1_MASTER_LOCK	BIT(5)
 #define CFGCHIP0_PLL_MASTER_LOCK	BIT(4)
@@ -57,7 +55,6 @@ static struct pll_data pll0_data = {
 
 static struct clk ref_clk = {
 	.name		= "ref_clk",
-	.rate		= DA850_REF_FREQ,
 };
 
 static struct clk pll0_clk = {
@@ -1104,10 +1101,12 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.reset_device		= &da8xx_wdt_device,
 };
 
-void __init da850_init(void)
+void __init da850_init(unsigned long ref_clk_rate)
 {
 	unsigned int v;
 
+	ref_clk.rate = ref_clk_rate;
+
 	davinci_common_init(&davinci_soc_info_da850);
 
 	da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index ad64da7..e8e704e 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -70,7 +70,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
 void __init da830_init(void);
-void __init da850_init(void);
+void __init da850_init(unsigned long ref_clk_rate);
 
 int da830_register_edma(struct edma_rsv_info *rsv);
 int da850_register_edma(struct edma_rsv_info *rsv[2]);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-05-25  8:37 [PATCH] davinci: da850: move input frequency to board specific files Christian Riesch
@ 2011-05-27  9:20 ` Christian Riesch
  2011-05-28  9:55   ` Menon, Nishanth
                     ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Christian Riesch @ 2011-05-27  9:20 UTC (permalink / raw)
  To: linux-arm-kernel

From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>

Currently the input frequency of the SoC is hardcoded in the SoC specific
da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
range from 12 to 50 MHz, boards with different oscillator/crystal
frequencies may be built.

This patch allows setting a different input frequency in the board
specific files to support boards with oscillator/crystal frequencies other
than 24 MHz.

Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
---

Hi,
in private email Bob Dunlop suggested to pass a pointer to a small 
structure instead of the frequency value to allow future expansions, 
e.g., for the OPP list. Therefore I submit his patch as V2.
Christian

 arch/arm/mach-davinci/board-da850-evm.c     |    2 +-
 arch/arm/mach-davinci/board-mityomapl138.c  |    2 +-
 arch/arm/mach-davinci/board-omapl138-hawk.c |    2 +-
 arch/arm/mach-davinci/da850.c               |    5 ++++-
 arch/arm/mach-davinci/include/mach/da8xx.h  |    6 +++++-
 5 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index a7b41bf..231ff87 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1252,7 +1252,7 @@ console_initcall(da850_evm_console_init);
 
 static void __init da850_evm_map_io(void)
 {
-	da850_init();
+	da850_init(NULL);
 }
 
 MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 606a6f2..362770c 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -561,7 +561,7 @@ console_initcall(mityomapl138_console_init);
 
 static void __init mityomapl138_map_io(void)
 {
-	da850_init();
+	da850_init(NULL);
 }
 
 MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index 67c38d0..c43a6c3 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -334,7 +334,7 @@ console_initcall(omapl138_hawk_console_init);
 
 static void __init omapl138_hawk_map_io(void)
 {
-	da850_init();
+	da850_init(NULL);
 }
 
 MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 133aac4..ebd0603 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1104,10 +1104,13 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.reset_device		= &da8xx_wdt_device,
 };
 
-void __init da850_init(void)
+void __init da850_init(struct da850_init_board_info *board)
 {
 	unsigned int v;
 
+	if (board && board->ref_clk_rate)
+		ref_clk.rate = board->ref_clk_rate;
+
 	davinci_common_init(&davinci_soc_info_da850);
 
 	da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index ad64da7..66efc5d 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -69,8 +69,12 @@ extern unsigned int da850_max_speed;
 #define DA8XX_AEMIF_CTL_BASE	0x68000000
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
+struct da850_init_board_info {
+	unsigned long ref_clk_rate;
+};
+
 void __init da830_init(void);
-void __init da850_init(void);
+void __init da850_init(struct da850_init_board_info *board);
 
 int da830_register_edma(struct edma_rsv_info *rsv);
 int da850_register_edma(struct edma_rsv_info *rsv[2]);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-05-27  9:20 ` [PATCH V2] " Christian Riesch
@ 2011-05-28  9:55   ` Menon, Nishanth
  2011-05-30  8:23     ` Christian Riesch
  2011-06-01 17:15   ` Nori, Sekhar
  2011-06-06 22:44   ` Kevin Hilman
  2 siblings, 1 reply; 17+ messages in thread
From: Menon, Nishanth @ 2011-05-28  9:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 27, 2011 at 02:20, Christian Riesch
<christian.riesch@omicron.at> wrote:
> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>
> Currently the input frequency of the SoC is hardcoded in the SoC specific
> da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
> range from 12 to 50 MHz, boards with different oscillator/crystal
> frequencies may be built.
>
> This patch allows setting a different input frequency in the board
> specific files to support boards with oscillator/crystal frequencies other
> than 24 MHz.
Curious question: have you considered Documentation/power/opp.txt? Not
entirely sure if that will help, but I am curious to know if there are
reasons why it did not scale for you

Regards,
Nishanth Menon

>
> Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> ---
>
> Hi,
> in private email Bob Dunlop suggested to pass a pointer to a small
> structure instead of the frequency value to allow future expansions,
> e.g., for the OPP list. Therefore I submit his patch as V2.
> Christian
>
> ?arch/arm/mach-davinci/board-da850-evm.c ? ? | ? ?2 +-
> ?arch/arm/mach-davinci/board-mityomapl138.c ?| ? ?2 +-
> ?arch/arm/mach-davinci/board-omapl138-hawk.c | ? ?2 +-
> ?arch/arm/mach-davinci/da850.c ? ? ? ? ? ? ? | ? ?5 ++++-
> ?arch/arm/mach-davinci/include/mach/da8xx.h ?| ? ?6 +++++-
> ?5 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index a7b41bf..231ff87 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -1252,7 +1252,7 @@ console_initcall(da850_evm_console_init);
>
> ?static void __init da850_evm_map_io(void)
> ?{
> - ? ? ? da850_init();
> + ? ? ? da850_init(NULL);
> ?}
>
> ?MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> index 606a6f2..362770c 100644
> --- a/arch/arm/mach-davinci/board-mityomapl138.c
> +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> @@ -561,7 +561,7 @@ console_initcall(mityomapl138_console_init);
>
> ?static void __init mityomapl138_map_io(void)
> ?{
> - ? ? ? da850_init();
> + ? ? ? da850_init(NULL);
> ?}
>
> ?MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
> diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
> index 67c38d0..c43a6c3 100644
> --- a/arch/arm/mach-davinci/board-omapl138-hawk.c
> +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
> @@ -334,7 +334,7 @@ console_initcall(omapl138_hawk_console_init);
>
> ?static void __init omapl138_hawk_map_io(void)
> ?{
> - ? ? ? da850_init();
> + ? ? ? da850_init(NULL);
> ?}
>
> ?MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index 133aac4..ebd0603 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -1104,10 +1104,13 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
> ? ? ? ?.reset_device ? ? ? ? ? = &da8xx_wdt_device,
> ?};
>
> -void __init da850_init(void)
> +void __init da850_init(struct da850_init_board_info *board)
> ?{
> ? ? ? ?unsigned int v;
>
> + ? ? ? if (board && board->ref_clk_rate)
> + ? ? ? ? ? ? ? ref_clk.rate = board->ref_clk_rate;
> +
> ? ? ? ?davinci_common_init(&davinci_soc_info_da850);
>
> ? ? ? ?da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
> diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
> index ad64da7..66efc5d 100644
> --- a/arch/arm/mach-davinci/include/mach/da8xx.h
> +++ b/arch/arm/mach-davinci/include/mach/da8xx.h
> @@ -69,8 +69,12 @@ extern unsigned int da850_max_speed;
> ?#define DA8XX_AEMIF_CTL_BASE ? 0x68000000
> ?#define DA8XX_ARM_RAM_BASE ? ? 0xffff0000
>
> +struct da850_init_board_info {
> + ? ? ? unsigned long ref_clk_rate;
> +};
> +
> ?void __init da830_init(void);
> -void __init da850_init(void);
> +void __init da850_init(struct da850_init_board_info *board);
>
> ?int da830_register_edma(struct edma_rsv_info *rsv);
> ?int da850_register_edma(struct edma_rsv_info *rsv[2]);
> --
> 1.7.0.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-05-28  9:55   ` Menon, Nishanth
@ 2011-05-30  8:23     ` Christian Riesch
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Riesch @ 2011-05-30  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

>From Menon, Nishanth [mailto:nm at ti.com]
> On Fri, May 27, 2011 at 02:20, Christian Riesch 
> <christian.riesch@omicron.at> wrote:
>> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>>
>> Currently the input frequency of the SoC is hardcoded in the SoC
>> specific da850.c file to 24 MHz. Since the SoC accepts input
>> frequencies in a wide range from 12 to 50 MHz, boards with different
>> oscillator/crystal frequencies may be built.
>>
>> This patch allows setting a different input frequency in the board
>> specific files to support boards with oscillator/crystal frequencies
>> other than 24 MHz.
>Curious question: have you considered Documentation/power/opp.txt? Not
>entirely sure if that will help, but I am curious to know if there are
>reasons why it did not scale for you

I took a look at it but I got the impression that the code in mach-davinci does not use your OPP library. Instead the structs that are used for the OPPs are defined locally in arch/arm/mach-davinci/da850.c. The frequency multiplier and divider values are hardcoded there and do not scale with the input clock frequency.

Christian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-05-27  9:20 ` [PATCH V2] " Christian Riesch
  2011-05-28  9:55   ` Menon, Nishanth
@ 2011-06-01 17:15   ` Nori, Sekhar
  2011-06-06 22:44   ` Kevin Hilman
  2 siblings, 0 replies; 17+ messages in thread
From: Nori, Sekhar @ 2011-06-01 17:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 27, 2011 at 14:50:53, Christian Riesch wrote:
> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> 
> Currently the input frequency of the SoC is hardcoded in the SoC specific
> da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
> range from 12 to 50 MHz, boards with different oscillator/crystal
> frequencies may be built.

The same problem was fixed for dm6467/T EVMs with a different approach.

This solution is much better than what was done for dm6467/T.
So I am working on converting the dm6467/T code to this approach
and should be able to post the updated patchset by tomorrow.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-05-27  9:20 ` [PATCH V2] " Christian Riesch
  2011-05-28  9:55   ` Menon, Nishanth
  2011-06-01 17:15   ` Nori, Sekhar
@ 2011-06-06 22:44   ` Kevin Hilman
  2011-06-07 10:39     ` Nori, Sekhar
  2011-06-09 10:05     ` Christian Riesch
  2 siblings, 2 replies; 17+ messages in thread
From: Kevin Hilman @ 2011-06-06 22:44 UTC (permalink / raw)
  To: linux-arm-kernel

Christian Riesch <christian.riesch@omicron.at> writes:

> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>
> Currently the input frequency of the SoC is hardcoded in the SoC specific
> da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
> range from 12 to 50 MHz, boards with different oscillator/crystal
> frequencies may be built.
>
> This patch allows setting a different input frequency in the board
> specific files to support boards with oscillator/crystal frequencies other
> than 24 MHz.
>
> Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>

Why not allow board code to just do a clk_set_rate()?

Currently the ref_clk struct clk does not have a .set_rate method
implemented, but that should be easy enough to add.  

Then the default ref_clk.rate would stay the 24MHz, but any boards that
want to override that simply use clk_get(), clk_set_rate(), clk_put()

Kevin

> ---
>
> Hi,
> in private email Bob Dunlop suggested to pass a pointer to a small 
> structure instead of the frequency value to allow future expansions, 
> e.g., for the OPP list. Therefore I submit his patch as V2.
> Christian
>
>  arch/arm/mach-davinci/board-da850-evm.c     |    2 +-
>  arch/arm/mach-davinci/board-mityomapl138.c  |    2 +-
>  arch/arm/mach-davinci/board-omapl138-hawk.c |    2 +-
>  arch/arm/mach-davinci/da850.c               |    5 ++++-
>  arch/arm/mach-davinci/include/mach/da8xx.h  |    6 +++++-
>  5 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index a7b41bf..231ff87 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -1252,7 +1252,7 @@ console_initcall(da850_evm_console_init);
>  
>  static void __init da850_evm_map_io(void)
>  {
> -	da850_init();
> +	da850_init(NULL);
>  }
>  
>  MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> index 606a6f2..362770c 100644
> --- a/arch/arm/mach-davinci/board-mityomapl138.c
> +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> @@ -561,7 +561,7 @@ console_initcall(mityomapl138_console_init);
>  
>  static void __init mityomapl138_map_io(void)
>  {
> -	da850_init();
> +	da850_init(NULL);
>  }
>  
>  MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
> diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
> index 67c38d0..c43a6c3 100644
> --- a/arch/arm/mach-davinci/board-omapl138-hawk.c
> +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
> @@ -334,7 +334,7 @@ console_initcall(omapl138_hawk_console_init);
>  
>  static void __init omapl138_hawk_map_io(void)
>  {
> -	da850_init();
> +	da850_init(NULL);
>  }
>  
>  MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index 133aac4..ebd0603 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -1104,10 +1104,13 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
>  	.reset_device		= &da8xx_wdt_device,
>  };
>  
> -void __init da850_init(void)
> +void __init da850_init(struct da850_init_board_info *board)
>  {
>  	unsigned int v;
>  
> +	if (board && board->ref_clk_rate)
> +		ref_clk.rate = board->ref_clk_rate;
> +
>  	davinci_common_init(&davinci_soc_info_da850);
>  
>  	da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
> diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
> index ad64da7..66efc5d 100644
> --- a/arch/arm/mach-davinci/include/mach/da8xx.h
> +++ b/arch/arm/mach-davinci/include/mach/da8xx.h
> @@ -69,8 +69,12 @@ extern unsigned int da850_max_speed;
>  #define DA8XX_AEMIF_CTL_BASE	0x68000000
>  #define DA8XX_ARM_RAM_BASE	0xffff0000
>  
> +struct da850_init_board_info {
> +	unsigned long ref_clk_rate;
> +};
> +
>  void __init da830_init(void);
> -void __init da850_init(void);
> +void __init da850_init(struct da850_init_board_info *board);
>  
>  int da830_register_edma(struct edma_rsv_info *rsv);
>  int da850_register_edma(struct edma_rsv_info *rsv[2]);

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-06 22:44   ` Kevin Hilman
@ 2011-06-07 10:39     ` Nori, Sekhar
  2011-06-07 16:23       ` Kevin Hilman
  2011-06-09 10:05     ` Christian Riesch
  1 sibling, 1 reply; 17+ messages in thread
From: Nori, Sekhar @ 2011-06-07 10:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin,

On Tue, Jun 07, 2011 at 04:14:59, Hilman, Kevin wrote:
> Christian Riesch <christian.riesch@omicron.at> writes:
> 
> > From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> >
> > Currently the input frequency of the SoC is hardcoded in the SoC specific
> > da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
> > range from 12 to 50 MHz, boards with different oscillator/crystal
> > frequencies may be built.
> >
> > This patch allows setting a different input frequency in the board
> > specific files to support boards with oscillator/crystal frequencies other
> > than 24 MHz.
> >
> > Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> > Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> 
> Why not allow board code to just do a clk_set_rate()?
> 
> Currently the ref_clk struct clk does not have a .set_rate method
> implemented, but that should be easy enough to add.  
> 
> Then the default ref_clk.rate would stay the 24MHz, but any boards that
> want to override that simply use clk_get(), clk_set_rate(), clk_put()

That's certainly much more elegant, but this would mean the whole
clock tree is traversed again on each boot.

I am doing some measurements to see if there is any big difference
in boot-time if this is done. Will get back with results.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-07 10:39     ` Nori, Sekhar
@ 2011-06-07 16:23       ` Kevin Hilman
  2011-06-08 12:08         ` Nori, Sekhar
  0 siblings, 1 reply; 17+ messages in thread
From: Kevin Hilman @ 2011-06-07 16:23 UTC (permalink / raw)
  To: linux-arm-kernel

"Nori, Sekhar" <nsekhar@ti.com> writes:

> Hi Kevin,
>
> On Tue, Jun 07, 2011 at 04:14:59, Hilman, Kevin wrote:
>> Christian Riesch <christian.riesch@omicron.at> writes:
>> 
>> > From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>> >
>> > Currently the input frequency of the SoC is hardcoded in the SoC specific
>> > da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
>> > range from 12 to 50 MHz, boards with different oscillator/crystal
>> > frequencies may be built.
>> >
>> > This patch allows setting a different input frequency in the board
>> > specific files to support boards with oscillator/crystal frequencies other
>> > than 24 MHz.
>> >
>> > Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>> > Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
>> 
>> Why not allow board code to just do a clk_set_rate()?
>> 
>> Currently the ref_clk struct clk does not have a .set_rate method
>> implemented, but that should be easy enough to add.  
>> 
>> Then the default ref_clk.rate would stay the 24MHz, but any boards that
>> want to override that simply use clk_get(), clk_set_rate(), clk_put()
>
> That's certainly much more elegant, but this would mean the whole
> clock tree is traversed again on each boot.
>
> I am doing some measurements to see if there is any big difference
> in boot-time if this is done. Will get back with results.

I don't expect this to be a big boot-time impact.

However, some of the clock.c assumptions might need to be updated as it
currently is written from the perspective that the PLL clocks are the
"root" clocks.

Setting (and propagating) clock rates is what the clock framework is
for, so adding a new interface to set a custom clock rate just doesn't
seem right.  I understand that the reference oscillator might be
considered a special case, but if this can be done with the clock
framework, it is much preferred.

Kevin

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-07 16:23       ` Kevin Hilman
@ 2011-06-08 12:08         ` Nori, Sekhar
  2011-06-14 15:33           ` Nori, Sekhar
  0 siblings, 1 reply; 17+ messages in thread
From: Nori, Sekhar @ 2011-06-08 12:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 07, 2011 at 21:53:59, Hilman, Kevin wrote:

> I don't expect this to be a big boot-time impact.

You are right. Using PRINTK_TIME on DM365 I saw no noticeable boot-time
change. When I profiled the code using do_gettimeofday(), I saw it
was taking ~95 usecs to complete the propagation. I was mainly worried
about all the recursion and reading of PLL and sysclk registers. Seems
its not so bad.

> However, some of the clock.c assumptions might need to be updated as it
> currently is written from the perspective that the PLL clocks are the
> "root" clocks.

Hmm, just calling clk_set_rate() on refclk propagated the rate
nicely across the tree. It seems DaVinci clock code is not in
such a bad shape :) Or did I miss the concern?

> Setting (and propagating) clock rates is what the clock framework is
> for, so adding a new interface to set a custom clock rate just doesn't
> seem right.  I understand that the reference oscillator might be
> considered a special case, but if this can be done with the clock
> framework, it is much preferred.

Okay. Will modify the DM6467/T EVM code to use this method
instead.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-06 22:44   ` Kevin Hilman
  2011-06-07 10:39     ` Nori, Sekhar
@ 2011-06-09 10:05     ` Christian Riesch
  2011-06-09 16:48       ` Nori, Sekhar
  1 sibling, 1 reply; 17+ messages in thread
From: Christian Riesch @ 2011-06-09 10:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin,

On Tue, Jun 7, 2011 at 12:44 AM, Kevin Hilman <khilman@ti.com> wrote:
> Christian Riesch <christian.riesch@omicron.at> writes:
>
>> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>>
>> Currently the input frequency of the SoC is hardcoded in the SoC specific
>> da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
>> range from 12 to 50 MHz, boards with different oscillator/crystal
>> frequencies may be built.
>>
>> This patch allows setting a different input frequency in the board
>> specific files to support boards with oscillator/crystal frequencies other
>> than 24 MHz.
>>
>> Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
>
> Why not allow board code to just do a clk_set_rate()?

I'm fine with this method (In fact it was the first thing that I
tried, I added a .set_rate method to ref_clk, it worked well for me).
However I wonder whether first initializing the clock with the wrong
value (24 MHz) and later correcting it via clk_set_rate() would break
something. In the meantime, the data in the clock tree do not reflect
the actual frequencies that are present on the SoC.

Christian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-09 10:05     ` Christian Riesch
@ 2011-06-09 16:48       ` Nori, Sekhar
  0 siblings, 0 replies; 17+ messages in thread
From: Nori, Sekhar @ 2011-06-09 16:48 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Christian,

On Thu, Jun 09, 2011 at 15:35:12, Christian Riesch wrote:
> Hi Kevin,
> 
> On Tue, Jun 7, 2011 at 12:44 AM, Kevin Hilman <khilman@ti.com> wrote:
> > Christian Riesch <christian.riesch@omicron.at> writes:
> >
> >> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> >>
> >> Currently the input frequency of the SoC is hardcoded in the SoC specific
> >> da850.c file to 24 MHz. Since the SoC accepts input frequencies in a wide
> >> range from 12 to 50 MHz, boards with different oscillator/crystal
> >> frequencies may be built.
> >>
> >> This patch allows setting a different input frequency in the board
> >> specific files to support boards with oscillator/crystal frequencies other
> >> than 24 MHz.
> >>
> >> Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> >> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> >
> > Why not allow board code to just do a clk_set_rate()?
> 
> I'm fine with this method (In fact it was the first thing that I
> tried, I added a .set_rate method to ref_clk, it worked well for me).
> However I wonder whether first initializing the clock with the wrong
> value (24 MHz) and later correcting it via clk_set_rate() would break
> something. In the meantime, the data in the clock tree do not reflect
> the actual frequencies that are present on the SoC.

Doing this right after <soc>_init() should be safe. The board should not
assume clocks to be setup before this call is made.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-08 12:08         ` Nori, Sekhar
@ 2011-06-14 15:33           ` Nori, Sekhar
  2011-06-14 17:39             ` [PATCH] davinci: da850: add a .set_rate method to ref_clk Christian Riesch
  2011-06-16 15:06             ` [PATCH V2] davinci: da850: move input frequency to board specific files Kevin Hilman
  0 siblings, 2 replies; 17+ messages in thread
From: Nori, Sekhar @ 2011-06-14 15:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 08, 2011 at 17:38:25, Nori, Sekhar wrote:
> On Tue, Jun 07, 2011 at 21:53:59, Hilman, Kevin wrote:
> 
> > I don't expect this to be a big boot-time impact.
> 
> You are right. Using PRINTK_TIME on DM365 I saw no noticeable boot-time
> change. When I profiled the code using do_gettimeofday(), I saw it
> was taking ~95 usecs to complete the propagation. I was mainly worried
> about all the recursion and reading of PLL and sysclk registers. Seems
> its not so bad.
> 
> > However, some of the clock.c assumptions might need to be updated as it
> > currently is written from the perspective that the PLL clocks are the
> > "root" clocks.
> 
> Hmm, just calling clk_set_rate() on refclk propagated the rate
> nicely across the tree. It seems DaVinci clock code is not in
> such a bad shape :) Or did I miss the concern?
> 
> > Setting (and propagating) clock rates is what the clock framework is
> > for, so adding a new interface to set a custom clock rate just doesn't
> > seem right.  I understand that the reference oscillator might be
> > considered a special case, but if this can be done with the clock
> > framework, it is much preferred.
> 
> Okay. Will modify the DM6467/T EVM code to use this method
> instead.

So, here is the patch. I suspect reference clock information
should come from devicetree data when available. I hope it is
OK to take this approach till that time?

Thanks,
Sekhar

-----8<------------
From: Sekhar Nori <nsekhar@ti.com>
Date: Thu, 2 Jun 2011 14:10:50 +0530
Subject: [PATCH 1/1] davinci: dm6467/T EVM: fix setting up of reference clock rate

The DM6467 and DM6467T EVMs use different reference clock
frequencies. This difference is currently supported by having
the SoC code call a public board routine which sets up the reference
clock frequency. This does not scale as more boards are added.

Instead, use the clk_set_rate() API to setup the reference clock
frequency to a different value from the board file.

Suggested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/mach-davinci/board-dm646x-evm.c    |   17 ++++--------
 arch/arm/mach-davinci/clock.c               |   38 +++++++++++++++++++++++++++
 arch/arm/mach-davinci/clock.h               |    2 +
 arch/arm/mach-davinci/dm646x.c              |    4 ++-
 arch/arm/mach-davinci/include/mach/dm646x.h |    2 -
 5 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index f6ac9ba..9db9838 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -719,9 +719,15 @@ static void __init cdce_clk_init(void)
 	}
 }
 
+#define DM6467T_EVM_REF_FREQ		33000000
+
 static void __init davinci_map_io(void)
 {
 	dm646x_init();
+
+	if (machine_is_davinci_dm6467tevm())
+		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
+
 	cdce_clk_init();
 }
 
@@ -785,17 +791,6 @@ static __init void evm_init(void)
 	soc_info->emac_pdata->phy_id = DM646X_EVM_PHY_ID;
 }
 
-#define DM646X_EVM_REF_FREQ		27000000
-#define DM6467T_EVM_REF_FREQ		33000000
-
-void __init dm646x_board_setup_refclk(struct clk *clk)
-{
-	if (machine_is_davinci_dm6467tevm())
-		clk->rate = DM6467T_EVM_REF_FREQ;
-	else
-		clk->rate = DM646X_EVM_REF_FREQ;
-}
-
 MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
 	.boot_params  = (0x80000100),
 	.map_io       = davinci_map_io,
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index e4e3af1..ae65319 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -368,6 +368,12 @@ static unsigned long clk_leafclk_recalc(struct clk *clk)
 	return clk->parent->rate;
 }
 
+int davinci_simple_set_rate(struct clk *clk, unsigned long rate)
+{
+	clk->rate = rate;
+	return 0;
+}
+
 static unsigned long clk_pllclk_recalc(struct clk *clk)
 {
 	u32 ctrl, mult = 1, prediv = 1, postdiv = 1;
@@ -506,6 +512,38 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
 }
 EXPORT_SYMBOL(davinci_set_pllrate);
 
+/**
+ * davinci_set_refclk_rate() - Set the reference clock rate
+ * @rate:	The new rate.
+ *
+ * Sets the reference clock rate to a given value. This will most likely
+ * result in the entire clock tree getting updated.
+ *
+ * This is used to support boards which use a reference clock different
+ * than that used by default in <soc>.c file. The reference clock rate
+ * should be updated early in the boot process; ideally soon after the
+ * clock tree has been initialized once with the default reference clock
+ * rate (davinci_common_init()).
+ *
+ * Returns 0 on success, error otherwise.
+ */
+int davinci_set_refclk_rate(unsigned long rate)
+{
+	struct clk *refclk;
+
+	refclk = clk_get(NULL, "ref");
+	if (IS_ERR(refclk)) {
+		pr_err("%s: failed to get reference clock.\n", __func__);
+		return PTR_ERR(refclk);
+	}
+
+	clk_set_rate(refclk, rate);
+
+	clk_put(refclk);
+
+	return 0;
+}
+
 int __init davinci_clk_init(struct clk_lookup *clocks)
   {
 	struct clk_lookup *c;
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 0dd2203..50b2482 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -123,6 +123,8 @@ 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);
 int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
+int davinci_set_refclk_rate(unsigned long rate);
+int davinci_simple_set_rate(struct clk *clk, unsigned long rate);
 
 extern struct platform_device davinci_wdt_device;
 extern void davinci_watchdog_reset(struct platform_device *);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 1e0f809..46739c9 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -42,6 +42,7 @@
 /*
  * Device specific clocks
  */
+#define DM646X_REF_FREQ		27000000
 #define DM646X_AUX_FREQ		24000000
 
 static struct pll_data pll1_data = {
@@ -56,6 +57,8 @@ static struct pll_data pll2_data = {
 
 static struct clk ref_clk = {
 	.name = "ref_clk",
+	.rate = DM646X_REF_FREQ,
+	.set_rate = davinci_simple_set_rate,
 };
 
 static struct clk aux_clkin = {
@@ -901,7 +904,6 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
 
 void __init dm646x_init(void)
 {
-	dm646x_board_setup_refclk(&ref_clk);
 	davinci_common_init(&davinci_soc_info_dm646x);
 }
 
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index 7a27f3f..2a00fe5 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -15,7 +15,6 @@
 #include <mach/asp.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
-#include <linux/clk.h>
 #include <linux/davinci_emac.h>
 
 #define DM646X_EMAC_BASE		(0x01C80000)
@@ -31,7 +30,6 @@
 void __init dm646x_init(void);
 void __init dm646x_init_mcasp0(struct snd_platform_data *pdata);
 void __init dm646x_init_mcasp1(struct snd_platform_data *pdata);
-void __init dm646x_board_setup_refclk(struct clk *clk);
 int __init dm646x_init_edma(struct edma_rsv_info *rsv);
 
 void dm646x_video_init(void);
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH] davinci: da850: add a .set_rate method to ref_clk
  2011-06-14 15:33           ` Nori, Sekhar
@ 2011-06-14 17:39             ` Christian Riesch
  2011-06-28 11:23               ` Nori, Sekhar
  2011-06-16 15:06             ` [PATCH V2] davinci: da850: move input frequency to board specific files Kevin Hilman
  1 sibling, 1 reply; 17+ messages in thread
From: Christian Riesch @ 2011-06-14 17:39 UTC (permalink / raw)
  To: linux-arm-kernel

This patch allows setting the input clock frequency of the SoC from
the board specific using the davinci_set_refclk_rate function.

Suggested-by: Kevin Hilman <khilman@ti.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
---

This patch applies on top of Sekhar's patch.
Best regards, Christian

 arch/arm/mach-davinci/da850.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 133aac4..27fe3ac 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -58,6 +58,7 @@ static struct pll_data pll0_data = {
 static struct clk ref_clk = {
 	.name		= "ref_clk",
 	.rate		= DA850_REF_FREQ,
+	.set_rate       = davinci_simple_set_rate,
 };
 
 static struct clk pll0_clk = {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH V2] davinci: da850: move input frequency to board specific files
  2011-06-14 15:33           ` Nori, Sekhar
  2011-06-14 17:39             ` [PATCH] davinci: da850: add a .set_rate method to ref_clk Christian Riesch
@ 2011-06-16 15:06             ` Kevin Hilman
  1 sibling, 0 replies; 17+ messages in thread
From: Kevin Hilman @ 2011-06-16 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

"Nori, Sekhar" <nsekhar@ti.com> writes:

> On Wed, Jun 08, 2011 at 17:38:25, Nori, Sekhar wrote:
>> On Tue, Jun 07, 2011 at 21:53:59, Hilman, Kevin wrote:
>> 
>> > I don't expect this to be a big boot-time impact.
>> 
>> You are right. Using PRINTK_TIME on DM365 I saw no noticeable boot-time
>> change. When I profiled the code using do_gettimeofday(), I saw it
>> was taking ~95 usecs to complete the propagation. I was mainly worried
>> about all the recursion and reading of PLL and sysclk registers. Seems
>> its not so bad.
>> 
>> > However, some of the clock.c assumptions might need to be updated as it
>> > currently is written from the perspective that the PLL clocks are the
>> > "root" clocks.
>> 
>> Hmm, just calling clk_set_rate() on refclk propagated the rate
>> nicely across the tree. It seems DaVinci clock code is not in
>> such a bad shape :) Or did I miss the concern?
>> 
>> > Setting (and propagating) clock rates is what the clock framework is
>> > for, so adding a new interface to set a custom clock rate just doesn't
>> > seem right.  I understand that the reference oscillator might be
>> > considered a special case, but if this can be done with the clock
>> > framework, it is much preferred.
>> 
>> Okay. Will modify the DM6467/T EVM code to use this method
>> instead.
>
> So, here is the patch. I suspect reference clock information
> should come from devicetree data when available. I hope it is
> OK to take this approach till that time?
>
> Thanks,
> Sekhar
>
> -----8<------------
> From: Sekhar Nori <nsekhar@ti.com>
> Date: Thu, 2 Jun 2011 14:10:50 +0530
> Subject: [PATCH 1/1] davinci: dm6467/T EVM: fix setting up of reference clock rate
>
> The DM6467 and DM6467T EVMs use different reference clock
> frequencies. This difference is currently supported by having
> the SoC code call a public board routine which sets up the reference
> clock frequency. This does not scale as more boards are added.
>
> Instead, use the clk_set_rate() API to setup the reference clock
> frequency to a different value from the board file.
>
> Suggested-by: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Acked-by: Kevin Hilman <khilman@ti.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] davinci: da850: add a .set_rate method to ref_clk
  2011-06-14 17:39             ` [PATCH] davinci: da850: add a .set_rate method to ref_clk Christian Riesch
@ 2011-06-28 11:23               ` Nori, Sekhar
  2011-06-28 15:10                 ` [PATCH v2] " Christian Riesch
  0 siblings, 1 reply; 17+ messages in thread
From: Nori, Sekhar @ 2011-06-28 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Christian,

On Tue, Jun 14, 2011 at 23:09:17, Christian Riesch wrote:
> This patch allows setting the input clock frequency of the SoC from
> the board specific using the davinci_set_refclk_rate function.

"board specific code"

> 
> Suggested-by: Kevin Hilman <khilman@ti.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> ---
> 
> This patch applies on top of Sekhar's patch.
> Best regards, Christian
> 
>  arch/arm/mach-davinci/da850.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index 133aac4..27fe3ac 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -58,6 +58,7 @@ static struct pll_data pll0_data = {
>  static struct clk ref_clk = {
>  	.name		= "ref_clk",
>  	.rate		= DA850_REF_FREQ,
> +	.set_rate       = davinci_simple_set_rate,

Please use tabs for indentation.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2] davinci: da850: add a .set_rate method to ref_clk
  2011-06-28 11:23               ` Nori, Sekhar
@ 2011-06-28 15:10                 ` Christian Riesch
  2011-07-06 16:36                   ` Nori, Sekhar
  0 siblings, 1 reply; 17+ messages in thread
From: Christian Riesch @ 2011-06-28 15:10 UTC (permalink / raw)
  To: linux-arm-kernel

This patch allows setting the input clock frequency of the SoC from
the board specific code using the davinci_set_refclk_rate function.

Suggested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
---

v2: fixed the commit message and indentation.
Regards, Christian

 arch/arm/mach-davinci/da850.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 133aac4..27fe3ac 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -58,6 +58,7 @@ static struct pll_data pll0_data = {
 static struct clk ref_clk = {
 	.name		= "ref_clk",
 	.rate		= DA850_REF_FREQ,
+	.set_rate	= davinci_simple_set_rate,
 };
 
 static struct clk pll0_clk = {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2] davinci: da850: add a .set_rate method to ref_clk
  2011-06-28 15:10                 ` [PATCH v2] " Christian Riesch
@ 2011-07-06 16:36                   ` Nori, Sekhar
  0 siblings, 0 replies; 17+ messages in thread
From: Nori, Sekhar @ 2011-07-06 16:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Christian,

On Tue, Jun 28, 2011 at 20:40:51, Christian Riesch wrote:
> This patch allows setting the input clock frequency of the SoC from
> the board specific code using the davinci_set_refclk_rate function.
> 
> Suggested-by: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> ---
> 
> v2: fixed the commit message and indentation.
> Regards, Christian
> 
>  arch/arm/mach-davinci/da850.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index 133aac4..27fe3ac 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -58,6 +58,7 @@ static struct pll_data pll0_data = {
>  static struct clk ref_clk = {
>  	.name		= "ref_clk",
>  	.rate		= DA850_REF_FREQ,
> +	.set_rate	= davinci_simple_set_rate,
>  };
>  
>  static struct clk pll0_clk = {

Thanks, will queue this as a 'feature' for
next merge window.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-07-06 16:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25  8:37 [PATCH] davinci: da850: move input frequency to board specific files Christian Riesch
2011-05-27  9:20 ` [PATCH V2] " Christian Riesch
2011-05-28  9:55   ` Menon, Nishanth
2011-05-30  8:23     ` Christian Riesch
2011-06-01 17:15   ` Nori, Sekhar
2011-06-06 22:44   ` Kevin Hilman
2011-06-07 10:39     ` Nori, Sekhar
2011-06-07 16:23       ` Kevin Hilman
2011-06-08 12:08         ` Nori, Sekhar
2011-06-14 15:33           ` Nori, Sekhar
2011-06-14 17:39             ` [PATCH] davinci: da850: add a .set_rate method to ref_clk Christian Riesch
2011-06-28 11:23               ` Nori, Sekhar
2011-06-28 15:10                 ` [PATCH v2] " Christian Riesch
2011-07-06 16:36                   ` Nori, Sekhar
2011-06-16 15:06             ` [PATCH V2] davinci: da850: move input frequency to board specific files Kevin Hilman
2011-06-09 10:05     ` Christian Riesch
2011-06-09 16:48       ` Nori, Sekhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).