fix to allow usb modules to compile
[linux-2.4.21-pre4.git] / arch / ppc / platforms / gemini_prom.S
1 /*
2  * BK Id: SCCS/s.gemini_prom.S 1.10 08/13/02 21:52:54 paulus
3  */
4 /*
5  *  arch/ppc/kernel/gemini_prom.S
6  *
7  *  Not really prom support code (yet), but sort of anti-prom code.  The current
8  *  bootloader does a number of things it shouldn't and doesn't do things that it
9  *  should.  The stuff in here is mainly a hodge-podge collection of setup code
10  *  to get the board up and running.
11  *    ---Dan
12  */
13
14 #include <linux/config.h>
15 #include <asm/processor.h>
16 #include <asm/page.h>
17 #include <platforms/gemini.h>
18 #include <asm/ppc_asm.h>
19
20 #define HID0_ABE (1<<3)
21
22 /*
23  *  On 750's the MMU is on when Linux is booted, so we need to clear out the
24  *  bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
25  *  and turn off the MMU.
26  *
27  */
28
29 _GLOBAL(gemini_prom_init)
30 #ifdef CONFIG_SMP
31         /* Since the MMU's on, get stuff in rom space that we'll need */
32         lis     r4,GEMINI_CPUSTAT@h
33         ori     r4,r4,GEMINI_CPUSTAT@l
34         lbz     r5,0(r4)
35         andi.   r5,r5,3
36         mr      r24,r5          /* cpu # used later on */
37 #endif
38         mfmsr   r4
39         li      r3,MSR_PR       /* ensure supervisor! */
40         ori     r3,r3,MSR_IR|MSR_DR
41         andc    r4,r4,r3
42         mtmsr   r4
43         isync
44 #if 0
45         /* zero out the bats now that the MMU is off */
46 prom_no_mmu:    
47         li      r3,0
48         mtspr   IBAT0U,r3
49         mtspr   IBAT0L,r3
50         mtspr   IBAT1U,r3
51         mtspr   IBAT1L,r3
52         mtspr   IBAT2U,r3
53         mtspr   IBAT2L,r3
54         mtspr   IBAT3U,r3
55         mtspr   IBAT3L,r3
56
57         mtspr   DBAT0U,r3
58         mtspr   DBAT0L,r3
59         mtspr   DBAT1U,r3
60         mtspr   DBAT1L,r3
61         mtspr   DBAT2U,r3
62         mtspr   DBAT2L,r3
63         mtspr   DBAT3U,r3
64         mtspr   DBAT3L,r3
65 #endif
66
67         /* the bootloader (as far as I'm currently aware) doesn't mess with page
68            tables, but since we're already here, might as well zap these, too */
69         li      r4,0
70         mtspr   SDR1,r4
71
72         li      r4,16
73         mtctr   r4
74         li      r3,0
75         li      r4,0
76 3:      mtsrin  r3,r4
77         addi    r3,r3,1
78         bdnz    3b
79
80 #ifdef CONFIG_SMP
81         /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
82            when in SMP.  Not sure yet whether this should stay or leave... */
83         mfspr   r4,HID0
84         ori     r4,r4,HID0_ABE
85         mtspr   HID0,r4
86         sync
87 #endif /* CONFIG_SMP */
88         blr
89
90 /*  apparently, SMon doesn't pay attention to HID0[SRST].  Disable the MMU and
91     branch to 0xfff00100 */
92 _GLOBAL(_gemini_reboot)
93         lis     r5,GEMINI_BOOT_INIT@h
94         ori     r5,r5,GEMINI_BOOT_INIT@l
95         li      r6,MSR_IP
96         mtspr   SRR0,r5
97         mtspr   SRR1,r6
98         rfi