]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/staging/et131x/et1310_pm.h
Staging: add et131x network driver
[linux-2.6-omap-h63xx.git] / drivers / staging / et131x / et1310_pm.h
1 /*
2  * Agere Systems Inc.
3  * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
4  *
5  * Copyright © 2005 Agere Systems Inc.
6  * All rights reserved.
7  *   http://www.agere.com
8  *
9  *------------------------------------------------------------------------------
10  *
11  * et1310_pm.h - Defines, structs, enums, prototypes, etc. pertaining to power
12  *               management.
13  *
14  *------------------------------------------------------------------------------
15  *
16  * SOFTWARE LICENSE
17  *
18  * This software is provided subject to the following terms and conditions,
19  * which you should read carefully before using the software.  Using this
20  * software indicates your acceptance of these terms and conditions.  If you do
21  * not agree with these terms and conditions, do not use the software.
22  *
23  * Copyright © 2005 Agere Systems Inc.
24  * All rights reserved.
25  *
26  * Redistribution and use in source or binary forms, with or without
27  * modifications, are permitted provided that the following conditions are met:
28  *
29  * . Redistributions of source code must retain the above copyright notice, this
30  *    list of conditions and the following Disclaimer as comments in the code as
31  *    well as in the documentation and/or other materials provided with the
32  *    distribution.
33  *
34  * . Redistributions in binary form must reproduce the above copyright notice,
35  *    this list of conditions and the following Disclaimer in the documentation
36  *    and/or other materials provided with the distribution.
37  *
38  * . Neither the name of Agere Systems Inc. nor the names of the contributors
39  *    may be used to endorse or promote products derived from this software
40  *    without specific prior written permission.
41  *
42  * Disclaimer
43  *
44  * THIS SOFTWARE IS PROVIDED \93AS IS\94 AND ANY EXPRESS OR IMPLIED WARRANTIES,
45  * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
46  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
47  * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
48  * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
49  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
50  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
52  * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
54  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
55  * DAMAGE.
56  *
57  */
58
59 #ifndef _ET1310_PM_H_
60 #define _ET1310_PM_H_
61
62 #include "et1310_address_map.h"
63
64 #define MAX_WOL_PACKET_SIZE    0x80
65 #define MAX_WOL_MASK_SIZE      ( MAX_WOL_PACKET_SIZE / 8 )
66 #define NUM_WOL_PATTERNS       0x5
67 #define CRC16_POLY             0x1021
68
69 /* Definition of NDIS_DEVICE_POWER_STATE */
70 typedef enum {
71         NdisDeviceStateUnspecified = 0,
72         NdisDeviceStateD0,
73         NdisDeviceStateD1,
74         NdisDeviceStateD2,
75         NdisDeviceStateD3
76 } NDIS_DEVICE_POWER_STATE;
77
78 typedef struct _MP_POWER_MGMT {
79         /* variable putting the phy into coma mode when boot up with no cable
80          * plugged in after 5 seconds
81          */
82         u8 TransPhyComaModeOnBoot;
83
84         /* Array holding the five CRC values that the device is currently
85          * using for WOL.  This will be queried when a pattern is to be
86          * removed.
87          */
88         u32 localWolAndCrc0;
89         u16 WOLPatternList[NUM_WOL_PATTERNS];
90         u8 WOLMaskList[NUM_WOL_PATTERNS][MAX_WOL_MASK_SIZE];
91         u32 WOLMaskSize[NUM_WOL_PATTERNS];
92
93         /* IP address */
94         union {
95                 u32 u32;
96                 u8 u8[4];
97         } IPAddress;
98
99         /* Current Power state of the adapter. */
100         NDIS_DEVICE_POWER_STATE PowerState;
101         bool WOLState;
102         bool WOLEnabled;
103         bool Failed10Half;
104         bool bFailedStateTransition;
105
106         /* Next two used to save power information at power down. This
107          * information will be used during power up to set up parts of Power
108          * Management in JAGCore
109          */
110         u32 tx_en;
111         u32 rx_en;
112         u16 PowerDownSpeed;
113         u8 PowerDownDuplex;
114 } MP_POWER_MGMT, *PMP_POWER_MGMT;
115
116 /* Forward declaration of the private adapter structure
117  * ( IS THERE A WAY TO DO THIS WITH A TYPEDEF??? )
118  */
119 struct et131x_adapter;
120
121 u16 CalculateCCITCRC16(u8 *Pattern, u8 *Mask, u32 MaskSize);
122 void EnablePhyComa(struct et131x_adapter *adapter);
123 void DisablePhyComa(struct et131x_adapter *adapter);
124
125 #endif /* _ET1310_PM_H_ */