aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/t3_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb3/t3_hw.c')
-rw-r--r--drivers/net/cxgb3/t3_hw.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 6e5b4992f17e..7469935877bd 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -537,10 +537,11 @@ struct t3_vpd {
537 * addres is written to the control register. The hardware device will 537 * addres is written to the control register. The hardware device will
538 * set the flag to 1 when 4 bytes have been read into the data register. 538 * set the flag to 1 when 4 bytes have been read into the data register.
539 */ 539 */
540int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) 540int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data)
541{ 541{
542 u16 val; 542 u16 val;
543 int attempts = EEPROM_MAX_POLL; 543 int attempts = EEPROM_MAX_POLL;
544 u32 v;
544 unsigned int base = adapter->params.pci.vpd_cap_addr; 545 unsigned int base = adapter->params.pci.vpd_cap_addr;
545 546
546 if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr & 3)) 547 if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr & 3))
@@ -556,8 +557,8 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
556 CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr); 557 CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr);
557 return -EIO; 558 return -EIO;
558 } 559 }
559 pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, data); 560 pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, &v);
560 *data = le32_to_cpu(*data); 561 *data = cpu_to_le32(v);
561 return 0; 562 return 0;
562} 563}
563 564
@@ -570,7 +571,7 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
570 * Write a 32-bit word to a location in VPD EEPROM using the card's PCI 571 * Write a 32-bit word to a location in VPD EEPROM using the card's PCI
571 * VPD ROM capability. 572 * VPD ROM capability.
572 */ 573 */
573int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data) 574int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data)
574{ 575{
575 u16 val; 576 u16 val;
576 int attempts = EEPROM_MAX_POLL; 577 int attempts = EEPROM_MAX_POLL;
@@ -580,7 +581,7 @@ int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
580 return -EINVAL; 581 return -EINVAL;
581 582
582 pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA, 583 pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA,
583 cpu_to_le32(data)); 584 le32_to_cpu(data));
584 pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR, 585 pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR,
585 addr | PCI_VPD_ADDR_F); 586 addr | PCI_VPD_ADDR_F);
586 do { 587 do {
@@ -631,14 +632,14 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
631 * Card information is normally at VPD_BASE but some early cards had 632 * Card information is normally at VPD_BASE but some early cards had
632 * it at 0. 633 * it at 0.
633 */ 634 */
634 ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *)&vpd); 635 ret = t3_seeprom_read(adapter, VPD_BASE, (__le32 *)&vpd);
635 if (ret) 636 if (ret)
636 return ret; 637 return ret;
637 addr = vpd.id_tag == 0x82 ? VPD_BASE : 0; 638 addr = vpd.id_tag == 0x82 ? VPD_BASE : 0;
638 639
639 for (i = 0; i < sizeof(vpd); i += 4) { 640 for (i = 0; i < sizeof(vpd); i += 4) {
640 ret = t3_seeprom_read(adapter, addr + i, 641 ret = t3_seeprom_read(adapter, addr + i,
641 (u32 *)((u8 *)&vpd + i)); 642 (__le32 *)((u8 *)&vpd + i));
642 if (ret) 643 if (ret)
643 return ret; 644 return ret;
644 } 645 }
@@ -926,7 +927,7 @@ int t3_check_tpsram(struct adapter *adapter, u8 *tp_sram, unsigned int size)
926{ 927{
927 u32 csum; 928 u32 csum;
928 unsigned int i; 929 unsigned int i;
929 const u32 *p = (const u32 *)tp_sram; 930 const __be32 *p = (const __be32 *)tp_sram;
930 931
931 /* Verify checksum */ 932 /* Verify checksum */
932 for (csum = 0, i = 0; i < size / sizeof(csum); i++) 933 for (csum = 0, i = 0; i < size / sizeof(csum); i++)
@@ -1040,7 +1041,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
1040{ 1041{
1041 u32 csum; 1042 u32 csum;
1042 unsigned int i; 1043 unsigned int i;
1043 const u32 *p = (const u32 *)fw_data; 1044 const __be32 *p = (const __be32 *)fw_data;
1044 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; 1045 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
1045 1046
1046 if ((size & 3) || size < FW_MIN_SIZE) 1047 if ((size & 3) || size < FW_MIN_SIZE)
@@ -2877,14 +2878,14 @@ static void ulp_config(struct adapter *adap, const struct tp_params *p)
2877int t3_set_proto_sram(struct adapter *adap, u8 *data) 2878int t3_set_proto_sram(struct adapter *adap, u8 *data)
2878{ 2879{
2879 int i; 2880 int i;
2880 u32 *buf = (u32 *)data; 2881 __be32 *buf = (__be32 *)data;
2881 2882
2882 for (i = 0; i < PROTO_SRAM_LINES; i++) { 2883 for (i = 0; i < PROTO_SRAM_LINES; i++) {
2883 t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, cpu_to_be32(*buf++)); 2884 t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, be32_to_cpu(*buf++));
2884 t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, cpu_to_be32(*buf++)); 2885 t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, be32_to_cpu(*buf++));
2885 t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, cpu_to_be32(*buf++)); 2886 t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, be32_to_cpu(*buf++));
2886 t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, cpu_to_be32(*buf++)); 2887 t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, be32_to_cpu(*buf++));
2887 t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, cpu_to_be32(*buf++)); 2888 t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, be32_to_cpu(*buf++));
2888 2889
2889 t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31); 2890 t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31);
2890 if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1)) 2891 if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1))