From patchwork Wed Jun 11 08:56:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 31721 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B121F21134 for ; Wed, 11 Jun 2014 08:58:28 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id i8sf10912013qcq.0 for ; Wed, 11 Jun 2014 01:58:28 -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:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=BJ7tyiZiKYwBXqUfgA3aPepF11/miqfrpofmdpKQYhc=; b=iqbbmN3jveU+Frhv7E45ufw0RC73wrMZ8J8PhGnJfhuqoxKcFQkgeWl1AakuGiR3Ci TKX51t4h0V8U8bK5wE0N4rAHEjAz3dFKRIhfEXh1mYQy3p6Q0b6ttBJxrF9LI+M/56F/ r6YhW8nAgkGCZJYJeHca4H31OpeuXZBNkSmasr3rYdKvGdVWxqFSXbj1ndtgZP+JDZU1 ThQsniqKrmqy0XefNlvgoqF/cz+gD2a5QnIQSRKbnwzimIdtkb8TkM68n91i6QGkQKZw saV5w2yyl8PFY/R92sJBWRRMgfKSNpAPh2aIUioI/NL7h4TyZbF0viPUJN0a8HMvLhsz 1q3Q== X-Gm-Message-State: ALoCoQlR0Xwv7uI73LAs+H5TsBTfQO+x5/TCQvWnMRtyvMiQpanHO6Qnny+mVELKKcJBI5v/cMN6 X-Received: by 10.236.112.12 with SMTP id x12mr10871171yhg.56.1402477108572; Wed, 11 Jun 2014 01:58:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.163 with SMTP id p32ls2499519qgd.42.gmail; Wed, 11 Jun 2014 01:58:28 -0700 (PDT) X-Received: by 10.221.64.20 with SMTP id xg20mr36865042vcb.3.1402477108484; Wed, 11 Jun 2014 01:58:28 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id fp5si12754052vcb.75.2014.06.11.01.58.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 01:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jw12so7404615veb.11 for ; Wed, 11 Jun 2014 01:58:28 -0700 (PDT) X-Received: by 10.221.63.195 with SMTP id xf3mr1770879vcb.36.1402477108366; Wed, 11 Jun 2014 01:58:28 -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.54.6 with SMTP id vs6csp286450vcb; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) X-Received: by 10.66.188.5 with SMTP id fw5mr11626808pac.63.1402477107337; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kd3si37352792pbc.49.2014.06.11.01.58.26; Wed, 11 Jun 2014 01:58:26 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755712AbaFKI6T (ORCPT + 27 others); Wed, 11 Jun 2014 04:58:19 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:59795 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932316AbaFKI6P (ORCPT ); Wed, 11 Jun 2014 04:58:15 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5B8vnWm004664; Wed, 11 Jun 2014 03:57:49 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8vnTx021085; Wed, 11 Jun 2014 03:57:49 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 11 Jun 2014 03:57:49 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8uiSp020510; Wed, 11 Jun 2014 03:57:46 -0500 From: Roger Quadros To: , , CC: , , , , , , , , , Roger Quadros Subject: [PATCH 17/36] ARM: OMAP2+: gpmc-onenand: Use Async settings/timings by default Date: Wed, 11 Jun 2014 11:56:22 +0300 Message-ID: <1402477001-31132-18-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1402477001-31132-1-git-send-email-rogerq@ti.com> References: <1402477001-31132-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.128.180 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Onenand device operates in Asynchronous mode by default. So configure GPMC settings/timings based on Async mode before the onenand device is created. Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/gpmc-onenand.c | 66 ++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 8b6876c..bed8efe 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c @@ -61,9 +61,8 @@ static struct gpmc_settings onenand_sync = { .wait_pin = 0, }; -static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) +static void omap2_onenand_get_async_timings(struct gpmc_device_timings *dev_t) { - struct gpmc_device_timings dev_t; const int t_cer = 15; const int t_avdp = 12; const int t_aavdh = 7; @@ -74,20 +73,18 @@ static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) const int t_wpl = 40; const int t_wph = 30; - memset(&dev_t, 0, sizeof(dev_t)); - - dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; - dev_t.t_avdp_w = dev_t.t_avdp_r; - dev_t.t_aavdh = t_aavdh * 1000; - dev_t.t_aa = t_aa * 1000; - dev_t.t_ce = t_ce * 1000; - dev_t.t_oe = t_oe * 1000; - dev_t.t_cez_r = t_cez * 1000; - dev_t.t_cez_w = dev_t.t_cez_r; - dev_t.t_wpl = t_wpl * 1000; - dev_t.t_wph = t_wph * 1000; - - gpmc_calc_timings(t, &onenand_async, &dev_t); + memset(dev_t, 0, sizeof(*dev_t)); + + dev_t->t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; + dev_t->t_avdp_w = dev_t->t_avdp_r; + dev_t->t_aavdh = t_aavdh * 1000; + dev_t->t_aa = t_aa * 1000; + dev_t->t_ce = t_ce * 1000; + dev_t->t_oe = t_oe * 1000; + dev_t->t_cez_r = t_cez * 1000; + dev_t->t_cez_w = dev_t->t_cez_r; + dev_t->t_wpl = t_wpl * 1000; + dev_t->t_wph = t_wph * 1000; } static void omap2_onenand_set_async_mode(void __iomem *onenand_base) @@ -267,9 +264,10 @@ static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, gpmc_calc_timings(t, &onenand_sync, &dev_t); } -static int omap2_onenand_setup_async(void __iomem *onenand_base) +static int omap2_onenand_setup_async(void) { - struct gpmc_timings t; + struct gpmc_timings gpmc_t; + struct gpmc_device_timings dev_t; int ret; if (gpmc_onenand_data->of_node) { @@ -286,19 +284,14 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) } } - omap2_onenand_set_async_mode(onenand_base); - - omap2_onenand_calc_async_timings(&t); - ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async); if (ret < 0) return ret; - ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); - if (ret < 0) - return ret; - - omap2_onenand_set_async_mode(onenand_base); + omap2_onenand_get_async_timings(&dev_t); + gpmc_calc_timings(&gpmc_t, &onenand_async, &dev_t); + if (gpmc_cs_set_timings(gpmc_onenand_data->cs, &gpmc_t)) + return -EINVAL; return 0; } @@ -349,11 +342,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE; int ret; - ret = omap2_onenand_setup_async(onenand_base); - if (ret) { - dev_err(dev, "unable to set to async mode\n"); - return ret; - } + omap2_onenand_set_async_mode(onenand_base); if (!(gpmc_onenand_data->flags & l)) return 0; @@ -396,9 +385,18 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) gpmc_onenand_resource.end = gpmc_onenand_resource.start + ONENAND_IO_SIZE - 1; + if (omap2_onenand_setup_async()) { + pr_err("%s: Failed to setup ASYNC timings\n", __func__); + goto fail; + } + if (platform_device_register(&gpmc_onenand_device) < 0) { dev_err(dev, "Unable to register OneNAND device\n"); - gpmc_cs_free(gpmc_onenand_data->cs); - return; + goto fail; } + + return; + +fail: + gpmc_cs_free(gpmc_onenand_data->cs); }