aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorShweta Gulati <shweta.gulati@ti.com>2012-02-29 17:33:37 -0500
committerKevin Hilman <khilman@ti.com>2012-03-05 14:29:25 -0500
commitcea6b942124683305280962969599fed36f0ea7e (patch)
tree75cee3814d28131230343d2990335bcff4d515cd /arch
parent149f1d5c8d2fd6879cdf93ca70f1cb745e698a1e (diff)
ARM: OMAP3+: SmartReflex: use voltage domain name in device attributes
To set sr ntarget values for all volt_domain, volt_table is retrieved by doing a look_up of 'vdd_name' field from omap_hwmod but voltage domain pointer does not belong to omap_hwmod and is not used anywhere else. As a part of voltage layer and SR Layer clean up volt pointer is removed from omap_hwmod and added in dev attributes of SR. The value of the field must match the voltage domain names for the binding to be effective. Tested on OMAP3630 SDP, OMAP3530 Beagleboard and OMAP4430 SDP Board. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Shweta Gulati <shweta.gulati@ti.com> Acked by: Nishanth Menon <nm@ti.com> Cc: Benoit Cousson <b-cousson@ti.com> Cc: Paul Walmsley <paul@pwsan.com> Signed-off-by: Jean Pihet <j-pihet@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c17
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c19
-rw-r--r--arch/arm/mach-omap2/smartreflex.h9
-rw-r--r--arch/arm/mach-omap2/sr_device.c11
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h2
5 files changed, 45 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 3c8dd928628e..8688960932f4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -29,6 +29,7 @@
29 29
30#include "omap_hwmod_common_data.h" 30#include "omap_hwmod_common_data.h"
31 31
32#include "smartreflex.h"
32#include "prm-regbits-34xx.h" 33#include "prm-regbits-34xx.h"
33#include "cm-regbits-34xx.h" 34#include "cm-regbits-34xx.h"
34#include "wd_timer.h" 35#include "wd_timer.h"
@@ -2664,6 +2665,10 @@ static struct omap_hwmod_class omap36xx_smartreflex_hwmod_class = {
2664}; 2665};
2665 2666
2666/* SR1 */ 2667/* SR1 */
2668static struct omap_smartreflex_dev_attr sr1_dev_attr = {
2669 .sensor_voltdm_name = "mpu_iva",
2670};
2671
2667static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { 2672static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = {
2668 &omap3_l4_core__sr1, 2673 &omap3_l4_core__sr1,
2669}; 2674};
@@ -2672,7 +2677,6 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2672 .name = "sr1_hwmod", 2677 .name = "sr1_hwmod",
2673 .class = &omap34xx_smartreflex_hwmod_class, 2678 .class = &omap34xx_smartreflex_hwmod_class,
2674 .main_clk = "sr1_fck", 2679 .main_clk = "sr1_fck",
2675 .vdd_name = "mpu_iva",
2676 .prcm = { 2680 .prcm = {
2677 .omap2 = { 2681 .omap2 = {
2678 .prcm_reg_id = 1, 2682 .prcm_reg_id = 1,
@@ -2684,6 +2688,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2684 }, 2688 },
2685 .slaves = omap3_sr1_slaves, 2689 .slaves = omap3_sr1_slaves,
2686 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2690 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2691 .dev_attr = &sr1_dev_attr,
2687 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2692 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2688}; 2693};
2689 2694
@@ -2691,7 +2696,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2691 .name = "sr1_hwmod", 2696 .name = "sr1_hwmod",
2692 .class = &omap36xx_smartreflex_hwmod_class, 2697 .class = &omap36xx_smartreflex_hwmod_class,
2693 .main_clk = "sr1_fck", 2698 .main_clk = "sr1_fck",
2694 .vdd_name = "mpu_iva",
2695 .prcm = { 2699 .prcm = {
2696 .omap2 = { 2700 .omap2 = {
2697 .prcm_reg_id = 1, 2701 .prcm_reg_id = 1,
@@ -2703,9 +2707,14 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2703 }, 2707 },
2704 .slaves = omap3_sr1_slaves, 2708 .slaves = omap3_sr1_slaves,
2705 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2709 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2710 .dev_attr = &sr1_dev_attr,
2706}; 2711};
2707 2712
2708/* SR2 */ 2713/* SR2 */
2714static struct omap_smartreflex_dev_attr sr2_dev_attr = {
2715 .sensor_voltdm_name = "core",
2716};
2717
2709static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { 2718static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = {
2710 &omap3_l4_core__sr2, 2719 &omap3_l4_core__sr2,
2711}; 2720};
@@ -2714,7 +2723,6 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
2714 .name = "sr2_hwmod", 2723 .name = "sr2_hwmod",
2715 .class = &omap34xx_smartreflex_hwmod_class, 2724 .class = &omap34xx_smartreflex_hwmod_class,
2716 .main_clk = "sr2_fck", 2725 .main_clk = "sr2_fck",
2717 .vdd_name = "core",
2718 .prcm = { 2726 .prcm = {
2719 .omap2 = { 2727 .omap2 = {
2720 .prcm_reg_id = 1, 2728 .prcm_reg_id = 1,
@@ -2726,6 +2734,7 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
2726 }, 2734 },
2727 .slaves = omap3_sr2_slaves, 2735 .slaves = omap3_sr2_slaves,
2728 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2736 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2737 .dev_attr = &sr2_dev_attr,
2729 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2738 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2730}; 2739};
2731 2740
@@ -2733,7 +2742,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
2733 .name = "sr2_hwmod", 2742 .name = "sr2_hwmod",
2734 .class = &omap36xx_smartreflex_hwmod_class, 2743 .class = &omap36xx_smartreflex_hwmod_class,
2735 .main_clk = "sr2_fck", 2744 .main_clk = "sr2_fck",
2736 .vdd_name = "core",
2737 .prcm = { 2745 .prcm = {
2738 .omap2 = { 2746 .omap2 = {
2739 .prcm_reg_id = 1, 2747 .prcm_reg_id = 1,
@@ -2745,6 +2753,7 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
2745 }, 2753 },
2746 .slaves = omap3_sr2_slaves, 2754 .slaves = omap3_sr2_slaves,
2747 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2755 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2756 .dev_attr = &sr2_dev_attr,
2748}; 2757};
2749 2758
2750/* 2759/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index ef0524c10a84..ee3624bd1996 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -34,6 +34,7 @@
34 34
35#include "omap_hwmod_common_data.h" 35#include "omap_hwmod_common_data.h"
36 36
37#include "smartreflex.h"
37#include "cm1_44xx.h" 38#include "cm1_44xx.h"
38#include "cm2_44xx.h" 39#include "cm2_44xx.h"
39#include "prm44xx.h" 40#include "prm44xx.h"
@@ -3963,6 +3964,10 @@ static struct omap_hwmod_class omap44xx_smartreflex_hwmod_class = {
3963}; 3964};
3964 3965
3965/* smartreflex_core */ 3966/* smartreflex_core */
3967static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = {
3968 .sensor_voltdm_name = "core",
3969};
3970
3966static struct omap_hwmod omap44xx_smartreflex_core_hwmod; 3971static struct omap_hwmod omap44xx_smartreflex_core_hwmod;
3967static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { 3972static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = {
3968 { .irq = 19 + OMAP44XX_IRQ_GIC_START }, 3973 { .irq = 19 + OMAP44XX_IRQ_GIC_START },
@@ -3999,7 +4004,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
3999 .mpu_irqs = omap44xx_smartreflex_core_irqs, 4004 .mpu_irqs = omap44xx_smartreflex_core_irqs,
4000 4005
4001 .main_clk = "smartreflex_core_fck", 4006 .main_clk = "smartreflex_core_fck",
4002 .vdd_name = "core",
4003 .prcm = { 4007 .prcm = {
4004 .omap4 = { 4008 .omap4 = {
4005 .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, 4009 .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET,
@@ -4009,9 +4013,14 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
4009 }, 4013 },
4010 .slaves = omap44xx_smartreflex_core_slaves, 4014 .slaves = omap44xx_smartreflex_core_slaves,
4011 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), 4015 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves),
4016 .dev_attr = &smartreflex_core_dev_attr,
4012}; 4017};
4013 4018
4014/* smartreflex_iva */ 4019/* smartreflex_iva */
4020static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = {
4021 .sensor_voltdm_name = "iva",
4022};
4023
4015static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; 4024static struct omap_hwmod omap44xx_smartreflex_iva_hwmod;
4016static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { 4025static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = {
4017 { .irq = 102 + OMAP44XX_IRQ_GIC_START }, 4026 { .irq = 102 + OMAP44XX_IRQ_GIC_START },
@@ -4047,7 +4056,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4047 .clkdm_name = "l4_ao_clkdm", 4056 .clkdm_name = "l4_ao_clkdm",
4048 .mpu_irqs = omap44xx_smartreflex_iva_irqs, 4057 .mpu_irqs = omap44xx_smartreflex_iva_irqs,
4049 .main_clk = "smartreflex_iva_fck", 4058 .main_clk = "smartreflex_iva_fck",
4050 .vdd_name = "iva",
4051 .prcm = { 4059 .prcm = {
4052 .omap4 = { 4060 .omap4 = {
4053 .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, 4061 .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET,
@@ -4057,9 +4065,14 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4057 }, 4065 },
4058 .slaves = omap44xx_smartreflex_iva_slaves, 4066 .slaves = omap44xx_smartreflex_iva_slaves,
4059 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), 4067 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves),
4068 .dev_attr = &smartreflex_iva_dev_attr,
4060}; 4069};
4061 4070
4062/* smartreflex_mpu */ 4071/* smartreflex_mpu */
4072static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = {
4073 .sensor_voltdm_name = "mpu",
4074};
4075
4063static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; 4076static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod;
4064static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { 4077static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = {
4065 { .irq = 18 + OMAP44XX_IRQ_GIC_START }, 4078 { .irq = 18 + OMAP44XX_IRQ_GIC_START },
@@ -4095,7 +4108,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4095 .clkdm_name = "l4_ao_clkdm", 4108 .clkdm_name = "l4_ao_clkdm",
4096 .mpu_irqs = omap44xx_smartreflex_mpu_irqs, 4109 .mpu_irqs = omap44xx_smartreflex_mpu_irqs,
4097 .main_clk = "smartreflex_mpu_fck", 4110 .main_clk = "smartreflex_mpu_fck",
4098 .vdd_name = "mpu",
4099 .prcm = { 4111 .prcm = {
4100 .omap4 = { 4112 .omap4 = {
4101 .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, 4113 .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET,
@@ -4105,6 +4117,7 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4105 }, 4117 },
4106 .slaves = omap44xx_smartreflex_mpu_slaves, 4118 .slaves = omap44xx_smartreflex_mpu_slaves,
4107 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), 4119 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves),
4120 .dev_attr = &smartreflex_mpu_dev_attr,
4108}; 4121};
4109 4122
4110/* 4123/*
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
index 5f35b9e25556..fd61498f71e0 100644
--- a/arch/arm/mach-omap2/smartreflex.h
+++ b/arch/arm/mach-omap2/smartreflex.h
@@ -152,6 +152,15 @@ struct omap_sr_pmic_data {
152 void (*sr_pmic_init) (void); 152 void (*sr_pmic_init) (void);
153}; 153};
154 154
155/**
156 * struct omap_smartreflex_dev_attr - Smartreflex Device attribute.
157 *
158 * @sensor_voltdm_name: Name of voltdomain of SR instance
159 */
160struct omap_smartreflex_dev_attr {
161 const char *sensor_voltdm_name;
162};
163
155#ifdef CONFIG_OMAP_SMARTREFLEX 164#ifdef CONFIG_OMAP_SMARTREFLEX
156/* 165/*
157 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. 166 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR.
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 9f43fcc05d3e..60293370a2a7 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -74,6 +74,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
74 struct omap_sr_data *sr_data; 74 struct omap_sr_data *sr_data;
75 struct platform_device *pdev; 75 struct platform_device *pdev;
76 struct omap_volt_data *volt_data; 76 struct omap_volt_data *volt_data;
77 struct omap_smartreflex_dev_attr *sr_dev_attr;
77 char *name = "smartreflex"; 78 char *name = "smartreflex";
78 static int i; 79 static int i;
79 80
@@ -84,9 +85,11 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
84 return -ENOMEM; 85 return -ENOMEM;
85 } 86 }
86 87
87 if (!oh->vdd_name) { 88 sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
89 if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
88 pr_err("%s: No voltage domain specified for %s." 90 pr_err("%s: No voltage domain specified for %s."
89 "Cannot initialize\n", __func__, oh->name); 91 "Cannot initialize\n", __func__,
92 oh->name);
90 goto exit; 93 goto exit;
91 } 94 }
92 95
@@ -94,10 +97,10 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
94 sr_data->senn_mod = 0x1; 97 sr_data->senn_mod = 0x1;
95 sr_data->senp_mod = 0x1; 98 sr_data->senp_mod = 0x1;
96 99
97 sr_data->voltdm = voltdm_lookup(oh->vdd_name); 100 sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name);
98 if (IS_ERR(sr_data->voltdm)) { 101 if (IS_ERR(sr_data->voltdm)) {
99 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", 102 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
100 __func__, oh->vdd_name); 103 __func__, sr_dev_attr->sensor_voltdm_name);
101 goto exit; 104 goto exit;
102 } 105 }
103 106
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 647010109afa..9e8e63d52aab 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -484,7 +484,6 @@ struct omap_hwmod_class {
484 * @main_clk: main clock: OMAP clock name 484 * @main_clk: main clock: OMAP clock name
485 * @_clk: pointer to the main struct clk (filled in at runtime) 485 * @_clk: pointer to the main struct clk (filled in at runtime)
486 * @opt_clks: other device clocks that drivers can request (0..*) 486 * @opt_clks: other device clocks that drivers can request (0..*)
487 * @vdd_name: voltage domain name
488 * @voltdm: pointer to voltage domain (filled in at runtime) 487 * @voltdm: pointer to voltage domain (filled in at runtime)
489 * @masters: ptr to array of OCP ifs that this hwmod can initiate on 488 * @masters: ptr to array of OCP ifs that this hwmod can initiate on
490 * @slaves: ptr to array of OCP ifs that this hwmod can respond on 489 * @slaves: ptr to array of OCP ifs that this hwmod can respond on
@@ -528,7 +527,6 @@ struct omap_hwmod {
528 struct omap_hwmod_opt_clk *opt_clks; 527 struct omap_hwmod_opt_clk *opt_clks;
529 char *clkdm_name; 528 char *clkdm_name;
530 struct clockdomain *clkdm; 529 struct clockdomain *clkdm;
531 char *vdd_name;
532 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 530 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
533 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 531 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */
534 void *dev_attr; 532 void *dev_attr;