diff options
author | Jean Pihet <j-pihet@ti.com> | 2012-04-25 01:49:44 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2012-05-31 19:03:44 -0400 |
commit | 5e7f2e12e4ea14a34fb9b5941d60a4464fc8d40a (patch) | |
tree | 0ff1412b37d31fa0c601de90759928b9dbcd7960 /arch/arm/mach-omap2/sr_device.c | |
parent | fa60be6e3f9362bd841e26b9366f0db7b761a042 (diff) |
ARM: OMAP2+: SmartReflex: Use per-OPP data structure
The SmartReflex driver incorrectly treats some per-OPP data as data
common to all OPPs (e.g., ERRMINLIMIT). Move this data into a per-OPP
data structure.
Furthermore, in order to make the SmartReflex implementation ready for
the move to drivers/, remove the dependency from the SR driver code
to the voltage layer by querying the data tables only from the SR device
init code.
Based on Paul's original code for the SmartReflex driver conversion.
Signed-off-by: Jean Pihet <j-pihet@ti.com>
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/sr_device.c')
-rw-r--r-- | arch/arm/mach-omap2/sr_device.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index e081174f28af..e107e3915a8a 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c | |||
@@ -36,7 +36,10 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, | |||
36 | struct omap_sr_data *sr_data) | 36 | struct omap_sr_data *sr_data) |
37 | { | 37 | { |
38 | struct omap_sr_nvalue_table *nvalue_table; | 38 | struct omap_sr_nvalue_table *nvalue_table; |
39 | int i, count = 0; | 39 | int i, j, count = 0; |
40 | |||
41 | sr_data->nvalue_count = 0; | ||
42 | sr_data->nvalue_table = NULL; | ||
40 | 43 | ||
41 | while (volt_data[count].volt_nominal) | 44 | while (volt_data[count].volt_nominal) |
42 | count++; | 45 | count++; |
@@ -44,8 +47,14 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, | |||
44 | nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count, | 47 | nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count, |
45 | GFP_KERNEL); | 48 | GFP_KERNEL); |
46 | 49 | ||
47 | for (i = 0; i < count; i++) { | 50 | if (!nvalue_table) { |
51 | pr_err("OMAP: SmartReflex: cannot allocate memory for n-value table\n"); | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | for (i = 0, j = 0; i < count; i++) { | ||
48 | u32 v; | 56 | u32 v; |
57 | |||
49 | /* | 58 | /* |
50 | * In OMAP4 the efuse registers are 24 bit aligned. | 59 | * In OMAP4 the efuse registers are 24 bit aligned. |
51 | * A __raw_readl will fail for non-32 bit aligned address | 60 | * A __raw_readl will fail for non-32 bit aligned address |
@@ -58,15 +67,30 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, | |||
58 | omap_ctrl_readb(offset + 1) << 8 | | 67 | omap_ctrl_readb(offset + 1) << 8 | |
59 | omap_ctrl_readb(offset + 2) << 16; | 68 | omap_ctrl_readb(offset + 2) << 16; |
60 | } else { | 69 | } else { |
61 | v = omap_ctrl_readl(volt_data[i].sr_efuse_offs); | 70 | v = omap_ctrl_readl(volt_data[i].sr_efuse_offs); |
62 | } | 71 | } |
63 | 72 | ||
64 | nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs; | 73 | /* |
65 | nvalue_table[i].nvalue = v; | 74 | * Many OMAP SoCs don't have the eFuse values set. |
75 | * For example, pretty much all OMAP3xxx before | ||
76 | * ES3.something. | ||
77 | * | ||
78 | * XXX There needs to be some way for board files or | ||
79 | * userspace to add these in. | ||
80 | */ | ||
81 | if (v == 0) | ||
82 | continue; | ||
83 | |||
84 | nvalue_table[j].nvalue = v; | ||
85 | nvalue_table[j].efuse_offs = volt_data[i].sr_efuse_offs; | ||
86 | nvalue_table[j].errminlimit = volt_data[i].sr_errminlimit; | ||
87 | nvalue_table[j].volt_nominal = volt_data[i].volt_nominal; | ||
88 | |||
89 | j++; | ||
66 | } | 90 | } |
67 | 91 | ||
68 | sr_data->nvalue_table = nvalue_table; | 92 | sr_data->nvalue_table = nvalue_table; |
69 | sr_data->nvalue_count = count; | 93 | sr_data->nvalue_count = j; |
70 | } | 94 | } |
71 | 95 | ||
72 | static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | 96 | static int __init sr_dev_init(struct omap_hwmod *oh, void *user) |