From patchwork Thu Jul 7 23:08:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Mason X-Patchwork-Id: 9219905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C8AD76048B for ; Thu, 7 Jul 2016 23:11:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4D0127BFF for ; Thu, 7 Jul 2016 23:11:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A94B627C38; Thu, 7 Jul 2016 23:11:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5449427BFF for ; Thu, 7 Jul 2016 23:11:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLIQd-0001eK-01; Thu, 07 Jul 2016 23:09:55 +0000 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLIQG-0001Qy-S7 for linux-arm-kernel@lists.infradead.org; Thu, 07 Jul 2016 23:09:35 +0000 Received: by mail-pf0-x233.google.com with SMTP id h14so10021625pfe.1 for ; Thu, 07 Jul 2016 16:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VHSVlxgJzC5Ia2gg5i0vC5+dBTOD1GzqsK0zSknYKJU=; b=fxLSWr/u1Pm4t6QVKEcRTHltLjCV94SQpRx3A6kvmIVcmyvZk02nHRPrt/TbVaipg9 izoB/1g4/Vdfe0s4/oheCtWVUmRLgvqYsrL4Q8wQiBcuuJ0hS2Sat99Xh5vcHGG4OiJk HSQKJsIUNDN5VzdUTfbzX2X46UmwuNe0Rl2Fs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VHSVlxgJzC5Ia2gg5i0vC5+dBTOD1GzqsK0zSknYKJU=; b=TghxWYX+nO7T7ZLiSCmt2zJJw6DTMf/SwdBRitWVqYgWSBMew6MozUAjKuTn+Cpq1R G02q1iM3njrAPw2rVH7iWnbtoA+zsIQUlppUwtEpXFLh1B7B3Gk+tIyuTsspLoB0aLzR VpB19hPBCIl8RQ4srIsUhRryAFd3kS6EfSRWdJo89ngr0ZTLVdFWCMWTOdWh6OBXR7c8 QY40UgPfLpx7yVJBJjU0NTJ9jn6EoXTCukcI+qCA0Ux23TjMFDeW3mxyq8s6Jtsqyj1e WomEUqQi7hdWGOXQoEDw4fZJYyQRw0PApIoCk3QYKzEUYtuKFAxV1SSD/YbDOCCks3yH ETkQ== X-Gm-Message-State: ALyK8tLR5vOSJ7A7AX1pm4tws4QtRFDPZHrK5J83/ggdfgnMHmXddfRo4fYM6PeI2Gb39qr/ X-Received: by 10.98.110.195 with SMTP id j186mr4492993pfc.49.1467932952090; Thu, 07 Jul 2016 16:09:12 -0700 (PDT) Received: from venom.rtp.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id y70sm3838514pff.25.2016.07.07.16.09.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 16:09:11 -0700 (PDT) From: Jon Mason To: davem@davemloft.net, f.fainelli@gmail.com Subject: [PATCH v2 2/6] net: ethernet: bgmac: add dma_dev pointer Date: Thu, 7 Jul 2016 19:08:54 -0400 Message-Id: <1467932938-21819-3-git-send-email-jon.mason@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467932938-21819-1-git-send-email-jon.mason@broadcom.com> References: <1467932938-21819-1-git-send-email-jon.mason@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160707_160933_122923_84DFCC14 X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Scott Branden , Pawel Moll , Ian Campbell , hauke@hauke-m.de, zajec5@gmail.com, linux-kernel@vger.kernel.org, Ray Jui , Rob Herring , bcm-kernel-feedback-list@broadcom.com, Kumar Gala , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The dma buffer allocation, etc references a dma_dev device pointer from the bcma core. In anticipation of removing the bcma requirement for this driver, these must be changed to not reference that struct. Add a dma_dev device pointer to the bgmac stuct and reference that instead. Signed-off-by: Jon Mason Acked-by: Arnd Bergmann Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli --- drivers/net/ethernet/broadcom/bgmac.c | 17 +++++++++-------- drivers/net/ethernet/broadcom/bgmac.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 37b3b68..3614bd8 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, struct bgmac_dma_ring *ring, struct sk_buff *skb) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; struct net_device *net_dev = bgmac->net_dev; int index = ring->end % BGMAC_TX_RING_SLOTS; struct bgmac_slot_info *slot = &ring->slots[index]; @@ -254,7 +254,7 @@ err_drop: /* Free transmitted packets */ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; int empty_slot; bool freed = false; unsigned bytes_compl = 0, pkts_compl = 0; @@ -351,7 +351,7 @@ static void bgmac_dma_rx_enable(struct bgmac *bgmac, static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac, struct bgmac_slot_info *slot) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; dma_addr_t dma_addr; struct bgmac_rx_header *rx; void *buf; @@ -440,7 +440,7 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, end_slot /= sizeof(struct bgmac_dma_desc); while (ring->start != end_slot) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; struct bgmac_slot_info *slot = &ring->slots[ring->start]; struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; struct sk_buff *skb; @@ -543,7 +543,7 @@ static bool bgmac_dma_unaligned(struct bgmac *bgmac, static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; struct bgmac_dma_desc *dma_desc = ring->cpu_base; struct bgmac_slot_info *slot; int i; @@ -569,7 +569,7 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, static void bgmac_dma_rx_ring_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; struct bgmac_slot_info *slot; int i; @@ -590,7 +590,7 @@ static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring, int num_slots) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; int size; if (!ring->cpu_base) @@ -628,7 +628,7 @@ static void bgmac_dma_free(struct bgmac *bgmac) static int bgmac_dma_alloc(struct bgmac *bgmac) { - struct device *dma_dev = bgmac->core->dma_dev; + struct device *dma_dev = bgmac->dma_dev; struct bgmac_dma_ring *ring; static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1, BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, }; @@ -1701,6 +1701,7 @@ static int bgmac_probe(struct bcma_device *core) net_dev->ethtool_ops = &bgmac_ethtool_ops; bgmac = netdev_priv(net_dev); bgmac->dev = &core->dev; + bgmac->dma_dev = core->dma_dev; bgmac->net_dev = net_dev; bgmac->core = core; bcma_set_drvdata(core, bgmac); diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h index abb9dd8..fd20018 100644 --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h @@ -429,6 +429,7 @@ struct bgmac { struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */ struct device *dev; + struct device *dma_dev; struct net_device *net_dev; struct napi_struct napi; struct mii_bus *mii_bus;