1 /*
2 * Definition of platform feature hooks for PowerMacs
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1998 Paul Mackerras &
9 * Ben. Herrenschmidt.
10 *
11 *
12 * Note: I removed media-bay details from the feature stuff, I beleive it's
13 * not worth it, the media-bay driver can directly use the mac-io
14 * ASIC registers.
15 *
16 * Implementation note: Currently, none of these functions will block.
17 * However, they may internally protect themselves with a spinlock
18 * for way too long. Be prepared for at least some of these to block
19 * in the future.
20 *
21 * Unless specifically defined, the result code is assumed to be an
22 * error when negative, 0 is the default success result. Some functions
23 * may return additional positive result values.
24 *
25 * To keep implementation simple, all feature calls are assumed to have
26 * the prototype parameters (struct device_node* node, int value).
27 * When either is not used, pass 0.
28 */
29
30 #ifdef __KERNEL__
31 #ifndef __PPC_ASM_PMAC_FEATURE_H
32 #define __PPC_ASM_PMAC_FEATURE_H
33
34 /*
35 * Known OldWorld Mac motherboard models
36 *
37 * Please, report any error here to benh@kernel.crashing.org, thanks !
38 *
39 * Note that I don't fully maintain this list for Core99 & MacRISC2
40 * and I'm considering removing all NewWorld entries from it and
41 * entirely rely on the model string.
42 */
43
44 /* PowerSurge are the first generation of PCI Pmacs. This include
45 * all of the Grand-Central based machines. We currently don't
46 * differenciate most of them.
47 */
48 #define PMAC_TYPE_PSURGE 0x10 /* PowerSurge */
49 #define PMAC_TYPE_ANS 0x11 /* Apple Network Server */
50
51 /* Here is the infamous serie of OHare based machines
52 */
53 #define PMAC_TYPE_COMET 0x20 /* Beleived to be PowerBook 2400 */
54 #define PMAC_TYPE_HOOPER 0x21 /* Beleived to be PowerBook 3400 */
55 #define PMAC_TYPE_KANGA 0x22 /* PowerBook 3500 (first G3) */
56 #define PMAC_TYPE_ALCHEMY 0x23 /* Alchemy motherboard base */
57 #define PMAC_TYPE_GAZELLE 0x24 /* Spartacus, some 5xxx/6xxx */
58 #define PMAC_TYPE_UNKNOWN_OHARE 0x2f /* Unknown, but OHare based */
59
60 /* Here are the Heathrow based machines
61 * FIXME: Differenciate wallstreet,mainstreet,wallstreetII
62 */
63 #define PMAC_TYPE_GOSSAMER 0x30 /* Gossamer motherboard */
64 #define PMAC_TYPE_SILK 0x31 /* Desktop PowerMac G3 */
65 #define PMAC_TYPE_WALLSTREET 0x32 /* Wallstreet/Mainstreet PowerBook*/
66 #define PMAC_TYPE_UNKNOWN_HEATHROW 0x3f /* Unknown but heathrow based */
67
68 /* Here are newworld machines based on Paddington (heathrow derivative)
69 */
70 #define PMAC_TYPE_101_PBOOK 0x40 /* 101 PowerBook (aka Lombard) */
71 #define PMAC_TYPE_ORIG_IMAC 0x41 /* First generation iMac */
72 #define PMAC_TYPE_YOSEMITE 0x42 /* B&W G3 */
73 #define PMAC_TYPE_YIKES 0x43 /* Yikes G4 (PCI graphics) */
74 #define PMAC_TYPE_UNKNOWN_PADDINGTON 0x4f /* Unknown but paddington based */
75
76 /* Core99 machines based on UniNorth 1.0 and 1.5
77 *
78 * Note: A single entry here may cover several actual models according
79 * to the device-tree. (Sawtooth is most tower G4s, FW_IMAC is most
80 * FireWire based iMacs, etc...). Those machines are too similar to be
81 * distinguished here, when they need to be differencied, use the
82 * device-tree "model" or "compatible" property.
83 */
84 #define PMAC_TYPE_ORIG_IBOOK 0x40 /* First iBook model (no firewire) */
85 #define PMAC_TYPE_SAWTOOTH 0x41 /* Desktop G4s */
86 #define PMAC_TYPE_FW_IMAC 0x42 /* FireWire iMacs (except Pangea based) */
87 #define PMAC_TYPE_FW_IBOOK 0x43 /* FireWire iBooks (except iBook2) */
88 #define PMAC_TYPE_CUBE 0x44 /* Cube PowerMac */
89 #define PMAC_TYPE_QUICKSILVER 0x45 /* QuickSilver G4s */
90 #define PMAC_TYPE_PISMO 0x46 /* Pismo PowerBook */
91 #define PMAC_TYPE_TITANIUM 0x47 /* Titanium PowerBook */
92 #define PMAC_TYPE_TITANIUM2 0x48 /* Titanium II PowerBook (no L3, M6) */
93 #define PMAC_TYPE_TITANIUM3 0x49 /* Titanium III PowerBook (with L3 & M7) */
94 #define PMAC_TYPE_TITANIUM4 0x50 /* Titanium IV PowerBook (with L3 & M9) */
95 #define PMAC_TYPE_EMAC 0x50 /* eMac */
96 #define PMAC_TYPE_UNKNOWN_CORE99 0x5f
97
98 /* MacRisc2 with UniNorth 2.0 */
99 #define PMAC_TYPE_RACKMAC 0x80 /* XServe */
100 #define PMAC_TYPE_WINDTUNNEL 0x81
101
102 /* MacRISC2 machines based on the Pangea chipset
103 */
104 #define PMAC_TYPE_PANGEA_IMAC 0x100 /* Flower Power iMac */
105 #define PMAC_TYPE_IBOOK2 0x101 /* iBook2 (polycarbonate) */
106 #define PMAC_TYPE_FLAT_PANEL_IMAC 0x102 /* Flat panel iMac */
107 #define PMAC_TYPE_UNKNOWN_PANGEA 0x10f
108
109 /* MacRISC2 machines based on the Intrepid chipset
110 */
111 #define PMAC_TYPE_UNKNOWN_INTREPID 0x11f /* Generic */
112
113 /*
114 * Motherboard flags
115 */
116
117 #define PMAC_MB_CAN_SLEEP 0x00000001
118 #define PMAC_MB_HAS_FW_POWER 0x00000002
119 #define PMAC_MB_OLD_CORE99 0x00000004
120 #define PMAC_MB_MOBILE 0x00000008
121
122 /*
123 * Feature calls supported on pmac
124 *
125 */
126
127 /*
128 * Use this inline wrapper
129 */
130 struct device_node;
131
pmac_call_feature(int selector,struct device_node * node,int param,int value)132 static inline int pmac_call_feature(int selector, struct device_node* node,
133 int param, int value)
134 {
135 if (!ppc_md.feature_call)
136 return -ENODEV;
137 return ppc_md.feature_call(selector, node, param, value);
138 }
139
140 /* PMAC_FTR_SERIAL_ENABLE (struct device_node* node, int param, int value)
141 * enable/disable an SCC side. Pass the node corresponding to the
142 * channel side as a parameter.
143 * param is the type of port
144 * if param is ored with PMAC_SCC_FLAG_XMON, then the SCC is locked enabled
145 * for use by xmon.
146 */
147 #define PMAC_FTR_SCC_ENABLE PMAC_FTR_DEF(0)
148 #define PMAC_SCC_ASYNC 0
149 #define PMAC_SCC_IRDA 1
150 #define PMAC_SCC_I2S1 2
151 #define PMAC_SCC_FLAG_XMON 0x00001000
152
153 /* PMAC_FTR_MODEM_ENABLE (struct device_node* node, 0, int value)
154 * enable/disable the internal modem.
155 */
156 #define PMAC_FTR_MODEM_ENABLE PMAC_FTR_DEF(1)
157
158 /* PMAC_FTR_SWIM3_ENABLE (struct device_node* node, 0,int value)
159 * enable/disable the swim3 (floppy) cell of a mac-io ASIC
160 */
161 #define PMAC_FTR_SWIM3_ENABLE PMAC_FTR_DEF(2)
162
163 /* PMAC_FTR_MESH_ENABLE (struct device_node* node, 0, int value)
164 * enable/disable the mesh (scsi) cell of a mac-io ASIC
165 */
166 #define PMAC_FTR_MESH_ENABLE PMAC_FTR_DEF(3)
167
168 /* PMAC_FTR_IDE_ENABLE (struct device_node* node, int busID, int value)
169 * enable/disable an IDE port of a mac-io ASIC
170 * pass the busID parameter
171 */
172 #define PMAC_FTR_IDE_ENABLE PMAC_FTR_DEF(4)
173
174 /* PMAC_FTR_IDE_RESET (struct device_node* node, int busID, int value)
175 * assert(1)/release(0) an IDE reset line (mac-io IDE only)
176 */
177 #define PMAC_FTR_IDE_RESET PMAC_FTR_DEF(5)
178
179 /* PMAC_FTR_BMAC_ENABLE (struct device_node* node, 0, int value)
180 * enable/disable the bmac (ethernet) cell of a mac-io ASIC, also drive
181 * it's reset line
182 */
183 #define PMAC_FTR_BMAC_ENABLE PMAC_FTR_DEF(6)
184
185 /* PMAC_FTR_GMAC_ENABLE (struct device_node* node, 0, int value)
186 * enable/disable the gmac (ethernet) cell of an uninorth ASIC. This
187 * control the cell's clock.
188 */
189 #define PMAC_FTR_GMAC_ENABLE PMAC_FTR_DEF(7)
190
191 /* PMAC_FTR_GMAC_PHY_RESET (struct device_node* node, 0, 0)
192 * Perform a HW reset of the PHY connected to a gmac controller.
193 * Pass the gmac device node, not the PHY node.
194 */
195 #define PMAC_FTR_GMAC_PHY_RESET PMAC_FTR_DEF(8)
196
197 /* PMAC_FTR_SOUND_CHIP_ENABLE (struct device_node* node, 0, int value)
198 * enable/disable the sound chip, whatever it is and provided it can
199 * acually be controlled
200 */
201 #define PMAC_FTR_SOUND_CHIP_ENABLE PMAC_FTR_DEF(9)
202
203 /* -- add various tweaks related to sound routing -- */
204
205 /* PMAC_FTR_AIRPORT_ENABLE (struct device_node* node, 0, int value)
206 * enable/disable the airport card
207 */
208 #define PMAC_FTR_AIRPORT_ENABLE PMAC_FTR_DEF(10)
209
210 /* PMAC_FTR_RESET_CPU (NULL, int cpu_nr, 0)
211 * toggle the reset line of a CPU on an uninorth-based SMP machine
212 */
213 #define PMAC_FTR_RESET_CPU PMAC_FTR_DEF(11)
214
215 /* PMAC_FTR_USB_ENABLE (struct device_node* node, 0, int value)
216 * enable/disable an USB cell, along with the power of the USB "pad"
217 * on keylargo based machines
218 */
219 #define PMAC_FTR_USB_ENABLE PMAC_FTR_DEF(12)
220
221 /* PMAC_FTR_1394_ENABLE (struct device_node* node, 0, int value)
222 * enable/disable the firewire cell of an uninorth ASIC.
223 */
224 #define PMAC_FTR_1394_ENABLE PMAC_FTR_DEF(13)
225
226 /* PMAC_FTR_1394_CABLE_POWER (struct device_node* node, 0, int value)
227 * enable/disable the firewire cable power supply of the uninorth
228 * firewire cell
229 */
230 #define PMAC_FTR_1394_CABLE_POWER PMAC_FTR_DEF(14)
231
232 /* PMAC_FTR_SLEEP_STATE (struct device_node* node, 0, int value)
233 * set the sleep state of the motherboard.
234 * Pass -1 as value to query for sleep capability
235 */
236 #define PMAC_FTR_SLEEP_STATE PMAC_FTR_DEF(15)
237
238 /* PMAC_FTR_GET_MB_INFO (NULL, selector, 0)
239 *
240 * returns some motherboard infos.
241 * selector: 0 - model id
242 * 1 - model flags (capabilities)
243 * 2 - model name (cast to const char *)
244 */
245 #define PMAC_FTR_GET_MB_INFO PMAC_FTR_DEF(16)
246 #define PMAC_MB_INFO_MODEL 0
247 #define PMAC_MB_INFO_FLAGS 1
248 #define PMAC_MB_INFO_NAME 2
249
250 /* PMAC_FTR_READ_GPIO (NULL, int index, 0)
251 *
252 * read a GPIO from a mac-io controller of type KeyLargo or Pangea.
253 * the value returned is a byte (positive), or a negative error code
254 */
255 #define PMAC_FTR_READ_GPIO PMAC_FTR_DEF(17)
256
257 /* PMAC_FTR_WRITE_GPIO (NULL, int index, int value)
258 *
259 * write a GPIO of a mac-io controller of type KeyLargo or Pangea.
260 */
261 #define PMAC_FTR_WRITE_GPIO PMAC_FTR_DEF(18)
262
263
264 /* Don't use those directly, they are for the sake of pmac_setup.c */
265 extern int pmac_do_feature_call(unsigned int selector, ...);
266 extern void pmac_feature_init(void);
267 extern void pmac_feature_late_init(void);
268
269 #define PMAC_FTR_DEF(x) ((_MACH_Pmac << 16) | (x))
270
271 #endif /* __PPC_ASM_PMAC_FEATURE_H */
272 #endif /* __KERNEL__ */
273