setup.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Carsten Langgaard, carstenl@mips.com
  3. * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
  4. *
  5. * This program is free software; you can distribute it and/or modify it
  6. * under the terms of the GNU General Public License (Version 2) as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  17. */
  18. #include <linux/init.h>
  19. #include <linux/ioport.h>
  20. #include <linux/pm.h>
  21. #include <linux/time.h>
  22. #include <asm/reboot.h>
  23. #include <asm/mach-ar7/ar7.h>
  24. #include <asm/mach-ar7/prom.h>
  25. #include <asm/mach-ar7/gpio.h>
  26. static void ar7_machine_restart(char *command)
  27. {
  28. u32 *softres_reg = ioremap(AR7_REGS_RESET + AR7_RESET_SOFTWARE, 1);
  29. writel(1, softres_reg);
  30. }
  31. static void ar7_machine_halt(void)
  32. {
  33. while (1)
  34. ;
  35. }
  36. static void ar7_machine_power_off(void)
  37. {
  38. u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
  39. u32 power_state = readl(power_reg) | (3 << 30);
  40. writel(power_state, power_reg);
  41. ar7_machine_halt();
  42. }
  43. const char *get_system_type(void)
  44. {
  45. u16 chip_id = ar7_chip_id();
  46. u16 titan_variant_id = titan_chip_id();
  47. switch (chip_id) {
  48. case AR7_CHIP_7100:
  49. return "TI AR7 (TNETD7100)";
  50. case AR7_CHIP_7200:
  51. return "TI AR7 (TNETD7200)";
  52. case AR7_CHIP_7300:
  53. return "TI AR7 (TNETD7300)";
  54. case AR7_CHIP_TITAN:
  55. switch (titan_variant_id) {
  56. case TITAN_CHIP_1050:
  57. return "TI AR7 (TNETV1050)";
  58. case TITAN_CHIP_1055:
  59. return "TI AR7 (TNETV1055)";
  60. case TITAN_CHIP_1056:
  61. return "TI AR7 (TNETV1056)";
  62. case TITAN_CHIP_1060:
  63. return "TI AR7 (TNETV1060)";
  64. }
  65. default:
  66. return "TI AR7 (unknown)";
  67. }
  68. }
  69. static int __init ar7_init_console(void)
  70. {
  71. return 0;
  72. }
  73. console_initcall(ar7_init_console);
  74. /*
  75. * Initializes basic routines and structures pointers, memory size (as
  76. * given by the bios and saves the command line.
  77. */
  78. void __init plat_mem_setup(void)
  79. {
  80. unsigned long io_base;
  81. _machine_restart = ar7_machine_restart;
  82. _machine_halt = ar7_machine_halt;
  83. pm_power_off = ar7_machine_power_off;
  84. io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
  85. if (!io_base)
  86. panic("Can't remap IO base!");
  87. set_io_port_base(io_base);
  88. prom_meminit();
  89. printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
  90. get_system_type(), ar7_chip_id(), ar7_chip_rev());
  91. }