Lines Matching +full:bt1 +full:- +full:ccu
1 // SPDX-License-Identifier: GPL-2.0-only
8 * Baikal-T1 CCU Resets interface driver
11 #define pr_fmt(fmt) "bt1-ccu-rst: " fmt
19 #include <linux/reset-controller.h>
22 #include <dt-bindings/reset/bt1-ccu.h>
24 #include "ccu-rst.h"
66 * Each AXI-bus clock divider is equipped with the corresponding clock-consumer
67 * domain reset (it's self-deasserted reset control).
84 * SATA reference clock domain and APB-bus domain are connected with the
85 * sefl-deasserted reset control, which can be activated via the corresponding
86 * clock divider register. DDR and PCIe sub-domains can be reset with directly
107 const struct ccu_rst_info *info = &rst->rsts_info[idx]; in ccu_rst_reset()
109 if (info->type != CCU_RST_TRIG) in ccu_rst_reset()
110 return -EOPNOTSUPP; in ccu_rst_reset()
112 regmap_update_bits(rst->sys_regs, info->base, info->mask, info->mask); in ccu_rst_reset()
124 const struct ccu_rst_info *info = &rst->rsts_info[idx]; in ccu_rst_set()
126 if (info->type != CCU_RST_DIR) in ccu_rst_set()
127 return high ? -EOPNOTSUPP : 0; in ccu_rst_set()
129 return regmap_update_bits(rst->sys_regs, info->base, in ccu_rst_set()
130 info->mask, high ? info->mask : 0); in ccu_rst_set()
149 const struct ccu_rst_info *info = &rst->rsts_info[idx]; in ccu_rst_status()
152 if (info->type != CCU_RST_DIR) in ccu_rst_status()
153 return -EOPNOTSUPP; in ccu_rst_status()
155 regmap_read(rst->sys_regs, info->base, &val); in ccu_rst_status()
157 return !!(val & info->mask); in ccu_rst_status()
173 return ERR_PTR(-EINVAL); in ccu_rst_hw_register()
177 return ERR_PTR(-ENOMEM); in ccu_rst_hw_register()
179 rst->sys_regs = rst_init->sys_regs; in ccu_rst_hw_register()
180 if (of_device_is_compatible(rst_init->np, "baikal,bt1-ccu-axi")) { in ccu_rst_hw_register()
181 rst->rcdev.nr_resets = ARRAY_SIZE(axi_rst_info); in ccu_rst_hw_register()
182 rst->rsts_info = axi_rst_info; in ccu_rst_hw_register()
183 } else if (of_device_is_compatible(rst_init->np, "baikal,bt1-ccu-sys")) { in ccu_rst_hw_register()
184 rst->rcdev.nr_resets = ARRAY_SIZE(sys_rst_info); in ccu_rst_hw_register()
185 rst->rsts_info = sys_rst_info; in ccu_rst_hw_register()
188 of_node_full_name(rst_init->np)); in ccu_rst_hw_register()
189 ret = -EINVAL; in ccu_rst_hw_register()
193 rst->rcdev.owner = THIS_MODULE; in ccu_rst_hw_register()
194 rst->rcdev.ops = &ccu_rst_ops; in ccu_rst_hw_register()
195 rst->rcdev.of_node = rst_init->np; in ccu_rst_hw_register()
197 ret = reset_controller_register(&rst->rcdev); in ccu_rst_hw_register()
200 of_node_full_name(rst_init->np)); in ccu_rst_hw_register()
214 reset_controller_unregister(&rst->rcdev); in ccu_rst_hw_unregister()