1185377Ssam/*
2185377Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3185377Ssam * Copyright (c) 2002-2008 Atheros Communications, Inc.
4185377Ssam *
5185377Ssam * Permission to use, copy, modify, and/or distribute this software for any
6185377Ssam * purpose with or without fee is hereby granted, provided that the above
7185377Ssam * copyright notice and this permission notice appear in all copies.
8185377Ssam *
9185377Ssam * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10185377Ssam * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11185377Ssam * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12185377Ssam * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13185377Ssam * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14185377Ssam * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15185377Ssam * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16185377Ssam *
17204644Srpaulo * $FreeBSD$
18185377Ssam */
19185377Ssam#ifndef _ATH_AH_SOC_H_
20185377Ssam#define _ATH_AH_SOC_H_
21185377Ssam/*
22185377Ssam * Atheros System on Chip (SoC) public definitions.
23185377Ssam */
24185377Ssam
25185377Ssam/*
26185377Ssam * This is board-specific data that is stored in a "known"
27185377Ssam * location in flash.  To find the start of this data search
28185377Ssam * back from the (aliased) end of flash by 0x1000 bytes at a
29185377Ssam * time until you find the string "5311", which marks the
30185377Ssam * start of Board Configuration.  Typically one gives up if
31185377Ssam * more than 500KB is searched.
32185377Ssam */
33185377Ssamstruct ar531x_boarddata {
34185377Ssam	uint32_t magic;             /* board data is valid */
35185377Ssam#define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
36185377Ssam	uint16_t cksum;             /* checksum (starting with BD_REV 2) */
37185377Ssam	uint16_t rev;               /* revision of this struct */
38185377Ssam#define BD_REV  4
39185377Ssam	char   boardName[64];        /* Name of board */
40185377Ssam	uint16_t major;             /* Board major number */
41185377Ssam	uint16_t minor;             /* Board minor number */
42185377Ssam	uint32_t config;            /* Board configuration */
43185377Ssam#define BD_ENET0        0x00000001   /* ENET0 is stuffed */
44185377Ssam#define BD_ENET1        0x00000002   /* ENET1 is stuffed */
45185377Ssam#define BD_UART1        0x00000004   /* UART1 is stuffed */
46185377Ssam#define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
47185377Ssam#define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
48185377Ssam#define BD_SYSLED       0x00000020   /* System LED stuffed */
49185377Ssam#define BD_EXTUARTCLK   0x00000040   /* External UART clock */
50185377Ssam#define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
51185377Ssam#define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
52185377Ssam#define BD_WLAN0        0x00000200   /* Enable WLAN0 */
53185377Ssam#define BD_MEMCAP       0x00000400   /* CAP SDRAM @ memCap for testing */
54185377Ssam#define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
55185377Ssam#define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
56185377Ssam#define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
57185377Ssam#define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
58185377Ssam#define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
59185377Ssam#define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
60185377Ssam#define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
61185377Ssam	uint16_t resetConfigGpio;   /* Reset factory GPIO pin */
62185377Ssam	uint16_t sysLedGpio;        /* System LED GPIO pin */
63185377Ssam
64185377Ssam	uint32_t cpuFreq;           /* CPU core frequency in Hz */
65185377Ssam	uint32_t sysFreq;           /* System frequency in Hz */
66185377Ssam	uint32_t cntFreq;           /* Calculated C0_COUNT frequency */
67185377Ssam
68185377Ssam	uint8_t  wlan0Mac[6];
69185377Ssam	uint8_t  enet0Mac[6];
70185377Ssam	uint8_t  enet1Mac[6];
71185377Ssam
72185377Ssam	uint16_t pciId;             /* Pseudo PCIID for common code */
73185377Ssam	uint16_t memCap;            /* cap bank1 in MB */
74185377Ssam
75185377Ssam	/* version 3 */
76185377Ssam	uint8_t  wlan1Mac[6];       /* (ar5212) */
77185377Ssam};
78185377Ssam
79185377Ssam/*
80185377Ssam * Board support data.  The driver is required to locate
81185377Ssam * and fill-in this information before passing a reference to
82185377Ssam * this structure as the HAL_BUS_TAG parameter supplied to
83185377Ssam * ath_hal_attach.
84185377Ssam */
85185377Ssamstruct ar531x_config {
86185377Ssam	const struct ar531x_boarddata *board;	/* board config data */
87185377Ssam	const char	*radio;			/* radio config data */
88185377Ssam	int		unit;			/* unit number [0, 1] */
89185377Ssam	void		*tag;			/* bus space tag */
90185377Ssam};
91185377Ssam#endif	/* _ATH_AH_SOC_H_ */
92