From e49d5539c06f1d026a23c1c764495d9195fbc345 Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Thu, 19 Apr 2012 04:04:27 -0600 Subject: [PATCH] --- yaml --- r: 303023 b: refs/heads/master c: 2d6141baf15df188283ada7c0fa04679c4fcf1c7 h: refs/heads/master i: 303021: 0dd401938249213384dd24e712007d877c358889 303019: b56a7d11ea49740afc4e20088b8428c47a73775b 303015: ec797c16515f36d150b996c4d2671517499ec70a 303007: 0b2906a8ea6c5f5644bb45f7c2842e7128d570b7 v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-omap2/omap_hwmod.c | 39 +++++++++++++++++++------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 4d4f5459bf0a..c20bb1f98f9d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 515237d6fef36ebc476a4ce9204a3234ac14cf45 +refs/heads/master: 2d6141baf15df188283ada7c0fa04679c4fcf1c7 diff --git a/trunk/arch/arm/mach-omap2/omap_hwmod.c b/trunk/arch/arm/mach-omap2/omap_hwmod.c index 230119756504..241c663a8f62 100644 --- a/trunk/arch/arm/mach-omap2/omap_hwmod.c +++ b/trunk/arch/arm/mach-omap2/omap_hwmod.c @@ -1024,6 +1024,27 @@ static int __init _find_mpu_port_index(struct omap_hwmod *oh) return (found) ? i : -EINVAL; } +/** + * _find_mpu_rt_port - return omap_hwmod_ocp_if accessible by the MPU + * @oh: struct omap_hwmod * + * + * Given a pointer to a struct omap_hwmod record @oh, return a pointer + * to the struct omap_hwmod_ocp_if record that is used by the MPU to + * communicate with the IP block. This interface need not be directly + * connected to the MPU (and almost certainly is not), but is directly + * connected to the IP block represented by @oh. Returns a pointer + * to the struct omap_hwmod_ocp_if * upon success, or returns NULL upon + * error or if there does not appear to be a path from the MPU to this + * IP block. + */ +static struct omap_hwmod_ocp_if *_find_mpu_rt_port(struct omap_hwmod *oh) +{ + if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) + return NULL; + + return oh->slaves[oh->_mpu_port_index]; +}; + /** * _find_mpu_rt_addr_space - return MPU register target address space for @oh * @oh: struct omap_hwmod * @@ -1037,10 +1058,7 @@ static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap struct omap_hwmod_addr_space *mem; int found = 0, i = 0; - if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) - return NULL; - - os = oh->slaves[oh->_mpu_port_index]; + os = _find_mpu_rt_port(oh); if (!os->addr) return NULL; @@ -1298,12 +1316,11 @@ static int _wait_target_ready(struct omap_hwmod *oh) if (!oh) return -EINVAL; - if (oh->_int_flags & _HWMOD_NO_MPU_PORT) + if (oh->flags & HWMOD_NO_IDLEST) return 0; - os = oh->slaves[oh->_mpu_port_index]; - - if (oh->flags & HWMOD_NO_IDLEST) + os = _find_mpu_rt_port(oh); + if (!os) return 0; /* XXX check module SIDLEMODE */ @@ -2747,6 +2764,7 @@ int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type, struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) { struct clk *c; + struct omap_hwmod_ocp_if *oi; if (!oh) return NULL; @@ -2754,9 +2772,10 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) if (oh->_clk) { c = oh->_clk; } else { - if (oh->_int_flags & _HWMOD_NO_MPU_PORT) + oi = _find_mpu_rt_port(oh); + if (!oi) return NULL; - c = oh->slaves[oh->_mpu_port_index]->_clk; + c = oi->_clk; } if (!c->clkdm)