* Copyright (C) 2016 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  */
 
+#include <linux/bitfield.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/device.h>
 #define PRG_ETH0_CLK_M250_SEL_SHIFT    4
 #define PRG_ETH0_CLK_M250_SEL_MASK     GENMASK(4, 4)
 
-#define PRG_ETH0_TXDLY_SHIFT           5
 #define PRG_ETH0_TXDLY_MASK            GENMASK(6, 5)
 
 /* divider for the result of m250_sel */
                                        PRG_ETH0_INVERTED_RMII_CLK, 0);
 
                meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK,
-                                       tx_dly_val << PRG_ETH0_TXDLY_SHIFT);
+                                       FIELD_PREP(PRG_ETH0_TXDLY_MASK,
+                                                  tx_dly_val));
 
                /* Configure the 125MHz RGMII TX clock, the IP block changes
                 * the output automatically (= without us having to configure