1b348c26cSRex-BC Chen /* SPDX-License-Identifier: GPL-2.0-only */ 2b348c26cSRex-BC Chen /* 3b348c26cSRex-BC Chen * Copyright (c) 2022 MediaTek Inc. 4b348c26cSRex-BC Chen */ 5b348c26cSRex-BC Chen 6b348c26cSRex-BC Chen #ifndef __DRV_CLK_MTK_RESET_H 7b348c26cSRex-BC Chen #define __DRV_CLK_MTK_RESET_H 8b348c26cSRex-BC Chen 9b348c26cSRex-BC Chen #include <linux/reset-controller.h> 10b348c26cSRex-BC Chen #include <linux/types.h> 11b348c26cSRex-BC Chen 12*723e3671SRex-BC Chen #define RST_NR_PER_BANK 32 13*723e3671SRex-BC Chen 14370bf628SRex-BC Chen /** 15370bf628SRex-BC Chen * enum mtk_reset_version - Version of MediaTek clock reset controller. 16370bf628SRex-BC Chen * @MTK_RST_SIMPLE: Use the same registers for bit set and clear. 17370bf628SRex-BC Chen * @MTK_RST_SET_CLR: Use separate registers for bit set and clear. 18370bf628SRex-BC Chen * @MTK_RST_MAX: Total quantity of version for MediaTek clock reset controller. 19370bf628SRex-BC Chen */ 20370bf628SRex-BC Chen enum mtk_reset_version { 21370bf628SRex-BC Chen MTK_RST_SIMPLE = 0, 22370bf628SRex-BC Chen MTK_RST_SET_CLR, 23370bf628SRex-BC Chen MTK_RST_MAX, 24370bf628SRex-BC Chen }; 25370bf628SRex-BC Chen 262d2a2900SRex-BC Chen /** 272d2a2900SRex-BC Chen * struct mtk_clk_rst_desc - Description of MediaTek clock reset. 282d2a2900SRex-BC Chen * @version: Reset version which is defined in enum mtk_reset_version. 29*723e3671SRex-BC Chen * @rst_bank_ofs: Pointer to an array containing base offsets of the reset register. 302d2a2900SRex-BC Chen * @rst_bank_nr: Quantity of reset bank. 312d2a2900SRex-BC Chen */ 322d2a2900SRex-BC Chen struct mtk_clk_rst_desc { 332d2a2900SRex-BC Chen enum mtk_reset_version version; 34*723e3671SRex-BC Chen u16 *rst_bank_ofs; 352d2a2900SRex-BC Chen u32 rst_bank_nr; 362d2a2900SRex-BC Chen }; 372d2a2900SRex-BC Chen 382d2a2900SRex-BC Chen /** 392d2a2900SRex-BC Chen * struct mtk_clk_rst_data - Data of MediaTek clock reset controller. 402d2a2900SRex-BC Chen * @regmap: Pointer to base address of reset register address. 412d2a2900SRex-BC Chen * @rcdev: Reset controller device. 422d2a2900SRex-BC Chen * @desc: Pointer to description of the reset controller. 432d2a2900SRex-BC Chen */ 442d2a2900SRex-BC Chen struct mtk_clk_rst_data { 45b348c26cSRex-BC Chen struct regmap *regmap; 46b348c26cSRex-BC Chen struct reset_controller_dev rcdev; 472d2a2900SRex-BC Chen const struct mtk_clk_rst_desc *desc; 48b348c26cSRex-BC Chen }; 49b348c26cSRex-BC Chen 50370bf628SRex-BC Chen /** 51370bf628SRex-BC Chen * mtk_register_reset_controller - Register MediaTek clock reset controller 52370bf628SRex-BC Chen * @np: Pointer to device node. 532d2a2900SRex-BC Chen * @desc: Constant pointer to description of clock reset. 54370bf628SRex-BC Chen */ 55b348c26cSRex-BC Chen void mtk_register_reset_controller(struct device_node *np, 562d2a2900SRex-BC Chen const struct mtk_clk_rst_desc *desc); 57b348c26cSRex-BC Chen 58b348c26cSRex-BC Chen #endif /* __DRV_CLK_MTK_RESET_H */ 59