1 #include <linux/types.h>
2 #include <linux/kernel.h>
5 #include <linux/console.h>
7 #include <linux/vt_kern.h>
8 #include <linux/interrupt.h>
10 #include <asm/setup.h>
11 #include <asm/bootinfo.h>
12 #include <asm/system.h>
13 #include <asm/pgtable.h>
14 #include <asm/apollohw.h>
17 #include <asm/machdep.h>
19 u_long sio01_physaddr
;
20 u_long sio23_physaddr
;
24 u_long cpuctrl_physaddr
;
25 u_long timer_physaddr
;
28 extern void dn_sched_init(irq_handler_t handler
);
29 extern void dn_init_IRQ(void);
30 extern unsigned long dn_gettimeoffset(void);
31 extern int dn_dummy_hwclk(int, struct rtc_time
*);
32 extern int dn_dummy_set_clock_mmss(unsigned long);
33 extern void dn_dummy_reset(void);
34 extern void dn_dummy_waitbut(void);
35 extern struct fb_info
*dn_fb_init(long *);
36 extern void dn_dummy_debug_init(void);
37 extern irqreturn_t
dn_process_int(int irq
, struct pt_regs
*fp
);
38 #ifdef CONFIG_HEARTBEAT
39 static void dn_heartbeat(int on
);
41 static irqreturn_t
dn_timer_int(int irq
,void *);
42 static void dn_get_model(char *model
);
43 static const char *apollo_models
[] = {
44 [APOLLO_DN3000
-APOLLO_DN3000
] = "DN3000 (Otter)",
45 [APOLLO_DN3010
-APOLLO_DN3000
] = "DN3010 (Otter)",
46 [APOLLO_DN3500
-APOLLO_DN3000
] = "DN3500 (Cougar II)",
47 [APOLLO_DN4000
-APOLLO_DN3000
] = "DN4000 (Mink)",
48 [APOLLO_DN4500
-APOLLO_DN3000
] = "DN4500 (Roadrunner)"
51 int apollo_parse_bootinfo(const struct bi_record
*record
) {
54 const unsigned long *data
= record
->data
;
68 void dn_setup_model(void) {
71 printk("Apollo hardware found: ");
72 printk("[%s]\n", apollo_models
[apollo_model
- APOLLO_DN3000
]);
74 switch(apollo_model
) {
76 panic("Unknown apollo model");
80 sio01_physaddr
=SAU8_SIO01_PHYSADDR
;
81 rtc_physaddr
=SAU8_RTC_PHYSADDR
;
82 pica_physaddr
=SAU8_PICA
;
83 picb_physaddr
=SAU8_PICB
;
84 cpuctrl_physaddr
=SAU8_CPUCTRL
;
85 timer_physaddr
=SAU8_TIMER
;
88 sio01_physaddr
=SAU7_SIO01_PHYSADDR
;
89 sio23_physaddr
=SAU7_SIO23_PHYSADDR
;
90 rtc_physaddr
=SAU7_RTC_PHYSADDR
;
91 pica_physaddr
=SAU7_PICA
;
92 picb_physaddr
=SAU7_PICB
;
93 cpuctrl_physaddr
=SAU7_CPUCTRL
;
94 timer_physaddr
=SAU7_TIMER
;
97 panic("Apollo model not yet supported");
100 sio01_physaddr
=SAU7_SIO01_PHYSADDR
;
101 sio23_physaddr
=SAU7_SIO23_PHYSADDR
;
102 rtc_physaddr
=SAU7_RTC_PHYSADDR
;
103 pica_physaddr
=SAU7_PICA
;
104 picb_physaddr
=SAU7_PICB
;
105 cpuctrl_physaddr
=SAU7_CPUCTRL
;
106 timer_physaddr
=SAU7_TIMER
;
109 panic("Undefined apollo model");
116 int dn_serial_console_wait_key(struct console
*co
) {
118 while(!(sio01
.srb_csrb
& 1))
120 return sio01
.rhrb_thrb
;
123 void dn_serial_console_write (struct console
*co
, const char *str
,unsigned int count
)
127 sio01
.rhrb_thrb
= (unsigned char)'\r';
128 while (!(sio01
.srb_csrb
& 0x4))
131 sio01
.rhrb_thrb
= (unsigned char)*str
++;
132 while (!(sio01
.srb_csrb
& 0x4))
137 void dn_serial_print (const char *str
)
141 sio01
.rhrb_thrb
= (unsigned char)'\r';
142 while (!(sio01
.srb_csrb
& 0x4))
145 sio01
.rhrb_thrb
= (unsigned char)*str
++;
146 while (!(sio01
.srb_csrb
& 0x4))
151 void __init
config_apollo(void)
157 mach_sched_init
=dn_sched_init
; /* */
158 mach_init_IRQ
=dn_init_IRQ
;
159 mach_gettimeoffset
= dn_gettimeoffset
;
160 mach_max_dma_address
= 0xffffffff;
161 mach_hwclk
= dn_dummy_hwclk
; /* */
162 mach_set_clock_mmss
= dn_dummy_set_clock_mmss
; /* */
163 mach_reset
= dn_dummy_reset
; /* */
164 #ifdef CONFIG_HEARTBEAT
165 mach_heartbeat
= dn_heartbeat
;
167 mach_get_model
= dn_get_model
;
171 /* clear DMA translation table */
177 irqreturn_t
dn_timer_int(int irq
, void *dev_id
)
179 irq_handler_t timer_handler
= dev_id
;
181 volatile unsigned char x
;
183 timer_handler(irq
, dev_id
);
185 x
=*(volatile unsigned char *)(timer
+3);
186 x
=*(volatile unsigned char *)(timer
+5);
191 void dn_sched_init(irq_handler_t timer_routine
)
193 /* program timer 1 */
194 *(volatile unsigned char *)(timer
+3)=0x01;
195 *(volatile unsigned char *)(timer
+1)=0x40;
196 *(volatile unsigned char *)(timer
+5)=0x09;
197 *(volatile unsigned char *)(timer
+7)=0xc4;
199 /* enable IRQ of PIC B */
200 *(volatile unsigned char *)(pica
+1)&=(~8);
203 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer
+0x3));
204 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer
+0x3));
207 request_irq(IRQ_APOLLO
, dn_timer_int
, 0, "time", timer_routine
);
210 unsigned long dn_gettimeoffset(void) {
216 int dn_dummy_hwclk(int op
, struct rtc_time
*t
) {
220 t
->tm_sec
=rtc
->second
;
221 t
->tm_min
=rtc
->minute
;
222 t
->tm_hour
=rtc
->hours
;
223 t
->tm_mday
=rtc
->day_of_month
;
224 t
->tm_wday
=rtc
->day_of_week
;
225 t
->tm_mon
=rtc
->month
;
226 t
->tm_year
=rtc
->year
;
228 rtc
->second
=t
->tm_sec
;
229 rtc
->minute
=t
->tm_min
;
230 rtc
->hours
=t
->tm_hour
;
231 rtc
->day_of_month
=t
->tm_mday
;
233 rtc
->day_of_week
=t
->tm_wday
;
234 rtc
->month
=t
->tm_mon
;
235 rtc
->year
=t
->tm_year
;
242 int dn_dummy_set_clock_mmss(unsigned long nowtime
) {
244 printk("set_clock_mmss\n");
250 void dn_dummy_reset(void) {
252 dn_serial_print("The end !\n");
258 void dn_dummy_waitbut(void) {
260 dn_serial_print("waitbut\n");
264 static void dn_get_model(char *model
)
266 strcpy(model
, "Apollo ");
267 if (apollo_model
>= APOLLO_DN3000
&& apollo_model
<= APOLLO_DN4500
)
268 strcat(model
, apollo_models
[apollo_model
- APOLLO_DN3000
]);
271 #ifdef CONFIG_HEARTBEAT
272 static int dn_cpuctrl
=0xff00;
274 static void dn_heartbeat(int on
) {