3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1k CPU.
6 * Copyright 2000,2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 #include <linux/config.h>
35 #include <linux/delay.h>
38 /* cpu pipeline flush */
39 void static inline au_sync(void)
41 __asm__ volatile ("sync");
44 void static inline au_sync_udelay(int us)
46 __asm__ volatile ("sync");
50 void static inline au_sync_delay(int ms)
52 __asm__ volatile ("sync");
56 void static inline au_writeb(u8 val, int reg)
58 *(volatile u8 *)(reg) = val;
61 void static inline au_writew(u16 val, int reg)
63 *(volatile u16 *)(reg) = val;
66 void static inline au_writel(u32 val, int reg)
68 *(volatile u32 *)(reg) = val;
71 static inline u8 au_readb(unsigned long port)
73 return (*(volatile u8 *)port);
76 static inline u16 au_readw(unsigned long port)
78 return (*(volatile u16 *)port);
81 static inline u32 au_readl(unsigned long port)
83 return (*(volatile u32 *)port);
86 /* arch/mips/au1000/common/clocks.c */
87 extern void set_au1000_speed(unsigned int new_freq);
88 extern unsigned int get_au1000_speed(void);
89 extern void set_au1000_uart_baud_base(unsigned long new_baud_base);
90 extern unsigned long get_au1000_uart_baud_base(void);
91 extern void set_au1000_lcd_clock(void);
92 extern unsigned int get_au1000_lcd_clock(void);
95 /* no CP0 timer irq */
96 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
98 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
101 /* SDRAM Controller */
102 #define MEM_SDMODE0 0xB4000000
103 #define MEM_SDMODE1 0xB4000004
104 #define MEM_SDMODE2 0xB4000008
106 #define MEM_SDADDR0 0xB400000C
107 #define MEM_SDADDR1 0xB4000010
108 #define MEM_SDADDR2 0xB4000014
110 #define MEM_SDREFCFG 0xB4000018
111 #define MEM_SDPRECMD 0xB400001C
112 #define MEM_SDAUTOREF 0xB4000020
114 #define MEM_SDWRMD0 0xB4000024
115 #define MEM_SDWRMD1 0xB4000028
116 #define MEM_SDWRMD2 0xB400002C
118 #define MEM_SDSLEEP 0xB4000030
119 #define MEM_SDSMCKE 0xB4000034
121 /* Static Bus Controller */
122 #define MEM_STCFG0 0xB4001000
123 #define MEM_STTIME0 0xB4001004
124 #define MEM_STADDR0 0xB4001008
126 #define MEM_STCFG1 0xB4001010
127 #define MEM_STTIME1 0xB4001014
128 #define MEM_STADDR1 0xB4001018
130 #define MEM_STCFG2 0xB4001020
131 #define MEM_STTIME2 0xB4001024
132 #define MEM_STADDR2 0xB4001028
134 #define MEM_STCFG3 0xB4001030
135 #define MEM_STTIME3 0xB4001034
136 #define MEM_STADDR3 0xB4001038
138 /* Interrupt Controller 0 */
139 #define IC0_CFG0RD 0xB0400040
140 #define IC0_CFG0SET 0xB0400040
141 #define IC0_CFG0CLR 0xB0400044
143 #define IC0_CFG1RD 0xB0400048
144 #define IC0_CFG1SET 0xB0400048
145 #define IC0_CFG1CLR 0xB040004C
147 #define IC0_CFG2RD 0xB0400050
148 #define IC0_CFG2SET 0xB0400050
149 #define IC0_CFG2CLR 0xB0400054
151 #define IC0_REQ0INT 0xB0400054
152 #define IC0_SRCRD 0xB0400058
153 #define IC0_SRCSET 0xB0400058
154 #define IC0_SRCCLR 0xB040005C
155 #define IC0_REQ1INT 0xB040005C
157 #define IC0_ASSIGNRD 0xB0400060
158 #define IC0_ASSIGNSET 0xB0400060
159 #define IC0_ASSIGNCLR 0xB0400064
161 #define IC0_WAKERD 0xB0400068
162 #define IC0_WAKESET 0xB0400068
163 #define IC0_WAKECLR 0xB040006C
165 #define IC0_MASKRD 0xB0400070
166 #define IC0_MASKSET 0xB0400070
167 #define IC0_MASKCLR 0xB0400074
169 #define IC0_RISINGRD 0xB0400078
170 #define IC0_RISINGCLR 0xB0400078
171 #define IC0_FALLINGRD 0xB040007C
172 #define IC0_FALLINGCLR 0xB040007C
174 #define IC0_TESTBIT 0xB0400080
176 /* Interrupt Controller 1 */
177 #define IC1_CFG0RD 0xB1800040
178 #define IC1_CFG0SET 0xB1800040
179 #define IC1_CFG0CLR 0xB1800044
181 #define IC1_CFG1RD 0xB1800048
182 #define IC1_CFG1SET 0xB1800048
183 #define IC1_CFG1CLR 0xB180004C
185 #define IC1_CFG2RD 0xB1800050
186 #define IC1_CFG2SET 0xB1800050
187 #define IC1_CFG2CLR 0xB1800054
189 #define IC1_REQ0INT 0xB1800054
190 #define IC1_SRCRD 0xB1800058
191 #define IC1_SRCSET 0xB1800058
192 #define IC1_SRCCLR 0xB180005C
193 #define IC1_REQ1INT 0xB180005C
195 #define IC1_ASSIGNRD 0xB1800060
196 #define IC1_ASSIGNSET 0xB1800060
197 #define IC1_ASSIGNCLR 0xB1800064
199 #define IC1_WAKERD 0xB1800068
200 #define IC1_WAKESET 0xB1800068
201 #define IC1_WAKECLR 0xB180006C
203 #define IC1_MASKRD 0xB1800070
204 #define IC1_MASKSET 0xB1800070
205 #define IC1_MASKCLR 0xB1800074
207 #define IC1_RISINGRD 0xB1800078
208 #define IC1_RISINGCLR 0xB1800078
209 #define IC1_FALLINGRD 0xB180007C
210 #define IC1_FALLINGCLR 0xB180007C
212 #define IC1_TESTBIT 0xB1800080
214 /* Interrupt Configuration Modes */
215 #define INTC_INT_DISABLED 0
216 #define INTC_INT_RISE_EDGE 0x1
217 #define INTC_INT_FALL_EDGE 0x2
218 #define INTC_INT_RISE_AND_FALL_EDGE 0x3
219 #define INTC_INT_HIGH_LEVEL 0x5
220 #define INTC_INT_LOW_LEVEL 0x6
221 #define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
223 /* Interrupt Numbers */
224 #define AU1000_UART0_INT 0
225 #define AU1000_UART1_INT 1 /* au1000 */
226 #define AU1000_UART2_INT 2 /* au1000 */
228 #define AU1000_PCI_INTA 1 /* au1500 */
229 #define AU1000_PCI_INTB 2 /* au1500 */
231 #define AU1000_UART3_INT 3
233 #define AU1000_SSI0_INT 4 /* au1000 */
234 #define AU1000_SSI1_INT 5 /* au1000 */
236 #define AU1000_PCI_INTC 4 /* au1500 */
237 #define AU1000_PCI_INTD 5 /* au1500 */
239 #define AU1000_DMA_INT_BASE 6
240 #define AU1000_TOY_INT 14
241 #define AU1000_TOY_MATCH0_INT 15
242 #define AU1000_TOY_MATCH1_INT 16
243 #define AU1000_TOY_MATCH2_INT 17
244 #define AU1000_RTC_INT 18
245 #define AU1000_RTC_MATCH0_INT 19
246 #define AU1000_RTC_MATCH1_INT 20
247 #define AU1000_RTC_MATCH2_INT 21
248 #define AU1000_IRDA_TX_INT 22 /* au1000 */
249 #define AU1000_IRDA_RX_INT 23 /* au1000 */
250 #define AU1000_USB_DEV_REQ_INT 24
251 #define AU1000_USB_DEV_SUS_INT 25
252 #define AU1000_USB_HOST_INT 26
253 #define AU1000_ACSYNC_INT 27
254 #define AU1000_MAC0_DMA_INT 28
255 #define AU1000_MAC1_DMA_INT 29
256 #define AU1000_ETH0_IRQ AU1000_MAC0_DMA_INT
257 #define AU1000_ETH1_IRQ AU1000_MAC1_DMA_INT
258 #define AU1000_I2S_UO_INT 30 /* au1000 */
259 #define AU1000_AC97C_INT 31
260 #define AU1000_LAST_INTC0_INT AU1000_AC97C_INT
261 #define AU1000_GPIO_0 32
262 #define AU1000_GPIO_1 33
263 #define AU1000_GPIO_2 34
264 #define AU1000_GPIO_3 35
265 #define AU1000_GPIO_4 36
266 #define AU1000_GPIO_5 37
267 #define AU1000_GPIO_6 38
268 #define AU1000_GPIO_7 39
269 #define AU1000_GPIO_8 40
270 #define AU1000_GPIO_9 41
271 #define AU1000_GPIO_10 42
272 #define AU1000_GPIO_11 43
273 #define AU1000_GPIO_12 44
274 #define AU1000_GPIO_13 45
275 #define AU1000_GPIO_14 46
276 #define AU1000_GPIO_15 47
279 #define AU1000_GPIO_16 48
280 #define AU1000_GPIO_17 49
281 #define AU1000_GPIO_18 50
282 #define AU1000_GPIO_19 51
283 #define AU1000_GPIO_20 52
284 #define AU1000_GPIO_21 53
285 #define AU1000_GPIO_22 54
286 #define AU1000_GPIO_23 55
287 #define AU1000_GPIO_24 56
288 #define AU1000_GPIO_25 57
289 #define AU1000_GPIO_26 58
290 #define AU1000_GPIO_27 59
291 #define AU1000_GPIO_28 60
292 #define AU1000_GPIO_29 61
293 #define AU1000_GPIO_30 62
294 #define AU1000_GPIO_31 63
297 #define AU1500_GPIO_200 48
298 #define AU1500_GPIO_201 49
299 #define AU1500_GPIO_202 50
300 #define AU1500_GPIO_203 51
301 #define AU1500_GPIO_20 52
302 #define AU1500_GPIO_204 53
303 #define AU1500_GPIO_205 54
304 #define AU1500_GPIO_23 55
305 #define AU1500_GPIO_24 56
306 #define AU1500_GPIO_25 57
307 #define AU1500_GPIO_26 58
308 #define AU1500_GPIO_27 59
309 #define AU1500_GPIO_28 60
310 #define AU1500_GPIO_206 61
311 #define AU1500_GPIO_207 62
312 #define AU1500_GPIO_208_215 63
314 #define AU1000_MAX_INTR 63
317 #define AU1100_GPIO_208_215 29
318 // REDEFINE SECONDARY GPIO BLOCK INTO IC1 CONTROLLER HERE
322 /* Programmable Counters 0 and 1 */
323 #define SYS_BASE 0xB1900000
324 #define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
325 #define SYS_CNTRL_E1S (1<<23)
326 #define SYS_CNTRL_T1S (1<<20)
327 #define SYS_CNTRL_M21 (1<<19)
328 #define SYS_CNTRL_M11 (1<<18)
329 #define SYS_CNTRL_M01 (1<<17)
330 #define SYS_CNTRL_C1S (1<<16)
331 #define SYS_CNTRL_BP (1<<14)
332 #define SYS_CNTRL_EN1 (1<<13)
333 #define SYS_CNTRL_BT1 (1<<12)
334 #define SYS_CNTRL_EN0 (1<<11)
335 #define SYS_CNTRL_BT0 (1<<10)
336 #define SYS_CNTRL_E0 (1<<8)
337 #define SYS_CNTRL_E0S (1<<7)
338 #define SYS_CNTRL_32S (1<<5)
339 #define SYS_CNTRL_T0S (1<<4)
340 #define SYS_CNTRL_M20 (1<<3)
341 #define SYS_CNTRL_M10 (1<<2)
342 #define SYS_CNTRL_M00 (1<<1)
343 #define SYS_CNTRL_C0S (1<<0)
345 /* Programmable Counter 0 Registers */
346 #define SYS_TOYTRIM (SYS_BASE + 0)
347 #define SYS_TOYWRITE (SYS_BASE + 4)
348 #define SYS_TOYMATCH0 (SYS_BASE + 8)
349 #define SYS_TOYMATCH1 (SYS_BASE + 0xC)
350 #define SYS_TOYMATCH2 (SYS_BASE + 0x10)
351 #define SYS_TOYREAD (SYS_BASE + 0x40)
353 /* Programmable Counter 1 Registers */
354 #define SYS_RTCTRIM (SYS_BASE + 0x44)
355 #define SYS_RTCWRITE (SYS_BASE + 0x48)
356 #define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
357 #define SYS_RTCMATCH1 (SYS_BASE + 0x50)
358 #define SYS_RTCMATCH2 (SYS_BASE + 0x54)
359 #define SYS_RTCREAD (SYS_BASE + 0x58)
362 #define I2S_DATA 0xB1000000
363 #define I2S_DATA_MASK (0xffffff)
364 #define I2S_CONFIG 0xB1000004
365 #define I2S_CONFIG_XU (1<<25)
366 #define I2S_CONFIG_XO (1<<24)
367 #define I2S_CONFIG_RU (1<<23)
368 #define I2S_CONFIG_RO (1<<22)
369 #define I2S_CONFIG_TR (1<<21)
370 #define I2S_CONFIG_TE (1<<20)
371 #define I2S_CONFIG_TF (1<<19)
372 #define I2S_CONFIG_RR (1<<18)
373 #define I2S_CONFIG_RE (1<<17)
374 #define I2S_CONFIG_RF (1<<16)
375 #define I2S_CONFIG_PD (1<<11)
376 #define I2S_CONFIG_LB (1<<10)
377 #define I2S_CONFIG_IC (1<<9)
378 #define I2S_CONFIG_FM_BIT 7
379 #define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
380 #define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
381 #define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
382 #define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
383 #define I2S_CONFIG_TN (1<<6)
384 #define I2S_CONFIG_RN (1<<5)
385 #define I2S_CONFIG_SZ_BIT 0
386 #define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
388 #define I2S_CONTROL 0xB1000008
389 #define I2S_CONTROL_D (1<<1)
390 #define I2S_CONTROL_CE (1<<0)
392 /* USB Host Controller */
393 // We pass USB_OHCI_BASE to ioremap, so it needs to be a physical address
394 #define USB_OHCI_BASE 0x10100000
395 #define USB_OHCI_LEN 0x00100000
396 #define USB_HOST_CONFIG 0xB017fffc
398 /* USB Device Controller */
399 #define USBD_EP0RD 0xB0200000
400 #define USBD_EP0WR 0xB0200004
401 #define USBD_EP2WR 0xB0200008
402 #define USBD_EP3WR 0xB020000C
403 #define USBD_EP4RD 0xB0200010
404 #define USBD_EP5RD 0xB0200014
405 #define USBD_INTEN 0xB0200018
406 #define USBD_INTSTAT 0xB020001C
407 #define USBDEV_INT_SOF (1<<12)
408 #define USBDEV_INT_HF_BIT 6
409 #define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
410 #define USBDEV_INT_CMPLT_BIT 0
411 #define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
412 #define USBD_CONFIG 0xB0200020
413 #define USBD_EP0CS 0xB0200024
414 #define USBD_EP2CS 0xB0200028
415 #define USBD_EP3CS 0xB020002C
416 #define USBD_EP4CS 0xB0200030
417 #define USBD_EP5CS 0xB0200034
418 #define USBDEV_CS_SU (1<<14)
419 #define USBDEV_CS_NAK (1<<13)
420 #define USBDEV_CS_ACK (1<<12)
421 #define USBDEV_CS_BUSY (1<<11)
422 #define USBDEV_CS_TSIZE_BIT 1
423 #define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
424 #define USBDEV_CS_STALL (1<<0)
425 #define USBD_EP0RDSTAT 0xB0200040
426 #define USBD_EP0WRSTAT 0xB0200044
427 #define USBD_EP2WRSTAT 0xB0200048
428 #define USBD_EP3WRSTAT 0xB020004C
429 #define USBD_EP4RDSTAT 0xB0200050
430 #define USBD_EP5RDSTAT 0xB0200054
431 #define USBDEV_FSTAT_FLUSH (1<<6)
432 #define USBDEV_FSTAT_UF (1<<5)
433 #define USBDEV_FSTAT_OF (1<<4)
434 #define USBDEV_FSTAT_FCNT_BIT 0
435 #define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
436 #define USBD_ENABLE 0xB0200058
437 #define USBDEV_ENABLE (1<<1)
438 #define USBDEV_CE (1<<0)
440 /* Ethernet Controllers */
441 #define AU1000_ETH0_BASE 0xB0500000
442 #define AU1000_ETH1_BASE 0xB0510000
443 #define AU1500_ETH0_BASE 0xB1500000
444 #define AU1500_ETH1_BASE 0xB1510000
445 #define AU1100_ETH0_BASE 0xB0500000
447 /* 4 byte offsets from AU1000_ETH_BASE */
448 #define MAC_CONTROL 0x0
449 #define MAC_RX_ENABLE (1<<2)
450 #define MAC_TX_ENABLE (1<<3)
451 #define MAC_DEF_CHECK (1<<5)
452 #define MAC_SET_BL(X) (((X)&0x3)<<6)
453 #define MAC_AUTO_PAD (1<<8)
454 #define MAC_DISABLE_RETRY (1<<10)
455 #define MAC_DISABLE_BCAST (1<<11)
456 #define MAC_LATE_COL (1<<12)
457 #define MAC_HASH_MODE (1<<13)
458 #define MAC_HASH_ONLY (1<<15)
459 #define MAC_PASS_ALL (1<<16)
460 #define MAC_INVERSE_FILTER (1<<17)
461 #define MAC_PROMISCUOUS (1<<18)
462 #define MAC_PASS_ALL_MULTI (1<<19)
463 #define MAC_FULL_DUPLEX (1<<20)
464 #define MAC_NORMAL_MODE 0
465 #define MAC_INT_LOOPBACK (1<<21)
466 #define MAC_EXT_LOOPBACK (1<<22)
467 #define MAC_DISABLE_RX_OWN (1<<23)
468 #define MAC_BIG_ENDIAN (1<<30)
469 #define MAC_RX_ALL (1<<31)
470 #define MAC_ADDRESS_HIGH 0x4
471 #define MAC_ADDRESS_LOW 0x8
472 #define MAC_MCAST_HIGH 0xC
473 #define MAC_MCAST_LOW 0x10
474 #define MAC_MII_CNTRL 0x14
475 #define MAC_MII_BUSY (1<<0)
476 #define MAC_MII_READ 0
477 #define MAC_MII_WRITE (1<<1)
478 #define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6)
479 #define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11)
480 #define MAC_MII_DATA 0x18
481 #define MAC_FLOW_CNTRL 0x1C
482 #define MAC_FLOW_CNTRL_BUSY (1<<0)
483 #define MAC_FLOW_CNTRL_ENABLE (1<<1)
484 #define MAC_PASS_CONTROL (1<<2)
485 #define MAC_SET_PAUSE(X) (((X)&0xffff)<<16)
486 #define MAC_VLAN1_TAG 0x20
487 #define MAC_VLAN2_TAG 0x24
489 /* Ethernet Controller Enable */
490 #define AU1000_MAC0_ENABLE 0xB0520000
491 #define AU1000_MAC1_ENABLE 0xB0520004
492 #define AU1500_MAC0_ENABLE 0xB1520000
493 #define AU1500_MAC1_ENABLE 0xB1520004
494 #define AU1100_MAC0_ENABLE 0xB0520000
496 #define MAC_EN_CLOCK_ENABLE (1<<0)
497 #define MAC_EN_RESET0 (1<<1)
498 #define MAC_EN_TOSS (0<<2)
499 #define MAC_EN_CACHEABLE (1<<3)
500 #define MAC_EN_RESET1 (1<<4)
501 #define MAC_EN_RESET2 (1<<5)
502 #define MAC_DMA_RESET (1<<6)
504 /* Ethernet Controller DMA Channels */
506 #define MAC0_TX_DMA_ADDR 0xB4004000
507 #define MAC1_TX_DMA_ADDR 0xB4004200
508 /* offsets from MAC_TX_RING_ADDR address */
509 #define MAC_TX_BUFF0_STATUS 0x0
510 #define TX_FRAME_ABORTED (1<<0)
511 #define TX_JAB_TIMEOUT (1<<1)
512 #define TX_NO_CARRIER (1<<2)
513 #define TX_LOSS_CARRIER (1<<3)
514 #define TX_EXC_DEF (1<<4)
515 #define TX_LATE_COLL_ABORT (1<<5)
516 #define TX_EXC_COLL (1<<6)
517 #define TX_UNDERRUN (1<<7)
518 #define TX_DEFERRED (1<<8)
519 #define TX_LATE_COLL (1<<9)
520 #define TX_COLL_CNT_MASK (0xF<<10)
521 #define TX_PKT_RETRY (1<<31)
522 #define MAC_TX_BUFF0_ADDR 0x4
523 #define TX_DMA_ENABLE (1<<0)
524 #define TX_T_DONE (1<<1)
525 #define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
526 #define MAC_TX_BUFF0_LEN 0x8
527 #define MAC_TX_BUFF1_STATUS 0x10
528 #define MAC_TX_BUFF1_ADDR 0x14
529 #define MAC_TX_BUFF1_LEN 0x18
530 #define MAC_TX_BUFF2_STATUS 0x20
531 #define MAC_TX_BUFF2_ADDR 0x24
532 #define MAC_TX_BUFF2_LEN 0x28
533 #define MAC_TX_BUFF3_STATUS 0x30
534 #define MAC_TX_BUFF3_ADDR 0x34
535 #define MAC_TX_BUFF3_LEN 0x38
537 #define MAC0_RX_DMA_ADDR 0xB4004100
538 #define MAC1_RX_DMA_ADDR 0xB4004300
539 /* offsets from MAC_RX_RING_ADDR */
540 #define MAC_RX_BUFF0_STATUS 0x0
541 #define RX_FRAME_LEN_MASK 0x3fff
542 #define RX_WDOG_TIMER (1<<14)
543 #define RX_RUNT (1<<15)
544 #define RX_OVERLEN (1<<16)
545 #define RX_COLL (1<<17)
546 #define RX_ETHER (1<<18)
547 #define RX_MII_ERROR (1<<19)
548 #define RX_DRIBBLING (1<<20)
549 #define RX_CRC_ERROR (1<<21)
550 #define RX_VLAN1 (1<<22)
551 #define RX_VLAN2 (1<<23)
552 #define RX_LEN_ERROR (1<<24)
553 #define RX_CNTRL_FRAME (1<<25)
554 #define RX_U_CNTRL_FRAME (1<<26)
555 #define RX_MCAST_FRAME (1<<27)
556 #define RX_BCAST_FRAME (1<<28)
557 #define RX_FILTER_FAIL (1<<29)
558 #define RX_PACKET_FILTER (1<<30)
559 #define RX_MISSED_FRAME (1<<31)
561 #define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
562 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
563 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
564 #define MAC_RX_BUFF0_ADDR 0x4
565 #define RX_DMA_ENABLE (1<<0)
566 #define RX_T_DONE (1<<1)
567 #define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
568 #define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0)
569 #define MAC_RX_BUFF1_STATUS 0x10
570 #define MAC_RX_BUFF1_ADDR 0x14
571 #define MAC_RX_BUFF2_STATUS 0x20
572 #define MAC_RX_BUFF2_ADDR 0x24
573 #define MAC_RX_BUFF3_STATUS 0x30
574 #define MAC_RX_BUFF3_ADDR 0x34
578 #define UART_BASE 0xB1100000
579 #define UART0_ADDR 0xB1100000
580 #define UART1_ADDR 0xB1200000
581 #define UART2_ADDR 0xB1300000
582 #define UART3_ADDR 0xB1400000
584 #define UART_RX 0 /* Receive buffer */
585 #define UART_TX 4 /* Transmit buffer */
586 #define UART_IER 8 /* Interrupt Enable Register */
587 #define UART_IIR 0xC /* Interrupt ID Register */
588 #define UART_FCR 0x10 /* FIFO Control Register */
589 #define UART_LCR 0x14 /* Line Control Register */
590 #define UART_MCR 0x18 /* Modem Control Register */
591 #define UART_LSR 0x1C /* Line Status Register */
592 #define UART_MSR 0x20 /* Modem Status Register */
593 #define UART_CLK 0x28 /* Baud Rate Clock Divider */
594 #define UART_MOD_CNTRL 0x100 /* Module Control */
596 #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
597 #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
598 #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */
599 #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */
600 #define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */
601 #define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */
602 #define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */
603 #define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */
604 #define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */
605 #define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */
606 #define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */
607 #define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */
608 #define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */
611 * These are the definitions for the Line Control Register
613 #define UART_LCR_SBC 0x40 /* Set break control */
614 #define UART_LCR_SPAR 0x20 /* Stick parity (?) */
615 #define UART_LCR_EPAR 0x10 /* Even parity select */
616 #define UART_LCR_PARITY 0x08 /* Parity Enable */
617 #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
618 #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */
619 #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */
620 #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
621 #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
624 * These are the definitions for the Line Status Register
626 #define UART_LSR_TEMT 0x40 /* Transmitter empty */
627 #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
628 #define UART_LSR_BI 0x10 /* Break interrupt indicator */
629 #define UART_LSR_FE 0x08 /* Frame error indicator */
630 #define UART_LSR_PE 0x04 /* Parity error indicator */
631 #define UART_LSR_OE 0x02 /* Overrun error indicator */
632 #define UART_LSR_DR 0x01 /* Receiver data ready */
635 * These are the definitions for the Interrupt Identification Register
637 #define UART_IIR_NO_INT 0x01 /* No interrupts pending */
638 #define UART_IIR_ID 0x06 /* Mask for the interrupt ID */
639 #define UART_IIR_MSI 0x00 /* Modem status interrupt */
640 #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
641 #define UART_IIR_RDI 0x04 /* Receiver data interrupt */
642 #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
645 * These are the definitions for the Interrupt Enable Register
647 #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */
648 #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */
649 #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */
650 #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */
653 * These are the definitions for the Modem Control Register
655 #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
656 #define UART_MCR_OUT2 0x08 /* Out2 complement */
657 #define UART_MCR_OUT1 0x04 /* Out1 complement */
658 #define UART_MCR_RTS 0x02 /* RTS complement */
659 #define UART_MCR_DTR 0x01 /* DTR complement */
662 * These are the definitions for the Modem Status Register
664 #define UART_MSR_DCD 0x80 /* Data Carrier Detect */
665 #define UART_MSR_RI 0x40 /* Ring Indicator */
666 #define UART_MSR_DSR 0x20 /* Data Set Ready */
667 #define UART_MSR_CTS 0x10 /* Clear to Send */
668 #define UART_MSR_DDCD 0x08 /* Delta DCD */
669 #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */
670 #define UART_MSR_DDSR 0x02 /* Delta DSR */
671 #define UART_MSR_DCTS 0x01 /* Delta CTS */
672 #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
677 #define SSI0_STATUS 0xB1600000
678 #define SSI_STATUS_BF (1<<4)
679 #define SSI_STATUS_OF (1<<3)
680 #define SSI_STATUS_UF (1<<2)
681 #define SSI_STATUS_D (1<<1)
682 #define SSI_STATUS_B (1<<0)
683 #define SSI0_INT 0xB1600004
684 #define SSI_INT_OI (1<<3)
685 #define SSI_INT_UI (1<<2)
686 #define SSI_INT_DI (1<<1)
687 #define SSI0_INT_ENABLE 0xB1600008
688 #define SSI_INTE_OIE (1<<3)
689 #define SSI_INTE_UIE (1<<2)
690 #define SSI_INTE_DIE (1<<1)
691 #define SSI0_CONFIG 0xB1600020
692 #define SSI_CONFIG_AO (1<<24)
693 #define SSI_CONFIG_DO (1<<23)
694 #define SSI_CONFIG_ALEN_BIT 20
695 #define SSI_CONFIG_ALEN_MASK (0x7<<20)
696 #define SSI_CONFIG_DLEN_BIT 16
697 #define SSI_CONFIG_DLEN_MASK (0x7<<16)
698 #define SSI_CONFIG_DD (1<<11)
699 #define SSI_CONFIG_AD (1<<10)
700 #define SSI_CONFIG_BM_BIT 8
701 #define SSI_CONFIG_BM_MASK (0x3<<8)
702 #define SSI_CONFIG_CE (1<<7)
703 #define SSI_CONFIG_DP (1<<6)
704 #define SSI_CONFIG_DL (1<<5)
705 #define SSI_CONFIG_EP (1<<4)
706 #define SSI0_ADATA 0xB1600024
707 #define SSI_AD_D (1<<24)
708 #define SSI_AD_ADDR_BIT 16
709 #define SSI_AD_ADDR_MASK (0xff<<16)
710 #define SSI_AD_DATA_BIT 0
711 #define SSI_AD_DATA_MASK (0xfff<<0)
712 #define SSI0_CLKDIV 0xB1600028
713 #define SSI0_CONTROL 0xB1600100
714 #define SSI_CONTROL_CD (1<<1)
715 #define SSI_CONTROL_E (1<<0)
718 #define SSI1_STATUS 0xB1680000
719 #define SSI1_INT 0xB1680004
720 #define SSI1_INT_ENABLE 0xB1680008
721 #define SSI1_CONFIG 0xB1680020
722 #define SSI1_ADATA 0xB1680024
723 #define SSI1_CLKDIV 0xB1680028
724 #define SSI1_CONTROL 0xB1680100
726 /* IrDA Controller */
727 #define IRDA_BASE 0xB0300000
728 #define IR_RING_PTR_STATUS (IRDA_BASE+0x00)
729 #define IR_RING_BASE_ADDR_H (IRDA_BASE+0x04)
730 #define IR_RING_BASE_ADDR_L (IRDA_BASE+0x08)
731 #define IR_RING_SIZE (IRDA_BASE+0x0C)
732 #define IR_RING_PROMPT (IRDA_BASE+0x10)
733 #define IR_RING_ADDR_CMPR (IRDA_BASE+0x14)
734 #define IR_INT_CLEAR (IRDA_BASE+0x18)
735 #define IR_CONFIG_1 (IRDA_BASE+0x20)
736 #define IR_RX_INVERT_LED (1<<0)
737 #define IR_TX_INVERT_LED (1<<1)
740 #define IR_SIR (1<<4)
741 #define IR_MIR (1<<5)
742 #define IR_FIR (1<<6)
743 #define IR_16CRC (1<<7)
745 #define IR_RX_ALL (1<<9)
746 #define IR_DMA_ENABLE (1<<10)
747 #define IR_RX_ENABLE (1<<11)
748 #define IR_TX_ENABLE (1<<12)
749 #define IR_LOOPBACK (1<<14)
750 #define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
751 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
752 #define IR_SIR_FLAGS (IRDA_BASE+0x24)
753 #define IR_ENABLE (IRDA_BASE+0x28)
754 #define IR_RX_STATUS (1<<9)
755 #define IR_TX_STATUS (1<<10)
756 #define IR_READ_PHY_CONFIG (IRDA_BASE+0x2C)
757 #define IR_WRITE_PHY_CONFIG (IRDA_BASE+0x30)
758 #define IR_MAX_PKT_LEN (IRDA_BASE+0x34)
759 #define IR_RX_BYTE_CNT (IRDA_BASE+0x38)
760 #define IR_CONFIG_2 (IRDA_BASE+0x3C)
761 #define IR_MODE_INV (1<<0)
762 #define IR_ONE_PIN (1<<1)
763 #define IR_INTERFACE_CONFIG (IRDA_BASE+0x40)
766 #define SYS_PINFUNC 0xB190002C
767 #define SYS_PF_USB (1<<15) /* 2nd USB device/host */
768 #define SYS_PF_U3 (1<<14) /* GPIO23/U3TXD */
769 #define SYS_PF_U2 (1<<13) /* GPIO22/U2TXD */
770 #define SYS_PF_U1 (1<<12) /* GPIO21/U1TXD */
771 #define SYS_PF_SRC (1<<11) /* GPIO6/SROMCKE */
772 #define SYS_PF_CK5 (1<<10) /* GPIO3/CLK5 */
773 #define SYS_PF_CK4 (1<<9) /* GPIO2/CLK4 */
774 #define SYS_PF_IRF (1<<8) /* GPIO15/IRFIRSEL */
775 #define SYS_PF_UR3 (1<<7) /* GPIO[14:9]/UART3 */
776 #define SYS_PF_I2D (1<<6) /* GPIO8/I2SDI */
777 #define SYS_PF_I2S (1<<5) /* I2S/GPIO[29:31] */
778 #define SYS_PF_NI2 (1<<4) /* NI2/GPIO[24:28] */
779 #define SYS_PF_U0 (1<<3) /* U0TXD/GPIO20 */
780 #define SYS_PF_RD (1<<2) /* IRTXD/GPIO19 */
781 #define SYS_PF_A97 (1<<1) /* AC97/SSL1 */
782 #define SYS_PF_S0 (1<<0) /* SSI_0/GPIO[16:18] */
783 #define SYS_TRIOUTRD 0xB1900100
784 #define SYS_TRIOUTCLR 0xB1900100
785 #define SYS_OUTPUTRD 0xB1900108
786 #define SYS_OUTPUTSET 0xB1900108
787 #define SYS_OUTPUTCLR 0xB190010C
788 #define SYS_PINSTATERD 0xB1900110
789 #define SYS_PININPUTEN 0xB1900110
791 /* GPIO2, Au1500 only */
792 #define GPIO2_BASE 0xB1700000
793 #define GPIO2_DIR (GPIO2_BASE + 0)
794 #define GPIO2_DATA_EN (GPIO2_BASE + 8)
795 #define GPIO2_PIN_STATE (GPIO2_BASE + 0xC)
796 #define GPIO2_INT_MASK (GPIO2_BASE + 0x10)
797 #define GPIO2_CONTROL (GPIO2_BASE + 0x14)
799 /* Power Management */
800 #define SYS_SCRATCH0 0xB1900018
801 #define SYS_SCRATCH1 0xB190001C
802 #define SYS_WAKEMSK 0xB1900034
803 #define SYS_ENDIAN 0xB1900038
804 #define SYS_POWERCTRL 0xB190003C
805 #define SYS_WAKESRC 0xB190005C
806 #define SYS_SLPPWR 0xB1900078
807 #define SYS_SLEEP 0xB190007C
809 /* Clock Controller */
810 #define SYS_FREQCTRL0 0xB1900020
811 #define SYS_FC_FRDIV2_BIT 22
812 #define SYS_FC_FRDIV2_MASK (0xff << FQC2_FRDIV2_BIT)
813 #define SYS_FC_FE2 (1<<21)
814 #define SYS_FC_FS2 (1<<20)
815 #define SYS_FC_FRDIV1_BIT 12
816 #define SYS_FC_FRDIV1_MASK (0xff << FQC2_FRDIV1_BIT)
817 #define SYS_FC_FE1 (1<<11)
818 #define SYS_FC_FS1 (1<<10)
819 #define SYS_FC_FRDIV0_BIT 2
820 #define SYS_FC_FRDIV0_MASK (0xff << FQC2_FRDIV0_BIT)
821 #define SYS_FC_FE0 (1<<1)
822 #define SYS_FC_FS0 (1<<0)
823 #define SYS_FREQCTRL1 0xB1900024
824 #define SYS_FC_FRDIV5_BIT 22
825 #define SYS_FC_FRDIV5_MASK (0xff << FQC2_FRDIV5_BIT)
826 #define SYS_FC_FE5 (1<<21)
827 #define SYS_FC_FS5 (1<<20)
828 #define SYS_FC_FRDIV4_BIT 12
829 #define SYS_FC_FRDIV4_MASK (0xff << FQC2_FRDIV4_BIT)
830 #define SYS_FC_FE4 (1<<11)
831 #define SYS_FC_FS4 (1<<10)
832 #define SYS_FC_FRDIV3_BIT 2
833 #define SYS_FC_FRDIV3_MASK (0xff << FQC2_FRDIV3_BIT)
834 #define SYS_FC_FE3 (1<<1)
835 #define SYS_FC_FS3 (1<<0)
836 #define SYS_CLKSRC 0xB1900028
837 #define SYS_CS_ME1_BIT 27
838 #define SYS_CS_ME1_MASK (0x7<<CSC_ME1_BIT)
839 #define SYS_CS_DE1 (1<<26)
840 #define SYS_CS_CE1 (1<<25)
841 #define SYS_CS_ME0_BIT 22
842 #define SYS_CS_ME0_MASK (0x7<<CSC_ME0_BIT)
843 #define SYS_CS_DE0 (1<<21)
844 #define SYS_CS_CE0 (1<<20)
845 #define SYS_CS_MI2_BIT 17
846 #define SYS_CS_MI2_MASK (0x7<<CSC_MI2_BIT)
847 #define SYS_CS_DI2 (1<<16)
848 #define SYS_CS_CI2 (1<<15)
849 #define SYS_CS_MUH_BIT 12
850 #define SYS_CS_MUH_MASK (0x7<<CSC_MUH_BIT)
851 #define SYS_CS_DUH (1<<11)
852 #define SYS_CS_CUH (1<<10)
853 #define SYS_CS_MUD_BIT 7
854 #define SYS_CS_MUD_MASK (0x7<<CSC_MUD_BIT)
855 #define SYS_CS_DUD (1<<6)
856 #define SYS_CS_CUD (1<<5)
857 #define SYS_CS_MIR_BIT 2
858 #define SYS_CS_MIR_MASK (0x7<<CSC_MIR_BIT)
859 #define SYS_CS_DIR (1<<1)
860 #define SYS_CS_CIR (1<<0)
862 #define SYS_CS_MUX_AUX 0x1
863 #define SYS_CS_MUX_FQ0 0x2
864 #define SYS_CS_MUX_FQ1 0x3
865 #define SYS_CS_MUX_FQ2 0x4
866 #define SYS_CS_MUX_FQ3 0x5
867 #define SYS_CS_MUX_FQ4 0x6
868 #define SYS_CS_MUX_FQ5 0x7
869 #define SYS_CPUPLL 0xB1900060
870 #define SYS_AUXPLL 0xB1900064
872 /* AC97 Controller */
873 #define AC97C_CONFIG 0xB0000000
874 #define AC97C_RECV_SLOTS_BIT 13
875 #define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
876 #define AC97C_XMIT_SLOTS_BIT 3
877 #define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
878 #define AC97C_SG (1<<2)
879 #define AC97C_SYNC (1<<1)
880 #define AC97C_RESET (1<<0)
881 #define AC97C_STATUS 0xB0000004
882 #define AC97C_XU (1<<11)
883 #define AC97C_XO (1<<10)
884 #define AC97C_RU (1<<9)
885 #define AC97C_RO (1<<8)
886 #define AC97C_READY (1<<7)
887 #define AC97C_CP (1<<6)
888 #define AC97C_TR (1<<5)
889 #define AC97C_TE (1<<4)
890 #define AC97C_TF (1<<3)
891 #define AC97C_RR (1<<2)
892 #define AC97C_RE (1<<1)
893 #define AC97C_RF (1<<0)
894 #define AC97C_DATA 0xB0000008
895 #define AC97C_CMD 0xB000000C
896 #define AC97C_WD_BIT 16
897 #define AC97C_READ (1<<7)
898 #define AC97C_INDEX_MASK 0x7f
899 #define AC97C_CNTRL 0xB0000010
900 #define AC97C_RS (1<<1)
901 #define AC97C_CE (1<<0)
903 /* Au1500 PCI Controller */
904 #define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr
905 #define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
906 #define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
907 #define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27))
908 #define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
909 #define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
910 #define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
911 #define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
912 #define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
913 #define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
914 #define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
915 #define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
916 #define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
917 #define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
918 #define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
919 #define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
921 #define Au1500_PCI_HDR 0xB4005100 // virtual, kseg0 addr
923 /* All of our structures, like pci resource, have 32 bit members.
924 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
925 * hard to store 0x4 0000 0000 in a 32 bit type. We require a small patch
926 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
927 * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM
928 * addresses. For PCI IO, it's simpler because we get to do the ioremap
929 * ourselves and then adjust the device's resources.
931 #define Au1500_EXT_CFG 0x600000000
932 #define Au1500_EXT_CFG_TYPE1 0x680000000
933 #define Au1500_PCI_IO_START 0x500000000
934 #define Au1500_PCI_IO_END 0x5000FFFFF
935 #define Au1500_PCI_MEM_START 0x440000000
936 #define Au1500_PCI_MEM_END 0x443FFFFFF