^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * PM domain driver for Keystone2 devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2013 Texas Instruments, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Santosh Shilimkar <santosh.shillimkar@ti.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Based on Kevins work on DAVINCI SOCs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Kevin Hilman <khilman@linaro.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/pm_runtime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/pm_clock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "keystone.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static struct dev_pm_domain keystone_pm_domain = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) USE_PM_CLK_RUNTIME_OPS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) USE_PLATFORM_PM_SLEEP_OPS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static struct pm_clk_notifier_block platform_domain_notifier = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .pm_domain = &keystone_pm_domain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .con_ids = { NULL },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static const struct of_device_id of_keystone_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {.compatible = "ti,k2hk"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {.compatible = "ti,k2e"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {.compatible = "ti,k2l"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) { /* end of list */ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int __init keystone_pm_runtime_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct device_node *np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) np = of_find_matching_node(NULL, of_keystone_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) if (!np)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }