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 12370bf628SRex-BC Chen /** 13370bf628SRex-BC Chen * enum mtk_reset_version - Version of MediaTek clock reset controller. 14370bf628SRex-BC Chen * @MTK_RST_SIMPLE: Use the same registers for bit set and clear. 15370bf628SRex-BC Chen * @MTK_RST_SET_CLR: Use separate registers for bit set and clear. 16370bf628SRex-BC Chen * @MTK_RST_MAX: Total quantity of version for MediaTek clock reset controller. 17370bf628SRex-BC Chen */ 18370bf628SRex-BC Chen enum mtk_reset_version { 19370bf628SRex-BC Chen MTK_RST_SIMPLE = 0, 20370bf628SRex-BC Chen MTK_RST_SET_CLR, 21370bf628SRex-BC Chen MTK_RST_MAX, 22370bf628SRex-BC Chen }; 23370bf628SRex-BC Chen 24*2d2a2900SRex-BC Chen /** 25*2d2a2900SRex-BC Chen * struct mtk_clk_rst_desc - Description of MediaTek clock reset. 26*2d2a2900SRex-BC Chen * @version: Reset version which is defined in enum mtk_reset_version. 27*2d2a2900SRex-BC Chen * @reg_ofs: Base offset of the reset register. 28*2d2a2900SRex-BC Chen * @rst_bank_nr: Quantity of reset bank. 29*2d2a2900SRex-BC Chen */ 30*2d2a2900SRex-BC Chen struct mtk_clk_rst_desc { 31*2d2a2900SRex-BC Chen enum mtk_reset_version version; 32*2d2a2900SRex-BC Chen u16 reg_ofs; 33*2d2a2900SRex-BC Chen u32 rst_bank_nr; 34*2d2a2900SRex-BC Chen }; 35*2d2a2900SRex-BC Chen 36*2d2a2900SRex-BC Chen /** 37*2d2a2900SRex-BC Chen * struct mtk_clk_rst_data - Data of MediaTek clock reset controller. 38*2d2a2900SRex-BC Chen * @regmap: Pointer to base address of reset register address. 39*2d2a2900SRex-BC Chen * @rcdev: Reset controller device. 40*2d2a2900SRex-BC Chen * @desc: Pointer to description of the reset controller. 41*2d2a2900SRex-BC Chen */ 42*2d2a2900SRex-BC Chen struct mtk_clk_rst_data { 43b348c26cSRex-BC Chen struct regmap *regmap; 44b348c26cSRex-BC Chen struct reset_controller_dev rcdev; 45*2d2a2900SRex-BC Chen const struct mtk_clk_rst_desc *desc; 46b348c26cSRex-BC Chen }; 47b348c26cSRex-BC Chen 48370bf628SRex-BC Chen /** 49370bf628SRex-BC Chen * mtk_register_reset_controller - Register MediaTek clock reset controller 50370bf628SRex-BC Chen * @np: Pointer to device node. 51*2d2a2900SRex-BC Chen * @desc: Constant pointer to description of clock reset. 52370bf628SRex-BC Chen */ 53b348c26cSRex-BC Chen void mtk_register_reset_controller(struct device_node *np, 54*2d2a2900SRex-BC Chen const struct mtk_clk_rst_desc *desc); 55b348c26cSRex-BC Chen 56b348c26cSRex-BC Chen #endif /* __DRV_CLK_MTK_RESET_H */ 57