Skip to contentSkip to conversation

40X: Add Default Restart Machdep Method to 40X Platforms

PATCH In review Grant Erickson 3 participants 4 messages Feb 22, 2008 – Mar 1, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 40X: Add Default Restart Machdep Method to 40X Platforms

This patch restores the reset on restart functionality to 40x-based platforms that was formerly provided--but not used in arch/powerpc--by abort() in head_40x.S. This functionality is now provided by ppc40x_reset_system(char *) in a fashion similar to that of the 44x-based platforms.

Compiled, linked and tested against the AMCC Haleakala board.

---
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/kernel/head_40x.S linux-2.6.25-rc2-git1.N/arch/powerpc/kernel/head_40x.S
--- linux-2.6.25-rc2-git1/arch/powerpc/kernel/head_40x.S 2008-01-24
14:58:37.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/kernel/head_40x.S 2008-02-22
11:02:56.000000000 -0800
@@ -961,11 +961,6 @@

blr

-_GLOBAL(abort)

-        mfspr   r13,SPRN_DBCR0
-        oris    r13,r13,DBCR0_RST_SYSTEM@h
-        mtspr   SPRN_DBCR0,r13

-
_GLOBAL(set_context)

#ifdef CONFIG_BDI_SWITCH
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/40x.h linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/40x.h
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/40x.h 1969-12-31
16:00:00.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/40x.h 2008-02-22
11:02:56.000000000 -0800
@@ -0,0 +1,6 @@
+#ifndef __POWERPC_PLATFORMS_40X_40X_H
+#define __POWERPC_PLATFORMS_40X_40X_H
+
+extern void ppc40x_reset_system(char *cmd);
+
+#endif /* __POWERPC_PLATFORMS_40X_40X_H */
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/ep405.c linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/ep405.c
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/ep405.c 2008-02-22
11:07:53.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/ep405.c 2008-02-22
11:02:56.000000000 -0800
@@ -30,6 +30,8 @@
#include <asm/uic.h>
#include <asm/pci-bridge.h>

+#include "40x.h"
+
static struct device_node *bcsr_node;
static void __iomem *bcsr_regs;

@@ -119,5 +121,6 @@
.progress = udbg_progress,
.init_IRQ = uic_init_tree,
.get_irq = uic_get_irq,

-    .calibrate_decr        = generic_calibrate_decr,
+    .restart        = ppc40x_reset_system,
+    .calibrate_decr    = generic_calibrate_decr,

};
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/kilauea.c linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/kilauea.c
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/kilauea.c 2008-02-22
11:07:53.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/kilauea.c

2008-02-22 11:02:56.000000000 -0800

@@ -21,6 +21,8 @@
#include <asm/uic.h>
#include <asm/pci-bridge.h>

+#include "40x.h"
+

 static __initdata struct of_device_id kilauea_of_bus[] = {
     { .compatible = "ibm,plb4", },
     { .compatible = "ibm,opb", },

@@ -54,5 +56,6 @@
.progress = udbg_progress,
.init_IRQ = uic_init_tree,
.get_irq = uic_get_irq,

-    .calibrate_decr            = generic_calibrate_decr,
+    .restart            = ppc40x_reset_system,
+    .calibrate_decr        = generic_calibrate_decr,

};
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/makalu.c linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/makalu.c
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/makalu.c 2008-02-22
11:07:53.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/makalu.c

2008-02-22 11:02:56.000000000 -0800

@@ -21,6 +21,8 @@
#include <asm/uic.h>
#include <asm/pci-bridge.h>

+#include "40x.h"
+

 static __initdata struct of_device_id makalu_of_bus[] = {
     { .compatible = "ibm,plb4", },
     { .compatible = "ibm,opb", },

@@ -54,5 +56,6 @@
.progress = udbg_progress,
.init_IRQ = uic_init_tree,
.get_irq = uic_get_irq,

-    .calibrate_decr            = generic_calibrate_decr,
+    .restart            = ppc40x_reset_system,
+    .calibrate_decr        = generic_calibrate_decr,

};
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/Makefile linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/Makefile
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/Makefile 2008-02-22
11:07:53.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/Makefile

2008-02-22 11:02:56.000000000 -0800

@@ -1,3 +1,4 @@
+obj-$(CONFIG_40x) += misc_40x.o
obj-$(CONFIG_KILAUEA) += kilauea.o
obj-$(CONFIG_MAKALU) += makalu.o
obj-$(CONFIG_WALNUT) += walnut.o
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/misc_40x.S linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/misc_40x.S --- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/misc_40x.S

1969-12-31 16:00:00.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/misc_40x.S
2008-02-22 15:19:14.000000000 -0800

@@ -0,0 +1,30 @@
+/*
+ * This file contains miscellaneous low-level functions for PPC 40x.
+ *
+ * Copyright (c) 1999 Grant Erickson <[email protected]>
+ * Copyright 2007 David Gibson <[email protected]>, IBM Corporation.
+ *
+ * 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.
+ *
+ */
+
+#include <asm/reg.h>
+#include <asm/ppc_asm.h>
+
+ .text
+
+/*
+ * void ppc40x_reset_system(char *cmd)
+ *
+ * At present, this just applies a system reset which, historically, when
+ * this routine existed as '_abort' in head_40x.S was sufficient for most
+ * systems.
+ */
+_GLOBAL(ppc40x_reset_system)

+        mfspr   r13,SPRN_DBCR0
+        oris    r13,r13,DBCR0_RST_SYSTEM@h
+        mtspr   SPRN_DBCR0,r13

+ b . /* Just in case reset fails. */
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/virtex.c linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/virtex.c
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/virtex.c 2008-02-22
11:07:53.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/virtex.c

2008-02-22 11:02:56.000000000 -0800

@@ -15,6 +15,8 @@
#include <asm/time.h>
#include <asm/xilinx_intc.h>

+#include "40x.h"
+

 static struct of_device_id xilinx_of_bus_ids[] __initdata = {
     { .compatible = "xlnx,plb-v46-1.00.a", },
     { .compatible = "xlnx,plb-v34-1.01.a", },

@@ -48,5 +50,6 @@
.probe = virtex_probe,
.init_IRQ = xilinx_intc_init_tree,
.get_irq = xilinx_intc_get_irq,

-    .calibrate_decr        = generic_calibrate_decr,
+    .restart        = ppc40x_reset_system,
+    .calibrate_decr    = generic_calibrate_decr,

};
diff -rauN linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/walnut.c linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/walnut.c
--- linux-2.6.25-rc2-git1/arch/powerpc/platforms/40x/walnut.c 2008-02-22
11:07:53.000000000 -0800
+++ linux-2.6.25-rc2-git1.N/arch/powerpc/platforms/40x/walnut.c

2008-02-22 11:02:56.000000000 -0800

@@ -27,6 +27,8 @@
#include <asm/uic.h>
#include <asm/pci-bridge.h>

+#include "40x.h"
+

 static __initdata struct of_device_id walnut_of_bus[] = {
     { .compatible = "ibm,plb3", },
     { .compatible = "ibm,opb", },

@@ -61,5 +63,6 @@
.progress = udbg_progress,
.init_IRQ = uic_init_tree,
.get_irq = uic_get_irq,
+ .restart = ppc40x_reset_system,
.calibrate_decr = generic_calibrate_decr,
};

#1 lore raw
Quoted 9 lines · On Fri, 22 Feb 2008 15:28:44 -0800 Grant Erickson <[email protected]> wrote:

This patch restores the reset on restart functionality to 40x-based platforms that was formerly provided--but not used in arch/powerpc--by abort() in head_40x.S. This functionality is now provided by ppc40x_reset_system(char *) in a fashion similar to that of the 44x-based platforms.

Compiled, linked and tested against the AMCC Haleakala board.

This patch is word wrapped. Seems your mailer decided to eat tabs as well.

josh

#2 lore raw
In reply to Grant Erickson
Quoted 7 lines · Grant Erickson

This patch restores the reset on restart functionality to 40x-based platforms that was formerly provided--but not used in arch/powerpc--by abort() in head_40x.S. This functionality is now provided by ppc40x_reset_system(char *) in a fashion similar to that of the 44x-based platforms.

Compiled, linked and tested against the AMCC Haleakala board.

Instead of duplicating this code in platform/40x/ which is already present in platforms/44x/misc_44x.S, why not move this misc_44x.S code into a common place for all 4xx (40x and 44x) PPC's? There seems to be nothing 44x specific.

I suggest to introduce platforms/4xx/misc.S or sysdev/ppc4xx_misc.S with these functions and change the code referencing it accordingly.

Comments/thoughts?

Best regards,
Stefan

#3 lore raw
Quoted 14 lines · On Sat, 1 Mar 2008 12:32:54 +0100 Stefan Roese <[email protected]> wrote:
Quoted 7 lines · Grant Erickson

This patch restores the reset on restart functionality to 40x-based platforms that was formerly provided--but not used in arch/powerpc--by abort() in head_40x.S. This functionality is now provided by ppc40x_reset_system(char *) in a fashion similar to that of the 44x-based platforms.

Compiled, linked and tested against the AMCC Haleakala board.

Instead of duplicating this code in platform/40x/ which is already present in platforms/44x/misc_44x.S, why not move this misc_44x.S code into a common place for all 4xx (40x and 44x) PPC's? There seems to be nothing 44x specific.

Quoted 4 lines

I suggest to introduce platforms/4xx/misc.S or sysdev/ppc4xx_misc.S with these functions and change the code referencing it accordingly.

Comments/thoughts?

It's a good idea. I'd rather avoid platforms/4xx for now, but sysdev/ppc4xx_misc.S seems reasonable.

I'll move it in my tree soon and do the necessary makefile fixups.

josh