config.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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/mm.h>
  17. #include <linux/tty.h>
  18. #include <linux/console.h>
  19. #include <linux/kd.h>
  20. #include <linux/netdevice.h>
  21. #include <asm/setup.h>
  22. #include <asm/system.h>
  23. #include <asm/pgtable.h>
  24. #include <asm/irq.h>
  25. #include <asm/machdep.h>
  26. #include <asm/MC68VZ328.h>
  27. #include <asm/bootstd.h>
  28. #ifdef CONFIG_INIT_LCD
  29. #include "bootlogo.h"
  30. #endif
  31. /***************************************************************************/
  32. void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *));
  33. void m68328_timer_tick(void);
  34. unsigned long m68328_timer_gettimeoffset(void);
  35. void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
  36. /***************************************************************************/
  37. /* Init Drangon Engine hardware */
  38. /***************************************************************************/
  39. #if defined(CONFIG_DRAGEN2)
  40. static void m68vz328_reset(void)
  41. {
  42. local_irq_disable();
  43. #ifdef CONFIG_INIT_LCD
  44. PBDATA |= 0x20; /* disable CCFL light */
  45. PKDATA |= 0x4; /* disable LCD controller */
  46. LCKCON = 0;
  47. #endif
  48. __asm__ __volatile__(
  49. "reset\n\t"
  50. "moveal #0x04000000, %a0\n\t"
  51. "moveal 0(%a0), %sp\n\t"
  52. "moveal 4(%a0), %a0\n\t"
  53. "jmp (%a0)"
  54. );
  55. }
  56. static void init_hardware(char *command, int size)
  57. {
  58. #ifdef CONFIG_DIRECT_IO_ACCESS
  59. SCR = 0x10; /* allow user access to internal registers */
  60. #endif
  61. /* CSGB Init */
  62. CSGBB = 0x4000;
  63. CSB = 0x1a1;
  64. /* CS8900 init */
  65. /* PK3: hardware sleep function pin, active low */
  66. PKSEL |= PK(3); /* select pin as I/O */
  67. PKDIR |= PK(3); /* select pin as output */
  68. PKDATA |= PK(3); /* set pin high */
  69. /* PF5: hardware reset function pin, active high */
  70. PFSEL |= PF(5); /* select pin as I/O */
  71. PFDIR |= PF(5); /* select pin as output */
  72. PFDATA &= ~PF(5); /* set pin low */
  73. /* cs8900 hardware reset */
  74. PFDATA |= PF(5);
  75. { int i; for (i = 0; i < 32000; ++i); }
  76. PFDATA &= ~PF(5);
  77. /* INT1 enable (cs8900 IRQ) */
  78. PDPOL &= ~PD(1); /* active high signal */
  79. PDIQEG &= ~PD(1);
  80. PDIRQEN |= PD(1); /* IRQ enabled */
  81. #ifdef CONFIG_68328_SERIAL_UART2
  82. /* Enable RXD TXD port bits to enable UART2 */
  83. PJSEL &= ~(PJ(5) | PJ(4));
  84. #endif
  85. #ifdef CONFIG_INIT_LCD
  86. /* initialize LCD controller */
  87. LSSA = (long) screen_bits;
  88. LVPW = 0x14;
  89. LXMAX = 0x140;
  90. LYMAX = 0xef;
  91. LRRA = 0;
  92. LPXCD = 3;
  93. LPICF = 0x08;
  94. LPOLCF = 0;
  95. LCKCON = 0x80;
  96. PCPDEN = 0xff;
  97. PCSEL = 0;
  98. /* Enable LCD controller */
  99. PKDIR |= 0x4;
  100. PKSEL |= 0x4;
  101. PKDATA &= ~0x4;
  102. /* Enable CCFL backlighting circuit */
  103. PBDIR |= 0x20;
  104. PBSEL |= 0x20;
  105. PBDATA &= ~0x20;
  106. /* contrast control register */
  107. PFDIR |= 0x1;
  108. PFSEL &= ~0x1;
  109. PWMR = 0x037F;
  110. #endif
  111. }
  112. /***************************************************************************/
  113. /* Init RT-Control uCdimm hardware */
  114. /***************************************************************************/
  115. #elif defined(CONFIG_UCDIMM)
  116. static void m68vz328_reset(void)
  117. {
  118. local_irq_disable();
  119. asm volatile (
  120. "moveal #0x10c00000, %a0;\n\t"
  121. "moveb #0, 0xFFFFF300;\n\t"
  122. "moveal 0(%a0), %sp;\n\t"
  123. "moveal 4(%a0), %a0;\n\t"
  124. "jmp (%a0);\n"
  125. );
  126. }
  127. unsigned char *cs8900a_hwaddr;
  128. static int errno;
  129. _bsc0(char *, getserialnum)
  130. _bsc1(unsigned char *, gethwaddr, int, a)
  131. _bsc1(char *, getbenv, char *, a)
  132. static void init_hardware(char *command, int size)
  133. {
  134. char *p;
  135. printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum());
  136. p = cs8900a_hwaddr = gethwaddr(0);
  137. printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
  138. p[0], p[1], p[2], p[3], p[4], p[5]);
  139. p = getbenv("APPEND");
  140. if (p)
  141. strcpy(p, command);
  142. else
  143. command[0] = 0;
  144. }
  145. /***************************************************************************/
  146. #else
  147. static void m68vz328_reset(void)
  148. {
  149. }
  150. static void init_hardware(char *command, int size)
  151. {
  152. }
  153. /***************************************************************************/
  154. #endif
  155. /***************************************************************************/
  156. void config_BSP(char *command, int size)
  157. {
  158. printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
  159. #if defined(CONFIG_BOOTPARAM)
  160. strncpy(command, CONFIG_BOOTPARAM_STRING, size);
  161. command[size-1] = 0;
  162. #else
  163. memset(command, 0, size);
  164. #endif
  165. init_hardware(command, size);
  166. mach_sched_init = (void *) m68328_timer_init;
  167. mach_tick = m68328_timer_tick;
  168. mach_gettimeoffset = m68328_timer_gettimeoffset;
  169. mach_gettod = m68328_timer_gettod;
  170. mach_reset = m68vz328_reset;
  171. }
  172. /***************************************************************************/