Merge branch 'master' into net80211-update
[dragonfly.git] / sys / dev / netif / ath / hal / ath_hal / ah_soc.h
1 /*
2  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3  * Copyright (c) 2002-2008 Atheros Communications, Inc.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * $Id: ah_soc.h,v 1.4 2008/11/10 04:08:00 sam Exp $
18  * $DragonFly$
19  */
20 #ifndef _ATH_AH_SOC_H_
21 #define _ATH_AH_SOC_H_
22 /*
23  * Atheros System on Chip (SoC) public definitions.
24  */
25
26 /*
27  * This is board-specific data that is stored in a "known"
28  * location in flash.  To find the start of this data search
29  * back from the (aliased) end of flash by 0x1000 bytes at a
30  * time until you find the string "5311", which marks the
31  * start of Board Configuration.  Typically one gives up if
32  * more than 500KB is searched.
33  */
34 struct ar531x_boarddata {
35         uint32_t magic;             /* board data is valid */
36 #define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
37         uint16_t cksum;             /* checksum (starting with BD_REV 2) */
38         uint16_t rev;               /* revision of this struct */
39 #define BD_REV  4
40         char   boardName[64];        /* Name of board */
41         uint16_t major;             /* Board major number */
42         uint16_t minor;             /* Board minor number */
43         uint32_t config;            /* Board configuration */
44 #define BD_ENET0        0x00000001   /* ENET0 is stuffed */
45 #define BD_ENET1        0x00000002   /* ENET1 is stuffed */
46 #define BD_UART1        0x00000004   /* UART1 is stuffed */
47 #define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
48 #define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
49 #define BD_SYSLED       0x00000020   /* System LED stuffed */
50 #define BD_EXTUARTCLK   0x00000040   /* External UART clock */
51 #define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
52 #define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
53 #define BD_WLAN0        0x00000200   /* Enable WLAN0 */
54 #define BD_MEMCAP       0x00000400   /* CAP SDRAM @ memCap for testing */
55 #define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
56 #define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
57 #define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
58 #define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
59 #define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
60 #define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
61 #define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
62         uint16_t resetConfigGpio;   /* Reset factory GPIO pin */
63         uint16_t sysLedGpio;        /* System LED GPIO pin */
64         
65         uint32_t cpuFreq;           /* CPU core frequency in Hz */
66         uint32_t sysFreq;           /* System frequency in Hz */
67         uint32_t cntFreq;           /* Calculated C0_COUNT frequency */
68         
69         uint8_t  wlan0Mac[6];
70         uint8_t  enet0Mac[6];
71         uint8_t  enet1Mac[6];
72         
73         uint16_t pciId;             /* Pseudo PCIID for common code */
74         uint16_t memCap;            /* cap bank1 in MB */
75         
76         /* version 3 */
77         uint8_t  wlan1Mac[6];       /* (ar5212) */
78 };
79
80 /*
81  * Board support data.  The driver is required to locate
82  * and fill-in this information before passing a reference to
83  * this structure as the HAL_BUS_TAG parameter supplied to
84  * ath_hal_attach.
85  */
86 struct ar531x_config {
87         const struct ar531x_boarddata *board;   /* board config data */
88         const char      *radio;                 /* radio config data */
89         int             unit;                   /* unit number [0, 1] */
90         void            *tag;                   /* bus space tag */
91 };
92 #endif  /* _ATH_AH_SOC_H_ */