Skip to content

Commit

Permalink
MIPS: Alchemy: get rid of common/reset.c
Browse files Browse the repository at this point in the history
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 <manuel.lauss@gmail.com>
Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/783/
Patchwork: http://patchwork.linux-mips.org/patch/882/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Manuel Lauss authored and ralfbaechle committed Feb 27, 2010
1 parent 325f8a0 commit 32fd690
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 225 deletions.
3 changes: 1 addition & 2 deletions arch/mips/alchemy/common/Makefile
Expand Up @@ -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
Expand Down
185 changes: 0 additions & 185 deletions arch/mips/alchemy/common/reset.c

This file was deleted.

9 changes: 0 additions & 9 deletions arch/mips/alchemy/common/setup.c
Expand Up @@ -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)
Expand All @@ -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())
Expand Down
19 changes: 0 additions & 19 deletions arch/mips/alchemy/devboards/db1200/setup.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
49 changes: 41 additions & 8 deletions arch/mips/alchemy/devboards/db1x00/board_setup.c
Expand Up @@ -30,11 +30,13 @@
#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pm.h>

#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-au1x00/au1xxx_eth.h>
#include <asm/mach-db1x00/db1x00.h>
#include <asm/mach-db1x00/bcsr.h>
#include <asm/reboot.h>

#include <prom.h>

Expand All @@ -43,6 +45,18 @@ char irq_tab_alchemy[][5] __initdata = {
[12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - HPT371 */
[13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */
};

static void bosporus_power_off(void)
{
printk(KERN_INFO "It's now safe to turn off power\n");
while (1)
asm volatile (".set mips3 ; wait ; .set mips0");
}

const char *get_system_type(void)
{
return "Alchemy Bosporus Gateway Reference";
}
#endif

/*
Expand Down Expand Up @@ -73,6 +87,16 @@ char irq_tab_alchemy[][5] __initdata = {
[12] = { -1, 0xff, 0xff, AU1500_PCI_INTC, 0xff }, /* IDSEL 12 - PNX1300 */
[13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 13 - miniPCI */
};

static void mirage_power_off(void)
{
alchemy_gpio_direction_output(210, 1);
}

const char *get_system_type(void)
{
return "Alchemy Mirage";
}
#endif

#ifdef CONFIG_MIPS_DB1550
Expand All @@ -83,19 +107,19 @@ char irq_tab_alchemy[][5] __initdata = {
};
#endif

const char *get_system_type(void)
#if defined(CONFIG_MIPS_BOSPORUS) || defined(CONFIG_MIPS_MIRAGE)
static void mips_softreset(void)
{
#ifdef CONFIG_MIPS_BOSPORUS
return "Alchemy Bosporus Gateway Reference";
#else
return "Alchemy Db1x00";
#endif
asm volatile ("jr\t%0" : : "r"(0xbfc00000));
}

void board_reset(void)
#else

const char *get_system_type(void)
{
bcsr_write(BCSR_SYSTEM, 0);
return "Alchemy Db1x00";
}
#endif

void __init board_setup(void)
{
Expand Down Expand Up @@ -196,8 +220,17 @@ void __init board_setup(void)
* be part of the audio driver.
*/
alchemy_gpio_direction_output(209, 1);

pm_power_off = mirage_power_off;
_machine_halt = mirage_power_off;
_machine_restart = (void(*)(char *))mips_softreset;
#endif

#ifdef CONFIG_MIPS_BOSPORUS
pm_power_off = bosporus_power_off;
_machine_halt = bosporus_power_off;
_machine_restart = (void(*)(char *))mips_softreset;
#endif
au_sync();
}

Expand Down
29 changes: 29 additions & 0 deletions arch/mips/alchemy/devboards/platform.c
Expand Up @@ -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,
Expand Down

0 comments on commit 32fd690

Please sign in to comment.