From patchwork Wed May 7 08:14:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungho An X-Patchwork-Id: 4126421 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 150979F1E1 for ; Wed, 7 May 2014 08:14:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F8D920222 for ; Wed, 7 May 2014 08:14:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AAA9201C8 for ; Wed, 7 May 2014 08:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755210AbaEGIOS (ORCPT ); Wed, 7 May 2014 04:14:18 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:9489 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754176AbaEGIOG (ORCPT ); Wed, 7 May 2014 04:14:06 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5700HEO2VFEL10@mailout4.samsung.com>; Wed, 07 May 2014 17:14:03 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.50]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id D5.1D.18501.A4BE9635; Wed, 07 May 2014 17:14:02 +0900 (KST) X-AuditID: cbfee68d-b7f4e6d000004845-67-5369eb4aa8b1 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id CB.3E.27725.94BE9635; Wed, 07 May 2014 17:14:01 +0900 (KST) Received: from DObh74an01 ([12.36.166.149]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N57000ZW2VCYT50@mmp1.samsung.com>; Wed, 07 May 2014 17:14:01 +0900 (KST) From: Byungho An To: netdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: davem@davemloft.net, ks.giri@samsung.com, vipul.pandya@samsung.com Subject: [PATCH] net: sxgbe: Added condition for non fix_burst mode Date: Wed, 07 May 2014 17:14:01 +0900 Message-id: <008c01cf69cc$4dcc8e50$e965aaf0$%an@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac9pzE23Lk45uQteTh6BVRoAo8VccA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsVy+t8zI12v15nBBn/+MlvMOd/CYjH/6A4m ixnn9zFZHFsgZrFtwQVmB1aPLStvMnn0bVnF6PF5k1wAcxSXTUpqTmZZapG+XQJXxqb5ixkL ripWHF63hbWBsVOmi5GTQ0LAROL1tuOsELaYxIV769m6GLk4hASWMUqs+X6cGabo8KvZjBCJ RYwSx/adY4FwfjNKLGt8ClbFJqAm0TzzMhuILSJgK7HkyGd2EJtZwE1i/+XbYCuEBZwlHk34 wQRiswioSvxsWg1Uw8HBK2AjselWPkiYV0BQ4sfkeywQrVoS63ceZ4Kw5SU2r3nLDFIuIaAu 8eivLsQmPYm/G59AlYhI7HvxDuxOCYFt7BJnNt9jh1glIPFt8iEWiF5ZiU0HoP6SlDi44gbL BEaxWUg2z0KyeRaSzbOQrFjAyLKKUTS1ILmgOCm9yFCvODG3uDQvXS85P3cTIyTGencw3j5g fYgxGWj9RGYp0eR8YIzmlcQbGpsZWZiamBobmVuakSasJM6b9DApSEggPbEkNTs1tSC1KL6o NCe1+BAjEwenVANjK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apO3vZs9PYJnQ2/Fr lhJLcUaioRZzUXEiAPbZAWAkAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This patch adds the condition for non fixed burst mode and separates into two conditions depending on pbl value. Signed-off-by: Byungho An --- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c | 32 ++++++++++++++++++++--- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h | 2 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 3 ++- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c index bb9b5b8..49240c9 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c @@ -45,7 +45,8 @@ static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst, int burst_map) static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num, int fix_burst, int pbl, dma_addr_t dma_tx, - dma_addr_t dma_rx, int t_rsize, int r_rsize) + dma_addr_t dma_rx, int t_rsize, int r_rsize, + int buf_size) { u32 reg_val; dma_addr_t dma_addr; @@ -57,12 +58,37 @@ static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num, writel(reg_val, ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num)); /* program the TX pbl */ reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num)); - reg_val |= (pbl << SXGBE_DMA_TXPBL_LSHIFT); + reg_val |= pbl << SXGBE_DMA_TXPBL_LSHIFT; writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num)); /* program the RX pbl */ reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num)); - reg_val |= (pbl << SXGBE_DMA_RXPBL_LSHIFT); + reg_val |= pbl << SXGBE_DMA_RXPBL_LSHIFT; writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num)); + } else { + if (pbl > 32) { + /* program the pblx8 */ + reg_val |= SXGBE_DMA_PBL_X8MODE; + writel(reg_val, ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num)); + /* program the TX pbl */ + reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num)); + reg_val |= (pbl >> 3) << SXGBE_DMA_TXPBL_LSHIFT; + writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num)); + /* program the RX pbl */ + reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num)); + reg_val |= (pbl >> 3) << SXGBE_DMA_RXPBL_LSHIFT | + buf_size << SXGBE_DMA_BLENMAP_LSHIFT; + writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num)); + } else { + /* program the TX pbl */ + reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num)); + reg_val |= pbl << SXGBE_DMA_TXPBL_LSHIFT; + writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num)); + /* program the RX pbl */ + reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num)); + reg_val |= pbl << SXGBE_DMA_RXPBL_LSHIFT | + buf_size << SXGBE_DMA_BLENMAP_LSHIFT; + writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num)); + } } /* program desc registers */ diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h index 1607b54..843fa9b 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h @@ -25,7 +25,7 @@ struct sxgbe_dma_ops { int (*init)(void __iomem *ioaddr, int fix_burst, int burst_map); void (*cha_init)(void __iomem *ioaddr, int cha_num, int fix_burst, int pbl, dma_addr_t dma_tx, dma_addr_t dma_rx, - int t_rzie, int r_rsize); + int t_rzie, int r_rsize, int buf_size); void (*enable_dma_transmission)(void __iomem *ioaddr, int dma_cnum); void (*enable_dma_irq)(void __iomem *ioaddr, int dma_cnum); void (*disable_dma_irq)(void __iomem *ioaddr, int dma_cnum); diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 82a9a98..93bf151 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -944,7 +944,8 @@ static int sxgbe_init_dma_engine(struct sxgbe_priv_data *priv) fixed_burst, pbl, (priv->txq[queue_num])->dma_tx_phy, (priv->rxq[queue_num])->dma_rx_phy, - priv->dma_tx_size, priv->dma_rx_size); + priv->dma_tx_size, priv->dma_rx_size, + priv->dma_buf_sz); return priv->hw->dma->init(priv->ioaddr, fixed_burst, burst_map); }