port-work; won't compile or even work
[ppcskel.git] / hollywood.h
1 /*
2         mini - a Free Software replacement for the Nintendo/BroadOn IOS.
3         Hollywood register definitions
4
5 Copyright (C) 2008, 2009        Haxx Enterprises <bushing@gmail.com>
6 Copyright (C) 2008, 2009        Sven Peter <svenpeter@gmail.com>
7 Copyright (C) 2008, 2009        Hector Martin "marcan" <marcan@marcansoft.com>
8 Copyright (C) 2008, 2009        John Kelley <wiidev@kelley.ca>
9
10 # This code is licensed to you under the terms of the GNU GPL, version 2;
11 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
12 */
13
14 #ifndef __HOLLYWOOD_H__
15 #define __HOLLYWOOD_H__
16
17 /* Hollywood Registers */
18
19 #define         HW_PPC_REG_BASE         0xd000000
20 #define         HW_REG_BASE             0xd800000
21
22 // The PPC can only see the first three IPC registers
23 #define         HW_IPC_PPCMSG           (HW_REG_BASE + 0x000)
24 #define         HW_IPC_PPCCTRL          (HW_REG_BASE + 0x004)
25 #define         HW_IPC_ARMMSG           (HW_REG_BASE + 0x008)
26 #define         HW_IPC_ARMCTRL          (HW_REG_BASE + 0x00c)
27
28 #define         HW_TIMER                (HW_REG_BASE + 0x010)
29 #define         HW_ALARM                (HW_REG_BASE + 0x014)
30
31 #define         HW_PPCIRQFLAG           (HW_REG_BASE + 0x030)
32 #define         HW_PPCIRQMASK           (HW_REG_BASE + 0x034)
33
34 #define         HW_ARMIRQFLAG           (HW_REG_BASE + 0x038)
35 #define         HW_ARMIRQMASK           (HW_REG_BASE + 0x03c)
36
37 #define         HW_MEMMIRR              (HW_REG_BASE + 0x060)
38
39 // something to do with PPCBOOT
40 // and legacy DI it seems ?!?
41 #define         HW_EXICTRL              (HW_REG_BASE + 0x070)
42 #define         EXICTRL_ENABLE_EXI      1
43
44 // PPC side of GPIO1 (Starlet can access this too)
45 // Output state
46 #define         HW_GPIO1BOUT            (HW_REG_BASE + 0x0c0)
47 // Direction (1=output)
48 #define         HW_GPIO1BDIR            (HW_REG_BASE + 0x0c4)
49 // Input state
50 #define         HW_GPIO1BIN             (HW_REG_BASE + 0x0c8)
51 // Interrupt level
52 #define         HW_GPIO1BINTLVL         (HW_REG_BASE + 0x0cc)
53 // Interrupt flags (write 1 to clear)
54 #define         HW_GPIO1BINTFLAG        (HW_REG_BASE + 0x0d0)
55 // Interrupt propagation enable
56 // Do these interrupts go anywhere???
57 #define         HW_GPIO1BINTENABLE      (HW_REG_BASE + 0x0d4)
58 //??? seems to be a mirror of inputs at some point... power-up state?
59 #define         HW_GPIO1BINMIR          (HW_REG_BASE + 0x0d8)
60 // 0xFFFFFF by default, if cleared disables respective outputs. Top bits non-settable.
61 #define         HW_GPIO1ENABLE          (HW_REG_BASE + 0x0dc)
62
63 #define         HW_GPIO1_SLOT           0x000020
64 #define         HW_GPIO1_DEBUG          0xFF0000
65 #define         HW_GPIO1_DEBUG_SH       16
66
67 // Starlet side of GPIO1
68 // Output state
69 #define         HW_GPIO1OUT             (HW_REG_BASE + 0x0e0)
70 // Direction (1=output)
71 #define         HW_GPIO1DIR             (HW_REG_BASE + 0x0e4)
72 // Input state
73 #define         HW_GPIO1IN              (HW_REG_BASE + 0x0e8)
74 // Interrupt level
75 #define         HW_GPIO1INTLVL          (HW_REG_BASE + 0x0ec)
76 // Interrupt flags (write 1 to clear)
77 #define         HW_GPIO1INTFLAG         (HW_REG_BASE + 0x0f0)
78 // Interrupt propagation enable (interrupts go to main interrupt 0x800)
79 #define         HW_GPIO1INTENABLE       (HW_REG_BASE + 0x0f4)
80 //??? seems to be a mirror of inputs at some point... power-up state?
81 #define         HW_GPIO1INMIR           (HW_REG_BASE + 0x0f8)
82 // Owner of each GPIO bit. If 1, GPIO1B registers assume control. If 0, GPIO1 registers assume control.
83 #define         HW_GPIO1OWNER           (HW_REG_BASE + 0x0fc)
84
85 // ????
86 #define         HW_DIFLAGS              (HW_REG_BASE + 0x180)
87 #define         DIFLAGS_BOOT_CODE       0x100000
88
89 // maybe a GPIO???
90 #define         HW_RESETS               (HW_REG_BASE + 0x194)
91
92 #define         HW_CLOCKS               (HW_REG_BASE + 0x1b4)
93
94 #define         HW_GPIO2OUT             (HW_REG_BASE + 0x1c8)
95 #define         HW_GPIO2DIR             (HW_REG_BASE + 0x1cc)
96 #define         HW_GPIO2IN              (HW_REG_BASE + 0x1d0)
97
98 #define         HW_OTPCMD               (HW_REG_BASE + 0x1ec)
99 #define         HW_OTPDATA              (HW_REG_BASE + 0x1f0)
100 #define         HW_VERSION              (HW_REG_BASE + 0x214)
101
102 /* NAND Registers */
103
104 #define         NAND_REG_BASE           0xd010000
105
106 #define         NAND_CMD                (NAND_REG_BASE + 0x000)
107 #define         NAND_STATUS             NAND_CMD
108 #define         NAND_CONF               (NAND_REG_BASE + 0x004)
109 #define         NAND_ADDR0              (NAND_REG_BASE + 0x008)
110 #define         NAND_ADDR1              (NAND_REG_BASE + 0x00c)
111 #define         NAND_DATA               (NAND_REG_BASE + 0x010)
112 #define         NAND_ECC                (NAND_REG_BASE + 0x014)
113 #define         NAND_UNK1               (NAND_REG_BASE + 0x018)
114 #define         NAND_UNK2               (NAND_REG_BASE + 0x01c)
115
116 /* AES Registers */
117
118 #define         AES_REG_BASE            0xd020000
119
120 #define         AES_CMD                 (AES_REG_BASE + 0x000)
121 #define         AES_SRC                 (AES_REG_BASE + 0x004)
122 #define         AES_DEST                (AES_REG_BASE + 0x008)
123 #define         AES_KEY                 (AES_REG_BASE + 0x00c)
124 #define         AES_IV                  (AES_REG_BASE + 0x010)
125
126 /* SHA-1 Registers */
127
128 #define         SHA_REG_BASE            0xd030000
129
130 #define         SHA_CMD                 (SHA_REG_BASE + 0x000)
131 #define         SHA_SRC                 (SHA_REG_BASE + 0x004)
132 #define         SHA_H0                  (SHA_REG_BASE + 0x008)
133 #define         SHA_H1                  (SHA_REG_BASE + 0x00c)
134 #define         SHA_H2                  (SHA_REG_BASE + 0x010)
135 #define         SHA_H3                  (SHA_REG_BASE + 0x014)
136 #define         SHA_H4                  (SHA_REG_BASE + 0x018)
137
138 /* SD Host Controller Registers */
139
140 #define         SDHC_REG_BASE           0xd070000
141
142 /* OHCI0 Registers */
143 #define         OHCI0_REG_BASE          0xd050000
144
145 /* OHCI1 Registers */
146 #define         OHCI1_REG_BASE          0xd060000
147
148 #define         OHCI_HC_REVISION                        0x00
149 #define         OHCI_HC_CONTROL                         0x04
150 #define         OHCI_HC_COMMAND_STATUS          0x08
151 #define         OHCI_HC_INT_STATUS                      0x0C
152
153 #define         OHCI_HC_INT_ENABLE                      0x10
154 #define         OHCI_HC_INT_DISABLE             0x14
155 #define         OHCI_HC_HCCA                            0x18
156 #define         OHCI_HC_PERIOD_CURRENT_ED       0x1C
157
158 #define         OHCI_HC_CTRL_HEAD_ED            0x20
159 #define         OHCI_HC_CTRL_CURRENT_ED         0x24
160 #define         OHCI_HC_BULK_HEAD_ED            0x28
161 #define         OHCI_HC_BULK_CURRENT_ED         0x2C
162
163 #define         OHCI_HC_DONE_HEAD                       0x30
164 #define         OHCI_HC_FM_INTERVAL             0x34
165 #define         OHCI_HC_FM_REMAINING            0x38
166 #define         OHCI_HC_FM_NUMBER                       0x3C
167
168 #define         OHCI_HC_PERIODIC_START          0x40
169 #define         OHCI_HC_LS_THRESHOLD            0x44
170 #define         OHCI_HC_RH_DESCRIPTOR_A         0x48
171 #define         OHCI_HC_RH_DESCRIPTOR_B         0x4C
172
173 #define         OHCI_HC_RH_STATUS                       0x50
174 #define         OHCI_HC_RH_PORT_STATUS_1        0x54
175 #define         OHCI_HC_RH_PORT_STATUS_2        0x58
176
177 /* EHCI Registers */
178 #define         EHCI_REG_BASE           0xd040000
179
180 /* stolen from mikep2 patched linux kernel: drivers/usb/host/ohci-mipc.c */
181 #define         EHCI_CTL                        (EHCI_REG_BASE + 0xCC)
182 #define         EHCI_CTL_OH0INTE                (1<<11) /* oh0 interrupt enable */
183 #define         EHCI_CTL_OH1INTE                (1<<12) /* oh1 interrupt enable */
184
185 /* EXI Registers */
186
187 #define         EXI_REG_BASE            0xd806800
188 #define         EXI0_REG_BASE           (EXI_REG_BASE+0x000)
189 #define         EXI1_REG_BASE           (EXI_REG_BASE+0x014)
190 #define         EXI2_REG_BASE           (EXI_REG_BASE+0x028)
191
192 #define         EXI0_CSR                (EXI0_REG_BASE+0x000)
193 #define         EXI0_MAR                (EXI0_REG_BASE+0x004)
194 #define         EXI0_LENGTH             (EXI0_REG_BASE+0x008)
195 #define         EXI0_CR                 (EXI0_REG_BASE+0x00c)
196 #define         EXI0_DATA               (EXI0_REG_BASE+0x010)
197
198 #define         EXI1_CSR                (EXI1_REG_BASE+0x000)
199 #define         EXI1_MAR                (EXI1_REG_BASE+0x004)
200 #define         EXI1_LENGTH             (EXI1_REG_BASE+0x008)
201 #define         EXI1_CR                 (EXI1_REG_BASE+0x00c)
202 #define         EXI1_DATA               (EXI1_REG_BASE+0x010)
203
204 #define         EXI2_CSR                (EXI2_REG_BASE+0x000)
205 #define         EXI2_MAR                (EXI2_REG_BASE+0x004)
206 #define         EXI2_LENGTH             (EXI2_REG_BASE+0x008)
207 #define         EXI2_CR                 (EXI2_REG_BASE+0x00c)
208 #define         EXI2_DATA               (EXI2_REG_BASE+0x010)
209
210 #define         EXI_BOOT_BASE           (EXI_REG_BASE+0x040)
211
212 /* MEMORY CONTROLLER Registers */
213
214 #define         MEM_REG_BASE            0xd8b4000
215 #define         MEM_PROT                (MEM_REG_BASE+0x20a)
216 #define         MEM_PROT_START          (MEM_REG_BASE+0x20c)
217 #define         MEM_PROT_END            (MEM_REG_BASE+0x20e)
218 #define         MEM_FLUSHREQ            (MEM_REG_BASE+0x228)
219 #define         MEM_FLUSHACK            (MEM_REG_BASE+0x22a)
220
221 #endif