proc-init.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* MN2WS0050 processor initialisation
  2. *
  3. * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/sched.h>
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/delay.h>
  15. #include <linux/interrupt.h>
  16. #include <asm/processor.h>
  17. #include <asm/uaccess.h>
  18. #include <asm/io.h>
  19. #include <linux/atomic.h>
  20. #include <asm/smp.h>
  21. #include <asm/pgalloc.h>
  22. #include <asm/busctl-regs.h>
  23. #include <unit/timex.h>
  24. #include <asm/fpu.h>
  25. #include <asm/rtc.h>
  26. #define MEMCONF __SYSREGC(0xdf800400, u32)
  27. /*
  28. * initialise the on-silicon processor peripherals
  29. */
  30. asmlinkage void __init processor_init(void)
  31. {
  32. int loop;
  33. /* set up the exception table first */
  34. for (loop = 0x000; loop < 0x400; loop += 8)
  35. __set_intr_stub(loop, __common_exception);
  36. __set_intr_stub(EXCEP_ITLBMISS, itlb_miss);
  37. __set_intr_stub(EXCEP_DTLBMISS, dtlb_miss);
  38. __set_intr_stub(EXCEP_IAERROR, itlb_aerror);
  39. __set_intr_stub(EXCEP_DAERROR, dtlb_aerror);
  40. __set_intr_stub(EXCEP_BUSERROR, raw_bus_error);
  41. __set_intr_stub(EXCEP_DOUBLE_FAULT, double_fault);
  42. __set_intr_stub(EXCEP_FPU_DISABLED, fpu_disabled);
  43. __set_intr_stub(EXCEP_SYSCALL0, system_call);
  44. __set_intr_stub(EXCEP_NMI, nmi_handler);
  45. __set_intr_stub(EXCEP_WDT, nmi_handler);
  46. __set_intr_stub(EXCEP_IRQ_LEVEL0, irq_handler);
  47. __set_intr_stub(EXCEP_IRQ_LEVEL1, irq_handler);
  48. __set_intr_stub(EXCEP_IRQ_LEVEL2, irq_handler);
  49. __set_intr_stub(EXCEP_IRQ_LEVEL3, irq_handler);
  50. __set_intr_stub(EXCEP_IRQ_LEVEL4, irq_handler);
  51. __set_intr_stub(EXCEP_IRQ_LEVEL5, irq_handler);
  52. __set_intr_stub(EXCEP_IRQ_LEVEL6, irq_handler);
  53. IVAR0 = EXCEP_IRQ_LEVEL0;
  54. IVAR1 = EXCEP_IRQ_LEVEL1;
  55. IVAR2 = EXCEP_IRQ_LEVEL2;
  56. IVAR3 = EXCEP_IRQ_LEVEL3;
  57. IVAR4 = EXCEP_IRQ_LEVEL4;
  58. IVAR5 = EXCEP_IRQ_LEVEL5;
  59. IVAR6 = EXCEP_IRQ_LEVEL6;
  60. #ifndef CONFIG_MN10300_HAS_CACHE_SNOOP
  61. mn10300_dcache_flush_inv();
  62. mn10300_icache_inv();
  63. #endif
  64. /* disable all interrupts and set to priority 6 (lowest) */
  65. #ifdef CONFIG_SMP
  66. for (loop = 0; loop < GxICR_NUM_IRQS; loop++)
  67. GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT;
  68. #else /* !CONFIG_SMP */
  69. for (loop = 0; loop < NR_IRQS; loop++)
  70. GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT;
  71. #endif /* !CONFIG_SMP */
  72. /* clear the timers */
  73. TM0MD = 0;
  74. TM1MD = 0;
  75. TM2MD = 0;
  76. TM3MD = 0;
  77. TM4MD = 0;
  78. TM5MD = 0;
  79. TM6MD = 0;
  80. TM6MDA = 0;
  81. TM6MDB = 0;
  82. TM7MD = 0;
  83. TM8MD = 0;
  84. TM9MD = 0;
  85. TM10MD = 0;
  86. TM11MD = 0;
  87. TM12MD = 0;
  88. TM13MD = 0;
  89. TM14MD = 0;
  90. TM15MD = 0;
  91. calibrate_clock();
  92. }
  93. /*
  94. * determine the memory size and base from the memory controller regs
  95. */
  96. void __init get_mem_info(unsigned long *mem_base, unsigned long *mem_size)
  97. {
  98. unsigned long memconf = MEMCONF;
  99. unsigned long size = 0; /* order: MByte */
  100. *mem_base = 0x90000000; /* fixed address */
  101. switch (memconf & 0x00000003) {
  102. case 0x01:
  103. size = 256 / 8; /* 256 Mbit per chip */
  104. break;
  105. case 0x02:
  106. size = 512 / 8; /* 512 Mbit per chip */
  107. break;
  108. case 0x03:
  109. size = 1024 / 8; /* 1 Gbit per chip */
  110. break;
  111. default:
  112. panic("Invalid SDRAM size");
  113. break;
  114. }
  115. printk(KERN_INFO "DDR2-SDRAM: %luMB x 2 @%08lx\n", size, *mem_base);
  116. *mem_size = (size * 2) << 20;
  117. }