Lines Matching +full:main +full:- +full:eeprom

3  * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
9 * COPYING in the main directory of this source tree, or the
16 * - Redistributions of source code must retain the above
20 * - Redistributions in binary form must reproduce the above
42 * Functions specific to the serial EEPROM on cards handled by ib_qib.
47 * qib_eeprom_read - receives bytes from the eeprom via I2C
58 ret = mutex_lock_interruptible(&dd->eep_lock); in qib_eeprom_read()
62 qib_dev_err(dd, "EEPROM Reset for read failed\n"); in qib_eeprom_read()
64 ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, in qib_eeprom_read()
66 mutex_unlock(&dd->eep_lock); in qib_eeprom_read()
73 * Actually update the eeprom, first doing write enable if
82 pwen = dd->f_eeprom_wen(dd, 1); in eeprom_write_with_enable()
85 qib_dev_err(dd, "EEPROM Reset for write failed\n"); in eeprom_write_with_enable()
87 ret = qib_twsi_blk_wr(dd, dd->twsi_eeprom_dev, in eeprom_write_with_enable()
89 dd->f_eeprom_wen(dd, pwen); in eeprom_write_with_enable()
94 * qib_eeprom_write - writes data to the eeprom via I2C
105 ret = mutex_lock_interruptible(&dd->eep_lock); in qib_eeprom_write()
108 mutex_unlock(&dd->eep_lock); in qib_eeprom_write()
121 * Checksum of erased eeprom will still be bad, but we avoid in flash_csum()
124 len = ifp->if_length; in flash_csum()
127 while (len--) in flash_csum()
129 csum -= ifp->if_csum; in flash_csum()
132 ifp->if_csum = csum; in flash_csum()
138 * qib_get_eeprom_info- get the GUID et al. from the TSWI EEPROM device
151 int t = dd->unit; in qib_get_eeprom_info()
154 if (t && dd0->nguid > 1 && t <= dd0->nguid) { in qib_get_eeprom_info()
157 dd->base_guid = dd0->base_guid; in qib_get_eeprom_info()
158 bguid = (u8 *) &dd->base_guid; in qib_get_eeprom_info()
167 dd->base_guid = 0; in qib_get_eeprom_info()
174 dd->nguid = 1; in qib_get_eeprom_info()
188 * Use "public" eeprom read function, which does locking and in qib_get_eeprom_info()
189 * figures out device. This will migrate to chip-specific. in qib_get_eeprom_info()
194 qib_dev_err(dd, "Failed reading GUID from eeprom\n"); in qib_get_eeprom_info()
200 if (csum != ifp->if_csum) { in qib_get_eeprom_info()
201 qib_devinfo(dd->pcidev, in qib_get_eeprom_info()
203 csum, ifp->if_csum); in qib_get_eeprom_info()
206 if (*(__be64 *) ifp->if_guid == cpu_to_be64(0) || in qib_get_eeprom_info()
207 *(__be64 *) ifp->if_guid == ~cpu_to_be64(0)) { in qib_get_eeprom_info()
210 *(unsigned long long *) ifp->if_guid); in qib_get_eeprom_info()
216 if (*(u64 *) ifp->if_guid == 0x100007511000000ULL) in qib_get_eeprom_info()
217 qib_devinfo(dd->pcidev, in qib_get_eeprom_info()
219 *(unsigned long long *) ifp->if_guid); in qib_get_eeprom_info()
221 bguid = ifp->if_guid; in qib_get_eeprom_info()
232 guid = *(__be64 *) ifp->if_guid; in qib_get_eeprom_info()
234 guid = *(__be64 *) ifp->if_guid; in qib_get_eeprom_info()
235 dd->base_guid = guid; in qib_get_eeprom_info()
236 dd->nguid = ifp->if_numguid; in qib_get_eeprom_info()
239 * support both the Pathscale 10-digit serial number and the QLogic in qib_get_eeprom_info()
240 * 13-character version. in qib_get_eeprom_info()
242 if ((ifp->if_fversion > 1) && ifp->if_sprefix[0] && in qib_get_eeprom_info()
243 ((u8 *) ifp->if_sprefix)[0] != 0xFF) { in qib_get_eeprom_info()
244 char *snp = dd->serial; in qib_get_eeprom_info()
247 * This board has a Serial-prefix, which is stored in qib_get_eeprom_info()
248 * elsewhere for backward-compatibility. in qib_get_eeprom_info()
250 memcpy(snp, ifp->if_sprefix, sizeof(ifp->if_sprefix)); in qib_get_eeprom_info()
251 snp[sizeof(ifp->if_sprefix)] = '\0'; in qib_get_eeprom_info()
254 len = sizeof(dd->serial) - len; in qib_get_eeprom_info()
255 if (len > sizeof(ifp->if_serial)) in qib_get_eeprom_info()
256 len = sizeof(ifp->if_serial); in qib_get_eeprom_info()
257 memcpy(snp, ifp->if_serial, len); in qib_get_eeprom_info()
259 memcpy(dd->serial, ifp->if_serial, sizeof(ifp->if_serial)); in qib_get_eeprom_info()
261 if (!strstr(ifp->if_comment, "Tested successfully")) in qib_get_eeprom_info()
264 dd->serial, ifp->if_comment); in qib_get_eeprom_info()