All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP2+: don't try to register the main clock twice.
@ 2014-03-28 11:50 Wolfram Sang
  2014-04-11 18:33 ` Paul Walmsley
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2014-03-28 11:50 UTC (permalink / raw)
  To: linux-omap
  Cc: Benoit Cousson, Tony Lindgren, Paul Walmsley, NeilBrown, Wolfram Sang

From: NeilBrown <neilb@suse.de>

If omap_device_alloc is given 2 or more "struct omap_hwmod" it will try
to register the 'main_clk' of each of them with the same alias - "fck" -
against the same device.  This fails. So to avoid a warning, don't even
try.

Signed-off-by: NeilBrown <neilb@suse.de>
[wsa: ported to top-of-tree]
Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>
---

Digged this out from the net and think this makes sense. I am going to use it
with an AM335x based board. Based on v3.14-rc8.

 arch/arm/mach-omap2/omap_device.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 01ef59def44b..ce132d0084d2 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -84,6 +84,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
  * and main clock
  * @od: struct omap_device *od
  * @oh: struct omap_hwmod *oh
+ * @sub: if > 0, this is a subordinate device, so don't try to register fck
  *
  * For the main clock and every optional clock present per hwmod per
  * omap_device, this function adds an entry in the clkdev table of the
@@ -99,11 +100,12 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
  * No return value.
  */
 static void _add_hwmod_clocks_clkdev(struct omap_device *od,
-				     struct omap_hwmod *oh)
+				     struct omap_hwmod *oh, int sub)
 {
 	int i;
 
-	_add_clkdev(od, "fck", oh->main_clk);
+	if (!sub)
+		_add_clkdev(od, "fck", oh->main_clk);
 
 	for (i = 0; i < oh->opt_clks_cnt; i++)
 		_add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk);
@@ -468,7 +470,7 @@ have_everything:
 
 	for (i = 0; i < oh_cnt; i++) {
 		hwmods[i]->od = od;
-		_add_hwmod_clocks_clkdev(od, hwmods[i]);
+		_add_hwmod_clocks_clkdev(od, hwmods[i], i);
 	}
 
 	return od;
-- 
1.9.0


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

* Re: [PATCH] ARM: OMAP2+: don't try to register the main clock twice.
  2014-03-28 11:50 [PATCH] ARM: OMAP2+: don't try to register the main clock twice Wolfram Sang
@ 2014-04-11 18:33 ` Paul Walmsley
  2014-04-17  8:55   ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Walmsley @ 2014-04-11 18:33 UTC (permalink / raw)
  To: Wolfram Sang, NeilBrown
  Cc: linux-omap, Benoit Cousson, Tony Lindgren, Wolfram Sang

Hi Wolfram, Neil,

On Fri, 28 Mar 2014, Wolfram Sang wrote:

> From: NeilBrown <neilb@suse.de>
> 
> If omap_device_alloc is given 2 or more "struct omap_hwmod" it will try
> to register the 'main_clk' of each of them with the same alias - "fck" -
> against the same device.  This fails. So to avoid a warning, don't even
> try.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>
> [wsa: ported to top-of-tree]
> Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>

What devices and hwmods cause this warning on AM335x?   Ideally, there 
should only be one hwmod per device.  Usually when multiple hwmods are 
stacked up for a device, it means that something isn't right - either the 
hwmod data, or the device driver itself. 

In the specific context of this patch, the problem would be: what if the 
two hwmods have different main_clk entries?  Which one should be 
associated with the "fck" alias?


- Paul

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

* Re: [PATCH] ARM: OMAP2+: don't try to register the main clock twice.
  2014-04-11 18:33 ` Paul Walmsley
@ 2014-04-17  8:55   ` Wolfram Sang
  2014-05-07 23:20     ` Paul Walmsley
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2014-04-17  8:55 UTC (permalink / raw)
  To: Paul Walmsley
  Cc: NeilBrown, linux-omap, Benoit Cousson, Tony Lindgren, Wolfram Sang

[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]

Hi Paul,

thanks for the reply!

> > If omap_device_alloc is given 2 or more "struct omap_hwmod" it will try
> > to register the 'main_clk' of each of them with the same alias - "fck" -
> > against the same device.  This fails. So to avoid a warning, don't even
> > try.
> > 
> > Signed-off-by: NeilBrown <neilb@suse.de>
> > [wsa: ported to top-of-tree]
> > Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>
> 
> What devices and hwmods cause this warning on AM335x?   Ideally, there 
> should only be one hwmod per device.  Usually when multiple hwmods are 
> stacked up for a device, it means that something isn't right - either the 
> hwmod data, or the device driver itself. 

I applied the patch because of the edma driver DT entry for the am335x.
Check am33xx.dtsi, it has multiple hwmods. I also get this message
printed for the d_can driver with am335x; they have two entries in
drivers/clk/ti/clk-33xx.c. Probably as a workaround to match the desired
clock name for the d_can driver? Didn't really investigate yet.

> In the specific context of this patch, the problem would be: what if the 
> two hwmods have different main_clk entries?  Which one should be 
> associated with the "fck" alias?

Sadly, I am in a board bringup phase and can't really contribute to the
discussions. Lots of other issues to tackle at the moment.

All the best,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] ARM: OMAP2+: don't try to register the main clock twice.
  2014-04-17  8:55   ` Wolfram Sang
@ 2014-05-07 23:20     ` Paul Walmsley
  2014-05-08  7:02       ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Walmsley @ 2014-05-07 23:20 UTC (permalink / raw)
  To: Wolfram Sang, mporter, Benoit Cousson, joelagnel
  Cc: NeilBrown, linux-omap, Tony Lindgren, Wolfram Sang

(+ Matt Porter, Joel Fernandes)

Hi Wolfram,

On Thu, 17 Apr 2014, Wolfram Sang wrote:

> thanks for the reply!

Always good to hear from you - 

> > > If omap_device_alloc is given 2 or more "struct omap_hwmod" it will try
> > > to register the 'main_clk' of each of them with the same alias - "fck" -
> > > against the same device.  This fails. So to avoid a warning, don't even
> > > try.
> > > 
> > > Signed-off-by: NeilBrown <neilb@suse.de>
> > > [wsa: ported to top-of-tree]
> > > Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>
> > 
> > What devices and hwmods cause this warning on AM335x?   Ideally, there 
> > should only be one hwmod per device.  Usually when multiple hwmods are 
> > stacked up for a device, it means that something isn't right - either the 
> > hwmod data, or the device driver itself. 
> 
> I applied the patch because of the edma driver DT entry for the am335x.
> Check am33xx.dtsi, it has multiple hwmods. 

I just took a look at the EDMA DT data vis-a-vis SPRUH73J Section 11.2.2 
"Third-Party Transfer Controller (TPTC) Integration".  This section 
clearly indicates that the TPTCs have their own L3 Fast Interconnect slave 
ports, marked as "CFG Slave".  Cross-checking this with Table 2-1 "L3 
Memory Map" indeed indicates that these three devices have their own 1MB 
physical address ranges hanging off the L3.

So the EDMA DT data is flat-out wrong here and should not have been 
merged.  Looks like it was added by commit 
505975d3802f8d3a3c0905f38056213d06997b36 ("ARM: dts: AM33XX: Add EDMA 
support").  Matt, Joel, could you please fix this data?  The TPTCs are 
separate IP blocks with separate address ranges and MPU IRQs and should 
have separate DT nodes.

> I also get this message printed for the d_can driver with am335x; they 
> have two entries in drivers/clk/ti/clk-33xx.c. Probably as a workaround 
> to match the desired clock name for the d_can driver? Didn't really 
> investigate yet.

That's pretty weird.  I wonder where the second fck alias is coming from?  
The DT & hwmod data for those devices looks relatively straightforward.  
Is the hwmod code adding fck aliases for both of the entries from the 
clock file?

> > In the specific context of this patch, the problem would be: what if the 
> > two hwmods have different main_clk entries?  Which one should be 
> > associated with the "fck" alias?
> 
> Sadly, I am in a board bringup phase and can't really contribute to the
> discussions. Lots of other issues to tackle at the moment.

Understood.  Good luck with your board -


- Paul

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

* Re: [PATCH] ARM: OMAP2+: don't try to register the main clock twice.
  2014-05-07 23:20     ` Paul Walmsley
@ 2014-05-08  7:02       ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2014-05-08  7:02 UTC (permalink / raw)
  To: Paul Walmsley
  Cc: mporter, Benoit Cousson, joelagnel, NeilBrown, linux-omap,
	Tony Lindgren, Wolfram Sang

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]


> > I also get this message printed for the d_can driver with am335x; they 
> > have two entries in drivers/clk/ti/clk-33xx.c. Probably as a workaround 
> > to match the desired clock name for the d_can driver? Didn't really 
> > investigate yet.
> 
> That's pretty weird.  I wonder where the second fck alias is coming from?  
> The DT & hwmod data for those devices looks relatively straightforward.  
> Is the hwmod code adding fck aliases for both of the entries from the 
> clock file?

$ grep 'can' drivers/clk/ti/clk-33xx.c 
 * This program is free software; you can redistribute it and/or
	DT_CLK(NULL, "dcan0_fck", "dcan0_fck"),
	DT_CLK("481cc000.d_can", NULL, "dcan0_fck"),
	DT_CLK(NULL, "dcan1_fck", "dcan1_fck"),
	DT_CLK("481d0000.d_can", NULL, "dcan1_fck"),

I quickly tried to remove the entries not specifying platform devices
but that prevented my system from booting (Huh?). Still, no time to
really check it, though.

Thanks,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-05-08  7:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 11:50 [PATCH] ARM: OMAP2+: don't try to register the main clock twice Wolfram Sang
2014-04-11 18:33 ` Paul Walmsley
2014-04-17  8:55   ` Wolfram Sang
2014-05-07 23:20     ` Paul Walmsley
2014-05-08  7:02       ` Wolfram Sang

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.