reset.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * BRIEF MODULE DESCRIPTION
  3. * Galileo EV96100 reset routines.
  4. *
  5. * Copyright 2000 MontaVista Software Inc.
  6. * Author: MontaVista Software, Inc.
  7. * ppopov@mvista.com or source@mvista.com
  8. *
  9. * This file was derived from Carsten Langgaard's
  10. * arch/mips/mips-boards/generic/reset.c
  11. *
  12. * Carsten Langgaard, carstenl@mips.com
  13. * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
  14. *
  15. * This program is free software; you can redistribute it and/or modify it
  16. * under the terms of the GNU General Public License as published by the
  17. * Free Software Foundation; either version 2 of the License, or (at your
  18. * option) any later version.
  19. *
  20. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  21. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  22. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  23. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  26. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  27. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. *
  31. * You should have received a copy of the GNU General Public License along
  32. * with this program; if not, write to the Free Software Foundation, Inc.,
  33. * 675 Mass Ave, Cambridge, MA 02139, USA.
  34. */
  35. #include <linux/sched.h>
  36. #include <linux/mm.h>
  37. #include <asm/io.h>
  38. #include <asm/pgtable.h>
  39. #include <asm/processor.h>
  40. #include <asm/reboot.h>
  41. #include <asm/system.h>
  42. #include <asm/gt64120.h>
  43. static void mips_machine_restart(char *command);
  44. static void mips_machine_halt(void);
  45. static void mips_machine_restart(char *command)
  46. {
  47. set_c0_status(ST0_BEV | ST0_ERL);
  48. change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
  49. flush_cache_all();
  50. write_c0_wired(0);
  51. __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
  52. while (1);
  53. }
  54. static void mips_machine_halt(void)
  55. {
  56. printk(KERN_NOTICE "You can safely turn off the power\n");
  57. while (1)
  58. __asm__(".set\tmips3\n\t"
  59. "wait\n\t"
  60. ".set\tmips0");
  61. }
  62. void mips_reboot_setup(void)
  63. {
  64. _machine_restart = mips_machine_restart;
  65. _machine_halt = mips_machine_halt;
  66. }