xref: /freebsd/sys/dev/ath/ath_hal/ah_soc.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1*6e778a7eSPedro F. Giffuni /*-
2*6e778a7eSPedro F. Giffuni  * SPDX-License-Identifier: ISC
3*6e778a7eSPedro F. Giffuni  *
414779705SSam Leffler  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
514779705SSam Leffler  * Copyright (c) 2002-2008 Atheros Communications, Inc.
614779705SSam Leffler  *
714779705SSam Leffler  * Permission to use, copy, modify, and/or distribute this software for any
814779705SSam Leffler  * purpose with or without fee is hereby granted, provided that the above
914779705SSam Leffler  * copyright notice and this permission notice appear in all copies.
1014779705SSam Leffler  *
1114779705SSam Leffler  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1214779705SSam Leffler  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1314779705SSam Leffler  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1414779705SSam Leffler  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1514779705SSam Leffler  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1614779705SSam Leffler  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1714779705SSam Leffler  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1814779705SSam Leffler  */
1914779705SSam Leffler #ifndef _ATH_AH_SOC_H_
2014779705SSam Leffler #define _ATH_AH_SOC_H_
2114779705SSam Leffler /*
2214779705SSam Leffler  * Atheros System on Chip (SoC) public definitions.
2314779705SSam Leffler  */
2414779705SSam Leffler 
2514779705SSam Leffler /*
2614779705SSam Leffler  * This is board-specific data that is stored in a "known"
2714779705SSam Leffler  * location in flash.  To find the start of this data search
2814779705SSam Leffler  * back from the (aliased) end of flash by 0x1000 bytes at a
2914779705SSam Leffler  * time until you find the string "5311", which marks the
3014779705SSam Leffler  * start of Board Configuration.  Typically one gives up if
3114779705SSam Leffler  * more than 500KB is searched.
3214779705SSam Leffler  */
3314779705SSam Leffler struct ar531x_boarddata {
3414779705SSam Leffler 	uint32_t magic;             /* board data is valid */
3514779705SSam Leffler #define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
3614779705SSam Leffler 	uint16_t cksum;             /* checksum (starting with BD_REV 2) */
3714779705SSam Leffler 	uint16_t rev;               /* revision of this struct */
3814779705SSam Leffler #define BD_REV  4
3914779705SSam Leffler 	char   boardName[64];        /* Name of board */
4014779705SSam Leffler 	uint16_t major;             /* Board major number */
4114779705SSam Leffler 	uint16_t minor;             /* Board minor number */
4214779705SSam Leffler 	uint32_t config;            /* Board configuration */
4314779705SSam Leffler #define BD_ENET0        0x00000001   /* ENET0 is stuffed */
4414779705SSam Leffler #define BD_ENET1        0x00000002   /* ENET1 is stuffed */
4514779705SSam Leffler #define BD_UART1        0x00000004   /* UART1 is stuffed */
4614779705SSam Leffler #define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
4714779705SSam Leffler #define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
4814779705SSam Leffler #define BD_SYSLED       0x00000020   /* System LED stuffed */
4914779705SSam Leffler #define BD_EXTUARTCLK   0x00000040   /* External UART clock */
5014779705SSam Leffler #define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
5114779705SSam Leffler #define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
5214779705SSam Leffler #define BD_WLAN0        0x00000200   /* Enable WLAN0 */
5314779705SSam Leffler #define BD_MEMCAP       0x00000400   /* CAP SDRAM @ memCap for testing */
5414779705SSam Leffler #define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
5514779705SSam Leffler #define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
5614779705SSam Leffler #define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
5714779705SSam Leffler #define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
5814779705SSam Leffler #define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
5914779705SSam Leffler #define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
6014779705SSam Leffler #define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
6114779705SSam Leffler 	uint16_t resetConfigGpio;   /* Reset factory GPIO pin */
6214779705SSam Leffler 	uint16_t sysLedGpio;        /* System LED GPIO pin */
6314779705SSam Leffler 
6414779705SSam Leffler 	uint32_t cpuFreq;           /* CPU core frequency in Hz */
6514779705SSam Leffler 	uint32_t sysFreq;           /* System frequency in Hz */
6614779705SSam Leffler 	uint32_t cntFreq;           /* Calculated C0_COUNT frequency */
6714779705SSam Leffler 
6814779705SSam Leffler 	uint8_t  wlan0Mac[6];
6914779705SSam Leffler 	uint8_t  enet0Mac[6];
7014779705SSam Leffler 	uint8_t  enet1Mac[6];
7114779705SSam Leffler 
7214779705SSam Leffler 	uint16_t pciId;             /* Pseudo PCIID for common code */
7314779705SSam Leffler 	uint16_t memCap;            /* cap bank1 in MB */
7414779705SSam Leffler 
7514779705SSam Leffler 	/* version 3 */
7614779705SSam Leffler 	uint8_t  wlan1Mac[6];       /* (ar5212) */
7714779705SSam Leffler };
7814779705SSam Leffler 
7914779705SSam Leffler /*
8014779705SSam Leffler  * Board support data.  The driver is required to locate
8114779705SSam Leffler  * and fill-in this information before passing a reference to
8214779705SSam Leffler  * this structure as the HAL_BUS_TAG parameter supplied to
8314779705SSam Leffler  * ath_hal_attach.
8414779705SSam Leffler  */
8514779705SSam Leffler struct ar531x_config {
8614779705SSam Leffler 	const struct ar531x_boarddata *board;	/* board config data */
8714779705SSam Leffler 	const char	*radio;			/* radio config data */
8814779705SSam Leffler 	int		unit;			/* unit number [0, 1] */
8914779705SSam Leffler 	void		*tag;			/* bus space tag */
9014779705SSam Leffler };
9114779705SSam Leffler #endif	/* _ATH_AH_SOC_H_ */
92