diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2015-11-12 02:32:58 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2015-11-12 12:57:44 -0500 |
commit | c12ba8ce2335389ce5416f88391cd67c7325c963 (patch) | |
tree | 91c27bbe28608a27005a7abdfb6456621d5e9263 /arch | |
parent | bf05c2c2c5586242509660d146a5bb5f73dd06c5 (diff) |
ARM: OMAP2+: hwmod: Add hwmod flag for HWMOD_OPT_CLKS_NEEDED
Some module needs more than one functional clock in order to be accessible,
like the McASPs found in DRA7xx family.
This flag will indicate that the opt_clks need to be handled at the same
time as the main_clk for the given hwmod, ensuring that all needed clocks
are enabled before we try to access the module's address space.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 66 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.h | 3 |
2 files changed, 39 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 * |
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index ca6df1a73475..76bce11c85a4 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h | |||
@@ -523,6 +523,8 @@ struct omap_hwmod_omap4_prcm { | |||
523 | * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up | 523 | * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up |
524 | * events by calling _reconfigure_io_chain() when a device is enabled | 524 | * events by calling _reconfigure_io_chain() when a device is enabled |
525 | * or idled. | 525 | * or idled. |
526 | * HWMOD_OPT_CLKS_NEEDED: The optional clocks are needed for the module to | ||
527 | * operate and they need to be handled at the same time as the main_clk. | ||
526 | */ | 528 | */ |
527 | #define HWMOD_SWSUP_SIDLE (1 << 0) | 529 | #define HWMOD_SWSUP_SIDLE (1 << 0) |
528 | #define HWMOD_SWSUP_MSTANDBY (1 << 1) | 530 | #define HWMOD_SWSUP_MSTANDBY (1 << 1) |
@@ -538,6 +540,7 @@ struct omap_hwmod_omap4_prcm { | |||
538 | #define HWMOD_FORCE_MSTANDBY (1 << 11) | 540 | #define HWMOD_FORCE_MSTANDBY (1 << 11) |
539 | #define HWMOD_SWSUP_SIDLE_ACT (1 << 12) | 541 | #define HWMOD_SWSUP_SIDLE_ACT (1 << 12) |
540 | #define HWMOD_RECONFIG_IO_CHAIN (1 << 13) | 542 | #define HWMOD_RECONFIG_IO_CHAIN (1 << 13) |
543 | #define HWMOD_OPT_CLKS_NEEDED (1 << 14) | ||
541 | 544 | ||
542 | /* | 545 | /* |
543 | * omap_hwmod._int_flags definitions | 546 | * omap_hwmod._int_flags definitions |