aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRon Mercer <ron.mercer@qlogic.com>2007-01-03 19:26:07 -0500
committerJeff Garzik <jeff@garzik.org>2007-01-07 22:37:36 -0500
commit80b02e595c308a5deb2ad49bd6aa3ab1da9cdbdb (patch)
tree628eb5b079ad990cf70d44aaf2b275f8b314049d
parentca16497a75d0e658858b6a8601f8c60250e73833 (diff)
qla3xxx: Add delay to NVRAM register access.
When accessing the 93LC86 serial prom the clock high and low times must be at least 250ns each. We have seen on some systems where the access times were much lower casing bit errors. Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/qla3xxx.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 36e0830dba73..8844c20eac2d 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -208,6 +208,15 @@ static void ql_write_common_reg(struct ql3_adapter *qdev,
208 return; 208 return;
209} 209}
210 210
211static void ql_write_nvram_reg(struct ql3_adapter *qdev,
212 u32 __iomem *reg, u32 value)
213{
214 writel(value, reg);
215 readl(reg);
216 udelay(1);
217 return;
218}
219
211static void ql_write_page0_reg(struct ql3_adapter *qdev, 220static void ql_write_page0_reg(struct ql3_adapter *qdev,
212 u32 __iomem *reg, u32 value) 221 u32 __iomem *reg, u32 value)
213{ 222{
@@ -336,9 +345,9 @@ static void fm93c56a_select(struct ql3_adapter *qdev)
336 qdev->mem_map_registers; 345 qdev->mem_map_registers;
337 346
338 qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_1; 347 qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_1;
339 ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, 348 ql_write_nvram_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
340 ISP_NVRAM_MASK | qdev->eeprom_cmd_data); 349 ISP_NVRAM_MASK | qdev->eeprom_cmd_data);
341 ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, 350 ql_write_nvram_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
342 ((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data)); 351 ((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data));
343} 352}
344 353
@@ -355,14 +364,14 @@ static void fm93c56a_cmd(struct ql3_adapter *qdev, u32 cmd, u32 eepromAddr)
355 qdev->mem_map_registers; 364 qdev->mem_map_registers;
356 365
357 /* Clock in a zero, then do the start bit */ 366 /* Clock in a zero, then do the start bit */
358 ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, 367 ql_write_nvram_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
359 ISP_NVRAM_MASK | qdev->eeprom_cmd_data | 368 ISP_NVRAM_MASK | qdev->eeprom_cmd_data |
360 AUBURN_EEPROM_DO_1); 369 AUBURN_EEPROM_DO_1);
361 ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, 370 ql_write_nvram_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
362 ISP_NVRAM_MASK | qdev-> 371 ISP_NVRAM_MASK | qdev->
363 eeprom_cmd_data | AUBURN_EEPROM_DO_1 | 372 eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
364 AUBURN_EEPROM_CLK_RISE); 373 AUBURN_EEPROM_CLK_RISE);
365 ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, 374 ql_write_nvram_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
366 ISP_NVRAM_MASK | qdev-> 375 ISP_NVRAM_MASK | qdev->
367 eeprom_cmd_data | AUBURN_EEPROM_DO_1 | 376 eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
368 AUBURN_EEPROM_CLK_FALL); 377 AUBURN_EEPROM_CLK_FALL);
@@ -378,20 +387,20 @@ static void fm93c56a_cmd(struct ql3_adapter *qdev, u32 cmd, u32 eepromAddr)
378 * If the bit changed, then change the DO state to 387 * If the bit changed, then change the DO state to
379 * match 388 * match
380 */ 389 */
381 ql_write_common_reg(qdev, 390 ql_write_nvram_reg(qdev,
382 &port_regs->CommonRegs. 391 &port_regs->CommonRegs.
383 serialPortInterfaceReg, 392 serialPortInterfaceReg,
384 ISP_NVRAM_MASK | qdev-> 393 ISP_NVRAM_MASK | qdev->
385 eeprom_cmd_data | dataBit); 394 eeprom_cmd_data | dataBit);
386 previousBit = dataBit; 395 previousBit = dataBit;
387 } 396 }
388 ql_write_common_reg(qdev, 397 ql_write_nvram_reg(qdev,
389 &port_regs->CommonRegs. 398 &port_regs->CommonRegs.
390 serialPortInterfaceReg, 399 serialPortInterfaceReg,
391 ISP_NVRAM_MASK | qdev-> 400 ISP_NVRAM_MASK | qdev->
392 eeprom_cmd_data | dataBit | 401 eeprom_cmd_data | dataBit |
393 AUBURN_EEPROM_CLK_RISE); 402 AUBURN_EEPROM_CLK_RISE);
394 ql_write_common_reg(qdev, 403 ql_write_nvram_reg(qdev,
395 &port_regs->CommonRegs. 404 &port_regs->CommonRegs.
396 serialPortInterfaceReg, 405 serialPortInterfaceReg,
397 ISP_NVRAM_MASK | qdev-> 406 ISP_NVRAM_MASK | qdev->
@@ -412,20 +421,20 @@ static void fm93c56a_cmd(struct ql3_adapter *qdev, u32 cmd, u32 eepromAddr)
412 * If the bit changed, then change the DO state to 421 * If the bit changed, then change the DO state to
413 * match 422 * match
414 */ 423 */
415 ql_write_common_reg(qdev, 424 ql_write_nvram_reg(qdev,
416 &port_regs->CommonRegs. 425 &port_regs->CommonRegs.
417 serialPortInterfaceReg, 426 serialPortInterfaceReg,
418 ISP_NVRAM_MASK | qdev-> 427 ISP_NVRAM_MASK | qdev->
419 eeprom_cmd_data | dataBit); 428 eeprom_cmd_data | dataBit);
420 previousBit = dataBit; 429 previousBit = dataBit;
421 } 430 }
422 ql_write_common_reg(qdev, 431 ql_write_nvram_reg(qdev,
423 &port_regs->CommonRegs. 432 &port_regs->CommonRegs.
424 serialPortInterfaceReg, 433 serialPortInterfaceReg,
425 ISP_NVRAM_MASK | qdev-> 434 ISP_NVRAM_MASK | qdev->
426 eeprom_cmd_data | dataBit | 435 eeprom_cmd_data | dataBit |
427 AUBURN_EEPROM_CLK_RISE); 436 AUBURN_EEPROM_CLK_RISE);
428 ql_write_common_reg(qdev, 437 ql_write_nvram_reg(qdev,
429 &port_regs->CommonRegs. 438 &port_regs->CommonRegs.
430 serialPortInterfaceReg, 439 serialPortInterfaceReg,
431 ISP_NVRAM_MASK | qdev-> 440 ISP_NVRAM_MASK | qdev->
@@ -443,7 +452,7 @@ static void fm93c56a_deselect(struct ql3_adapter *qdev)
443 struct ql3xxx_port_registers __iomem *port_regs = 452 struct ql3xxx_port_registers __iomem *port_regs =
444 qdev->mem_map_registers; 453 qdev->mem_map_registers;
445 qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_0; 454 qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_0;
446 ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, 455 ql_write_nvram_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
447 ISP_NVRAM_MASK | qdev->eeprom_cmd_data); 456 ISP_NVRAM_MASK | qdev->eeprom_cmd_data);
448} 457}
449 458
@@ -461,12 +470,12 @@ static void fm93c56a_datain(struct ql3_adapter *qdev, unsigned short *value)
461 /* Read the data bits */ 470 /* Read the data bits */
462 /* The first bit is a dummy. Clock right over it. */ 471 /* The first bit is a dummy. Clock right over it. */
463 for (i = 0; i < dataBits; i++) { 472 for (i = 0; i < dataBits; i++) {
464 ql_write_common_reg(qdev, 473 ql_write_nvram_reg(qdev,
465 &port_regs->CommonRegs. 474 &port_regs->CommonRegs.
466 serialPortInterfaceReg, 475 serialPortInterfaceReg,
467 ISP_NVRAM_MASK | qdev->eeprom_cmd_data | 476 ISP_NVRAM_MASK | qdev->eeprom_cmd_data |
468 AUBURN_EEPROM_CLK_RISE); 477 AUBURN_EEPROM_CLK_RISE);
469 ql_write_common_reg(qdev, 478 ql_write_nvram_reg(qdev,
470 &port_regs->CommonRegs. 479 &port_regs->CommonRegs.
471 serialPortInterfaceReg, 480 serialPortInterfaceReg,
472 ISP_NVRAM_MASK | qdev->eeprom_cmd_data | 481 ISP_NVRAM_MASK | qdev->eeprom_cmd_data |