diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2009-12-08 13:18:13 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:53:04 -0500 |
commit | 32fd6901a6d8d19f94e4de6be4e4b552ab078620 (patch) | |
tree | b0bce261bcdbf6cd4b4026711ee5cbc6e10d9892 /arch/mips/alchemy/devboards | |
parent | 325f8a0a31df567dbafafc48f8e60f3c1f101a46 (diff) |
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.
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>
Diffstat (limited to 'arch/mips/alchemy/devboards')
-rw-r--r-- | arch/mips/alchemy/devboards/db1200/setup.c | 19 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1x00/board_setup.c | 49 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/platform.c | 29 |
3 files changed, 70 insertions, 27 deletions
diff --git a/arch/mips/alchemy/devboards/db1200/setup.c b/arch/mips/alchemy/devboards/db1200/setup.c index a3458c0e4051..379536e3abd1 100644 --- a/arch/mips/alchemy/devboards/db1200/setup.c +++ b/arch/mips/alchemy/devboards/db1200/setup.c | |||
@@ -9,30 +9,15 @@ | |||
9 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
10 | #include <linux/io.h> | 10 | #include <linux/io.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/pm.h> | ||
13 | #include <asm/mach-au1x00/au1000.h> | 12 | #include <asm/mach-au1x00/au1000.h> |
14 | #include <asm/mach-db1x00/bcsr.h> | 13 | #include <asm/mach-db1x00/bcsr.h> |
15 | #include <asm/mach-db1x00/db1200.h> | 14 | #include <asm/mach-db1x00/db1200.h> |
16 | #include <asm/processor.h> | ||
17 | #include <asm/reboot.h> | ||
18 | 15 | ||
19 | const char *get_system_type(void) | 16 | const char *get_system_type(void) |
20 | { | 17 | { |
21 | return "Alchemy Db1200"; | 18 | return "Alchemy Db1200"; |
22 | } | 19 | } |
23 | 20 | ||
24 | static void board_power_off(void) | ||
25 | { | ||
26 | bcsr_write(BCSR_RESETS, 0); | ||
27 | bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET); | ||
28 | } | ||
29 | |||
30 | void board_reset(void) | ||
31 | { | ||
32 | bcsr_write(BCSR_RESETS, 0); | ||
33 | bcsr_write(BCSR_SYSTEM, 0); | ||
34 | } | ||
35 | |||
36 | void __init board_setup(void) | 21 | void __init board_setup(void) |
37 | { | 22 | { |
38 | unsigned long freq0, clksrc, div, pfc; | 23 | unsigned long freq0, clksrc, div, pfc; |
@@ -73,10 +58,6 @@ void __init board_setup(void) | |||
73 | clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; | 58 | clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; |
74 | __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); | 59 | __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); |
75 | wmb(); | 60 | wmb(); |
76 | |||
77 | pm_power_off = board_power_off; | ||
78 | _machine_halt = board_power_off; | ||
79 | _machine_restart = (void(*)(char *))board_reset; | ||
80 | } | 61 | } |
81 | 62 | ||
82 | /* use the hexleds to count the number of times the cpu has entered | 63 | /* use the hexleds to count the number of times the cpu has entered |
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c index b490efff4dca..56c541d0c55a 100644 --- a/arch/mips/alchemy/devboards/db1x00/board_setup.c +++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c | |||
@@ -30,11 +30,13 @@ | |||
30 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
33 | #include <linux/pm.h> | ||
33 | 34 | ||
34 | #include <asm/mach-au1x00/au1000.h> | 35 | #include <asm/mach-au1x00/au1000.h> |
35 | #include <asm/mach-au1x00/au1xxx_eth.h> | 36 | #include <asm/mach-au1x00/au1xxx_eth.h> |
36 | #include <asm/mach-db1x00/db1x00.h> | 37 | #include <asm/mach-db1x00/db1x00.h> |
37 | #include <asm/mach-db1x00/bcsr.h> | 38 | #include <asm/mach-db1x00/bcsr.h> |
39 | #include <asm/reboot.h> | ||
38 | 40 | ||
39 | #include <prom.h> | 41 | #include <prom.h> |
40 | 42 | ||
@@ -43,6 +45,18 @@ char irq_tab_alchemy[][5] __initdata = { | |||
43 | [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - HPT371 */ | 45 | [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - HPT371 */ |
44 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */ | 46 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */ |
45 | }; | 47 | }; |
48 | |||
49 | static void bosporus_power_off(void) | ||
50 | { | ||
51 | printk(KERN_INFO "It's now safe to turn off power\n"); | ||
52 | while (1) | ||
53 | asm volatile (".set mips3 ; wait ; .set mips0"); | ||
54 | } | ||
55 | |||
56 | const char *get_system_type(void) | ||
57 | { | ||
58 | return "Alchemy Bosporus Gateway Reference"; | ||
59 | } | ||
46 | #endif | 60 | #endif |
47 | 61 | ||
48 | /* | 62 | /* |
@@ -73,6 +87,16 @@ char irq_tab_alchemy[][5] __initdata = { | |||
73 | [12] = { -1, 0xff, 0xff, AU1500_PCI_INTC, 0xff }, /* IDSEL 12 - PNX1300 */ | 87 | [12] = { -1, 0xff, 0xff, AU1500_PCI_INTC, 0xff }, /* IDSEL 12 - PNX1300 */ |
74 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 13 - miniPCI */ | 88 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 13 - miniPCI */ |
75 | }; | 89 | }; |
90 | |||
91 | static void mirage_power_off(void) | ||
92 | { | ||
93 | alchemy_gpio_direction_output(210, 1); | ||
94 | } | ||
95 | |||
96 | const char *get_system_type(void) | ||
97 | { | ||
98 | return "Alchemy Mirage"; | ||
99 | } | ||
76 | #endif | 100 | #endif |
77 | 101 | ||
78 | #ifdef CONFIG_MIPS_DB1550 | 102 | #ifdef CONFIG_MIPS_DB1550 |
@@ -83,19 +107,19 @@ char irq_tab_alchemy[][5] __initdata = { | |||
83 | }; | 107 | }; |
84 | #endif | 108 | #endif |
85 | 109 | ||
86 | const char *get_system_type(void) | 110 | #if defined(CONFIG_MIPS_BOSPORUS) || defined(CONFIG_MIPS_MIRAGE) |
111 | static void mips_softreset(void) | ||
87 | { | 112 | { |
88 | #ifdef CONFIG_MIPS_BOSPORUS | 113 | asm volatile ("jr\t%0" : : "r"(0xbfc00000)); |
89 | return "Alchemy Bosporus Gateway Reference"; | ||
90 | #else | ||
91 | return "Alchemy Db1x00"; | ||
92 | #endif | ||
93 | } | 114 | } |
94 | 115 | ||
95 | void board_reset(void) | 116 | #else |
117 | |||
118 | const char *get_system_type(void) | ||
96 | { | 119 | { |
97 | bcsr_write(BCSR_SYSTEM, 0); | 120 | return "Alchemy Db1x00"; |
98 | } | 121 | } |
122 | #endif | ||
99 | 123 | ||
100 | void __init board_setup(void) | 124 | void __init board_setup(void) |
101 | { | 125 | { |
@@ -196,8 +220,17 @@ void __init board_setup(void) | |||
196 | * be part of the audio driver. | 220 | * be part of the audio driver. |
197 | */ | 221 | */ |
198 | alchemy_gpio_direction_output(209, 1); | 222 | alchemy_gpio_direction_output(209, 1); |
223 | |||
224 | pm_power_off = mirage_power_off; | ||
225 | _machine_halt = mirage_power_off; | ||
226 | _machine_restart = (void(*)(char *))mips_softreset; | ||
199 | #endif | 227 | #endif |
200 | 228 | ||
229 | #ifdef CONFIG_MIPS_BOSPORUS | ||
230 | pm_power_off = bosporus_power_off; | ||
231 | _machine_halt = bosporus_power_off; | ||
232 | _machine_restart = (void(*)(char *))mips_softreset; | ||
233 | #endif | ||
201 | au_sync(); | 234 | au_sync(); |
202 | } | 235 | } |
203 | 236 | ||
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index 7f2bcee7ac34..febf4e042343 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c | |||
@@ -8,6 +8,35 @@ | |||
8 | #include <linux/mtd/physmap.h> | 8 | #include <linux/mtd/physmap.h> |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | #include <linux/pm.h> | ||
12 | |||
13 | #include <asm/reboot.h> | ||
14 | #include <asm/mach-db1x00/bcsr.h> | ||
15 | |||
16 | static void db1x_power_off(void) | ||
17 | { | ||
18 | bcsr_write(BCSR_RESETS, 0); | ||
19 | bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET); | ||
20 | } | ||
21 | |||
22 | static void db1x_reset(char *c) | ||
23 | { | ||
24 | bcsr_write(BCSR_RESETS, 0); | ||
25 | bcsr_write(BCSR_SYSTEM, 0); | ||
26 | } | ||
27 | |||
28 | static int __init db1x_poweroff_setup(void) | ||
29 | { | ||
30 | if (!pm_power_off) | ||
31 | pm_power_off = db1x_power_off; | ||
32 | if (!_machine_halt) | ||
33 | _machine_halt = db1x_power_off; | ||
34 | if (!_machine_restart) | ||
35 | _machine_restart = db1x_reset; | ||
36 | |||
37 | return 0; | ||
38 | } | ||
39 | late_initcall(db1x_poweroff_setup); | ||
11 | 40 | ||
12 | /* register a pcmcia socket */ | 41 | /* register a pcmcia socket */ |
13 | int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start, | 42 | int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start, |