aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/clock.c
diff options
context:
space:
mode:
authorRobert Tivy <rtivy@ti.com>2013-01-10 19:23:23 -0500
committerSekhar Nori <nsekhar@ti.com>2013-01-22 07:12:59 -0500
commitaf47e6bb8866ad57cfcfeceecf799edc3a658660 (patch)
treef91c474cdd8988e9a959b66f0d6c22032f2ffe71 /arch/arm/mach-davinci/clock.c
parent35031f9df569913ac0c46b03c8033fc1deed749d (diff)
ARM: davinci: psc: introduce reset API
Introduce an IP reset API for use on DaVinci SoC. There is no existing "reset" framework support for SoC devices. The remoteproc driver needs explicit control of the DSP's reset line. To support this, a new DaVinci specific API is added. This private API will disappear with DT migration. Some discussion regarding a proposed DT "reset" binding is here: https://patchwork.kernel.org/patch/1635051/ Modify davinci_clk_init() to set clk "reset" function for clocks that indicate PSC_LRST support. Also fix indentation issue with function opening curly brace. Signed-off-by: Robert Tivy <rtivy@ti.com> [nsekhar@ti.com: rename davinci_psc_config_reset() to davinci_psc_reset()] Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci/clock.c')
-rw-r--r--arch/arm/mach-davinci/clock.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 34668ead53c7..d458558ee84a 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -52,6 +52,40 @@ static void __clk_disable(struct clk *clk)
52 __clk_disable(clk->parent); 52 __clk_disable(clk->parent);
53} 53}
54 54
55int davinci_clk_reset(struct clk *clk, bool reset)
56{
57 unsigned long flags;
58
59 if (clk == NULL || IS_ERR(clk))
60 return -EINVAL;
61
62 spin_lock_irqsave(&clockfw_lock, flags);
63 if (clk->flags & CLK_PSC)
64 davinci_psc_reset(clk->gpsc, clk->lpsc, reset);
65 spin_unlock_irqrestore(&clockfw_lock, flags);
66
67 return 0;
68}
69EXPORT_SYMBOL(davinci_clk_reset);
70
71int davinci_clk_reset_assert(struct clk *clk)
72{
73 if (clk == NULL || IS_ERR(clk) || !clk->reset)
74 return -EINVAL;
75
76 return clk->reset(clk, true);
77}
78EXPORT_SYMBOL(davinci_clk_reset_assert);
79
80int davinci_clk_reset_deassert(struct clk *clk)
81{
82 if (clk == NULL || IS_ERR(clk) || !clk->reset)
83 return -EINVAL;
84
85 return clk->reset(clk, false);
86}
87EXPORT_SYMBOL(davinci_clk_reset_deassert);
88
55int clk_enable(struct clk *clk) 89int clk_enable(struct clk *clk)
56{ 90{
57 unsigned long flags; 91 unsigned long flags;
@@ -535,7 +569,7 @@ int davinci_set_refclk_rate(unsigned long rate)
535} 569}
536 570
537int __init davinci_clk_init(struct clk_lookup *clocks) 571int __init davinci_clk_init(struct clk_lookup *clocks)
538 { 572{
539 struct clk_lookup *c; 573 struct clk_lookup *c;
540 struct clk *clk; 574 struct clk *clk;
541 size_t num_clocks = 0; 575 size_t num_clocks = 0;
@@ -576,6 +610,9 @@ int __init davinci_clk_init(struct clk_lookup *clocks)
576 if (clk->lpsc) 610 if (clk->lpsc)
577 clk->flags |= CLK_PSC; 611 clk->flags |= CLK_PSC;
578 612
613 if (clk->flags & PSC_LRST)
614 clk->reset = davinci_clk_reset;
615
579 clk_register(clk); 616 clk_register(clk);
580 num_clocks++; 617 num_clocks++;
581 618