All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] davinci: dm646x.h: include header files under mach/ after those in linux/
@ 2011-06-02 17:11 Sekhar Nori
  2011-06-02 17:11 ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Sekhar Nori
  0 siblings, 1 reply; 12+ messages in thread
From: Sekhar Nori @ 2011-06-02 17:11 UTC (permalink / raw)
  To: linux-arm-kernel

The general header file inclusion order followed
in the kernel is to include files under linux/
first and then under mach/.

The dm646x.h file has the opposite of this. Fix it.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/mach-davinci/include/mach/dm646x.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index 7a27f3f..5e95b02 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -11,13 +11,14 @@
 #ifndef __ASM_ARCH_DM646X_H
 #define __ASM_ARCH_DM646X_H
 
-#include <mach/hardware.h>
-#include <mach/asp.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <linux/clk.h>
 #include <linux/davinci_emac.h>
 
+#include <mach/hardware.h>
+#include <mach/asp.h>
+
 #define DM646X_EMAC_BASE		(0x01C80000)
 #define DM646X_EMAC_MDIO_BASE		(DM646X_EMAC_BASE + 0x4000)
 #define DM646X_EMAC_CNTRL_OFFSET	(0x0000)
-- 
1.7.3.2

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-02 17:11 [PATCH 1/3] davinci: dm646x.h: include header files under mach/ after those in linux/ Sekhar Nori
@ 2011-06-02 17:11 ` Sekhar Nori
  2011-06-02 17:11   ` [PATCH v3 3/3] davinci: da850: move input frequency to board specific files Sekhar Nori
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Sekhar Nori @ 2011-06-02 17:11 UTC (permalink / raw)
  To: linux-arm-kernel

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

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, pass the reference clock frequency as a parameter
to dm646x_init(). Boards which do not need the default reference
clock changed can pass NULL to this function.

Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
I have marked Bob as the author of this patch since it is essentially
his idea. Hope he doesnt mind that :)

 arch/arm/mach-davinci/board-dm646x-evm.c    |   23 +++++++++++------------
 arch/arm/mach-davinci/dm646x.c              |    6 ++++--
 arch/arm/mach-davinci/include/mach/common.h |   10 ++++++++++
 arch/arm/mach-davinci/include/mach/dm646x.h |    4 ++--
 4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index f6ac9ba..37c49a9 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -719,9 +719,19 @@ static void __init cdce_clk_init(void)
 	}
 }
 
+#define DM646X_EVM_REF_FREQ		27000000
+#define DM6467T_EVM_REF_FREQ		33000000
+
+static struct davinci_board_info dm646x_evm;
+
 static void __init davinci_map_io(void)
 {
-	dm646x_init();
+	if (machine_is_davinci_dm6467tevm())
+		dm646x_evm.ref_clk_rate = DM6467T_EVM_REF_FREQ;
+	else
+		dm646x_evm.ref_clk_rate = DM646X_EVM_REF_FREQ;
+
+	dm646x_init(&dm646x_evm);
 	cdce_clk_init();
 }
 
@@ -785,17 +795,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/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 1e0f809..871af17 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -899,9 +899,11 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
 	return platform_device_register(&dm646x_edma_device);
 }
 
-void __init dm646x_init(void)
+void __init dm646x_init(struct davinci_board_info *board)
 {
-	dm646x_board_setup_refclk(&ref_clk);
+	if (board && board->ref_clk_rate)
+		ref_clk.rate = board->ref_clk_rate;
+
 	davinci_common_init(&davinci_soc_info_dm646x);
 }
 
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index a57cba2..fbe650b 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -83,6 +83,16 @@ struct davinci_soc_info {
 
 extern struct davinci_soc_info davinci_soc_info;
 
+/*
+ * DaVinci board info.
+ *
+ * This structure is used to pass board information to
+ * early SoC specific initialization code.
+ */
+struct davinci_board_info {
+	unsigned long ref_clk_rate;
+};
+
 extern void davinci_common_init(struct davinci_soc_info *soc_info);
 extern void davinci_init_ide(void);
 
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index 5e95b02..b92db82 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/davinci_emac.h>
 
+#include <mach/common.h>
 #include <mach/hardware.h>
 #include <mach/asp.h>
 
@@ -29,10 +30,9 @@
 #define DM646X_ASYNC_EMIF_CONTROL_BASE	0x20008000
 #define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000
 
-void __init dm646x_init(void);
+void __init dm646x_init(struct davinci_board_info *board);
 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] 12+ messages in thread

* [PATCH v3 3/3] davinci: da850: move input frequency to board specific files
  2011-06-02 17:11 ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Sekhar Nori
@ 2011-06-02 17:11   ` Sekhar Nori
  2011-06-02 18:01   ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Olof Johansson
  2011-06-05 13:00   ` Sergei Shtylyov
  2 siblings, 0 replies; 12+ messages in thread
From: Sekhar Nori @ 2011-06-02 17:11 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>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 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  |    3 ++-
 5 files changed, 9 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..7f94d77 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 davinci_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..90227ce 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -17,6 +17,7 @@
 #include <linux/davinci_emac.h>
 #include <linux/spi/spi.h>
 
+#include <mach/common.h>
 #include <mach/serial.h>
 #include <mach/edma.h>
 #include <mach/i2c.h>
@@ -70,7 +71,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(struct davinci_board_info *info);
 
 int da830_register_edma(struct edma_rsv_info *rsv);
 int da850_register_edma(struct edma_rsv_info *rsv[2]);
-- 
1.7.3.2

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-02 17:11 ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Sekhar Nori
  2011-06-02 17:11   ` [PATCH v3 3/3] davinci: da850: move input frequency to board specific files Sekhar Nori
@ 2011-06-02 18:01   ` Olof Johansson
  2011-06-03 11:32     ` Nori, Sekhar
  2011-06-05 13:00   ` Sergei Shtylyov
  2 siblings, 1 reply; 12+ messages in thread
From: Olof Johansson @ 2011-06-02 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, Jun 2, 2011 at 10:11 AM, Sekhar Nori <nsekhar@ti.com> wrote:
> From: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
>
> 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, pass the reference clock frequency as a parameter
> to dm646x_init(). Boards which do not need the default reference
> clock changed can pass NULL to this function.
>
> Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> I have marked Bob as the author of this patch since it is essentially
> his idea. Hope he doesnt mind that :)
>
> ?arch/arm/mach-davinci/board-dm646x-evm.c ? ?| ? 23 +++++++++++------------
> ?arch/arm/mach-davinci/dm646x.c ? ? ? ? ? ? ?| ? ?6 ++++--
> ?arch/arm/mach-davinci/include/mach/common.h | ? 10 ++++++++++
> ?arch/arm/mach-davinci/include/mach/dm646x.h | ? ?4 ++--
> ?4 files changed, 27 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
> index f6ac9ba..37c49a9 100644
> --- a/arch/arm/mach-davinci/board-dm646x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
> @@ -719,9 +719,19 @@ static void __init cdce_clk_init(void)
> ? ? ? ?}
> ?}
>
> +#define DM646X_EVM_REF_FREQ ? ? ? ? ? ?27000000
> +#define DM6467T_EVM_REF_FREQ ? ? ? ? ? 33000000
> +
> +static struct davinci_board_info dm646x_evm;
> +
> ?static void __init davinci_map_io(void)
> ?{
> - ? ? ? dm646x_init();
> + ? ? ? if (machine_is_davinci_dm6467tevm())
> + ? ? ? ? ? ? ? dm646x_evm.ref_clk_rate = DM6467T_EVM_REF_FREQ;
> + ? ? ? else
> + ? ? ? ? ? ? ? dm646x_evm.ref_clk_rate = DM646X_EVM_REF_FREQ;
> +
> + ? ? ? dm646x_init(&dm646x_evm);


Do you foresee needing more members of the davinci_board_info struct
in the near future? If so, this approach is OK. If this is the only
anticipated use today, just passing in the refclk rate as an integer
argument would be just as clean, with less infrastructure.


-Olof

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-02 18:01   ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Olof Johansson
@ 2011-06-03 11:32     ` Nori, Sekhar
  2011-06-03 16:59       ` Olof Johansson
  0 siblings, 1 reply; 12+ messages in thread
From: Nori, Sekhar @ 2011-06-03 11:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Olof,

On Thu, Jun 02, 2011 at 23:31:05, Olof Johansson wrote:

> Do you foresee needing more members of the davinci_board_info struct
> in the near future? If so, this approach is OK. If this is the only
> anticipated use today, just passing in the refclk rate as an integer
> argument would be just as clean, with less infrastructure.

There was some discussion on passing PLL configuration information too.
So yes, the structure is likely extended in future.

Also, most boards end up using the reference clock used by the EVM.
In that case, with this approach, most boards just pass NULL instead of
replicating the reference clock frequency in all board files.

Thanks,
Sekhar

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-03 11:32     ` Nori, Sekhar
@ 2011-06-03 16:59       ` Olof Johansson
  2011-06-05 11:24         ` Nori, Sekhar
  0 siblings, 1 reply; 12+ messages in thread
From: Olof Johansson @ 2011-06-03 16:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Jun 3, 2011 at 4:32 AM, Nori, Sekhar <nsekhar@ti.com> wrote:
> Hi Olof,
>
> On Thu, Jun 02, 2011 at 23:31:05, Olof Johansson wrote:
>
>> Do you foresee needing more members of the davinci_board_info struct
>> in the near future? If so, this approach is OK. If this is the only
>> anticipated use today, just passing in the refclk rate as an integer
>> argument would be just as clean, with less infrastructure.
>
> There was some discussion on passing PLL configuration information too.
> So yes, the structure is likely extended in future.
>
> Also, most boards end up using the reference clock used by the EVM.
> In that case, with this approach, most boards just pass NULL instead of
> replicating the reference clock frequency in all board files.

OK, that sounds reasonable.

Only change I would like to request in that case (sorry, not
commenting on the patch directly here), is to mark dm646x_evm
__initdata (or even make it a local variable in the function), so for
multiboard kernels you won't need to keep the static struct around for
hardware you're not running on.


-Olof

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-03 16:59       ` Olof Johansson
@ 2011-06-05 11:24         ` Nori, Sekhar
  0 siblings, 0 replies; 12+ messages in thread
From: Nori, Sekhar @ 2011-06-05 11:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 03, 2011 at 22:29:26, Olof Johansson wrote:

> Only change I would like to request in that case (sorry, not
> commenting on the patch directly here), is to mark dm646x_evm
> __initdata (or even make it a local variable in the function), so for
> multiboard kernels you won't need to keep the static struct around for
> hardware you're not running on.
> 

Fixed that and sent a new version. Thanks for the review.

Regards,
Sekhar

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-02 17:11 ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Sekhar Nori
  2011-06-02 17:11   ` [PATCH v3 3/3] davinci: da850: move input frequency to board specific files Sekhar Nori
  2011-06-02 18:01   ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Olof Johansson
@ 2011-06-05 13:00   ` Sergei Shtylyov
  2011-06-06 11:31     ` Nori, Sekhar
  2 siblings, 1 reply; 12+ messages in thread
From: Sergei Shtylyov @ 2011-06-05 13:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 02-06-2011 21:11, Sekhar Nori wrote:

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

> 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, pass the reference clock frequency as a parameter
> to dm646x_init(). Boards which do not need the default reference
> clock changed can pass NULL to this function.

> Signed-off-by: Bob Dunlop<bob.dunlop@xyzzy.org.uk>
> Signed-off-by: Sekhar Nori<nsekhar@ti.com>
> ---
> I have marked Bob as the author of this patch since it is essentially
> his idea. Hope he doesnt mind that :)

    I don't think you should ascribe *your* patch to Bob. There's 
Suggested-by: line if you want to credit Bob.

WBR, Sergei

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-05 13:00   ` Sergei Shtylyov
@ 2011-06-06 11:31     ` Nori, Sekhar
  2011-06-06 12:25       ` Bob Dunlop
  0 siblings, 1 reply; 12+ messages in thread
From: Nori, Sekhar @ 2011-06-06 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 05, 2011 at 18:30:04, Sergei Shtylyov wrote:
> Hello.
> 
> On 02-06-2011 21:11, Sekhar Nori wrote:
> 
> > From: Bob Dunlop<bob.dunlop@xyzzy.org.uk>
> 
> > 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, pass the reference clock frequency as a parameter
> > to dm646x_init(). Boards which do not need the default reference
> > clock changed can pass NULL to this function.
> 
> > Signed-off-by: Bob Dunlop<bob.dunlop@xyzzy.org.uk>
> > Signed-off-by: Sekhar Nori<nsekhar@ti.com>
> > ---
> > I have marked Bob as the author of this patch since it is essentially
> > his idea. Hope he doesnt mind that :)
> 
>     I don't think you should ascribe *your* patch to Bob. There's 
> Suggested-by: line if you want to credit Bob.

Well, in this case I actually took a patch authored by Bob, split
it into two and moved around the code to other files. But there is
also code written by me included in this patch.

Bob, do you have an opinion on this? If not, I will go with what
Sergei is suggesting.

Thanks,
Sekhar

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-06 11:31     ` Nori, Sekhar
@ 2011-06-06 12:25       ` Bob Dunlop
  2011-06-06 13:02         ` Nori, Sekhar
  0 siblings, 1 reply; 12+ messages in thread
From: Bob Dunlop @ 2011-06-06 12:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Mon, Jun 06 at 05:01, Nori, Sekhar wrote:
> On Sun, Jun 05, 2011 at 18:30:04, Sergei Shtylyov wrote:
> >     I don't think you should ascribe *your* patch to Bob. There's 
> > Suggested-by: line if you want to credit Bob.
> 
> Bob, do you have an opinion on this? If not, I will go with what
> Sergei is suggesting.

I have no problem one way or the other, we all know who we are.

Anyway I'd like to propose a simpler patch that covers both boards in one.
Fewer files touched than the original da850 patch.

Add the ref_clk_rate parameter to the davinci_soc_info structure and
perform the clock adjustment in davinci_common_init().  The code assumes
that if which to tweak the ref_clk it will be the first one listed in
cpu_clocks[] which is the case for all boards sofar.

The only downside is you need to export the davinci_soc_info_dm646x struct
in order to tweak it.

I don't have a dm646x to test this with.
Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>



diff -Naur linux-2.6-arm-orig/arch/arm/mach-davinci//board-dm646x-evm.c linux-2.6-arm/arch/arm/mach-davinci//board-dm646x-evm.c
--- linux-2.6-arm-orig/arch/arm/mach-davinci//board-dm646x-evm.c	2011-02-09 08:37:02.000000000 +0000
+++ linux-2.6-arm/arch/arm/mach-davinci//board-dm646x-evm.c	2011-06-06 12:30:12.000000000 +0100
@@ -719,8 +719,16 @@
 	}
 }
 
+#define DM646X_EVM_REF_FREQ            27000000
+#define DM6467T_EVM_REF_FREQ           33000000
+
 static void __init davinci_map_io(void)
 {
+	if (machine_is_davinci_dm6467tevm())
+		davinci_soc_info_dm646x.ref_clk_rate = DM6467T_EVM_REF_FREQ;
+	else
+		davinci_soc_info_dm646x.ref_clk_rate = DM646X_EVM_REF_FREQ;
+
 	dm646x_init();
 	cdce_clk_init();
 }
@@ -785,17 +793,6 @@
 	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 -Naur linux-2.6-arm-orig/arch/arm/mach-davinci//common.c linux-2.6-arm/arch/arm/mach-davinci//common.c
--- linux-2.6-arm-orig/arch/arm/mach-davinci//common.c	2011-02-09 08:37:02.000000000 +0000
+++ linux-2.6-arm/arch/arm/mach-davinci//common.c	2011-06-06 12:00:14.000000000 +0100
@@ -106,6 +106,10 @@
 		goto err;
 
 	if (davinci_soc_info.cpu_clks) {
+		if(davinci_soc_info.ref_clk_rate)
+			davinci_soc_info.cpu_clks->clk->rate
+					= davinci_soc_info.ref_clk_rate;
+
 		ret = davinci_clk_init(davinci_soc_info.cpu_clks);
 
 		if (ret != 0)
diff -Naur linux-2.6-arm-orig/arch/arm/mach-davinci//dm646x.c linux-2.6-arm/arch/arm/mach-davinci//dm646x.c
--- linux-2.6-arm-orig/arch/arm/mach-davinci//dm646x.c	2011-02-09 08:37:02.000000000 +0000
+++ linux-2.6-arm/arch/arm/mach-davinci//dm646x.c	2011-06-06 12:24:25.000000000 +0100
@@ -825,7 +825,7 @@
 	},
 };
 
-static struct davinci_soc_info davinci_soc_info_dm646x = {
+struct davinci_soc_info davinci_soc_info_dm646x = {
 	.io_desc		= dm646x_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm646x_io_desc),
 	.jtag_id_reg		= 0x01c40028,
@@ -901,7 +901,6 @@
 
 void __init dm646x_init(void)
 {
-	dm646x_board_setup_refclk(&ref_clk);
 	davinci_common_init(&davinci_soc_info_dm646x);
 }
 
diff -Naur linux-2.6-arm-orig/arch/arm/mach-davinci//include/mach/common.h linux-2.6-arm/arch/arm/mach-davinci//include/mach/common.h
--- linux-2.6-arm-orig/arch/arm/mach-davinci//include/mach/common.h	2011-02-09 08:37:02.000000000 +0000
+++ linux-2.6-arm/arch/arm/mach-davinci//include/mach/common.h	2011-06-06 11:52:56.000000000 +0100
@@ -79,6 +79,7 @@
 	unsigned			sram_len;
 	struct platform_device		*reset_device;
 	void				(*reset)(struct platform_device *);
+	unsigned long			ref_clk_rate;
 };
 
 extern struct davinci_soc_info davinci_soc_info;
diff -Naur linux-2.6-arm-orig/arch/arm/mach-davinci//include/mach/dm646x.h linux-2.6-arm/arch/arm/mach-davinci//include/mach/dm646x.h
--- linux-2.6-arm-orig/arch/arm/mach-davinci//include/mach/dm646x.h	2011-02-09 08:37:02.000000000 +0000
+++ linux-2.6-arm/arch/arm/mach-davinci//include/mach/dm646x.h	2011-06-06 12:23:02.000000000 +0100
@@ -31,7 +31,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);
@@ -92,3 +91,5 @@
 		       struct vpif_capture_config *);
 
+extern struct davinci_soc_info davinci_soc_info_dm646x;
+
 #endif /* __ASM_ARCH_DM646X_H */

-- 
        Bob Dunlop

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-06 12:25       ` Bob Dunlop
@ 2011-06-06 13:02         ` Nori, Sekhar
  2011-06-07  7:41           ` Bob Dunlop
  0 siblings, 1 reply; 12+ messages in thread
From: Nori, Sekhar @ 2011-06-06 13:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bob,

On Mon, Jun 06, 2011 at 17:55:52, Bob Dunlop wrote:
> Hi,
> 
> On Mon, Jun 06 at 05:01, Nori, Sekhar wrote:
> > On Sun, Jun 05, 2011 at 18:30:04, Sergei Shtylyov wrote:
> > >     I don't think you should ascribe *your* patch to Bob. There's 
> > > Suggested-by: line if you want to credit Bob.
> > 
> > Bob, do you have an opinion on this? If not, I will go with what
> > Sergei is suggesting.
> 
> I have no problem one way or the other, we all know who we are.

Okay, I will do what Sergei is suggesting then.

> 
> Anyway I'd like to propose a simpler patch that covers both boards in one.
> Fewer files touched than the original da850 patch.
> 
> Add the ref_clk_rate parameter to the davinci_soc_info structure and
> perform the clock adjustment in davinci_common_init().  The code assumes

Lets not extend davinci_soc_info any further. We need to be looking
at ways of reducing its usage (for example by making GPIO code use
platform device).

Also, refclk is a board information not soc information so placing
it there makes it misplaced.

> that if which to tweak the ref_clk it will be the first one listed in
> cpu_clocks[] which is the case for all boards sofar.
> 
> The only downside is you need to export the davinci_soc_info_dm646x struct
> in order to tweak it.

That's not very elegant as well. SoC information structure for a given
SoC should be private to the SoC specific file. Making it public will
open it up for abuse.

Thanks,
Sekhar

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

* [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init()
  2011-06-06 13:02         ` Nori, Sekhar
@ 2011-06-07  7:41           ` Bob Dunlop
  0 siblings, 0 replies; 12+ messages in thread
From: Bob Dunlop @ 2011-06-07  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 06 at 06:32, Nori, Sekhar wrote:
...
> > Add the ref_clk_rate parameter to the davinci_soc_info structure and
> > perform the clock adjustment in davinci_common_init().  The code assumes
> 
> Lets not extend davinci_soc_info any further. We need to be looking
> at ways of reducing its usage (for example by making GPIO code use
> platform device).
> 
> Also, refclk is a board information not soc information so placing
> it there makes it misplaced.

Okay let's drop this idea.  I must admit I was concerned about opening
up the structure availability.

-- 
        Bob Dunlop

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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-02 17:11 [PATCH 1/3] davinci: dm646x.h: include header files under mach/ after those in linux/ Sekhar Nori
2011-06-02 17:11 ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Sekhar Nori
2011-06-02 17:11   ` [PATCH v3 3/3] davinci: da850: move input frequency to board specific files Sekhar Nori
2011-06-02 18:01   ` [PATCH 2/3] davinci: dm6467/T EVM: pass reference clock rate to dm646x_init() Olof Johansson
2011-06-03 11:32     ` Nori, Sekhar
2011-06-03 16:59       ` Olof Johansson
2011-06-05 11:24         ` Nori, Sekhar
2011-06-05 13:00   ` Sergei Shtylyov
2011-06-06 11:31     ` Nori, Sekhar
2011-06-06 12:25       ` Bob Dunlop
2011-06-06 13:02         ` Nori, Sekhar
2011-06-07  7:41           ` Bob Dunlop

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.