aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2011-03-11 00:43:05 -0500
committerPaul Walmsley <paul@pwsan.com>2011-03-11 00:43:05 -0500
commit2d403fe03070b541cc93cfa915f6e6c592cf231c (patch)
tree530e0bf3a99a9aa93e0113a916fb7a547605ad2e /arch/arm/mach-omap2/omap_hwmod.c
parent21ace5452ce3327f0d11f85b0c33dfcd0d20fdb2 (diff)
parentcc1226e7635011c7dd1e786770ed51ee751800f2 (diff)
Merge remote branch 'remotes/origin/hwmod_a_2.6.39' into tmp-integration-2.6.39-20110310-024
Conflicts: arch/arm/mach-omap2/omap_hwmod_2430_data.c arch/arm/mach-omap2/omap_hwmod_3xxx_data.c arch/arm/plat-omap/include/plat/omap_hwmod.h
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c79
1 files changed, 45 insertions, 34 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e39772beaedd..4c8329e4e6e1 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -370,7 +370,7 @@ static int _set_module_autoidle(struct omap_hwmod *oh, u8 autoidle,
370 } 370 }
371 371
372 autoidle_shift = oh->class->sysc->sysc_fields->autoidle_shift; 372 autoidle_shift = oh->class->sysc->sysc_fields->autoidle_shift;
373 autoidle_mask = (0x3 << autoidle_shift); 373 autoidle_mask = (0x1 << autoidle_shift);
374 374
375 *v &= ~autoidle_mask; 375 *v &= ~autoidle_mask;
376 *v |= autoidle << autoidle_shift; 376 *v |= autoidle << autoidle_shift;
@@ -929,7 +929,7 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
929 if (!ret) 929 if (!ret)
930 oh->_state = _HWMOD_STATE_CLKS_INITED; 930 oh->_state = _HWMOD_STATE_CLKS_INITED;
931 931
932 return 0; 932 return ret;
933} 933}
934 934
935/** 935/**
@@ -975,25 +975,29 @@ static int _wait_target_ready(struct omap_hwmod *oh)
975} 975}
976 976
977/** 977/**
978 * _lookup_hardreset - return the register bit shift for this hwmod/reset line 978 * _lookup_hardreset - fill register bit info for this hwmod/reset line
979 * @oh: struct omap_hwmod * 979 * @oh: struct omap_hwmod *
980 * @name: name of the reset line in the context of this hwmod 980 * @name: name of the reset line in the context of this hwmod
981 * @ohri: struct omap_hwmod_rst_info * that this function will fill in
981 * 982 *
982 * Return the bit position of the reset line that match the 983 * Return the bit position of the reset line that match the
983 * input name. Return -ENOENT if not found. 984 * input name. Return -ENOENT if not found.
984 */ 985 */
985static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name) 986static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name,
987 struct omap_hwmod_rst_info *ohri)
986{ 988{
987 int i; 989 int i;
988 990
989 for (i = 0; i < oh->rst_lines_cnt; i++) { 991 for (i = 0; i < oh->rst_lines_cnt; i++) {
990 const char *rst_line = oh->rst_lines[i].name; 992 const char *rst_line = oh->rst_lines[i].name;
991 if (!strcmp(rst_line, name)) { 993 if (!strcmp(rst_line, name)) {
992 u8 shift = oh->rst_lines[i].rst_shift; 994 ohri->rst_shift = oh->rst_lines[i].rst_shift;
993 pr_debug("omap_hwmod: %s: _lookup_hardreset: %s: %d\n", 995 ohri->st_shift = oh->rst_lines[i].st_shift;
994 oh->name, rst_line, shift); 996 pr_debug("omap_hwmod: %s: %s: %s: rst %d st %d\n",
997 oh->name, __func__, rst_line, ohri->rst_shift,
998 ohri->st_shift);
995 999
996 return shift; 1000 return 0;
997 } 1001 }
998 } 1002 }
999 1003
@@ -1012,21 +1016,22 @@ static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name)
1012 */ 1016 */
1013static int _assert_hardreset(struct omap_hwmod *oh, const char *name) 1017static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1014{ 1018{
1015 u8 shift; 1019 struct omap_hwmod_rst_info ohri;
1020 u8 ret;
1016 1021
1017 if (!oh) 1022 if (!oh)
1018 return -EINVAL; 1023 return -EINVAL;
1019 1024
1020 shift = _lookup_hardreset(oh, name); 1025 ret = _lookup_hardreset(oh, name, &ohri);
1021 if (IS_ERR_VALUE(shift)) 1026 if (IS_ERR_VALUE(ret))
1022 return shift; 1027 return ret;
1023 1028
1024 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1029 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1025 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, 1030 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
1026 shift); 1031 ohri.rst_shift);
1027 else if (cpu_is_omap44xx()) 1032 else if (cpu_is_omap44xx())
1028 return omap4_prm_assert_hardreset(oh->prcm.omap4.rstctrl_reg, 1033 return omap4_prm_assert_hardreset(oh->prcm.omap4.rstctrl_reg,
1029 shift); 1034 ohri.rst_shift);
1030 else 1035 else
1031 return -EINVAL; 1036 return -EINVAL;
1032} 1037}
@@ -1043,29 +1048,34 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1043 */ 1048 */
1044static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) 1049static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1045{ 1050{
1046 u8 shift; 1051 struct omap_hwmod_rst_info ohri;
1047 int r; 1052 int ret;
1048 1053
1049 if (!oh) 1054 if (!oh)
1050 return -EINVAL; 1055 return -EINVAL;
1051 1056
1052 shift = _lookup_hardreset(oh, name); 1057 ret = _lookup_hardreset(oh, name, &ohri);
1053 if (IS_ERR_VALUE(shift)) 1058 if (IS_ERR_VALUE(ret))
1054 return shift; 1059 return ret;
1055 1060
1056 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1061 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1057 r = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs, 1062 ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
1058 shift); 1063 ohri.rst_shift,
1059 else if (cpu_is_omap44xx()) 1064 ohri.st_shift);
1060 r = omap4_prm_deassert_hardreset(oh->prcm.omap4.rstctrl_reg, 1065 } else if (cpu_is_omap44xx()) {
1061 shift); 1066 if (ohri.st_shift)
1062 else 1067 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
1068 oh->name, name);
1069 ret = omap4_prm_deassert_hardreset(oh->prcm.omap4.rstctrl_reg,
1070 ohri.rst_shift);
1071 } else {
1063 return -EINVAL; 1072 return -EINVAL;
1073 }
1064 1074
1065 if (r == -EBUSY) 1075 if (ret == -EBUSY)
1066 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); 1076 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name);
1067 1077
1068 return r; 1078 return ret;
1069} 1079}
1070 1080
1071/** 1081/**
@@ -1078,21 +1088,22 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1078 */ 1088 */
1079static int _read_hardreset(struct omap_hwmod *oh, const char *name) 1089static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1080{ 1090{
1081 u8 shift; 1091 struct omap_hwmod_rst_info ohri;
1092 u8 ret;
1082 1093
1083 if (!oh) 1094 if (!oh)
1084 return -EINVAL; 1095 return -EINVAL;
1085 1096
1086 shift = _lookup_hardreset(oh, name); 1097 ret = _lookup_hardreset(oh, name, &ohri);
1087 if (IS_ERR_VALUE(shift)) 1098 if (IS_ERR_VALUE(ret))
1088 return shift; 1099 return ret;
1089 1100
1090 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 1101 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1091 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, 1102 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
1092 shift); 1103 ohri.st_shift);
1093 } else if (cpu_is_omap44xx()) { 1104 } else if (cpu_is_omap44xx()) {
1094 return omap4_prm_is_hardreset_asserted(oh->prcm.omap4.rstctrl_reg, 1105 return omap4_prm_is_hardreset_asserted(oh->prcm.omap4.rstctrl_reg,
1095 shift); 1106 ohri.rst_shift);
1096 } else { 1107 } else {
1097 return -EINVAL; 1108 return -EINVAL;
1098 } 1109 }