From patchwork Wed Jun 11 08:56:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 31720 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D87B203C2 for ; Wed, 11 Jun 2014 08:58:28 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id lx4sf15048033iec.4 for ; Wed, 11 Jun 2014 01:58:27 -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=O5PlwDeO0cJT/QvJyqz6hKjDeHVufBEn0Jv6tb+xRkA=; b=jZwJE4sm0GMi6eLDsJnhmk5LC4CFmBZ07u77X5Kl/92tE4LktQXGf5/LZB/LSJiqOO Sw1535/2/9/LAW8vU4NbRHTclmbparlP/mXPESsVZjl6vAnt2RaKpJURto/oh46+xTqj E/Qk+Y4QGzP2TLHFTnaxEdXu/Evpno2p1+DoVfEKFh0n6IuGSr25NJPL8bJmz7aqdzfb RyYhmwBT703ITOWcASG2EggGX2XY8aNrqnPXt+QC70NMWKl8F7eIZ1YG0b4KdILleri8 OauCwOJJ3byYGoioMxkGgwjiIgg8qziLFHqXCiDuKywFfQOqWlvoua9n5o5T53gvh2qX l3UQ== X-Gm-Message-State: ALoCoQl8pe7z32pJWcWlIAmaOidJZpIl1aBYY9WxyfYpY2ngUYPH0N/IafupQJw9OQUPaROIjU/r X-Received: by 10.42.249.207 with SMTP id ml15mr17858800icb.21.1402477107768; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.147 with SMTP id 19ls2408626qgp.68.gmail; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) X-Received: by 10.220.106.7 with SMTP id v7mr504165vco.46.1402477107645; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id kc17si14004470vdb.12.2014.06.11.01.58.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 01:58:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id us18so8108969veb.6 for ; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) X-Received: by 10.220.12.66 with SMTP id w2mr36833467vcw.15.1402477107572; Wed, 11 Jun 2014 01:58:27 -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 vs6csp286448vcb; Wed, 11 Jun 2014 01:58:27 -0700 (PDT) X-Received: by 10.68.254.103 with SMTP id ah7mr3394484pbd.159.1402477106588; Wed, 11 Jun 2014 01:58:26 -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.25; Wed, 11 Jun 2014 01:58:25 -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 S1755697AbaFKI6L (ORCPT + 27 others); Wed, 11 Jun 2014 04:58:11 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:56302 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753812AbaFKI6E (ORCPT ); Wed, 11 Jun 2014 04:58:04 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5B8vcKl027477; Wed, 11 Jun 2014 03:57:38 -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 s5B8vcmR020999; Wed, 11 Jun 2014 03:57:38 -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:38 -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 s5B8uiSm020510; Wed, 11 Jun 2014 03:57:35 -0500 From: Roger Quadros To: , , CC: , , , , , , , , , Roger Quadros Subject: [PATCH 14/36] ARM: OMAP2+: gpmc: Allow drivers to reconfigure GPMC settings & timings Date: Wed, 11 Jun 2014 11:56:19 +0300 Message-ID: <1402477001-31132-15-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.175 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: , Some devices (e.g. TUSB6010, omap-onenand) need to reconfigure the GPMC timings in order to operate with different peripheral clock frequencies. Introduce omap_gpmc_retime() to allow them to do that. The driver needs to pass the chips select number, GPMC settings and Device timings to omap_gpmc_retime(). NOTE: Device tree and board code must still pass the most conservative timings to GPMC so that the device can be probed by the respective driver. e.g. Onenand must operate in asynchronous mode at bootup. The device driver can then request for more optimal timings via omap_gpmc_retime(). Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/gpmc.c | 36 +++++++++++++++++++++++++++++++++ include/linux/platform_data/gpmc-omap.h | 12 +++++++++++ 2 files changed, 48 insertions(+) diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 70cb6b0..90b7686 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c @@ -1542,6 +1542,42 @@ static int __init omap_gpmc_init(void) } omap_postcore_initcall(omap_gpmc_init); +/** + * omap_gpmc_retime - Reconfigre GPMC timings for the device + * + * @cs Chip select number + * @gpmc_s GPMC settings + * @dev_t New device timings to set + */ +int omap_gpmc_retime(int cs, struct gpmc_settings *gpmc_s, + struct gpmc_device_timings *dev_t) +{ + struct gpmc_timings gpmc_t; + struct device *dev = gpmc_dev; + + if (!gpmc_dev) + return -ENODEV; + + if (cs < 0 || cs >= gpmc_cs_num) { + dev_err(dev, "%s: Invalid find Chip Select\n", __func__); + return cs; + } + + if (gpmc_cs_program_settings(cs, gpmc_s)) { + dev_err(dev, "%s: Failed to set GPMC settings\n", __func__); + return -EINVAL; + } + + gpmc_calc_timings(&gpmc_t, gpmc_s, dev_t); + if (gpmc_cs_set_timings(cs, &gpmc_t)) { + dev_err(dev, "%s: Failed to set GPMC timings\n", __func__); + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL_GPL(omap_gpmc_retime); + static struct omap3_gpmc_regs gpmc_context; void omap3_gpmc_save_context(void) diff --git a/include/linux/platform_data/gpmc-omap.h b/include/linux/platform_data/gpmc-omap.h index e861112..0d40c2a 100644 --- a/include/linux/platform_data/gpmc-omap.h +++ b/include/linux/platform_data/gpmc-omap.h @@ -166,4 +166,16 @@ struct gpmc_omap_platform_data { struct gpmc_omap_cs_data cs[GPMC_CS_NUM]; }; +#ifdef CONFIG_ARCH_OMAP2PLUS +int omap_gpmc_retime(int cs, struct gpmc_settings *gpmc_s, + struct gpmc_device_timings *dev_t); +#else +static inline int omap_gpmc_retime(int cs, + struct gpmc_settings *gpmc_s, + struct gpmc_device_timings *dev_t) +{ + return 0; +} +#endif /* CONFIG_ARCH_OMAP2PLUS */ + #endif /* _GPMC_OMAP_H */