MIPS: Alchemy: get rid of common/reset.c
PATCH 1/1 MIPS: Alchemy: get rid of common/reset.c
Implement reset/poweroff in the board code instead. The peripheral reset code is gone too since YAMON (which all in-tree boards use) does the same work when it boots.
---
Run-tested on DB1200, compiled tested on all other boards. Applies on top of all the other Alchemy stuff in mips-queue.
arch/mips/alchemy/common/Makefile | 3 +- arch/mips/alchemy/common/reset.c | 185 ---------------------- arch/mips/alchemy/common/setup.c | 9 - arch/mips/alchemy/devboards/db1200/setup.c | 19 --- arch/mips/alchemy/devboards/db1x00/board_setup.c | 49 +++++- arch/mips/alchemy/devboards/platform.c | 29 ++++ arch/mips/alchemy/mtx-1/board_setup.c | 15 ++- arch/mips/alchemy/xxs1500/board_setup.c | 15 ++- 8 files changed, 99 insertions(+), 225 deletions(-) delete mode 100644 arch/mips/alchemy/common/reset.c
arch/mips/alchemy/common/Makefile +1 -2
@@ -5,8 +5,7 @@ # Makefile for the Alchemy Au1xx0 CPUs, generic files. # -obj-y += prom.o time.o reset.o \ - clocks.o platform.o power.o setup.o \ +obj-y += prom.o time.o clocks.o platform.o power.o setup.o \ sleeper.o dma.o dbdma.o obj-$(CONFIG_ALCHEMY_GPIOINT_AU1000) += irq.o
arch/mips/alchemy/common/reset.c deleted +0 -185
185 lines not on this page · raw message
arch/mips/alchemy/common/setup.c +0 -9
@@ -29,18 +29,13 @@#include <linux/ioport.h> #include <linux/jiffies.h> #include <linux/module.h> -#include <linux/pm.h> #include <asm/mipsregs.h> -#include <asm/reboot.h> #include <asm/time.h> #include <au1000.h> extern void __init board_setup (void ); -extern void au1000_restart (char *); -extern void au1000_halt (void ); -extern void au1000_power_off (void );extern void set_cpuspec (void );void __init plat_mem_setup (void )
@@ -57,10 +52,6 @@ void __init plat_mem_setup(void)/* this is faster than wasting cycles trying to approximate it */ preset_lpj = (est_freq >>1 ) /HZ ; - _machine_restart = au1000_restart; - _machine_halt = au1000_halt; - pm_power_off = au1000_power_off; -board_setup ();/* board specific setup */ if (au1xxx_cpu_needs_config_od ())
arch/mips/alchemy/devboards/db1200/setup.c +0 -19
@@ -9,30 +9,15 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/kernel.h> -#include <linux/pm.h> #include <asm/mach-au1x00/au1000.h> #include <asm/mach-db1x00/bcsr.h> #include <asm/mach-db1x00/db1200.h> -#include <asm/processor.h> -#include <asm/reboot.h> const char *get_system_type (void ) {return "Alchemy Db1200" ; } -static void board_power_off (void ) -{ -bcsr_write (BCSR_RESETS ,0 ); -bcsr_write (BCSR_SYSTEM ,BCSR_SYSTEM_PWROFF |BCSR_SYSTEM_RESET ); -} - -void board_reset (void ) -{ -bcsr_write (BCSR_RESETS ,0 ); -bcsr_write (BCSR_SYSTEM ,0 ); -} -void __init board_setup (void ) {unsigned long freq0, clksrc, div, pfc;
@@ -73,10 +58,6 @@ void __init board_setup(void) clksrc =SYS_CS_MUX_FQ0 <<SYS_CS_ME0_BIT ;__raw_writel (clksrc, (void __iomem *)SYS_CLKSRC );wmb (); - - pm_power_off = board_power_off; - _machine_halt = board_power_off; - _machine_restart = (void (*)(char *))board_reset; }/* use the hexleds to count the number of times the cpu has entered
arch/mips/alchemy/devboards/db1x00/board_setup.c +41 -8
90 lines not on this page · raw message
arch/mips/alchemy/devboards/platform.c +29 -0
@@ -8,6 +8,35 @@#include <linux/mtd/physmap.h> #include <linux/slab.h> #include <linux/platform_device.h> +#include <linux/pm.h> + +#include <asm/reboot.h> +#include <asm/mach-db1x00/bcsr.h> + +static void db1x_power_off (void ) +{ +bcsr_write (BCSR_RESETS ,0 ); +bcsr_write (BCSR_SYSTEM ,BCSR_SYSTEM_PWROFF |BCSR_SYSTEM_RESET ); +} + +static void db1x_reset (char *c) +{ +bcsr_write (BCSR_RESETS ,0 ); +bcsr_write (BCSR_SYSTEM ,0 ); +} + +static int __init db1x_poweroff_setup (void ) +{ +if (!pm_power_off) + pm_power_off = db1x_power_off; +if (!_machine_halt) + _machine_halt = db1x_power_off; +if (!_machine_restart) + _machine_restart = db1x_reset; + +return 0 ; +} +late_initcall (db1x_poweroff_setup);/* register a pcmcia socket */ int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start,
arch/mips/alchemy/mtx-1/board_setup.c +14 -1
@@ -31,7 +31,9 @@#include <linux/gpio.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/pm.h> +#include <asm/reboot.h> #include <asm/mach-au1x00/au1000.h> #include <prom.h>
@@ -50,12 +52,19 @@ char irq_tab_alchemy[][5] __initdata = {extern int (*board_pci_idsel)(unsigned int devsel,int assert);int mtx1_pci_idsel (unsigned int devsel,int assert); -void board_reset (void ) +static void mtx1_reset (char *c) {/* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ au_writel (0x00000000 ,0xAE00001C ); } +static void mtx1_power_off (void ) +{ +printk (KERN_ALERT "It's now safe to remove power\n" ); +while (1 ) + asmvolatile (".set mips3 ; wait ; .set mips1" ); +} +void __init board_setup (void ) {#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -98,6 +107,10 @@ void __init board_setup(void)alchemy_gpio_direction_output (211 ,1 );/* green on */ alchemy_gpio_direction_output (212 ,0 );/* red off */ + pm_power_off = mtx1_power_off; + _machine_halt = mtx1_power_off; + _machine_restart = mtx1_reset; +printk (KERN_INFO "4G Systems MTX-1 Board\n" ); }
arch/mips/alchemy/xxs1500/board_setup.c +14 -1
@@ -27,17 +27,26 @@#include <linux/init.h> #include <linux/interrupt.h> #include <linux/delay.h> +#include <linux/pm.h> +#include <asm/reboot.h> #include <asm/mach-au1x00/au1000.h> #include <prom.h> -void board_reset (void ) +static void xxs1500_reset (char *c) {/* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ au_writel (0x00000000 ,0xAE00001C ); } +static void xxs1500_power_off (void ) +{ +printk (KERN_ALERT "It's now safe to remove power\n" ); +while (1 ) + asmvolatile (".set mips3 ; wait ; .set mips1" ); +} +void __init board_setup (void ) {u32 pin_func;
@@ -52,6 +61,10 @@ void __init board_setup(void) }#endif + pm_power_off = xxs1500_power_off; + _machine_halt = xxs1500_power_off; + _machine_restart = xxs1500_reset; +alchemy_gpio1_input_enable ();alchemy_gpio2_enable ();
Signature · 1 line
1.6.5.3
Quoted 8 lines · Manuel Lauss
Implement reset/poweroff in the board code instead. The peripheral reset code is gone too since YAMON (which all in-tree boards use) does the same work when it boots.
Signed-off-by Manuel Lauss <[email protected]>---
Run-tested on DB1200, compiled tested on all other boards. Applies on top of all the other Alchemy stuff in mips-queue.
Yet I got a reject for the first hunk of arch/mips/alchemy/devboards/db1x00/board_setup.c. I was looking trivial so I fixed it up and queued the patch for 2.6.34.
Thanks!
Ralf