| 1 | /*- |
| 2 | * Copyright (c) 2014 Yandex LLC. |
| 3 | * |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 25 | * SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * The following set of constants are from Document SFF-8436 |
| 30 | * "QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER" revision 4.8 dated October 31, 2013 |
| 31 | * |
| 32 | * This SFF standard defines the following QSFP+ memory address module: |
| 33 | * |
| 34 | * 1) 256-byte addressable block and 128-byte pages |
| 35 | * 2) Lower 128-bytes addresses always refer to the same page |
| 36 | * 3) Upper address space may refer to different pages depending on |
| 37 | * "page select" byte value. |
| 38 | * |
| 39 | * Map description: |
| 40 | * |
| 41 | * Serial address 0xA02: |
| 42 | * |
| 43 | * Lower bits |
| 44 | * 0-127 Monitoring data & page select byte |
| 45 | * 128-255: |
| 46 | * |
| 47 | * Page 00: |
| 48 | * 128-191 Base ID Fields |
| 49 | * 191-223 Extended ID |
| 50 | * 223-255 Vendor Specific ID |
| 51 | * |
| 52 | * Page 01 (optional): |
| 53 | * 128-255 App-specific data |
| 54 | * |
| 55 | * Page 02 (optional): |
| 56 | * 128-255 User EEPROM Data |
| 57 | * |
| 58 | * Page 03 (optional for Cable Assmeblies) |
| 59 | * 128-223 Thresholds |
| 60 | * 225-237 Vendor Specific |
| 61 | * 238-253 Channel Controls/Monitor |
| 62 | * 254-255 Reserverd |
| 63 | * |
| 64 | * All these values are read across an I2C (i squared C) bus. |
| 65 | */ |
| 66 | |
| 67 | #define	SFF_8436_BASE	0xA0	/* Base address for all requests */ |
| 68 | |
| 69 | /* Table 17 - Lower Memory Map */ |
| 70 | enum { |
| 71 | 	SFF_8436_MID		= 0,	/* Copy of SFF_8436_ID field */ |
| 72 | 	SFF_8436_STATUS		= 1,	/* 2-bytes status (Table 18) */ |
| 73 | 	SFF_8436_INTR_START	= 3,	/* Interrupt flags (Tables 19-21) */ |
| 74 | 	SFF_8436_INTR_END	= 21, |
| 75 | 	SFF_8436_MODMON_START	= 22,	/* Module monitors (Table 22 */ |
| 76 | 	SFF_8436_TEMP		= 22,	/* Internally measured module temp */ |
| 77 | 	SFF_8436_VCC		= 26,	/* Internally mesasure module |
| 78 | 					* supplied voltage */ |
| 79 | 	SFF_8436_MODMON_END	= 33, |
| 80 | 	SFF_8436_CHMON_START	= 34,	/* Channel monitors (Table 23) */ |
| 81 | 	SFF_8436_RX_CH1_MSB	= 34,	/* Internally measured RX input power */ |
| 82 | 	SFF_8436_RX_CH1_LSB	= 35,	/* for channel 1 */ |
| 83 | 	SFF_8436_RX_CH2_MSB	= 36,	/* Internally measured RX input power */ |
| 84 | 	SFF_8436_RX_CH2_LSB	= 37,	/* for channel 2 */ |
| 85 | 	SFF_8436_RX_CH3_MSB	= 38,	/* Internally measured RX input power */ |
| 86 | 	SFF_8436_RX_CH3_LSB	= 39,	/* for channel 3 */ |
| 87 | 	SFF_8436_RX_CH4_MSB	= 40,	/* Internally measured RX input power */ |
| 88 | 	SFF_8436_RX_CH4_LSB	= 41,	/* for channel 4 */ |
| 89 | 	SFF_8436_TX_CH1_MSB	= 42,	/* Internally measured TX bias */ |
| 90 | 	SFF_8436_TX_CH1_LSB	= 43,	/* for channel 1 */ |
| 91 | 	SFF_8436_TX_CH2_MSB	= 44,	/* Internally measured TX bias */ |
| 92 | 	SFF_8436_TX_CH2_LSB	= 45,	/* for channel 2 */ |
| 93 | 	SFF_8436_TX_CH3_MSB	= 46,	/* Internally measured TX bias */ |
| 94 | 	SFF_8436_TX_CH3_LSB	= 47,	/* for channel 3 */ |
| 95 | 	SFF_8436_TX_CH4_MSB	= 48,	/* Internally measured TX bias */ |
| 96 | 	SFF_8436_TX_CH4_LSB	= 49,	/* for channel 4 */ |
| 97 | 	SFF_8436_CHANMON_END	= 81, |
| 98 | 	SFF_8436_CONTROL_START	= 86,	/* Control (Table 24) */ |
| 99 | 	SFF_8436_CONTROL_END	= 97, |
| 100 | 	SFF_8436_MASKS_START	= 100,	/* Module/channel masks (Table 25) */ |
| 101 | 	SFF_8436_MASKS_END	= 106, |
| 102 | 	SFF_8436_CHPASSWORD	= 119,	/* Password change entry (4 bytes) */ |
| 103 | 	SFF_8436_PASSWORD	= 123,	/* Password entry area (4 bytes) */ |
| 104 | 	SFF_8436_PAGESEL	= 127,	/* Page select byte */ |
| 105 | }; |
| 106 | |
| 107 | /* Table 18 - Status Indicators bits */ |
| 108 | /* Byte 1: all bits reserved */ |
| 109 | |
| 110 | /* Byte 2 bits */ |
| 111 | #define	SFF_8436_STATUS_FLATMEM	(1 << 2)	/* Upper memory flat or paged |
| 112 | 						* 0 = paging, 1=Page 0 only */ |
| 113 | #define	SFF_8436_STATUS_INTL	(1 << 1)	/* Digital state of the intL |
| 114 | 						* Interrupt output pin */ |
| 115 | #define	SFF_8436_STATUS_NOTREADY 1		/* Module has not yet achieved |
| 116 | 						* power up and memory data is not |
| 117 | 						* ready. 0=data is ready */ |
| 118 | /* |
| 119 | * Upper page 0 definitions: |
| 120 | * Table 29 - Serial ID: Data fields. |
| 121 | * |
| 122 | * Note that this table is mostly the same as used in SFF-8472. |
| 123 | * The only differenee is address shift: +128 bytes. |
| 124 | */ |
| 125 | enum { |
| 126 | 	SFF_8436_ID		= 128, /* Module Type (defined in sff8472.h) */ |
| 127 | 	SFF_8436_EXT_ID		= 129, /* Extended transceiver type |
| 128 | 					 * (Table 31) */ |
| 129 | 	SFF_8436_CONNECTOR	= 130, /* Connector type (Table 32) */ |
| 130 | 	SFF_8436_TRANS_START	= 131, /* Electric or Optical Compatibility |
| 131 | 					 * (Table 33) */ |
| 132 | 	SFF_8436_CODE_E1040100G	= 131,	/* 10/40/100G Ethernet Compliance Code */ |
| 133 | 	SFF_8436_CODE_SONET	= 132,	/* SONET Compliance codes */ |
| 134 | 	SFF_8436_CODE_SATA	= 133,	/* SAS/SATA compliance codes */ |
| 135 | 	SFF_8436_CODE_E1G	= 134,	/* Gigabit Ethernet Compliant codes */ |
| 136 | 	SFF_8436_CODE_FC_START	= 135,	/* FC link/media/speed */ |
| 137 | 	SFF_8436_CODE_FC_END	= 138, |
| 138 | 	SFF_8436_TRANS_END	= 138, |
| 139 | 	SFF_8436_ENCODING	= 139,	/* Encoding Code for high speed |
| 140 | 					* serial encoding algorithm (see |
| 141 | 					* Table 34) */ |
| 142 | 	SFF_8436_BITRATE	= 140,	/* Nominal signaling rate, units |
| 143 | 					* of 100MBd. */ |
| 144 | 	SFF_8436_RATEID		= 141,	/* Extended RateSelect Compliance |
| 145 | 					* (see Table 35) */ |
| 146 | 	SFF_8436_LEN_SMF_KM	= 142,	/* Link length supported for single |
| 147 | 					* mode fiber, units of km */ |
| 148 | 	SFF_8436_LEN_OM3	= 143,	/* Link length supported for 850nm |
| 149 | 					* 50um multimode fiber, units of 2 m */ |
| 150 | 	SFF_8436_LEN_OM2	= 144, 	/* Link length supported for 50 um |
| 151 | 					* OM2 fiber, units of 1 m */ |
| 152 | 	SFF_8436_LEN_OM1	= 145,	/* Link length supported for 1310 nm |
| 153 | 					 * 50um multi-mode fiber, units of 1m*/ |
| 154 | 	SFF_8436_LEN_ASM	= 144, /* Link length of passive cable assembly |
| 155 | 					* Length is specified as in the INF |
| 156 | 					* 8074, units of 1m. 0 means this is |
| 157 | 					* not value assembly. Value of 255 |
| 158 | 					* means thet the Module supports length |
| 159 | 					* greater than 254 m. */ |
| 160 | 	SFF_8436_DEV_TECH	= 147,	/* Device/transmitter technology, |
| 161 | 					* see Table 36/37 */ |
| 162 | 	SFF_8436_VENDOR_START	= 148,	/* Vendor name, 16 bytes, padded |
| 163 | 					* right with 0x20 */ |
| 164 | 	SFF_8436_VENDOR_END	= 163, |
| 165 | 	SFF_8436_EXTMODCODE	= 164,	/* Extended module code, Table 164 */ |
| 166 | 	SFF_8436_VENDOR_OUI_START	= 165 , /* Vendor OUI SFP vendor IEEE |
| 167 | 					* company ID */ |
| 168 | 	SFF_8436_VENDOR_OUI_END	= 167, |
| 169 | 	SFF_8436_PN_START 	= 168,	/* Vendor PN, padded right with 0x20 */ |
| 170 | 	SFF_8436_PN_END 	= 183, |
| 171 | 	SFF_8436_REV_START 	= 184,	/* Vendor Revision, padded right 0x20 */ |
| 172 | 	SFF_8436_REV_END 	= 185, |
| 173 | 	SFF_8436_WAVELEN_START	= 186,	/* Wavelength Laser wavelength |
| 174 | 					* (Passive/Active Cable |
| 175 | 					* Specification Compliance) */ |
| 176 | 	SFF_8436_WAVELEN_END	= 189, |
| 177 | 	SFF_8436_MAX_CASE_TEMP	= 190,	/* Allows to specify maximum temp |
| 178 | 					* above 70C. Maximum case temperature is |
| 179 | 					* an 8-bit value in Degrees C. A value |
| 180 | 					*of 0 implies the standard 70C rating.*/ |
| 181 | 	SFF_8436_CC_BASE	= 191,	/* CC_BASE Check code for Base ID |
| 182 | 					* Fields (first 63 bytes) */ |
| 183 | 	/* Extended ID fields */ |
| 184 | 	SFF_8436_OPTIONS_START	= 192, /* Options Indicates which optional |
| 185 | 					* transceiver signals are |
| 186 | 					* implemented (see Table 39) */ |
| 187 | 	SFF_8436_OPTIONS_END	= 195, |
| 188 | 	SFF_8436_SN_START 	= 196,	/* Vendor SN, riwght padded with 0x20 */ |
| 189 | 	SFF_8436_SN_END 	= 211, |
| 190 | 	SFF_8436_DATE_START	= 212,	/* Vendor’s manufacturing date code |
| 191 | 					* (see Table 40) */ |
| 192 | 	SFF_8436_DATE_END	= 219, |
| 193 | 	SFF_8436_DIAG_TYPE	= 220,	/* Diagnostic Monitoring Type |
| 194 | 					* Indicates which type of |
| 195 | 					* diagnostic monitoring is |
| 196 | 					* implemented (if any) in the |
| 197 | 					* transceiver (see Table 41) */ |
| 198 | |
| 199 | 	SFF_8436_ENHANCED	= 221,	/* Enhanced Options Indicates which |
| 200 | 					* optional features are implemented |
| 201 | 					* (if any) in the transceiver |
| 202 | 					* (see Table 42) */ |
| 203 | 	SFF_8636_BITRATE	= 222,	/* Nominal bit rate per channel, units |
| 204 | 					* of 250 Mbps */ |
| 205 | 	SFF_8436_CC_EXT		= 223,	/* Check code for the Extended ID |
| 206 | 					* Fields (bytes 192-222 incl) */ |
| 207 | 	SFF_8436_VENDOR_RSRVD_START	= 224, |
| 208 | 	SFF_8436_VENDOR_RSRVD_END	= 255, |
| 209 | }; |