setup.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
  3. * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. * Setup code for the SWARM board
  21. */
  22. #include <linux/config.h>
  23. #include <linux/spinlock.h>
  24. #include <linux/mm.h>
  25. #include <linux/bootmem.h>
  26. #include <linux/blkdev.h>
  27. #include <linux/init.h>
  28. #include <linux/kernel.h>
  29. #include <linux/tty.h>
  30. #include <linux/initrd.h>
  31. #include <asm/irq.h>
  32. #include <asm/io.h>
  33. #include <asm/bootinfo.h>
  34. #include <asm/mipsregs.h>
  35. #include <asm/reboot.h>
  36. #include <asm/time.h>
  37. #include <asm/traps.h>
  38. #include <asm/sibyte/sb1250.h>
  39. #include <asm/sibyte/sb1250_regs.h>
  40. #include <asm/sibyte/sb1250_genbus.h>
  41. #include <asm/sibyte/board.h>
  42. extern void sb1250_setup(void);
  43. extern int xicor_probe(void);
  44. extern int xicor_set_time(unsigned long);
  45. extern unsigned long xicor_get_time(void);
  46. extern int m41t81_probe(void);
  47. extern int m41t81_set_time(unsigned long);
  48. extern unsigned long m41t81_get_time(void);
  49. const char *get_system_type(void)
  50. {
  51. return "SiByte " SIBYTE_BOARD_NAME;
  52. }
  53. void __init swarm_timer_setup(struct irqaction *irq)
  54. {
  55. /*
  56. * we don't set up irqaction, because we will deliver timer
  57. * interrupts through low-level (direct) meachanism.
  58. */
  59. /* We only need to setup the generic timer */
  60. sb1250_time_init();
  61. }
  62. int swarm_be_handler(struct pt_regs *regs, int is_fixup)
  63. {
  64. if (!is_fixup && (regs->cp0_cause & 4)) {
  65. /* Data bus error - print PA */
  66. #ifdef CONFIG_64BIT
  67. printk("DBE physical address: %010lx\n",
  68. __read_64bit_c0_register($26, 1));
  69. #else
  70. printk("DBE physical address: %010llx\n",
  71. __read_64bit_c0_split($26, 1));
  72. #endif
  73. }
  74. return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
  75. }
  76. static int __init swarm_setup(void)
  77. {
  78. sb1250_setup();
  79. panic_timeout = 5; /* For debug. */
  80. board_timer_setup = swarm_timer_setup;
  81. board_be_handler = swarm_be_handler;
  82. if (xicor_probe()) {
  83. printk("swarm setup: Xicor 1241 RTC detected.\n");
  84. rtc_get_time = xicor_get_time;
  85. rtc_set_time = xicor_set_time;
  86. }
  87. if (m41t81_probe()) {
  88. printk("swarm setup: M41T81 RTC detected.\n");
  89. rtc_get_time = m41t81_get_time;
  90. rtc_set_time = m41t81_set_time;
  91. }
  92. printk("This kernel optimized for "
  93. #ifdef CONFIG_SIMULATION
  94. "simulation"
  95. #else
  96. "board"
  97. #endif
  98. " runs "
  99. #ifdef CONFIG_SIBYTE_CFE
  100. "with"
  101. #else
  102. "without"
  103. #endif
  104. " CFE\n");
  105. #ifdef CONFIG_VT
  106. screen_info = (struct screen_info) {
  107. 0, 0, /* orig-x, orig-y */
  108. 0, /* unused */
  109. 52, /* orig_video_page */
  110. 3, /* orig_video_mode */
  111. 80, /* orig_video_cols */
  112. 4626, 3, 9, /* unused, ega_bx, unused */
  113. 25, /* orig_video_lines */
  114. 0x22, /* orig_video_isVGA */
  115. 16 /* orig_video_points */
  116. };
  117. /* XXXKW for CFE, get lines/cols from environment */
  118. #endif
  119. return 0;
  120. }
  121. early_initcall(swarm_setup);
  122. #ifdef LEDS_PHYS
  123. #ifdef CONFIG_SIBYTE_CARMEL
  124. /* XXXKW need to detect Monterey/LittleSur/etc */
  125. #undef LEDS_PHYS
  126. #define LEDS_PHYS MLEDS_PHYS
  127. #endif
  128. #define setled(index, c) \
  129. ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
  130. void setleds(char *str)
  131. {
  132. int i;
  133. for (i = 0; i < 4; i++) {
  134. if (!str[i]) {
  135. setled(i, ' ');
  136. } else {
  137. setled(i, str[i]);
  138. }
  139. }
  140. }
  141. #endif