config.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/68VZ328/config.c
  4. *
  5. * Copyright (C) 1993 Hamish Macdonald
  6. * Copyright (C) 1999 D. Jeff Dionne
  7. * Copyright (C) 2001 Georges Menie, Ken Desmet
  8. *
  9. * This file is subject to the terms and conditions of the GNU General Public
  10. * License. See the file COPYING in the main directory of this archive
  11. * for more details.
  12. */
  13. /***************************************************************************/
  14. #include <linux/types.h>
  15. #include <linux/kernel.h>
  16. #include <linux/kd.h>
  17. #include <linux/netdevice.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/irq.h>
  20. #include <asm/system.h>
  21. #include <asm/pgtable.h>
  22. #include <asm/machdep.h>
  23. #include <asm/MC68VZ328.h>
  24. #include <asm/bootstd.h>
  25. #ifdef CONFIG_INIT_LCD
  26. #include "bootlogo.h"
  27. #endif
  28. /***************************************************************************/
  29. void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
  30. /***************************************************************************/
  31. /* Init Drangon Engine hardware */
  32. /***************************************************************************/
  33. #if defined(CONFIG_DRAGEN2)
  34. static void m68vz328_reset(void)
  35. {
  36. local_irq_disable();
  37. #ifdef CONFIG_INIT_LCD
  38. PBDATA |= 0x20; /* disable CCFL light */
  39. PKDATA |= 0x4; /* disable LCD controller */
  40. LCKCON = 0;
  41. #endif
  42. __asm__ __volatile__(
  43. "reset\n\t"
  44. "moveal #0x04000000, %a0\n\t"
  45. "moveal 0(%a0), %sp\n\t"
  46. "moveal 4(%a0), %a0\n\t"
  47. "jmp (%a0)"
  48. );
  49. }
  50. static void init_hardware(char *command, int size)
  51. {
  52. #ifdef CONFIG_DIRECT_IO_ACCESS
  53. SCR = 0x10; /* allow user access to internal registers */
  54. #endif
  55. /* CSGB Init */
  56. CSGBB = 0x4000;
  57. CSB = 0x1a1;
  58. /* CS8900 init */
  59. /* PK3: hardware sleep function pin, active low */
  60. PKSEL |= PK(3); /* select pin as I/O */
  61. PKDIR |= PK(3); /* select pin as output */
  62. PKDATA |= PK(3); /* set pin high */
  63. /* PF5: hardware reset function pin, active high */
  64. PFSEL |= PF(5); /* select pin as I/O */
  65. PFDIR |= PF(5); /* select pin as output */
  66. PFDATA &= ~PF(5); /* set pin low */
  67. /* cs8900 hardware reset */
  68. PFDATA |= PF(5);
  69. { int i; for (i = 0; i < 32000; ++i); }
  70. PFDATA &= ~PF(5);
  71. /* INT1 enable (cs8900 IRQ) */
  72. PDPOL &= ~PD(1); /* active high signal */
  73. PDIQEG &= ~PD(1);
  74. PDIRQEN |= PD(1); /* IRQ enabled */
  75. #ifdef CONFIG_68328_SERIAL_UART2
  76. /* Enable RXD TXD port bits to enable UART2 */
  77. PJSEL &= ~(PJ(5) | PJ(4));
  78. #endif
  79. #ifdef CONFIG_INIT_LCD
  80. /* initialize LCD controller */
  81. LSSA = (long) screen_bits;
  82. LVPW = 0x14;
  83. LXMAX = 0x140;
  84. LYMAX = 0xef;
  85. LRRA = 0;
  86. LPXCD = 3;
  87. LPICF = 0x08;
  88. LPOLCF = 0;
  89. LCKCON = 0x80;
  90. PCPDEN = 0xff;
  91. PCSEL = 0;
  92. /* Enable LCD controller */
  93. PKDIR |= 0x4;
  94. PKSEL |= 0x4;
  95. PKDATA &= ~0x4;
  96. /* Enable CCFL backlighting circuit */
  97. PBDIR |= 0x20;
  98. PBSEL |= 0x20;
  99. PBDATA &= ~0x20;
  100. /* contrast control register */
  101. PFDIR |= 0x1;
  102. PFSEL &= ~0x1;
  103. PWMR = 0x037F;
  104. #endif
  105. }
  106. /***************************************************************************/
  107. /* Init RT-Control uCdimm hardware */
  108. /***************************************************************************/
  109. #elif defined(CONFIG_UCDIMM)
  110. static void m68vz328_reset(void)
  111. {
  112. local_irq_disable();
  113. asm volatile (
  114. "moveal #0x10c00000, %a0;\n\t"
  115. "moveb #0, 0xFFFFF300;\n\t"
  116. "moveal 0(%a0), %sp;\n\t"
  117. "moveal 4(%a0), %a0;\n\t"
  118. "jmp (%a0);\n"
  119. );
  120. }
  121. unsigned char *cs8900a_hwaddr;
  122. static int errno;
  123. _bsc0(char *, getserialnum)
  124. _bsc1(unsigned char *, gethwaddr, int, a)
  125. _bsc1(char *, getbenv, char *, a)
  126. static void init_hardware(char *command, int size)
  127. {
  128. char *p;
  129. printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum());
  130. p = cs8900a_hwaddr = gethwaddr(0);
  131. printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
  132. p[0], p[1], p[2], p[3], p[4], p[5]);
  133. p = getbenv("APPEND");
  134. if (p)
  135. strcpy(p, command);
  136. else
  137. command[0] = 0;
  138. }
  139. /***************************************************************************/
  140. #else
  141. static void m68vz328_reset(void)
  142. {
  143. }
  144. static void init_hardware(char *command, int size)
  145. {
  146. }
  147. /***************************************************************************/
  148. #endif
  149. /***************************************************************************/
  150. void config_BSP(char *command, int size)
  151. {
  152. printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
  153. init_hardware(command, size);
  154. mach_gettod = m68328_timer_gettod;
  155. mach_reset = m68vz328_reset;
  156. }
  157. /***************************************************************************/