From patchwork Tue Apr 29 04:15:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungho An X-Patchwork-Id: 29281 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E48C420553 for ; Tue, 29 Apr 2014 04:15:29 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id r5sf27622656qcx.5 for ; Mon, 28 Apr 2014 21:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:thread-index:dlp-filter:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding:content-language; bh=BT/aILkvvgeE4+aQN/FOklKAaLKjcQeXbsgMvxOs++U=; b=d/MmMzPtiPE6Z+TjCBAMaPgX7EPlx7U6u9evMJ7fgD86OG4x95yd5H1a4Mur8MBXod CQXEP97msv2RIRJ6wiK1EDLKJoWc6JL5pRsMvZXqadDABQXpFEHIl7q2OeQvssIjkUxb 1nJKKdZZzvb6mXo+bbaALsGon86CgLH8gIlWwUntsYA4t5SNkzesY/kSHVDEYxMfurvh AzrQ/5oEXEGDpUmRHv/pIhRi2cFbLxvWf2Q6+2mvyPdlsYLdIGyMohquDKq3OY4RmPTP sztK0KAeb7DKFn4Ja9e+7Pg2ndXIVrypDEx35Zm5hKd00Ndd9OfCdI/d5kmIfl3TwZHe 7iHw== X-Gm-Message-State: ALoCoQm8KKo+pokiR5wFaH9xtq1nnhnqhlDpfBAig3AoRxvqJrDZ/jMlkxZ9vITwpoCvyaKQVsYv X-Received: by 10.58.43.170 with SMTP id x10mr14610576vel.36.1398744929381; Mon, 28 Apr 2014 21:15:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls2901670qga.86.gmail; Mon, 28 Apr 2014 21:15:29 -0700 (PDT) X-Received: by 10.220.147.16 with SMTP id j16mr27352053vcv.14.1398744929245; Mon, 28 Apr 2014 21:15:29 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id ud8si4221742vdc.177.2014.04.28.21.15.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 21:15:29 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so9112324veb.6 for ; Mon, 28 Apr 2014 21:15:29 -0700 (PDT) X-Received: by 10.58.96.36 with SMTP id dp4mr27738381veb.21.1398744929131; Mon, 28 Apr 2014 21:15:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp166340vcb; Mon, 28 Apr 2014 21:15:28 -0700 (PDT) X-Received: by 10.68.249.195 with SMTP id yw3mr12966054pbc.134.1398744928346; Mon, 28 Apr 2014 21:15:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pn4si11775667pac.175.2014.04.28.21.15.27; Mon, 28 Apr 2014 21:15:27 -0700 (PDT) Received-SPF: none (google.com: netdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754011AbaD2EPX (ORCPT + 3 others); Tue, 29 Apr 2014 00:15:23 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:40544 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752777AbaD2EPT (ORCPT ); Tue, 29 Apr 2014 00:15:19 -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 <0N4R009BQYHIPW80@mailout4.samsung.com>; Tue, 29 Apr 2014 13:15:18 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id D5.29.11496.6572F535; Tue, 29 Apr 2014 13:15:18 +0900 (KST) X-AuditID: cbfee691-b7f3e6d000002ce8-de-535f2756a5e4 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 30.E2.25708.5572F535; Tue, 29 Apr 2014 13:15:18 +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 <0N4R00HXHYHHZ330@mmp1.samsung.com>; Tue, 29 Apr 2014 13:15:17 +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 rxqueue enable function Date: Tue, 29 Apr 2014 13:15:17 +0900 Message-id: <001c01cf6361$a0df9ae0$e29ed0a0$%an@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac9jYaC+l2sKCUhoRFqdmbCcXtaK1Q== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsVy+t8zY90w9fhgg79z2C3mnG9hsehdcJXN Yv7RHUwWM87vY7I4tkDMYtuCC8wObB5bVt5k8ujbsorR4/MmuQDmKC6blNSczLLUIn27BK6M +W1KBXcVK659fsPcwDhXtouRk0NCwETi5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Lz mrfMIK0SAuoSj/7qQmzSk3iz7ixUuYjEvhfvGCcwCsxCMmkWkkmzkEyahaRlASPLKkbR1ILk guKk9FwjveLE3OLSvHS95PzcTYzgOH4mvYNxVYPFIUYBDkYlHt6OmLhgIdbEsuLK3EOMEhzM SiK8tq1AId6UxMqq1KL8+KLSnNTiQ4zJQH9OZJYSTc4Hppi8knhDYxMzI0sjMwsjE3Nz0oSV xHkPtloHCgmkJ5akZqemFqQWwWxh4uCUamAMdTu+qtFol74Fv+uf8lufIqZUubx3er7svJSv ujT/739T7coTY28KbbN7GLTtdoRbpYzx8rMMvj/v3YlPOx7w2+ThxY2L+1vrT3vc8vV6vy3O c2W66NX+bydWlnO87jIxCyk5I9x2Y+7a3+dWzw0UOh/8yJBdS9QuM1ZblJfXslMyKsZ9FZ8S S3FGoqEWc1FxIgBjRbAuJwMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bh74.an@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit Content-language: ko This patch adds rxqueue enable function according to number of rxqueue and adds rxqueue disable function for removing. Signed-off-by: Byungho An --- drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h | 2 ++ drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c | 22 +++++++++++++++++++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 8 ++++++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h | 4 ++++ 4 files changed, 36 insertions(+) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h index 6203c7d..4501964 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h @@ -358,6 +358,8 @@ struct sxgbe_core_ops { /* Enable disable checksum offload operations */ void (*enable_rx_csum)(void __iomem *ioaddr); void (*disable_rx_csum)(void __iomem *ioaddr); + void (*enable_rxqueue)(void __iomem *ioaddr, int queue_num); + void (*disable_rxqueue)(void __iomem *ioaddr, int queue_num); }; const struct sxgbe_core_ops *sxgbe_get_core_ops(void); diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c index c4da7a2..58c3569 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c @@ -165,6 +165,26 @@ static void sxgbe_core_set_speed(void __iomem *ioaddr, unsigned char speed) writel(tx_cfg, ioaddr + SXGBE_CORE_TX_CONFIG_REG); } +static void sxgbe_core_enable_rxqueue(void __iomem *ioaddr, int queue_num) +{ + u32 reg_val; + + reg_val = readl(ioaddr + SXGBE_CORE_RX_CTL0_REG); + reg_val &= ~(SXGBE_CORE_RXQ_ENABLE_MASK << queue_num); + reg_val |= SXGBE_CORE_RXQ_ENABLE; + writel(reg_val, ioaddr + SXGBE_CORE_RX_CTL0_REG); +} + +static void sxgbe_core_disable_rxqueue(void __iomem *ioaddr, int queue_num) +{ + u32 reg_val; + + reg_val = readl(ioaddr + SXGBE_CORE_RX_CTL0_REG); + reg_val &= ~(SXGBE_CORE_RXQ_ENABLE_MASK << queue_num); + reg_val |= SXGBE_CORE_RXQ_DISABLE; + writel(reg_val, ioaddr + SXGBE_CORE_RX_CTL0_REG); +} + static void sxgbe_set_eee_mode(void __iomem *ioaddr) { u32 ctrl; @@ -254,6 +274,8 @@ static const struct sxgbe_core_ops core_ops = { .set_eee_pls = sxgbe_set_eee_pls, .enable_rx_csum = sxgbe_enable_rx_csum, .disable_rx_csum = sxgbe_disable_rx_csum, + .enable_rxqueue = sxgbe_core_enable_rxqueue, + .disable_rxqueue = sxgbe_core_disable_rxqueue, }; const struct sxgbe_core_ops *sxgbe_get_core_ops(void) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 6ad7b3a..fd5c428 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -1076,6 +1076,9 @@ static int sxgbe_open(struct net_device *dev) /* Initialize the MAC Core */ priv->hw->mac->core_init(priv->ioaddr); + SXGBE_FOR_EACH_QUEUE(SXGBE_RX_QUEUES, queue_num) { + priv->hw->mac->enable_rxqueue(priv->ioaddr, queue_num); + } /* Request the IRQ lines */ ret = devm_request_irq(priv->device, priv->irq, sxgbe_common_interrupt, @@ -2240,9 +2243,14 @@ error_free_netdev: int sxgbe_drv_remove(struct net_device *ndev) { struct sxgbe_priv_data *priv = netdev_priv(ndev); + u8 queue_num; netdev_info(ndev, "%s: removing driver\n", __func__); + SXGBE_FOR_EACH_QUEUE(SXGBE_RX_QUEUES, queue_num) { + priv->hw->mac->disable_rxqueue(priv->ioaddr, queue_num); + } + priv->hw->dma->stop_rx(priv->ioaddr, SXGBE_RX_QUEUES); priv->hw->dma->stop_tx(priv->ioaddr, SXGBE_TX_QUEUES); diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h b/drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h index 5a89acb..56f8bf5 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h @@ -52,6 +52,10 @@ #define SXGBE_CORE_RX_CTL2_REG 0x00A8 #define SXGBE_CORE_RX_CTL3_REG 0x00AC +#define SXGBE_CORE_RXQ_ENABLE_MASK 0x0003 +#define SXGBE_CORE_RXQ_ENABLE 0x0002 +#define SXGBE_CORE_RXQ_DISABLE 0x0000 + /* Interrupt Registers */ #define SXGBE_CORE_INT_STATUS_REG 0x00B0 #define SXGBE_CORE_INT_ENABLE_REG 0x00B4