1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2a7473717SSergey Ryazanov #ifndef __ASM_MACH_ATH25_PLATFORM_H
3a7473717SSergey Ryazanov #define __ASM_MACH_ATH25_PLATFORM_H
4a7473717SSergey Ryazanov 
5a7473717SSergey Ryazanov #include <linux/etherdevice.h>
6a7473717SSergey Ryazanov 
7a7473717SSergey Ryazanov /*
8a7473717SSergey Ryazanov  * This is board-specific data that is stored in a "fixed" location in flash.
9a7473717SSergey Ryazanov  * It is shared across operating systems, so it should not be changed lightly.
10a7473717SSergey Ryazanov  * The main reason we need it is in order to extract the ethernet MAC
11a7473717SSergey Ryazanov  * address(es).
12a7473717SSergey Ryazanov  */
13a7473717SSergey Ryazanov struct ath25_boarddata {
14a7473717SSergey Ryazanov 	u32 magic;                   /* board data is valid */
15a7473717SSergey Ryazanov #define ATH25_BD_MAGIC 0x35333131    /* "5311", for all 531x/231x platforms */
16a7473717SSergey Ryazanov 	u16 cksum;                   /* checksum (starting with BD_REV 2) */
17a7473717SSergey Ryazanov 	u16 rev;                     /* revision of this struct */
18a7473717SSergey Ryazanov #define BD_REV 4
19a7473717SSergey Ryazanov 	char board_name[64];         /* Name of board */
20a7473717SSergey Ryazanov 	u16 major;                   /* Board major number */
21a7473717SSergey Ryazanov 	u16 minor;                   /* Board minor number */
22a7473717SSergey Ryazanov 	u32 flags;                   /* Board configuration */
23a7473717SSergey Ryazanov #define BD_ENET0        0x00000001   /* ENET0 is stuffed */
24a7473717SSergey Ryazanov #define BD_ENET1        0x00000002   /* ENET1 is stuffed */
25a7473717SSergey Ryazanov #define BD_UART1        0x00000004   /* UART1 is stuffed */
26a7473717SSergey Ryazanov #define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
27a7473717SSergey Ryazanov #define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
28a7473717SSergey Ryazanov #define BD_SYSLED       0x00000020   /* System LED stuffed */
29a7473717SSergey Ryazanov #define BD_EXTUARTCLK   0x00000040   /* External UART clock */
30a7473717SSergey Ryazanov #define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
31a7473717SSergey Ryazanov #define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
32a7473717SSergey Ryazanov #define BD_WLAN0        0x00000200   /* Enable WLAN0 */
33a7473717SSergey Ryazanov #define BD_MEMCAP       0x00000400   /* CAP SDRAM @ mem_cap for testing */
34a7473717SSergey Ryazanov #define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
35a7473717SSergey Ryazanov #define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
36a7473717SSergey Ryazanov #define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
37a7473717SSergey Ryazanov #define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
38a7473717SSergey Ryazanov #define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
39a7473717SSergey Ryazanov #define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
40a7473717SSergey Ryazanov #define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
41a7473717SSergey Ryazanov 	u16 reset_config_gpio;       /* Reset factory GPIO pin */
42a7473717SSergey Ryazanov 	u16 sys_led_gpio;            /* System LED GPIO pin */
43a7473717SSergey Ryazanov 
44a7473717SSergey Ryazanov 	u32 cpu_freq;                /* CPU core frequency in Hz */
45a7473717SSergey Ryazanov 	u32 sys_freq;                /* System frequency in Hz */
46a7473717SSergey Ryazanov 	u32 cnt_freq;                /* Calculated C0_COUNT frequency */
47a7473717SSergey Ryazanov 
48a7473717SSergey Ryazanov 	u8  wlan0_mac[ETH_ALEN];
49a7473717SSergey Ryazanov 	u8  enet0_mac[ETH_ALEN];
50a7473717SSergey Ryazanov 	u8  enet1_mac[ETH_ALEN];
51a7473717SSergey Ryazanov 
52a7473717SSergey Ryazanov 	u16 pci_id;                  /* Pseudo PCIID for common code */
53a7473717SSergey Ryazanov 	u16 mem_cap;                 /* cap bank1 in MB */
54a7473717SSergey Ryazanov 
55a7473717SSergey Ryazanov 	/* version 3 */
56a7473717SSergey Ryazanov 	u8  wlan1_mac[ETH_ALEN];     /* (ar5212) */
57a7473717SSergey Ryazanov };
58a7473717SSergey Ryazanov 
59a7473717SSergey Ryazanov #define BOARD_CONFIG_BUFSZ		0x1000
60a7473717SSergey Ryazanov 
61a7473717SSergey Ryazanov /*
62a7473717SSergey Ryazanov  * Platform device information for the Wireless MAC
63a7473717SSergey Ryazanov  */
64a7473717SSergey Ryazanov struct ar231x_board_config {
65a7473717SSergey Ryazanov 	u16 devid;
66a7473717SSergey Ryazanov 
67a7473717SSergey Ryazanov 	/* board config data */
68a7473717SSergey Ryazanov 	struct ath25_boarddata *config;
69a7473717SSergey Ryazanov 
70a7473717SSergey Ryazanov 	/* radio calibration data */
71a7473717SSergey Ryazanov 	const char *radio;
72a7473717SSergey Ryazanov };
73a7473717SSergey Ryazanov 
74a7473717SSergey Ryazanov #endif /* __ASM_MACH_ATH25_PLATFORM_H */
75