diff options
-rw-r--r-- | drivers/net/bnx2.c | 74 | ||||
-rw-r--r-- | drivers/net/bnx2.h | 10 |
2 files changed, 54 insertions, 30 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index d23861c8658c..311c8595c64b 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -126,91 +126,102 @@ static struct pci_device_id bnx2_pci_tbl[] = { | |||
126 | 126 | ||
127 | static struct flash_spec flash_table[] = | 127 | static struct flash_spec flash_table[] = |
128 | { | 128 | { |
129 | #define BUFFERED_FLAGS (BNX2_NV_BUFFERED | BNX2_NV_TRANSLATE) | ||
130 | #define NONBUFFERED_FLAGS (BNX2_NV_WREN) | ||
129 | /* Slow EEPROM */ | 131 | /* Slow EEPROM */ |
130 | {0x00000000, 0x40830380, 0x009f0081, 0xa184a053, 0xaf000400, | 132 | {0x00000000, 0x40830380, 0x009f0081, 0xa184a053, 0xaf000400, |
131 | 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, | 133 | BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, |
132 | SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, | 134 | SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, |
133 | "EEPROM - slow"}, | 135 | "EEPROM - slow"}, |
134 | /* Expansion entry 0001 */ | 136 | /* Expansion entry 0001 */ |
135 | {0x08000002, 0x4b808201, 0x00050081, 0x03840253, 0xaf020406, | 137 | {0x08000002, 0x4b808201, 0x00050081, 0x03840253, 0xaf020406, |
136 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 138 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
137 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, | 139 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, |
138 | "Entry 0001"}, | 140 | "Entry 0001"}, |
139 | /* Saifun SA25F010 (non-buffered flash) */ | 141 | /* Saifun SA25F010 (non-buffered flash) */ |
140 | /* strap, cfg1, & write1 need updates */ | 142 | /* strap, cfg1, & write1 need updates */ |
141 | {0x04000001, 0x47808201, 0x00050081, 0x03840253, 0xaf020406, | 143 | {0x04000001, 0x47808201, 0x00050081, 0x03840253, 0xaf020406, |
142 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 144 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
143 | SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*2, | 145 | SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*2, |
144 | "Non-buffered flash (128kB)"}, | 146 | "Non-buffered flash (128kB)"}, |
145 | /* Saifun SA25F020 (non-buffered flash) */ | 147 | /* Saifun SA25F020 (non-buffered flash) */ |
146 | /* strap, cfg1, & write1 need updates */ | 148 | /* strap, cfg1, & write1 need updates */ |
147 | {0x0c000003, 0x4f808201, 0x00050081, 0x03840253, 0xaf020406, | 149 | {0x0c000003, 0x4f808201, 0x00050081, 0x03840253, 0xaf020406, |
148 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 150 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
149 | SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*4, | 151 | SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*4, |
150 | "Non-buffered flash (256kB)"}, | 152 | "Non-buffered flash (256kB)"}, |
151 | /* Expansion entry 0100 */ | 153 | /* Expansion entry 0100 */ |
152 | {0x11000000, 0x53808201, 0x00050081, 0x03840253, 0xaf020406, | 154 | {0x11000000, 0x53808201, 0x00050081, 0x03840253, 0xaf020406, |
153 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 155 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
154 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, | 156 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, |
155 | "Entry 0100"}, | 157 | "Entry 0100"}, |
156 | /* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */ | 158 | /* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */ |
157 | {0x19000002, 0x5b808201, 0x000500db, 0x03840253, 0xaf020406, | 159 | {0x19000002, 0x5b808201, 0x000500db, 0x03840253, 0xaf020406, |
158 | 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, | 160 | NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, |
159 | ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*2, | 161 | ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*2, |
160 | "Entry 0101: ST M45PE10 (128kB non-bufferred)"}, | 162 | "Entry 0101: ST M45PE10 (128kB non-bufferred)"}, |
161 | /* Entry 0110: ST M45PE20 (non-buffered flash)*/ | 163 | /* Entry 0110: ST M45PE20 (non-buffered flash)*/ |
162 | {0x15000001, 0x57808201, 0x000500db, 0x03840253, 0xaf020406, | 164 | {0x15000001, 0x57808201, 0x000500db, 0x03840253, 0xaf020406, |
163 | 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, | 165 | NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, |
164 | ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*4, | 166 | ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*4, |
165 | "Entry 0110: ST M45PE20 (256kB non-bufferred)"}, | 167 | "Entry 0110: ST M45PE20 (256kB non-bufferred)"}, |
166 | /* Saifun SA25F005 (non-buffered flash) */ | 168 | /* Saifun SA25F005 (non-buffered flash) */ |
167 | /* strap, cfg1, & write1 need updates */ | 169 | /* strap, cfg1, & write1 need updates */ |
168 | {0x1d000003, 0x5f808201, 0x00050081, 0x03840253, 0xaf020406, | 170 | {0x1d000003, 0x5f808201, 0x00050081, 0x03840253, 0xaf020406, |
169 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 171 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
170 | SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE, | 172 | SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE, |
171 | "Non-buffered flash (64kB)"}, | 173 | "Non-buffered flash (64kB)"}, |
172 | /* Fast EEPROM */ | 174 | /* Fast EEPROM */ |
173 | {0x22000000, 0x62808380, 0x009f0081, 0xa184a053, 0xaf000400, | 175 | {0x22000000, 0x62808380, 0x009f0081, 0xa184a053, 0xaf000400, |
174 | 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, | 176 | BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, |
175 | SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, | 177 | SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, |
176 | "EEPROM - fast"}, | 178 | "EEPROM - fast"}, |
177 | /* Expansion entry 1001 */ | 179 | /* Expansion entry 1001 */ |
178 | {0x2a000002, 0x6b808201, 0x00050081, 0x03840253, 0xaf020406, | 180 | {0x2a000002, 0x6b808201, 0x00050081, 0x03840253, 0xaf020406, |
179 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 181 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
180 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, | 182 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, |
181 | "Entry 1001"}, | 183 | "Entry 1001"}, |
182 | /* Expansion entry 1010 */ | 184 | /* Expansion entry 1010 */ |
183 | {0x26000001, 0x67808201, 0x00050081, 0x03840253, 0xaf020406, | 185 | {0x26000001, 0x67808201, 0x00050081, 0x03840253, 0xaf020406, |
184 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 186 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
185 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, | 187 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, |
186 | "Entry 1010"}, | 188 | "Entry 1010"}, |
187 | /* ATMEL AT45DB011B (buffered flash) */ | 189 | /* ATMEL AT45DB011B (buffered flash) */ |
188 | {0x2e000003, 0x6e808273, 0x00570081, 0x68848353, 0xaf000400, | 190 | {0x2e000003, 0x6e808273, 0x00570081, 0x68848353, 0xaf000400, |
189 | 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, | 191 | BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, |
190 | BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE, | 192 | BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE, |
191 | "Buffered flash (128kB)"}, | 193 | "Buffered flash (128kB)"}, |
192 | /* Expansion entry 1100 */ | 194 | /* Expansion entry 1100 */ |
193 | {0x33000000, 0x73808201, 0x00050081, 0x03840253, 0xaf020406, | 195 | {0x33000000, 0x73808201, 0x00050081, 0x03840253, 0xaf020406, |
194 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 196 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
195 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, | 197 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, |
196 | "Entry 1100"}, | 198 | "Entry 1100"}, |
197 | /* Expansion entry 1101 */ | 199 | /* Expansion entry 1101 */ |
198 | {0x3b000002, 0x7b808201, 0x00050081, 0x03840253, 0xaf020406, | 200 | {0x3b000002, 0x7b808201, 0x00050081, 0x03840253, 0xaf020406, |
199 | 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, | 201 | NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, |
200 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, | 202 | SAIFUN_FLASH_BYTE_ADDR_MASK, 0, |
201 | "Entry 1101"}, | 203 | "Entry 1101"}, |
202 | /* Ateml Expansion entry 1110 */ | 204 | /* Ateml Expansion entry 1110 */ |
203 | {0x37000001, 0x76808273, 0x00570081, 0x68848353, 0xaf000400, | 205 | {0x37000001, 0x76808273, 0x00570081, 0x68848353, 0xaf000400, |
204 | 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, | 206 | BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, |
205 | BUFFERED_FLASH_BYTE_ADDR_MASK, 0, | 207 | BUFFERED_FLASH_BYTE_ADDR_MASK, 0, |
206 | "Entry 1110 (Atmel)"}, | 208 | "Entry 1110 (Atmel)"}, |
207 | /* ATMEL AT45DB021B (buffered flash) */ | 209 | /* ATMEL AT45DB021B (buffered flash) */ |
208 | {0x3f000003, 0x7e808273, 0x00570081, 0x68848353, 0xaf000400, | 210 | {0x3f000003, 0x7e808273, 0x00570081, 0x68848353, 0xaf000400, |
209 | 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, | 211 | BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, |
210 | BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE*2, | 212 | BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE*2, |
211 | "Buffered flash (256kB)"}, | 213 | "Buffered flash (256kB)"}, |
212 | }; | 214 | }; |
213 | 215 | ||
216 | static struct flash_spec flash_5709 = { | ||
217 | .flags = BNX2_NV_BUFFERED, | ||
218 | .page_bits = BCM5709_FLASH_PAGE_BITS, | ||
219 | .page_size = BCM5709_FLASH_PAGE_SIZE, | ||
220 | .addr_mask = BCM5709_FLASH_BYTE_ADDR_MASK, | ||
221 | .total_size = BUFFERED_FLASH_TOTAL_SIZE*2, | ||
222 | .name = "5709 Buffered flash (256kB)", | ||
223 | }; | ||
224 | |||
214 | MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); | 225 | MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); |
215 | 226 | ||
216 | static inline u32 bnx2_tx_avail(struct bnx2 *bp) | 227 | static inline u32 bnx2_tx_avail(struct bnx2 *bp) |
@@ -3289,7 +3300,7 @@ bnx2_enable_nvram_write(struct bnx2 *bp) | |||
3289 | val = REG_RD(bp, BNX2_MISC_CFG); | 3300 | val = REG_RD(bp, BNX2_MISC_CFG); |
3290 | REG_WR(bp, BNX2_MISC_CFG, val | BNX2_MISC_CFG_NVM_WR_EN_PCI); | 3301 | REG_WR(bp, BNX2_MISC_CFG, val | BNX2_MISC_CFG_NVM_WR_EN_PCI); |
3291 | 3302 | ||
3292 | if (!bp->flash_info->buffered) { | 3303 | if (bp->flash_info->flags & BNX2_NV_WREN) { |
3293 | int j; | 3304 | int j; |
3294 | 3305 | ||
3295 | REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | 3306 | REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); |
@@ -3349,7 +3360,7 @@ bnx2_nvram_erase_page(struct bnx2 *bp, u32 offset) | |||
3349 | u32 cmd; | 3360 | u32 cmd; |
3350 | int j; | 3361 | int j; |
3351 | 3362 | ||
3352 | if (bp->flash_info->buffered) | 3363 | if (bp->flash_info->flags & BNX2_NV_BUFFERED) |
3353 | /* Buffered flash, no erase needed */ | 3364 | /* Buffered flash, no erase needed */ |
3354 | return 0; | 3365 | return 0; |
3355 | 3366 | ||
@@ -3392,8 +3403,8 @@ bnx2_nvram_read_dword(struct bnx2 *bp, u32 offset, u8 *ret_val, u32 cmd_flags) | |||
3392 | /* Build the command word. */ | 3403 | /* Build the command word. */ |
3393 | cmd = BNX2_NVM_COMMAND_DOIT | cmd_flags; | 3404 | cmd = BNX2_NVM_COMMAND_DOIT | cmd_flags; |
3394 | 3405 | ||
3395 | /* Calculate an offset of a buffered flash. */ | 3406 | /* Calculate an offset of a buffered flash, not needed for 5709. */ |
3396 | if (bp->flash_info->buffered) { | 3407 | if (bp->flash_info->flags & BNX2_NV_TRANSLATE) { |
3397 | offset = ((offset / bp->flash_info->page_size) << | 3408 | offset = ((offset / bp->flash_info->page_size) << |
3398 | bp->flash_info->page_bits) + | 3409 | bp->flash_info->page_bits) + |
3399 | (offset % bp->flash_info->page_size); | 3410 | (offset % bp->flash_info->page_size); |
@@ -3439,8 +3450,8 @@ bnx2_nvram_write_dword(struct bnx2 *bp, u32 offset, u8 *val, u32 cmd_flags) | |||
3439 | /* Build the command word. */ | 3450 | /* Build the command word. */ |
3440 | cmd = BNX2_NVM_COMMAND_DOIT | BNX2_NVM_COMMAND_WR | cmd_flags; | 3451 | cmd = BNX2_NVM_COMMAND_DOIT | BNX2_NVM_COMMAND_WR | cmd_flags; |
3441 | 3452 | ||
3442 | /* Calculate an offset of a buffered flash. */ | 3453 | /* Calculate an offset of a buffered flash, not needed for 5709. */ |
3443 | if (bp->flash_info->buffered) { | 3454 | if (bp->flash_info->flags & BNX2_NV_TRANSLATE) { |
3444 | offset = ((offset / bp->flash_info->page_size) << | 3455 | offset = ((offset / bp->flash_info->page_size) << |
3445 | bp->flash_info->page_bits) + | 3456 | bp->flash_info->page_bits) + |
3446 | (offset % bp->flash_info->page_size); | 3457 | (offset % bp->flash_info->page_size); |
@@ -3478,15 +3489,19 @@ static int | |||
3478 | bnx2_init_nvram(struct bnx2 *bp) | 3489 | bnx2_init_nvram(struct bnx2 *bp) |
3479 | { | 3490 | { |
3480 | u32 val; | 3491 | u32 val; |
3481 | int j, entry_count, rc; | 3492 | int j, entry_count, rc = 0; |
3482 | struct flash_spec *flash; | 3493 | struct flash_spec *flash; |
3483 | 3494 | ||
3495 | if (CHIP_NUM(bp) == CHIP_NUM_5709) { | ||
3496 | bp->flash_info = &flash_5709; | ||
3497 | goto get_flash_size; | ||
3498 | } | ||
3499 | |||
3484 | /* Determine the selected interface. */ | 3500 | /* Determine the selected interface. */ |
3485 | val = REG_RD(bp, BNX2_NVM_CFG1); | 3501 | val = REG_RD(bp, BNX2_NVM_CFG1); |
3486 | 3502 | ||
3487 | entry_count = sizeof(flash_table) / sizeof(struct flash_spec); | 3503 | entry_count = sizeof(flash_table) / sizeof(struct flash_spec); |
3488 | 3504 | ||
3489 | rc = 0; | ||
3490 | if (val & 0x40000000) { | 3505 | if (val & 0x40000000) { |
3491 | 3506 | ||
3492 | /* Flash interface has been reconfigured */ | 3507 | /* Flash interface has been reconfigured */ |
@@ -3542,6 +3557,7 @@ bnx2_init_nvram(struct bnx2 *bp) | |||
3542 | return -ENODEV; | 3557 | return -ENODEV; |
3543 | } | 3558 | } |
3544 | 3559 | ||
3560 | get_flash_size: | ||
3545 | val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2); | 3561 | val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2); |
3546 | val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK; | 3562 | val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK; |
3547 | if (val) | 3563 | if (val) |
@@ -3706,7 +3722,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3706 | buf = align_buf; | 3722 | buf = align_buf; |
3707 | } | 3723 | } |
3708 | 3724 | ||
3709 | if (bp->flash_info->buffered == 0) { | 3725 | if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) { |
3710 | flash_buffer = kmalloc(264, GFP_KERNEL); | 3726 | flash_buffer = kmalloc(264, GFP_KERNEL); |
3711 | if (flash_buffer == NULL) { | 3727 | if (flash_buffer == NULL) { |
3712 | rc = -ENOMEM; | 3728 | rc = -ENOMEM; |
@@ -3739,7 +3755,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3739 | bnx2_enable_nvram_access(bp); | 3755 | bnx2_enable_nvram_access(bp); |
3740 | 3756 | ||
3741 | cmd_flags = BNX2_NVM_COMMAND_FIRST; | 3757 | cmd_flags = BNX2_NVM_COMMAND_FIRST; |
3742 | if (bp->flash_info->buffered == 0) { | 3758 | if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) { |
3743 | int j; | 3759 | int j; |
3744 | 3760 | ||
3745 | /* Read the whole page into the buffer | 3761 | /* Read the whole page into the buffer |
@@ -3767,7 +3783,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3767 | /* Loop to write back the buffer data from page_start to | 3783 | /* Loop to write back the buffer data from page_start to |
3768 | * data_start */ | 3784 | * data_start */ |
3769 | i = 0; | 3785 | i = 0; |
3770 | if (bp->flash_info->buffered == 0) { | 3786 | if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) { |
3771 | /* Erase the page */ | 3787 | /* Erase the page */ |
3772 | if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0) | 3788 | if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0) |
3773 | goto nvram_write_end; | 3789 | goto nvram_write_end; |
@@ -3791,7 +3807,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3791 | /* Loop to write the new data from data_start to data_end */ | 3807 | /* Loop to write the new data from data_start to data_end */ |
3792 | for (addr = data_start; addr < data_end; addr += 4, i += 4) { | 3808 | for (addr = data_start; addr < data_end; addr += 4, i += 4) { |
3793 | if ((addr == page_end - 4) || | 3809 | if ((addr == page_end - 4) || |
3794 | ((bp->flash_info->buffered) && | 3810 | ((bp->flash_info->flags & BNX2_NV_BUFFERED) && |
3795 | (addr == data_end - 4))) { | 3811 | (addr == data_end - 4))) { |
3796 | 3812 | ||
3797 | cmd_flags |= BNX2_NVM_COMMAND_LAST; | 3813 | cmd_flags |= BNX2_NVM_COMMAND_LAST; |
@@ -3808,7 +3824,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3808 | 3824 | ||
3809 | /* Loop to write back the buffer data from data_end | 3825 | /* Loop to write back the buffer data from data_end |
3810 | * to page_end */ | 3826 | * to page_end */ |
3811 | if (bp->flash_info->buffered == 0) { | 3827 | if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) { |
3812 | for (addr = data_end; addr < page_end; | 3828 | for (addr = data_end; addr < page_end; |
3813 | addr += 4, i += 4) { | 3829 | addr += 4, i += 4) { |
3814 | 3830 | ||
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index d8cd1afeb23d..102adfe1e923 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6433,6 +6433,11 @@ struct sw_bd { | |||
6433 | #define ST_MICRO_FLASH_PAGE_SIZE 256 | 6433 | #define ST_MICRO_FLASH_PAGE_SIZE 256 |
6434 | #define ST_MICRO_FLASH_BASE_TOTAL_SIZE 65536 | 6434 | #define ST_MICRO_FLASH_BASE_TOTAL_SIZE 65536 |
6435 | 6435 | ||
6436 | #define BCM5709_FLASH_PAGE_BITS 8 | ||
6437 | #define BCM5709_FLASH_PHY_PAGE_SIZE (1 << BCM5709_FLASH_PAGE_BITS) | ||
6438 | #define BCM5709_FLASH_BYTE_ADDR_MASK (BCM5709_FLASH_PHY_PAGE_SIZE-1) | ||
6439 | #define BCM5709_FLASH_PAGE_SIZE 256 | ||
6440 | |||
6436 | #define NVRAM_TIMEOUT_COUNT 30000 | 6441 | #define NVRAM_TIMEOUT_COUNT 30000 |
6437 | 6442 | ||
6438 | 6443 | ||
@@ -6449,7 +6454,10 @@ struct flash_spec { | |||
6449 | u32 config2; | 6454 | u32 config2; |
6450 | u32 config3; | 6455 | u32 config3; |
6451 | u32 write1; | 6456 | u32 write1; |
6452 | u32 buffered; | 6457 | u32 flags; |
6458 | #define BNX2_NV_BUFFERED 0x00000001 | ||
6459 | #define BNX2_NV_TRANSLATE 0x00000002 | ||
6460 | #define BNX2_NV_WREN 0x00000004 | ||
6453 | u32 page_bits; | 6461 | u32 page_bits; |
6454 | u32 page_size; | 6462 | u32 page_size; |
6455 | u32 addr_mask; | 6463 | u32 addr_mask; |