Staging: et131x: Fix 2.6.33rc1 regression in et131x

et131x: Fix 12bit wrapping

From: Alan Cox <alan@linux.intel.com>

The 12bit wrap logic conversion is wrong and this shows up for some
memory sizes and layouts of card. Patch it up for now, once the kernel
view of status is cleaned up it'll become two variables and a lot saner.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Alan Cox and committed by Greg Kroah-Hartman d31a2ff0 20633bf0

+15 -7
+12 -4
drivers/staging/et131x/et1310_address_map.h
··· 203 * 9-0: pr ndes 204 */ 205 206 - #define ET_DMA10_MASK 0x3FF /* 10 bit mask for DMA10W types */ 207 - #define ET_DMA10_WRAP 0x400 208 - #define ET_DMA4_MASK 0x00F /* 4 bit mask for DMA4W types */ 209 - #define ET_DMA4_WRAP 0x010 210 211 #define INDEX10(x) ((x) & ET_DMA10_MASK) 212 #define INDEX4(x) ((x) & ET_DMA4_MASK) 213 214 extern inline void add_10bit(u32 *v, int n) 215 { 216 *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); 217 } 218 219 /*
··· 203 * 9-0: pr ndes 204 */ 205 206 + #define ET_DMA12_MASK 0x0FFF /* 12 bit mask for DMA12W types */ 207 + #define ET_DMA12_WRAP 0x1000 208 + #define ET_DMA10_MASK 0x03FF /* 10 bit mask for DMA10W types */ 209 + #define ET_DMA10_WRAP 0x0400 210 + #define ET_DMA4_MASK 0x000F /* 4 bit mask for DMA4W types */ 211 + #define ET_DMA4_WRAP 0x0010 212 213 + #define INDEX12(x) ((x) & ET_DMA12_MASK) 214 #define INDEX10(x) ((x) & ET_DMA10_MASK) 215 #define INDEX4(x) ((x) & ET_DMA4_MASK) 216 217 extern inline void add_10bit(u32 *v, int n) 218 { 219 *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); 220 + } 221 + 222 + extern inline void add_12bit(u32 *v, int n) 223 + { 224 + *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP); 225 } 226 227 /*
+3 -3
drivers/staging/et131x/et1310_rx.c
··· 831 832 /* Indicate that we have used this PSR entry. */ 833 /* FIXME wrap 12 */ 834 - rx_local->local_psr_full = (rx_local->local_psr_full + 1) & 0xFFF; 835 - if (rx_local->local_psr_full > rx_local->PsrNumEntries - 1) { 836 /* Clear psr full and toggle the wrap bit */ 837 - rx_local->local_psr_full &= 0xFFF; 838 rx_local->local_psr_full ^= 0x1000; 839 } 840
··· 831 832 /* Indicate that we have used this PSR entry. */ 833 /* FIXME wrap 12 */ 834 + add_12bit(&rx_local->local_psr_full, 1); 835 + if ((rx_local->local_psr_full & 0xFFF) > rx_local->PsrNumEntries - 1) { 836 /* Clear psr full and toggle the wrap bit */ 837 + rx_local->local_psr_full &= ~0xFFF; 838 rx_local->local_psr_full ^= 0x1000; 839 } 840