Commit 550c8092 authored by Paul Walmsley's avatar Paul Walmsley

OMAP2+: hwmod: rename some init functions

Rename omap_hwmod_init() to omap_hwmod_register().  Rename
omap_hwmod_late_init() to omap_hwmod_setup_all().  Also change all of
the callers to reflect the new names.  While here, update some
copyrights.

Suggested by Tony Lindgren <tony@atomide.com>.

N.B. The comment in mach-omap2/serial.c may no longer be correct, given
     recent changes in init order.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
parent bac1a0f0
/* /*
* omap_hwmod implementation for OMAP2/3/4 * omap_hwmod implementation for OMAP2/3/4
* *
* Copyright (C) 2009-2010 Nokia Corporation * Copyright (C) 2009-2011 Nokia Corporation
* *
* Paul Walmsley, Benoît Cousson, Kevin Hilman * Paul Walmsley, Benoît Cousson, Kevin Hilman
* *
...@@ -901,7 +901,7 @@ static struct omap_hwmod *_lookup(const char *name) ...@@ -901,7 +901,7 @@ static struct omap_hwmod *_lookup(const char *name)
* @oh: struct omap_hwmod * * @oh: struct omap_hwmod *
* @data: not used; pass NULL * @data: not used; pass NULL
* *
* Called by omap_hwmod_late_init() (after omap2_clk_init()). * Called by omap_hwmod_setup_all() (after omap2_clk_init()).
* Resolves all clock names embedded in the hwmod. Returns -EINVAL if * Resolves all clock names embedded in the hwmod. Returns -EINVAL if
* the omap_hwmod has not yet been registered or if the clocks have * the omap_hwmod has not yet been registered or if the clocks have
* already been initialized, 0 on success, or a non-zero error on * already been initialized, 0 on success, or a non-zero error on
...@@ -1580,17 +1580,15 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), ...@@ -1580,17 +1580,15 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
return ret; return ret;
} }
/** /**
* omap_hwmod_init - init omap_hwmod code and register hwmods * omap_hwmod_register - register an array of hwmods
* @ohs: pointer to an array of omap_hwmods to register * @ohs: pointer to an array of omap_hwmods to register
* *
* Intended to be called early in boot before the clock framework is * Intended to be called early in boot before the clock framework is
* initialized. If @ohs is not null, will register all omap_hwmods * initialized. If @ohs is not null, will register all omap_hwmods
* listed in @ohs that are valid for this chip. Returns -EINVAL if * listed in @ohs that are valid for this chip. Returns 0.
* omap_hwmod_init() has already been called or 0 otherwise.
*/ */
int __init omap_hwmod_init(struct omap_hwmod **ohs) int __init omap_hwmod_register(struct omap_hwmod **ohs)
{ {
int r, i; int r, i;
...@@ -1613,9 +1611,8 @@ int __init omap_hwmod_init(struct omap_hwmod **ohs) ...@@ -1613,9 +1611,8 @@ int __init omap_hwmod_init(struct omap_hwmod **ohs)
/* /*
* _populate_mpu_rt_base - populate the virtual address for a hwmod * _populate_mpu_rt_base - populate the virtual address for a hwmod
* *
* Must be called only from omap_hwmod_late_init so ioremap works properly. * Must be called only from omap_hwmod_setup_all() so ioremap works properly.
* Assumes the caller takes care of locking if needed. * Assumes the caller takes care of locking if needed.
*
*/ */
static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data)
{ {
...@@ -1631,13 +1628,13 @@ static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) ...@@ -1631,13 +1628,13 @@ static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data)
} }
/** /**
* omap_hwmod_late_init - do some post-clock framework initialization * omap_hwmod_setup - do some post-clock framework initialization
* *
* Must be called after omap2_clk_init(). Resolves the struct clk names * Must be called after omap2_clk_init(). Resolves the struct clk names
* to struct clk pointers for each registered omap_hwmod. Also calls * to struct clk pointers for each registered omap_hwmod. Also calls
* _setup() on each hwmod. Returns 0. * _setup() on each hwmod. Returns 0.
*/ */
static int __init omap_hwmod_late_init(void) static int __init omap_hwmod_setup_all(void)
{ {
int r; int r;
...@@ -1645,7 +1642,7 @@ static int __init omap_hwmod_late_init(void) ...@@ -1645,7 +1642,7 @@ static int __init omap_hwmod_late_init(void)
/* XXX check return value */ /* XXX check return value */
r = omap_hwmod_for_each(_init_clocks, NULL); r = omap_hwmod_for_each(_init_clocks, NULL);
WARN(r, "omap_hwmod: omap_hwmod_late_init(): _init_clocks failed\n"); WARN(r, "omap_hwmod: %s: _init_clocks failed\n", __func__);
mpu_oh = omap_hwmod_lookup(MPU_INITIATOR_NAME); mpu_oh = omap_hwmod_lookup(MPU_INITIATOR_NAME);
WARN(!mpu_oh, "omap_hwmod: could not find MPU initiator hwmod %s\n", WARN(!mpu_oh, "omap_hwmod: could not find MPU initiator hwmod %s\n",
...@@ -1655,7 +1652,7 @@ static int __init omap_hwmod_late_init(void) ...@@ -1655,7 +1652,7 @@ static int __init omap_hwmod_late_init(void)
return 0; return 0;
} }
core_initcall(omap_hwmod_late_init); core_initcall(omap_hwmod_setup_all);
/** /**
* omap_hwmod_enable - enable an omap_hwmod * omap_hwmod_enable - enable an omap_hwmod
...@@ -2174,11 +2171,11 @@ int omap_hwmod_for_each_by_class(const char *classname, ...@@ -2174,11 +2171,11 @@ int omap_hwmod_for_each_by_class(const char *classname,
* @oh: struct omap_hwmod * * @oh: struct omap_hwmod *
* @state: state that _setup() should leave the hwmod in * @state: state that _setup() should leave the hwmod in
* *
* Sets the hwmod state that @oh will enter at the end of _setup() (called by * Sets the hwmod state that @oh will enter at the end of _setup()
* omap_hwmod_late_init()). Only valid to call between calls to * (called by omap_hwmod_setup_all()). Only valid to call between
* omap_hwmod_init() and omap_hwmod_late_init(). Returns 0 upon success or * calling omap_hwmod_register() and omap_hwmod_setup_all(). Returns
* -EINVAL if there is a problem with the arguments or if the hwmod is * 0 upon success or -EINVAL if there is a problem with the arguments
* in the wrong state. * or if the hwmod is in the wrong state.
*/ */
int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state) int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state)
{ {
......
...@@ -1990,5 +1990,5 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = { ...@@ -1990,5 +1990,5 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
int __init omap2420_hwmod_init(void) int __init omap2420_hwmod_init(void)
{ {
return omap_hwmod_init(omap2420_hwmods); return omap_hwmod_register(omap2420_hwmods);
} }
...@@ -2183,5 +2183,5 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = { ...@@ -2183,5 +2183,5 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = {
int __init omap2430_hwmod_init(void) int __init omap2430_hwmod_init(void)
{ {
return omap_hwmod_init(omap2430_hwmods); return omap_hwmod_register(omap2430_hwmods);
} }
...@@ -2919,5 +2919,5 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { ...@@ -2919,5 +2919,5 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
int __init omap3xxx_hwmod_init(void) int __init omap3xxx_hwmod_init(void)
{ {
return omap_hwmod_init(omap3xxx_hwmods); return omap_hwmod_register(omap3xxx_hwmods);
} }
...@@ -5125,6 +5125,6 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { ...@@ -5125,6 +5125,6 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
int __init omap44xx_hwmod_init(void) int __init omap44xx_hwmod_init(void)
{ {
return omap_hwmod_init(omap44xx_hwmods); return omap_hwmod_register(omap44xx_hwmods);
} }
...@@ -680,7 +680,7 @@ static int __init omap_serial_early_init(void) ...@@ -680,7 +680,7 @@ static int __init omap_serial_early_init(void)
num_uarts++; num_uarts++;
/* /*
* NOTE: omap_hwmod_init() has not yet been called, * NOTE: omap_hwmod_setup*() has not yet been called,
* so no hwmod functions will work yet. * so no hwmod functions will work yet.
*/ */
......
/* /*
* omap_hwmod macros, structures * omap_hwmod macros, structures
* *
* Copyright (C) 2009-2010 Nokia Corporation * Copyright (C) 2009-2011 Nokia Corporation
* Paul Walmsley * Paul Walmsley
* *
* Created in collaboration with (alphabetical order): Benoît Cousson, * Created in collaboration with (alphabetical order): Benoît Cousson,
...@@ -370,8 +370,10 @@ struct omap_hwmod_omap4_prcm { ...@@ -370,8 +370,10 @@ struct omap_hwmod_omap4_prcm {
* of standby, rather than relying on module smart-standby * of standby, rather than relying on module smart-standby
* HWMOD_INIT_NO_RESET: don't reset this module at boot - important for * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for
* SDRAM controller, etc. XXX probably belongs outside the main hwmod file * SDRAM controller, etc. XXX probably belongs outside the main hwmod file
* XXX Should be HWMOD_SETUP_NO_RESET
* HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM * HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM
* controller, etc. XXX probably belongs outside the main hwmod file * controller, etc. XXX probably belongs outside the main hwmod file
* XXX Should be HWMOD_SETUP_NO_IDLE
* HWMOD_NO_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE) * HWMOD_NO_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE)
* when module is enabled, rather than the default, which is to * when module is enabled, rather than the default, which is to
* enable autoidle * enable autoidle
...@@ -535,7 +537,7 @@ struct omap_hwmod { ...@@ -535,7 +537,7 @@ struct omap_hwmod {
const struct omap_chip_id omap_chip; const struct omap_chip_id omap_chip;
}; };
int omap_hwmod_init(struct omap_hwmod **ohs); int omap_hwmod_register(struct omap_hwmod **ohs);
struct omap_hwmod *omap_hwmod_lookup(const char *name); struct omap_hwmod *omap_hwmod_lookup(const char *name);
int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
void *data); void *data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment