.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * SuperH Timer Support - TMU |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
14 | 6 | */ |
---|
15 | 7 | |
---|
16 | 8 | #include <linux/clk.h> |
---|
.. | .. |
---|
31 | 23 | #include <linux/sh_timer.h> |
---|
32 | 24 | #include <linux/slab.h> |
---|
33 | 25 | #include <linux/spinlock.h> |
---|
| 26 | + |
---|
| 27 | +#ifdef CONFIG_SUPERH |
---|
| 28 | +#include <asm/platform_early.h> |
---|
| 29 | +#endif |
---|
34 | 30 | |
---|
35 | 31 | enum sh_tmu_model { |
---|
36 | 32 | SH_TMU, |
---|
.. | .. |
---|
296 | 292 | |
---|
297 | 293 | if (--ch->enable_count == 0) { |
---|
298 | 294 | __sh_tmu_disable(ch); |
---|
299 | | - pm_genpd_syscore_poweroff(&ch->tmu->pdev->dev); |
---|
| 295 | + dev_pm_genpd_suspend(&ch->tmu->pdev->dev); |
---|
300 | 296 | } |
---|
301 | 297 | } |
---|
302 | 298 | |
---|
.. | .. |
---|
308 | 304 | return; |
---|
309 | 305 | |
---|
310 | 306 | if (ch->enable_count++ == 0) { |
---|
311 | | - pm_genpd_syscore_poweron(&ch->tmu->pdev->dev); |
---|
| 307 | + dev_pm_genpd_resume(&ch->tmu->pdev->dev); |
---|
312 | 308 | __sh_tmu_enable(ch); |
---|
313 | 309 | } |
---|
314 | 310 | } |
---|
.. | .. |
---|
398 | 394 | |
---|
399 | 395 | static void sh_tmu_clock_event_suspend(struct clock_event_device *ced) |
---|
400 | 396 | { |
---|
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); |
---|
402 | 398 | } |
---|
403 | 399 | |
---|
404 | 400 | static void sh_tmu_clock_event_resume(struct clock_event_device *ced) |
---|
405 | 401 | { |
---|
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); |
---|
407 | 403 | } |
---|
408 | 404 | |
---|
409 | 405 | static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, |
---|
.. | .. |
---|
470 | 466 | ch->base = tmu->mapbase + 8 + ch->index * 12; |
---|
471 | 467 | |
---|
472 | 468 | 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) |
---|
476 | 470 | return ch->irq; |
---|
477 | | - } |
---|
478 | 471 | |
---|
479 | 472 | ch->cs_enabled = false; |
---|
480 | 473 | ch->enable_count = 0; |
---|
.. | .. |
---|
493 | 486 | return -ENXIO; |
---|
494 | 487 | } |
---|
495 | 488 | |
---|
496 | | - tmu->mapbase = ioremap_nocache(res->start, resource_size(res)); |
---|
| 489 | + tmu->mapbase = ioremap(res->start, resource_size(res)); |
---|
497 | 490 | if (tmu->mapbase == NULL) |
---|
498 | 491 | return -ENXIO; |
---|
499 | 492 | |
---|
.. | .. |
---|
606 | 599 | struct sh_tmu_device *tmu = platform_get_drvdata(pdev); |
---|
607 | 600 | int ret; |
---|
608 | 601 | |
---|
609 | | - if (!is_early_platform_device(pdev)) { |
---|
| 602 | + if (!is_sh_early_platform_device(pdev)) { |
---|
610 | 603 | pm_runtime_set_active(&pdev->dev); |
---|
611 | 604 | pm_runtime_enable(&pdev->dev); |
---|
612 | 605 | } |
---|
.. | .. |
---|
626 | 619 | pm_runtime_idle(&pdev->dev); |
---|
627 | 620 | return ret; |
---|
628 | 621 | } |
---|
629 | | - if (is_early_platform_device(pdev)) |
---|
| 622 | + |
---|
| 623 | + if (is_sh_early_platform_device(pdev)) |
---|
630 | 624 | return 0; |
---|
631 | 625 | |
---|
632 | 626 | out: |
---|
.. | .. |
---|
676 | 670 | platform_driver_unregister(&sh_tmu_device_driver); |
---|
677 | 671 | } |
---|
678 | 672 | |
---|
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 | + |
---|
680 | 677 | subsys_initcall(sh_tmu_init); |
---|
681 | 678 | module_exit(sh_tmu_exit); |
---|
682 | 679 | |
---|