2 * Copyright (c) 2004 Atheros Communications, Inc.
8 #ifndef _DEV_ATH_AHB_H_
9 #define _DEV_ATH_AHB_H_
12 #include <asm/uaccess.h>
14 #define AR531X_WLAN0_NUM 0
15 #define AR531X_WLAN1_NUM 1
17 #define REG_WRITE(_reg,_val) *((volatile u_int32_t *)(_reg)) = (_val);
18 #define REG_READ(_reg) *((volatile u_int32_t *)(_reg))
21 * 5315 specific registers
25 * PCI-MAC Configuration registers
27 #define AR5315_PCI 0xB0100000 /* PCI MMR */
28 #define AR5315_PCI_MAC_RC (AR5315_PCI + 0x4000)
29 #define AR5315_PCI_MAC_SCR (AR5315_PCI + 0x4004)
30 #define AR5315_PCI_MAC_INTPEND (AR5315_PCI + 0x4008)
31 #define AR5315_PCI_MAC_SFR (AR5315_PCI + 0x400C)
32 #define AR5315_PCI_MAC_PCICFG (AR5315_PCI + 0x4010)
33 #define AR5315_PCI_MAC_SREV (AR5315_PCI + 0x4020)
35 #define AR5315_PCI_MAC_RC_MAC 0x00000001
36 #define AR5315_PCI_MAC_RC_BB 0x00000002
38 #define AR5315_PCI_MAC_SCR_SLMODE_M 0x00030000
39 #define AR5315_PCI_MAC_SCR_SLMODE_S 16
40 #define AR5315_PCI_MAC_SCR_SLM_FWAKE 0
41 #define AR5315_PCI_MAC_SCR_SLM_FSLEEP 1
42 #define AR5315_PCI_MAC_SCR_SLM_NORMAL 2
44 #define AR5315_PCI_MAC_SFR_SLEEP 0x00000001
46 #define AR5315_PCI_MAC_PCICFG_SPWR_DN 0x00010000
48 #define AR5315_IRQ_WLAN0_INTRS 3
49 #define AR5315_WLAN0 0xb0000000
51 #define AR5315_ENDIAN_CTL 0xb100000c
52 #define AR5315_CONFIG_WLAN 0x00000002 /* WLAN byteswap */
53 #define AR5315_AHB_ARB_CTL 0xb1000008
54 #define AR5315_ARB_WLAN 0x00000002
57 * Revision Register - Initial value is 0x3010 (WMAC 3.0, AR531X 1.0).
59 #define AR5315_SREV 0xb1000014
61 #define AR5315_REV_MAJ 0x0080
62 #define AR5317_REV_MAJ 0x0090
63 #define AR5315_REV_MAJ_M 0x00f0
64 #define AR5315_REV_MAJ_S 4
65 #define AR5315_REV_MIN_M 0x000f
66 #define AR5315_REV_MIN_S 0
67 #define AR5315_REV_CHIP (REV_MAJ|REV_MIN)
69 #define AR531X_IRQ_WLAN0_INTRS 2
70 #define AR531X_IRQ_WLAN1_INTRS 5
71 #define AR531X_WLAN0 0xb8000000
72 #define AR531X_WLAN1 0xb8500000
73 #define AR531X_WLANX_LEN 0x000ffffc
75 #define AR531X_RESETCTL 0xbc003020
76 #define AR531X_RESET_WLAN0 0x00000004 /* mac & bb */
77 #define AR531X_RESET_WLAN1 0x00000200 /* mac & bb */
78 #define AR531X_RESET_WARM_WLAN0_MAC 0x00002000
79 #define AR531X_RESET_WARM_WLAN0_BB 0x00004000
80 #define AR531X_RESET_WARM_WLAN1_MAC 0x00020000
81 #define AR531X_RESET_WARM_WLAN1_BB 0x00040000
83 #define AR531X_ENABLE 0xbc003080
84 #define AR531X_ENABLE_WLAN0 0x0001
85 #define AR531X_ENABLE_WLAN1 0x0018 /* both DMA and PIO */
87 #define AR531X_RADIO_MASK_OFF 0xc8
88 #define AR531X_RADIO0_MASK 0x0003
89 #define AR531X_RADIO1_MASK 0x000c
90 #define AR531X_RADIO1_S 2
92 #define BUS_DMA_FROMDEVICE 0
93 #define BUS_DMA_TODEVICE 1
95 #define AR531X_APBBASE 0xbc000000
96 #define AR531X_RESETTMR (AR531X_APBBASE + 0x3000)
97 #define AR531X_REV (AR531X_RESETTMR + 0x0090) /* revision */
98 #define AR531X_REV_MAJ 0x00f0
99 #define AR531X_REV_MAJ_S 4
100 #define AR531X_REV_MIN 0x000f
101 #define AR531X_REV_MIN_S 0
103 #define AR531X_BD_MAGIC 0x35333131 /* "5311", for all 531x platforms */
105 /* Allow compiling on non-mips platforms for code verification */
107 #define CAC_ADDR(addr) (addr)
108 #define UNCAC_ADDR(addr) (addr)
109 #define KSEG1ADDR(addr) (addr)
110 #define dma_cache_wback_inv(start,size) \
111 do { (void) (start); (void) (size); } while (0)
114 /* set bus cachesize in 4B word units */
115 static __inline void bus_dma_sync_single(void *hwdev, dma_addr_t dma_handle,
116 size_t size, int direction)
120 addr = (unsigned long) __va(dma_handle);
121 dma_cache_wback_inv(addr, size);
124 static __inline dma_addr_t bus_map_single(void *hwdev, void *ptr,
125 size_t size, int direction)
127 dma_cache_wback_inv((unsigned long) ptr, size);
132 static __inline void bus_unmap_single(void *hwdev, dma_addr_t dma_addr,
133 size_t size, int direction)
135 if (direction != BUS_DMA_TODEVICE) {
138 addr = (unsigned long)__va(dma_addr);
139 dma_cache_wback_inv(addr, size);
142 void *bus_alloc_consistent(void *, size_t, dma_addr_t *);
143 void bus_free_consistent(void *, size_t, void *, dma_addr_t);
145 #define sysRegRead(phys) (*(volatile u_int32_t *)phys)
147 #endif /* _DEV_ATH_AHB_H_ */