This patch fixes an issue where data beyond the first 64bytes of TX buffers are not flushed. The driver did use kmalloc, dma_map_single, dma_sync_single_range_for_device, these function has been working on moblin. In latest meego, bytes after the first 64 does not get synched properly. This patch allocated coherent DMA memory instead.
Signed-off-by: Richard Röjfors <[email protected]> --- diff -Naur linux-2.6.35.org/drivers/net/ks8842.c linux-2.6.35/drivers/net/ks8842.c --- linux-2.6.35.org/drivers/net/ks8842.c 2010-11-18 15:18:01.000000000 -0500 +++ linux-2.6.35/drivers/net/ks8842.c 2010-11-18 15:24:36.000000000 -0500 @@ -449,10 +449,6 @@ *buf++ = (skb->len >> 8) & 0xff; skb_copy_from_linear_data(skb, buf, skb->len); - dma_sync_single_range_for_device(adapter->dev, - sg_dma_address(&ctl->sg), 0, sg_dma_len(&ctl->sg), - DMA_TO_DEVICE); - /* make sure the length is a multiple of 4 */ if (sg_dma_len(&ctl->sg) % 4) sg_dma_len(&ctl->sg) += 4 - sg_dma_len(&ctl->sg) % 4; @@ -908,12 +904,10 @@ tasklet_kill(&rx_ctl->tasklet); - if (sg_dma_address(&tx_ctl->sg)) - dma_unmap_single(adapter->dev, sg_dma_address(&tx_ctl->sg), - DMA_BUFFER_SIZE, DMA_TO_DEVICE); + if (tx_ctl->buf) + dma_free_coherent(adapter->dev, DMA_BUFFER_SIZE, + tx_ctl->buf, sg_dma_address(&tx_ctl->sg)); sg_dma_address(&tx_ctl->sg) = 0; - - kfree(tx_ctl->buf); tx_ctl->buf = NULL; } @@ -945,21 +939,13 @@ } /* allocate DMA buffer */ - tx_ctl->buf = kmalloc(DMA_BUFFER_SIZE, GFP_KERNEL); + tx_ctl->buf = dma_alloc_coherent(adapter->dev, DMA_BUFFER_SIZE, + &sg_dma_address(&tx_ctl->sg), GFP_KERNEL); if (!tx_ctl->buf) { err = -ENOMEM; goto err; } - sg_dma_address(&tx_ctl->sg) = dma_map_single(adapter->dev, - tx_ctl->buf, DMA_BUFFER_SIZE, DMA_TO_DEVICE); - err = dma_mapping_error(adapter->dev, - sg_dma_address(&tx_ctl->sg)); - if (err) { - sg_dma_address(&tx_ctl->sg) = 0; - goto err; - } - rx_ctl->chan = dma_request_channel(mask, ks8842_dma_filter_fn, (void *)(long)rx_ctl->channel); if (!rx_ctl->chan) { _______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
