config.c 5.1 KB

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