![]() |
|
|||
0001 /* 0002 * Definition of platform feature hooks for PowerMacs 0003 * 0004 * This file is subject to the terms and conditions of the GNU General Public 0005 * License. See the file "COPYING" in the main directory of this archive 0006 * for more details. 0007 * 0008 * Copyright (C) 1998 Paul Mackerras & 0009 * Ben. Herrenschmidt. 0010 * 0011 * 0012 * Note: I removed media-bay details from the feature stuff, I believe it's 0013 * not worth it, the media-bay driver can directly use the mac-io 0014 * ASIC registers. 0015 * 0016 * Implementation note: Currently, none of these functions will block. 0017 * However, they may internally protect themselves with a spinlock 0018 * for way too long. Be prepared for at least some of these to block 0019 * in the future. 0020 * 0021 * Unless specifically defined, the result code is assumed to be an 0022 * error when negative, 0 is the default success result. Some functions 0023 * may return additional positive result values. 0024 * 0025 * To keep implementation simple, all feature calls are assumed to have 0026 * the prototype parameters (struct device_node* node, int value). 0027 * When either is not used, pass 0. 0028 */ 0029 0030 #ifdef __KERNEL__ 0031 #ifndef __ASM_POWERPC_PMAC_FEATURE_H 0032 #define __ASM_POWERPC_PMAC_FEATURE_H 0033 0034 #include <asm/macio.h> 0035 #include <asm/machdep.h> 0036 0037 /* 0038 * Known Mac motherboard models 0039 * 0040 * Please, report any error here to benh@kernel.crashing.org, thanks ! 0041 * 0042 * Note that I don't fully maintain this list for Core99 & MacRISC2 0043 * and I'm considering removing all NewWorld entries from it and 0044 * entirely rely on the model string. 0045 */ 0046 0047 /* PowerSurge are the first generation of PCI Pmacs. This include 0048 * all of the Grand-Central based machines. We currently don't 0049 * differentiate most of them. 0050 */ 0051 #define PMAC_TYPE_PSURGE 0x10 /* PowerSurge */ 0052 #define PMAC_TYPE_ANS 0x11 /* Apple Network Server */ 0053 0054 /* Here is the infamous serie of OHare based machines 0055 */ 0056 #define PMAC_TYPE_COMET 0x20 /* Believed to be PowerBook 2400 */ 0057 #define PMAC_TYPE_HOOPER 0x21 /* Believed to be PowerBook 3400 */ 0058 #define PMAC_TYPE_KANGA 0x22 /* PowerBook 3500 (first G3) */ 0059 #define PMAC_TYPE_ALCHEMY 0x23 /* Alchemy motherboard base */ 0060 #define PMAC_TYPE_GAZELLE 0x24 /* Spartacus, some 5xxx/6xxx */ 0061 #define PMAC_TYPE_UNKNOWN_OHARE 0x2f /* Unknown, but OHare based */ 0062 0063 /* Here are the Heathrow based machines 0064 * FIXME: Differenciate wallstreet,mainstreet,wallstreetII 0065 */ 0066 #define PMAC_TYPE_GOSSAMER 0x30 /* Gossamer motherboard */ 0067 #define PMAC_TYPE_SILK 0x31 /* Desktop PowerMac G3 */ 0068 #define PMAC_TYPE_WALLSTREET 0x32 /* Wallstreet/Mainstreet PowerBook*/ 0069 #define PMAC_TYPE_UNKNOWN_HEATHROW 0x3f /* Unknown but heathrow based */ 0070 0071 /* Here are newworld machines based on Paddington (heathrow derivative) 0072 */ 0073 #define PMAC_TYPE_101_PBOOK 0x40 /* 101 PowerBook (aka Lombard) */ 0074 #define PMAC_TYPE_ORIG_IMAC 0x41 /* First generation iMac */ 0075 #define PMAC_TYPE_YOSEMITE 0x42 /* B&W G3 */ 0076 #define PMAC_TYPE_YIKES 0x43 /* Yikes G4 (PCI graphics) */ 0077 #define PMAC_TYPE_UNKNOWN_PADDINGTON 0x4f /* Unknown but paddington based */ 0078 0079 /* Core99 machines based on UniNorth 1.0 and 1.5 0080 * 0081 * Note: A single entry here may cover several actual models according 0082 * to the device-tree. (Sawtooth is most tower G4s, FW_IMAC is most 0083 * FireWire based iMacs, etc...). Those machines are too similar to be 0084 * distinguished here, when they need to be differencied, use the 0085 * device-tree "model" or "compatible" property. 0086 */ 0087 #define PMAC_TYPE_ORIG_IBOOK 0x40 /* First iBook model (no firewire) */ 0088 #define PMAC_TYPE_SAWTOOTH 0x41 /* Desktop G4s */ 0089 #define PMAC_TYPE_FW_IMAC 0x42 /* FireWire iMacs (except Pangea based) */ 0090 #define PMAC_TYPE_FW_IBOOK 0x43 /* FireWire iBooks (except iBook2) */ 0091 #define PMAC_TYPE_CUBE 0x44 /* Cube PowerMac */ 0092 #define PMAC_TYPE_QUICKSILVER 0x45 /* QuickSilver G4s */ 0093 #define PMAC_TYPE_PISMO 0x46 /* Pismo PowerBook */ 0094 #define PMAC_TYPE_TITANIUM 0x47 /* Titanium PowerBook */ 0095 #define PMAC_TYPE_TITANIUM2 0x48 /* Titanium II PowerBook (no L3, M6) */ 0096 #define PMAC_TYPE_TITANIUM3 0x49 /* Titanium III PowerBook (with L3 & M7) */ 0097 #define PMAC_TYPE_TITANIUM4 0x50 /* Titanium IV PowerBook (with L3 & M9) */ 0098 #define PMAC_TYPE_EMAC 0x50 /* eMac */ 0099 #define PMAC_TYPE_UNKNOWN_CORE99 0x5f 0100 0101 /* MacRisc2 with UniNorth 2.0 */ 0102 #define PMAC_TYPE_RACKMAC 0x80 /* XServe */ 0103 #define PMAC_TYPE_WINDTUNNEL 0x81 0104 0105 /* MacRISC2 machines based on the Pangea chipset 0106 */ 0107 #define PMAC_TYPE_PANGEA_IMAC 0x100 /* Flower Power iMac */ 0108 #define PMAC_TYPE_IBOOK2 0x101 /* iBook2 (polycarbonate) */ 0109 #define PMAC_TYPE_FLAT_PANEL_IMAC 0x102 /* Flat panel iMac */ 0110 #define PMAC_TYPE_UNKNOWN_PANGEA 0x10f 0111 0112 /* MacRISC2 machines based on the Intrepid chipset 0113 */ 0114 #define PMAC_TYPE_UNKNOWN_INTREPID 0x11f /* Generic */ 0115 0116 /* MacRISC4 / G5 machines. We don't have per-machine selection here anymore, 0117 * but rather machine families 0118 */ 0119 #define PMAC_TYPE_POWERMAC_G5 0x150 /* U3 & U3H based */ 0120 #define PMAC_TYPE_POWERMAC_G5_U3L 0x151 /* U3L based desktop */ 0121 #define PMAC_TYPE_IMAC_G5 0x152 /* iMac G5 */ 0122 #define PMAC_TYPE_XSERVE_G5 0x153 /* Xserve G5 */ 0123 #define PMAC_TYPE_UNKNOWN_K2 0x19f /* Any other K2 based */ 0124 #define PMAC_TYPE_UNKNOWN_SHASTA 0x19e /* Any other Shasta based */ 0125 0126 /* 0127 * Motherboard flags 0128 */ 0129 0130 #define PMAC_MB_CAN_SLEEP 0x00000001 0131 #define PMAC_MB_HAS_FW_POWER 0x00000002 0132 #define PMAC_MB_OLD_CORE99 0x00000004 0133 #define PMAC_MB_MOBILE 0x00000008 0134 #define PMAC_MB_MAY_SLEEP 0x00000010 0135 0136 /* 0137 * Feature calls supported on pmac 0138 * 0139 */ 0140 0141 /* 0142 * Use this inline wrapper 0143 */ 0144 struct device_node; 0145 0146 static inline long pmac_call_feature(int selector, struct device_node* node, 0147 long param, long value) 0148 { 0149 if (!ppc_md.feature_call || !machine_is(powermac)) 0150 return -ENODEV; 0151 return ppc_md.feature_call(selector, node, param, value); 0152 } 0153 0154 /* PMAC_FTR_SERIAL_ENABLE (struct device_node* node, int param, int value) 0155 * enable/disable an SCC side. Pass the node corresponding to the 0156 * channel side as a parameter. 0157 * param is the type of port 0158 * if param is ored with PMAC_SCC_FLAG_XMON, then the SCC is locked enabled 0159 * for use by xmon. 0160 */ 0161 #define PMAC_FTR_SCC_ENABLE PMAC_FTR_DEF(0) 0162 #define PMAC_SCC_ASYNC 0 0163 #define PMAC_SCC_IRDA 1 0164 #define PMAC_SCC_I2S1 2 0165 #define PMAC_SCC_FLAG_XMON 0x00001000 0166 0167 /* PMAC_FTR_MODEM_ENABLE (struct device_node* node, 0, int value) 0168 * enable/disable the internal modem. 0169 */ 0170 #define PMAC_FTR_MODEM_ENABLE PMAC_FTR_DEF(1) 0171 0172 /* PMAC_FTR_SWIM3_ENABLE (struct device_node* node, 0,int value) 0173 * enable/disable the swim3 (floppy) cell of a mac-io ASIC 0174 */ 0175 #define PMAC_FTR_SWIM3_ENABLE PMAC_FTR_DEF(2) 0176 0177 /* PMAC_FTR_MESH_ENABLE (struct device_node* node, 0, int value) 0178 * enable/disable the mesh (scsi) cell of a mac-io ASIC 0179 */ 0180 #define PMAC_FTR_MESH_ENABLE PMAC_FTR_DEF(3) 0181 0182 /* PMAC_FTR_IDE_ENABLE (struct device_node* node, int busID, int value) 0183 * enable/disable an IDE port of a mac-io ASIC 0184 * pass the busID parameter 0185 */ 0186 #define PMAC_FTR_IDE_ENABLE PMAC_FTR_DEF(4) 0187 0188 /* PMAC_FTR_IDE_RESET (struct device_node* node, int busID, int value) 0189 * assert(1)/release(0) an IDE reset line (mac-io IDE only) 0190 */ 0191 #define PMAC_FTR_IDE_RESET PMAC_FTR_DEF(5) 0192 0193 /* PMAC_FTR_BMAC_ENABLE (struct device_node* node, 0, int value) 0194 * enable/disable the bmac (ethernet) cell of a mac-io ASIC, also drive 0195 * it's reset line 0196 */ 0197 #define PMAC_FTR_BMAC_ENABLE PMAC_FTR_DEF(6) 0198 0199 /* PMAC_FTR_GMAC_ENABLE (struct device_node* node, 0, int value) 0200 * enable/disable the gmac (ethernet) cell of an uninorth ASIC. This 0201 * control the cell's clock. 0202 */ 0203 #define PMAC_FTR_GMAC_ENABLE PMAC_FTR_DEF(7) 0204 0205 /* PMAC_FTR_GMAC_PHY_RESET (struct device_node* node, 0, 0) 0206 * Perform a HW reset of the PHY connected to a gmac controller. 0207 * Pass the gmac device node, not the PHY node. 0208 */ 0209 #define PMAC_FTR_GMAC_PHY_RESET PMAC_FTR_DEF(8) 0210 0211 /* PMAC_FTR_SOUND_CHIP_ENABLE (struct device_node* node, 0, int value) 0212 * enable/disable the sound chip, whatever it is and provided it can 0213 * actually be controlled 0214 */ 0215 #define PMAC_FTR_SOUND_CHIP_ENABLE PMAC_FTR_DEF(9) 0216 0217 /* -- add various tweaks related to sound routing -- */ 0218 0219 /* PMAC_FTR_AIRPORT_ENABLE (struct device_node* node, 0, int value) 0220 * enable/disable the airport card 0221 */ 0222 #define PMAC_FTR_AIRPORT_ENABLE PMAC_FTR_DEF(10) 0223 0224 /* PMAC_FTR_RESET_CPU (NULL, int cpu_nr, 0) 0225 * toggle the reset line of a CPU on an uninorth-based SMP machine 0226 */ 0227 #define PMAC_FTR_RESET_CPU PMAC_FTR_DEF(11) 0228 0229 /* PMAC_FTR_USB_ENABLE (struct device_node* node, 0, int value) 0230 * enable/disable an USB cell, along with the power of the USB "pad" 0231 * on keylargo based machines 0232 */ 0233 #define PMAC_FTR_USB_ENABLE PMAC_FTR_DEF(12) 0234 0235 /* PMAC_FTR_1394_ENABLE (struct device_node* node, 0, int value) 0236 * enable/disable the firewire cell of an uninorth ASIC. 0237 */ 0238 #define PMAC_FTR_1394_ENABLE PMAC_FTR_DEF(13) 0239 0240 /* PMAC_FTR_1394_CABLE_POWER (struct device_node* node, 0, int value) 0241 * enable/disable the firewire cable power supply of the uninorth 0242 * firewire cell 0243 */ 0244 #define PMAC_FTR_1394_CABLE_POWER PMAC_FTR_DEF(14) 0245 0246 /* PMAC_FTR_SLEEP_STATE (struct device_node* node, 0, int value) 0247 * set the sleep state of the motherboard. 0248 * 0249 * Pass -1 as value to query for sleep capability 0250 * Pass 1 to set IOs to sleep 0251 * Pass 0 to set IOs to wake 0252 */ 0253 #define PMAC_FTR_SLEEP_STATE PMAC_FTR_DEF(15) 0254 0255 /* PMAC_FTR_GET_MB_INFO (NULL, selector, 0) 0256 * 0257 * returns some motherboard infos. 0258 * selector: 0 - model id 0259 * 1 - model flags (capabilities) 0260 * 2 - model name (cast to const char *) 0261 */ 0262 #define PMAC_FTR_GET_MB_INFO PMAC_FTR_DEF(16) 0263 #define PMAC_MB_INFO_MODEL 0 0264 #define PMAC_MB_INFO_FLAGS 1 0265 #define PMAC_MB_INFO_NAME 2 0266 0267 /* PMAC_FTR_READ_GPIO (NULL, int index, 0) 0268 * 0269 * read a GPIO from a mac-io controller of type KeyLargo or Pangea. 0270 * the value returned is a byte (positive), or a negative error code 0271 */ 0272 #define PMAC_FTR_READ_GPIO PMAC_FTR_DEF(17) 0273 0274 /* PMAC_FTR_WRITE_GPIO (NULL, int index, int value) 0275 * 0276 * write a GPIO of a mac-io controller of type KeyLargo or Pangea. 0277 */ 0278 #define PMAC_FTR_WRITE_GPIO PMAC_FTR_DEF(18) 0279 0280 /* PMAC_FTR_ENABLE_MPIC 0281 * 0282 * Enable the MPIC cell 0283 */ 0284 #define PMAC_FTR_ENABLE_MPIC PMAC_FTR_DEF(19) 0285 0286 /* PMAC_FTR_AACK_DELAY_ENABLE (NULL, int enable, 0) 0287 * 0288 * Enable/disable the AACK delay on the northbridge for systems using DFS 0289 */ 0290 #define PMAC_FTR_AACK_DELAY_ENABLE PMAC_FTR_DEF(20) 0291 0292 /* PMAC_FTR_DEVICE_CAN_WAKE 0293 * 0294 * Used by video drivers to inform system that they can actually perform 0295 * wakeup from sleep 0296 */ 0297 #define PMAC_FTR_DEVICE_CAN_WAKE PMAC_FTR_DEF(22) 0298 0299 0300 /* Don't use those directly, they are for the sake of pmac_setup.c */ 0301 extern long pmac_do_feature_call(unsigned int selector, ...); 0302 extern void pmac_feature_init(void); 0303 0304 /* Video suspend tweak */ 0305 extern void pmac_set_early_video_resume(void (*proc)(void *data), void *data); 0306 extern void pmac_call_early_video_resume(void); 0307 0308 #define PMAC_FTR_DEF(x) ((0x6660000) | (x)) 0309 0310 /* The AGP driver registers itself here */ 0311 extern void pmac_register_agp_pm(struct pci_dev *bridge, 0312 int (*suspend)(struct pci_dev *bridge), 0313 int (*resume)(struct pci_dev *bridge)); 0314 0315 /* Those are meant to be used by video drivers to deal with AGP 0316 * suspend resume properly 0317 */ 0318 extern void pmac_suspend_agp_for_card(struct pci_dev *dev); 0319 extern void pmac_resume_agp_for_card(struct pci_dev *dev); 0320 0321 /* 0322 * The part below is for use by macio_asic.c only, do not rely 0323 * on the data structures or constants below in a normal driver 0324 * 0325 */ 0326 0327 #define MAX_MACIO_CHIPS 2 0328 0329 enum { 0330 macio_unknown = 0, 0331 macio_grand_central, 0332 macio_ohare, 0333 macio_ohareII, 0334 macio_heathrow, 0335 macio_gatwick, 0336 macio_paddington, 0337 macio_keylargo, 0338 macio_pangea, 0339 macio_intrepid, 0340 macio_keylargo2, 0341 macio_shasta, 0342 }; 0343 0344 struct macio_chip 0345 { 0346 struct device_node *of_node; 0347 int type; 0348 const char *name; 0349 int rev; 0350 volatile u32 __iomem *base; 0351 unsigned long flags; 0352 0353 /* For use by macio_asic PCI driver */ 0354 struct macio_bus lbus; 0355 }; 0356 0357 extern struct macio_chip macio_chips[MAX_MACIO_CHIPS]; 0358 0359 #define MACIO_FLAG_SCCA_ON 0x00000001 0360 #define MACIO_FLAG_SCCB_ON 0x00000002 0361 #define MACIO_FLAG_SCC_LOCKED 0x00000004 0362 #define MACIO_FLAG_AIRPORT_ON 0x00000010 0363 #define MACIO_FLAG_FW_SUPPORTED 0x00000020 0364 0365 extern struct macio_chip* macio_find(struct device_node* child, int type); 0366 0367 #define MACIO_FCR32(macio, r) ((macio)->base + ((r) >> 2)) 0368 #define MACIO_FCR8(macio, r) (((volatile u8 __iomem *)((macio)->base)) + (r)) 0369 0370 #define MACIO_IN32(r) (in_le32(MACIO_FCR32(macio,r))) 0371 #define MACIO_OUT32(r,v) (out_le32(MACIO_FCR32(macio,r), (v))) 0372 #define MACIO_BIS(r,v) (MACIO_OUT32((r), MACIO_IN32(r) | (v))) 0373 #define MACIO_BIC(r,v) (MACIO_OUT32((r), MACIO_IN32(r) & ~(v))) 0374 #define MACIO_IN8(r) (in_8(MACIO_FCR8(macio,r))) 0375 #define MACIO_OUT8(r,v) (out_8(MACIO_FCR8(macio,r), (v))) 0376 0377 /* 0378 * Those are exported by pmac feature for internal use by arch code 0379 * only like the platform function callbacks, do not use directly in drivers 0380 */ 0381 extern raw_spinlock_t feature_lock; 0382 extern struct device_node *uninorth_node; 0383 extern u32 __iomem *uninorth_base; 0384 0385 /* 0386 * Uninorth reg. access. Note that Uni-N regs are big endian 0387 */ 0388 0389 #define UN_REG(r) (uninorth_base + ((r) >> 2)) 0390 #define UN_IN(r) (in_be32(UN_REG(r))) 0391 #define UN_OUT(r,v) (out_be32(UN_REG(r), (v))) 0392 #define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v))) 0393 #define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v))) 0394 0395 /* Uninorth variant: 0396 * 0397 * 0 = not uninorth 0398 * 1 = U1.x or U2.x 0399 * 3 = U3 0400 * 4 = U4 0401 */ 0402 extern int pmac_get_uninorth_variant(void); 0403 0404 /* 0405 * Power macintoshes have either a CUDA, PMU or SMU controlling 0406 * system reset, power, NVRAM, RTC. 0407 */ 0408 typedef enum sys_ctrler_kind { 0409 SYS_CTRLER_UNKNOWN = 0, 0410 SYS_CTRLER_CUDA = 1, 0411 SYS_CTRLER_PMU = 2, 0412 SYS_CTRLER_SMU = 3, 0413 } sys_ctrler_t; 0414 extern sys_ctrler_t sys_ctrler; 0415 0416 #endif /* __ASM_POWERPC_PMAC_FEATURE_H */ 0417 #endif /* __KERNEL__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |