summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2022-09-20 17:00:21 +0800
committerVinod Koul <vkoul@kernel.org>2022-09-24 11:57:49 +0530
commit29c07477556eb68a64f0ff53235feb0bd1cf1f63 (patch)
treefa211c0ef049120d37e7ff0d400c8805d6b1a137 /drivers/phy
parent9d943961912cdbbe33d04ca0144b27997f890d10 (diff)
downloadlwn-29c07477556eb68a64f0ff53235feb0bd1cf1f63.tar.gz
lwn-29c07477556eb68a64f0ff53235feb0bd1cf1f63.zip
phy: mediatek: add a new helper to update bitfield
Due to FIELD_PREP() macro can be used to prepare a bitfield value, local ones can be remove; add the new helper to make bitfield update easier. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/20220920090038.15133-2-chunfeng.yun@mediatek.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/mediatek/phy-mtk-io.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/phy/mediatek/phy-mtk-io.h b/drivers/phy/mediatek/phy-mtk-io.h
index 500fcdab165d..a723d4afc9b4 100644
--- a/drivers/phy/mediatek/phy-mtk-io.h
+++ b/drivers/phy/mediatek/phy-mtk-io.h
@@ -8,6 +8,7 @@
#ifndef __PHY_MTK_H__
#define __PHY_MTK_H__
+#include <linux/bitfield.h>
#include <linux/io.h>
static inline void mtk_phy_clear_bits(void __iomem *reg, u32 bits)
@@ -35,4 +36,10 @@ static inline void mtk_phy_update_bits(void __iomem *reg, u32 mask, u32 val)
writel(tmp, reg);
}
+/* field @mask should be constant and continuous */
+static inline void mtk_phy_update_field(void __iomem *reg, u32 mask, u32 val)
+{
+ mtk_phy_update_bits(reg, mask, FIELD_PREP(mask, val));
+}
+
#endif