aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb/ixgb_ee.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgb/ixgb_ee.c')
-rw-r--r--drivers/net/ixgb/ixgb_ee.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index 8e9302fc8865..2f7ed52c7502 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -29,11 +29,11 @@
29#include "ixgb_hw.h" 29#include "ixgb_hw.h"
30#include "ixgb_ee.h" 30#include "ixgb_ee.h"
31/* Local prototypes */ 31/* Local prototypes */
32static uint16_t ixgb_shift_in_bits(struct ixgb_hw *hw); 32static u16 ixgb_shift_in_bits(struct ixgb_hw *hw);
33 33
34static void ixgb_shift_out_bits(struct ixgb_hw *hw, 34static void ixgb_shift_out_bits(struct ixgb_hw *hw,
35 uint16_t data, 35 u16 data,
36 uint16_t count); 36 u16 count);
37static void ixgb_standby_eeprom(struct ixgb_hw *hw); 37static void ixgb_standby_eeprom(struct ixgb_hw *hw);
38 38
39static bool ixgb_wait_eeprom_command(struct ixgb_hw *hw); 39static bool ixgb_wait_eeprom_command(struct ixgb_hw *hw);
@@ -48,7 +48,7 @@ static void ixgb_cleanup_eeprom(struct ixgb_hw *hw);
48 *****************************************************************************/ 48 *****************************************************************************/
49static void 49static void
50ixgb_raise_clock(struct ixgb_hw *hw, 50ixgb_raise_clock(struct ixgb_hw *hw,
51 uint32_t *eecd_reg) 51 u32 *eecd_reg)
52{ 52{
53 /* Raise the clock input to the EEPROM (by setting the SK bit), and then 53 /* Raise the clock input to the EEPROM (by setting the SK bit), and then
54 * wait 50 microseconds. 54 * wait 50 microseconds.
@@ -67,7 +67,7 @@ ixgb_raise_clock(struct ixgb_hw *hw,
67 *****************************************************************************/ 67 *****************************************************************************/
68static void 68static void
69ixgb_lower_clock(struct ixgb_hw *hw, 69ixgb_lower_clock(struct ixgb_hw *hw,
70 uint32_t *eecd_reg) 70 u32 *eecd_reg)
71{ 71{
72 /* Lower the clock input to the EEPROM (by clearing the SK bit), and then 72 /* Lower the clock input to the EEPROM (by clearing the SK bit), and then
73 * wait 50 microseconds. 73 * wait 50 microseconds.
@@ -87,11 +87,11 @@ ixgb_lower_clock(struct ixgb_hw *hw,
87 *****************************************************************************/ 87 *****************************************************************************/
88static void 88static void
89ixgb_shift_out_bits(struct ixgb_hw *hw, 89ixgb_shift_out_bits(struct ixgb_hw *hw,
90 uint16_t data, 90 u16 data,
91 uint16_t count) 91 u16 count)
92{ 92{
93 uint32_t eecd_reg; 93 u32 eecd_reg;
94 uint32_t mask; 94 u32 mask;
95 95
96 /* We need to shift "count" bits out to the EEPROM. So, value in the 96 /* We need to shift "count" bits out to the EEPROM. So, value in the
97 * "data" parameter will be shifted out to the EEPROM one bit at a time. 97 * "data" parameter will be shifted out to the EEPROM one bit at a time.
@@ -133,12 +133,12 @@ ixgb_shift_out_bits(struct ixgb_hw *hw,
133 * 133 *
134 * hw - Struct containing variables accessed by shared code 134 * hw - Struct containing variables accessed by shared code
135 *****************************************************************************/ 135 *****************************************************************************/
136static uint16_t 136static u16
137ixgb_shift_in_bits(struct ixgb_hw *hw) 137ixgb_shift_in_bits(struct ixgb_hw *hw)
138{ 138{
139 uint32_t eecd_reg; 139 u32 eecd_reg;
140 uint32_t i; 140 u32 i;
141 uint16_t data; 141 u16 data;
142 142
143 /* In order to read a register from the EEPROM, we need to shift 16 bits 143 /* In order to read a register from the EEPROM, we need to shift 16 bits
144 * in from the EEPROM. Bits are "shifted in" by raising the clock input to 144 * in from the EEPROM. Bits are "shifted in" by raising the clock input to
@@ -179,7 +179,7 @@ ixgb_shift_in_bits(struct ixgb_hw *hw)
179static void 179static void
180ixgb_setup_eeprom(struct ixgb_hw *hw) 180ixgb_setup_eeprom(struct ixgb_hw *hw)
181{ 181{
182 uint32_t eecd_reg; 182 u32 eecd_reg;
183 183
184 eecd_reg = IXGB_READ_REG(hw, EECD); 184 eecd_reg = IXGB_READ_REG(hw, EECD);
185 185
@@ -201,7 +201,7 @@ ixgb_setup_eeprom(struct ixgb_hw *hw)
201static void 201static void
202ixgb_standby_eeprom(struct ixgb_hw *hw) 202ixgb_standby_eeprom(struct ixgb_hw *hw)
203{ 203{
204 uint32_t eecd_reg; 204 u32 eecd_reg;
205 205
206 eecd_reg = IXGB_READ_REG(hw, EECD); 206 eecd_reg = IXGB_READ_REG(hw, EECD);
207 207
@@ -235,7 +235,7 @@ ixgb_standby_eeprom(struct ixgb_hw *hw)
235static void 235static void
236ixgb_clock_eeprom(struct ixgb_hw *hw) 236ixgb_clock_eeprom(struct ixgb_hw *hw)
237{ 237{
238 uint32_t eecd_reg; 238 u32 eecd_reg;
239 239
240 eecd_reg = IXGB_READ_REG(hw, EECD); 240 eecd_reg = IXGB_READ_REG(hw, EECD);
241 241
@@ -259,7 +259,7 @@ ixgb_clock_eeprom(struct ixgb_hw *hw)
259static void 259static void
260ixgb_cleanup_eeprom(struct ixgb_hw *hw) 260ixgb_cleanup_eeprom(struct ixgb_hw *hw)
261{ 261{
262 uint32_t eecd_reg; 262 u32 eecd_reg;
263 263
264 eecd_reg = IXGB_READ_REG(hw, EECD); 264 eecd_reg = IXGB_READ_REG(hw, EECD);
265 265
@@ -285,8 +285,8 @@ ixgb_cleanup_eeprom(struct ixgb_hw *hw)
285static bool 285static bool
286ixgb_wait_eeprom_command(struct ixgb_hw *hw) 286ixgb_wait_eeprom_command(struct ixgb_hw *hw)
287{ 287{
288 uint32_t eecd_reg; 288 u32 eecd_reg;
289 uint32_t i; 289 u32 i;
290 290
291 /* Toggle the CS line. This in effect tells to EEPROM to actually execute 291 /* Toggle the CS line. This in effect tells to EEPROM to actually execute
292 * the command in question. 292 * the command in question.
@@ -325,13 +325,13 @@ ixgb_wait_eeprom_command(struct ixgb_hw *hw)
325bool 325bool
326ixgb_validate_eeprom_checksum(struct ixgb_hw *hw) 326ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
327{ 327{
328 uint16_t checksum = 0; 328 u16 checksum = 0;
329 uint16_t i; 329 u16 i;
330 330
331 for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) 331 for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++)
332 checksum += ixgb_read_eeprom(hw, i); 332 checksum += ixgb_read_eeprom(hw, i);
333 333
334 if(checksum == (uint16_t) EEPROM_SUM) 334 if(checksum == (u16) EEPROM_SUM)
335 return (true); 335 return (true);
336 else 336 else
337 return (false); 337 return (false);
@@ -348,13 +348,13 @@ ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
348void 348void
349ixgb_update_eeprom_checksum(struct ixgb_hw *hw) 349ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
350{ 350{
351 uint16_t checksum = 0; 351 u16 checksum = 0;
352 uint16_t i; 352 u16 i;
353 353
354 for(i = 0; i < EEPROM_CHECKSUM_REG; i++) 354 for(i = 0; i < EEPROM_CHECKSUM_REG; i++)
355 checksum += ixgb_read_eeprom(hw, i); 355 checksum += ixgb_read_eeprom(hw, i);
356 356
357 checksum = (uint16_t) EEPROM_SUM - checksum; 357 checksum = (u16) EEPROM_SUM - checksum;
358 358
359 ixgb_write_eeprom(hw, EEPROM_CHECKSUM_REG, checksum); 359 ixgb_write_eeprom(hw, EEPROM_CHECKSUM_REG, checksum);
360 return; 360 return;
@@ -372,7 +372,7 @@ ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
372 * 372 *
373 *****************************************************************************/ 373 *****************************************************************************/
374void 374void
375ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t offset, uint16_t data) 375ixgb_write_eeprom(struct ixgb_hw *hw, u16 offset, u16 data)
376{ 376{
377 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 377 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
378 378
@@ -425,11 +425,11 @@ ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t offset, uint16_t data)
425 * Returns: 425 * Returns:
426 * The 16-bit value read from the eeprom 426 * The 16-bit value read from the eeprom
427 *****************************************************************************/ 427 *****************************************************************************/
428uint16_t 428u16
429ixgb_read_eeprom(struct ixgb_hw *hw, 429ixgb_read_eeprom(struct ixgb_hw *hw,
430 uint16_t offset) 430 u16 offset)
431{ 431{
432 uint16_t data; 432 u16 data;
433 433
434 /* Prepare the EEPROM for reading */ 434 /* Prepare the EEPROM for reading */
435 ixgb_setup_eeprom(hw); 435 ixgb_setup_eeprom(hw);
@@ -463,8 +463,8 @@ ixgb_read_eeprom(struct ixgb_hw *hw,
463bool 463bool
464ixgb_get_eeprom_data(struct ixgb_hw *hw) 464ixgb_get_eeprom_data(struct ixgb_hw *hw)
465{ 465{
466 uint16_t i; 466 u16 i;
467 uint16_t checksum = 0; 467 u16 checksum = 0;
468 struct ixgb_ee_map_type *ee_map; 468 struct ixgb_ee_map_type *ee_map;
469 469
470 DEBUGFUNC("ixgb_get_eeprom_data"); 470 DEBUGFUNC("ixgb_get_eeprom_data");
@@ -473,13 +473,13 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
473 473
474 DEBUGOUT("ixgb_ee: Reading eeprom data\n"); 474 DEBUGOUT("ixgb_ee: Reading eeprom data\n");
475 for(i = 0; i < IXGB_EEPROM_SIZE ; i++) { 475 for(i = 0; i < IXGB_EEPROM_SIZE ; i++) {
476 uint16_t ee_data; 476 u16 ee_data;
477 ee_data = ixgb_read_eeprom(hw, i); 477 ee_data = ixgb_read_eeprom(hw, i);
478 checksum += ee_data; 478 checksum += ee_data;
479 hw->eeprom[i] = cpu_to_le16(ee_data); 479 hw->eeprom[i] = cpu_to_le16(ee_data);
480 } 480 }
481 481
482 if (checksum != (uint16_t) EEPROM_SUM) { 482 if (checksum != (u16) EEPROM_SUM) {
483 DEBUGOUT("ixgb_ee: Checksum invalid.\n"); 483 DEBUGOUT("ixgb_ee: Checksum invalid.\n");
484 /* clear the init_ctrl_reg_1 to signify that the cache is 484 /* clear the init_ctrl_reg_1 to signify that the cache is
485 * invalidated */ 485 * invalidated */
@@ -529,7 +529,7 @@ ixgb_check_and_get_eeprom_data (struct ixgb_hw* hw)
529 * Word at indexed offset in eeprom, if valid, 0 otherwise. 529 * Word at indexed offset in eeprom, if valid, 0 otherwise.
530 ******************************************************************************/ 530 ******************************************************************************/
531__le16 531__le16
532ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index) 532ixgb_get_eeprom_word(struct ixgb_hw *hw, u16 index)
533{ 533{
534 534
535 if ((index < IXGB_EEPROM_SIZE) && 535 if ((index < IXGB_EEPROM_SIZE) &&
@@ -550,7 +550,7 @@ ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index)
550 ******************************************************************************/ 550 ******************************************************************************/
551void 551void
552ixgb_get_ee_mac_addr(struct ixgb_hw *hw, 552ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
553 uint8_t *mac_addr) 553 u8 *mac_addr)
554{ 554{
555 int i; 555 int i;
556 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 556 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
@@ -574,7 +574,7 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
574 * Returns: 574 * Returns:
575 * PBA number if EEPROM contents are valid, 0 otherwise 575 * PBA number if EEPROM contents are valid, 0 otherwise
576 ******************************************************************************/ 576 ******************************************************************************/
577uint32_t 577u32
578ixgb_get_ee_pba_number(struct ixgb_hw *hw) 578ixgb_get_ee_pba_number(struct ixgb_hw *hw)
579{ 579{
580 if (ixgb_check_and_get_eeprom_data(hw) == true) 580 if (ixgb_check_and_get_eeprom_data(hw) == true)
@@ -593,7 +593,7 @@ ixgb_get_ee_pba_number(struct ixgb_hw *hw)
593 * Returns: 593 * Returns:
594 * Device Id if EEPROM contents are valid, 0 otherwise 594 * Device Id if EEPROM contents are valid, 0 otherwise
595 ******************************************************************************/ 595 ******************************************************************************/
596uint16_t 596u16
597ixgb_get_ee_device_id(struct ixgb_hw *hw) 597ixgb_get_ee_device_id(struct ixgb_hw *hw)
598{ 598{
599 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 599 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;