setup.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * Copyright (C) 2000, 2001, 2002, 2003, 2004 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. #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
  40. #include <asm/sibyte/bcm1480_regs.h>
  41. #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
  42. #include <asm/sibyte/sb1250_regs.h>
  43. #else
  44. #error invalid SiByte board configuation
  45. #endif
  46. #include <asm/sibyte/sb1250_genbus.h>
  47. #include <asm/sibyte/board.h>
  48. #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
  49. extern void bcm1480_setup(void);
  50. #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
  51. extern void sb1250_setup(void);
  52. #else
  53. #error invalid SiByte board configuation
  54. #endif
  55. extern int xicor_probe(void);
  56. extern int xicor_set_time(unsigned long);
  57. extern unsigned long xicor_get_time(void);
  58. extern int m41t81_probe(void);
  59. extern int m41t81_set_time(unsigned long);
  60. extern unsigned long m41t81_get_time(void);
  61. const char *get_system_type(void)
  62. {
  63. return "SiByte " SIBYTE_BOARD_NAME;
  64. }
  65. void __init swarm_timer_setup(struct irqaction *irq)
  66. {
  67. /*
  68. * we don't set up irqaction, because we will deliver timer
  69. * interrupts through low-level (direct) meachanism.
  70. */
  71. /* We only need to setup the generic timer */
  72. #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
  73. bcm1480_time_init();
  74. #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
  75. sb1250_time_init();
  76. #else
  77. #error invalid SiByte board configuation
  78. #endif
  79. }
  80. int swarm_be_handler(struct pt_regs *regs, int is_fixup)
  81. {
  82. if (!is_fixup && (regs->cp0_cause & 4)) {
  83. /* Data bus error - print PA */
  84. printk("DBE physical address: %010Lx\n",
  85. __read_64bit_c0_register($26, 1));
  86. }
  87. return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
  88. }
  89. void __init plat_setup(void)
  90. {
  91. #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
  92. bcm1480_setup();
  93. #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
  94. sb1250_setup();
  95. #else
  96. #error invalid SiByte board configuation
  97. #endif
  98. panic_timeout = 5; /* For debug. */
  99. board_timer_setup = swarm_timer_setup;
  100. board_be_handler = swarm_be_handler;
  101. if (xicor_probe()) {
  102. printk("swarm setup: Xicor 1241 RTC detected.\n");
  103. rtc_get_time = xicor_get_time;
  104. rtc_set_time = xicor_set_time;
  105. }
  106. if (m41t81_probe()) {
  107. printk("swarm setup: M41T81 RTC detected.\n");
  108. rtc_get_time = m41t81_get_time;
  109. rtc_set_time = m41t81_set_time;
  110. }
  111. printk("This kernel optimized for "
  112. #ifdef CONFIG_SIMULATION
  113. "simulation"
  114. #else
  115. "board"
  116. #endif
  117. " runs "
  118. #ifdef CONFIG_SIBYTE_CFE
  119. "with"
  120. #else
  121. "without"
  122. #endif
  123. " CFE\n");
  124. #ifdef CONFIG_VT
  125. screen_info = (struct screen_info) {
  126. 0, 0, /* orig-x, orig-y */
  127. 0, /* unused */
  128. 52, /* orig_video_page */
  129. 3, /* orig_video_mode */
  130. 80, /* orig_video_cols */
  131. 4626, 3, 9, /* unused, ega_bx, unused */
  132. 25, /* orig_video_lines */
  133. 0x22, /* orig_video_isVGA */
  134. 16 /* orig_video_points */
  135. };
  136. /* XXXKW for CFE, get lines/cols from environment */
  137. #endif
  138. }
  139. #ifdef LEDS_PHYS
  140. #ifdef CONFIG_SIBYTE_CARMEL
  141. /* XXXKW need to detect Monterey/LittleSur/etc */
  142. #undef LEDS_PHYS
  143. #define LEDS_PHYS MLEDS_PHYS
  144. #endif
  145. #define setled(index, c) \
  146. ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
  147. void setleds(char *str)
  148. {
  149. int i;
  150. for (i = 0; i < 4; i++) {
  151. if (!str[i]) {
  152. setled(i, ' ');
  153. } else {
  154. setled(i, str[i]);
  155. }
  156. }
  157. }
  158. #endif