hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/clocksource/sh_tmu.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * SuperH Timer Support - TMU
34 *
45 * Copyright (C) 2009 Magnus Damm
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
146 */
157
168 #include <linux/clk.h>
....@@ -31,6 +23,10 @@
3123 #include <linux/sh_timer.h>
3224 #include <linux/slab.h>
3325 #include <linux/spinlock.h>
26
+
27
+#ifdef CONFIG_SUPERH
28
+#include <asm/platform_early.h>
29
+#endif
3430
3531 enum sh_tmu_model {
3632 SH_TMU,
....@@ -296,7 +292,7 @@
296292
297293 if (--ch->enable_count == 0) {
298294 __sh_tmu_disable(ch);
299
- pm_genpd_syscore_poweroff(&ch->tmu->pdev->dev);
295
+ dev_pm_genpd_suspend(&ch->tmu->pdev->dev);
300296 }
301297 }
302298
....@@ -308,7 +304,7 @@
308304 return;
309305
310306 if (ch->enable_count++ == 0) {
311
- pm_genpd_syscore_poweron(&ch->tmu->pdev->dev);
307
+ dev_pm_genpd_resume(&ch->tmu->pdev->dev);
312308 __sh_tmu_enable(ch);
313309 }
314310 }
....@@ -398,12 +394,12 @@
398394
399395 static void sh_tmu_clock_event_suspend(struct clock_event_device *ced)
400396 {
401
- pm_genpd_syscore_poweroff(&ced_to_sh_tmu(ced)->tmu->pdev->dev);
397
+ dev_pm_genpd_suspend(&ced_to_sh_tmu(ced)->tmu->pdev->dev);
402398 }
403399
404400 static void sh_tmu_clock_event_resume(struct clock_event_device *ced)
405401 {
406
- pm_genpd_syscore_poweron(&ced_to_sh_tmu(ced)->tmu->pdev->dev);
402
+ dev_pm_genpd_resume(&ced_to_sh_tmu(ced)->tmu->pdev->dev);
407403 }
408404
409405 static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch,
....@@ -470,11 +466,8 @@
470466 ch->base = tmu->mapbase + 8 + ch->index * 12;
471467
472468 ch->irq = platform_get_irq(tmu->pdev, index);
473
- if (ch->irq < 0) {
474
- dev_err(&tmu->pdev->dev, "ch%u: failed to get irq\n",
475
- ch->index);
469
+ if (ch->irq < 0)
476470 return ch->irq;
477
- }
478471
479472 ch->cs_enabled = false;
480473 ch->enable_count = 0;
....@@ -493,7 +486,7 @@
493486 return -ENXIO;
494487 }
495488
496
- tmu->mapbase = ioremap_nocache(res->start, resource_size(res));
489
+ tmu->mapbase = ioremap(res->start, resource_size(res));
497490 if (tmu->mapbase == NULL)
498491 return -ENXIO;
499492
....@@ -606,7 +599,7 @@
606599 struct sh_tmu_device *tmu = platform_get_drvdata(pdev);
607600 int ret;
608601
609
- if (!is_early_platform_device(pdev)) {
602
+ if (!is_sh_early_platform_device(pdev)) {
610603 pm_runtime_set_active(&pdev->dev);
611604 pm_runtime_enable(&pdev->dev);
612605 }
....@@ -626,7 +619,8 @@
626619 pm_runtime_idle(&pdev->dev);
627620 return ret;
628621 }
629
- if (is_early_platform_device(pdev))
622
+
623
+ if (is_sh_early_platform_device(pdev))
630624 return 0;
631625
632626 out:
....@@ -676,7 +670,10 @@
676670 platform_driver_unregister(&sh_tmu_device_driver);
677671 }
678672
679
-early_platform_init("earlytimer", &sh_tmu_device_driver);
673
+#ifdef CONFIG_SUPERH
674
+sh_early_platform_init("earlytimer", &sh_tmu_device_driver);
675
+#endif
676
+
680677 subsys_initcall(sh_tmu_init);
681678 module_exit(sh_tmu_exit);
682679