From patchwork Sat Jul 20 10:15:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 2830815 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 082919F3EB for ; Sat, 20 Jul 2013 10:17:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F16320149 for ; Sat, 20 Jul 2013 10:17:24 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1AE5F20145 for ; Sat, 20 Jul 2013 10:17:23 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0UDz-0001P9-9r; Sat, 20 Jul 2013 10:17:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0UDx-00030T-3E; Sat, 20 Jul 2013 10:17:13 +0000 Received: from mail.nanl.de ([217.115.11.12]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0UDs-0002zA-Ca for linux-arm-kernel@lists.infradead.org; Sat, 20 Jul 2013 10:17:09 +0000 Received: from ixxyvirt.lan (unknown [IPv6:2001:470:9e39:0:a00:27ff:fe5b:45fa]) by mail.nanl.de (Postfix) with ESMTPSA id 500AE45FE0; Sat, 20 Jul 2013 10:16:20 +0000 (UTC) From: Jonas Gorski To: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] net: ixp4xx_eth: use parent device for dma allocations Date: Sat, 20 Jul 2013 12:15:39 +0200 Message-Id: <1374315339-31469-3-git-send-email-jogo@openwrt.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1374315339-31469-1-git-send-email-jogo@openwrt.org> References: <1374315339-31469-1-git-send-email-jogo@openwrt.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130720_061708_690795_81CE388E X-CRM114-Status: GOOD ( 10.25 ) X-Spam-Score: -1.9 (-) Cc: Russell King , netdev@vger.kernel.org, Imre Kaloz , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Krzysztof Halasa X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that the platfomr device provides a dma_cohorent_mask, use it for dma operations. This fixes ethernet on ixp4xx which was broken since 3.7. Signed-off-by: Jonas Gorski --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 3d689fc..18aa660 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -641,10 +641,10 @@ static inline void queue_put_desc(unsigned int queue, u32 phys, static inline void dma_unmap_tx(struct port *port, struct desc *desc) { #ifdef __ARMEB__ - dma_unmap_single(&port->netdev->dev, desc->data, + dma_unmap_single(port->netdev->dev.parent, desc->data, desc->buf_len, DMA_TO_DEVICE); #else - dma_unmap_single(&port->netdev->dev, desc->data & ~3, + dma_unmap_single(port->netdev->dev.parent, desc->data & ~3, ALIGN((desc->data & 3) + desc->buf_len, 4), DMA_TO_DEVICE); #endif @@ -711,9 +711,9 @@ static int eth_poll(struct napi_struct *napi, int budget) #ifdef __ARMEB__ if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) { - phys = dma_map_single(&dev->dev, skb->data, + phys = dma_map_single(dev->dev.parent, skb->data, RX_BUFF_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(&dev->dev, phys)) { + if (dma_mapping_error(dev->dev.parent, phys)) { dev_kfree_skb(skb); skb = NULL; } @@ -736,10 +736,11 @@ static int eth_poll(struct napi_struct *napi, int budget) #ifdef __ARMEB__ temp = skb; skb = port->rx_buff_tab[n]; - dma_unmap_single(&dev->dev, desc->data - NET_IP_ALIGN, + dma_unmap_single(dev->dev.parent, desc->data - NET_IP_ALIGN, RX_BUFF_SIZE, DMA_FROM_DEVICE); #else - dma_sync_single_for_cpu(&dev->dev, desc->data - NET_IP_ALIGN, + dma_sync_single_for_cpu(dev->dev.parent, + desc->data - NET_IP_ALIGN, RX_BUFF_SIZE, DMA_FROM_DEVICE); memcpy_swab32((u32 *)skb->data, (u32 *)port->rx_buff_tab[n], ALIGN(NET_IP_ALIGN + desc->pkt_len, 4) / 4); @@ -858,7 +859,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); #endif - phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); + phys = dma_map_single(dev->dev.parent, mem, bytes, DMA_TO_DEVICE); if (dma_mapping_error(&dev->dev, phys)) { dev_kfree_skb(skb); #ifndef __ARMEB__ @@ -1104,7 +1105,7 @@ static int init_queues(struct port *port) int i; if (!ports_open) { - dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev, + dma_pool = dma_pool_create(DRV_NAME, port->netdev->dev.parent, POOL_ALLOC_SIZE, 32, 0); if (!dma_pool) return -ENOMEM; @@ -1132,9 +1133,9 @@ static int init_queues(struct port *port) data = buff; #endif desc->buf_len = MAX_MRU; - desc->data = dma_map_single(&port->netdev->dev, data, + desc->data = dma_map_single(port->netdev->dev.parent, data, RX_BUFF_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(&port->netdev->dev, desc->data)) { + if (dma_mapping_error(port->netdev->dev.parent, desc->data)) { free_buffer(buff); return -EIO; } @@ -1154,7 +1155,7 @@ static void destroy_queues(struct port *port) struct desc *desc = rx_desc_ptr(port, i); buffer_t *buff = port->rx_buff_tab[i]; if (buff) { - dma_unmap_single(&port->netdev->dev, + dma_unmap_single(port->netdev->dev.parent, desc->data - NET_IP_ALIGN, RX_BUFF_SIZE, DMA_FROM_DEVICE); free_buffer(buff);