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