Skip to contentSkip to conversation

clk: tegra: Export peripheral reset functions

PATCH Applied Thierry Reding 6 participants 13 messages Mar 28, 2013 – Apr 2, 2013 6 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 clk: tegra: Export peripheral reset functions

The tegra_periph_reset_assert() and tegra_periph_reset_deassert() functions can be used by drivers to reset peripherals. In order to allow such drivers to be built as modules, export the functions.

Note that this restores the status quo as the functions were exported before the move to the drivers/clk tree.

---
 drivers/clk/tegra/clk-periph.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/tegra/clk-periph.c +3 -0
index 788486e..9dbd301 100644
@@ -16,6 +16,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/err.h>
 
@@ -128,6 +129,7 @@ void tegra_periph_reset_deassert(struct clk *c)
 
 	tegra_periph_reset(gate, 0);
 }
+EXPORT_SYMBOL(tegra_periph_reset_deassert);
 
 void tegra_periph_reset_assert(struct clk *c)
 {
@@ -147,6 +149,7 @@ void tegra_periph_reset_assert(struct clk *c)
 
 	tegra_periph_reset(gate, 1);
 }
+EXPORT_SYMBOL(tegra_periph_reset_assert);
 
 const struct clk_ops tegra_clk_periph_ops = {
 	.get_parent = clk_periph_get_parent,
Signature · 1 line
1.8.1.5

A message that is not in the archive (sent off-list or not yet received): 1364502688-5135-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org

#2 lore raw

PATCH 2/2 clk: tegra: Make gr2d and gr3d clocks children of pll_c

By default these clocks are children of pll_m, but in downstream kernels they are reparented to pll_c. While at it, decrease their frequencies to 300 MHz because the defaults aren't in the specified range.

gr2d can reportedly run at much higher frequencies, but 300 MHz works and is a more conservative default.

---
 drivers/clk/tegra/clk-tegra20.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/tegra/clk-tegra20.c +2 -0
index bf19400..b020beb 100644
@@ -1247,6 +1247,8 @@ static __initdata struct tegra_clk_init_table init_table[] = {
 	{host1x, pll_c, 150000000, 0},
 	{disp1, pll_p, 600000000, 0},
 	{disp2, pll_p, 600000000, 0},
+	{gr2d, pll_c, 300000000, 0},
+	{gr3d, pll_c, 300000000, 0},
 	{clk_max, clk_max, 0, 0}, /* This MUST be the last entry */
 };
 
Signature · 1 line
1.8.1.5

A message that is not in the archive (sent off-list or not yet received): 1364502688-5135-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] clk: tegra: Make gr2d and gr3d clocks children of pll_c

Quoted 6 lines · Thierry Reding

By default these clocks are children of pll_m, but in downstream kernels they are reparented to pll_c. While at it, decrease their frequencies to 300 MHz because the defaults aren't in the specified range.

gr2d can reportedly run at much higher frequencies, but 300 MHz works and is a more conservative default.

Questions on this patch:

Do we need to do the same thing for Tegra30 and/or Tegra114?

Is 300MHz the right value?

I'm hoping that Peter, Prashant, and/or Terje can provide guidance here.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 2/2] clk: tegra: Make gr2d and gr3d clocks children of pll_c

Quoted 5 lines · Stephen Warren
Quoted 4 lines · Thierry Reding

By default these clocks are children of pll_m, but in downstream kernels they are reparented to pll_c. While at it, decrease their frequencies to 300 MHz because the defaults aren't in the specified range.

Quoted 7 lines
Quoted 2 lines

gr2d can reportedly run at much higher frequencies, but 300 MHz works and is a more conservative default.

Questions on this patch:

Do we need to do the same thing for Tegra30 and/or Tegra114?

I think yes. For Tegra114, it's pll_c2.

Quoted 2 lines

Is 300MHz the right value?

Right. I use 300MHz on Tegra114 and it seems OK. I recall sometimes 276MHz can be used as well.

Mark

Quoted 6 lines

I'm hoping that Peter, Prashant, and/or Terje can provide guidance here. --
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH 2/2] clk: tegra: Make gr2d and gr3d clocks children of pll_c

In reply to a message not in the archive
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Thierry Reding

By default these clocks are children of pll_m, but in downstream kernels they are reparented to pll_c. While at it, decrease their frequencies to 300 MHz because the defaults aren't in the specified range.

gr2d can reportedly run at much higher frequencies, but 300 MHz works and is a more conservative default.

Quoted 7 lines

Questions on this patch:

Do we need to do the same thing for Tegra30 and/or Tegra114?

Is 300MHz the right value?

I'm hoping that Peter, Prashant, and/or Terje can provide guidance here.

We need a patch for all SoC's. 2D can fail subtly with the too high clocks, even though most of the time it seems to be doing just fine.

In Tegra20, 300MHz is the max rate we drive 2D in. Later Tegras have a higher max clock, and in Tegra114 we drive it from a different PLL. But for all of them 300MHz and PLLC should be a working configuration. I haven't checked how we use PLLC in upstream, so I'm not 100% sure.

In downstream, the nvhost driver is responsible for setting a sane value to the host1x clients. In upstream host1x, we missed that because we didn't include the clock management code.

Terje

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH 2/2] clk: tegra: Make gr2d and gr3d clocks children of pll_c

Quoted 11 lines · Terje Bergström
Quoted 10 lines · Stephen Warren
Quoted 6 lines · Thierry Reding

By default these clocks are children of pll_m, but in downstream kernels they are reparented to pll_c. While at it, decrease their frequencies to 300 MHz because the defaults aren't in the specified range.

gr2d can reportedly run at much higher frequencies, but 300 MHz works and is a more conservative default.

Questions on this patch:

Quoted 7 lines
Quoted 5 lines

Do we need to do the same thing for Tegra30 and/or Tegra114?

Is 300MHz the right value?

I'm hoping that Peter, Prashant, and/or Terje can provide guidance here.

We need a patch for all SoC's.

I think we also need that for all host1x children as well. But I think we can tackle those at the same time as driver support is added. Right now only 2D and 3D have some form of user code.

Quoted 7 lines

2D can fail subtly with the too high clocks, even though most of the time it seems to be doing just fine.

In Tegra20, 300MHz is the max rate we drive 2D in. Later Tegras have a higher max clock, and in Tegra114 we drive it from a different PLL. But for all of them 300MHz and PLLC should be a working configuration. I haven't checked how we use PLLC in upstream, so I'm not 100% sure.

At least on Tegra30 (CardHu) I can see that the clocks are also children of PLLC. I can add a similar hunk for Tegra30 to the patch. I have no Tegra114 hardware available and none of the downstream kernel branches I have seem to include Tegra114 support either so I can't check what's in use there, but if you say it should be fine I can include that in the patch as well.

Thierry

A message that is not in the archive (sent off-list or not yet received): 20130402054722.GA21277-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/[email protected]

#11 lore raw

Re: [PATCH 2/2] clk: tegra: Make gr2d and gr3d clocks children of pll_c

Quoted 8 lines · Thierry Reding
Quoted 4 lines · Terje Bergström

In Tegra20, 300MHz is the max rate we drive 2D in. Later Tegras have a higher max clock, and in Tegra114 we drive it from a different PLL. But for all of them 300MHz and PLLC should be a working configuration. I haven't checked how we use PLLC in upstream, so I'm not 100% sure.

At least on Tegra30 (CardHu) I can see that the clocks are also children of PLLC. I can add a similar hunk for Tegra30 to the patch. I have no

Yes, Tegra30 is similar to Tegra20 in this respect. Only max clock is different, so similar hunk for Tegra30 would be a good idea.

Quoted 4 lines

Tegra114 hardware available and none of the downstream kernel branches I have seem to include Tegra114 support either so I can't check what's in use there, but if you say it should be fine I can include that in the patch as well.

I think it's better we add this when we have a patch that enables host1x driver for Tegra114 and we have tested. Until then, I suggest we just leave the Tegra114 part out.

Terje

#12 lore raw

Re: [PATCH 2/2] clk: tegra: Make gr2d and gr3d clocks children of pll_c

In reply to a message not in the archive
Quoted 17 lines · Thierry Reding

By default these clocks are children of pll_m, but in downstream kernels they are reparented to pll_c. While at it, decrease their frequencies to 300 MHz because the defaults aren't in the specified range.

gr2d can reportedly run at much higher frequencies, but 300 MHz works and is a more conservative default.

---
 drivers/clk/tegra/clk-tegra20.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/tegra/clk-tegra20.c +0 -0
index bf19400..b020beb 100644

drivers/clk/tegra/clk-tegra20.c static __initdata struct tegra_clk_init_table init_table[] = { · line 1254

Quoted 8 lines
drivers/clk/tegra/clk-tegra20.c +2 -0
@@ -1247,6 +1247,8 @@ static __initdata struct tegra_clk_init_table init_table[] = {
 	{host1x, pll_c, 150000000, 0},
 	{disp1, pll_p, 600000000, 0},
 	{disp2, pll_p, 600000000, 0},
+	{gr2d, pll_c, 300000000, 0},
+	{gr3d, pll_c, 300000000, 0},
 	{clk_max, clk_max, 0, 0}, /* This MUST be the last entry */
 };
 

In the end we should move to a more flexible scheme where the pll_c frequency is determined by the needs of the various users, but for now this should do I think.

Cheers,

Peter.

#13 lore raw
In reply to a message not in the archive
Quoted 6 lines · Thierry Reding

The tegra_periph_reset_assert() and tegra_periph_reset_deassert() functions can be used by drivers to reset peripherals. In order to allow such drivers to be built as modules, export the functions.

Note that this restores the status quo as the functions were exported before the move to the drivers/clk tree.

Hopefully soon we can replace these with the new module reset API that's being cooked up. But this should do for now.

Peter, Prashant, can you please review this series too?

#14 lore raw
In reply to a message not in the archive
Quoted 6 lines · Thierry Reding

The tegra_periph_reset_assert() and tegra_periph_reset_deassert() functions can be used by drivers to reset peripherals. In order to allow such drivers to be built as modules, export the functions.

Note that this restores the status quo as the functions were exported before the move to the drivers/clk tree.

Mike,

Since I'm taking the Tegra CCF changes through the Tegra tree for this kernel cycle, do you want me to wait for your ack on these small fixes, or just go ahead and apply them?

Similarly, I assume you want to review/ack the Tegra114 clock driver that Peter posted? If not, do let me know, since I'm currently waiting for that. (Although I know Peter will post a V9 with minor fixes, but 99% of any review should still be applicable)

Thanks.

#15 lore raw
In reply to a message not in the archive
Quoted 6 lines · Thierry Reding

The tegra_periph_reset_assert() and tegra_periph_reset_deassert() functions can be used by drivers to reset peripherals. In order to allow such drivers to be built as modules, export the functions.

Note that this restores the status quo as the functions were exported before the move to the drivers/clk tree.

I have applied this one patch to Tegra's for-3.10/clk branch, with Mike's ack.

#16 lore raw
In reply to a message not in the archive
Quoted 7 lines · Thierry Reding

The tegra_periph_reset_assert() and tegra_periph_reset_deassert() functions can be used by drivers to reset peripherals. In order to allow such drivers to be built as modules, export the functions.

Note that this restores the status quo as the functions were exported before the move to the drivers/clk tree.

I guess we should move to the 'reset framework' at some point in the future?

Otherwise:

Cheers,

Peter.

A message that is not in the archive (sent off-list or not yet received): 20130402093426.GZ18519-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org

#18 lore raw

Quoting Peter De Schrijver (2013-04-02 02:34:26)

Quoted 11 lines · Thierry Reding
Quoted 7 lines

The tegra_periph_reset_assert() and tegra_periph_reset_deassert() functions can be used by drivers to reset peripherals. In order to allow such drivers to be built as modules, export the functions.

Note that this restores the status quo as the functions were exported before the move to the drivers/clk tree.

I guess we should move to the 'reset framework' at some point in the future?

Yes please do. Peripheral reset stuff should not lurk in the clock code. I kind of brought this point up back in June of 2012:
http://article.gmane.org/gmane.linux.ports.tegra/5346/

Back then the discussion was around removing this export from your clock driver and putting common reset code in clk.h (which is a bad idea). Now that the reset framework exists this stuff really should be migrated out of the clock framework entirely.

But as long as this patch is considered an incremental change then it's OK by me.

Regards,
Mike

Quoted 8 lines

Otherwise:

Cheers,

Peter.