From patchwork Tue Apr 29 04:15:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungho An X-Patchwork-Id: 4084501 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 555519F38E for ; Tue, 29 Apr 2014 04:15:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 874F8201F4 for ; Tue, 29 Apr 2014 04:15:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CB71201CE for ; Tue, 29 Apr 2014 04:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752657AbaD2EPS (ORCPT ); Tue, 29 Apr 2014 00:15:18 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:9610 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752171AbaD2EPR (ORCPT ); Tue, 29 Apr 2014 00:15:17 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4R00KTTYHFYU70@mailout3.samsung.com>; Tue, 29 Apr 2014 13:15:15 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.48]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 34.FD.11120.3572F535; Tue, 29 Apr 2014 13:15:15 +0900 (KST) X-AuditID: cbfee68f-b7eff6d000002b70-a0-535f275375df Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 3E.C2.25708.3572F535; Tue, 29 Apr 2014 13:15:15 +0900 (KST) Received: from DObh74an01 ([12.36.166.149]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4R004TXYHFI770@mmp2.samsung.com>; Tue, 29 Apr 2014 13:15:15 +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: sw reset moved to probe function Date: Tue, 29 Apr 2014 13:15:15 +0900 Message-id: <001b01cf6361$9f4b6650$dde232f0$%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: Ac9jYZ8GX4zzr2UcSTqnQx3o9nAn7A== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRmVeSWpSXmKPExsVy+t8zA91g9fhgg5stshZzzrewWPQuuMpm Mf/oDiaLGef3MVkcWyBmsW3BBWYHNo8tK28yefRtWcXo8XmTXABzFJdNSmpOZllqkb5dAlfG 0z+fmQsuCVbM3LaZrYHxMF8XIyeHhICJxMZfDxghbDGJC/fWs3UxcnEICSxjlDh2dDYbTNHv JXeZIRLTGSV2H9rECuH8ZpS4cuIdK0gVm4CaRPPMy2AdIgK2EkuOfGYHsZkF3CT2X74NViMM FD/UdhwsziKgKrF53X9mEJtXwEZiyonlLBC2oMSPyfdYIHq1JDZva2KFsOUlNq95C1TPAXSR usSjv7ogpoiAnkTHQlGIChGJfS/eMYKcJiGwjV3i8+QtjBCrBCS+TT7EAtEqK7HpADPEX5IS B1fcYJnAKDYLyeJZSBbPQrJ4FpIVCxhZVjGKphYkFxQnpRcZ6xUn5haX5qXrJefnbmKERFv/ Dsa7B6wPMSYDrZ/ILCWanA+M1rySeENjMyMLUxNTYyNzSzPShJXEee8/TAoSEkhPLEnNTk0t SC2KLy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jWVSWLZ1ePKMfFK LMUZiYZazEXFiQDDfSUDKQMAAA== 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 moves sw reset to probe function because sw reset is needed early stage before open function. Signed-off-by: Byungho An --- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c | 13 ------------- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c index 4d989ff..bb9b5b8 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c @@ -23,21 +23,8 @@ /* DMA core initialization */ static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst, int burst_map) { - int retry_count = 10; u32 reg_val; - /* reset the DMA */ - writel(SXGBE_DMA_SOFT_RESET, ioaddr + SXGBE_DMA_MODE_REG); - while (retry_count--) { - if (!(readl(ioaddr + SXGBE_DMA_MODE_REG) & - SXGBE_DMA_SOFT_RESET)) - break; - mdelay(10); - } - - if (retry_count < 0) - return -EBUSY; - reg_val = readl(ioaddr + SXGBE_DMA_SYSBUS_MODE_REG); /* if fix_burst = 0, Set UNDEF = 1 of DMA_Sys_Mode Register. diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 27e8c82..6ad7b3a 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -2070,6 +2070,24 @@ static int sxgbe_hw_init(struct sxgbe_priv_data * const priv) return 0; } +static int sxgbe_sw_reset(void __iomem *addr) +{ + int retry_count = 10; + + writel(SXGBE_DMA_SOFT_RESET, addr + SXGBE_DMA_MODE_REG); + while (retry_count--) { + if (!(readl(addr + SXGBE_DMA_MODE_REG) & + SXGBE_DMA_SOFT_RESET)) + break; + mdelay(10); + } + + if (retry_count < 0) + return -EBUSY; + + return 0; +} + /** * sxgbe_drv_probe * @device: device pointer @@ -2102,6 +2120,10 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device, priv->plat = plat_dat; priv->ioaddr = addr; + ret = sxgbe_sw_reset(priv->ioaddr); + if (ret) + goto error_free_netdev; + /* Verify driver arguments */ sxgbe_verify_args();