Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303012
b: refs/heads/master
c: c9aafd2
h: refs/heads/master
v: v3
  • Loading branch information
Paul Walmsley committed Apr 19, 2012
1 parent 234f712 commit 7b9638e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 747834ab83475f47878c68954d913e27124e4391
refs/heads/master: c9aafd23d6c1b466f37f554e9916886e7d4645d0
55 changes: 31 additions & 24 deletions trunk/arch/arm/mach-omap2/omap_hwmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,24 +884,22 @@ static int __init _find_mpu_port_index(struct omap_hwmod *oh)
}

/**
* _find_mpu_rt_base - find hwmod register target base addr accessible by MPU
* _find_mpu_rt_addr_space - return MPU register target address space for @oh
* @oh: struct omap_hwmod *
*
* Return the virtual address of the base of the register target of
* device @oh, or NULL on error.
* Returns a pointer to the struct omap_hwmod_addr_space record representing
* the register target MPU address space; or returns NULL upon error.
*/
static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap_hwmod *oh)
{
struct omap_hwmod_ocp_if *os;
struct omap_hwmod_addr_space *mem;
int i = 0, found = 0;
void __iomem *va_start;
int found = 0, i = 0;

if (!oh || oh->slaves_cnt == 0)
if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0)
return NULL;

os = oh->slaves[index];

os = oh->slaves[oh->_mpu_port_index];
if (!os->addr)
return NULL;

Expand All @@ -911,20 +909,7 @@ static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
found = 1;
} while (!found && mem->pa_start != mem->pa_end);

if (found) {
va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
if (!va_start) {
pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
return NULL;
}
pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
oh->name, va_start);
} else {
pr_debug("omap_hwmod: %s: no MPU register target found\n",
oh->name);
}

return (found) ? va_start : NULL;
return (found) ? mem : NULL;
}

/**
Expand Down Expand Up @@ -1813,10 +1798,32 @@ static int _shutdown(struct omap_hwmod *oh)
*/
static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
{
struct omap_hwmod_addr_space *mem;
void __iomem *va_start;

if (!oh)
return;

if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
return;

oh->_mpu_rt_va = _find_mpu_rt_base(oh, oh->_mpu_port_index);
mem = _find_mpu_rt_addr_space(oh);
if (!mem) {
pr_debug("omap_hwmod: %s: no MPU register target found\n",
oh->name);
return;
}

va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
if (!va_start) {
pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
return;
}

pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
oh->name, va_start);

oh->_mpu_rt_va = va_start;
}

/**
Expand Down

0 comments on commit 7b9638e

Please sign in to comment.