pal4_setup.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * arch/ppc/platforms/pal4_setup.c
  3. *
  4. * Board setup routines for the SBS PalomarIV.
  5. *
  6. * Author: Dan Cox
  7. *
  8. * 2002 (c) MontaVista, Software, Inc. This file is licensed under
  9. * the terms of the GNU General Public License version 2. This program
  10. * is licensed "as is" without any warranty of any kind, whether express
  11. * or implied.
  12. */
  13. #include <linux/config.h>
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/types.h>
  17. #include <linux/errno.h>
  18. #include <linux/reboot.h>
  19. #include <linux/time.h>
  20. #include <linux/irq.h>
  21. #include <linux/kdev_t.h>
  22. #include <linux/initrd.h>
  23. #include <linux/console.h>
  24. #include <linux/seq_file.h>
  25. #include <linux/root_dev.h>
  26. #include <asm/io.h>
  27. #include <asm/todc.h>
  28. #include <asm/bootinfo.h>
  29. #include <syslib/cpc700.h>
  30. #include "pal4.h"
  31. extern void pal4_find_bridges(void);
  32. unsigned int cpc700_irq_assigns[][2] = {
  33. {1, 1}, /* IRQ 0: ECC correctable error */
  34. {1, 1}, /* IRQ 1: PCI write to memory range */
  35. {0, 1}, /* IRQ 2: PCI write to command register */
  36. {0, 1}, /* IRQ 3: UART 0 */
  37. {0, 1}, /* IRQ 4: UART 1 */
  38. {0, 1}, /* IRQ 5: ICC 0 */
  39. {0, 1}, /* IRQ 6: ICC 1 */
  40. {0, 1}, /* IRQ 7: GPT compare 0 */
  41. {0, 1}, /* IRQ 8: GPT compare 1 */
  42. {0, 1}, /* IRQ 9: GPT compare 2 */
  43. {0, 1}, /* IRQ 10: GPT compare 3 */
  44. {0, 1}, /* IRQ 11: GPT compare 4 */
  45. {0, 1}, /* IRQ 12: GPT capture 0 */
  46. {0, 1}, /* IRQ 13: GPT capture 1 */
  47. {0, 1}, /* IRQ 14: GPT capture 2 */
  48. {0, 1}, /* IRQ 15: GPT capture 3 */
  49. {0, 1}, /* IRQ 16: GPT capture 4 */
  50. {0, 0}, /* IRQ 17: reserved */
  51. {0, 0}, /* IRQ 18: reserved */
  52. {0, 0}, /* IRQ 19: reserved */
  53. {0, 0}, /* IRQ 20: reserved */
  54. {0, 1}, /* IRQ 21: Ethernet */
  55. {0, 0}, /* IRQ 22: reserved */
  56. {0, 0}, /* IRQ 23: reserved */
  57. {0, 0}, /* IRQ 24: resreved */
  58. {0, 0}, /* IRQ 25: reserved */
  59. {0, 0}, /* IRQ 26: reserved */
  60. {0, 0}, /* IRQ 27: reserved */
  61. {0, 0}, /* IRQ 28: reserved */
  62. {0, 0}, /* IRQ 29: reserved */
  63. {0, 0}, /* IRQ 30: reserved */
  64. {0, 0}, /* IRQ 31: reserved */
  65. };
  66. static int
  67. pal4_show_cpuinfo(struct seq_file *m)
  68. {
  69. seq_printf(m, "board\t\t: SBS Palomar IV\n");
  70. return 0;
  71. }
  72. static void
  73. pal4_restart(char *cmd)
  74. {
  75. local_irq_disable();
  76. __asm__ __volatile__("lis 3,0xfff0\n \
  77. ori 3,3,0x100\n \
  78. mtspr 26,3\n \
  79. li 3,0\n \
  80. mtspr 27,3\n \
  81. rfi");
  82. for(;;);
  83. }
  84. static void
  85. pal4_power_off(void)
  86. {
  87. local_irq_disable();
  88. for(;;);
  89. }
  90. static void
  91. pal4_halt(void)
  92. {
  93. pal4_power_off();
  94. }
  95. TODC_ALLOC();
  96. static void __init
  97. pal4_setup_arch(void)
  98. {
  99. unsigned long l2;
  100. TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
  101. ioremap(PAL4_NVRAM, PAL4_NVRAM_SIZE), 8);
  102. pal4_find_bridges();
  103. #ifdef CONFIG_BLK_DEV_INITRD
  104. if (initrd_start)
  105. ROOT_DEV = Root_RAM0;
  106. else
  107. #endif
  108. ROOT_DEV = Root_NFS;
  109. /* The L2 gets disabled in the bootloader, but all the proper
  110. bits should be present from the fw, so just re-enable it */
  111. l2 = _get_L2CR();
  112. if (!(l2 & L2CR_L2E)) {
  113. /* presume that it was initially set if the size is
  114. still present. */
  115. if (l2 ^ L2CR_L2SIZ_MASK)
  116. _set_L2CR(l2 | L2CR_L2E);
  117. else
  118. printk("L2 not set by firmware; left disabled.\n");
  119. }
  120. }
  121. static void __init
  122. pal4_map_io(void)
  123. {
  124. io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
  125. }
  126. void __init
  127. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  128. unsigned long r6, unsigned long r7)
  129. {
  130. parse_bootinfo(find_bootinfo());
  131. isa_io_base = 0 /*PAL4_ISA_IO_BASE*/;
  132. pci_dram_offset = 0 /*PAL4_PCI_SYS_MEM_BASE*/;
  133. ppc_md.setup_arch = pal4_setup_arch;
  134. ppc_md.show_cpuinfo = pal4_show_cpuinfo;
  135. ppc_md.setup_io_mappings = pal4_map_io;
  136. ppc_md.init_IRQ = cpc700_init_IRQ;
  137. ppc_md.get_irq = cpc700_get_irq;
  138. ppc_md.restart = pal4_restart;
  139. ppc_md.halt = pal4_halt;
  140. ppc_md.power_off = pal4_power_off;
  141. ppc_md.time_init = todc_time_init;
  142. ppc_md.set_rtc_time = todc_set_rtc_time;
  143. ppc_md.get_rtc_time = todc_get_rtc_time;
  144. ppc_md.calibrate_decr = todc_calibrate_decr;
  145. ppc_md.nvram_read_val = todc_direct_read_val;
  146. ppc_md.nvram_write_val = todc_direct_write_val;
  147. }