linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided.
@ 2007-10-08 22:24 Grant Likely
  2007-10-08 22:24 ` [PATCH 2/6] Remove empty ppc_md.setup_arch hooks Grant Likely
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Grant Likely @ 2007-10-08 22:24 UTC (permalink / raw)
  To: galak, paulus, arnd, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

This allows platforms which don't have anything to do at setup_arch time
(like a bunch of the 4xx platforms) to eliminate an empty setup_arch hook.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/kernel/setup_32.c |    3 ++-
 arch/powerpc/kernel/setup_64.c |    3 ++-
 include/asm-powerpc/machdep.h  |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 7474502..cd870a8 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -290,7 +290,8 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 
-	ppc_md.setup_arch();
+	if (ppc_md.setup_arch)
+		ppc_md.setup_arch();
 	if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
 
 	paging_init();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 3089eae..008ab68 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -530,7 +530,8 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 
-	ppc_md.setup_arch();
+	if (ppc_md.setup_arch)
+		ppc_md.setup_arch();
 
 	paging_init();
 	ppc64_boot_msg(0x15, "Setup Done");
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 71c6e7e..cc7c17f 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -99,7 +99,7 @@ struct machdep_calls {
 #endif /* CONFIG_PPC64 */
 
 	int		(*probe)(void);
-	void		(*setup_arch)(void);
+	void		(*setup_arch)(void); /* Optional, may be NULL */
 	void		(*init_early)(void);
 	/* Optional, may be NULL. */
 	void		(*show_cpuinfo)(struct seq_file *m);

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

* [PATCH 2/6] Remove empty ppc_md.setup_arch hooks.
  2007-10-08 22:24 [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided Grant Likely
@ 2007-10-08 22:24 ` Grant Likely
  2007-10-08 22:25 ` [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV Grant Likely
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2007-10-08 22:24 UTC (permalink / raw)
  To: galak, paulus, arnd, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/40x/virtex.c  |    5 -----
 arch/powerpc/platforms/40x/walnut.c  |    5 -----
 arch/powerpc/platforms/44x/bamboo.c  |    5 -----
 arch/powerpc/platforms/44x/ebony.c   |    5 -----
 arch/powerpc/platforms/44x/sequoia.c |    5 -----
 5 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index b52aa94..14bbc32 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -36,14 +36,9 @@ static int __init virtex_probe(void)
 	return 1;
 }
 
-static void __init virtex_setup_arch(void)
-{
-}
-
 define_machine(virtex) {
 	.name			= "Xilinx Virtex",
 	.probe			= virtex_probe,
-	.setup_arch		= virtex_setup_arch,
 	.init_IRQ		= xilinx_intc_init_tree,
 	.get_irq		= xilinx_intc_get_irq,
 	.calibrate_decr		= generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index c17fdf2..eb0c136 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -53,14 +53,9 @@ static int __init walnut_probe(void)
 	return 1;
 }
 
-static void __init walnut_setup_arch(void)
-{
-}
-
 define_machine(walnut) {
 	.name			= "Walnut",
 	.probe			= walnut_probe,
-	.setup_arch		= walnut_setup_arch,
 	.progress		= udbg_progress,
 	.init_IRQ		= uic_init_tree,
 	.get_irq		= uic_get_irq,
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index 9bc45de..470e1a3 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -50,14 +50,9 @@ static int __init bamboo_probe(void)
 	return 1;
 }
 
-static void __init bamboo_setup_arch(void)
-{
-}
-
 define_machine(bamboo) {
 	.name 				= "Bamboo",
 	.probe 				= bamboo_probe,
-	.setup_arch 		= bamboo_setup_arch,
 	.progress 			= udbg_progress,
 	.init_IRQ 			= uic_init_tree,
 	.get_irq 			= uic_get_irq,
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 5a7fec8..40e18fc 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -57,14 +57,9 @@ static int __init ebony_probe(void)
 	return 1;
 }
 
-static void __init ebony_setup_arch(void)
-{
-}
-
 define_machine(ebony) {
 	.name			= "Ebony",
 	.probe			= ebony_probe,
-	.setup_arch		= ebony_setup_arch,
 	.progress		= udbg_progress,
 	.init_IRQ		= uic_init_tree,
 	.get_irq		= uic_get_irq,
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index 7d0d9d5..30700b3 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -50,14 +50,9 @@ static int __init sequoia_probe(void)
 	return 1;
 }
 
-static void __init sequoia_setup_arch(void)
-{
-}
-
 define_machine(sequoia) {
 	.name 				= "Sequoia",
 	.probe 				= sequoia_probe,
-	.setup_arch			= sequoia_setup_arch,
 	.progress 			= udbg_progress,
 	.init_IRQ 			= uic_init_tree,
 	.get_irq 			= uic_get_irq,

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

* [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV
  2007-10-08 22:24 [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided Grant Likely
  2007-10-08 22:24 ` [PATCH 2/6] Remove empty ppc_md.setup_arch hooks Grant Likely
@ 2007-10-08 22:25 ` Grant Likely
  2007-10-09 13:53   ` Kumar Gala
  2007-10-08 22:25 ` [PATCH 4/6] MPC52xx: Drop show_cpuinfo platform hooks from Lite5200 Grant Likely
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Grant Likely @ 2007-10-08 22:25 UTC (permalink / raw)
  To: galak, paulus, arnd, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

There is no good reason for board platform code to mess with the ROOT_DEV.
Remove it from all in-tree platforms except powermac

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/52xx/efika.c          |    9 ---------
 arch/powerpc/platforms/52xx/lite5200.c       |   12 ------------
 arch/powerpc/platforms/8xx/mpc86xads_setup.c |    2 --
 arch/powerpc/platforms/cell/setup.c          |    5 -----
 arch/powerpc/platforms/celleb/setup.c        |    5 -----
 arch/powerpc/platforms/chrp/setup.c          |   10 ----------
 arch/powerpc/platforms/pseries/setup.c       |    5 -----
 7 files changed, 0 insertions(+), 48 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 4263158..0b1e60a 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -197,15 +197,6 @@ static void __init efika_setup_arch(void)
 {
 	rtas_initialize();
 
-#ifdef CONFIG_BLK_DEV_INITRD
-	initrd_below_start_ok = 1;
-
-	if (initrd_start)
-		ROOT_DEV = Root_RAM0;
-	else
-#endif
-		ROOT_DEV = Root_SDA2;	/* sda2 (sda1 is for the kernel) */
-
 	efika_pcisetup();
 
 #ifdef CONFIG_PM
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index e11d27f..48fc662 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -136,18 +136,6 @@ static void __init lite5200_setup_arch(void)
 		of_node_put(np);
 	}
 #endif
-
-#ifdef CONFIG_BLK_DEV_INITRD
-	if (initrd_start)
-		ROOT_DEV = Root_RAM0;
-	else
-#endif
-#ifdef  CONFIG_ROOT_NFS
-		ROOT_DEV = Root_NFS;
-#else
-		ROOT_DEV = Root_HDA1;
-#endif
-
 }
 
 static void lite5200_show_cpuinfo(struct seq_file *m)
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index 8f64f48..c712ce0 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -256,8 +256,6 @@ static void __init mpc86xads_setup_arch(void)
 	cpm_reset();
 
 	mpc86xads_board_setup();
-
-	ROOT_DEV = Root_NFS;
 }
 
 static int __init mpc86xads_probe(void)
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index db66542..3d679b1 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -161,11 +161,6 @@ static void __init cell_setup_arch(void)
 	/* init to some ~sane value until calibrate_delay() runs */
 	loops_per_jiffy = 50000000;
 
-	if (ROOT_DEV == 0) {
-		printk("No ramdisk, default root is /dev/hda2\n");
-		ROOT_DEV = Root_HDA2;
-	}
-
 	/* Find and initialize PCI host bridges */
 	init_pci_config_tokens();
 	find_and_init_phbs();
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index 0f1dddb..1769d75 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -101,11 +101,6 @@ static void __init celleb_setup_arch(void)
 	/* init to some ~sane value until calibrate_delay() runs */
 	loops_per_jiffy = 50000000;
 
-	if (ROOT_DEV == 0) {
-		printk("No ramdisk, default root is /dev/hda2\n");
-		ROOT_DEV = Root_HDA2;
-	}
-
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 96498ad..5930626 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -290,16 +290,6 @@ void __init chrp_setup_arch(void)
 		ppc_md.set_rtc_time	= rtas_set_rtc_time;
 	}
 
-#ifdef CONFIG_BLK_DEV_INITRD
-	/* this is fine for chrp */
-	initrd_below_start_ok = 1;
-
-	if (initrd_start)
-		ROOT_DEV = Root_RAM0;
-	else
-#endif
-		ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
-
 	/* On pegasos, enable the L2 cache if not already done by OF */
 	pegasos_set_l2cr();
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f0b7146..fdb9b1c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -257,11 +257,6 @@ static void __init pSeries_setup_arch(void)
 	/* init to some ~sane value until calibrate_delay() runs */
 	loops_per_jiffy = 50000000;
 
-	if (ROOT_DEV == 0) {
-		printk("No ramdisk, default root is /dev/sda2\n");
-		ROOT_DEV = Root_SDA2;
-	}
-
 	fwnmi_init();
 
 	/* Find and initialize PCI host bridges */

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

* [PATCH 4/6] MPC52xx: Drop show_cpuinfo platform hooks from Lite5200
  2007-10-08 22:24 [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided Grant Likely
  2007-10-08 22:24 ` [PATCH 2/6] Remove empty ppc_md.setup_arch hooks Grant Likely
  2007-10-08 22:25 ` [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV Grant Likely
@ 2007-10-08 22:25 ` Grant Likely
  2007-10-08 22:25 ` [PATCH 5/6] MPC52xx: Trim includes on mpc5200 platform support code Grant Likely
  2007-10-08 22:25 ` [PATCH 6/6] MPC5200: Don't make firmware fixups into common code Grant Likely
  4 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2007-10-08 22:25 UTC (permalink / raw)
  To: galak, paulus, arnd, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

This hook doesn't really add any new information.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/52xx/lite5200.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 48fc662..6469813 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -138,20 +138,6 @@ static void __init lite5200_setup_arch(void)
 #endif
 }
 
-static void lite5200_show_cpuinfo(struct seq_file *m)
-{
-	struct device_node* np = of_find_all_nodes(NULL);
-	const char *model = NULL;
-
-	if (np)
-		model = of_get_property(np, "model", NULL);
-
-	seq_printf(m, "vendor\t\t:	Freescale Semiconductor\n");
-	seq_printf(m, "machine\t\t:	%s\n", model ? model : "unknown");
-
-	of_node_put(np);
-}
-
 /*
  * Called very early, MMU is off, device-tree isn't unflattened
  */
@@ -175,6 +161,5 @@ define_machine(lite5200) {
 	.init		= mpc52xx_declare_of_platform_devices,
 	.init_IRQ 	= mpc52xx_init_irq,
 	.get_irq 	= mpc52xx_get_irq,
-	.show_cpuinfo	= lite5200_show_cpuinfo,
 	.calibrate_decr	= generic_calibrate_decr,
 };

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

* [PATCH 5/6] MPC52xx: Trim includes on mpc5200 platform support code
  2007-10-08 22:24 [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided Grant Likely
                   ` (2 preceding siblings ...)
  2007-10-08 22:25 ` [PATCH 4/6] MPC52xx: Drop show_cpuinfo platform hooks from Lite5200 Grant Likely
@ 2007-10-08 22:25 ` Grant Likely
  2007-10-09  4:43   ` Stephen Rothwell
  2007-10-08 22:25 ` [PATCH 6/6] MPC5200: Don't make firmware fixups into common code Grant Likely
  4 siblings, 1 reply; 9+ messages in thread
From: Grant Likely @ 2007-10-08 22:25 UTC (permalink / raw)
  To: galak, paulus, arnd, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

Drop unnecessary includes for MPC5200 based boards

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/52xx/efika.c          |   21 ++-------------------
 arch/powerpc/platforms/52xx/lite5200.c       |   22 +---------------------
 arch/powerpc/platforms/52xx/mpc52xx_common.c |    4 +---
 arch/powerpc/platforms/52xx/mpc52xx_pic.c    |   12 +-----------
 4 files changed, 5 insertions(+), 54 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 0b1e60a..e5bc493 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -9,33 +9,16 @@
  * kind, whether express or implied.
  */
 
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/utsrelease.h>
-#include <linux/seq_file.h>
-#include <linux/string.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-#include <linux/timer.h>
 #include <linux/pci.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/sections.h>
-#include <asm/pci-bridge.h>
-#include <asm/pgtable.h>
-#include <asm/prom.h>
+#include <linux/of.h>
 #include <asm/time.h>
+#include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/rtas.h>
-#include <asm/of_device.h>
-#include <asm/of_platform.h>
 #include <asm/mpc52xx.h>
 
-
 #define EFIKA_PLATFORM_NAME "Efika"
 
 
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 6469813..c1aca5e 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -15,32 +15,12 @@
 
 #undef DEBUG
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
 #include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-
-#include <asm/system.h>
-#include <asm/atomic.h>
+#include <linux/of.h>
 #include <asm/time.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/of_platform.h>
-
 #include <asm/mpc52xx.h>
 
 /* ************************************************************************
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 2dd415f..93e7869 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -13,10 +13,8 @@
 #undef DEBUG
 
 #include <linux/kernel.h>
-
+#include <linux/of_platform.h>
 #include <asm/io.h>
-#include <asm/prom.h>
-#include <asm/of_platform.h>
 #include <asm/mpc52xx.h>
 
 
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 0f4ca8a..0cfcc42 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -18,19 +18,9 @@
 
 #undef DEBUG
 
-#include <linux/stddef.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/signal.h>
-#include <linux/delay.h>
 #include <linux/irq.h>
-#include <linux/hardirq.h>
-
+#include <linux/of.h>
 #include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
 #include <asm/mpc52xx.h>
 #include "mpc52xx_pic.h"
 

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

* [PATCH 6/6] MPC5200: Don't make firmware fixups into common code
  2007-10-08 22:24 [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided Grant Likely
                   ` (3 preceding siblings ...)
  2007-10-08 22:25 ` [PATCH 5/6] MPC52xx: Trim includes on mpc5200 platform support code Grant Likely
@ 2007-10-08 22:25 ` Grant Likely
  4 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2007-10-08 22:25 UTC (permalink / raw)
  To: galak, paulus, arnd, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

The Lite5200 u-boot image doesn't entirely configure the processor
correctly and so Linux needs to fixup the cpu setup in setup_arch.  Fixing
the CPU setup is good, but making it into common code is not a good idea.

New board ports should be encouraged not to take the lead of the lite5200
and instead get their firmware to setup the CPU the right way.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/52xx/lite5200.c       |   85 ++++++++++++++++++++++++--
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   40 ------------
 2 files changed, 78 insertions(+), 47 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index c1aca5e..3956769 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -29,19 +29,90 @@
  *
  */
 
+/*
+ * Fix clock configuration.
+ *
+ * Firmware is supposed to be responsible for this.  If you are creating a
+ * new board port, do *NOT* duplicate this code.  Fix your boot firmware
+ * to set it correctly in the first place
+ */
+void __init
+lite5200_fix_clock_config(void)
+{
+	struct mpc52xx_cdm  __iomem *cdm;
+
+	/* Map zones */
+	cdm = mpc52xx_find_and_map("mpc5200-cdm");
+	if (!cdm) {
+		printk(KERN_ERR "Could not adjust CDM config; "
+		       "Expect abnormal behaviour\n");
+		return;
+	}
+
+	/* Use internal 48 Mhz */
+	out_8(&cdm->ext_48mhz_en, 0x00);
+	out_8(&cdm->fd_enable, 0x01);
+	if (in_be32(&cdm->rstcfg) & 0x40)	/* Assumes 33Mhz clock */
+		out_be16(&cdm->fd_counters, 0x0001);
+	else
+		out_be16(&cdm->fd_counters, 0x5555);
+
+	/* Unmap the regs */
+	iounmap(cdm);
+}
+
+/*
+ * Fix XLB configuration.
+ *
+ * Firmware is supposed to be responsible for this.  If you are creating a
+ * new board port, do *NOT* duplicate this code.  Fix your boot firmware
+ * to set it correctly in the first place
+ */
+void __init
+lite5200_fix_xlb_config(void)
+{
+	struct mpc52xx_xlb  __iomem *xlb;
+
+	xlb = mpc52xx_find_and_map("mpc5200-xlb");
+	if (!xlb) {
+		printk(KERN_ERR "Could not adjust XLB config; "
+		       "Expect abnormal behaviour\n");
+		return;
+	}
+
+	/* Configure the XLB Arbiter priorities */
+	out_be32(&xlb->master_pri_enable, 0xff);
+	out_be32(&xlb->master_priority, 0x11111111);
+
+	/* Disable XLB pipelining
+	 * (cfr errate 292. We could do this only just before ATA PIO
+	 * transaction and re-enable it afterwards ...)
+	 */
+	out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
+
+	/* Unmap the regs */
+	iounmap(xlb);
+}
+
+/*
+ * Fix setting of port_config register.
+ *
+ * Firmware is supposed to be responsible for this.  If you are creating a
+ * new board port, do *NOT* duplicate this code.  Fix your boot firmware
+ * to set it correctly in the first place
+ */
 static void __init
-lite5200_setup_cpu(void)
+lite5200_fix_port_config(void)
 {
 	struct mpc52xx_gpio __iomem *gpio;
 	u32 port_config;
 
-	/* Map zones */
 	gpio = mpc52xx_find_and_map("mpc5200-gpio");
 	if (!gpio) {
 		printk(KERN_ERR __FILE__ ": "
 			"Error while mapping GPIO register for port config. "
 			"Expect some abnormal behavior\n");
-		goto error;
+		return;
 	}
 
 	/* Set port config */
@@ -60,7 +131,6 @@ lite5200_setup_cpu(void)
 	out_be32(&gpio->port_config, port_config);
 
 	/* Unmap zone */
-error:
 	iounmap(gpio);
 }
 
@@ -99,9 +169,10 @@ static void __init lite5200_setup_arch(void)
 	if (ppc_md.progress)
 		ppc_md.progress("lite5200_setup_arch()", 0);
 
-	/* CPU & Port mux setup */
-	mpc52xx_setup_cpu();	/* Generic */
-	lite5200_setup_cpu();	/* Platorm specific */
+	/* Fix things that firmware should have done. */
+	lite5200_fix_clock_config();
+	lite5200_fix_xlb_config();
+	lite5200_fix_port_config();
 
 #ifdef CONFIG_PM
 	mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 93e7869..36e7a04 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -75,46 +75,6 @@ EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
 
 
 void __init
-mpc52xx_setup_cpu(void)
-{
-	struct mpc52xx_cdm  __iomem *cdm;
-	struct mpc52xx_xlb  __iomem *xlb;
-
-	/* Map zones */
-	cdm = mpc52xx_find_and_map("mpc5200-cdm");
-	xlb = mpc52xx_find_and_map("mpc5200-xlb");
-
-	if (!cdm || !xlb) {
-		printk(KERN_ERR __FILE__ ": "
-			"Error while mapping CDM/XLB during mpc52xx_setup_cpu. "
-			"Expect some abnormal behavior\n");
-		goto unmap_regs;
-	}
-
-	/* Use internal 48 Mhz */
-	out_8(&cdm->ext_48mhz_en, 0x00);
-	out_8(&cdm->fd_enable, 0x01);
-	if (in_be32(&cdm->rstcfg) & 0x40)	/* Assumes 33Mhz clock */
-		out_be16(&cdm->fd_counters, 0x0001);
-	else
-		out_be16(&cdm->fd_counters, 0x5555);
-
-	/* Configure the XLB Arbiter priorities */
-	out_be32(&xlb->master_pri_enable, 0xff);
-	out_be32(&xlb->master_priority, 0x11111111);
-
-	/* Disable XLB pipelining */
-	/* (cfr errate 292. We could do this only just before ATA PIO
-	    transaction and re-enable it afterwards ...) */
-	out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
-
-	/* Unmap zones */
-unmap_regs:
-	if (cdm) iounmap(cdm);
-	if (xlb) iounmap(xlb);
-}
-
-void __init
 mpc52xx_declare_of_platform_devices(void)
 {
 	/* Find every child of the SOC node and add it to of_platform */

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

* Re: [PATCH 5/6] MPC52xx: Trim includes on mpc5200 platform support code
  2007-10-08 22:25 ` [PATCH 5/6] MPC52xx: Trim includes on mpc5200 platform support code Grant Likely
@ 2007-10-09  4:43   ` Stephen Rothwell
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Rothwell @ 2007-10-09  4:43 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, paulus, arnd

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

On Mon, 08 Oct 2007 16:25:18 -0600 Grant Likely <grant.likely@secretlab.ca> wrote:
>
> -#include <asm/prom.h>
> +#include <linux/of.h>

You should keep asm/prom.h if you are using any of the flat device tree
accessors (which thses files do).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV
  2007-10-08 22:25 ` [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV Grant Likely
@ 2007-10-09 13:53   ` Kumar Gala
  2007-10-09 14:20     ` Grant Likely
  0 siblings, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2007-10-09 13:53 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, paulus, arnd


On Oct 8, 2007, at 5:25 PM, Grant Likely wrote:

> From: Grant Likely <grant.likely@secretlab.ca>
>
> There is no good reason for board platform code to mess with the  
> ROOT_DEV.
> Remove it from all in-tree platforms except powermac
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
>  arch/powerpc/platforms/52xx/efika.c          |    9 ---------
>  arch/powerpc/platforms/52xx/lite5200.c       |   12 ------------
>  arch/powerpc/platforms/8xx/mpc86xads_setup.c |    2 --
>  arch/powerpc/platforms/cell/setup.c          |    5 -----
>  arch/powerpc/platforms/celleb/setup.c        |    5 -----
>  arch/powerpc/platforms/chrp/setup.c          |   10 ----------
>  arch/powerpc/platforms/pseries/setup.c       |    5 -----
>  7 files changed, 0 insertions(+), 48 deletions(-)

I'd drop mpc86xads_setup since I think Scott's rework will deal with it.

- k

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

* Re: [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV
  2007-10-09 13:53   ` Kumar Gala
@ 2007-10-09 14:20     ` Grant Likely
  0 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2007-10-09 14:20 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, paulus, arnd

On 10/9/07, Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Oct 8, 2007, at 5:25 PM, Grant Likely wrote:
>
> > From: Grant Likely <grant.likely@secretlab.ca>
> >
> > There is no good reason for board platform code to mess with the
> > ROOT_DEV.
> > Remove it from all in-tree platforms except powermac
> >
> > Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> > ---
> >
> >  arch/powerpc/platforms/52xx/efika.c          |    9 ---------
> >  arch/powerpc/platforms/52xx/lite5200.c       |   12 ------------
> >  arch/powerpc/platforms/8xx/mpc86xads_setup.c |    2 --
> >  arch/powerpc/platforms/cell/setup.c          |    5 -----
> >  arch/powerpc/platforms/celleb/setup.c        |    5 -----
> >  arch/powerpc/platforms/chrp/setup.c          |   10 ----------
> >  arch/powerpc/platforms/pseries/setup.c       |    5 -----
> >  7 files changed, 0 insertions(+), 48 deletions(-)
>
> I'd drop mpc86xads_setup since I think Scott's rework will deal with it.

Okay, will do.  I wasn't sure since you hadn't explicitly mentioned it.

Cheers,
g.


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

end of thread, other threads:[~2007-10-09 14:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 22:24 [PATCH 1/6] Only call ppc_md.setup_arch() if it is provided Grant Likely
2007-10-08 22:24 ` [PATCH 2/6] Remove empty ppc_md.setup_arch hooks Grant Likely
2007-10-08 22:25 ` [PATCH 3/6] Platforms shouldn't mess with ROOT_DEV Grant Likely
2007-10-09 13:53   ` Kumar Gala
2007-10-09 14:20     ` Grant Likely
2007-10-08 22:25 ` [PATCH 4/6] MPC52xx: Drop show_cpuinfo platform hooks from Lite5200 Grant Likely
2007-10-08 22:25 ` [PATCH 5/6] MPC52xx: Trim includes on mpc5200 platform support code Grant Likely
2007-10-09  4:43   ` Stephen Rothwell
2007-10-08 22:25 ` [PATCH 6/6] MPC5200: Don't make firmware fixups into common code Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).