ah_soc.h revision 256281
1146773Ssam/*
2146773Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3146773Ssam * Copyright (c) 2002-2008 Atheros Communications, Inc.
4146773Ssam *
5251158Sdelphij * Permission to use, copy, modify, and/or distribute this software for any
6146773Ssam * purpose with or without fee is hereby granted, provided that the above
7146773Ssam * copyright notice and this permission notice appear in all copies.
8146773Ssam *
9146773Ssam * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10146773Ssam * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11146773Ssam * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12146773Ssam * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13146773Ssam * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14146773Ssam * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15146773Ssam * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16146773Ssam *
17146773Ssam * $FreeBSD: stable/10/sys/dev/ath/ath_hal/ah_soc.h 204644 2010-03-03 17:32:32Z rpaulo $
18146773Ssam */
19146773Ssam#ifndef _ATH_AH_SOC_H_
20146773Ssam#define _ATH_AH_SOC_H_
21146773Ssam/*
22146773Ssam * Atheros System on Chip (SoC) public definitions.
23146773Ssam */
24146773Ssam
25146773Ssam/*
26146773Ssam * This is board-specific data that is stored in a "known"
27146773Ssam * location in flash.  To find the start of this data search
28146773Ssam * back from the (aliased) end of flash by 0x1000 bytes at a
29146773Ssam * time until you find the string "5311", which marks the
30146773Ssam * start of Board Configuration.  Typically one gives up if
31146773Ssam * more than 500KB is searched.
32146773Ssam */
33146773Ssamstruct ar531x_boarddata {
34146773Ssam	uint32_t magic;             /* board data is valid */
35146773Ssam#define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
36146773Ssam	uint16_t cksum;             /* checksum (starting with BD_REV 2) */
37146773Ssam	uint16_t rev;               /* revision of this struct */
38146773Ssam#define BD_REV  4
39146773Ssam	char   boardName[64];        /* Name of board */
40146773Ssam	uint16_t major;             /* Board major number */
41276788Sdelphij	uint16_t minor;             /* Board minor number */
42276788Sdelphij	uint32_t config;            /* Board configuration */
43146773Ssam#define BD_ENET0        0x00000001   /* ENET0 is stuffed */
44146773Ssam#define BD_ENET1        0x00000002   /* ENET1 is stuffed */
45276788Sdelphij#define BD_UART1        0x00000004   /* UART1 is stuffed */
46276788Sdelphij#define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
47276788Sdelphij#define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
48276788Sdelphij#define BD_SYSLED       0x00000020   /* System LED stuffed */
49276788Sdelphij#define BD_EXTUARTCLK   0x00000040   /* External UART clock */
50146773Ssam#define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
51146773Ssam#define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
52146773Ssam#define BD_WLAN0        0x00000200   /* Enable WLAN0 */
53276788Sdelphij#define BD_MEMCAP       0x00000400   /* CAP SDRAM @ memCap for testing */
54276788Sdelphij#define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
55276788Sdelphij#define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
56276788Sdelphij#define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
57276788Sdelphij#define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
58146773Ssam#define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
59146773Ssam#define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
60146773Ssam#define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
61146773Ssam	uint16_t resetConfigGpio;   /* Reset factory GPIO pin */
62146773Ssam	uint16_t sysLedGpio;        /* System LED GPIO pin */
63146773Ssam
64146773Ssam	uint32_t cpuFreq;           /* CPU core frequency in Hz */
65146773Ssam	uint32_t sysFreq;           /* System frequency in Hz */
66146773Ssam	uint32_t cntFreq;           /* Calculated C0_COUNT frequency */
67146773Ssam
68146773Ssam	uint8_t  wlan0Mac[6];
69146773Ssam	uint8_t  enet0Mac[6];
70146773Ssam	uint8_t  enet1Mac[6];
71146773Ssam
72146773Ssam	uint16_t pciId;             /* Pseudo PCIID for common code */
73146773Ssam	uint16_t memCap;            /* cap bank1 in MB */
74146773Ssam
75276788Sdelphij	/* version 3 */
76146773Ssam	uint8_t  wlan1Mac[6];       /* (ar5212) */
77146773Ssam};
78146773Ssam
79146773Ssam/*
80276788Sdelphij * Board support data.  The driver is required to locate
81146773Ssam * and fill-in this information before passing a reference to
82146773Ssam * this structure as the HAL_BUS_TAG parameter supplied to
83146773Ssam * ath_hal_attach.
84146773Ssam */
85146773Ssamstruct ar531x_config {
86190207Srpaulo	const struct ar531x_boarddata *board;	/* board config data */
87146773Ssam	const char	*radio;			/* radio config data */
88146773Ssam	int		unit;			/* unit number [0, 1] */
89146773Ssam	void		*tag;			/* bus space tag */
90146773Ssam};
91146773Ssam#endif	/* _ATH_AH_SOC_H_ */
92146773Ssam