Skip to contentSkip to conversation

sunxi: Use clrsetbits_le32 instead of multiple instruction

PATCH Superseded Shyam Saini 1 participant 2 messages Mar 15, 2019 – Mar 18, 2019

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 sunxi: Use clrsetbits_le32 instead of multiple instruction

From: Michael Trimarchi <[email protected]>

This will improve code readabilty

---
Changelogs:

	   V1->V2: None
	   V2->V3: Fix use of clrsetbits_le32 and setbits_le32 functions
---
 arch/arm/mach-sunxi/dram_sun8i_a33.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
arch/arm/mach-sunxi/dram_sun8i_a33.c +2 -5
index 1da2727f9874..09742cbc2b55 100644
@@ -148,11 +148,8 @@ static void auto_set_timing_para(struct dram_para *para)
 	reg_val = (tcksrx << 24) | (tcksre << 16) | (tckesr << 8) | (tcke << 0);
 	writel(reg_val, &mctl_ctl->dramtmg5);
 	/* Set two rank timing and exit self-refresh timing */
-	reg_val = readl(&mctl_ctl->dramtmg8);
-	reg_val &= ~(0xff << 8);
-	reg_val &= ~(0xff << 0);
-	reg_val |= (0x33 << 8);
-	reg_val |= (0x8 << 0);
+	clrsetbits_le32(&mctl_ctl->dramtmg8, (0xff << 8) | (0xff << 0));
+	setbits_le32(&mctl_ctl->dramtmg8, (0x33 << 8) | (0x8 << 0));
 	writel(reg_val, &mctl_ctl->dramtmg8);
 	/* Set phy interface time */
 	reg_val = (0x2 << 24) | (t_rdata_en << 16) | (0x1 << 8)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/1 sunxi: Use clrsetbits_le32 instead of multiple instruction

Please ignore this patch,

I have sent this patch as a part of original series.

Sorry for the noise.

Thanks and regards,
Shyam

Quoted 35 lines · Shyam Saini

From: Michael Trimarchi <[email protected]>

This will improve code readabilty

---
Changelogs:

           V1->V2: None
           V2->V3: Fix use of clrsetbits_le32 and setbits_le32 functions
---
 arch/arm/mach-sunxi/dram_sun8i_a33.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
arch/arm/mach-sunxi/dram_sun8i_a33.c +2 -6
index 1da2727f9874..09742cbc2b55 100644
@@ -148,11 +148,8 @@ static void auto_set_timing_para(struct dram_para *para)
        reg_val = (tcksrx << 24) | (tcksre << 16) | (tckesr << 8) | (tcke << 0);
        writel(reg_val, &mctl_ctl->dramtmg5);
        /* Set two rank timing and exit self-refresh timing */
-       reg_val = readl(&mctl_ctl->dramtmg8);
-       reg_val &= ~(0xff << 8);
-       reg_val &= ~(0xff << 0);
-       reg_val |= (0x33 << 8);
-       reg_val |= (0x8 << 0);
+       clrsetbits_le32(&mctl_ctl->dramtmg8, (0xff << 8) | (0xff << 0));
+       setbits_le32(&mctl_ctl->dramtmg8, (0x33 << 8) | (0x8 << 0));
        writel(reg_val, &mctl_ctl->dramtmg8);
        /* Set phy interface time */
        reg_val = (0x2 << 24) | (t_rdata_en << 16) | (0x1 << 8)
--

2.11.0