1 /* apollohw.h : some structures to access apollo HW */
2 
3 #ifndef _ASMm68k_APOLLOHW_H_
4 #define _ASMm68k_APOLLOHW_H_
5 
6 /*
7    apollo models
8 */
9 
10 extern u_long apollo_model;
11 
12 #define APOLLO_UNKNOWN (0)
13 #define APOLLO_DN3000 (1)
14 #define APOLLO_DN3010 (2)
15 #define APOLLO_DN3500 (3)
16 #define APOLLO_DN4000 (4)
17 #define APOLLO_DN4500 (5)
18 
19 /*
20    see scn2681 data sheet for more info.
21    member names are read_write.
22 */
23 
24 #define DECLARE_2681_FIELD(x) unsigned char x; unsigned char dummy##x
25 
26 struct SCN2681 {
27 
28 	DECLARE_2681_FIELD(mra);
29 	DECLARE_2681_FIELD(sra_csra);
30 	DECLARE_2681_FIELD(BRGtest_cra);
31 	DECLARE_2681_FIELD(rhra_thra);
32 	DECLARE_2681_FIELD(ipcr_acr);
33 	DECLARE_2681_FIELD(isr_imr);
34 	DECLARE_2681_FIELD(ctu_ctur);
35 	DECLARE_2681_FIELD(ctl_ctlr);
36 	DECLARE_2681_FIELD(mrb);
37 	DECLARE_2681_FIELD(srb_csrb);
38 	DECLARE_2681_FIELD(tst_crb);
39 	DECLARE_2681_FIELD(rhrb_thrb);
40 	DECLARE_2681_FIELD(reserved);
41 	DECLARE_2681_FIELD(ip_opcr);
42 	DECLARE_2681_FIELD(startCnt_setOutBit);
43 	DECLARE_2681_FIELD(stopCnt_resetOutBit);
44 
45 };
46 
47 #if 0
48 struct mc146818 {
49 
50 	unsigned int second1:4, second2:4, alarm_second1:4, alarm_second2:4,
51 		     minute1:4, minute2:4, alarm_minute1:4, alarm_minute2:4;
52 	unsigned int hours1:4, hours2:4, alarm_hours1:4, alarm_hours2:4,
53 		     day_of_week1:4, day_of_week2:4, day_of_month1:4, day_of_month2:4;
54 	unsigned int month1:4, month2:4, year1:4, year2:4, :16;
55 
56 };
57 #endif
58 
59 struct mc146818 {
60         unsigned char second, alarm_second;
61         unsigned char minute, alarm_minute;
62         unsigned char hours, alarm_hours;
63         unsigned char day_of_week, day_of_month;
64         unsigned char month, year;
65 };
66 
67 
68 #define IO_BASE 0x80000000
69 
70 extern u_long sio01_physaddr;
71 extern u_long sio23_physaddr;
72 extern u_long rtc_physaddr;
73 extern u_long pica_physaddr;
74 extern u_long picb_physaddr;
75 extern u_long cpuctrl_physaddr;
76 extern u_long timer_physaddr;
77 
78 #define SAU7_SIO01_PHYSADDR 0x10400
79 #define SAU7_SIO23_PHYSADDR 0x10500
80 #define SAU7_RTC_PHYSADDR 0x10900
81 #define SAU7_PICA 0x11000
82 #define SAU7_PICB 0x11100
83 #define SAU7_CPUCTRL 0x10100
84 #define SAU7_TIMER 0x010800
85 
86 #define SAU8_SIO01_PHYSADDR 0x8400
87 #define SAU8_RTC_PHYSADDR 0x8900
88 #define SAU8_PICA 0x9400
89 #define SAU8_PICB 0x9500
90 #define SAU8_CPUCTRL 0x8100
91 #define SAU8_TIMER 0x8800
92 
93 #define sio01 ((*(volatile struct SCN2681 *)(IO_BASE + sio01_physaddr)))
94 #define sio23 ((*(volatile struct SCN2681 *)(IO_BASE + sio23_physaddr)))
95 #define rtc (((volatile struct mc146818 *)(IO_BASE + rtc_physaddr)))
96 #define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr))
97 #define pica (IO_BASE + pica_physaddr)
98 #define picb (IO_BASE + picb_physaddr)
99 #define timer (IO_BASE + timer_physaddr)
100 #define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000))
101 
102 #define isaIO2mem(x) (((((x) & 0x3f8)  << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
103 
104 #endif
105