diff options
author | Dmitri Vorobiev <dmitri.vorobiev@gmail.com> | 2008-01-07 22:44:00 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-11 12:05:41 -0500 |
commit | 84c21e254205ecac98f75b01589996440c6a6db0 (patch) | |
tree | 77d0c87cd919fded83e70caae461afbbae7a6eae /arch/mips | |
parent | 1b1c5f0d96eb05cf6cd4702dabf4e003eded08c2 (diff) |
[MIPS] Malta: Fix software reset on big endian
I noticed that the commit f197465384bf7ef1af184c2ed1a4e268911a91e3
(MIPS Tech: Get rid of volatile in core code) broke the software
reset functionality for MIPS Malta boards in big-endian mode.
According to the MIPS Malta board user's manual, writing the magic
32-bit GORESET value into the SOFTRES register initiates board soft
reset. My experimentation has shown that the endianness of the GORESET
integer should thereby be the same as the endianness, which has been
set for the CPU itself. The writew() function used to write the magic
value in the code introduced by the commit mentioned above, however,
swaps bytes for big-endian kernels and transfers 16 bits instead of 32.
The patch below replaces the writew() function by the __raw_writel()
routine, which leaves the byte order intact and transfers the whole
MIPS machine word. Trivial code cleanup (replacing spaces by a tab
and cutting oversized lines to make checkpatch.pl happy) is also
included.
The patch was tested using a Malta evaluation board running in both
BE and LE modes. For both modes, software reset was fully functional
after the change.
P.S. I suspect that the same commit broke the "standby" functionality
for MIPS Atlas boards. However, I did not touch the Atlas code as I
don't have such board at my disposal and also because the linux-mips.org
Web site claims that Atlas support is scheduled for removal.
Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/mips-boards/generic/reset.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c index 7a1bb51f81ee..583d468d98a9 100644 --- a/arch/mips/mips-boards/generic/reset.c +++ b/arch/mips/mips-boards/generic/reset.c | |||
@@ -39,16 +39,18 @@ static void atlas_machine_power_off(void); | |||
39 | 39 | ||
40 | static void mips_machine_restart(char *command) | 40 | static void mips_machine_restart(char *command) |
41 | { | 41 | { |
42 | unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); | 42 | unsigned int __iomem *softres_reg = |
43 | ioremap(SOFTRES_REG, sizeof(unsigned int)); | ||
43 | 44 | ||
44 | writew(GORESET, softres_reg); | 45 | __raw_writel(GORESET, softres_reg); |
45 | } | 46 | } |
46 | 47 | ||
47 | static void mips_machine_halt(void) | 48 | static void mips_machine_halt(void) |
48 | { | 49 | { |
49 | unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); | 50 | unsigned int __iomem *softres_reg = |
51 | ioremap(SOFTRES_REG, sizeof(unsigned int)); | ||
50 | 52 | ||
51 | writew(GORESET, softres_reg); | 53 | __raw_writel(GORESET, softres_reg); |
52 | } | 54 | } |
53 | 55 | ||
54 | #if defined(CONFIG_MIPS_ATLAS) | 56 | #if defined(CONFIG_MIPS_ATLAS) |