* [PATCH 0/2] OMAP4: McBSP: Fix clock reparenting
@ 2011-12-15 9:37 Peter Ujfalusi
2011-12-15 9:37 ` [PATCH 1/2] OMAP2+: mcbsp: Restructure clk reparenting code Peter Ujfalusi
2011-12-15 9:37 ` [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support Peter Ujfalusi
0 siblings, 2 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2011-12-15 9:37 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Jarkko Nikula, linux-omap, linux-arm-kernel
Hello,
OMAP4 has different clock names compared to OMAP2/3.
Restructure the clock reparenting code for omap2plus in order to be able to
suport OMAP4 clock source selection without breaking upper layer API.
Regards,
Peter
---
Peter Ujfalusi (2):
OMAP2+: mcbsp: Restructure clk reparenting code
OMAP4: mcbsp: Clock reparenting support
arch/arm/mach-omap2/mcbsp.c | 66 +++++++++++++++++++++++++++++++-----------
1 files changed, 48 insertions(+), 18 deletions(-)
--
1.7.8
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] OMAP2+: mcbsp: Restructure clk reparenting code
2011-12-15 9:37 [PATCH 0/2] OMAP4: McBSP: Fix clock reparenting Peter Ujfalusi
@ 2011-12-15 9:37 ` Peter Ujfalusi
2011-12-15 9:37 ` [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support Peter Ujfalusi
1 sibling, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2011-12-15 9:37 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Jarkko Nikula, linux-omap, linux-arm-kernel
In OMAP4 we have different clk names compared to OMAP2/3.
To be able to support OMAP4 clock reparenting the set_clk_src
function need to be separated into two function.
One for selecting the platform's clock names, the other
will do the reparenting.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-omap2/mcbsp.c | 37 ++++++++++++++++++++++---------------
1 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 857860b..9129003 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -65,25 +65,16 @@ static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
return 0;
}
-/* McBSP CLKS source switching function */
-static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
- const char *src)
+static int omap2_mcbsp_reparent_clk(struct device *dev, struct clk *clk,
+ char *fck_src_name)
{
struct clk *fck_src;
- char *fck_src_name;
int r;
- if (!strcmp(src, "clks_ext"))
- fck_src_name = "pad_fck";
- else if (!strcmp(src, "clks_fclk"))
- fck_src_name = "prcm_fck";
- else
- return -EINVAL;
-
fck_src = clk_get(dev, fck_src_name);
if (IS_ERR_OR_NULL(fck_src)) {
- pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
- fck_src_name);
+ dev_err(dev, "clk reparent: could not clk_get() %s\n",
+ fck_src_name);
return -EINVAL;
}
@@ -91,8 +82,8 @@ static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
r = clk_set_parent(clk, fck_src);
if (IS_ERR_VALUE(r)) {
- pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
- "clks", fck_src_name);
+ dev_err(dev, "clk reparent: could not clk_set_parent() to %s\n",
+ fck_src_name);
clk_put(fck_src);
return -EINVAL;
}
@@ -104,6 +95,22 @@ static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
return 0;
}
+/* McBSP CLKS source switching for OMAP2/3 */
+static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
+ const char *src)
+{
+ char *fck_src_name;
+
+ if (!strcmp(src, "clks_ext"))
+ fck_src_name = "pad_fck";
+ else if (!strcmp(src, "clks_fclk"))
+ fck_src_name = "prcm_fck";
+ else
+ return -EINVAL;
+
+ return omap2_mcbsp_reparent_clk(dev, clk, fck_src_name);
+}
+
static int omap3_enable_st_clock(unsigned int id, bool enable)
{
unsigned int w;
--
1.7.8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support
2011-12-15 9:37 [PATCH 0/2] OMAP4: McBSP: Fix clock reparenting Peter Ujfalusi
2011-12-15 9:37 ` [PATCH 1/2] OMAP2+: mcbsp: Restructure clk reparenting code Peter Ujfalusi
@ 2011-12-15 9:37 ` Peter Ujfalusi
2011-12-17 0:37 ` Paul Walmsley
1 sibling, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2011-12-15 9:37 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Jarkko Nikula, linux-omap, linux-arm-kernel
With OMAP4 the clock names are different compared to
OMAP2/3.
The internal fclk name depends on the McBSP instance
number.
In case of MCBSP_TYPE4 (OMAP4) we should use different
clock selection method compared to OMAP2/3.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-omap2/mcbsp.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 9129003..829f4c7 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -111,6 +111,23 @@ static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
return omap2_mcbsp_reparent_clk(dev, clk, fck_src_name);
}
+/* McBSP CLKS source switching for OMAP4 */
+static int omap4_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
+ const char *src)
+{
+ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
+ char fck_src_name[30];
+
+ if (!strcmp(src, "clks_ext"))
+ strcpy(fck_src_name, "pad_clks_ck");
+ else if (!strcmp(src, "clks_fclk"))
+ sprintf(fck_src_name, "mcbsp%d_sync_mux_ck", mcbsp->id);
+ else
+ return -EINVAL;
+
+ return omap2_mcbsp_reparent_clk(dev, clk, fck_src_name);
+}
+
static int omap3_enable_st_clock(unsigned int id, bool enable)
{
unsigned int w;
@@ -184,9 +201,15 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
name, oh->name);
return PTR_ERR(pdev);
}
- pdata->set_clk_src = omap2_mcbsp_set_clk_src;
- if (id == 1)
- pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
+
+ if (oh->class->rev == MCBSP_CONFIG_TYPE4)
+ pdata->set_clk_src = omap4_mcbsp_set_clk_src;
+ else {
+ pdata->set_clk_src = omap2_mcbsp_set_clk_src;
+ if (id == 1)
+ pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
+ }
+
omap_mcbsp_count++;
return 0;
}
--
1.7.8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support
2011-12-15 9:37 ` [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support Peter Ujfalusi
@ 2011-12-17 0:37 ` Paul Walmsley
2011-12-22 16:23 ` Peter Ujfalusi
0 siblings, 1 reply; 5+ messages in thread
From: Paul Walmsley @ 2011-12-17 0:37 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: Tony Lindgren, Jarkko Nikula, linux-omap, linux-arm-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2234 bytes --]
Hi Péter
On Thu, 15 Dec 2011, Peter Ujfalusi wrote:
> With OMAP4 the clock names are different compared to OMAP2/3. The
> internal fclk name depends on the McBSP instance number. In case of
> MCBSP_TYPE4 (OMAP4) we should use different clock selection method
> compared to OMAP2/3.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> arch/arm/mach-omap2/mcbsp.c | 29 ++++++++++++++++++++++++++---
> 1 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
> index 9129003..829f4c7 100644
> --- a/arch/arm/mach-omap2/mcbsp.c
> +++ b/arch/arm/mach-omap2/mcbsp.c
> @@ -111,6 +111,23 @@ static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
> return omap2_mcbsp_reparent_clk(dev, clk, fck_src_name);
> }
>
> +/* McBSP CLKS source switching for OMAP4 */
> +static int omap4_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
> + const char *src)
> +{
> + struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
> + char fck_src_name[30];
> +
> + if (!strcmp(src, "clks_ext"))
> + strcpy(fck_src_name, "pad_clks_ck");
> + else if (!strcmp(src, "clks_fclk"))
> + sprintf(fck_src_name, "mcbsp%d_sync_mux_ck", mcbsp->id);
> + else
> + return -EINVAL;
> +
> + return omap2_mcbsp_reparent_clk(dev, clk, fck_src_name);
> +}
What do you think about using clkdev alias lines and hwmod optional clks
for this instead? With these mechanisms, you can give clocks a consistent
"role name" for a given device, even if the underlying clock changes on
different platforms.
So in the mach-omap2/clock*_data.c files, you'd do something like
CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_3XXX),
for OMAP3, and
CLK("omap-mcbsp.1", "pad_fck", &pad_clks_clk, CK_44XX),
for OMAP4.
Then in the hwmod data files, you'd add them as optional clocks -
something like:
static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
{ .role = "pad_fck", .clk = "mcbsp_clks" },
};
for OMAP3, and
static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
{ .role = "pad_fck", .clk = "pad_clks_clk" },
};
for OMAP4.
I think this might work for your needs?
- Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support
2011-12-17 0:37 ` Paul Walmsley
@ 2011-12-22 16:23 ` Peter Ujfalusi
0 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2011-12-22 16:23 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Tony Lindgren, Jarkko Nikula, linux-omap, linux-arm-kernel
Hi Paul,
On 12/17/2011 02:37 AM, Paul Walmsley wrote:
> What do you think about using clkdev alias lines and hwmod optional clks
> for this instead? With these mechanisms, you can give clocks a consistent
> "role name" for a given device, even if the underlying clock changes on
> different platforms.
I need to look into the clock framework, but sounds promising.
I can see quite big difference between the clock3xxx_data, and
clock44xx_data regarding to McBSPs.
Need to understand why, and what need to be changed to achieve what I want.
> So in the mach-omap2/clock*_data.c files, you'd do something like
>
> CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_3XXX),
>
> for OMAP3, and
>
> CLK("omap-mcbsp.1", "pad_fck", &pad_clks_clk, CK_44XX),
>
> for OMAP4.
>
> Then in the hwmod data files, you'd add them as optional clocks -
> something like:
>
> static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
> { .role = "pad_fck", .clk = "mcbsp_clks" },
> };
>
> for OMAP3, and
>
> static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
> { .role = "pad_fck", .clk = "pad_clks_clk" },
> };
>
> for OMAP4.
>
> I think this might work for your needs?
Is it OK if I do this as an incremental patch as soon as I figured out
the way to do it nicely?
Thank you,
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-22 16:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15 9:37 [PATCH 0/2] OMAP4: McBSP: Fix clock reparenting Peter Ujfalusi
2011-12-15 9:37 ` [PATCH 1/2] OMAP2+: mcbsp: Restructure clk reparenting code Peter Ujfalusi
2011-12-15 9:37 ` [PATCH 2/2] OMAP4: mcbsp: Clock reparenting support Peter Ujfalusi
2011-12-17 0:37 ` Paul Walmsley
2011-12-22 16:23 ` Peter Ujfalusi
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).