- Add noise floor to stats
[dragonfly.git] / sys / contrib / dev / ath / ah_soc.h
1 /*-
2  * Copyright (c) 2006 Sam Leffler, Errno Consulting, Atheros
3  * Communications, Inc.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the following conditions are met:
7  * 1. The materials contained herein are unmodified and are used
8  *    unmodified.
9  * 2. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following NO
11  *    ''WARRANTY'' disclaimer below (''Disclaimer''), without
12  *    modification.
13  * 3. Redistributions in binary form must reproduce at minimum a
14  *    disclaimer similar to the Disclaimer below and any redistribution
15  *    must be conditioned upon including a substantially similar
16  *    Disclaimer requirement for further binary redistribution.
17  * 4. Neither the names of the above-listed copyright holders nor the
18  *    names of any contributors may be used to endorse or promote
19  *    product derived from this software without specific prior written
20  *    permission.
21  *
22  * NO WARRANTY
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
26  * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
28  * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGES.
35  *
36  * $Id: //depot/sw/branches/sam_hal/ah_soc.h#3 $
37  */
38 #ifndef _ATH_AH_SOC_H_
39 #define _ATH_AH_SOC_H_
40 /*
41  * Atheros System on Chip (SoC) public definitions.
42  */
43
44 /*
45  * This is board-specific data that is stored in a "known"
46  * location in flash.  To find the start of this data search
47  * back from the (aliased) end of flash by 0x1000 bytes at a
48  * time until you find the string "5311", which marks the
49  * start of Board Configuration.  Typically one gives up if
50  * more than 500KB is searched.
51  */
52 struct ar531x_boarddata {
53         u_int32_t magic;             /* board data is valid */
54 #define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
55         u_int16_t cksum;             /* checksum (starting with BD_REV 2) */
56         u_int16_t rev;               /* revision of this struct */
57 #define BD_REV  4
58         char   boardName[64];        /* Name of board */
59         u_int16_t major;             /* Board major number */
60         u_int16_t minor;             /* Board minor number */
61         u_int32_t config;            /* Board configuration */
62 #define BD_ENET0        0x00000001   /* ENET0 is stuffed */
63 #define BD_ENET1        0x00000002   /* ENET1 is stuffed */
64 #define BD_UART1        0x00000004   /* UART1 is stuffed */
65 #define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
66 #define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
67 #define BD_SYSLED       0x00000020   /* System LED stuffed */
68 #define BD_EXTUARTCLK   0x00000040   /* External UART clock */
69 #define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
70 #define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
71 #define BD_WLAN0        0x00000200   /* Enable WLAN0 */
72 #define BD_MEMCAP       0x00000400   /* CAP SDRAM @ memCap for testing */
73 #define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
74 #define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
75 #define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
76 #define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
77 #define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
78 #define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
79 #define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
80         u_int16_t resetConfigGpio;   /* Reset factory GPIO pin */
81         u_int16_t sysLedGpio;        /* System LED GPIO pin */
82         
83         u_int32_t cpuFreq;           /* CPU core frequency in Hz */
84         u_int32_t sysFreq;           /* System frequency in Hz */
85         u_int32_t cntFreq;           /* Calculated C0_COUNT frequency */
86         
87         u_int8_t  wlan0Mac[6];
88         u_int8_t  enet0Mac[6];
89         u_int8_t  enet1Mac[6];
90         
91         u_int16_t pciId;             /* Pseudo PCIID for common code */
92         u_int16_t memCap;            /* cap bank1 in MB */
93         
94         /* version 3 */
95         u_int8_t  wlan1Mac[6];       /* (ar5212) */
96 };
97
98 /*
99  * Board support data.  The driver is required to locate
100  * and fill-in this information before passing a reference to
101  * this structure as the HAL_BUS_TAG parameter supplied to
102  * ath_hal_attach.
103  */
104 struct ar531x_config {
105         const struct ar531x_boarddata *board;   /* board config data */
106         const char      *radio;                 /* radio config data */
107         int             unit;                   /* unit number [0, 1] */
108         void            *tag;                   /* bus space tag */
109 };
110 #endif  /* _ATH_AH_SOC_H_ */