diff options
author | Alan Cox <alan@linux.intel.com> | 2009-08-27 06:01:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 15:02:28 -0400 |
commit | 356c74b401f6b05ae5d793e9d1a9ba8297b8e3ff (patch) | |
tree | 9c5aaad97326bbaf453b825b024b32756d2a951c /drivers/staging/et131x/et1310_rx.c | |
parent | f2c98d27b8e88cd17bb3e77f8fccf70f8d2ebd2f (diff) |
Staging: et131x: clean up DMA10/DMA4 types
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/et131x/et1310_rx.c')
-rw-r--r-- | drivers/staging/et131x/et1310_rx.c | 60 |
1 files changed, 22 insertions, 38 deletions
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 7f36de04703..757a8cd4541 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
@@ -739,20 +739,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
739 | writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); | 739 | writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); |
740 | writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo); | 740 | writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo); |
741 | writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); | 741 | writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); |
742 | 742 | writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset); | |
743 | { | ||
744 | DMA10W_t fbr1_full = { 0 }; | ||
745 | |||
746 | fbr1_full.bits.val = 0; | ||
747 | fbr1_full.bits.wrap = 1; | ||
748 | writel(fbr1_full.value, &rx_dma->fbr1_full_offset.value); | ||
749 | } | ||
750 | 743 | ||
751 | /* This variable tracks the free buffer ring 1 full position, so it | 744 | /* This variable tracks the free buffer ring 1 full position, so it |
752 | * has to match the above. | 745 | * has to match the above. |
753 | */ | 746 | */ |
754 | pRxLocal->local_Fbr1_full.bits.val = 0; | 747 | pRxLocal->local_Fbr1_full = ET_DMA10_WRAP; |
755 | pRxLocal->local_Fbr1_full.bits.wrap = 1; | ||
756 | writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 748 | writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
757 | &rx_dma->fbr1_min_des.value); | 749 | &rx_dma->fbr1_min_des.value); |
758 | 750 | ||
@@ -769,20 +761,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
769 | writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); | 761 | writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); |
770 | writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo); | 762 | writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo); |
771 | writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); | 763 | writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); |
772 | 764 | writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset); | |
773 | { | ||
774 | DMA10W_t fbr0_full = { 0 }; | ||
775 | |||
776 | fbr0_full.bits.val = 0; | ||
777 | fbr0_full.bits.wrap = 1; | ||
778 | writel(fbr0_full.value, &rx_dma->fbr0_full_offset.value); | ||
779 | } | ||
780 | 765 | ||
781 | /* This variable tracks the free buffer ring 0 full position, so it | 766 | /* This variable tracks the free buffer ring 0 full position, so it |
782 | * has to match the above. | 767 | * has to match the above. |
783 | */ | 768 | */ |
784 | pRxLocal->local_Fbr0_full.bits.val = 0; | 769 | pRxLocal->local_Fbr0_full = ET_DMA10_WRAP; |
785 | pRxLocal->local_Fbr0_full.bits.wrap = 1; | ||
786 | writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 770 | writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
787 | &rx_dma->fbr0_min_des.value); | 771 | &rx_dma->fbr0_min_des.value); |
788 | #endif | 772 | #endif |
@@ -1282,6 +1266,16 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) | |||
1282 | DBG_RX_LEAVE(et131x_dbginfo); | 1266 | DBG_RX_LEAVE(et131x_dbginfo); |
1283 | } | 1267 | } |
1284 | 1268 | ||
1269 | static inline u32 bump_fbr(u32 *fbr, u32 limit) | ||
1270 | { | ||
1271 | u32 v = *fbr; | ||
1272 | add_10bit(&v, 1); | ||
1273 | if (v > limit) | ||
1274 | v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP; | ||
1275 | *fbr = v; | ||
1276 | return v; | ||
1277 | } | ||
1278 | |||
1285 | /** | 1279 | /** |
1286 | * NICReturnRFD - Recycle a RFD and put it back onto the receive list | 1280 | * NICReturnRFD - Recycle a RFD and put it back onto the receive list |
1287 | * @etdev: pointer to our adapter | 1281 | * @etdev: pointer to our adapter |
@@ -1310,7 +1304,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) | |||
1310 | if (ri == 1) { | 1304 | if (ri == 1) { |
1311 | PFBR_DESC_t pNextDesc = | 1305 | PFBR_DESC_t pNextDesc = |
1312 | (PFBR_DESC_t) (rx_local->pFbr1RingVa) + | 1306 | (PFBR_DESC_t) (rx_local->pFbr1RingVa) + |
1313 | rx_local->local_Fbr1_full.bits.val; | 1307 | INDEX10(rx_local->local_Fbr1_full); |
1314 | 1308 | ||
1315 | /* Handle the Free Buffer Ring advancement here. Write | 1309 | /* Handle the Free Buffer Ring advancement here. Write |
1316 | * the PA / Buffer Index for the returned buffer into | 1310 | * the PA / Buffer Index for the returned buffer into |
@@ -1320,20 +1314,15 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) | |||
1320 | pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi]; | 1314 | pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi]; |
1321 | pNextDesc->word2.value = bi; | 1315 | pNextDesc->word2.value = bi; |
1322 | 1316 | ||
1323 | if (++rx_local->local_Fbr1_full.bits.val > | 1317 | writel(bump_fbr(&rx_local->local_Fbr1_full, |
1324 | (rx_local->Fbr1NumEntries - 1)) { | 1318 | rx_local->Fbr1NumEntries - 1), |
1325 | rx_local->local_Fbr1_full.bits.val = 0; | 1319 | &rx_dma->fbr1_full_offset); |
1326 | rx_local->local_Fbr1_full.bits.wrap ^= 1; | ||
1327 | } | ||
1328 | |||
1329 | writel(rx_local->local_Fbr1_full.value, | ||
1330 | &rx_dma->fbr1_full_offset.value); | ||
1331 | } | 1320 | } |
1332 | #ifdef USE_FBR0 | 1321 | #ifdef USE_FBR0 |
1333 | else { | 1322 | else { |
1334 | PFBR_DESC_t pNextDesc = | 1323 | PFBR_DESC_t pNextDesc = |
1335 | (PFBR_DESC_t) rx_local->pFbr0RingVa + | 1324 | (PFBR_DESC_t) rx_local->pFbr0RingVa + |
1336 | rx_local->local_Fbr0_full.bits.val; | 1325 | INDEX10(rx_local->local_Fbr0_full); |
1337 | 1326 | ||
1338 | /* Handle the Free Buffer Ring advancement here. Write | 1327 | /* Handle the Free Buffer Ring advancement here. Write |
1339 | * the PA / Buffer Index for the returned buffer into | 1328 | * the PA / Buffer Index for the returned buffer into |
@@ -1343,14 +1332,9 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) | |||
1343 | pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi]; | 1332 | pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi]; |
1344 | pNextDesc->word2.value = bi; | 1333 | pNextDesc->word2.value = bi; |
1345 | 1334 | ||
1346 | if (++rx_local->local_Fbr0_full.bits.val > | 1335 | writel(bump_fbr(&rx_local->local_Fbr0_full, |
1347 | (rx_local->Fbr0NumEntries - 1)) { | 1336 | rx_local->Fbr0NumEntries - 1), |
1348 | rx_local->local_Fbr0_full.bits.val = 0; | 1337 | &rx_dma->fbr0_full_offset); |
1349 | rx_local->local_Fbr0_full.bits.wrap ^= 1; | ||
1350 | } | ||
1351 | |||
1352 | writel(rx_local->local_Fbr0_full.value, | ||
1353 | &rx_dma->fbr0_full_offset.value); | ||
1354 | } | 1338 | } |
1355 | #endif | 1339 | #endif |
1356 | spin_unlock_irqrestore(&etdev->FbrLock, flags); | 1340 | spin_unlock_irqrestore(&etdev->FbrLock, flags); |