1
2
3
4
5
6
7
8
9
10
11
12 #include <linux/compiler.h>
13
14 #ifndef _MC68328_H_
15 #define _MC68328_H_
16
17 #define BYTE_REF(addr) (*((volatile unsigned char*)addr))
18 #define WORD_REF(addr) (*((volatile unsigned short*)addr))
19 #define LONG_REF(addr) (*((volatile unsigned long*)addr))
20
21 #define PUT_FIELD(field, val) (((val) << field##_SHIFT) & field##_MASK)
22 #define GET_FIELD(reg, field) (((reg) & field##_MASK) >> field##_SHIFT)
23
24
25
26
27
28
29
30
31
32
33 #define SCR_ADDR 0xfffff000
34 #define SCR BYTE_REF(SCR_ADDR)
35
36 #define SCR_WDTH8 0x01
37 #define SCR_DMAP 0x04
38 #define SCR_SO 0x08
39 #define SCR_BETEN 0x10
40 #define SCR_PRV 0x20
41 #define SCR_WPV 0x40
42 #define SCR_BETO 0x80
43
44
45
46
47 #define MRR_ADDR 0xfffff004
48 #define MRR LONG_REF(MRR_ADDR)
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 #define GRPBASEA_ADDR 0xfffff100
66 #define GRPBASEB_ADDR 0xfffff102
67 #define GRPBASEC_ADDR 0xfffff104
68 #define GRPBASED_ADDR 0xfffff106
69
70 #define GRPBASEA WORD_REF(GRPBASEA_ADDR)
71 #define GRPBASEB WORD_REF(GRPBASEB_ADDR)
72 #define GRPBASEC WORD_REF(GRPBASEC_ADDR)
73 #define GRPBASED WORD_REF(GRPBASED_ADDR)
74
75 #define GRPBASE_V 0x0001
76 #define GRPBASE_GBA_MASK 0xfff0
77
78
79
80
81 #define GRPMASKA_ADDR 0xfffff108
82 #define GRPMASKB_ADDR 0xfffff10a
83 #define GRPMASKC_ADDR 0xfffff10c
84 #define GRPMASKD_ADDR 0xfffff10e
85
86 #define GRPMASKA WORD_REF(GRPMASKA_ADDR)
87 #define GRPMASKB WORD_REF(GRPMASKB_ADDR)
88 #define GRPMASKC WORD_REF(GRPMASKC_ADDR)
89 #define GRPMASKD WORD_REF(GRPMASKD_ADDR)
90
91 #define GRMMASK_GMA_MASK 0xfffff0
92
93
94
95
96 #define CSA0_ADDR 0xfffff110
97 #define CSA1_ADDR 0xfffff114
98 #define CSA2_ADDR 0xfffff118
99 #define CSA3_ADDR 0xfffff11c
100
101 #define CSA0 LONG_REF(CSA0_ADDR)
102 #define CSA1 LONG_REF(CSA1_ADDR)
103 #define CSA2 LONG_REF(CSA2_ADDR)
104 #define CSA3 LONG_REF(CSA3_ADDR)
105
106 #define CSA_WAIT_MASK 0x00000007
107 #define CSA_WAIT_SHIFT 0
108 #define CSA_RO 0x00000008
109 #define CSA_AM_MASK 0x0000ff00
110 #define CSA_AM_SHIFT 8
111 #define CSA_BUSW 0x00010000
112 #define CSA_AC_MASK 0xff000000
113 #define CSA_AC_SHIFT 24
114
115
116
117
118 #define CSB0_ADDR 0xfffff120
119 #define CSB1_ADDR 0xfffff124
120 #define CSB2_ADDR 0xfffff128
121 #define CSB3_ADDR 0xfffff12c
122
123 #define CSB0 LONG_REF(CSB0_ADDR)
124 #define CSB1 LONG_REF(CSB1_ADDR)
125 #define CSB2 LONG_REF(CSB2_ADDR)
126 #define CSB3 LONG_REF(CSB3_ADDR)
127
128 #define CSB_WAIT_MASK 0x00000007
129 #define CSB_WAIT_SHIFT 0
130 #define CSB_RO 0x00000008
131 #define CSB_AM_MASK 0x0000ff00
132 #define CSB_AM_SHIFT 8
133 #define CSB_BUSW 0x00010000
134 #define CSB_AC_MASK 0xff000000
135 #define CSB_AC_SHIFT 24
136
137
138
139
140 #define CSC0_ADDR 0xfffff130
141 #define CSC1_ADDR 0xfffff134
142 #define CSC2_ADDR 0xfffff138
143 #define CSC3_ADDR 0xfffff13c
144
145 #define CSC0 LONG_REF(CSC0_ADDR)
146 #define CSC1 LONG_REF(CSC1_ADDR)
147 #define CSC2 LONG_REF(CSC2_ADDR)
148 #define CSC3 LONG_REF(CSC3_ADDR)
149
150 #define CSC_WAIT_MASK 0x00000007
151 #define CSC_WAIT_SHIFT 0
152 #define CSC_RO 0x00000008
153 #define CSC_AM_MASK 0x0000fff0
154 #define CSC_AM_SHIFT 4
155 #define CSC_BUSW 0x00010000
156 #define CSC_AC_MASK 0xfff00000
157 #define CSC_AC_SHIFT 20
158
159
160
161
162 #define CSD0_ADDR 0xfffff140
163 #define CSD1_ADDR 0xfffff144
164 #define CSD2_ADDR 0xfffff148
165 #define CSD3_ADDR 0xfffff14c
166
167 #define CSD0 LONG_REF(CSD0_ADDR)
168 #define CSD1 LONG_REF(CSD1_ADDR)
169 #define CSD2 LONG_REF(CSD2_ADDR)
170 #define CSD3 LONG_REF(CSD3_ADDR)
171
172 #define CSD_WAIT_MASK 0x00000007
173 #define CSD_WAIT_SHIFT 0
174 #define CSD_RO 0x00000008
175 #define CSD_AM_MASK 0x0000fff0
176 #define CSD_AM_SHIFT 4
177 #define CSD_BUSW 0x00010000
178 #define CSD_AC_MASK 0xfff00000
179 #define CSD_AC_SHIFT 20
180
181
182
183
184
185
186
187
188
189
190 #define PLLCR_ADDR 0xfffff200
191 #define PLLCR WORD_REF(PLLCR_ADDR)
192
193 #define PLLCR_DISPLL 0x0008
194 #define PLLCR_CLKEN 0x0010
195 #define PLLCR_SYSCLK_SEL_MASK 0x0700
196 #define PLLCR_SYSCLK_SEL_SHIFT 8
197 #define PLLCR_PIXCLK_SEL_MASK 0x3800
198 #define PLLCR_PIXCLK_SEL_SHIFT 11
199
200
201 #define PLLCR_LCDCLK_SEL_MASK PLLCR_PIXCLK_SEL_MASK
202 #define PLLCR_LCDCLK_SEL_SHIFT PLLCR_PIXCLK_SEL_SHIFT
203
204
205
206
207 #define PLLFSR_ADDR 0xfffff202
208 #define PLLFSR WORD_REF(PLLFSR_ADDR)
209
210 #define PLLFSR_PC_MASK 0x00ff
211 #define PLLFSR_PC_SHIFT 0
212 #define PLLFSR_QC_MASK 0x0f00
213 #define PLLFSR_QC_SHIFT 8
214 #define PLLFSR_PROT 0x4000
215 #define PLLFSR_CLK32 0x8000
216
217
218
219
220 #define PCTRL_ADDR 0xfffff207
221 #define PCTRL BYTE_REF(PCTRL_ADDR)
222
223 #define PCTRL_WIDTH_MASK 0x1f
224 #define PCTRL_WIDTH_SHIFT 0
225 #define PCTRL_STOP 0x40
226 #define PCTRL_PCEN 0x80
227
228
229
230
231
232
233
234
235
236
237 #define IVR_ADDR 0xfffff300
238 #define IVR BYTE_REF(IVR_ADDR)
239
240 #define IVR_VECTOR_MASK 0xF8
241
242
243
244
245 #define ICR_ADRR 0xfffff302
246 #define ICR WORD_REF(ICR_ADDR)
247
248 #define ICR_ET6 0x0100
249 #define ICR_ET3 0x0200
250 #define ICR_ET2 0x0400
251 #define ICR_ET1 0x0800
252 #define ICR_POL6 0x1000
253 #define ICR_POL3 0x2000
254 #define ICR_POL2 0x4000
255 #define ICR_POL1 0x8000
256
257
258
259
260 #define IMR_ADDR 0xfffff304
261 #define IMR LONG_REF(IMR_ADDR)
262
263
264
265
266
267 #define SPIM_IRQ_NUM 0
268 #define TMR2_IRQ_NUM 1
269 #define UART_IRQ_NUM 2
270 #define WDT_IRQ_NUM 3
271 #define RTC_IRQ_NUM 4
272 #define KB_IRQ_NUM 6
273 #define PWM_IRQ_NUM 7
274 #define INT0_IRQ_NUM 8
275 #define INT1_IRQ_NUM 9
276 #define INT2_IRQ_NUM 10
277 #define INT3_IRQ_NUM 11
278 #define INT4_IRQ_NUM 12
279 #define INT5_IRQ_NUM 13
280 #define INT6_IRQ_NUM 14
281 #define INT7_IRQ_NUM 15
282 #define IRQ1_IRQ_NUM 16
283 #define IRQ2_IRQ_NUM 17
284 #define IRQ3_IRQ_NUM 18
285 #define IRQ6_IRQ_NUM 19
286 #define PEN_IRQ_NUM 20
287 #define SPIS_IRQ_NUM 21
288 #define TMR1_IRQ_NUM 22
289 #define IRQ7_IRQ_NUM 23
290
291
292 #define SPI_IRQ_NUM SPIM_IRQ_NUM
293 #define TMR_IRQ_NUM TMR1_IRQ_NUM
294
295
296
297
298 #define IMR_MSPIM (1 << SPIM_IRQ_NUM)
299 #define IMR_MTMR2 (1 << TMR2_IRQ_NUM)
300 #define IMR_MUART (1 << UART_IRQ_NUM)
301 #define IMR_MWDT (1 << WDT_IRQ_NUM)
302 #define IMR_MRTC (1 << RTC_IRQ_NUM)
303 #define IMR_MKB (1 << KB_IRQ_NUM)
304 #define IMR_MPWM (1 << PWM_IRQ_NUM)
305 #define IMR_MINT0 (1 << INT0_IRQ_NUM)
306 #define IMR_MINT1 (1 << INT1_IRQ_NUM)
307 #define IMR_MINT2 (1 << INT2_IRQ_NUM)
308 #define IMR_MINT3 (1 << INT3_IRQ_NUM)
309 #define IMR_MINT4 (1 << INT4_IRQ_NUM)
310 #define IMR_MINT5 (1 << INT5_IRQ_NUM)
311 #define IMR_MINT6 (1 << INT6_IRQ_NUM)
312 #define IMR_MINT7 (1 << INT7_IRQ_NUM)
313 #define IMR_MIRQ1 (1 << IRQ1_IRQ_NUM)
314 #define IMR_MIRQ2 (1 << IRQ2_IRQ_NUM)
315 #define IMR_MIRQ3 (1 << IRQ3_IRQ_NUM)
316 #define IMR_MIRQ6 (1 << IRQ6_IRQ_NUM)
317 #define IMR_MPEN (1 << PEN_IRQ_NUM)
318 #define IMR_MSPIS (1 << SPIS_IRQ_NUM)
319 #define IMR_MTMR1 (1 << TMR1_IRQ_NUM)
320 #define IMR_MIRQ7 (1 << IRQ7_IRQ_NUM)
321
322
323 #define IMR_MSPI IMR_MSPIM
324 #define IMR_MTMR IMR_MTMR1
325
326
327
328
329 #define IWR_ADDR 0xfffff308
330 #define IWR LONG_REF(IWR_ADDR)
331
332 #define IWR_SPIM (1 << SPIM_IRQ_NUM)
333 #define IWR_TMR2 (1 << TMR2_IRQ_NUM)
334 #define IWR_UART (1 << UART_IRQ_NUM)
335 #define IWR_WDT (1 << WDT_IRQ_NUM)
336 #define IWR_RTC (1 << RTC_IRQ_NUM)
337 #define IWR_KB (1 << KB_IRQ_NUM)
338 #define IWR_PWM (1 << PWM_IRQ_NUM)
339 #define IWR_INT0 (1 << INT0_IRQ_NUM)
340 #define IWR_INT1 (1 << INT1_IRQ_NUM)
341 #define IWR_INT2 (1 << INT2_IRQ_NUM)
342 #define IWR_INT3 (1 << INT3_IRQ_NUM)
343 #define IWR_INT4 (1 << INT4_IRQ_NUM)
344 #define IWR_INT5 (1 << INT5_IRQ_NUM)
345 #define IWR_INT6 (1 << INT6_IRQ_NUM)
346 #define IWR_INT7 (1 << INT7_IRQ_NUM)
347 #define IWR_IRQ1 (1 << IRQ1_IRQ_NUM)
348 #define IWR_IRQ2 (1 << IRQ2_IRQ_NUM)
349 #define IWR_IRQ3 (1 << IRQ3_IRQ_NUM)
350 #define IWR_IRQ6 (1 << IRQ6_IRQ_NUM)
351 #define IWR_PEN (1 << PEN_IRQ_NUM)
352 #define IWR_SPIS (1 << SPIS_IRQ_NUM)
353 #define IWR_TMR1 (1 << TMR1_IRQ_NUM)
354 #define IWR_IRQ7 (1 << IRQ7_IRQ_NUM)
355
356
357
358
359 #define ISR_ADDR 0xfffff30c
360 #define ISR LONG_REF(ISR_ADDR)
361
362 #define ISR_SPIM (1 << SPIM_IRQ_NUM)
363 #define ISR_TMR2 (1 << TMR2_IRQ_NUM)
364 #define ISR_UART (1 << UART_IRQ_NUM)
365 #define ISR_WDT (1 << WDT_IRQ_NUM)
366 #define ISR_RTC (1 << RTC_IRQ_NUM)
367 #define ISR_KB (1 << KB_IRQ_NUM)
368 #define ISR_PWM (1 << PWM_IRQ_NUM)
369 #define ISR_INT0 (1 << INT0_IRQ_NUM)
370 #define ISR_INT1 (1 << INT1_IRQ_NUM)
371 #define ISR_INT2 (1 << INT2_IRQ_NUM)
372 #define ISR_INT3 (1 << INT3_IRQ_NUM)
373 #define ISR_INT4 (1 << INT4_IRQ_NUM)
374 #define ISR_INT5 (1 << INT5_IRQ_NUM)
375 #define ISR_INT6 (1 << INT6_IRQ_NUM)
376 #define ISR_INT7 (1 << INT7_IRQ_NUM)
377 #define ISR_IRQ1 (1 << IRQ1_IRQ_NUM)
378 #define ISR_IRQ2 (1 << IRQ2_IRQ_NUM)
379 #define ISR_IRQ3 (1 << IRQ3_IRQ_NUM)
380 #define ISR_IRQ6 (1 << IRQ6_IRQ_NUM)
381 #define ISR_PEN (1 << PEN_IRQ_NUM)
382 #define ISR_SPIS (1 << SPIS_IRQ_NUM)
383 #define ISR_TMR1 (1 << TMR1_IRQ_NUM)
384 #define ISR_IRQ7 (1 << IRQ7_IRQ_NUM)
385
386
387 #define ISR_SPI ISR_SPIM
388 #define ISR_TMR ISR_TMR1
389
390
391
392
393 #define IPR_ADDR 0xfffff310
394 #define IPR LONG_REF(IPR_ADDR)
395
396 #define IPR_SPIM (1 << SPIM_IRQ_NUM)
397 #define IPR_TMR2 (1 << TMR2_IRQ_NUM)
398 #define IPR_UART (1 << UART_IRQ_NUM)
399 #define IPR_WDT (1 << WDT_IRQ_NUM)
400 #define IPR_RTC (1 << RTC_IRQ_NUM)
401 #define IPR_KB (1 << KB_IRQ_NUM)
402 #define IPR_PWM (1 << PWM_IRQ_NUM)
403 #define IPR_INT0 (1 << INT0_IRQ_NUM)
404 #define IPR_INT1 (1 << INT1_IRQ_NUM)
405 #define IPR_INT2 (1 << INT2_IRQ_NUM)
406 #define IPR_INT3 (1 << INT3_IRQ_NUM)
407 #define IPR_INT4 (1 << INT4_IRQ_NUM)
408 #define IPR_INT5 (1 << INT5_IRQ_NUM)
409 #define IPR_INT6 (1 << INT6_IRQ_NUM)
410 #define IPR_INT7 (1 << INT7_IRQ_NUM)
411 #define IPR_IRQ1 (1 << IRQ1_IRQ_NUM)
412 #define IPR_IRQ2 (1 << IRQ2_IRQ_NUM)
413 #define IPR_IRQ3 (1 << IRQ3_IRQ_NUM)
414 #define IPR_IRQ6 (1 << IRQ6_IRQ_NUM)
415 #define IPR_PEN (1 << PEN_IRQ_NUM)
416 #define IPR_SPIS (1 << SPIS_IRQ_NUM)
417 #define IPR_TMR1 (1 << TMR1_IRQ_NUM)
418 #define IPR_IRQ7 (1 << IRQ7_IRQ_NUM)
419
420
421 #define IPR_SPI IPR_SPIM
422 #define IPR_TMR IPR_TMR1
423
424
425
426
427
428
429
430
431
432
433 #define PADIR_ADDR 0xfffff400
434 #define PADATA_ADDR 0xfffff401
435 #define PASEL_ADDR 0xfffff403
436
437 #define PADIR BYTE_REF(PADIR_ADDR)
438 #define PADATA BYTE_REF(PADATA_ADDR)
439 #define PASEL BYTE_REF(PASEL_ADDR)
440
441 #define PA(x) (1 << (x))
442 #define PA_A(x) PA((x) - 16)
443
444 #define PA_A16 PA(0)
445 #define PA_A17 PA(1)
446 #define PA_A18 PA(2)
447 #define PA_A19 PA(3)
448 #define PA_A20 PA(4)
449 #define PA_A21 PA(5)
450 #define PA_A22 PA(6)
451 #define PA_A23 PA(7)
452
453
454
455
456 #define PBDIR_ADDR 0xfffff408
457 #define PBDATA_ADDR 0xfffff409
458 #define PBSEL_ADDR 0xfffff40b
459
460 #define PBDIR BYTE_REF(PBDIR_ADDR)
461 #define PBDATA BYTE_REF(PBDATA_ADDR)
462 #define PBSEL BYTE_REF(PBSEL_ADDR)
463
464 #define PB(x) (1 << (x))
465 #define PB_D(x) PB(x)
466
467 #define PB_D0 PB(0)
468 #define PB_D1 PB(1)
469 #define PB_D2 PB(2)
470 #define PB_D3 PB(3)
471 #define PB_D4 PB(4)
472 #define PB_D5 PB(5)
473 #define PB_D6 PB(6)
474 #define PB_D7 PB(7)
475
476
477
478
479 #define PCDIR_ADDR 0xfffff410
480 #define PCDATA_ADDR 0xfffff411
481 #define PCSEL_ADDR 0xfffff413
482
483 #define PCDIR BYTE_REF(PCDIR_ADDR)
484 #define PCDATA BYTE_REF(PCDATA_ADDR)
485 #define PCSEL BYTE_REF(PCSEL_ADDR)
486
487 #define PC(x) (1 << (x))
488
489 #define PC_WE PC(6)
490 #define PC_DTACK PC(5)
491 #define PC_IRQ7 PC(4)
492 #define PC_LDS PC(2)
493 #define PC_UDS PC(1)
494 #define PC_MOCLK PC(0)
495
496
497
498
499 #define PDDIR_ADDR 0xfffff418
500 #define PDDATA_ADDR 0xfffff419
501 #define PDPUEN_ADDR 0xfffff41a
502 #define PDPOL_ADDR 0xfffff41c
503 #define PDIRQEN_ADDR 0xfffff41d
504 #define PDIQEG_ADDR 0xfffff41f
505
506 #define PDDIR BYTE_REF(PDDIR_ADDR)
507 #define PDDATA BYTE_REF(PDDATA_ADDR)
508 #define PDPUEN BYTE_REF(PDPUEN_ADDR)
509 #define PDPOL BYTE_REF(PDPOL_ADDR)
510 #define PDIRQEN BYTE_REF(PDIRQEN_ADDR)
511 #define PDIQEG BYTE_REF(PDIQEG_ADDR)
512
513 #define PD(x) (1 << (x))
514 #define PD_KB(x) PD(x)
515
516 #define PD_KB0 PD(0)
517 #define PD_KB1 PD(1)
518 #define PD_KB2 PD(2)
519 #define PD_KB3 PD(3)
520 #define PD_KB4 PD(4)
521 #define PD_KB5 PD(5)
522 #define PD_KB6 PD(6)
523 #define PD_KB7 PD(7)
524
525
526
527
528 #define PEDIR_ADDR 0xfffff420
529 #define PEDATA_ADDR 0xfffff421
530 #define PEPUEN_ADDR 0xfffff422
531 #define PESEL_ADDR 0xfffff423
532
533 #define PEDIR BYTE_REF(PEDIR_ADDR)
534 #define PEDATA BYTE_REF(PEDATA_ADDR)
535 #define PEPUEN BYTE_REF(PEPUEN_ADDR)
536 #define PESEL BYTE_REF(PESEL_ADDR)
537
538 #define PE(x) (1 << (x))
539
540 #define PE_CSA1 PE(1)
541 #define PE_CSA2 PE(2)
542 #define PE_CSA3 PE(3)
543 #define PE_CSB0 PE(4)
544 #define PE_CSB1 PE(5)
545 #define PE_CSB2 PE(6)
546 #define PE_CSB3 PE(7)
547
548
549
550
551 #define PFDIR_ADDR 0xfffff428
552 #define PFDATA_ADDR 0xfffff429
553 #define PFPUEN_ADDR 0xfffff42a
554 #define PFSEL_ADDR 0xfffff42b
555
556 #define PFDIR BYTE_REF(PFDIR_ADDR)
557 #define PFDATA BYTE_REF(PFDATA_ADDR)
558 #define PFPUEN BYTE_REF(PFPUEN_ADDR)
559 #define PFSEL BYTE_REF(PFSEL_ADDR)
560
561 #define PF(x) (1 << (x))
562 #define PF_A(x) PF((x) - 24)
563
564 #define PF_A24 PF(0)
565 #define PF_A25 PF(1)
566 #define PF_A26 PF(2)
567 #define PF_A27 PF(3)
568 #define PF_A28 PF(4)
569 #define PF_A29 PF(5)
570 #define PF_A30 PF(6)
571 #define PF_A31 PF(7)
572
573
574
575
576 #define PGDIR_ADDR 0xfffff430
577 #define PGDATA_ADDR 0xfffff431
578 #define PGPUEN_ADDR 0xfffff432
579 #define PGSEL_ADDR 0xfffff433
580
581 #define PGDIR BYTE_REF(PGDIR_ADDR)
582 #define PGDATA BYTE_REF(PGDATA_ADDR)
583 #define PGPUEN BYTE_REF(PGPUEN_ADDR)
584 #define PGSEL BYTE_REF(PGSEL_ADDR)
585
586 #define PG(x) (1 << (x))
587
588 #define PG_UART_TXD PG(0)
589 #define PG_UART_RXD PG(1)
590 #define PG_PWMOUT PG(2)
591 #define PG_TOUT2 PG(3)
592 #define PG_TIN2 PG(4)
593 #define PG_TOUT1 PG(5)
594 #define PG_TIN1 PG(6)
595 #define PG_RTCOUT PG(7)
596
597
598
599
600 #define PJDIR_ADDR 0xfffff438
601 #define PJDATA_ADDR 0xfffff439
602 #define PJSEL_ADDR 0xfffff43b
603
604 #define PJDIR BYTE_REF(PJDIR_ADDR)
605 #define PJDATA BYTE_REF(PJDATA_ADDR)
606 #define PJSEL BYTE_REF(PJSEL_ADDR)
607
608 #define PJ(x) (1 << (x))
609
610 #define PJ_CSD3 PJ(7)
611
612
613
614
615 #define PKDIR_ADDR 0xfffff440
616 #define PKDATA_ADDR 0xfffff441
617 #define PKPUEN_ADDR 0xfffff442
618 #define PKSEL_ADDR 0xfffff443
619
620 #define PKDIR BYTE_REF(PKDIR_ADDR)
621 #define PKDATA BYTE_REF(PKDATA_ADDR)
622 #define PKPUEN BYTE_REF(PKPUEN_ADDR)
623 #define PKSEL BYTE_REF(PKSEL_ADDR)
624
625 #define PK(x) (1 << (x))
626
627
628
629
630 #define PMDIR_ADDR 0xfffff438
631 #define PMDATA_ADDR 0xfffff439
632 #define PMPUEN_ADDR 0xfffff43a
633 #define PMSEL_ADDR 0xfffff43b
634
635 #define PMDIR BYTE_REF(PMDIR_ADDR)
636 #define PMDATA BYTE_REF(PMDATA_ADDR)
637 #define PMPUEN BYTE_REF(PMPUEN_ADDR)
638 #define PMSEL BYTE_REF(PMSEL_ADDR)
639
640 #define PM(x) (1 << (x))
641
642
643
644
645
646
647
648
649
650
651 #define PWMC_ADDR 0xfffff500
652 #define PWMC WORD_REF(PWMC_ADDR)
653
654 #define PWMC_CLKSEL_MASK 0x0007
655 #define PWMC_CLKSEL_SHIFT 0
656 #define PWMC_PWMEN 0x0010
657 #define PMNC_POL 0x0020
658 #define PWMC_PIN 0x0080
659 #define PWMC_LOAD 0x0100
660 #define PWMC_IRQEN 0x4000
661 #define PWMC_CLKSRC 0x8000
662
663
664 #define PWMC_EN PWMC_PWMEN
665
666
667
668
669 #define PWMP_ADDR 0xfffff502
670 #define PWMP WORD_REF(PWMP_ADDR)
671
672
673
674
675 #define PWMW_ADDR 0xfffff504
676 #define PWMW WORD_REF(PWMW_ADDR)
677
678
679
680
681 #define PWMCNT_ADDR 0xfffff506
682 #define PWMCNT WORD_REF(PWMCNT_ADDR)
683
684
685
686
687
688
689
690
691
692
693 #define TCTL1_ADDR 0xfffff600
694 #define TCTL1 WORD_REF(TCTL1_ADDR)
695 #define TCTL2_ADDR 0xfffff60c
696 #define TCTL2 WORD_REF(TCTL2_ADDR)
697
698 #define TCTL_TEN 0x0001
699 #define TCTL_CLKSOURCE_MASK 0x000e
700 #define TCTL_CLKSOURCE_STOP 0x0000
701 #define TCTL_CLKSOURCE_SYSCLK 0x0002
702 #define TCTL_CLKSOURCE_SYSCLK_16 0x0004
703 #define TCTL_CLKSOURCE_TIN 0x0006
704 #define TCTL_CLKSOURCE_32KHZ 0x0008
705 #define TCTL_IRQEN 0x0010
706 #define TCTL_OM 0x0020
707 #define TCTL_CAP_MASK 0x00c0
708 #define TCTL_CAP_RE 0x0040
709 #define TCTL_CAP_FE 0x0080
710 #define TCTL_FRR 0x0010
711
712
713 #define TCTL_ADDR TCTL1_ADDR
714 #define TCTL TCTL1
715
716
717
718
719 #define TPRER1_ADDR 0xfffff602
720 #define TPRER1 WORD_REF(TPRER1_ADDR)
721 #define TPRER2_ADDR 0xfffff60e
722 #define TPRER2 WORD_REF(TPRER2_ADDR)
723
724
725 #define TPRER_ADDR TPRER1_ADDR
726 #define TPRER TPRER1
727
728
729
730
731 #define TCMP1_ADDR 0xfffff604
732 #define TCMP1 WORD_REF(TCMP1_ADDR)
733 #define TCMP2_ADDR 0xfffff610
734 #define TCMP2 WORD_REF(TCMP2_ADDR)
735
736
737 #define TCMP_ADDR TCMP1_ADDR
738 #define TCMP TCMP1
739
740
741
742
743 #define TCR1_ADDR 0xfffff606
744 #define TCR1 WORD_REF(TCR1_ADDR)
745 #define TCR2_ADDR 0xfffff612
746 #define TCR2 WORD_REF(TCR2_ADDR)
747
748
749 #define TCR_ADDR TCR1_ADDR
750 #define TCR TCR1
751
752
753
754
755 #define TCN1_ADDR 0xfffff608
756 #define TCN1 WORD_REF(TCN1_ADDR)
757 #define TCN2_ADDR 0xfffff614
758 #define TCN2 WORD_REF(TCN2_ADDR)
759
760
761 #define TCN_ADDR TCN1_ADDR
762 #define TCN TCN1
763
764
765
766
767 #define TSTAT1_ADDR 0xfffff60a
768 #define TSTAT1 WORD_REF(TSTAT1_ADDR)
769 #define TSTAT2_ADDR 0xfffff616
770 #define TSTAT2 WORD_REF(TSTAT2_ADDR)
771
772 #define TSTAT_COMP 0x0001
773 #define TSTAT_CAPT 0x0001
774
775
776 #define TSTAT_ADDR TSTAT1_ADDR
777 #define TSTAT TSTAT1
778
779
780
781
782 #define WRR_ADDR 0xfffff61a
783 #define WRR WORD_REF(WRR_ADDR)
784
785
786
787
788 #define WCN_ADDR 0xfffff61c
789 #define WCN WORD_REF(WCN_ADDR)
790
791
792
793
794 #define WCSR_ADDR 0xfffff618
795 #define WCSR WORD_REF(WCSR_ADDR)
796
797 #define WCSR_WDEN 0x0001
798 #define WCSR_FI 0x0002
799 #define WCSR_WRST 0x0004
800
801
802
803
804
805
806
807
808
809
810 #define SPISR_ADDR 0xfffff700
811 #define SPISR WORD_REF(SPISR_ADDR)
812
813 #define SPISR_DATA_ADDR 0xfffff701
814 #define SPISR_DATA BYTE_REF(SPISR_DATA_ADDR)
815
816 #define SPISR_DATA_MASK 0x00ff
817 #define SPISR_DATA_SHIFT 0
818 #define SPISR_SPISEN 0x0100
819 #define SPISR_POL 0x0200
820 #define SPISR_PHA 0x0400
821 #define SPISR_OVWR 0x0800
822 #define SPISR_DATARDY 0x1000
823 #define SPISR_ENPOL 0x2000
824 #define SPISR_IRQEN 0x4000
825 #define SPISR_SPISIRQ 0x8000
826
827
828
829
830
831
832
833
834
835
836 #define SPIMDATA_ADDR 0xfffff800
837 #define SPIMDATA WORD_REF(SPIMDATA_ADDR)
838
839
840
841
842 #define SPIMCONT_ADDR 0xfffff802
843 #define SPIMCONT WORD_REF(SPIMCONT_ADDR)
844
845 #define SPIMCONT_BIT_COUNT_MASK 0x000f
846 #define SPIMCONT_BIT_COUNT_SHIFT 0
847 #define SPIMCONT_POL 0x0010
848 #define SPIMCONT_PHA 0x0020
849 #define SPIMCONT_IRQEN 0x0040
850 #define SPIMCONT_SPIMIRQ 0x0080
851 #define SPIMCONT_XCH 0x0100
852 #define SPIMCONT_RSPIMEN 0x0200
853 #define SPIMCONT_DATA_RATE_MASK 0xe000
854 #define SPIMCONT_DATA_RATE_SHIFT 13
855
856
857 #define SPIMCONT_IRQ SPIMCONT_SPIMIRQ
858 #define SPIMCONT_ENABLE SPIMCONT_SPIMEN
859
860
861
862
863
864
865
866
867
868 #define USTCNT_ADDR 0xfffff900
869 #define USTCNT WORD_REF(USTCNT_ADDR)
870
871 #define USTCNT_TXAVAILEN 0x0001
872 #define USTCNT_TXHALFEN 0x0002
873 #define USTCNT_TXEMPTYEN 0x0004
874 #define USTCNT_RXREADYEN 0x0008
875 #define USTCNT_RXHALFEN 0x0010
876 #define USTCNT_RXFULLEN 0x0020
877 #define USTCNT_CTSDELTAEN 0x0040
878 #define USTCNT_GPIODELTAEN 0x0080
879 #define USTCNT_8_7 0x0100
880 #define USTCNT_STOP 0x0200
881 #define USTCNT_ODD_EVEN 0x0400
882 #define USTCNT_PARITYEN 0x0800
883 #define USTCNT_CLKMODE 0x1000
884 #define USTCNT_TXEN 0x2000
885 #define USTCNT_RXEN 0x4000
886 #define USTCNT_UARTEN 0x8000
887
888
889 #define USTCNT_TXAE USTCNT_TXAVAILEN
890 #define USTCNT_TXHE USTCNT_TXHALFEN
891 #define USTCNT_TXEE USTCNT_TXEMPTYEN
892 #define USTCNT_RXRE USTCNT_RXREADYEN
893 #define USTCNT_RXHE USTCNT_RXHALFEN
894 #define USTCNT_RXFE USTCNT_RXFULLEN
895 #define USTCNT_CTSD USTCNT_CTSDELTAEN
896 #define USTCNT_ODD USTCNT_ODD_EVEN
897 #define USTCNT_PEN USTCNT_PARITYEN
898 #define USTCNT_CLKM USTCNT_CLKMODE
899 #define USTCNT_UEN USTCNT_UARTEN
900
901
902
903
904 #define UBAUD_ADDR 0xfffff902
905 #define UBAUD WORD_REF(UBAUD_ADDR)
906
907 #define UBAUD_PRESCALER_MASK 0x003f
908 #define UBAUD_PRESCALER_SHIFT 0
909 #define UBAUD_DIVIDE_MASK 0x0700
910 #define UBAUD_DIVIDE_SHIFT 8
911 #define UBAUD_BAUD_SRC 0x0800
912 #define UBAUD_GPIOSRC 0x1000
913 #define UBAUD_GPIODIR 0x2000
914 #define UBAUD_GPIO 0x4000
915 #define UBAUD_GPIODELTA 0x8000
916
917
918
919
920 #define URX_ADDR 0xfffff904
921 #define URX WORD_REF(URX_ADDR)
922
923 #define URX_RXDATA_ADDR 0xfffff905
924 #define URX_RXDATA BYTE_REF(URX_RXDATA_ADDR)
925
926 #define URX_RXDATA_MASK 0x00ff
927 #define URX_RXDATA_SHIFT 0
928 #define URX_PARITY_ERROR 0x0100
929 #define URX_BREAK 0x0200
930 #define URX_FRAME_ERROR 0x0400
931 #define URX_OVRUN 0x0800
932 #define URX_DATA_READY 0x2000
933 #define URX_FIFO_HALF 0x4000
934 #define URX_FIFO_FULL 0x8000
935
936
937
938
939 #define UTX_ADDR 0xfffff906
940 #define UTX WORD_REF(UTX_ADDR)
941
942 #define UTX_TXDATA_ADDR 0xfffff907
943 #define UTX_TXDATA BYTE_REF(UTX_TXDATA_ADDR)
944
945 #define UTX_TXDATA_MASK 0x00ff
946 #define UTX_TXDATA_SHIFT 0
947 #define UTX_CTS_DELTA 0x0100
948 #define UTX_CTS_STATUS 0x0200
949 #define UTX_IGNORE_CTS 0x0800
950 #define UTX_SEND_BREAK 0x1000
951 #define UTX_TX_AVAIL 0x2000
952 #define UTX_FIFO_HALF 0x4000
953 #define UTX_FIFO_EMPTY 0x8000
954
955
956 #define UTX_CTS_STAT UTX_CTS_STATUS
957 #define UTX_NOCTS UTX_IGNORE_CTS
958
959
960
961
962 #define UMISC_ADDR 0xfffff908
963 #define UMISC WORD_REF(UMISC_ADDR)
964
965 #define UMISC_TX_POL 0x0004
966 #define UMISC_RX_POL 0x0008
967 #define UMISC_IRDA_LOOP 0x0010
968 #define UMISC_IRDA_EN 0x0020
969 #define UMISC_RTS 0x0040
970 #define UMISC_RTSCONT 0x0080
971 #define UMISC_LOOP 0x1000
972 #define UMISC_FORCE_PERR 0x2000
973 #define UMISC_CLKSRC 0x4000
974
975
976
977 typedef volatile struct {
978 volatile unsigned short int ustcnt;
979 volatile unsigned short int ubaud;
980 union {
981 volatile unsigned short int w;
982 struct {
983 volatile unsigned char status;
984 volatile unsigned char rxdata;
985 } b;
986 } urx;
987 union {
988 volatile unsigned short int w;
989 struct {
990 volatile unsigned char status;
991 volatile unsigned char txdata;
992 } b;
993 } utx;
994 volatile unsigned short int umisc;
995 volatile unsigned short int pad1;
996 volatile unsigned short int pad2;
997 volatile unsigned short int pad3;
998 } __packed m68328_uart;
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010 #define LSSA_ADDR 0xfffffa00
1011 #define LSSA LONG_REF(LSSA_ADDR)
1012
1013 #define LSSA_SSA_MASK 0xfffffffe
1014
1015
1016
1017
1018 #define LVPW_ADDR 0xfffffa05
1019 #define LVPW BYTE_REF(LVPW_ADDR)
1020
1021
1022
1023
1024 #define LXMAX_ADDR 0xfffffa08
1025 #define LXMAX WORD_REF(LXMAX_ADDR)
1026
1027 #define LXMAX_XM_MASK 0x02ff
1028
1029
1030
1031
1032 #define LYMAX_ADDR 0xfffffa0a
1033 #define LYMAX WORD_REF(LYMAX_ADDR)
1034
1035 #define LYMAX_YM_MASK 0x02ff
1036
1037
1038
1039
1040 #define LCXP_ADDR 0xfffffa18
1041 #define LCXP WORD_REF(LCXP_ADDR)
1042
1043 #define LCXP_CC_MASK 0xc000
1044 #define LCXP_CC_TRAMSPARENT 0x0000
1045 #define LCXP_CC_BLACK 0x4000
1046 #define LCXP_CC_REVERSED 0x8000
1047 #define LCXP_CC_WHITE 0xc000
1048 #define LCXP_CXP_MASK 0x02ff
1049
1050
1051
1052
1053 #define LCYP_ADDR 0xfffffa1a
1054 #define LCYP WORD_REF(LCYP_ADDR)
1055
1056 #define LCYP_CYP_MASK 0x01ff
1057
1058
1059
1060
1061 #define LCWCH_ADDR 0xfffffa1c
1062 #define LCWCH WORD_REF(LCWCH_ADDR)
1063
1064 #define LCWCH_CH_MASK 0x001f
1065 #define LCWCH_CH_SHIFT 0
1066 #define LCWCH_CW_MASK 0x1f00
1067 #define LCWCH_CW_SHIFT 8
1068
1069
1070
1071
1072 #define LBLKC_ADDR 0xfffffa1f
1073 #define LBLKC BYTE_REF(LBLKC_ADDR)
1074
1075 #define LBLKC_BD_MASK 0x7f
1076 #define LBLKC_BD_SHIFT 0
1077 #define LBLKC_BKEN 0x80
1078
1079
1080
1081
1082 #define LPICF_ADDR 0xfffffa20
1083 #define LPICF BYTE_REF(LPICF_ADDR)
1084
1085 #define LPICF_GS_MASK 0x01
1086 #define LPICF_GS_BW 0x00
1087 #define LPICF_GS_GRAY_4 0x01
1088 #define LPICF_PBSIZ_MASK 0x06
1089 #define LPICF_PBSIZ_1 0x00
1090 #define LPICF_PBSIZ_2 0x02
1091 #define LPICF_PBSIZ_4 0x04
1092
1093
1094
1095
1096 #define LPOLCF_ADDR 0xfffffa21
1097 #define LPOLCF BYTE_REF(LPOLCF_ADDR)
1098
1099 #define LPOLCF_PIXPOL 0x01
1100 #define LPOLCF_LPPOL 0x02
1101 #define LPOLCF_FLMPOL 0x04
1102 #define LPOLCF_LCKPOL 0x08
1103
1104
1105
1106
1107 #define LACDRC_ADDR 0xfffffa23
1108 #define LACDRC BYTE_REF(LACDRC_ADDR)
1109
1110 #define LACDRC_ACD_MASK 0x0f
1111 #define LACDRC_ACD_SHIFT 0
1112
1113
1114
1115
1116 #define LPXCD_ADDR 0xfffffa25
1117 #define LPXCD BYTE_REF(LPXCD_ADDR)
1118
1119 #define LPXCD_PCD_MASK 0x3f
1120 #define LPXCD_PCD_SHIFT 0
1121
1122
1123
1124
1125 #define LCKCON_ADDR 0xfffffa27
1126 #define LCKCON BYTE_REF(LCKCON_ADDR)
1127
1128 #define LCKCON_PCDS 0x01
1129 #define LCKCON_DWIDTH 0x02
1130 #define LCKCON_DWS_MASK 0x3c
1131 #define LCKCON_DWS_SHIFT 2
1132 #define LCKCON_DMA16 0x40
1133 #define LCKCON_LCDON 0x80
1134
1135
1136 #define LCKCON_DW_MASK LCKCON_DWS_MASK
1137 #define LCKCON_DW_SHIFT LCKCON_DWS_SHIFT
1138
1139
1140
1141
1142 #define LLBAR_ADDR 0xfffffa29
1143 #define LLBAR BYTE_REF(LLBAR_ADDR)
1144
1145 #define LLBAR_LBAR_MASK 0x7f
1146 #define LLBAR_LBAR_SHIFT 0
1147
1148
1149
1150
1151 #define LOTCR_ADDR 0xfffffa2b
1152 #define LOTCR BYTE_REF(LOTCR_ADDR)
1153
1154
1155
1156
1157 #define LPOSR_ADDR 0xfffffa2d
1158 #define LPOSR BYTE_REF(LPOSR_ADDR)
1159
1160 #define LPOSR_BOS 0x08
1161 #define LPOSR_POS_MASK 0x07
1162 #define LPOSR_POS_SHIFT 0
1163
1164
1165
1166
1167 #define LFRCM_ADDR 0xfffffa31
1168 #define LFRCM BYTE_REF(LFRCM_ADDR)
1169
1170 #define LFRCM_YMOD_MASK 0x0f
1171 #define LFRCM_YMOD_SHIFT 0
1172 #define LFRCM_XMOD_MASK 0xf0
1173 #define LFRCM_XMOD_SHIFT 4
1174
1175
1176
1177
1178 #define LGPMR_ADDR 0xfffffa32
1179 #define LGPMR WORD_REF(LGPMR_ADDR)
1180
1181 #define LGPMR_GLEVEL3_MASK 0x000f
1182 #define LGPMR_GLEVEL3_SHIFT 0
1183 #define LGPMR_GLEVEL2_MASK 0x00f0
1184 #define LGPMR_GLEVEL2_SHIFT 4
1185 #define LGPMR_GLEVEL0_MASK 0x0f00
1186 #define LGPMR_GLEVEL0_SHIFT 8
1187 #define LGPMR_GLEVEL1_MASK 0xf000
1188 #define LGPMR_GLEVEL1_SHIFT 12
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199 #define RTCTIME_ADDR 0xfffffb00
1200 #define RTCTIME LONG_REF(RTCTIME_ADDR)
1201
1202 #define RTCTIME_SECONDS_MASK 0x0000003f
1203 #define RTCTIME_SECONDS_SHIFT 0
1204 #define RTCTIME_MINUTES_MASK 0x003f0000
1205 #define RTCTIME_MINUTES_SHIFT 16
1206 #define RTCTIME_HOURS_MASK 0x1f000000
1207 #define RTCTIME_HOURS_SHIFT 24
1208
1209
1210
1211
1212 #define RTCALRM_ADDR 0xfffffb04
1213 #define RTCALRM LONG_REF(RTCALRM_ADDR)
1214
1215 #define RTCALRM_SECONDS_MASK 0x0000003f
1216 #define RTCALRM_SECONDS_SHIFT 0
1217 #define RTCALRM_MINUTES_MASK 0x003f0000
1218 #define RTCALRM_MINUTES_SHIFT 16
1219 #define RTCALRM_HOURS_MASK 0x1f000000
1220 #define RTCALRM_HOURS_SHIFT 24
1221
1222
1223
1224
1225 #define RTCCTL_ADDR 0xfffffb0c
1226 #define RTCCTL WORD_REF(RTCCTL_ADDR)
1227
1228 #define RTCCTL_384 0x0020
1229 #define RTCCTL_ENABLE 0x0080
1230
1231
1232 #define RTCCTL_XTL RTCCTL_384
1233 #define RTCCTL_EN RTCCTL_ENABLE
1234
1235
1236
1237
1238 #define RTCISR_ADDR 0xfffffb0e
1239 #define RTCISR WORD_REF(RTCISR_ADDR)
1240
1241 #define RTCISR_SW 0x0001
1242 #define RTCISR_MIN 0x0002
1243 #define RTCISR_ALM 0x0004
1244 #define RTCISR_DAY 0x0008
1245 #define RTCISR_1HZ 0x0010
1246
1247
1248
1249
1250 #define RTCIENR_ADDR 0xfffffb10
1251 #define RTCIENR WORD_REF(RTCIENR_ADDR)
1252
1253 #define RTCIENR_SW 0x0001
1254 #define RTCIENR_MIN 0x0002
1255 #define RTCIENR_ALM 0x0004
1256 #define RTCIENR_DAY 0x0008
1257 #define RTCIENR_1HZ 0x0010
1258
1259
1260
1261
1262 #define STPWCH_ADDR 0xfffffb12
1263 #define STPWCH WORD_REF(STPWCH)
1264
1265 #define STPWCH_CNT_MASK 0x00ff
1266 #define SPTWCH_CNT_SHIFT 0
1267
1268 #endif