diff options
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index cc8a987149e2..48495ad82aba 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -890,6 +890,36 @@ static int _init_opt_clks(struct omap_hwmod *oh) | |||
890 | return ret; | 890 | return ret; |
891 | } | 891 | } |
892 | 892 | ||
893 | static void _enable_optional_clocks(struct omap_hwmod *oh) | ||
894 | { | ||
895 | struct omap_hwmod_opt_clk *oc; | ||
896 | int i; | ||
897 | |||
898 | pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name); | ||
899 | |||
900 | for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) | ||
901 | if (oc->_clk) { | ||
902 | pr_debug("omap_hwmod: enable %s:%s\n", oc->role, | ||
903 | __clk_get_name(oc->_clk)); | ||
904 | clk_enable(oc->_clk); | ||
905 | } | ||
906 | } | ||
907 | |||
908 | static void _disable_optional_clocks(struct omap_hwmod *oh) | ||
909 | { | ||
910 | struct omap_hwmod_opt_clk *oc; | ||
911 | int i; | ||
912 | |||
913 | pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name); | ||
914 | |||
915 | for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) | ||
916 | if (oc->_clk) { | ||
917 | pr_debug("omap_hwmod: disable %s:%s\n", oc->role, | ||
918 | __clk_get_name(oc->_clk)); | ||
919 | clk_disable(oc->_clk); | ||
920 | } | ||
921 | } | ||
922 | |||
893 | /** | 923 | /** |
894 | * _enable_clocks - enable hwmod main clock and interface clocks | 924 | * _enable_clocks - enable hwmod main clock and interface clocks |
895 | * @oh: struct omap_hwmod * | 925 | * @oh: struct omap_hwmod * |
@@ -917,6 +947,9 @@ static int _enable_clocks(struct omap_hwmod *oh) | |||
917 | clk_enable(os->_clk); | 947 | clk_enable(os->_clk); |
918 | } | 948 | } |
919 | 949 | ||
950 | if (oh->flags & HWMOD_OPT_CLKS_NEEDED) | ||
951 | _enable_optional_clocks(oh); | ||
952 | |||
920 | /* The opt clocks are controlled by the device driver. */ | 953 | /* The opt clocks are controlled by the device driver. */ |
921 | 954 | ||
922 | return 0; | 955 | return 0; |
@@ -948,41 +981,14 @@ static int _disable_clocks(struct omap_hwmod *oh) | |||
948 | clk_disable(os->_clk); | 981 | clk_disable(os->_clk); |
949 | } | 982 | } |
950 | 983 | ||
984 | if (oh->flags & HWMOD_OPT_CLKS_NEEDED) | ||
985 | _disable_optional_clocks(oh); | ||
986 | |||
951 | /* The opt clocks are controlled by the device driver. */ | 987 | /* The opt clocks are controlled by the device driver. */ |
952 | 988 | ||
953 | return 0; | 989 | return 0; |
954 | } | 990 | } |
955 | 991 | ||
956 | static void _enable_optional_clocks(struct omap_hwmod *oh) | ||
957 | { | ||
958 | struct omap_hwmod_opt_clk *oc; | ||
959 | int i; | ||
960 | |||
961 | pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name); | ||
962 | |||
963 | for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) | ||
964 | if (oc->_clk) { | ||
965 | pr_debug("omap_hwmod: enable %s:%s\n", oc->role, | ||
966 | __clk_get_name(oc->_clk)); | ||
967 | clk_enable(oc->_clk); | ||
968 | } | ||
969 | } | ||
970 | |||
971 | static void _disable_optional_clocks(struct omap_hwmod *oh) | ||
972 | { | ||
973 | struct omap_hwmod_opt_clk *oc; | ||
974 | int i; | ||
975 | |||
976 | pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name); | ||
977 | |||
978 | for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) | ||
979 | if (oc->_clk) { | ||
980 | pr_debug("omap_hwmod: disable %s:%s\n", oc->role, | ||
981 | __clk_get_name(oc->_clk)); | ||
982 | clk_disable(oc->_clk); | ||
983 | } | ||
984 | } | ||
985 | |||
986 | /** | 992 | /** |
987 | * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4 | 993 | * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4 |
988 | * @oh: struct omap_hwmod * | 994 | * @oh: struct omap_hwmod * |