Merge branch 'master' of /home/sam/kernel/linux-2.6/
[pandora-kernel.git] / arch / ppc / platforms / gemini_prom.S
1 /*
2  *  Not really prom support code (yet), but sort of anti-prom code.  The current
3  *  bootloader does a number of things it shouldn't and doesn't do things that it
4  *  should.  The stuff in here is mainly a hodge-podge collection of setup code
5  *  to get the board up and running.
6  *    ---Dan
7  */
8
9 #include <asm/reg.h>
10 #include <asm/page.h>
11 #include <platforms/gemini.h>
12 #include <asm/ppc_asm.h>
13
14 /*
15  *  On 750's the MMU is on when Linux is booted, so we need to clear out the
16  *  bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
17  *  and turn off the MMU.
18  *
19  */
20
21 _GLOBAL(gemini_prom_init)
22 #ifdef CONFIG_SMP
23         /* Since the MMU's on, get stuff in rom space that we'll need */
24         lis     r4,GEMINI_CPUSTAT@h
25         ori     r4,r4,GEMINI_CPUSTAT@l
26         lbz     r5,0(r4)
27         andi.   r5,r5,3
28         mr      r24,r5          /* cpu # used later on */
29 #endif
30         mfmsr   r4
31         li      r3,MSR_PR       /* ensure supervisor! */
32         ori     r3,r3,MSR_IR|MSR_DR
33         andc    r4,r4,r3
34         mtmsr   r4
35         isync
36 #if 0
37         /* zero out the bats now that the MMU is off */
38 prom_no_mmu:    
39         li      r3,0
40         mtspr   SPRN_IBAT0U,r3
41         mtspr   SPRN_IBAT0L,r3
42         mtspr   SPRN_IBAT1U,r3
43         mtspr   SPRN_IBAT1L,r3
44         mtspr   SPRN_IBAT2U,r3
45         mtspr   SPRN_IBAT2L,r3
46         mtspr   SPRN_IBAT3U,r3
47         mtspr   SPRN_IBAT3L,r3
48
49         mtspr   SPRN_DBAT0U,r3
50         mtspr   SPRN_DBAT0L,r3
51         mtspr   SPRN_DBAT1U,r3
52         mtspr   SPRN_DBAT1L,r3
53         mtspr   SPRN_DBAT2U,r3
54         mtspr   SPRN_DBAT2L,r3
55         mtspr   SPRN_DBAT3U,r3
56         mtspr   SPRN_DBAT3L,r3
57 #endif
58
59         /* the bootloader (as far as I'm currently aware) doesn't mess with page
60            tables, but since we're already here, might as well zap these, too */
61         li      r4,0
62         mtspr   SPRN_SDR1,r4
63
64         li      r4,16
65         mtctr   r4
66         li      r3,0
67         li      r4,0
68 3:      mtsrin  r3,r4
69         addi    r3,r3,1
70         bdnz    3b
71
72 #ifdef CONFIG_SMP
73         /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
74            when in SMP.  Not sure yet whether this should stay or leave... */
75         mfspr   r4,SPRN_HID0
76         ori     r4,r4,HID0_ABE
77         mtspr   SPRN_HID0,r4
78         sync
79 #endif /* CONFIG_SMP */
80         blr
81
82 /*  apparently, SMon doesn't pay attention to HID0[SRST].  Disable the MMU and
83     branch to 0xfff00100 */
84 _GLOBAL(_gemini_reboot)
85         lis     r5,GEMINI_BOOT_INIT@h
86         ori     r5,r5,GEMINI_BOOT_INIT@l
87         li      r6,MSR_IP
88         mtspr   SPRN_SRR0,r5
89         mtspr   SPRN_SRR1,r6
90         rfi