From patchwork Fri May 9 02:03:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungho An X-Patchwork-Id: 4140011 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 408D69F23C for ; Fri, 9 May 2014 02:04:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67463202E9 for ; Fri, 9 May 2014 02:04:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7157202EC for ; Fri, 9 May 2014 02:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756038AbaEICDs (ORCPT ); Thu, 8 May 2014 22:03:48 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:10899 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756024AbaEICDr (ORCPT ); Thu, 8 May 2014 22:03:47 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5A00IYMB29G900@mailout4.samsung.com>; Fri, 09 May 2014 11:03:45 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 8F.93.11496.1873C635; Fri, 09 May 2014 11:03:45 +0900 (KST) X-AuditID: cbfee691-b7f3e6d000002ce8-17-536c37814295 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 31.AA.25708.1873C635; Fri, 09 May 2014 11:03:45 +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 <0N5A00E3RB27TW20@mmp1.samsung.com>; Fri, 09 May 2014 11:03:45 +0900 (KST) From: Byungho An To: 'netdev' , linux-samsung-soc@vger.kernel.org Cc: davem@davemloft.net, "'ks.giri'" , "'vipul.pandya'" Subject: [PATCH 1/3] net: sxgbe: Added condition for non fix_burst mode Date: Fri, 09 May 2014 11:03:45 +0900 Message-id: <003b01cf6b2a$e8c81960$ba584c20$%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: Ac9rKui55ejXAn6IQ9qfjT48VV2Thg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsVy+t8zY91G85xgg1OLDS3mnG9hsZh/dAeT xYzz+5gsji0Qs9i24AKzA6vHlpU3mTz6tqxi9Pi8SS6AOYrLJiU1J7MstUjfLoEr49yBNcwF ZxQr/k7YxNTA2CjTxcjJISFgIvFnczcbhC0mceHeeiCbi0NIYBmjxNHV91i6GDnAihZ3S0DE FzFK9La+Y4JwfjNKTP5wghmkm01ATaJ55mWwSSICHhI3Fu4FizMLZEps393IAmILC7hLnNm9 iwnEZhFQleh41sEIYvMK2EhMfbKIGcIWlPgx+R4LRK+WxPqdx5kgbHmJzWveMkMcpC7x6K8u xCo9ib7VJ6FKRCT2vXjHCHKbhMAmdokTe58yQ+wSkPg2+RDUM7ISmw4wQzwsKXFwxQ2WCYxi s5BsnoVk8ywkm2chWbGAkWUVo2hqQXJBcVJ6kalecWJucWleul5yfu4mRkiMTdzBeP+A9SHG ZKD1E5mlRJPzgTGaVxJvaGxmZGFqYmpsZG5pRpqwkjhv+qOkICGB9MSS1OzU1ILUovii0pzU 4kOMTBycUg2MNecbhC1N758JXfQy7RlXmkfz5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== 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 seperates into two conditions for 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); }