1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2021 MediaTek Inc. 4 * 5 * Author: Chunfeng Yun <chunfeng.yun@mediatek.com> 6 */ 7 8 #ifndef __PHY_MTK_H__ 9 #define __PHY_MTK_H__ 10 11 #include <linux/io.h> 12 13 static inline void mtk_phy_clear_bits(void __iomem *reg, u32 bits) 14 { 15 u32 tmp = readl(reg); 16 17 tmp &= ~bits; 18 writel(tmp, reg); 19 } 20 21 static inline void mtk_phy_set_bits(void __iomem *reg, u32 bits) 22 { 23 u32 tmp = readl(reg); 24 25 tmp |= bits; 26 writel(tmp, reg); 27 } 28 29 static inline void mtk_phy_update_bits(void __iomem *reg, u32 mask, u32 val) 30 { 31 u32 tmp = readl(reg); 32 33 tmp &= ~mask; 34 tmp |= val & mask; 35 writel(tmp, reg); 36 } 37 38 #endif 39