All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] powerpc: Use print_size() where appropriate
@ 2013-07-31 15:31 Shruti Kanetkar
  2013-07-31 15:31 ` [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does Shruti Kanetkar
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shruti Kanetkar @ 2013-07-31 15:31 UTC (permalink / raw)
  To: u-boot

Makes the startup output more consistent

Signed-off-by: Shruti Kanetkar <Shruti@Freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
---
 arch/powerpc/cpu/mpc824x/cpu.c      |  8 +++-----
 arch/powerpc/cpu/mpc85xx/cpu_init.c |  8 +++++---
 arch/powerpc/cpu/mpc8xx/cpu.c       | 24 +++++++++++-------------
 arch/powerpc/cpu/mpc8xxx/ddr/main.c |  3 ++-
 4 files changed, 21 insertions(+), 22 deletions(-)


Hello PowerPC Custodians,


These are two simple patches I've been playing with as part of my learning
process. I realize that perhaps pieces of these patches should be submitted to
their respective custodians, but given their simplicity I'm thinking one of the
powerpc custodians can apply them (Andy perhaps) to their tree if nobody objects

I compile-tested these patches on all the mpc8xx and mpc8[356]xxx powerpc
boards/targets and I run them on one board each of the following families of
SoC(s): MPC8xx, MPC83xx and MPC85xx

Checkpatch has a few warnings like this:

WARNING: space prohibited between function name and open parenthesis '('
#132: FILE: arch/powerpc/cpu/ppc4xx/cpu.c:670:
+       printf ("       16 KiB I-Cache %d KiB D-Cache",

but I simply preserved the existing formating/style in the respective files


Regards,
Shruti.


diff --git a/arch/powerpc/cpu/mpc824x/cpu.c b/arch/powerpc/cpu/mpc824x/cpu.c
index 44f91b2..8be57ac 100644
--- a/arch/powerpc/cpu/mpc824x/cpu.c
+++ b/arch/powerpc/cpu/mpc824x/cpu.c
@@ -61,12 +61,10 @@ int checkcpu (void)
 		return -1;		/* no valid CPU revision info */
 	}
 
-	printf (" at %s MHz:", strmhz (buf, clock));
+	printf (" at %s MHz: ", strmhz (buf, clock));
 
-	printf (" %u kB I-Cache", checkicache () >> 10);
-	printf (" %u kB D-Cache", checkdcache () >> 10);
-
-	puts ("\n");
+	print_size(checkicache(), " I-Cache ");
+	print_size(checkdcache(), " D-Cache\n");
 
 	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 3c8f59c..6433997 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -182,7 +182,8 @@ static void enable_cpc(void)
 
 	}
 
-	printf("Corenet Platform Cache: %d KB enabled\n", size);
+	puts("Corenet Platform Cache: ");
+	print_size(size * 1024, " enabled\n");
 }
 
 static void invalidate_cpc(void)
@@ -533,13 +534,14 @@ int cpu_init_r(void)
 	if (CONFIG_SYS_INIT_L2CSR0 & L2CSR0_L2E) {
 		while (!(mfspr(SPRN_L2CSR0) & L2CSR0_L2E))
 			;
-		printf("%d KB enabled\n", (l2cfg0 & 0x3fff) * 64);
+		print_size((l2cfg0 & 0x3fff) * 64 * 1024, " enabled\n");
 	}
 
 skip_l2:
 #elif defined(CONFIG_SYS_FSL_QORIQ_CHASSIS2)
 	if (l2cache->l2csr0 & L2CSR0_L2E)
-		printf("%d KB enabled\n", (l2cache->l2cfg0 & 0x3fff) * 64);
+		print_size((l2cache->l2cfg0 & 0x3fff) * 64 * 1024,
+			   " enabled\n");
 
 	enable_cluster_l2();
 #else
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index dc33eb3..b7f3eea 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -152,10 +152,8 @@ static int check_CPU (long clock, uint pvr, uint immr)
 #else
 	printf (" at %s MHz: ", strmhz (buf, clock));
 #endif
-	printf ("%u kB I-Cache %u kB D-Cache",
-		checkicache () >> 10,
-		checkdcache () >> 10
-	);
+	print_size(checkicache(), " I-Cache ");
+	print_size(checkdcache(), " D-Cache");
 
 	/* do we have a FEC (860T/P or 852/859/866/885)? */
 
@@ -220,10 +218,10 @@ static int check_CPU (long clock, uint pvr, uint immr)
 		printf ("unknown MPC857 (0x%08x)", k);
 #endif
 
-	printf (" at %s MHz:", strmhz (buf, clock));
+	printf (" at %s MHz: ", strmhz (buf, clock));
 
-	printf (" %u kB I-Cache", checkicache () >> 10);
-	printf (" %u kB D-Cache", checkdcache () >> 10);
+	print_size(checkicache(), " I-Cache ");
+	print_size(checkdcache(), " D-Cache");
 
 	/* lets check and see if we're running on a 862T (or P?) */
 
@@ -281,10 +279,10 @@ static int check_CPU (long clock, uint pvr, uint immr)
 	if (suf)
 		printf ("PPC823ZTnn%s", suf);
 
-	printf (" at %s MHz:", strmhz (buf, clock));
+	printf (" at %s MHz: ", strmhz (buf, clock));
 
-	printf (" %u kB I-Cache", checkicache () >> 10);
-	printf (" %u kB D-Cache", checkdcache () >> 10);
+	print_size(checkicache(), " I-Cache ");
+	print_size(checkdcache(), " D-Cache");
 
 	/* lets check and see if we're running on a 860T (or P?) */
 
@@ -337,10 +335,10 @@ static int check_CPU (long clock, uint pvr, uint immr)
 	default:
 		printf ("unknown MPC850 (0x%08x)", k);
 	}
-	printf (" at %s MHz:", strmhz (buf, clock));
+	printf (" at %s MHz: ", strmhz (buf, clock));
 
-	printf (" %u kB I-Cache", checkicache () >> 10);
-	printf (" %u kB D-Cache", checkdcache () >> 10);
+	print_size(checkicache(), " I-Cache ");
+	print_size(checkdcache(), " D-Cache");
 
 	/* lets check and see if we're running on a 850T (or P?) */
 
diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/main.c b/arch/powerpc/cpu/mpc8xxx/ddr/main.c
index 7a8636d..40c03d4 100644
--- a/arch/powerpc/cpu/mpc8xxx/ddr/main.c
+++ b/arch/powerpc/cpu/mpc8xxx/ddr/main.c
@@ -637,7 +637,8 @@ phys_size_t fsl_ddr_sdram(void)
 #if !defined(CONFIG_PHYS_64BIT)
 	/* Check for 4G or more.  Bad. */
 	if (total_memory >= (1ull << 32)) {
-		printf("Detected %lld MB of memory\n", total_memory >> 20);
+		puts("Detected ");
+		print_size(total_memory, " of memory\n");
 		printf("       This U-Boot only supports < 4G of DDR\n");
 		printf("       You could rebuild it with CONFIG_PHYS_64BIT\n");
 		printf("       "); /* re-align to match init_func_ram print */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does
  2013-07-31 15:31 [U-Boot] [PATCH 1/2] powerpc: Use print_size() where appropriate Shruti Kanetkar
@ 2013-07-31 15:31 ` Shruti Kanetkar
  2013-08-20 18:16   ` York Sun
  2013-08-13 21:26 ` [U-Boot] [U-Boot, 1/2] powerpc: Use print_size() where appropriate York Sun
  2013-08-20 18:16 ` [U-Boot] [PATCH " York Sun
  2 siblings, 1 reply; 5+ messages in thread
From: Shruti Kanetkar @ 2013-07-31 15:31 UTC (permalink / raw)
  To: u-boot

Makes the startup output more consistent

Signed-off-by: Shruti Kanetkar <Shruti@Freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/cpu.c      |  2 +-
 arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 +++++++-------
 arch/powerpc/cpu/mpc86xx/cpu.c      |  6 +++---
 arch/powerpc/cpu/mpc8xx/video.c     |  4 ++--
 arch/powerpc/cpu/ppc4xx/cpu.c       |  6 +++---
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index fbee753..373ad02 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -225,7 +225,7 @@ int checkcpu (void)
 	printf("       PME:   %s MHz\n", strmhz(buf1, sysinfo.freqPME));
 #endif
 
-	puts("L1:    D-cache 32 kB enabled\n       I-cache 32 kB enabled\n");
+	puts("L1:    D-cache 32 KiB enabled\n       I-cache 32 KiB enabled\n");
 
 	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 6433997..297648d 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -465,28 +465,28 @@ int cpu_init_r(void)
 	case 0x1:
 		if (ver == SVR_8540 || ver == SVR_8560   ||
 		    ver == SVR_8541 || ver == SVR_8555) {
-			puts("128 KB ");
-			/* set L2E=1, L2I=1, & L2BLKSZ=1 (128 Kbyte) */
+			puts("128 KiB ");
+			/* set L2E=1, L2I=1, & L2BLKSZ=1 (128 KiBibyte) */
 			cache_ctl = 0xc4000000;
 		} else {
-			puts("256 KB ");
+			puts("256 KiB ");
 			cache_ctl = 0xc0000000; /* set L2E=1, L2I=1, & L2SRAM=0 */
 		}
 		break;
 	case 0x2:
 		if (ver == SVR_8540 || ver == SVR_8560   ||
 		    ver == SVR_8541 || ver == SVR_8555) {
-			puts("256 KB ");
-			/* set L2E=1, L2I=1, & L2BLKSZ=2 (256 Kbyte) */
+			puts("256 KiB ");
+			/* set L2E=1, L2I=1, & L2BLKSZ=2 (256 KiBibyte) */
 			cache_ctl = 0xc8000000;
 		} else {
-			puts ("512 KB ");
+			puts ("512 KiB ");
 			/* set L2E=1, L2I=1, & L2SRAM=0 */
 			cache_ctl = 0xc0000000;
 		}
 		break;
 	case 0x3:
-		puts("1024 KB ");
+		puts("1024 KiB ");
 		/* set L2E=1, L2I=1, & L2SRAM=0 */
 		cache_ctl = 0xc0000000;
 		break;
diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index 5ed3eb2..2333248 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -101,8 +101,8 @@ checkcpu(void)
 		       sysinfo.freqLocalBus);
 	}
 
-	puts("L1:    D-cache 32 KB enabled\n");
-	puts("       I-cache 32 KB enabled\n");
+	puts("L1:    D-cache 32 KiB enabled\n");
+	puts("       I-cache 32 KiB enabled\n");
 
 	puts("L2:    ");
 	if (get_l2cr() & 0x80000000) {
@@ -111,7 +111,7 @@ checkcpu(void)
 #elif defined(CONFIG_MPC8641)
 		puts("512");
 #endif
-		puts(" KB enabled\n");
+		puts(" KiB enabled\n");
 	} else {
 		puts("Disabled\n");
 	}
diff --git a/arch/powerpc/cpu/mpc8xx/video.c b/arch/powerpc/cpu/mpc8xx/video.c
index 1bbf4cc..c52bed0 100644
--- a/arch/powerpc/cpu/mpc8xx/video.c
+++ b/arch/powerpc/cpu/mpc8xx/video.c
@@ -1189,7 +1189,7 @@ static void *video_logo (void)
 #ifndef CONFIG_FADS		/* all normal boards */
 	/* leave one blank line */
 
-	sprintf (info, "MPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash",
+	sprintf (info, "MPC823 CPU at %s MHz, %ld MiB RAM, %ld MiB Flash",
 		strmhz(temp, gd->cpu_clk),
 		gd->ram_size >> 20,
 		gd->bd->bi_flashsize >> 20 );
@@ -1200,7 +1200,7 @@ static void *video_logo (void)
 	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
 					  info);
 
-	sprintf (info, "2MB FLASH - 8MB DRAM - 4MB SRAM");
+	sprintf (info, "2MiB FLASH - 8MiB DRAM - 4MiB SRAM");
 	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 2,
 					  info);
 #endif
diff --git a/arch/powerpc/cpu/ppc4xx/cpu.c b/arch/powerpc/cpu/ppc4xx/cpu.c
index 60aba8c..05425b1 100644
--- a/arch/powerpc/cpu/ppc4xx/cpu.c
+++ b/arch/powerpc/cpu/ppc4xx/cpu.c
@@ -663,11 +663,11 @@ int checkcpu (void)
 #endif
 
 #if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX)
-	printf ("       16 kB I-Cache 16 kB D-Cache");
+	printf ("       16 KiB I-Cache 16 KiB D-Cache");
 #elif defined(CONFIG_440)
-	printf ("       32 kB I-Cache 32 kB D-Cache");
+	printf ("       32 KiB I-Cache 32 KiB D-Cache");
 #else
-	printf ("       16 kB I-Cache %d kB D-Cache",
+	printf ("       16 KiB I-Cache %d KiB D-Cache",
 		((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
 #endif
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [U-Boot, 1/2] powerpc: Use print_size() where appropriate
  2013-07-31 15:31 [U-Boot] [PATCH 1/2] powerpc: Use print_size() where appropriate Shruti Kanetkar
  2013-07-31 15:31 ` [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does Shruti Kanetkar
@ 2013-08-13 21:26 ` York Sun
  2013-08-20 18:16 ` [U-Boot] [PATCH " York Sun
  2 siblings, 0 replies; 5+ messages in thread
From: York Sun @ 2013-08-13 21:26 UTC (permalink / raw)
  To: u-boot

On 07/31/2013 08:31 AM, Shruti Kanetkar wrote:
> Makes the startup output more consistent
> 
> Signed-off-by: Shruti Kanetkar <Shruti@Freescale.com>
> Acked-by: Andy Fleming <afleming@freescale.com>
> 
> ---
> arch/powerpc/cpu/mpc824x/cpu.c      |  8 +++-----
>  arch/powerpc/cpu/mpc85xx/cpu_init.c |  8 +++++---
>  arch/powerpc/cpu/mpc8xx/cpu.c       | 24 +++++++++++-------------
>  arch/powerpc/cpu/mpc8xxx/ddr/main.c |  3 ++-
>  4 files changed, 21 insertions(+), 22 deletions(-)
> 
> 
> Hello PowerPC Custodians,
> 
> 
> These are two simple patches I've been playing with as part of my learning
> process. I realize that perhaps pieces of these patches should be submitted to
> their respective custodians, but given their simplicity I'm thinking one of the
> powerpc custodians can apply them (Andy perhaps) to their tree if nobody objects
> 
> I compile-tested these patches on all the mpc8xx and mpc8[356]xxx powerpc
> boards/targets and I run them on one board each of the following families of
> SoC(s): MPC8xx, MPC83xx and MPC85xx
> 
> Checkpatch has a few warnings like this:
> 
> WARNING: space prohibited between function name and open parenthesis '('
> #132: FILE: arch/powerpc/cpu/ppc4xx/cpu.c:670:
> +       printf ("       16 KiB I-Cache %d KiB D-Cache",
> 
> but I simply preserved the existing formating/style in the respective files
> 

Appreciate the cleanup. Please fix the space issue as checkpatch
complained. There are many examples of bad style in source code. We
should clean them up as much as we can. Thanks.

York

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] powerpc: Use print_size() where appropriate
  2013-07-31 15:31 [U-Boot] [PATCH 1/2] powerpc: Use print_size() where appropriate Shruti Kanetkar
  2013-07-31 15:31 ` [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does Shruti Kanetkar
  2013-08-13 21:26 ` [U-Boot] [U-Boot, 1/2] powerpc: Use print_size() where appropriate York Sun
@ 2013-08-20 18:16 ` York Sun
  2 siblings, 0 replies; 5+ messages in thread
From: York Sun @ 2013-08-20 18:16 UTC (permalink / raw)
  To: u-boot

On 07/31/2013 08:31 AM, Shruti Kanetkar wrote:
> Makes the startup output more consistent
> 
> Signed-off-by: Shruti Kanetkar <Shruti@Freescale.com>
> Acked-by: Andy Fleming <afleming@freescale.com>
> ---
>  arch/powerpc/cpu/mpc824x/cpu.c      |  8 +++-----
>  arch/powerpc/cpu/mpc85xx/cpu_init.c |  8 +++++---
>  arch/powerpc/cpu/mpc8xx/cpu.c       | 24 +++++++++++-------------
>  arch/powerpc/cpu/mpc8xxx/ddr/main.c |  3 ++-
>  4 files changed, 21 insertions(+), 22 deletions(-)
> 
>
Applied to u-boot-mpc85xx/master.

York

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does
  2013-07-31 15:31 ` [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does Shruti Kanetkar
@ 2013-08-20 18:16   ` York Sun
  0 siblings, 0 replies; 5+ messages in thread
From: York Sun @ 2013-08-20 18:16 UTC (permalink / raw)
  To: u-boot

On 07/31/2013 08:31 AM, Shruti Kanetkar wrote:
> Makes the startup output more consistent
> 
> Signed-off-by: Shruti Kanetkar <Shruti@Freescale.com>
> Acked-by: Andy Fleming <afleming@freescale.com>
> ---
>  arch/powerpc/cpu/mpc85xx/cpu.c      |  2 +-
>  arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 +++++++-------
>  arch/powerpc/cpu/mpc86xx/cpu.c      |  6 +++---
>  arch/powerpc/cpu/mpc8xx/video.c     |  4 ++--
>  arch/powerpc/cpu/ppc4xx/cpu.c       |  6 +++---
>  5 files changed, 16 insertions(+), 16 deletions(-)
> 

Applied to u-boot-mpc85xx/master after resolving conflicts.

York

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-20 18:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-31 15:31 [U-Boot] [PATCH 1/2] powerpc: Use print_size() where appropriate Shruti Kanetkar
2013-07-31 15:31 ` [U-Boot] [PATCH 2/2] powerpc: Print hardcoded size like print_size() does Shruti Kanetkar
2013-08-20 18:16   ` York Sun
2013-08-13 21:26 ` [U-Boot] [U-Boot, 1/2] powerpc: Use print_size() where appropriate York Sun
2013-08-20 18:16 ` [U-Boot] [PATCH " York Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.