Commit 81a60482 authored by Kevin Hilman's avatar Kevin Hilman

OMAP2+: voltage: start towards a new voltagedomain layer

Start cleaning up the voltage layer to have a voltage domain layer
that resembles the structure of the existing clock and power domain
layers.  To that end:

- move the 'struct voltagedomain' out of 'struct omap_vdd_info' to
  become the primary data structure.

- convert any functions taking a pointer to struct omap_vdd_info into
  functions taking a struct voltagedomain pointer.

- convert the register & initialize of voltage domains to look like
  that of powerdomains

- convert omap_voltage_domain_lookup() to voltdm_lookup(), modeled
  after the current powerdomain and clockdomain lookup functions.

- omap_voltage_late_init(): only configure VDD info when
  the vdd_info struct is non-NULL
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent c39263c3
......@@ -38,6 +38,7 @@
#include "io.h"
#include <plat/omap-pm.h>
#include "voltage.h"
#include "powerdomain.h"
#include "clockdomain.h"
......@@ -349,10 +350,12 @@ void __init omap2_init_common_infrastructure(void)
omap243x_clockdomains_init();
omap2430_hwmod_init();
} else if (cpu_is_omap34xx()) {
omap3xxx_voltagedomains_init();
omap3xxx_powerdomains_init();
omap3xxx_clockdomains_init();
omap3xxx_hwmod_init();
} else if (cpu_is_omap44xx()) {
omap44xx_voltagedomains_init();
omap44xx_powerdomains_init();
omap44xx_clockdomains_init();
omap44xx_hwmod_init();
......
......@@ -250,13 +250,13 @@ int __init omap4_twl_init(void)
if (!cpu_is_omap44xx())
return -ENODEV;
voltdm = omap_voltage_domain_lookup("mpu");
voltdm = voltdm_lookup("mpu");
omap_voltage_register_pmic(voltdm, &omap4_mpu_volt_info);
voltdm = omap_voltage_domain_lookup("iva");
voltdm = voltdm_lookup("iva");
omap_voltage_register_pmic(voltdm, &omap4_iva_volt_info);
voltdm = omap_voltage_domain_lookup("core");
voltdm = voltdm_lookup("core");
omap_voltage_register_pmic(voltdm, &omap4_core_volt_info);
return 0;
......@@ -288,10 +288,10 @@ int __init omap3_twl_init(void)
if (!twl_sr_enable_autoinit)
omap3_twl_set_sr_bit(true);
voltdm = omap_voltage_domain_lookup("mpu");
voltdm = voltdm_lookup("mpu");
omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info);
voltdm = omap_voltage_domain_lookup("core");
voltdm = voltdm_lookup("core");
omap_voltage_register_pmic(voltdm, &omap3_core_volt_info);
return 0;
......
......@@ -181,7 +181,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
goto exit;
}
voltdm = omap_voltage_domain_lookup(vdd_name);
voltdm = voltdm_lookup(vdd_name);
if (IS_ERR(voltdm)) {
printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
__func__, vdd_name);
......
......@@ -102,7 +102,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
sr_data->senn_mod = 0x1;
sr_data->senp_mod = 0x1;
sr_data->voltdm = omap_voltage_domain_lookup(oh->vdd_name);
sr_data->voltdm = voltdm_lookup(oh->vdd_name);
if (IS_ERR(sr_data->voltdm)) {
pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
__func__, oh->vdd_name);
......
This diff is collapsed.
......@@ -31,6 +31,8 @@
#define OMAP3_VOLTOFFSET 0xff
#define OMAP3_VOLTSETUP2 0xff
struct omap_vdd_info;
/**
* struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
* data
......@@ -50,11 +52,14 @@ struct omap_vfsm_instance_data {
/**
* struct voltagedomain - omap voltage domain global structure.
* @name: Name of the voltage domain which can be used as a unique
* identifier.
* @name: Name of the voltage domain which can be used as a unique identifier.
* @node: list_head linking all voltage domains
* @vdd: to be removed
*/
struct voltagedomain {
char *name;
struct list_head node;
struct omap_vdd_info *vdd;
};
/**
......@@ -116,7 +121,6 @@ struct omap_volt_pmic_info {
* @vc_data : structure containing various various vc registers,
* shifts, masks etc.
* @vfsm : voltage manager FSM data
* @voltdm : pointer to the voltage domain structure
* @debug_dir : debug directory for this voltage domain.
* @curr_volt : current voltage for this vdd.
* @prm_irqst_mod : PRM module id used for PRM IRQ status register access
......@@ -130,7 +134,6 @@ struct omap_vdd_info {
struct omap_vp_runtime_data vp_rt_data;
struct omap_vc_instance_data *vc_data;
const struct omap_vfsm_instance_data *vfsm;
struct voltagedomain voltdm;
struct dentry *debug_dir;
u32 curr_volt;
bool vp_enabled;
......@@ -139,7 +142,7 @@ struct omap_vdd_info {
u8 prm_irqst_reg;
u32 (*read_reg) (u16 mod, u8 offset);
void (*write_reg) (u32 val, u16 mod, u8 offset);
int (*volt_scale) (struct omap_vdd_info *vdd,
int (*volt_scale) (struct voltagedomain *voltdm,
unsigned long target_volt);
};
......@@ -155,16 +158,11 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
unsigned long volt);
unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
u8 omap_vdd_count);
#ifdef CONFIG_PM
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
struct omap_volt_pmic_info *pmic_info);
void omap_change_voltscale_method(struct voltagedomain *voltdm,
int voltscale_method);
/* API to get the voltagedomain pointer */
struct voltagedomain *omap_voltage_domain_lookup(char *name);
int omap_voltage_late_init(void);
#else
static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
......@@ -178,10 +176,11 @@ static inline int omap_voltage_late_init(void)
{
return -EINVAL;
}
static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
{
return ERR_PTR(-EINVAL);
}
#endif
extern void omap3xxx_voltagedomains_init(void);
extern void omap44xx_voltagedomains_init(void);
struct voltagedomain *voltdm_lookup(const char *name);
void voltdm_init(struct voltagedomain **voltdm_list);
#endif
......@@ -43,9 +43,6 @@ static struct omap_vdd_info omap3_vdd1_info = {
.vp_data = &omap3_vp1_data,
.vc_data = &omap3_vc1_data,
.vfsm = &omap3_vdd1_vfsm_data,
.voltdm = {
.name = "mpu",
},
};
static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
......@@ -60,23 +57,26 @@ static struct omap_vdd_info omap3_vdd2_info = {
.vp_data = &omap3_vp2_data,
.vc_data = &omap3_vc2_data,
.vfsm = &omap3_vdd2_vfsm_data,
.voltdm = {
.name = "core",
},
};
/* OMAP3 VDD structures */
static struct omap_vdd_info *omap3_vdd_info[] = {
&omap3_vdd1_info,
&omap3_vdd2_info,
static struct voltagedomain omap3_voltdm_mpu = {
.name = "mpu",
.vdd = &omap3_vdd1_info,
};
/* OMAP3 specific voltage init functions */
static int __init omap3xxx_voltage_early_init(void)
{
if (!cpu_is_omap34xx())
return 0;
static struct voltagedomain omap3_voltdm_core = {
.name = "core",
.vdd = &omap3_vdd2_info,
};
static struct voltagedomain *voltagedomains_omap3[] __initdata = {
&omap3_voltdm_mpu,
&omap3_voltdm_core,
NULL,
};
void __init omap3xxx_voltagedomains_init(void)
{
/*
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
......@@ -89,7 +89,5 @@ static int __init omap3xxx_voltage_early_init(void)
omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
}
return omap_voltage_early_init(omap3_vdd_info,
ARRAY_SIZE(omap3_vdd_info));
voltdm_init(voltagedomains_omap3);
};
core_initcall(omap3xxx_voltage_early_init);
......@@ -42,9 +42,6 @@ static struct omap_vdd_info omap4_vdd_mpu_info = {
.vp_data = &omap4_vp_mpu_data,
.vc_data = &omap4_vc_mpu_data,
.vfsm = &omap4_vdd_mpu_vfsm_data,
.voltdm = {
.name = "mpu",
},
};
static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
......@@ -57,9 +54,6 @@ static struct omap_vdd_info omap4_vdd_iva_info = {
.vp_data = &omap4_vp_iva_data,
.vc_data = &omap4_vc_iva_data,
.vfsm = &omap4_vdd_iva_vfsm_data,
.voltdm = {
.name = "iva",
},
};
static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
......@@ -72,24 +66,32 @@ static struct omap_vdd_info omap4_vdd_core_info = {
.vp_data = &omap4_vp_core_data,
.vc_data = &omap4_vc_core_data,
.vfsm = &omap4_vdd_core_vfsm_data,
.voltdm = {
.name = "core",
},
};
/* OMAP4 VDD structures */
static struct omap_vdd_info *omap4_vdd_info[] = {
&omap4_vdd_mpu_info,
&omap4_vdd_iva_info,
&omap4_vdd_core_info,
static struct voltagedomain omap4_voltdm_mpu = {
.name = "mpu",
.vdd = &omap4_vdd_mpu_info,
};
/* OMAP4 specific voltage init functions */
static int __init omap44xx_voltage_early_init(void)
{
if (!cpu_is_omap44xx())
return 0;
static struct voltagedomain omap4_voltdm_iva = {
.name = "iva",
.vdd = &omap4_vdd_iva_info,
};
static struct voltagedomain omap4_voltdm_core = {
.name = "core",
.vdd = &omap4_vdd_core_info,
};
static struct voltagedomain *voltagedomains_omap4[] __initdata = {
&omap4_voltdm_mpu,
&omap4_voltdm_iva,
&omap4_voltdm_core,
NULL,
};
void __init omap44xx_voltagedomains_init(void)
{
/*
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
......@@ -98,7 +100,5 @@ static int __init omap44xx_voltage_early_init(void)
omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
return omap_voltage_early_init(omap4_vdd_info,
ARRAY_SIZE(omap4_vdd_info));
voltdm_init(voltagedomains_omap4);
};
core_initcall(omap44xx_voltage_early_init);
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