aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2018-02-28 02:25:19 -0500
committerTony Lindgren <tony@atomide.com>2018-02-28 16:38:10 -0500
commit592ea6bd1fad6068fb7d813d36cfd832313f4421 (patch)
tree0120d24259f478a675f1c7b6514c1ef9164bfd87 /drivers/clocksource
parentac30751df953c298ee86e4f97a61347544833de8 (diff)
clocksource: timer-ti-dm: Make unexported functions static
As dmtimer no longer exports functions, make those previously exported static (this requires few functions to be moved around as their prototypes were deleted). Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/timer-ti-dm.c224
1 files changed, 115 insertions, 109 deletions
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 70782a41c493..935350176c01 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -163,6 +163,92 @@ static int omap_dm_timer_of_set_source(struct omap_dm_timer *timer)
163 return ret; 163 return ret;
164} 164}
165 165
166static int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
167{
168 int ret;
169 char *parent_name = NULL;
170 struct clk *parent;
171 struct dmtimer_platform_data *pdata;
172
173 if (unlikely(!timer))
174 return -EINVAL;
175
176 pdata = timer->pdev->dev.platform_data;
177
178 if (source < 0 || source >= 3)
179 return -EINVAL;
180
181 /*
182 * FIXME: Used for OMAP1 devices only because they do not currently
183 * use the clock framework to set the parent clock. To be removed
184 * once OMAP1 migrated to using clock framework for dmtimers
185 */
186 if (pdata && pdata->set_timer_src)
187 return pdata->set_timer_src(timer->pdev, source);
188
189 if (IS_ERR(timer->fclk))
190 return -EINVAL;
191
192#if defined(CONFIG_COMMON_CLK)
193 /* Check if the clock has configurable parents */
194 if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2)
195 return 0;
196#endif
197
198 switch (source) {
199 case OMAP_TIMER_SRC_SYS_CLK:
200 parent_name = "timer_sys_ck";
201 break;
202
203 case OMAP_TIMER_SRC_32_KHZ:
204 parent_name = "timer_32k_ck";
205 break;
206
207 case OMAP_TIMER_SRC_EXT_CLK:
208 parent_name = "timer_ext_ck";
209 break;
210 }
211
212 parent = clk_get(&timer->pdev->dev, parent_name);
213 if (IS_ERR(parent)) {
214 pr_err("%s: %s not found\n", __func__, parent_name);
215 return -EINVAL;
216 }
217
218 ret = clk_set_parent(timer->fclk, parent);
219 if (ret < 0)
220 pr_err("%s: failed to set %s as parent\n", __func__,
221 parent_name);
222
223 clk_put(parent);
224
225 return ret;
226}
227
228static void omap_dm_timer_enable(struct omap_dm_timer *timer)
229{
230 int c;
231
232 pm_runtime_get_sync(&timer->pdev->dev);
233
234 if (!(timer->capability & OMAP_TIMER_ALWON)) {
235 if (timer->get_context_loss_count) {
236 c = timer->get_context_loss_count(&timer->pdev->dev);
237 if (c != timer->ctx_loss_count) {
238 omap_timer_restore_context(timer);
239 timer->ctx_loss_count = c;
240 }
241 } else {
242 omap_timer_restore_context(timer);
243 }
244 }
245}
246
247static void omap_dm_timer_disable(struct omap_dm_timer *timer)
248{
249 pm_runtime_put_sync(&timer->pdev->dev);
250}
251
166static int omap_dm_timer_prepare(struct omap_dm_timer *timer) 252static int omap_dm_timer_prepare(struct omap_dm_timer *timer)
167{ 253{
168 int rc; 254 int rc;
@@ -298,16 +384,16 @@ found:
298 return timer; 384 return timer;
299} 385}
300 386
301struct omap_dm_timer *omap_dm_timer_request(void) 387static struct omap_dm_timer *omap_dm_timer_request(void)
302{ 388{
303 return _omap_dm_timer_request(REQUEST_ANY, NULL); 389 return _omap_dm_timer_request(REQUEST_ANY, NULL);
304} 390}
305 391
306struct omap_dm_timer *omap_dm_timer_request_specific(int id) 392static struct omap_dm_timer *omap_dm_timer_request_specific(int id)
307{ 393{
308 /* Requesting timer by ID is not supported when device tree is used */ 394 /* Requesting timer by ID is not supported when device tree is used */
309 if (of_have_populated_dt()) { 395 if (of_have_populated_dt()) {
310 pr_warn("%s: Please use omap_dm_timer_request_by_cap/node()\n", 396 pr_warn("%s: Please use omap_dm_timer_request_by_node()\n",
311 __func__); 397 __func__);
312 return NULL; 398 return NULL;
313 } 399 }
@@ -336,7 +422,7 @@ struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap)
336 * Request a timer based upon a device node pointer. Returns pointer to 422 * Request a timer based upon a device node pointer. Returns pointer to
337 * timer handle on success and a NULL pointer on failure. 423 * timer handle on success and a NULL pointer on failure.
338 */ 424 */
339struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np) 425static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np)
340{ 426{
341 if (!np) 427 if (!np)
342 return NULL; 428 return NULL;
@@ -344,7 +430,7 @@ struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np)
344 return _omap_dm_timer_request(REQUEST_BY_NODE, np); 430 return _omap_dm_timer_request(REQUEST_BY_NODE, np);
345} 431}
346 432
347int omap_dm_timer_free(struct omap_dm_timer *timer) 433static int omap_dm_timer_free(struct omap_dm_timer *timer)
348{ 434{
349 if (unlikely(!timer)) 435 if (unlikely(!timer))
350 return -EINVAL; 436 return -EINVAL;
@@ -356,30 +442,6 @@ int omap_dm_timer_free(struct omap_dm_timer *timer)
356 return 0; 442 return 0;
357} 443}
358 444
359void omap_dm_timer_enable(struct omap_dm_timer *timer)
360{
361 int c;
362
363 pm_runtime_get_sync(&timer->pdev->dev);
364
365 if (!(timer->capability & OMAP_TIMER_ALWON)) {
366 if (timer->get_context_loss_count) {
367 c = timer->get_context_loss_count(&timer->pdev->dev);
368 if (c != timer->ctx_loss_count) {
369 omap_timer_restore_context(timer);
370 timer->ctx_loss_count = c;
371 }
372 } else {
373 omap_timer_restore_context(timer);
374 }
375 }
376}
377
378void omap_dm_timer_disable(struct omap_dm_timer *timer)
379{
380 pm_runtime_put_sync(&timer->pdev->dev);
381}
382
383int omap_dm_timer_get_irq(struct omap_dm_timer *timer) 445int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
384{ 446{
385 if (timer) 447 if (timer)
@@ -389,6 +451,12 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
389 451
390#if defined(CONFIG_ARCH_OMAP1) 452#if defined(CONFIG_ARCH_OMAP1)
391#include <mach/hardware.h> 453#include <mach/hardware.h>
454
455static struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
456{
457 return NULL;
458}
459
392/** 460/**
393 * omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR 461 * omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR
394 * @inputmask: current value of idlect mask 462 * @inputmask: current value of idlect mask
@@ -424,7 +492,7 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
424 492
425#else 493#else
426 494
427struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) 495static struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
428{ 496{
429 if (timer && !IS_ERR(timer->fclk)) 497 if (timer && !IS_ERR(timer->fclk))
430 return timer->fclk; 498 return timer->fclk;
@@ -451,7 +519,7 @@ int omap_dm_timer_trigger(struct omap_dm_timer *timer)
451 return 0; 519 return 0;
452} 520}
453 521
454int omap_dm_timer_start(struct omap_dm_timer *timer) 522static int omap_dm_timer_start(struct omap_dm_timer *timer)
455{ 523{
456 u32 l; 524 u32 l;
457 525
@@ -471,7 +539,7 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
471 return 0; 539 return 0;
472} 540}
473 541
474int omap_dm_timer_stop(struct omap_dm_timer *timer) 542static int omap_dm_timer_stop(struct omap_dm_timer *timer)
475{ 543{
476 unsigned long rate = 0; 544 unsigned long rate = 0;
477 545
@@ -494,70 +562,8 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
494 return 0; 562 return 0;
495} 563}
496 564
497int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) 565static int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
498{ 566 unsigned int load)
499 int ret;
500 char *parent_name = NULL;
501 struct clk *parent;
502 struct dmtimer_platform_data *pdata;
503
504 if (unlikely(!timer))
505 return -EINVAL;
506
507 pdata = timer->pdev->dev.platform_data;
508
509 if (source < 0 || source >= 3)
510 return -EINVAL;
511
512 /*
513 * FIXME: Used for OMAP1 devices only because they do not currently
514 * use the clock framework to set the parent clock. To be removed
515 * once OMAP1 migrated to using clock framework for dmtimers
516 */
517 if (pdata && pdata->set_timer_src)
518 return pdata->set_timer_src(timer->pdev, source);
519
520 if (IS_ERR(timer->fclk))
521 return -EINVAL;
522
523#if defined(CONFIG_COMMON_CLK)
524 /* Check if the clock has configurable parents */
525 if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2)
526 return 0;
527#endif
528
529 switch (source) {
530 case OMAP_TIMER_SRC_SYS_CLK:
531 parent_name = "timer_sys_ck";
532 break;
533
534 case OMAP_TIMER_SRC_32_KHZ:
535 parent_name = "timer_32k_ck";
536 break;
537
538 case OMAP_TIMER_SRC_EXT_CLK:
539 parent_name = "timer_ext_ck";
540 break;
541 }
542
543 parent = clk_get(&timer->pdev->dev, parent_name);
544 if (IS_ERR(parent)) {
545 pr_err("%s: %s not found\n", __func__, parent_name);
546 return -EINVAL;
547 }
548
549 ret = clk_set_parent(timer->fclk, parent);
550 if (ret < 0)
551 pr_err("%s: failed to set %s as parent\n", __func__,
552 parent_name);
553
554 clk_put(parent);
555
556 return ret;
557}
558
559int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
560 unsigned int load)
561{ 567{
562 u32 l; 568 u32 l;
563 569
@@ -609,9 +615,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
609 timer->context.tcrr = load; 615 timer->context.tcrr = load;
610 return 0; 616 return 0;
611} 617}
612 618static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
613int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, 619 unsigned int match)
614 unsigned int match)
615{ 620{
616 u32 l; 621 u32 l;
617 622
@@ -634,8 +639,8 @@ int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
634 return 0; 639 return 0;
635} 640}
636 641
637int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, 642static int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
638 int toggle, int trigger) 643 int toggle, int trigger)
639{ 644{
640 u32 l; 645 u32 l;
641 646
@@ -659,7 +664,8 @@ int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
659 return 0; 664 return 0;
660} 665}
661 666
662int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler) 667static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
668 int prescaler)
663{ 669{
664 u32 l; 670 u32 l;
665 671
@@ -681,8 +687,8 @@ int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
681 return 0; 687 return 0;
682} 688}
683 689
684int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, 690static int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
685 unsigned int value) 691 unsigned int value)
686{ 692{
687 if (unlikely(!timer)) 693 if (unlikely(!timer))
688 return -EINVAL; 694 return -EINVAL;
@@ -704,7 +710,7 @@ int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
704 * 710 *
705 * Disables the specified timer interrupts for a timer. 711 * Disables the specified timer interrupts for a timer.
706 */ 712 */
707int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask) 713static int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
708{ 714{
709 u32 l = mask; 715 u32 l = mask;
710 716
@@ -727,7 +733,7 @@ int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
727 return 0; 733 return 0;
728} 734}
729 735
730unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer) 736static unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
731{ 737{
732 unsigned int l; 738 unsigned int l;
733 739
@@ -741,7 +747,7 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
741 return l; 747 return l;
742} 748}
743 749
744int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value) 750static int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
745{ 751{
746 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) 752 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev)))
747 return -EINVAL; 753 return -EINVAL;
@@ -751,7 +757,7 @@ int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
751 return 0; 757 return 0;
752} 758}
753 759
754unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer) 760static unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
755{ 761{
756 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) { 762 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
757 pr_err("%s: timer not iavailable or enabled.\n", __func__); 763 pr_err("%s: timer not iavailable or enabled.\n", __func__);
@@ -761,7 +767,7 @@ unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
761 return __omap_dm_timer_read_counter(timer, timer->posted); 767 return __omap_dm_timer_read_counter(timer, timer->posted);
762} 768}
763 769
764int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value) 770static int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
765{ 771{
766 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) { 772 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
767 pr_err("%s: timer not available or enabled.\n", __func__); 773 pr_err("%s: timer not available or enabled.\n", __func__);