From patchwork Wed Jul 9 12:37:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 33305 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4BCEB23932 for ; Wed, 9 Jul 2014 12:41:13 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id v10sf2664555qac.0 for ; Wed, 09 Jul 2014 05:41:13 -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:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=Etw7s1si4YL0QBosbw3DW92tQAIkPt4gJkjHYKwX6SA=; b=iMqkEWK0f4bH5mz51tPEkTEFguGGCoitgGUvLXR4HXsLqaCMIiaSIRDoXG9bmnrxqX UEtupKQGzN5wch9TUlJaWkJp7S+8WbCOBvr+eonwuxxVTdU6e1Rnyf9ySoU2PRXNKs1j IxjRJkWUFSd6uDoOC4xjtP/81iUR8J15SMrgCIxAef5YIPohYZYJBxNWoDwgD70++6mw qpr7DicsqWkVURHjfVxCfPYMKRyot/OWP/CCtG+z1YyoIGbxK6mhC5MzFW2Hw0ZpOjrs zWKgwG37VjK7hAoDmTlea67pZD+KKs7W3r5Dqd94yw/oYH4op3htFDu+P42m1W3hmRtn 9icA== X-Gm-Message-State: ALoCoQmwsyQLQyVPVV4Yb8ka7pgDM065oG+Z1m0ovCul8fncyixe6F+o7962/qgf+30EMS7MtvcG X-Received: by 10.236.150.114 with SMTP id y78mr19767446yhj.7.1404909673175; Wed, 09 Jul 2014 05:41:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.53 with SMTP id q50ls2626435qgd.2.gmail; Wed, 09 Jul 2014 05:41:13 -0700 (PDT) X-Received: by 10.58.185.227 with SMTP id ff3mr185834vec.45.1404909673104; Wed, 09 Jul 2014 05:41:13 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id sj4si21454882vec.18.2014.07.09.05.41.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 05:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id lf12so6839419vcb.32 for ; Wed, 09 Jul 2014 05:41:13 -0700 (PDT) X-Received: by 10.58.229.162 with SMTP id sr2mr39231053vec.15.1404909673026; Wed, 09 Jul 2014 05:41:13 -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.221.37.5 with SMTP id tc5csp44292vcb; Wed, 9 Jul 2014 05:41:12 -0700 (PDT) X-Received: by 10.68.230.194 with SMTP id ta2mr41244952pbc.51.1404909671125; Wed, 09 Jul 2014 05:41:11 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id j4si7298884pdb.15.2014.07.09.05.41.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jul 2014 05:41:11 -0700 (PDT) Received-SPF: none (google.com: linux-mtd-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) 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 1X4r9D-0001Lg-W9; Wed, 09 Jul 2014 12:38:55 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4r8o-0001Ak-Ot; Wed, 09 Jul 2014 12:38:31 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s69Cbf4V005242; Wed, 9 Jul 2014 07:37:41 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s69CbeUl005541; Wed, 9 Jul 2014 07:37:40 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Wed, 9 Jul 2014 07:37:39 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s69CbX7i010057; Wed, 9 Jul 2014 07:37:37 -0500 From: Roger Quadros To: , Subject: [RFC PATCH 01/10] mtd: nand: omap: Use a single hardware controller instance Date: Wed, 9 Jul 2014 15:37:21 +0300 Message-ID: <1404909450-11970-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404909450-11970-1-git-send-email-rogerq@ti.com> References: <1404909450-11970-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-20140709_053830_893192_CB23A05D X-CRM114-Status: UNSURE ( 8.53 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.152 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.47.26.152 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: jg1.han@samsung.com, nsekhar@ti.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, pekon@ti.com, ezequiel.garcia@free-electrons.com, javier@dowhile0.org, linux-omap@vger.kernel.org, dwmw2@infradead.org, Roger Quadros X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , 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.220.173 as permitted sender) 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 There is only one NAND controller (ECC generator) that needs to be shared among multiple devices. So point nand_chip->hwcontrol to a single omap_hw_controller instance. This way the NAND base driver can take care of serializing access to this single controller (via nand_chip->controller->lock) when multiple NAND devices are present. Signed-off-by: Roger Quadros --- drivers/mtd/nand/omap2.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index f0ed92e..5b8739c 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -149,8 +149,9 @@ static u_char bch4_vector[] = {0x00, 0x6b, 0x31, 0xdd, 0x41, 0xbc, 0x10}; /* oob info generated runtime depending on ecc algorithm and layout selected */ static struct nand_ecclayout omap_oobinfo; +static struct nand_hw_control omap_hw_controller; + struct omap_nand_info { - struct nand_hw_control controller; struct omap_nand_platform_data *pdata; struct mtd_info mtd; struct nand_chip nand; @@ -1649,9 +1650,6 @@ static int omap_nand_probe(struct platform_device *pdev) platform_set_drvdata(pdev, info); - spin_lock_init(&info->controller.lock); - init_waitqueue_head(&info->controller.wq); - info->pdev = pdev; info->gpmc_cs = pdata->cs; info->reg = pdata->reg; @@ -1672,7 +1670,13 @@ static int omap_nand_probe(struct platform_device *pdev) info->phys_base = res->start; - nand_chip->controller = &info->controller; + /* + * There is only one NAND controller (ECC generator) that needs to be + * shared among multiple devices. The NAND base driver takes care of + * serializing access to this single controller when multiple NAND + * devices are present. + */ + nand_chip->hwcontrol = omap_hw_controller; nand_chip->IO_ADDR_W = nand_chip->IO_ADDR_R; nand_chip->cmd_ctrl = omap_hwcontrol;