Skip to contentSkip to conversation

imx8m: ddrphy_utils: Improve coding style

PATCH New Fabio Estevam 4 participants 8 messages Jul 17, 2020 – Jul 27, 2020

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 imx8m: ddrphy_utils: Improve coding style

Currently checkpatch is not happy about this file:

total: 14 errors, 2 warnings, 7 checks, 359 lines checked

Improve the coding style so that it can now report:

total: 0 errors, 0 warnings, 6 checks, 360 lines checked

---
 drivers/ddr/imx/imx8m/ddrphy_utils.c | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/ddr/imx/imx8m/ddrphy_utils.c +15 -14
index 20ae47bfb5..0f8baefb1f 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
-* Copyright 2018 NXP
-*/
+ * Copyright 2018 NXP
+ */
 
 #include <common.h>
 #include <errno.h>
@@ -201,7 +201,7 @@ unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned int mr_addr)
 }
 
 unsigned int look_for_max(unsigned int data[],
-		 unsigned int addr_start, unsigned int addr_end)
+			  unsigned int addr_start, unsigned int addr_end)
 {
 	unsigned int i, imax = 0;
 
@@ -233,9 +233,9 @@ void get_trained_CDD(u32 fsp)
 			if (i == 0) {
 				cdd_cha[0] = (tmp >> 8) & 0xff;
 			} else if (i == 6) {
-				cdd_cha[11]=tmp & 0xff;
+				cdd_cha[11] = tmp & 0xff;
 			} else {
-				cdd_chb[ i * 2 - 1] = tmp & 0xff;
+				cdd_chb[i * 2 - 1] = tmp & 0xff;
 				cdd_chb[i * 2] = (tmp >> 8) & 0xff;
 			}
 		}
@@ -254,7 +254,8 @@ void get_trained_CDD(u32 fsp)
 		g_cdd_ww_max[fsp] =  cdd_cha_ww_max > cdd_chb_ww_max ? cdd_cha_ww_max : cdd_chb_ww_max;
 	} else {
 		unsigned int ddr4_cdd[64];
-		for( i = 0; i < 29; i++) {
+
+		for (i = 0; i < 29; i++) {
 			tmp = reg32_read(IP2APB_DDRPHY_IPS_BASE_ADDR(0) + (0x54012 + i) * 4);
 			ddr4_cdd[i * 2] = tmp & 0xff;
 			ddr4_cdd[i * 2 + 1] = (tmp >> 8) & 0xff;
@@ -269,18 +270,18 @@ void get_trained_CDD(u32 fsp)
 
 void update_umctl2_rank_space_setting(unsigned int pstat_num)
 {
-	unsigned int i,ddr_type;
+	unsigned int i, ddr_type;
 	unsigned int addr_slot, rdata, tmp, tmp_t;
-	unsigned int ddrc_w2r,ddrc_r2w,ddrc_wr_gap,ddrc_rd_gap;
+	unsigned int ddrc_w2r, ddrc_r2w, ddrc_wr_gap, ddrc_rd_gap;
 
 	ddr_type = reg32_read(DDRC_MSTR(0)) & 0x3f;
 	for (i = 0; i < pstat_num; i++) {
 		addr_slot = i ? (i + 1) * 0x1000 : 0;
 		if (ddr_type == 0x20) {
 			/* update r2w:[13:8], w2r:[5:0] */
-			rdata=reg32_read(DDRC_DRAMTMG2(0) + addr_slot);
+			rdata = reg32_read(DDRC_DRAMTMG2(0) + addr_slot);
 			ddrc_w2r = rdata & 0x3f;
-			if(is_imx8mp())
+			if (is_imx8mp())
 				tmp = ddrc_w2r + (g_cdd_wr_max[i] >> 1);
 			else
 				tmp = ddrc_w2r + (g_cdd_wr_max[i] >> 1) + 1;
@@ -297,7 +298,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 			reg32_write((DDRC_DRAMTMG2(0) + addr_slot), tmp_t);
 		} else {
 			/* update w2r:[5:0] */
-			rdata=reg32_read(DDRC_DRAMTMG9(0) + addr_slot);
+			rdata = reg32_read(DDRC_DRAMTMG9(0) + addr_slot);
 			ddrc_w2r = rdata & 0x3f;
 			if (is_imx8mp())
 				tmp = ddrc_w2r + (g_cdd_wr_max[i] >> 1);
@@ -310,7 +311,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 			/* update r2w:[13:8] */
 			rdata = reg32_read(DDRC_DRAMTMG2(0) + addr_slot);
 			ddrc_r2w = (rdata >> 8) & 0x3f;
-			if(is_imx8mp())
+			if (is_imx8mp())
 				tmp = ddrc_r2w + (g_cdd_rw_max[i] >> 1);
 			else
 				tmp = ddrc_r2w + (g_cdd_rw_max[i] >> 1) + 1;
@@ -324,7 +325,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 			/* update rankctl: wr_gap:11:8; rd:gap:7:4; quasi-dymic, doc wrong(static) */
 			rdata = reg32_read(DDRC_RANKCTL(0) + addr_slot);
 			ddrc_wr_gap = (rdata >> 8) & 0xf;
-			if(is_imx8mp())
+			if (is_imx8mp())
 				tmp = ddrc_wr_gap + (g_cdd_ww_max[i] >> 1);
 			else
 				tmp = ddrc_wr_gap + (g_cdd_ww_max[i] >> 1) + 1;
@@ -342,7 +343,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 		}
 	}
 
-	if(is_imx8mq()) {
+	if (is_imx8mq()) {
 		/* update rankctl: wr_gap:11:8; rd:gap:7:4; quasi-dymic, doc wrong(static) */
 		rdata = reg32_read(DDRC_RANKCTL(0));
 		ddrc_wr_gap = (rdata >> 8) & 0xf;
Signature · 1 line
2.17.1
author reviewer
#1 lore raw

PATCH 2/2 imx8m: soc: Remove unneeded space

Checkpatch reports the following issue:

ERROR: space prohibited before that ',' (ctx:WxW)
#936: FILE: arch/arm/mach-imx/imx8m/soc.c:936:
+ 0, 0 , 0, 0, 0, 0, &res);

Remove the unneeded space.
^

---
 arch/arm/mach-imx/imx8m/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/imx8m/soc.c +1 -1
index b3c08271e6..75e1877e20 100644
@@ -933,7 +933,7 @@ static void acquire_buildinfo(void)
 
 	/* Get ARM Trusted Firmware commit id */
 	arm_smccc_smc(IMX_SIP_BUILDINFO, IMX_SIP_BUILDINFO_GET_COMMITHASH,
-		      0, 0 , 0, 0, 0, 0, &res);
+		      0, 0, 0, 0, 0, 0, &res);
 	atf_commit = res.a0;
 	if (atf_commit == 0xffffffff) {
 		debug("ATF does not support build info\n");
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 imx8m: soc: Remove unneeded space

Quoted 10 lines · Fabio Estevam

Checkpatch reports the following issue:

ERROR: space prohibited before that ',' (ctx:WxW)
#936: FILE: arch/arm/mach-imx/imx8m/soc.c:936:

(quoted diff) +1 -0
+		      0, 0 , 0, 0, 0, 0, &res);

Remove the unneeded space.
^

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200717/c6a82746/attachment.sig>
#3 lore raw

PATCH 2/2 imx8m: soc: Remove unneeded space

In reply to Fabio Estevam
Quoted 29 lines

Subject: [PATCH 2/2] imx8m: soc: Remove unneeded space

Checkpatch reports the following issue:

ERROR: space prohibited before that ',' (ctx:WxW)
#936: FILE: arch/arm/mach-imx/imx8m/soc.c:936:

(quoted diff) +1 -0
+		      0, 0 , 0, 0, 0, 0, &res);

Remove the unneeded space.
^

---
 arch/arm/mach-imx/imx8m/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8m/soc.c index b3c08271e6..75e1877e20 100644

arch/arm/mach-imx/imx8m/soc.c +1 -1
@@ -933,7 +933,7 @@ static void acquire_buildinfo(void)
 
 	/* Get ARM Trusted Firmware commit id */
 	arm_smccc_smc(IMX_SIP_BUILDINFO,
 IMX_SIP_BUILDINFO_GET_COMMITHASH,
-		      0, 0 , 0, 0, 0, 0, &res);
+		      0, 0, 0, 0, 0, 0, &res);
 	atf_commit = res.a0;
 	if (atf_commit == 0xffffffff) {
Quoted 1 line

debug("ATF does not support build info\n");

Quoted 2 lines

--
2.17.1

#4 lore raw

PATCH 2/2 imx8m: soc: Remove unneeded space

In reply to Fabio Estevam
Quoted 10 lines

Checkpatch reports the following issue:
ERROR: space prohibited before that ',' (ctx:WxW) #936: FILE: arch/arm/mach-imx/imx8m/soc.c:936:

(quoted diff) +1 -0
+		      0, 0 , 0, 0, 0, 0, &res);

Remove the unneeded space.
^

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH 1/2 imx8m: ddrphy_utils: Improve coding style

In reply to Fabio Estevam
Quoted 10 lines · Fabio Estevam

Currently checkpatch is not happy about this file:

total: 14 errors, 2 warnings, 7 checks, 359 lines checked

Improve the coding style so that it can now report:

total: 0 errors, 0 warnings, 6 checks, 360 lines checked

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200717/0b28a8fb/attachment.sig>
#6 lore raw

PATCH 1/2 imx8m: ddrphy_utils: Improve coding style

In reply to Fabio Estevam
Quoted 123 lines

Subject: [PATCH 1/2] imx8m: ddrphy_utils: Improve coding style

Currently checkpatch is not happy about this file:

total: 14 errors, 2 warnings, 7 checks, 359 lines checked

Improve the coding style so that it can now report:

total: 0 errors, 0 warnings, 6 checks, 360 lines checked

---
 drivers/ddr/imx/imx8m/ddrphy_utils.c | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/ddr/imx/imx8m/ddrphy_utils.c +7 -6
index 20ae47bfb5..0f8baefb1f 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
-* Copyright 2018 NXP
-*/
+ * Copyright 2018 NXP
+ */
 
 #include <common.h>
 #include <errno.h>
@@ -201,7 +201,7 @@ unsigned int lpddr4_mr_read(unsigned int mr_rank,
 unsigned int mr_addr)  }
 
 unsigned int look_for_max(unsigned int data[],
-		 unsigned int addr_start, unsigned int addr_end)
+			  unsigned int addr_start, unsigned int addr_end)
 {
 	unsigned int i, imax = 0;
 
@@ -233,9 +233,9 @@ void get_trained_CDD(u32 fsp)
 			if (i == 0) {
 				cdd_cha[0] = (tmp >> 8) & 0xff;
 			} else if (i == 6) {
-				cdd_cha[11]=tmp & 0xff;
+				cdd_cha[11] = tmp & 0xff;
 			} else {
-				cdd_chb[ i * 2 - 1] = tmp & 0xff;
+				cdd_chb[i * 2 - 1] = tmp & 0xff;
 				cdd_chb[i * 2] = (tmp >> 8) & 0xff;
 			}
 		}
@@ -254,7 +254,8 @@ void get_trained_CDD(u32 fsp)
 		g_cdd_ww_max[fsp] =  cdd_cha_ww_max > cdd_chb_ww_max ?
 cdd_cha_ww_max : cdd_chb_ww_max;
 	} else {
 		unsigned int ddr4_cdd[64];
-		for( i = 0; i < 29; i++) {
+
+		for (i = 0; i < 29; i++) {
 			tmp = reg32_read(IP2APB_DDRPHY_IPS_BASE_ADDR(0) +
 (0x54012 + i) * 4);
drivers/ddr/imx/imx8m/ddrphy_utils.c +0 -0
 			ddr4_cdd[i * 2] = tmp & 0xff;
 			ddr4_cdd[i * 2 + 1] = (tmp >> 8) & 0xff; @@ -269,18 +270,18

@@ void get_trained_CDD(u32 fsp)

void update_umctl2_rank_space_setting(unsigned int pstat_num) {

drivers/ddr/imx/imx8m/ddrphy_utils.c +9 -6
-	unsigned int i,ddr_type;
+	unsigned int i, ddr_type;
 	unsigned int addr_slot, rdata, tmp, tmp_t;
-	unsigned int ddrc_w2r,ddrc_r2w,ddrc_wr_gap,ddrc_rd_gap;
+	unsigned int ddrc_w2r, ddrc_r2w, ddrc_wr_gap, ddrc_rd_gap;
 
 	ddr_type = reg32_read(DDRC_MSTR(0)) & 0x3f;
 	for (i = 0; i < pstat_num; i++) {
 		addr_slot = i ? (i + 1) * 0x1000 : 0;
 		if (ddr_type == 0x20) {
 			/* update r2w:[13:8], w2r:[5:0] */
-			rdata=reg32_read(DDRC_DRAMTMG2(0) + addr_slot);
+			rdata = reg32_read(DDRC_DRAMTMG2(0) + addr_slot);
 			ddrc_w2r = rdata & 0x3f;
-			if(is_imx8mp())
+			if (is_imx8mp())
 				tmp = ddrc_w2r + (g_cdd_wr_max[i] >> 1);
 			else
 				tmp = ddrc_w2r + (g_cdd_wr_max[i] >> 1) + 1; @@ -297,7
+298,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 			reg32_write((DDRC_DRAMTMG2(0) + addr_slot), tmp_t);
 		} else {
 			/* update w2r:[5:0] */
-			rdata=reg32_read(DDRC_DRAMTMG9(0) + addr_slot);
+			rdata = reg32_read(DDRC_DRAMTMG9(0) + addr_slot);
 			ddrc_w2r = rdata & 0x3f;
 			if (is_imx8mp())
 				tmp = ddrc_w2r + (g_cdd_wr_max[i] >> 1); @@ -310,7
+311,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 			/* update r2w:[13:8] */
 			rdata = reg32_read(DDRC_DRAMTMG2(0) + addr_slot);
 			ddrc_r2w = (rdata >> 8) & 0x3f;
-			if(is_imx8mp())
+			if (is_imx8mp())
 				tmp = ddrc_r2w + (g_cdd_rw_max[i] >> 1);
 			else
 				tmp = ddrc_r2w + (g_cdd_rw_max[i] >> 1) + 1; @@ -324,7
+325,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num)
 			/* update rankctl: wr_gap:11:8; rd:gap:7:4; quasi-dymic, doc

wrong(static) */

drivers/ddr/imx/imx8m/ddrphy_utils.c +1 -2
 			rdata = reg32_read(DDRC_RANKCTL(0) + addr_slot);
 			ddrc_wr_gap = (rdata >> 8) & 0xf;
-			if(is_imx8mp())
+			if (is_imx8mp())
 				tmp = ddrc_wr_gap + (g_cdd_ww_max[i] >> 1);
 			else
 				tmp = ddrc_wr_gap + (g_cdd_ww_max[i] >> 1) + 1; @@
-342,7 +343,7 @@ void update_umctl2_rank_space_setting(unsigned int

pstat_num)

drivers/ddr/imx/imx8m/ddrphy_utils.c +1 -1
 		}
 	}
 
-	if(is_imx8mq()) {
+	if (is_imx8mq()) {
 		/* update rankctl: wr_gap:11:8; rd:gap:7:4; quasi-dymic, doc

wrong(static) */

drivers/ddr/imx/imx8m/ddrphy_utils.c void update_umctl2_rank_space_setting(unsigned int pstat_num)

Quoted 3 lines
drivers/ddr/imx/imx8m/ddrphy_utils.c +0 -1
 		rdata = reg32_read(DDRC_RANKCTL(0));
 		ddrc_wr_gap = (rdata >> 8) & 0xf;
--
Quoted 1 line

2.17.1

#7 lore raw

PATCH 1/2 imx8m: ddrphy_utils: Improve coding style

In reply to Fabio Estevam
Quoted 8 lines

Currently checkpatch is not happy about this file:
total: 14 errors, 2 warnings, 7 checks, 359 lines checked Improve the coding style so that it can now report:
total: 0 errors, 0 warnings, 6 checks, 360 lines checked

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================