From patchwork Thu Apr 29 08:48:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 96064 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 o3UL3bJQ031256 for ; Fri, 30 Apr 2010 21:03:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757848Ab0D3VDA (ORCPT ); Fri, 30 Apr 2010 17:03:00 -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 S1754155Ab0D3VC6 (ORCPT ); Fri, 30 Apr 2010 17:02:58 -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 1O7PR7-0008JB-Kl; Thu, 29 Apr 2010 03:49:34 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id A5FDE9A0028; Thu, 29 Apr 2010 11:49:32 +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 T2RaZeXceY1M; Thu, 29 Apr 2010 11:49:32 +0300 (IDT) Received: from droid.compulab.local (droid.compulab.local [10.1.1.77]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 666D49A0026; Thu, 29 Apr 2010 11:49:32 +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 o3T8mJDZ015324; Thu, 29 Apr 2010 11:48:19 +0300 Received: (from mike@localhost) by droid.compulab.local (8.14.4/8.14.0/Submit) id o3T8mJ53015323; 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 2/3] omap: gpmc-nand: introduce omap2_nand_gpmc_round_timings helper Date: Thu, 29 Apr 2010 11:48:11 +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:39 +0000 (UTC) diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index e57fb29..9434c80 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c @@ -34,6 +34,35 @@ static struct platform_device gpmc_nand_device = { .resource = &gpmc_nand_resource, }; +static void omap2_nand_gpmc_round_timings(struct gpmc_timings *src, + struct gpmc_timings *dst) +{ + dst->sync_clk = gpmc_round_ns_to_ticks(src->sync_clk); + dst->cs_on = gpmc_round_ns_to_ticks(src->cs_on); + dst->adv_on = gpmc_round_ns_to_ticks(src->adv_on); + + /* Read */ + dst->adv_rd_off = gpmc_round_ns_to_ticks(src->adv_rd_off); + dst->oe_on = dst->adv_on; + dst->access = gpmc_round_ns_to_ticks(src->access); + dst->oe_off = gpmc_round_ns_to_ticks(src->oe_off); + dst->cs_rd_off = gpmc_round_ns_to_ticks(src->cs_rd_off); + dst->rd_cycle = gpmc_round_ns_to_ticks(src->rd_cycle); + + /* Write */ + dst->adv_wr_off = gpmc_round_ns_to_ticks(src->adv_wr_off); + dst->we_on = dst->oe_on; + if (cpu_is_omap34xx()) { + dst->wr_data_mux_bus = gpmc_round_ns_to_ticks( + src->wr_data_mux_bus); + dst->wr_access = gpmc_round_ns_to_ticks( + src->wr_access); + } + dst->we_off = gpmc_round_ns_to_ticks(src->we_off); + dst->cs_wr_off = gpmc_round_ns_to_ticks(src->cs_wr_off); + dst->wr_cycle = gpmc_round_ns_to_ticks(src->wr_cycle); +} + static int omap2_nand_gpmc_retime(void) { struct gpmc_timings t; @@ -43,32 +72,7 @@ static int omap2_nand_gpmc_retime(void) return 0; memset(&t, 0, sizeof(t)); - t.sync_clk = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->sync_clk); - t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on); - t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on); - - /* Read */ - t.adv_rd_off = gpmc_round_ns_to_ticks( - gpmc_nand_data->gpmc_t->adv_rd_off); - t.oe_on = t.adv_on; - t.access = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->access); - t.oe_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->oe_off); - t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_rd_off); - t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->rd_cycle); - - /* Write */ - t.adv_wr_off = gpmc_round_ns_to_ticks( - gpmc_nand_data->gpmc_t->adv_wr_off); - t.we_on = t.oe_on; - if (cpu_is_omap34xx()) { - t.wr_data_mux_bus = gpmc_round_ns_to_ticks( - gpmc_nand_data->gpmc_t->wr_data_mux_bus); - t.wr_access = gpmc_round_ns_to_ticks( - gpmc_nand_data->gpmc_t->wr_access); - } - t.we_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->we_off); - t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_wr_off); - t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->wr_cycle); + omap2_nand_gpmc_round_timings(gpmc_nand_data->gpmc_t, &t); /* Configure GPMC */ gpmc_cs_write_reg(gpmc_nand_data->cs, GPMC_CS_CONFIG1,