From patchwork Thu Apr 29 08:48:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 96065 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3UL3bJS031256 for ; Fri, 30 Apr 2010 21:03:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759264Ab0D3VDM (ORCPT ); Fri, 30 Apr 2010 17:03:12 -0400 Received: from compulab.co.il ([67.18.134.219]:38483 "EHLO compulab.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757260Ab0D3VDA (ORCPT ); Fri, 30 Apr 2010 17:03:00 -0400 Received: from [62.90.235.247] (helo=zimbra-mta.compulab.co.il) by compulab.site5.com with esmtp (Exim 4.69) (envelope-from ) id 1O7PR9-0008JF-60; Thu, 29 Apr 2010 03:49:35 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 4C41B9A002A; Thu, 29 Apr 2010 11:49:33 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X+xAHTYxX-Fn; Thu, 29 Apr 2010 11:49:33 +0300 (IDT) Received: from droid.compulab.local (droid.compulab.local [10.1.1.77]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 0E3F69A0026; Thu, 29 Apr 2010 11:49:33 +0300 (IDT) Received: from droid.compulab.local (localhost [127.0.0.1]) by droid.compulab.local (8.14.0/8.14.0) with ESMTP id o3T8mJ71015328; Thu, 29 Apr 2010 11:48:19 +0300 Received: (from mike@localhost) by droid.compulab.local (8.14.4/8.14.0/Submit) id o3T8mJSt015327; Thu, 29 Apr 2010 11:48:19 +0300 X-Authentication-Warning: droid.compulab.local: mike set sender to mike@compulab.co.il using -f From: Mike Rapoport To: linux-omap@vger.kernel.org Cc: tony@atomide.com, vimal.newwork@gmail.com, s-ghorai@ti.com, Mike Rapoport Subject: [PATCH v2 3/3] omap: gpmc-nand: add ability to keep timings defined by the bootloader Date: Thu, 29 Apr 2010 11:48:12 +0300 Message-Id: X-Mailer: git-send-email 1.6.6.2 In-Reply-To: References: X-ACL-Warn: { X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - compulab.site5.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Source: X-Source-Args: X-Source-Dir: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 30 Apr 2010 21:03:48 +0000 (UTC) diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index 9434c80..96f0c7f 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c @@ -22,6 +22,7 @@ #define WR_RD_PIN_MONITORING 0x00600000 static struct omap_nand_platform_data *gpmc_nand_data; +static struct gpmc_timings gpmc_default_timings; static struct resource gpmc_nand_resource = { .flags = IORESOURCE_MEM, @@ -65,21 +66,28 @@ static void omap2_nand_gpmc_round_timings(struct gpmc_timings *src, static int omap2_nand_gpmc_retime(void) { + struct device *dev = &gpmc_nand_device.dev; + struct gpmc_timings *gpmc_t = gpmc_nand_data->gpmc_t; struct gpmc_timings t; int err; - if (!gpmc_nand_data->gpmc_t) + if (!gpmc_t) { + dev_warn(dev, "No timings provided, skipping retime\n"); return 0; + } - memset(&t, 0, sizeof(t)); - omap2_nand_gpmc_round_timings(gpmc_nand_data->gpmc_t, &t); + if (!gpmc_nand_data->keep_timings) { + memset(&t, 0, sizeof(t)); + omap2_nand_gpmc_round_timings(gpmc_nand_data->gpmc_t, &t); + gpmc_t = &t; + } /* Configure GPMC */ gpmc_cs_write_reg(gpmc_nand_data->cs, GPMC_CS_CONFIG1, GPMC_CONFIG1_DEVICESIZE(gpmc_nand_data->devsize) | GPMC_CONFIG1_DEVICETYPE_NAND); - err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); + err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t); if (err) return err; @@ -116,6 +124,11 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *_nand_data) return err; } + if (gpmc_nand_data->keep_timings) { + gpmc_cs_get_timings(gpmc_nand_data->cs, &gpmc_default_timings); + gpmc_nand_data->gpmc_t = &gpmc_default_timings; + } + err = gpmc_nand_setup(); if (err < 0) { dev_err(dev, "NAND platform setup failed: %d\n", err); diff --git a/arch/arm/plat-omap/include/plat/nand.h b/arch/arm/plat-omap/include/plat/nand.h index f8efd54..0f727ea 100644 --- a/arch/arm/plat-omap/include/plat/nand.h +++ b/arch/arm/plat-omap/include/plat/nand.h @@ -24,6 +24,7 @@ struct omap_nand_platform_data { void __iomem *gpmc_cs_baseaddr; void __iomem *gpmc_baseaddr; int devsize; + bool keep_timings; }; /* size (4 KiB) for IO mapping */