From patchwork Thu Jun 30 22:59:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Mason X-Patchwork-Id: 9209055 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 AAE1D6089D for ; Thu, 30 Jun 2016 23:01:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C35B28515 for ; Thu, 30 Jun 2016 23:01:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9053E28683; Thu, 30 Jun 2016 23:01:58 +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 20D5F28515 for ; Thu, 30 Jun 2016 23:01:58 +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 1bIkwR-0003zg-Vh; Thu, 30 Jun 2016 23:00:15 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIkw5-0002ez-3G for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2016 22:59:55 +0000 Received: by mail-pa0-x22d.google.com with SMTP id wo6so32484388pac.3 for ; Thu, 30 Jun 2016 15:59:32 -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=oKuOpSHo8CPThbVzd7bMYUlqrbrDXJ4C01CIG0UozvI=; b=dbeN0sCPFrUULZLC4UEaIn+KGDU2c0pFgrwD+Xvuxci7JqYYq9qBZvnFbZvszfhoSp 3kNOvzHskCZDZCSRHxSxtY9YbZO2fyCNsXAzQxME5HmynTtITxLfalEMk1c68yVN4h0j pNLOOc4CBJbTAR3xUdAZ2I9erh4usNi+kF/S8= 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=oKuOpSHo8CPThbVzd7bMYUlqrbrDXJ4C01CIG0UozvI=; b=A+iEEUyP0xdSL1GP+QSbxogIRHAkTR/g55B38KX8EgP51d/K0BrWyShGouKGmNEdTU SVQWKs846BSqL0OWyhw1B5mIuFkuSTmlSrzig2dyLza2mBykHVS2vwLSq+TwxlBaUYU9 pN+izvZ4y0ybvLDpjY/lj9w8PtzoIXmLEXO1w6qTUpGXgeuUQRasLQbFhqOlDdDR99IJ Y8lLYZ1PfIPizR8+0BsK/iCVBBaK8Ynfw16Sd+6UHHMfF9rp7IIMLgvsDSPfxxIaWhG3 jixqJzJSWgJ58qgQPNyRfsEIIfm0t5gwVrEiT67KzZFjPIw2OUpRbTPn7G+IgDiAaZSN amrw== X-Gm-Message-State: ALyK8tLlomyUVd4WNr/u0KycSVIVyIEutl7aLkqno8EinXuq2AUJbRIAOIKvqOD4h6cJgJh7 X-Received: by 10.67.7.71 with SMTP id da7mr25699955pad.136.1467327572052; Thu, 30 Jun 2016 15:59:32 -0700 (PDT) Received: from venom.rtp.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id zv2sm395767pac.43.2016.06.30.15.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jun 2016 15:59:31 -0700 (PDT) From: Jon Mason To: zajec5@gmail.com Subject: [PATCH 2/7] net: ethernet: bgmac: add dma_dev pointer Date: Thu, 30 Jun 2016 18:59:09 -0400 Message-Id: <1467327554-22074-3-git-send-email-jon.mason@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467327554-22074-1-git-send-email-jon.mason@broadcom.com> References: <1467327554-22074-1-git-send-email-jon.mason@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160630_155953_279073_B4E96402 X-CRM114-Status: GOOD ( 14.42 ) 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, f.fainelli@gmail.com, Scott Branden , Pawel Moll , Ian Campbell , hauke@hauke-m.de, linux-kernel@vger.kernel.org, Ray Jui , Rob Herring , bcm-kernel-feedback-list@broadcom.com, Kumar Gala , netdev@vger.kernel.org, davem@davemloft.net, 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 --- 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;