OSDN Git Service
(root)
/
tomoyo
/
tomoyo-test1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d94396
)
phy: mediatek: add a new helper to update bitfield
author
Chunfeng Yun
<chunfeng.yun@mediatek.com>
Tue, 20 Sep 2022 09:00:21 +0000
(17:00 +0800)
committer
Vinod Koul
<vkoul@kernel.org>
Sat, 24 Sep 2022 06:27:49 +0000
(11:57 +0530)
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>
drivers/phy/mediatek/phy-mtk-io.h
patch
|
blob
|
history
diff --git
a/drivers/phy/mediatek/phy-mtk-io.h
b/drivers/phy/mediatek/phy-mtk-io.h
index
500fcda
..
a723d4a
100644
(file)
--- 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