ddr: altera: sdram: Clean up set_sdr_mp_weight()
authorMarek Vasut <marex@denx.de>
Sat, 1 Aug 2015 18:10:23 +0000 (20:10 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 06:17:35 +0000 (08:17 +0200)
Get rid of the constant clrsetbits_le32(), instead prepare the whole
content of the register once and write it at the end of the function.

Signed-off-by: Marek Vasut <marex@denx.de>
drivers/ddr/altera/sdram.c

index 8db8dde..f324805 100644 (file)
@@ -417,31 +417,26 @@ static void set_sdr_fifo_cfg(void)
 
 static void set_sdr_mp_weight(void)
 {
-       debug("Configuring MPWEIGHT_MPWEIGHT_0\n");
-       clrsetbits_le32(&sdr_ctrl->mp_weight0,
-                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_0_STATICWEIGHT_31_0_MASK,
-                       CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_0_STATICWEIGHT_31_0 <<
+       const u32 mp_weight0 =
+               (CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_0_STATICWEIGHT_31_0 <<
                        SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_0_STATICWEIGHT_31_0_LSB);
-
-       clrsetbits_le32(&sdr_ctrl->mp_weight1,
-                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_STATICWEIGHT_49_32_MASK,
-                       CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_1_STATICWEIGHT_49_32 <<
-                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_STATICWEIGHT_49_32_LSB);
-
-       clrsetbits_le32(&sdr_ctrl->mp_weight1,
-                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_SUMOFWEIGHTS_13_0_MASK,
-                       CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_1_SUMOFWEIGHT_13_0 <<
+       const u32 mp_weight1 =
+               (CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_1_STATICWEIGHT_49_32 <<
+                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_STATICWEIGHT_49_32_LSB) |
+               (CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_1_SUMOFWEIGHT_13_0 <<
                        SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_1_SUMOFWEIGHTS_13_0_LSB);
-
-       clrsetbits_le32(&sdr_ctrl->mp_weight2,
-                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_2_SUMOFWEIGHTS_45_14_MASK,
-                       CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_2_SUMOFWEIGHT_45_14 <<
+       const u32 mp_weight2 =
+               (CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_2_SUMOFWEIGHT_45_14 <<
                        SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_2_SUMOFWEIGHTS_45_14_LSB);
-
-       clrsetbits_le32(&sdr_ctrl->mp_weight3,
-                       SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_3_SUMOFWEIGHTS_63_46_MASK,
-                       CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_3_SUMOFWEIGHT_63_46 <<
+       const u32 mp_weight3 =
+               (CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_3_SUMOFWEIGHT_63_46 <<
                        SDR_CTRLGRP_MPWEIGHT_MPWEIGHT_3_SUMOFWEIGHTS_63_46_LSB);
+
+       debug("Configuring MPWEIGHT_MPWEIGHT_0\n");
+       writel(mp_weight0, &sdr_ctrl->mp_weight0);
+       writel(mp_weight1, &sdr_ctrl->mp_weight1);
+       writel(mp_weight2, &sdr_ctrl->mp_weight2);
+       writel(mp_weight3, &sdr_ctrl->mp_weight3);
 }
 
 static void set_sdr_mp_pacing(void)