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