mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
This commit is contained in:
1 parent
9d94396191
commit
29c0747755
1 file changed
+7
@@ -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
|
||||
Reference in new issue
Block a user