diff mbox

[v2,1/4] clk: tegra: Move mipi-cal initialization into clk-tegra1[12]4.c

Message ID 1410360725-4286-2-git-send-email-seanpaul@chromium.org
State Not Applicable, archived
Headers show

Commit Message

Sean Paul Sept. 10, 2014, 2:52 p.m. UTC
This patch moves the mipi-cal gate registration down into the SoC
specific files to reflect the different in parent between them.

Without this change, MIPI calibration will fail on K1 devices if
the 72MHz clock is off.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
Changes in v2:
	- Added this patch in favor of the patch that did this in the mipi driver

 drivers/clk/tegra/clk-tegra-periph.c | 1 -
 drivers/clk/tegra/clk-tegra114.c     | 5 +++++
 drivers/clk/tegra/clk-tegra124.c     | 5 +++++
 3 files changed, 10 insertions(+), 1 deletion(-)

Comments

Stephen Warren Sept. 10, 2014, 4:17 p.m. UTC | #1
On 09/10/2014 08:52 AM, Sean Paul wrote:
> This patch moves the mipi-cal gate registration down into the SoC
> specific files to reflect the different in parent between them.
>
> Without this change, MIPI calibration will fail on K1 devices if
> the 72MHz clock is off.

This isn't a problem with this patch per se, but I notice that what's 
removed from clk-tegra-periph.c is data in a table, whereas open-coded 
calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in 
clk-tegra*.c could be converted to a table (simply with SoC-specific 
data) and processed by the same function. Peter, would that make sense?
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter De Schrijver Sept. 18, 2014, 11:26 a.m. UTC | #2
On Wed, Sep 10, 2014 at 06:17:44PM +0200, Stephen Warren wrote:
> On 09/10/2014 08:52 AM, Sean Paul wrote:
> > This patch moves the mipi-cal gate registration down into the SoC
> > specific files to reflect the different in parent between them.
> >
> > Without this change, MIPI calibration will fail on K1 devices if
> > the 72MHz clock is off.
> 
> This isn't a problem with this patch per se, but I notice that what's 
> removed from clk-tegra-periph.c is data in a table, whereas open-coded 
> calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in 
> clk-tegra*.c could be converted to a table (simply with SoC-specific 
> data) and processed by the same function. Peter, would that make sense?

Maybe yes. I will look into this. For this patch, it would make more sense
to keep the entry in clk-tegra-periph.c as it can be used by both Tegra124
and Tegra132.

Cheers,

Peter.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sean Paul Sept. 18, 2014, 6:59 p.m. UTC | #3
On Thu, Sep 18, 2014 at 7:26 AM, Peter De Schrijver
<pdeschrijver@nvidia.com> wrote:
> On Wed, Sep 10, 2014 at 06:17:44PM +0200, Stephen Warren wrote:
>> On 09/10/2014 08:52 AM, Sean Paul wrote:
>> > This patch moves the mipi-cal gate registration down into the SoC
>> > specific files to reflect the different in parent between them.
>> >
>> > Without this change, MIPI calibration will fail on K1 devices if
>> > the 72MHz clock is off.
>>
>> This isn't a problem with this patch per se, but I notice that what's
>> removed from clk-tegra-periph.c is data in a table, whereas open-coded
>> calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in
>> clk-tegra*.c could be converted to a table (simply with SoC-specific
>> data) and processed by the same function. Peter, would that make sense?
>
> Maybe yes. I will look into this. For this patch, it would make more sense
> to keep the entry in clk-tegra-periph.c as it can be used by both Tegra124
> and Tegra132.
>

How do you suggest we switch the parent based on 124 vs 132 if it
remains in clk-tegra-periph.c?

Sean



> Cheers,
>
> Peter.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter De Schrijver Sept. 19, 2014, 11:28 a.m. UTC | #4
On Thu, Sep 18, 2014 at 08:59:53PM +0200, Sean Paul wrote:
> On Thu, Sep 18, 2014 at 7:26 AM, Peter De Schrijver
> <pdeschrijver@nvidia.com> wrote:
> > On Wed, Sep 10, 2014 at 06:17:44PM +0200, Stephen Warren wrote:
> >> On 09/10/2014 08:52 AM, Sean Paul wrote:
> >> > This patch moves the mipi-cal gate registration down into the SoC
> >> > specific files to reflect the different in parent between them.
> >> >
> >> > Without this change, MIPI calibration will fail on K1 devices if
> >> > the 72MHz clock is off.
> >>
> >> This isn't a problem with this patch per se, but I notice that what's
> >> removed from clk-tegra-periph.c is data in a table, whereas open-coded
> >> calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in
> >> clk-tegra*.c could be converted to a table (simply with SoC-specific
> >> data) and processed by the same function. Peter, would that make sense?
> >
> > Maybe yes. I will look into this. For this patch, it would make more sense
> > to keep the entry in clk-tegra-periph.c as it can be used by both Tegra124
> > and Tegra132.
> >
> 
> How do you suggest we switch the parent based on 124 vs 132 if it
> remains in clk-tegra-periph.c?
> 

I would change the parent of mipi-cal in clk-tegra-periph.c to clk72mhz and
use a different mechanism for Tegra114.

Cheers,

Peter.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sean Paul Oct. 1, 2014, 6:38 p.m. UTC | #5
On Fri, Sep 19, 2014 at 7:28 AM, Peter De Schrijver
<pdeschrijver@nvidia.com> wrote:
> On Thu, Sep 18, 2014 at 08:59:53PM +0200, Sean Paul wrote:
>> On Thu, Sep 18, 2014 at 7:26 AM, Peter De Schrijver
>> <pdeschrijver@nvidia.com> wrote:
>> > On Wed, Sep 10, 2014 at 06:17:44PM +0200, Stephen Warren wrote:
>> >> On 09/10/2014 08:52 AM, Sean Paul wrote:
>> >> > This patch moves the mipi-cal gate registration down into the SoC
>> >> > specific files to reflect the different in parent between them.
>> >> >
>> >> > Without this change, MIPI calibration will fail on K1 devices if
>> >> > the 72MHz clock is off.
>> >>
>> >> This isn't a problem with this patch per se, but I notice that what's
>> >> removed from clk-tegra-periph.c is data in a table, whereas open-coded
>> >> calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in
>> >> clk-tegra*.c could be converted to a table (simply with SoC-specific
>> >> data) and processed by the same function. Peter, would that make sense?
>> >
>> > Maybe yes. I will look into this. For this patch, it would make more sense
>> > to keep the entry in clk-tegra-periph.c as it can be used by both Tegra124
>> > and Tegra132.
>> >
>>
>> How do you suggest we switch the parent based on 124 vs 132 if it
>> remains in clk-tegra-periph.c?
>>
>
> I would change the parent of mipi-cal in clk-tegra-periph.c to clk72mhz and
> use a different mechanism for Tegra114.
>

Hi Peter,
Sorry for the delay, I'm just getting back to this now.

I'm still unclear on how you propose we alter mipi-cal in tegra114.
AFAICT, we can't re-parent it since it's a gate clock. Can you please
be a little more specific (and forgive my ignorance wrt this driver,
it's still new to me)?

Sean



> Cheers,
>
> Peter.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sean Paul Oct. 7, 2014, 8:07 p.m. UTC | #6
On Wed, Oct 1, 2014 at 11:38 AM, Sean Paul <seanpaul@chromium.org> wrote:
> On Fri, Sep 19, 2014 at 7:28 AM, Peter De Schrijver
> <pdeschrijver@nvidia.com> wrote:
>> On Thu, Sep 18, 2014 at 08:59:53PM +0200, Sean Paul wrote:
>>> On Thu, Sep 18, 2014 at 7:26 AM, Peter De Schrijver
>>> <pdeschrijver@nvidia.com> wrote:
>>> > On Wed, Sep 10, 2014 at 06:17:44PM +0200, Stephen Warren wrote:
>>> >> On 09/10/2014 08:52 AM, Sean Paul wrote:
>>> >> > This patch moves the mipi-cal gate registration down into the SoC
>>> >> > specific files to reflect the different in parent between them.
>>> >> >
>>> >> > Without this change, MIPI calibration will fail on K1 devices if
>>> >> > the 72MHz clock is off.
>>> >>
>>> >> This isn't a problem with this patch per se, but I notice that what's
>>> >> removed from clk-tegra-periph.c is data in a table, whereas open-coded
>>> >> calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in
>>> >> clk-tegra*.c could be converted to a table (simply with SoC-specific
>>> >> data) and processed by the same function. Peter, would that make sense?
>>> >
>>> > Maybe yes. I will look into this. For this patch, it would make more sense
>>> > to keep the entry in clk-tegra-periph.c as it can be used by both Tegra124
>>> > and Tegra132.
>>> >
>>>
>>> How do you suggest we switch the parent based on 124 vs 132 if it
>>> remains in clk-tegra-periph.c?
>>>
>>
>> I would change the parent of mipi-cal in clk-tegra-periph.c to clk72mhz and
>> use a different mechanism for Tegra114.
>>
>
> Hi Peter,
> Sorry for the delay, I'm just getting back to this now.
>
> I'm still unclear on how you propose we alter mipi-cal in tegra114.
> AFAICT, we can't re-parent it since it's a gate clock. Can you please
> be a little more specific (and forgive my ignorance wrt this driver,
> it's still new to me)?
>

Ping. Can I get some advice on this?

I've also got 2 other outstanding tegra clock patches that have not
received a response:
- clk: tegra124: Add init data for dsi lp clocks
- clk/tegra: Fix mux typo, s/pll_m/clk_m/

Sean


> Sean
>
>
>
>> Cheers,
>>
>> Peter.
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding Oct. 8, 2014, 7:20 a.m. UTC | #7
On Tue, Oct 07, 2014 at 01:07:29PM -0700, Sean Paul wrote:
> On Wed, Oct 1, 2014 at 11:38 AM, Sean Paul <seanpaul@chromium.org> wrote:
> > On Fri, Sep 19, 2014 at 7:28 AM, Peter De Schrijver
> > <pdeschrijver@nvidia.com> wrote:
> >> On Thu, Sep 18, 2014 at 08:59:53PM +0200, Sean Paul wrote:
> >>> On Thu, Sep 18, 2014 at 7:26 AM, Peter De Schrijver
> >>> <pdeschrijver@nvidia.com> wrote:
> >>> > On Wed, Sep 10, 2014 at 06:17:44PM +0200, Stephen Warren wrote:
> >>> >> On 09/10/2014 08:52 AM, Sean Paul wrote:
> >>> >> > This patch moves the mipi-cal gate registration down into the SoC
> >>> >> > specific files to reflect the different in parent between them.
> >>> >> >
> >>> >> > Without this change, MIPI calibration will fail on K1 devices if
> >>> >> > the 72MHz clock is off.
> >>> >>
> >>> >> This isn't a problem with this patch per se, but I notice that what's
> >>> >> removed from clk-tegra-periph.c is data in a table, whereas open-coded
> >>> >> calls are added to clk-tegra*.c. It'd be nice if the open-coded calls in
> >>> >> clk-tegra*.c could be converted to a table (simply with SoC-specific
> >>> >> data) and processed by the same function. Peter, would that make sense?
> >>> >
> >>> > Maybe yes. I will look into this. For this patch, it would make more sense
> >>> > to keep the entry in clk-tegra-periph.c as it can be used by both Tegra124
> >>> > and Tegra132.
> >>> >
> >>>
> >>> How do you suggest we switch the parent based on 124 vs 132 if it
> >>> remains in clk-tegra-periph.c?
> >>>
> >>
> >> I would change the parent of mipi-cal in clk-tegra-periph.c to clk72mhz and
> >> use a different mechanism for Tegra114.
> >>
> >
> > Hi Peter,
> > Sorry for the delay, I'm just getting back to this now.
> >
> > I'm still unclear on how you propose we alter mipi-cal in tegra114.
> > AFAICT, we can't re-parent it since it's a gate clock. Can you please
> > be a little more specific (and forgive my ignorance wrt this driver,
> > it's still new to me)?
> >
> 
> Ping. Can I get some advice on this?

I don't see a way how we can make this work with a table that wouldn't
involve adding a lot more code. Given that we need to separate the table
based on SoC generation we need to add code to both Tegra114 and
Tegra124 to register a table of generation-specific clocks.

We do something like that already for Tegra114 using the
tegra_periph_clk_list table, but initializing the clocks is done using
an open-coded loop. Perhaps one possibility would be to implement a
generic function that takes a table of tegra_periph_init_data structs
and a count. Then we can add per-generation clocks to such a table and
only need to modify the code once.

But again, this would be adding much more code than this patch does, so
perhaps we can address it when we start needing more generation-specific
clocks.

Thierry
diff mbox

Patch

diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c
index 37f32c4..97c0eb4 100644
--- a/drivers/clk/tegra/clk-tegra-periph.c
+++ b/drivers/clk/tegra/clk-tegra-periph.c
@@ -524,7 +524,6 @@  static struct tegra_periph_init_data gate_clks[] = {
 	GATE("hda2hdmi", "clk_m", 128, TEGRA_PERIPH_ON_APB, tegra_clk_hda2hdmi, 0),
 	GATE("bsea", "clk_m", 62, 0, tegra_clk_bsea, 0),
 	GATE("bsev", "clk_m", 63, 0, tegra_clk_bsev, 0),
-	GATE("mipi-cal", "clk_m", 56, 0, tegra_clk_mipi_cal, 0),
 	GATE("usbd", "clk_m", 22, 0, tegra_clk_usbd, 0),
 	GATE("usb2", "clk_m", 58, 0, tegra_clk_usb2, 0),
 	GATE("usb3", "clk_m", 59, 0, tegra_clk_usb3, 0),
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
index f760f31..5a1fa41 100644
--- a/drivers/clk/tegra/clk-tegra114.c
+++ b/drivers/clk/tegra/clk-tegra114.c
@@ -1238,6 +1238,11 @@  static __init void tegra114_periph_clk_init(void __iomem *clk_base,
 		clks[data->clk_id] = clk;
 	}
 
+	clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base,
+				0, TEGRA114_CLK_MIPI_CAL,
+				periph_clk_enb_refcnt);
+	clks[TEGRA114_CLK_MIPI_CAL] = clk;
+
 	tegra_periph_clk_init(clk_base, pmc_base, tegra114_clks,
 				&pll_p_params);
 }
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 9525c68..0c3c892 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -1141,6 +1141,11 @@  static __init void tegra124_periph_clk_init(void __iomem *clk_base,
 	clk_register_clkdev(clk, "cml1", NULL);
 	clks[TEGRA124_CLK_CML1] = clk;
 
+	clk = tegra_clk_register_periph_gate("mipi-cal", "clk72mhz", 0,
+				clk_base, 0, TEGRA124_CLK_MIPI_CAL,
+				periph_clk_enb_refcnt);
+	clks[TEGRA124_CLK_MIPI_CAL] = clk;
+
 	tegra_periph_clk_init(clk_base, pmc_base, tegra124_clks, &pll_p_params);
 }