diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2006-10-23 08:53:17 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-02 00:12:01 -0500 |
commit | b2e68aa337f950e4a8c893a82b95b1755309bc56 (patch) | |
tree | 4f7696e09d08cb173306e68bfdc4dc98aa97ef0b /drivers/net/defxx.c | |
parent | c3a9392e4f3b9d97803b067871d66bc143369dbf (diff) |
[PATCH] defxx: Big-endian hosts support
The PDQ DMA engine requires a different byte-swapping mode for big-endian
hosts; also the MAC address which is read from a register through PIO has
to be byte-swapped. These changes have been verified with DEFPA-DC (PCI)
boards and a Broadcom BCM91250A (MIPS CPU based) host.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/defxx.c')
-rw-r--r-- | drivers/net/defxx.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 8f514cc0debd..dc3ab3b5c8cb 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -192,6 +192,7 @@ | |||
192 | * 04 Aug 2003 macro Converted to the DMA API. | 192 | * 04 Aug 2003 macro Converted to the DMA API. |
193 | * 14 Aug 2004 macro Fix device names reported. | 193 | * 14 Aug 2004 macro Fix device names reported. |
194 | * 14 Jun 2005 macro Use irqreturn_t. | 194 | * 14 Jun 2005 macro Use irqreturn_t. |
195 | * 23 Oct 2006 macro Big-endian host support. | ||
195 | */ | 196 | */ |
196 | 197 | ||
197 | /* Include files */ | 198 | /* Include files */ |
@@ -218,8 +219,8 @@ | |||
218 | 219 | ||
219 | /* Version information string should be updated prior to each new release! */ | 220 | /* Version information string should be updated prior to each new release! */ |
220 | #define DRV_NAME "defxx" | 221 | #define DRV_NAME "defxx" |
221 | #define DRV_VERSION "v1.08" | 222 | #define DRV_VERSION "v1.09" |
222 | #define DRV_RELDATE "2005/06/14" | 223 | #define DRV_RELDATE "2006/10/23" |
223 | 224 | ||
224 | static char version[] __devinitdata = | 225 | static char version[] __devinitdata = |
225 | DRV_NAME ": " DRV_VERSION " " DRV_RELDATE | 226 | DRV_NAME ": " DRV_VERSION " " DRV_RELDATE |
@@ -859,6 +860,7 @@ static int __devinit dfx_driver_init(struct net_device *dev, | |||
859 | print_name); | 860 | print_name); |
860 | return(DFX_K_FAILURE); | 861 | return(DFX_K_FAILURE); |
861 | } | 862 | } |
863 | data = cpu_to_le32(data); | ||
862 | memcpy(&bp->factory_mac_addr[0], &data, sizeof(u32)); | 864 | memcpy(&bp->factory_mac_addr[0], &data, sizeof(u32)); |
863 | 865 | ||
864 | if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_HI, 0, | 866 | if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_HI, 0, |
@@ -867,6 +869,7 @@ static int __devinit dfx_driver_init(struct net_device *dev, | |||
867 | print_name); | 869 | print_name); |
868 | return(DFX_K_FAILURE); | 870 | return(DFX_K_FAILURE); |
869 | } | 871 | } |
872 | data = cpu_to_le32(data); | ||
870 | memcpy(&bp->factory_mac_addr[4], &data, sizeof(u16)); | 873 | memcpy(&bp->factory_mac_addr[4], &data, sizeof(u16)); |
871 | 874 | ||
872 | /* | 875 | /* |
@@ -1085,27 +1088,23 @@ static int dfx_adap_init(DFX_board_t *bp, int get_buffers) | |||
1085 | } | 1088 | } |
1086 | 1089 | ||
1087 | /* | 1090 | /* |
1088 | * Set base address of Descriptor Block and bring adapter to DMA_AVAILABLE state | 1091 | * Set the base address of Descriptor Block and bring adapter |
1092 | * to DMA_AVAILABLE state. | ||
1089 | * | 1093 | * |
1090 | * Note: We also set the literal and data swapping requirements in this | 1094 | * Note: We also set the literal and data swapping requirements |
1091 | * command. Since this driver presently runs on Intel platforms | 1095 | * in this command. |
1092 | * which are Little Endian, we'll tell the adapter to byte swap | ||
1093 | * data only. This code will need to change when we support | ||
1094 | * Big Endian systems (eg. PowerPC). | ||
1095 | * | 1096 | * |
1096 | * Assumption: 32-bit physical address of descriptor block is 8Kbyte | 1097 | * Assumption: 32-bit physical address of descriptor block |
1097 | * aligned. That is, bits 0-12 of the address must be zero. | 1098 | * is 8Kbyte aligned. |
1098 | */ | 1099 | */ |
1099 | 1100 | if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_INIT, | |
1100 | if (dfx_hw_port_ctrl_req(bp, | 1101 | (u32)(bp->descr_block_phys | |
1101 | PI_PCTRL_M_INIT, | 1102 | PI_PDATA_A_INIT_M_BSWAP_INIT), |
1102 | (u32) (bp->descr_block_phys | PI_PDATA_A_INIT_M_BSWAP_DATA), | 1103 | 0, NULL) != DFX_K_SUCCESS) { |
1103 | 0, | 1104 | printk("%s: Could not set descriptor block address!\n", |
1104 | NULL) != DFX_K_SUCCESS) | 1105 | bp->dev->name); |
1105 | { | 1106 | return DFX_K_FAILURE; |
1106 | printk("%s: Could not set descriptor block address!\n", bp->dev->name); | 1107 | } |
1107 | return(DFX_K_FAILURE); | ||
1108 | } | ||
1109 | 1108 | ||
1110 | /* Set transmit flush timeout value */ | 1109 | /* Set transmit flush timeout value */ |
1111 | 1110 | ||