aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-04-19 06:04:27 -0400
committerPaul Walmsley <paul@pwsan.com>2012-04-19 06:04:27 -0400
commit2d6141baf15df188283ada7c0fa04679c4fcf1c7 (patch)
treebf764e93567a52d6723ac8e4368bdcb30a48080e /arch/arm/mach-omap2/omap_hwmod.c
parent515237d6fef36ebc476a4ce9204a3234ac14cf45 (diff)
ARM: OMAP2+: hwmod: add _find_mpu_rt_port()
Most IP blocks on the OMAP SoC have an interconnect link that is intended to be used by the MPU to communicate with the IP block. Several parts of the hwmod code need to be able to identify this link. Currently, this is open-coded. However, future patches will change the way that interconnect links are represented and will make identifying the link more complex. So to avoid code duplication, this patch centralizes the MPU port link identification code into a new function, _find_mpu_rt_port(). Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: BenoƮt Cousson <b-cousson@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 230119756504..241c663a8f62 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1025,6 +1025,27 @@ static int __init _find_mpu_port_index(struct omap_hwmod *oh)
1025} 1025}
1026 1026
1027/** 1027/**
1028 * _find_mpu_rt_port - return omap_hwmod_ocp_if accessible by the MPU
1029 * @oh: struct omap_hwmod *
1030 *
1031 * Given a pointer to a struct omap_hwmod record @oh, return a pointer
1032 * to the struct omap_hwmod_ocp_if record that is used by the MPU to
1033 * communicate with the IP block. This interface need not be directly
1034 * connected to the MPU (and almost certainly is not), but is directly
1035 * connected to the IP block represented by @oh. Returns a pointer
1036 * to the struct omap_hwmod_ocp_if * upon success, or returns NULL upon
1037 * error or if there does not appear to be a path from the MPU to this
1038 * IP block.
1039 */
1040static struct omap_hwmod_ocp_if *_find_mpu_rt_port(struct omap_hwmod *oh)
1041{
1042 if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0)
1043 return NULL;
1044
1045 return oh->slaves[oh->_mpu_port_index];
1046};
1047
1048/**
1028 * _find_mpu_rt_addr_space - return MPU register target address space for @oh 1049 * _find_mpu_rt_addr_space - return MPU register target address space for @oh
1029 * @oh: struct omap_hwmod * 1050 * @oh: struct omap_hwmod *
1030 * 1051 *
@@ -1037,10 +1058,7 @@ static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap
1037 struct omap_hwmod_addr_space *mem; 1058 struct omap_hwmod_addr_space *mem;
1038 int found = 0, i = 0; 1059 int found = 0, i = 0;
1039 1060
1040 if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) 1061 os = _find_mpu_rt_port(oh);
1041 return NULL;
1042
1043 os = oh->slaves[oh->_mpu_port_index];
1044 if (!os->addr) 1062 if (!os->addr)
1045 return NULL; 1063 return NULL;
1046 1064
@@ -1298,12 +1316,11 @@ static int _wait_target_ready(struct omap_hwmod *oh)
1298 if (!oh) 1316 if (!oh)
1299 return -EINVAL; 1317 return -EINVAL;
1300 1318
1301 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 1319 if (oh->flags & HWMOD_NO_IDLEST)
1302 return 0; 1320 return 0;
1303 1321
1304 os = oh->slaves[oh->_mpu_port_index]; 1322 os = _find_mpu_rt_port(oh);
1305 1323 if (!os)
1306 if (oh->flags & HWMOD_NO_IDLEST)
1307 return 0; 1324 return 0;
1308 1325
1309 /* XXX check module SIDLEMODE */ 1326 /* XXX check module SIDLEMODE */
@@ -2747,6 +2764,7 @@ int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
2747struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) 2764struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
2748{ 2765{
2749 struct clk *c; 2766 struct clk *c;
2767 struct omap_hwmod_ocp_if *oi;
2750 2768
2751 if (!oh) 2769 if (!oh)
2752 return NULL; 2770 return NULL;
@@ -2754,9 +2772,10 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
2754 if (oh->_clk) { 2772 if (oh->_clk) {
2755 c = oh->_clk; 2773 c = oh->_clk;
2756 } else { 2774 } else {
2757 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 2775 oi = _find_mpu_rt_port(oh);
2776 if (!oi)
2758 return NULL; 2777 return NULL;
2759 c = oh->slaves[oh->_mpu_port_index]->_clk; 2778 c = oi->_clk;
2760 } 2779 }
2761 2780
2762 if (!c->clkdm) 2781 if (!c->clkdm)