proc-init.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* MN103E010 Processor initialisation
  2. *
  3. * Copyright (C) 2007 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 Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <linux/kernel.h>
  12. #include <asm/fpu.h>
  13. #include <asm/rtc.h>
  14. #include <asm/busctl-regs.h>
  15. /*
  16. * initialise the on-silicon processor peripherals
  17. */
  18. asmlinkage void __init processor_init(void)
  19. {
  20. int loop;
  21. /* set up the exception table first */
  22. for (loop = 0x000; loop < 0x400; loop += 8)
  23. __set_intr_stub(loop, __common_exception);
  24. __set_intr_stub(EXCEP_ITLBMISS, itlb_miss);
  25. __set_intr_stub(EXCEP_DTLBMISS, dtlb_miss);
  26. __set_intr_stub(EXCEP_IAERROR, itlb_aerror);
  27. __set_intr_stub(EXCEP_DAERROR, dtlb_aerror);
  28. __set_intr_stub(EXCEP_BUSERROR, raw_bus_error);
  29. __set_intr_stub(EXCEP_DOUBLE_FAULT, double_fault);
  30. __set_intr_stub(EXCEP_FPU_DISABLED, fpu_disabled);
  31. __set_intr_stub(EXCEP_SYSCALL0, system_call);
  32. __set_intr_stub(EXCEP_NMI, nmi_handler);
  33. __set_intr_stub(EXCEP_WDT, nmi_handler);
  34. __set_intr_stub(EXCEP_IRQ_LEVEL0, irq_handler);
  35. __set_intr_stub(EXCEP_IRQ_LEVEL1, irq_handler);
  36. __set_intr_stub(EXCEP_IRQ_LEVEL2, irq_handler);
  37. __set_intr_stub(EXCEP_IRQ_LEVEL3, irq_handler);
  38. __set_intr_stub(EXCEP_IRQ_LEVEL4, irq_handler);
  39. __set_intr_stub(EXCEP_IRQ_LEVEL5, irq_handler);
  40. __set_intr_stub(EXCEP_IRQ_LEVEL6, irq_handler);
  41. IVAR0 = EXCEP_IRQ_LEVEL0;
  42. IVAR1 = EXCEP_IRQ_LEVEL1;
  43. IVAR2 = EXCEP_IRQ_LEVEL2;
  44. IVAR3 = EXCEP_IRQ_LEVEL3;
  45. IVAR4 = EXCEP_IRQ_LEVEL4;
  46. IVAR5 = EXCEP_IRQ_LEVEL5;
  47. IVAR6 = EXCEP_IRQ_LEVEL6;
  48. mn10300_dcache_flush_inv();
  49. mn10300_icache_inv();
  50. /* disable all interrupts and set to priority 6 (lowest) */
  51. for (loop = 0; loop < NR_IRQS; loop++)
  52. GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT;
  53. /* clear the timers */
  54. TM0MD = 0;
  55. TM1MD = 0;
  56. TM2MD = 0;
  57. TM3MD = 0;
  58. TM4MD = 0;
  59. TM5MD = 0;
  60. TM6MD = 0;
  61. TM6MDA = 0;
  62. TM6MDB = 0;
  63. TM7MD = 0;
  64. TM8MD = 0;
  65. TM9MD = 0;
  66. TM10MD = 0;
  67. TM11MD = 0;
  68. calibrate_clock();
  69. }
  70. /*
  71. * determine the memory size and base from the memory controller regs
  72. */
  73. void __init get_mem_info(unsigned long *mem_base, unsigned long *mem_size)
  74. {
  75. unsigned long base, size;
  76. *mem_base = 0;
  77. *mem_size = 0;
  78. base = SDBASE(0);
  79. if (base & SDBASE_CE) {
  80. size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT;
  81. size = ~size + 1;
  82. base &= SDBASE_CBA;
  83. printk(KERN_INFO "SDRAM[0]: %luMb @%08lx\n", size >> 20, base);
  84. *mem_size += size;
  85. *mem_base = base;
  86. }
  87. base = SDBASE(1);
  88. if (base & SDBASE_CE) {
  89. size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT;
  90. size = ~size + 1;
  91. base &= SDBASE_CBA;
  92. printk(KERN_INFO "SDRAM[1]: %luMb @%08lx\n", size >> 20, base);
  93. *mem_size += size;
  94. if (*mem_base == 0)
  95. *mem_base = base;
  96. }
  97. }