diff options
author | Naveen Krishna Chatradhi <ch.naveen@samsung.com> | 2011-07-18 01:44:19 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-07-20 13:10:04 -0400 |
commit | 65f5eaa27a0c18ab79489b2fcbaf28d97c45101a (patch) | |
tree | 60da2ca55bd8fa21e3dbf7e845a21a3dc8ff70e8 | |
parent | 696f6fc1be92a8e117b4d07de34bf2d514a9c079 (diff) |
ARM: SAMSUNG: Move duplicate code for SPDIF ops
Move the duplicated code for SPDIF ops from S5PV210 and S5PC100.
So, the same can be used in EXYNOS4.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r-- | arch/arm/mach-s5pc100/clock.c | 37 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/clock.c | 37 | ||||
-rw-r--r-- | arch/arm/plat-s5p/clock.c | 35 | ||||
-rw-r--r-- | arch/arm/plat-s5p/include/plat/s5p-clock.h | 5 |
4 files changed, 42 insertions, 72 deletions
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c index cd248e681377..ff5cbb30de5b 100644 --- a/arch/arm/mach-s5pc100/clock.c +++ b/arch/arm/mach-s5pc100/clock.c | |||
@@ -910,47 +910,12 @@ struct clksrc_sources clk_src_sclk_spdif = { | |||
910 | .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list), | 910 | .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list), |
911 | }; | 911 | }; |
912 | 912 | ||
913 | static int s5pc100_spdif_set_rate(struct clk *clk, unsigned long rate) | ||
914 | { | ||
915 | struct clk *pclk; | ||
916 | int ret; | ||
917 | |||
918 | pclk = clk_get_parent(clk); | ||
919 | if (IS_ERR(pclk)) | ||
920 | return -EINVAL; | ||
921 | |||
922 | ret = pclk->ops->set_rate(pclk, rate); | ||
923 | clk_put(pclk); | ||
924 | |||
925 | return ret; | ||
926 | } | ||
927 | |||
928 | static unsigned long s5pc100_spdif_get_rate(struct clk *clk) | ||
929 | { | ||
930 | struct clk *pclk; | ||
931 | int rate; | ||
932 | |||
933 | pclk = clk_get_parent(clk); | ||
934 | if (IS_ERR(pclk)) | ||
935 | return -EINVAL; | ||
936 | |||
937 | rate = pclk->ops->get_rate(clk); | ||
938 | clk_put(pclk); | ||
939 | |||
940 | return rate; | ||
941 | } | ||
942 | |||
943 | static struct clk_ops s5pc100_sclk_spdif_ops = { | ||
944 | .set_rate = s5pc100_spdif_set_rate, | ||
945 | .get_rate = s5pc100_spdif_get_rate, | ||
946 | }; | ||
947 | |||
948 | static struct clksrc_clk clk_sclk_spdif = { | 913 | static struct clksrc_clk clk_sclk_spdif = { |
949 | .clk = { | 914 | .clk = { |
950 | .name = "sclk_spdif", | 915 | .name = "sclk_spdif", |
951 | .ctrlbit = (1 << 11), | 916 | .ctrlbit = (1 << 11), |
952 | .enable = s5pc100_sclk1_ctrl, | 917 | .enable = s5pc100_sclk1_ctrl, |
953 | .ops = &s5pc100_sclk_spdif_ops, | 918 | .ops = &s5p_sclk_spdif_ops, |
954 | }, | 919 | }, |
955 | .sources = &clk_src_sclk_spdif, | 920 | .sources = &clk_src_sclk_spdif, |
956 | .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 }, | 921 | .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 }, |
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index b5c95e663c53..ae72f87eab15 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c | |||
@@ -686,47 +686,12 @@ static struct clksrc_sources clkset_sclk_spdif = { | |||
686 | .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list), | 686 | .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list), |
687 | }; | 687 | }; |
688 | 688 | ||
689 | static int s5pv210_spdif_set_rate(struct clk *clk, unsigned long rate) | ||
690 | { | ||
691 | struct clk *pclk; | ||
692 | int ret; | ||
693 | |||
694 | pclk = clk_get_parent(clk); | ||
695 | if (IS_ERR(pclk)) | ||
696 | return -EINVAL; | ||
697 | |||
698 | ret = pclk->ops->set_rate(pclk, rate); | ||
699 | clk_put(pclk); | ||
700 | |||
701 | return ret; | ||
702 | } | ||
703 | |||
704 | static unsigned long s5pv210_spdif_get_rate(struct clk *clk) | ||
705 | { | ||
706 | struct clk *pclk; | ||
707 | int rate; | ||
708 | |||
709 | pclk = clk_get_parent(clk); | ||
710 | if (IS_ERR(pclk)) | ||
711 | return -EINVAL; | ||
712 | |||
713 | rate = pclk->ops->get_rate(clk); | ||
714 | clk_put(pclk); | ||
715 | |||
716 | return rate; | ||
717 | } | ||
718 | |||
719 | static struct clk_ops s5pv210_sclk_spdif_ops = { | ||
720 | .set_rate = s5pv210_spdif_set_rate, | ||
721 | .get_rate = s5pv210_spdif_get_rate, | ||
722 | }; | ||
723 | |||
724 | static struct clksrc_clk clk_sclk_spdif = { | 689 | static struct clksrc_clk clk_sclk_spdif = { |
725 | .clk = { | 690 | .clk = { |
726 | .name = "sclk_spdif", | 691 | .name = "sclk_spdif", |
727 | .enable = s5pv210_clk_mask0_ctrl, | 692 | .enable = s5pv210_clk_mask0_ctrl, |
728 | .ctrlbit = (1 << 27), | 693 | .ctrlbit = (1 << 27), |
729 | .ops = &s5pv210_sclk_spdif_ops, | 694 | .ops = &s5p_sclk_spdif_ops, |
730 | }, | 695 | }, |
731 | .sources = &clkset_sclk_spdif, | 696 | .sources = &clkset_sclk_spdif, |
732 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 }, | 697 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 }, |
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c index 8d081d968c58..02af235298e2 100644 --- a/arch/arm/plat-s5p/clock.c +++ b/arch/arm/plat-s5p/clock.c | |||
@@ -168,6 +168,41 @@ unsigned long s5p_epll_get_rate(struct clk *clk) | |||
168 | return clk->rate; | 168 | return clk->rate; |
169 | } | 169 | } |
170 | 170 | ||
171 | int s5p_spdif_set_rate(struct clk *clk, unsigned long rate) | ||
172 | { | ||
173 | struct clk *pclk; | ||
174 | int ret; | ||
175 | |||
176 | pclk = clk_get_parent(clk); | ||
177 | if (IS_ERR(pclk)) | ||
178 | return -EINVAL; | ||
179 | |||
180 | ret = pclk->ops->set_rate(pclk, rate); | ||
181 | clk_put(pclk); | ||
182 | |||
183 | return ret; | ||
184 | } | ||
185 | |||
186 | unsigned long s5p_spdif_get_rate(struct clk *clk) | ||
187 | { | ||
188 | struct clk *pclk; | ||
189 | int rate; | ||
190 | |||
191 | pclk = clk_get_parent(clk); | ||
192 | if (IS_ERR(pclk)) | ||
193 | return -EINVAL; | ||
194 | |||
195 | rate = pclk->ops->get_rate(clk); | ||
196 | clk_put(pclk); | ||
197 | |||
198 | return rate; | ||
199 | } | ||
200 | |||
201 | struct clk_ops s5p_sclk_spdif_ops = { | ||
202 | .set_rate = s5p_spdif_set_rate, | ||
203 | .get_rate = s5p_spdif_get_rate, | ||
204 | }; | ||
205 | |||
171 | static struct clk *s5p_clks[] __initdata = { | 206 | static struct clk *s5p_clks[] __initdata = { |
172 | &clk_ext_xtal_mux, | 207 | &clk_ext_xtal_mux, |
173 | &clk_48m, | 208 | &clk_48m, |
diff --git a/arch/arm/plat-s5p/include/plat/s5p-clock.h b/arch/arm/plat-s5p/include/plat/s5p-clock.h index 2b6dcff8ab2b..769b5bdfb046 100644 --- a/arch/arm/plat-s5p/include/plat/s5p-clock.h +++ b/arch/arm/plat-s5p/include/plat/s5p-clock.h | |||
@@ -47,4 +47,9 @@ extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable); | |||
47 | extern int s5p_epll_enable(struct clk *clk, int enable); | 47 | extern int s5p_epll_enable(struct clk *clk, int enable); |
48 | extern unsigned long s5p_epll_get_rate(struct clk *clk); | 48 | extern unsigned long s5p_epll_get_rate(struct clk *clk); |
49 | 49 | ||
50 | /* SPDIF clk operations common for S5PC100/V210/C110 and Exynos4 */ | ||
51 | extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate); | ||
52 | extern unsigned long s5p_spdif_get_rate(struct clk *clk); | ||
53 | |||
54 | extern struct clk_ops s5p_sclk_spdif_ops; | ||
50 | #endif /* __ASM_PLAT_S5P_CLOCK_H */ | 55 | #endif /* __ASM_PLAT_S5P_CLOCK_H */ |