blob: edea697e8253d601ce2323a0a99c1083d1e9ff93 [file] [log] [blame]
Santosh Shilimkarfc20ffe2013-07-14 17:17:39 -04001/*
2 * PM domain driver for Keystone2 devices
3 *
4 * Copyright 2013 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shillimkar@ti.com>
6 *
7 * Based on Kevins work on DAVINCI SOCs
8 * Kevin Hilman <khilman@linaro.org>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/pm_runtime.h>
17#include <linux/pm_clock.h>
18#include <linux/platform_device.h>
19#include <linux/clk-provider.h>
Kevin Hilman8620d2c2013-10-14 10:30:11 -070020#include <linux/of.h>
Santosh Shilimkarfc20ffe2013-07-14 17:17:39 -040021
Santosh Shilimkarfc20ffe2013-07-14 17:17:39 -040022static struct dev_pm_domain keystone_pm_domain = {
23 .ops = {
Rajendra Nayak1f51b0c2015-04-23 14:03:10 +053024 USE_PM_CLK_RUNTIME_OPS
Santosh Shilimkarfc20ffe2013-07-14 17:17:39 -040025 USE_PLATFORM_PM_SLEEP_OPS
26 },
27};
28
29static struct pm_clk_notifier_block platform_domain_notifier = {
30 .pm_domain = &keystone_pm_domain,
31};
32
Uwe Kleine-König444d2d32015-02-18 21:19:56 +010033static const struct of_device_id of_keystone_table[] = {
Kevin Hilman8620d2c2013-10-14 10:30:11 -070034 {.compatible = "ti,keystone"},
35 { /* end of list */ },
36};
37
Santosh Shilimkarfc20ffe2013-07-14 17:17:39 -040038int __init keystone_pm_runtime_init(void)
39{
Kevin Hilman8620d2c2013-10-14 10:30:11 -070040 struct device_node *np;
41
42 np = of_find_matching_node(NULL, of_keystone_table);
43 if (!np)
44 return 0;
45
Santosh Shilimkarfc20ffe2013-07-14 17:17:39 -040046 pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
47
48 return 0;
49}