aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pnx4008/clock.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-11-20 05:32:41 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-02-12 12:32:36 -0500
commit6985a5ad0d719d8c8d584a69f6e5d7138a2e19ab (patch)
tree23209cc6187f1b1633fd98cf1aef598f8fa3c2f2 /arch/arm/mach-pnx4008/clock.c
parent0a0300dc8c4b3f3ce5c9ef5a0a4be5442590398f (diff)
ARM: PNX4008: convert to clkdev
Acked-by: Vitaly Wool <vitalywool@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pnx4008/clock.c')
-rw-r--r--arch/arm/mach-pnx4008/clock.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/arch/arm/mach-pnx4008/clock.c b/arch/arm/mach-pnx4008/clock.c
index 898c0e88acbc..6f5d2e502654 100644
--- a/arch/arm/mach-pnx4008/clock.c
+++ b/arch/arm/mach-pnx4008/clock.c
@@ -22,8 +22,9 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <mach/hardware.h> 25#include <asm/clkdev.h>
26 26
27#include <mach/hardware.h>
27#include <mach/clock.h> 28#include <mach/clock.h>
28#include "clock.h" 29#include "clock.h"
29 30
@@ -747,7 +748,7 @@ static struct clk wdt_ck = {
747/* These clocks are visible outside this module 748/* These clocks are visible outside this module
748 * and can be initialized 749 * and can be initialized
749 */ 750 */
750static struct clk *onchip_clks[] = { 751static struct clk *onchip_clks[] __initdata = {
751 &ck_13MHz, 752 &ck_13MHz,
752 &ck_pll1, 753 &ck_pll1,
753 &ck_pll4, 754 &ck_pll4,
@@ -777,6 +778,36 @@ static struct clk *onchip_clks[] = {
777 &wdt_ck, 778 &wdt_ck,
778}; 779};
779 780
781static struct clk_lookup onchip_clkreg[] = {
782 { .clk = &ck_13MHz, .con_id = "ck_13MHz" },
783 { .clk = &ck_pll1, .con_id = "ck_pll1" },
784 { .clk = &ck_pll4, .con_id = "ck_pll4" },
785 { .clk = &ck_pll5, .con_id = "ck_pll5" },
786 { .clk = &ck_pll3, .con_id = "ck_pll3" },
787 { .clk = &vfp9_ck, .con_id = "vfp9_ck" },
788 { .clk = &m2hclk_ck, .con_id = "m2hclk_ck" },
789 { .clk = &hclk_ck, .con_id = "hclk_ck" },
790 { .clk = &dma_ck, .con_id = "dma_ck" },
791 { .clk = &flash_ck, .con_id = "flash_ck" },
792 { .clk = &dum_ck, .con_id = "dum_ck" },
793 { .clk = &keyscan_ck, .con_id = "keyscan_ck" },
794 { .clk = &pwm1_ck, .con_id = "pwm1_ck" },
795 { .clk = &pwm2_ck, .con_id = "pwm2_ck" },
796 { .clk = &jpeg_ck, .con_id = "jpeg_ck" },
797 { .clk = &ms_ck, .con_id = "ms_ck" },
798 { .clk = &touch_ck, .con_id = "touch_ck" },
799 { .clk = &i2c0_ck, .con_id = "i2c0_ck" },
800 { .clk = &i2c1_ck, .con_id = "i2c1_ck" },
801 { .clk = &i2c2_ck, .con_id = "i2c2_ck" },
802 { .clk = &spi0_ck, .con_id = "spi0_ck" },
803 { .clk = &spi1_ck, .con_id = "spi1_ck" },
804 { .clk = &uart3_ck, .con_id = "uart3_ck" },
805 { .clk = &uart4_ck, .con_id = "uart4_ck" },
806 { .clk = &uart5_ck, .con_id = "uart5_ck" },
807 { .clk = &uart6_ck, .con_id = "uart6_ck" },
808 { .clk = &wdt_ck, .con_id = "wdt_ck" },
809};
810
780static int local_clk_enable(struct clk *clk) 811static int local_clk_enable(struct clk *clk)
781{ 812{
782 int ret = 0; 813 int ret = 0;
@@ -866,35 +897,6 @@ out:
866 897
867EXPORT_SYMBOL(clk_set_rate); 898EXPORT_SYMBOL(clk_set_rate);
868 899
869struct clk *clk_get(struct device *dev, const char *id)
870{
871 struct clk *clk = ERR_PTR(-ENOENT);
872 struct clk **clkp;
873
874 clock_lock();
875 for (clkp = onchip_clks; clkp < onchip_clks + ARRAY_SIZE(onchip_clks);
876 clkp++) {
877 if (strcmp(id, (*clkp)->name) == 0
878 && try_module_get((*clkp)->owner)) {
879 clk = (*clkp);
880 break;
881 }
882 }
883 clock_unlock();
884
885 return clk;
886}
887EXPORT_SYMBOL(clk_get);
888
889void clk_put(struct clk *clk)
890{
891 clock_lock();
892 if (clk && !IS_ERR(clk))
893 module_put(clk->owner);
894 clock_unlock();
895}
896EXPORT_SYMBOL(clk_put);
897
898unsigned long clk_get_rate(struct clk *clk) 900unsigned long clk_get_rate(struct clk *clk)
899{ 901{
900 unsigned long ret; 902 unsigned long ret;
@@ -987,6 +989,8 @@ static int __init clk_init(void)
987 /* Disable autoclocking */ 989 /* Disable autoclocking */
988 __raw_writeb(0xff, AUTOCLK_CTRL); 990 __raw_writeb(0xff, AUTOCLK_CTRL);
989 991
992 clkdev_add_table(onchip_clkreg, ARRAY_SIZE(onchip_clkreg));
993
990 return 0; 994 return 0;
991} 995}
992 996