/arch/m68knommu/platform/68328/config.c

https://bitbucket.org/evzijst/gittest · C · 125 lines · 82 code · 16 blank · 27 comment · 2 complexity · 831c848076b65863346ef1e33be2cc15 MD5 · raw file

  1. /*
  2. * linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c
  3. *
  4. * Copyright (C) 1993 Hamish Macdonald
  5. * Copyright (C) 1999 D. Jeff Dionne
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file COPYING in the main directory of this archive
  9. * for more details.
  10. *
  11. * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca>
  12. */
  13. #include <asm/dbg.h>
  14. #include <stdarg.h>
  15. #include <linux/config.h>
  16. #include <linux/types.h>
  17. #include <linux/kernel.h>
  18. #include <linux/mm.h>
  19. #include <linux/tty.h>
  20. #include <linux/console.h>
  21. #include <linux/interrupt.h>
  22. #include <asm/current.h>
  23. #include <asm/setup.h>
  24. #include <asm/system.h>
  25. #include <asm/pgtable.h>
  26. #include <asm/irq.h>
  27. #include <asm/machdep.h>
  28. #include <asm/MC68328.h>
  29. void BSP_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *))
  30. {
  31. #ifdef CONFIG_XCOPILOT_BUGS
  32. /*
  33. * The only thing I know is that CLK32 is not available on Xcopilot
  34. * I have little idea about what frequency SYSCLK has on Xcopilot.
  35. * The values for prescaler and compare registers were simply
  36. * taken from the original source
  37. */
  38. /* Restart mode, Enable int, SYSCLK, Enable timer */
  39. TCTL2 = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_SYSCLK | TCTL_TEN;
  40. /* Set prescaler */
  41. TPRER2 = 2;
  42. /* Set compare register */
  43. TCMP2 = 0xd7e4;
  44. #else
  45. /* Restart mode, Enable int, 32KHz, Enable timer */
  46. TCTL2 = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
  47. /* Set prescaler (Divide 32KHz by 32)*/
  48. TPRER2 = 31;
  49. /* Set compare register 32Khz / 32 / 10 = 100 */
  50. TCMP2 = 10;
  51. #endif
  52. request_irq(TMR2_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
  53. }
  54. void BSP_tick(void)
  55. {
  56. /* Reset Timer2 */
  57. TSTAT2 &= 0;
  58. }
  59. unsigned long BSP_gettimeoffset (void)
  60. {
  61. return 0;
  62. }
  63. void BSP_gettod (int *yearp, int *monp, int *dayp,
  64. int *hourp, int *minp, int *secp)
  65. {
  66. }
  67. int BSP_hwclk(int op, struct hwclk_time *t)
  68. {
  69. if (!op) {
  70. /* read */
  71. } else {
  72. /* write */
  73. }
  74. return 0;
  75. }
  76. int BSP_set_clock_mmss (unsigned long nowtime)
  77. {
  78. #if 0
  79. short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
  80. tod->second1 = real_seconds / 10;
  81. tod->second2 = real_seconds % 10;
  82. tod->minute1 = real_minutes / 10;
  83. tod->minute2 = real_minutes % 10;
  84. #endif
  85. return 0;
  86. }
  87. void BSP_reset (void)
  88. {
  89. local_irq_disable();
  90. asm volatile ("moveal #0x10c00000, %a0;\n\t"
  91. "moveb #0, 0xFFFFF300;\n\t"
  92. "moveal 0(%a0), %sp;\n\t"
  93. "moveal 4(%a0), %a0;\n\t"
  94. "jmp (%a0);");
  95. }
  96. void config_BSP(char *command, int len)
  97. {
  98. printk(KERN_INFO "\n68328 support D. Jeff Dionne <jeff@uclinux.org>\n");
  99. printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n");
  100. printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n");
  101. mach_sched_init = BSP_sched_init;
  102. mach_tick = BSP_tick;
  103. mach_gettimeoffset = BSP_gettimeoffset;
  104. mach_gettod = BSP_gettod;
  105. mach_hwclk = NULL;
  106. mach_set_clock_mmss = NULL;
  107. mach_reset = BSP_reset;
  108. *command = '\0';
  109. }