Skip to content

Commit d6de45f

Browse files
Nicolas FrattaroliYuryNorov
authored andcommitted
phy: rockchip-samsung-dcphy: switch to FIELD_PREP_WM16 macro
The era of hand-rolled HIWORD_UPDATE macros is over, at least for those drivers that use constant masks. phy-rockchip-samsung-dcphy is actually an exemplary example, where the similarities to FIELD_PREP were spotted and the driver local macro has the same semantics as the new FIELD_PREP_WM16 hw_bitfield.h macro. Still, get rid of FIELD_PREP_HIWORD now that a shared implementation exists, replacing the two instances of it with FIELD_PREP_WM16. This gives us slightly better error checking; the value is now checked to fit in 16 bits. Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
1 parent 9040ecd commit d6de45f

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <dt-bindings/phy/phy.h>
99
#include <linux/bitfield.h>
1010
#include <linux/clk.h>
11+
#include <linux/hw_bitfield.h>
1112
#include <linux/init.h>
1213
#include <linux/kernel.h>
1314
#include <linux/mfd/syscon.h>
@@ -20,12 +21,6 @@
2021
#include <linux/regmap.h>
2122
#include <linux/reset.h>
2223

23-
#define FIELD_PREP_HIWORD(_mask, _val) \
24-
( \
25-
FIELD_PREP((_mask), (_val)) | \
26-
((_mask) << 16) \
27-
)
28-
2924
#define BIAS_CON0 0x0000
3025
#define I_RES_CNTL_MASK GENMASK(6, 4)
3126
#define I_RES_CNTL(x) FIELD_PREP(I_RES_CNTL_MASK, x)
@@ -252,8 +247,8 @@
252247

253248
/* MIPI_CDPHY_GRF registers */
254249
#define MIPI_DCPHY_GRF_CON0 0x0000
255-
#define S_CPHY_MODE FIELD_PREP_HIWORD(BIT(3), 1)
256-
#define M_CPHY_MODE FIELD_PREP_HIWORD(BIT(0), 1)
250+
#define S_CPHY_MODE FIELD_PREP_WM16(BIT(3), 1)
251+
#define M_CPHY_MODE FIELD_PREP_WM16(BIT(0), 1)
257252

258253
enum hs_drv_res_ohm {
259254
STRENGTH_30_OHM = 0x8,

0 commit comments

Comments
 (0)