Santosh Shilimkar | fc20ffe | 2013-07-14 17:17:39 -0400 | [diff] [blame] | 1 | /* |
| 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> |
Kevin Hilman | 8620d2c | 2013-10-14 10:30:11 -0700 | [diff] [blame] | 19 | #include <linux/of.h> |
Santosh Shilimkar | fc20ffe | 2013-07-14 17:17:39 -0400 | [diff] [blame] | 20 | |
Ben Dooks | 39a5cbb | 2016-06-21 09:31:15 -0700 | [diff] [blame] | 21 | #include "keystone.h" |
| 22 | |
Santosh Shilimkar | fc20ffe | 2013-07-14 17:17:39 -0400 | [diff] [blame] | 23 | static struct dev_pm_domain keystone_pm_domain = { |
| 24 | .ops = { |
Rajendra Nayak | 1f51b0c | 2015-04-23 14:03:10 +0530 | [diff] [blame] | 25 | USE_PM_CLK_RUNTIME_OPS |
Santosh Shilimkar | fc20ffe | 2013-07-14 17:17:39 -0400 | [diff] [blame] | 26 | USE_PLATFORM_PM_SLEEP_OPS |
| 27 | }, |
| 28 | }; |
| 29 | |
| 30 | static struct pm_clk_notifier_block platform_domain_notifier = { |
| 31 | .pm_domain = &keystone_pm_domain, |
| 32 | }; |
| 33 | |
Uwe Kleine-König | 444d2d3 | 2015-02-18 21:19:56 +0100 | [diff] [blame] | 34 | static const struct of_device_id of_keystone_table[] = { |
Dave Gerlach | ae3874c | 2017-04-04 08:59:28 -0700 | [diff] [blame] | 35 | {.compatible = "ti,k2hk"}, |
| 36 | {.compatible = "ti,k2e"}, |
| 37 | {.compatible = "ti,k2l"}, |
Kevin Hilman | 8620d2c | 2013-10-14 10:30:11 -0700 | [diff] [blame] | 38 | { /* end of list */ }, |
| 39 | }; |
| 40 | |
Santosh Shilimkar | fc20ffe | 2013-07-14 17:17:39 -0400 | [diff] [blame] | 41 | int __init keystone_pm_runtime_init(void) |
| 42 | { |
Kevin Hilman | 8620d2c | 2013-10-14 10:30:11 -0700 | [diff] [blame] | 43 | struct device_node *np; |
| 44 | |
| 45 | np = of_find_matching_node(NULL, of_keystone_table); |
| 46 | if (!np) |
| 47 | return 0; |
| 48 | |
Santosh Shilimkar | fc20ffe | 2013-07-14 17:17:39 -0400 | [diff] [blame] | 49 | pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier); |
| 50 | |
| 51 | return 0; |
| 52 | } |