From patchwork Fri Sep 18 14:53:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 53912 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 03CCC218E3 for ; Fri, 18 Sep 2015 14:58:06 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf9904126wic.3 for ; Fri, 18 Sep 2015 07:58:05 -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:subject:date:message-id :in-reply-to:references:mime-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe:cc :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=2ZszJznp0j+EzWaR3CyZXn0/ujOdbBgYPiXu1EjO430=; b=k4OWOw1ZhQoyKh9m62joJXxkq/Pm5gEjNPRKAe7keenT0KvrgZTo7ORFLdu1Qbjrk3 kqHEWQdDsoK3nyOGnU51mGIukZzhSdAXE0a/in5LS0UHmDD/9Pr+exACGLvrd06Uhcyr bwGiugZ6cV8ruNWmM9G7VeXup6qmCjikYR9tTXSmPkHFsKgREUoWHSQMFDjchm1AsKTq 9qA/BFGFAlrwLJktshdCBzcszAyiW37kDeRH4U+0bw8ENePTCpzwlBJ9Ne1aX//+gXZV f7g2uF74s63HCo5MOlWzsrR6KqCgwikACRSAyWXs6itNrXrTFqmL+Aei6NWDWeIsdPzq K9VA== X-Gm-Message-State: ALoCoQlbV3YggiCo4K1M+pN1VWwcWMM2fpPUTrWCV97jx+R1RBZBwRc7X4as/IVyH0fd5M7Bdfr9 X-Received: by 10.112.48.41 with SMTP id i9mr978415lbn.23.1442588285264; Fri, 18 Sep 2015 07:58:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.237.36 with SMTP id uz4ls248535lac.6.gmail; Fri, 18 Sep 2015 07:58:05 -0700 (PDT) X-Received: by 10.152.21.196 with SMTP id x4mr3389565lae.86.1442588285129; Fri, 18 Sep 2015 07:58:05 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id b2si6389477laa.31.2015.09.18.07.58.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 07:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lamp12 with SMTP id p12so31511564lam.0 for ; Fri, 18 Sep 2015 07:58:05 -0700 (PDT) X-Received: by 10.152.5.170 with SMTP id t10mr3303266lat.112.1442588284965; Fri, 18 Sep 2015 07:58:04 -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.112.59.35 with SMTP id w3csp345734lbq; Fri, 18 Sep 2015 07:58:03 -0700 (PDT) X-Received: by 10.68.197.196 with SMTP id iw4mr7645694pbc.153.1442588283877; Fri, 18 Sep 2015 07:58:03 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ms5si14176120pbb.135.2015.09.18.07.58.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 07:58:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zcx4i-0000mv-3F; Fri, 18 Sep 2015 14:55:44 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zcx4d-0000SP-5D; Fri, 18 Sep 2015 14:55:41 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8IEtDtt026983; Fri, 18 Sep 2015 09:55:13 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8IEtD6t009032; Fri, 18 Sep 2015 09:55:13 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Fri, 18 Sep 2015 09:55:13 -0500 Received: from rockdesk.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8IEseAP002598; Fri, 18 Sep 2015 09:55:10 -0500 From: Roger Quadros To: Subject: [PATCH v3 09/27] mtd: nand: omap2: manage NAND interrupts Date: Fri, 18 Sep 2015 17:53:31 +0300 Message-ID: <1442588029-13769-10-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442588029-13769-1-git-send-email-rogerq@ti.com> References: <1442588029-13769-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150918_075539_500458_3350AF6A X-CRM114-Status: GOOD ( 13.23 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.40 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.94.94.40 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-omap@vger.kernel.org, nsekhar@ti.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, ezequiel@vanguardiasur.com.ar, javier@dowhile0.org, computersforpeace@gmail.com, dwmw2@infradead.org, fcooper@ti.com, Roger Quadros Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=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 Manage NAND interrupts here using the GPMC IRQ ops. This causes performance in prefetch-irq mode to be increased from [ 38.252811] mtd_speedtest: eraseblock write speed is 5576 KiB/s [ 39.265259] mtd_speedtest: eraseblock read speed is 8192 KiB/s to [ 35.666446] mtd_speedtest: eraseblock write speed is 6537 KiB/s [ 36.444842] mtd_speedtest: eraseblock read speed is 10680 KiB/s Test results on dra7-evm using mtd_speedtest.ko Signed-off-by: Roger Quadros --- drivers/mtd/nand/omap2.c | 65 +++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 0eb0b8c..267bcdd 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -162,8 +162,7 @@ struct omap_nand_info { enum omap_ecc ecc_opt; struct completion comp; struct dma_chan *dma; - int gpmc_irq_fifo; - int gpmc_irq_count; + int gpmc_irq; enum { OMAP_NAND_IO_READ = 0, /* read */ OMAP_NAND_IO_WRITE, /* write */ @@ -579,12 +578,17 @@ static irqreturn_t omap_nand_irq(int this_irq, void *dev) { struct omap_nand_info *info = (struct omap_nand_info *) dev; u32 bytes; + u32 irqstatus; + + irqstatus = info->ops->nand_irq_status(); + if (!irqstatus) + return IRQ_NONE; bytes = readl(info->reg.gpmc_prefetch_status); bytes = PREFETCH_STATUS_FIFO_CNT(bytes); bytes = bytes & 0xFFFC; /* io in multiple of 4 bytes */ if (info->iomode == OMAP_NAND_IO_WRITE) { /* checks for write io */ - if (this_irq == info->gpmc_irq_count) + if (irqstatus & GPMC_IRQENABLE_TERMCOUNT) goto done; if (info->buf_len && (info->buf_len < bytes)) @@ -601,17 +605,25 @@ static irqreturn_t omap_nand_irq(int this_irq, void *dev) (u32 *)info->buf, bytes >> 2); info->buf = info->buf + bytes; - if (this_irq == info->gpmc_irq_count) + if (irqstatus & GPMC_IRQENABLE_TERMCOUNT) goto done; } + /* Clear FIFOEVENT STATUS */ + info->ops->nand_irq_clear(GPMC_NAND_IRQ_FIFOEVENT); + return IRQ_HANDLED; done: complete(&info->comp); - disable_irq_nosync(info->gpmc_irq_fifo); - disable_irq_nosync(info->gpmc_irq_count); + /* Clear FIFOEVENT and TERMCOUNT STATUS */ + info->ops->nand_irq_clear(GPMC_NAND_IRQ_FIFOEVENT); + info->ops->nand_irq_clear(GPMC_NAND_IRQ_TERMCOUNT); + + /* Disable Interrupt generation */ + info->ops->nand_irq_disable(GPMC_NAND_IRQ_FIFOEVENT); + info->ops->nand_irq_disable(GPMC_NAND_IRQ_TERMCOUNT); return IRQ_HANDLED; } @@ -646,8 +658,9 @@ static void omap_read_buf_irq_pref(struct mtd_info *mtd, u_char *buf, int len) info->buf_len = len; - enable_irq(info->gpmc_irq_count); - enable_irq(info->gpmc_irq_fifo); + /* Enable Interrupt generation */ + info->ops->nand_irq_enable(GPMC_NAND_IRQ_TERMCOUNT); + info->ops->nand_irq_enable(GPMC_NAND_IRQ_FIFOEVENT); /* waiting for read to complete */ wait_for_completion(&info->comp); @@ -696,8 +709,9 @@ static void omap_write_buf_irq_pref(struct mtd_info *mtd, info->buf_len = len; - enable_irq(info->gpmc_irq_count); - enable_irq(info->gpmc_irq_fifo); + /* Enable Interrupt generation */ + info->ops->nand_irq_enable(GPMC_NAND_IRQ_TERMCOUNT); + info->ops->nand_irq_enable(GPMC_NAND_IRQ_FIFOEVENT); /* waiting for write to complete */ wait_for_completion(&info->comp); @@ -1776,35 +1790,18 @@ static int omap_nand_probe(struct platform_device *pdev) break; case NAND_OMAP_PREFETCH_IRQ: - info->gpmc_irq_fifo = platform_get_irq(pdev, 0); - if (info->gpmc_irq_fifo <= 0) { - dev_err(&pdev->dev, "error getting fifo irq\n"); - err = -ENODEV; - goto return_error; - } - err = devm_request_irq(&pdev->dev, info->gpmc_irq_fifo, - omap_nand_irq, IRQF_SHARED, - "gpmc-nand-fifo", info); - if (err) { - dev_err(&pdev->dev, "requesting irq(%d) error:%d", - info->gpmc_irq_fifo, err); - info->gpmc_irq_fifo = 0; - goto return_error; - } - - info->gpmc_irq_count = platform_get_irq(pdev, 1); - if (info->gpmc_irq_count <= 0) { - dev_err(&pdev->dev, "error getting count irq\n"); + info->gpmc_irq = platform_get_irq(pdev, 0); + if (info->gpmc_irq <= 0) { + dev_err(&pdev->dev, "error getting GPMC irq\n"); err = -ENODEV; goto return_error; } - err = devm_request_irq(&pdev->dev, info->gpmc_irq_count, - omap_nand_irq, IRQF_SHARED, - "gpmc-nand-count", info); + err = devm_request_irq(&pdev->dev, info->gpmc_irq, + omap_nand_irq, IRQF_SHARED, + DRIVER_NAME, info); if (err) { dev_err(&pdev->dev, "requesting irq(%d) error:%d", - info->gpmc_irq_count, err); - info->gpmc_irq_count = 0; + info->gpmc_irq, err); goto return_error; }