[PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

STALE6964d

8 messages, 5 authors, 2007-07-13 · open the first message on its own page

[PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Laurent Pinchart <hidden>
Date: 2007-07-10 11:12:49

The non board-specific mpc82xx_halt and mpc82xx_restart functions are defined
in arch/powerpc/platforms/82xx/mpc82xx_ads.c. This patch moves them to
mpc82xx.c to make them usable by other MPC82xx boards.

Signed-off-by: Laurent Pinchart <redacted>
---
 arch/powerpc/platforms/82xx/mpc82xx.c     |   33 
+++++++++++++++--------------
 arch/powerpc/platforms/82xx/mpc82xx.h     |   24 +++++++++++++++++++++
 arch/powerpc/platforms/82xx/mpc82xx_ads.c |   31 ++++++++++++++-------------
 arch/powerpc/platforms/82xx/pq2ads.h      |    1 -
 4 files changed, 57 insertions(+), 32 deletions(-)
 create mode 100644 arch/powerpc/platforms/82xx/mpc82xx.h
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.c 
b/arch/powerpc/platforms/82xx/mpc82xx.c
index cc9900d..d67c754 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx.c
@@ -50,7 +50,7 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/cpm2_pic.h>
 
-#include "pq2ads.h"
+#include "mpc82xx.h"
 
 static int __init get_freq(char *name, unsigned long *val)
 {
@@ -88,23 +88,24 @@ void __init m82xx_calibrate_decr(void)
 				"(not found)\n");
 }
 
-void mpc82xx_ads_show_cpuinfo(struct seq_file *m)
+#define RMR_CSRE 0x00000001
+void m82xx_restart(char *cmd)
 {
-	uint pvid, svid, phid1;
-	uint memsize = total_memory;
+	__volatile__ unsigned char dummy;
 
-	pvid = mfspr(SPRN_PVR);
-	svid = mfspr(SPRN_SVR);
+	local_irq_disable();
+	((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= RMR_CSRE;
 
-	seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
-	seq_printf(m, "Machine\t\t: %s\n", CPUINFO_MACHINE);
-	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
-	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
-
-	/* Display cpu Pll setting */
-	phid1 = mfspr(SPRN_HID1);
-	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
+	/* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
+	mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
+	dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
+	printk("Restart failed\n");
+	while (1) ;
+}
 
-	/* Display the amount of memory */
-	seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
+void m82xx_halt(void)
+{
+	local_irq_disable();
+	while (1) ;
 }
+
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.h 
b/arch/powerpc/platforms/82xx/mpc82xx.h
new file mode 100644
index 0000000..427925b
--- /dev/null
+++ b/arch/powerpc/platforms/82xx/mpc82xx.h
@@ -0,0 +1,24 @@
+/*
+ * MPC82xx setup and early boot code plus other random bits.
+ *
+ * Author: Vitaly Bordug <vbordug@ru.mvista.com>
+ *
+ * Copyright (c) 2006 MontaVista Software, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __MACH_MPC82XX_H__
+#define __MACH_MPC82XX_H__
+
+#include <linux/init.h>
+
+extern void __init m82xx_calibrate_decr(void);
+extern void m82xx_restart(char *cmd);
+extern void m82xx_halt(void);
+
+#endif
+
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c 
b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index 47cb09f..1af9449 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -51,6 +51,7 @@
 #include <sysdev/fsl_soc.h>
 #include <../sysdev/cpm2_pic.h>
 
+#include "mpc82xx.h"
 #include "pq2ads.h"
 
 #ifdef CONFIG_PCI
@@ -611,25 +612,25 @@ static int __init mpc82xx_ads_probe(void)
 	return 1;
 }
 
-#define RMR_CSRE 0x00000001
-static void m82xx_restart(char *cmd)
+void mpc82xx_ads_show_cpuinfo(struct seq_file *m)
 {
-	__volatile__ unsigned char dummy;
+	uint pvid, svid, phid1;
+	uint memsize = total_memory;
 
-	local_irq_disable();
-	((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= RMR_CSRE;
+	pvid = mfspr(SPRN_PVR);
+	svid = mfspr(SPRN_SVR);
 
-	/* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
-	mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
-	dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
-	printk("Restart failed\n");
-	while (1) ;
-}
+	seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
+	seq_printf(m, "Machine\t\t: %s\n", CPUINFO_MACHINE);
+	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
+	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
 
-static void m82xx_halt(void)
-{
-	local_irq_disable();
-	while (1) ;
+	/* Display cpu Pll setting */
+	phid1 = mfspr(SPRN_HID1);
+	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
+
+	/* Display the amount of memory */
+	seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
 }
 
 define_machine(mpc82xx_ads)
diff --git a/arch/powerpc/platforms/82xx/pq2ads.h 
b/arch/powerpc/platforms/82xx/pq2ads.h
index 5b5cca6..5056fe5 100644
--- a/arch/powerpc/platforms/82xx/pq2ads.h
+++ b/arch/powerpc/platforms/82xx/pq2ads.h
@@ -60,7 +60,6 @@
 
 void m82xx_pci_init_irq(void);
 void mpc82xx_ads_show_cpuinfo(struct seq_file*);
-void m82xx_calibrate_decr(void);
 
 #endif /* __MACH_ADS8260_DEFS */
 #endif /* __KERNEL__ */
-- 
1.5.0

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Scott Wood <hidden>
Date: 2007-07-10 18:05:35

On Tue, Jul 10, 2007 at 01:12:45PM +0200, Laurent Pinchart wrote:
The non board-specific mpc82xx_halt and mpc82xx_restart functions are defined
in arch/powerpc/platforms/82xx/mpc82xx_ads.c. This patch moves them to
mpc82xx.c to make them usable by other MPC82xx boards.
Why are you also moving mpc82xx_ads_show_cpuinfo() to the board file? 
It's not really ADS-specific; it should just be renamed.

-Scott

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Laurent Pinchart <hidden>
Date: 2007-07-11 07:28:59

On Tuesday 10 July 2007 20:05, Scott Wood wrote:
On Tue, Jul 10, 2007 at 01:12:45PM +0200, Laurent Pinchart wrote:
quoted
The non board-specific mpc82xx_halt and mpc82xx_restart functions are
defined in arch/powerpc/platforms/82xx/mpc82xx_ads.c. This patch moves
them to mpc82xx.c to make them usable by other MPC82xx boards.
Why are you also moving mpc82xx_ads_show_cpuinfo() to the board file?
It's not really ADS-specific; it should just be renamed.
For the MPC82xx ADS boards, mpc82xx_ads_show_cpuinfo() prints

Vendor		: Freescale Semiconductor
Machine		: PQ2 ADS PowerPC

The vendor string is hardcoded to "Freescale Semiconductor", and the machine 
string is defined in pq2ads.h. What should show_cpuinfo() print ? Should the 
vendor be the board vendor or the CPU vendor ? What about the machine ?

Laurent Pinchart

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Scott Wood <hidden>
Date: 2007-07-11 15:25:39

Laurent Pinchart wrote:
On Tuesday 10 July 2007 20:05, Scott Wood wrote:
quoted
Why are you also moving mpc82xx_ads_show_cpuinfo() to the board file?
It's not really ADS-specific; it should just be renamed.

For the MPC82xx ADS boards, mpc82xx_ads_show_cpuinfo() prints

Vendor		: Freescale Semiconductor
Machine		: PQ2 ADS PowerPC

The vendor string is hardcoded to "Freescale Semiconductor", and the machine 
string is defined in pq2ads.h. What should show_cpuinfo() print ? Should the 
vendor be the board vendor or the CPU vendor ? What about the machine ?
Ah, I missed that.  I'd just get rid of "Vendor" altogether, and include 
the vendor name in the machine name.

-Scott

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Laurent Pinchart <hidden>
Date: 2007-07-12 14:57:56

Hi Scott,

On Wednesday 11 July 2007 17:25, Scott Wood wrote:
Laurent Pinchart wrote:
quoted
On Tuesday 10 July 2007 20:05, Scott Wood wrote:
quoted
Why are you also moving mpc82xx_ads_show_cpuinfo() to the board file?
It's not really ADS-specific; it should just be renamed.
For the MPC82xx ADS boards, mpc82xx_ads_show_cpuinfo() prints

Vendor		: Freescale Semiconductor
Machine		: PQ2 ADS PowerPC

The vendor string is hardcoded to "Freescale Semiconductor", and the
machine string is defined in pq2ads.h. What should show_cpuinfo() print ?
Should the vendor be the board vendor or the CPU vendor ? What about the
machine ?
Ah, I missed that.  I'd just get rid of "Vendor" altogether, and include
the vendor name in the machine name.
Is there any standard/documentation regarding what show_cpuinfo should print ? 
Should it show CPU information only, or board information as well ? What 
about the memory size, clock settings, ... ? What are the meanings 
of "vendor" and "machine" ?

-- 
Laurent Pinchart
CSE Semaphore Belgium

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Laurent Pinchart <hidden>
Date: 2007-07-12 15:04:48

Hi Scott,

On Wednesday 11 July 2007 17:25, Scott Wood wrote:
Laurent Pinchart wrote:
quoted
On Tuesday 10 July 2007 20:05, Scott Wood wrote:
quoted
Why are you also moving mpc82xx_ads_show_cpuinfo() to the board file?
It's not really ADS-specific; it should just be renamed.
For the MPC82xx ADS boards, mpc82xx_ads_show_cpuinfo() prints

Vendor		: Freescale Semiconductor
Machine		: PQ2 ADS PowerPC

The vendor string is hardcoded to "Freescale Semiconductor", and the
machine string is defined in pq2ads.h. What should show_cpuinfo() print ?
Should the vendor be the board vendor or the CPU vendor ? What about the
machine ?
Ah, I missed that.  I'd just get rid of "Vendor" altogether, and include
the vendor name in the machine name.
Is there any standard/documentation regarding what show_cpuinfo should print ? 
Should it show CPU information only, or board information as well ? What 
about the memory size, clock settings, ... ? What are the meanings 
of "vendor" and "machine" ?

-- 
Laurent Pinchart
CSE Semaphore Belgium

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Laurent Pinchart <hidden>
Date: 2007-07-12 15:07:33

Hi Scott,

On Wednesday 11 July 2007 17:25, Scott Wood wrote:
Laurent Pinchart wrote:
quoted
On Tuesday 10 July 2007 20:05, Scott Wood wrote:
quoted
Why are you also moving mpc82xx_ads_show_cpuinfo() to the board file?
It's not really ADS-specific; it should just be renamed.
For the MPC82xx ADS boards, mpc82xx_ads_show_cpuinfo() prints

Vendor              : Freescale Semiconductor
Machine             : PQ2 ADS PowerPC

The vendor string is hardcoded to "Freescale Semiconductor", and the
machine string is defined in pq2ads.h. What should show_cpuinfo() print ?
Should the vendor be the board vendor or the CPU vendor ? What about the
machine ?
Ah, I missed that.  I'd just get rid of "Vendor" altogether, and include
the vendor name in the machine name.
Is there any standard/documentation regarding what show_cpuinfo should print ? 
Should it show CPU information only, or board information as well ? What 
about the memory size, clock settings, ... ? What are the meanings 
of "vendor" and "machine" ?

-- 
Laurent Pinchart
CSE Semaphore Belgium

Re: [PATCH] [POWERPC] Move generic MPC82xx functions out of ADS-specific

From: Arnd Bergmann <arnd@arndb.de>
Date: 2007-07-13 00:00:16

On Thursday 12 July 2007, Laurent Pinchart wrote:
quoted
Ah, I missed that. =A0I'd just get rid of "Vendor" altogether, and incl=
ude
quoted
the vendor name in the machine name.
=20
Is there any standard/documentation regarding what show_cpuinfo should pr=
int ?=20
Should it show CPU information only, or board information as well ? What=
=20
about the memory size, clock settings, ... ? What are the meanings=20
of "vendor" and "machine" ?
I guess the easiest would be to modify the common show_cpuinfo function
to fall back to just printing the model, if there is no specific function:

=2D-- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -175,6 +175,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 			seq_printf(m, "platform\t: %s\n", ppc_md.name);
 		if (ppc_md.show_cpuinfo !=3D NULL)
 			ppc_md.show_cpuinfo(m);
+		else {
+			struct device_node *root =3D of_find_node_by_path("/");
+			const char *model =3D of_get_property(root, "model", NULL);
+			seq_printf(m, "machine\t\t: %s\n", model);
+			of_node_put(root);
+		}
=20
 		return 0;
 	}

With that in place, we can probably get rid of half the platform
specific show_cpuinfo functions.

	Arnd <><
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help