aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Vadillo <vadillo@ti.com>2011-01-11 16:38:26 -0500
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:19:11 -0400
commit580be3a42dc924123026ce4b4b0f0f29c8e62252 (patch)
tree00b83e15cd235584ac2c9edd8a941858bbb4a985
parent4d7c3dffbb84a0abe4a13fda3519c733b5f00300 (diff)
omap: remoteproc: use gptimer 4 and 9 as ipu clk
Enable gptimer 4 and 9 to be used as ipu clk. Gptimers will be requested when calling rproc_start() and released them when calling rproc_stop(), also when hibernating ipu the gptimers will be stop/start to ensure proper pm functionality. The gptimer numbers are configurable, currently 4 will be used by ipu_c0 and 9 by ipu_c1. Change-Id: I9424991e34e786ab2f57a1dc625ae801290fd7b6 Reported-by: Paul Hunt <hunt@ti.com> Signed-off-by: Miguel Vadillo <vadillo@ti.com>
-rw-r--r--arch/arm/mach-omap2/remoteproc44xx.c43
-rw-r--r--arch/arm/plat-omap/include/plat/remoteproc.h7
-rw-r--r--arch/arm/plat-omap/remoteproc.c3
3 files changed, 39 insertions, 14 deletions
diff --git a/arch/arm/mach-omap2/remoteproc44xx.c b/arch/arm/mach-omap2/remoteproc44xx.c
index f87a2809716..7549798ff81 100644
--- a/arch/arm/mach-omap2/remoteproc44xx.c
+++ b/arch/arm/mach-omap2/remoteproc44xx.c
@@ -37,10 +37,10 @@ static inline int proc44x_start(struct device *dev, u32 start_addr)
37 to_platform_device(dev)); 37 to_platform_device(dev));
38 int ret = 0; 38 int ret = 0;
39 39
40 /* Enable the Timer that would be used by co-processor */ 40 /* Enable the Timer that would be used by co-processor for HIB/WD*/
41 if (obj->timer_id >= 0) { 41 if (obj->timer_hib_id >= 0) {
42 obj->dmtimer = 42 obj->dmtimer =
43 omap_dm_timer_request_specific(obj->timer_id); 43 omap_dm_timer_request_specific(obj->timer_hib_id);
44 if (!obj->dmtimer) { 44 if (!obj->dmtimer) {
45 ret = -EBUSY; 45 ret = -EBUSY;
46 goto err_start; 46 goto err_start;
@@ -50,6 +50,19 @@ static inline int proc44x_start(struct device *dev, u32 start_addr)
50 omap_dm_timer_set_source(obj->dmtimer, OMAP_TIMER_SRC_SYS_CLK); 50 omap_dm_timer_set_source(obj->dmtimer, OMAP_TIMER_SRC_SYS_CLK);
51 } 51 }
52 52
53 /* Enable the Timer that would be used by co-processor as Clock*/
54 if (obj->timer_clk_id >= 0) {
55 obj->dmtimer_clk =
56 omap_dm_timer_request_specific(obj->timer_clk_id);
57 if (!obj->dmtimer_clk) {
58 ret = -EBUSY;
59 goto err_start;
60 }
61
62 omap_dm_timer_set_source(obj->dmtimer_clk,
63 OMAP_TIMER_SRC_SYS_CLK);
64 }
65
53 ret = omap_device_enable(pdev); 66 ret = omap_device_enable(pdev);
54 if (ret) 67 if (ret)
55 goto err_start; 68 goto err_start;
@@ -80,6 +93,11 @@ static inline int proc44x_stop(struct device *dev)
80 obj->dmtimer = NULL; 93 obj->dmtimer = NULL;
81 } 94 }
82 95
96 if (obj->dmtimer_clk) {
97 omap_dm_timer_free(obj->dmtimer_clk);
98 obj->dmtimer_clk = NULL;
99 }
100
83 obj->state = OMAP_RPROC_STOPPED; 101 obj->state = OMAP_RPROC_STOPPED;
84 return ret; 102 return ret;
85} 103}
@@ -98,6 +116,8 @@ static inline int proc44x_sleep(struct device *dev)
98 116
99 if (obj->dmtimer) 117 if (obj->dmtimer)
100 omap_dm_timer_stop(obj->dmtimer); 118 omap_dm_timer_stop(obj->dmtimer);
119 if (obj->dmtimer_clk)
120 omap_dm_timer_stop(obj->dmtimer_clk);
101 } 121 }
102 122
103 obj->state = OMAP_RPROC_HIBERNATING; 123 obj->state = OMAP_RPROC_HIBERNATING;
@@ -113,6 +133,8 @@ static inline int proc44x_wakeup(struct device *dev)
113 133
114 if (obj->dmtimer) 134 if (obj->dmtimer)
115 omap_dm_timer_start(obj->dmtimer); 135 omap_dm_timer_start(obj->dmtimer);
136 if (obj->dmtimer_clk)
137 omap_dm_timer_start(obj->dmtimer_clk);
116 138
117 ret = omap_device_enable(pdev); 139 ret = omap_device_enable(pdev);
118 if (ret) 140 if (ret)
@@ -164,27 +186,26 @@ static struct omap_rproc_platform_data omap4_rproc_data[] = {
164 .name = "tesla", 186 .name = "tesla",
165 .ops = &omap4_tesla_ops, 187 .ops = &omap4_tesla_ops,
166 .oh_name = "dsp_c0", 188 .oh_name = "dsp_c0",
167 .timer_id = 5, 189 .timer_clk_id = 5,
190 .timer_hib_id = -1,
168 }, 191 },
169 { 192 {
170 .name = "ducati-proc0", 193 .name = "ducati-proc0",
171 .ops = &omap4_ducati0_ops, 194 .ops = &omap4_ducati0_ops,
172 .oh_name = "ipu_c0", 195 .oh_name = "ipu_c0",
196 .timer_clk_id = 4,
173#ifdef CONFIG_SYSLINK_IPU_SELF_HIBERNATION 197#ifdef CONFIG_SYSLINK_IPU_SELF_HIBERNATION
174 .timer_id = 3, 198 .timer_hib_id = 3,
175#else 199#else
176 .timer_id = -1, 200 .timer_hib_id = -1,
177#endif 201#endif
178 }, 202 },
179 { 203 {
180 .name = "ducati-proc1", 204 .name = "ducati-proc1",
181 .ops = &omap4_ducati1_ops, 205 .ops = &omap4_ducati1_ops,
182 .oh_name = "ipu_c1", 206 .oh_name = "ipu_c1",
183#ifdef CONFIG_SYSLINK_IPU_SELF_HIBERNATION 207 .timer_clk_id = 9,
184 .timer_id = 4, 208 .timer_hib_id = -1,
185#else
186 .timer_id = -1,
187#endif
188 209
189 }, 210 },
190}; 211};
diff --git a/arch/arm/plat-omap/include/plat/remoteproc.h b/arch/arm/plat-omap/include/plat/remoteproc.h
index 3c579927416..5ed9bc8376d 100644
--- a/arch/arm/plat-omap/include/plat/remoteproc.h
+++ b/arch/arm/plat-omap/include/plat/remoteproc.h
@@ -90,7 +90,8 @@ struct omap_rproc_platform_data {
90 struct omap_rproc_ops *ops; 90 struct omap_rproc_ops *ops;
91 char *name; 91 char *name;
92 char *oh_name; 92 char *oh_name;
93 int timer_id; 93 int timer_hib_id;
94 int timer_clk_id;
94}; 95};
95 96
96struct omap_rproc { 97struct omap_rproc {
@@ -102,8 +103,10 @@ struct omap_rproc {
102 int minor; 103 int minor;
103 struct blocking_notifier_head notifier; 104 struct blocking_notifier_head notifier;
104 struct mutex lock; 105 struct mutex lock;
105 int timer_id; 106 int timer_hib_id;
107 int timer_clk_id;
106 struct omap_dm_timer *dmtimer; 108 struct omap_dm_timer *dmtimer;
109 struct omap_dm_timer *dmtimer_clk;
107 struct list_head event_list; 110 struct list_head event_list;
108 spinlock_t event_lock; 111 spinlock_t event_lock;
109}; 112};
diff --git a/arch/arm/plat-omap/remoteproc.c b/arch/arm/plat-omap/remoteproc.c
index 3b544bfefaf..4f66af4e7e9 100644
--- a/arch/arm/plat-omap/remoteproc.c
+++ b/arch/arm/plat-omap/remoteproc.c
@@ -418,7 +418,8 @@ static int omap_rproc_probe(struct platform_device *pdev)
418 atomic_set(&rproc->count, 0); 418 atomic_set(&rproc->count, 0);
419 rproc->name = pdata->name; 419 rproc->name = pdata->name;
420 420
421 rproc->timer_id = pdata->timer_id; 421 rproc->timer_clk_id = pdata->timer_clk_id;
422 rproc->timer_hib_id = pdata->timer_hib_id;
422 423
423 mutex_init(&rproc->lock); 424 mutex_init(&rproc->lock);
424 BLOCKING_INIT_NOTIFIER_HEAD(&rproc->notifier); 425 BLOCKING_INIT_NOTIFIER_HEAD(&rproc->notifier);