Changeset 18150


Ignore:
Timestamp:
2009-10-25T17:58:00+01:00 (7 years ago)
Author:
blogic
Message:

[ramips] clean up dma api of ethernet driver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ramips/files/drivers/net/ramips.c

    r18149 r18150  
    4040#endif 
    4141 
     42#define phys_to_bus(a)  (a & 0x1FFFFFFF) 
     43 
    4244static struct net_device * ramips_dev; 
    4345static void __iomem *ramips_fe_base = 0; 
     
    5860ramips_alloc_dma(struct net_device *dev) 
    5961{ 
    60 #define phys_to_bus(a)  (a & 0x1FFFFFFF) 
    6162        struct raeth_priv *priv = netdev_priv(dev); 
    6263        int i; 
     
    6566 
    6667        /* setup tx ring */ 
    67         priv->tx = pci_alloc_consistent(NULL, 
    68                 NUM_TX_DESC * sizeof(struct ramips_tx_dma), &priv->phy_tx); 
     68        priv->tx = dma_alloc_coherent(NULL, 
     69                NUM_TX_DESC * sizeof(struct ramips_tx_dma), &priv->phy_tx, GFP_ATOMIC); 
    6970        for(i = 0; i < NUM_TX_DESC; i++) 
    7071        { 
     
    8081 
    8182        /* setup rx ring */ 
    82         priv->rx = pci_alloc_consistent(NULL, 
    83                 NUM_RX_DESC * sizeof(struct ramips_rx_dma), &priv->phy_rx); 
     83        priv->rx = dma_alloc_coherent(NULL, 
     84                NUM_RX_DESC * sizeof(struct ramips_rx_dma), &priv->phy_rx, GFP_ATOMIC); 
    8485        memset(priv->rx, 0, sizeof(struct ramips_rx_dma) * NUM_RX_DESC); 
    8586        for(i = 0; i < NUM_RX_DESC; i++) 
     
    9495                priv->rx_skb[i] = new_skb; 
    9596        } 
    96         dma_cache_wback_inv((unsigned long)priv->rx, 
    97                 NUM_RX_DESC * (sizeof(struct ramips_rx_dma))); 
    98  
    9997        ramips_fe_wr(phys_to_bus(priv->phy_rx), RAMIPS_RX_BASE_PTR0); 
    10098        ramips_fe_wr(NUM_RX_DESC, RAMIPS_RX_MAX_CNT0); 
     
    111109        unsigned long tx; 
    112110        unsigned int tx_next; 
    113  
     111        unsigned int mapped_addr; 
    114112        if(priv->plat->min_pkt_len) 
    115113        { 
     
    126124        } 
    127125        dev->trans_start = jiffies; 
    128         dma_cache_wback_inv((unsigned long)skb->data, skb->len); 
     126        mapped_addr = (unsigned int)dma_map_single(NULL, skb->data, skb->len, 
     127                        PCI_DMA_TODEVICE); 
     128        dma_sync_single_for_device(NULL, mapped_addr, skb->len, PCI_DMA_TODEVICE); 
    129129        tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0); 
    130130        if(tx == NUM_TX_DESC - 1) 
     
    191191                        PCI_DMA_FROMDEVICE); 
    192192                priv->rx[rx].rxd2 &= ~RX_DMA_DONE; 
    193                 dma_cache_wback_inv((unsigned long)&priv->rx[rx], 
    194                         sizeof(struct ramips_rx_dma)); 
    195193                ramips_fe_wr(rx, RAMIPS_RX_CALC_IDX0); 
    196194        } 
Note: See TracChangeset for help on using the changeset viewer.