1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * MIPS boards bootprom interface for the Linux kernel.
4  *
5  * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
6  * Author: Carsten Langgaard, carstenl@mips.com
7  *
8  * ########################################################################
9  *
10  * ########################################################################
11  */
12 
13 #ifndef _ASM_MSP_PROM_H
14 #define _ASM_MSP_PROM_H
15 
16 #include <linux/types.h>
17 
18 #define DEVICEID			"deviceid"
19 #define FEATURES			"features"
20 #define PROM_ENV			"prom_env"
21 #define PROM_ENV_FILE			"/proc/"PROM_ENV
22 #define PROM_ENV_SIZE			256
23 
24 #define CPU_DEVID_FAMILY		0x0000ff00
25 #define CPU_DEVID_REVISION		0x000000ff
26 
27 #define FPGA_IS_POLO(revision) \
28 		(((revision >= 0xb0) && (revision < 0xd0)))
29 #define FPGA_IS_5000(revision) \
30 		((revision >= 0x80) && (revision <= 0x90))
31 #define FPGA_IS_ZEUS(revision)		((revision < 0x7f))
32 #define FPGA_IS_DUET(revision) \
33 		(((revision >= 0xa0) && (revision < 0xb0)))
34 #define FPGA_IS_MSP4200(revision)	((revision >= 0xd0))
35 #define FPGA_IS_MSP7100(revision)	((revision >= 0xd0))
36 
37 #define MACHINE_TYPE_POLO		"POLO"
38 #define MACHINE_TYPE_DUET		"DUET"
39 #define MACHINE_TYPE_ZEUS		"ZEUS"
40 #define MACHINE_TYPE_MSP2000REVB	"MSP2000REVB"
41 #define MACHINE_TYPE_MSP5000		"MSP5000"
42 #define MACHINE_TYPE_MSP4200		"MSP4200"
43 #define MACHINE_TYPE_MSP7120		"MSP7120"
44 #define MACHINE_TYPE_MSP7130		"MSP7130"
45 #define MACHINE_TYPE_OTHER		"OTHER"
46 
47 #define MACHINE_TYPE_POLO_FPGA		"POLO-FPGA"
48 #define MACHINE_TYPE_DUET_FPGA		"DUET-FPGA"
49 #define MACHINE_TYPE_ZEUS_FPGA		"ZEUS_FPGA"
50 #define MACHINE_TYPE_MSP2000REVB_FPGA	"MSP2000REVB-FPGA"
51 #define MACHINE_TYPE_MSP5000_FPGA	"MSP5000-FPGA"
52 #define MACHINE_TYPE_MSP4200_FPGA	"MSP4200-FPGA"
53 #define MACHINE_TYPE_MSP7100_FPGA	"MSP7100-FPGA"
54 #define MACHINE_TYPE_OTHER_FPGA		"OTHER-FPGA"
55 
56 /* Device Family definitions */
57 #define FAMILY_FPGA			0x0000
58 #define FAMILY_ZEUS			0x1000
59 #define FAMILY_POLO			0x2000
60 #define FAMILY_DUET			0x4000
61 #define FAMILY_TRIAD			0x5000
62 #define FAMILY_MSP4200			0x4200
63 #define FAMILY_MSP4200_FPGA		0x4f00
64 #define FAMILY_MSP7100			0x7100
65 #define FAMILY_MSP7100_FPGA		0x7f00
66 
67 /* Device Type definitions */
68 #define TYPE_MSP7120			0x7120
69 #define TYPE_MSP7130			0x7130
70 
71 #define ENET_KEY		'E'
72 #define ENETTXD_KEY		'e'
73 #define PCI_KEY			'P'
74 #define PCIMUX_KEY		'p'
75 #define SEC_KEY			'S'
76 #define SPAD_KEY		'D'
77 #define TDM_KEY			'T'
78 #define ZSP_KEY			'Z'
79 
80 #define FEATURE_NOEXIST		'-'
81 #define FEATURE_EXIST		'+'
82 
83 #define ENET_MII		'M'
84 #define ENET_RMII		'R'
85 
86 #define ENETTXD_FALLING		'F'
87 #define ENETTXD_RISING		'R'
88 
89 #define PCI_HOST		'H'
90 #define PCI_PERIPHERAL		'P'
91 
92 #define PCIMUX_FULL		'F'
93 #define PCIMUX_SINGLE		'S'
94 
95 #define SEC_DUET		'D'
96 #define SEC_POLO		'P'
97 #define SEC_SLOW		'S'
98 #define SEC_TRIAD		'T'
99 
100 #define SPAD_POLO		'P'
101 
102 #define TDM_DUET		'D'	/* DUET TDMs might exist */
103 #define TDM_POLO		'P'	/* POLO TDMs might exist */
104 #define TDM_TRIAD		'T'	/* TRIAD TDMs might exist */
105 
106 #define ZSP_DUET		'D'	/* one DUET zsp engine */
107 #define ZSP_TRIAD		'T'	/* two TRIAD zsp engines */
108 
109 extern char *prom_getenv(char *name);
110 extern void prom_init_cmdline(void);
111 extern void prom_meminit(void);
112 extern void prom_fixup_mem_map(unsigned long start_mem,
113 			       unsigned long end_mem);
114 
115 extern int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr);
116 extern unsigned long get_deviceid(void);
117 extern char identify_enet(unsigned long interface_num);
118 extern char identify_enetTxD(unsigned long interface_num);
119 extern char identify_pci(void);
120 extern char identify_sec(void);
121 extern char identify_spad(void);
122 extern char identify_sec(void);
123 extern char identify_tdm(void);
124 extern char identify_zsp(void);
125 extern unsigned long identify_family(void);
126 extern unsigned long identify_revision(void);
127 
128 /*
129  * The following macro calls prom_printf and puts the format string
130  * into an init section so it can be reclaimed.
131  */
132 #define ppfinit(f, x...) \
133 	do { \
134 		static char _f[] __initdata = KERN_INFO f; \
135 		printk(_f, ## x); \
136 	} while (0)
137 
138 /* Memory descriptor management. */
139 #define PROM_MAX_PMEMBLOCKS    7	/* 6 used */
140 
141 enum yamon_memtypes {
142 	yamon_dontuse,
143 	yamon_prom,
144 	yamon_free,
145 };
146 
147 struct prom_pmemblock {
148 	unsigned long base; /* Within KSEG0. */
149 	unsigned int size;  /* In bytes. */
150 	unsigned int type;  /* free or prom memory */
151 };
152 
153 extern int prom_argc;
154 extern char **prom_argv;
155 extern char **prom_envp;
156 extern int *prom_vec;
157 extern struct prom_pmemblock *prom_getmdesc(void);
158 
159 #endif /* !_ASM_MSP_PROM_H */
160