From patchwork Wed Jun 11 08:56:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 31726 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 26C49203C2 for ; Wed, 11 Jun 2014 08:59:10 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf17785336pbb.9 for ; Wed, 11 Jun 2014 01:59:09 -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=xzT5AZJYQqIfu75++PBrX62QpXS8cDD4Ocu1UQgwIgI=; b=kEIhL0gEDbQ2/vwqS8kpuHGdH8vY8iGroHS5hF0uz15J3YFVSZhP4o5XmSkAW/Bt8U FMFLV4/FJxQjHbg1t/IT14vS0Wx3G6aeMB3YxvCEPlZcklH194idcYeIJga+t47Ugtxw 0Y8fHRFQ8Zlc/aHqINJU3FlctgWuJzBnASFgUkZPZXDmqkDgF1eIQldTatndriHKvE0A b34/UvbIA8ZwbtbiH3D5iHc62HZnt9hdPwhLFDjXxZcecBIZNG8Kmf0EiiGiYI8MMJch ca/TiClHGgr1tkQWfArYShYV4QHVQKOJQDLdHAWdhHqdUTGMdSlb1SWyOx2j/6lwGJD0 uJVA== X-Gm-Message-State: ALoCoQmjsd+F/zFoRELxKQ/ATktpeADLPU4+sD1GNkD37x3imEZFhc+3ry9ci6C+1/YNgf3AtrmZ X-Received: by 10.66.66.196 with SMTP id h4mr1711500pat.22.1402477149480; Wed, 11 Jun 2014 01:59:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.1 with SMTP id p1ls2481191qga.97.gmail; Wed, 11 Jun 2014 01:59:09 -0700 (PDT) X-Received: by 10.58.132.70 with SMTP id os6mr1816791veb.36.1402477149352; Wed, 11 Jun 2014 01:59:09 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id p1si9441508veh.91.2014.06.11.01.59.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 01:59:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id db11so4862830veb.40 for ; Wed, 11 Jun 2014 01:59:09 -0700 (PDT) X-Received: by 10.58.210.68 with SMTP id ms4mr9735045vec.6.1402477149282; Wed, 11 Jun 2014 01:59:09 -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 vs6csp286485vcb; Wed, 11 Jun 2014 01:59:08 -0700 (PDT) X-Received: by 10.66.66.135 with SMTP id f7mr12026096pat.22.1402477148319; Wed, 11 Jun 2014 01:59:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vj3si37358394pbc.59.2014.06.11.01.59.07; Wed, 11 Jun 2014 01:59:07 -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 S1755778AbaFKI7A (ORCPT + 27 others); Wed, 11 Jun 2014 04:59:00 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:57666 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbaFKI65 (ORCPT ); Wed, 11 Jun 2014 04:58:57 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5B8wPtp027227; Wed, 11 Jun 2014 03:58:25 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8wP0Y009756; Wed, 11 Jun 2014 03:58:25 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Wed, 11 Jun 2014 03:58:24 -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 s5B8uiT1020510; Wed, 11 Jun 2014 03:58:21 -0500 From: Roger Quadros To: , , CC: , , , , , , , , , Roger Quadros , Felipe Balbi Subject: [PATCH 27/36] ARM: OMAP2+: usb-tusb6010: Use omap_gpmc_retime() Date: Wed, 11 Jun 2014 11:56:32 +0300 Message-ID: <1402477001-31132-28-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.181 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: , In order to change the GPMC settings/timings on the fly, we must use omap_gpmc_retime(). The other gpmc_*() functions will soon be made private and moved out of arch/mach-omap2/ CC: Felipe Balbi Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/usb-tusb6010.c | 94 ++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 50 deletions(-) diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index e832bc7..71e6246 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c @@ -48,58 +48,48 @@ static struct gpmc_settings tusb_sync = { /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ -static int tusb_set_async_mode(unsigned sysclk_ps) +static void tusb_get_async_timings(unsigned sysclk_ps, + struct gpmc_device_timings *dev_t) { - struct gpmc_device_timings dev_t; - struct gpmc_timings t; - unsigned t_acsnh_advnh = sysclk_ps + 3000; - - memset(&dev_t, 0, sizeof(dev_t)); - - dev_t.t_ceasu = 8 * 1000; - dev_t.t_avdasu = t_acsnh_advnh - 7000; - dev_t.t_ce_avd = 1000; - dev_t.t_avdp_r = t_acsnh_advnh; - dev_t.t_oeasu = t_acsnh_advnh + 1000; - dev_t.t_oe = 300; - dev_t.t_cez_r = 7000; - dev_t.t_cez_w = dev_t.t_cez_r; - dev_t.t_avdp_w = t_acsnh_advnh; - dev_t.t_weasu = t_acsnh_advnh + 1000; - dev_t.t_wpl = 300; - dev_t.cyc_aavdh_we = 1; - - gpmc_calc_timings(&t, &tusb_async, &dev_t); - - return gpmc_cs_set_timings(async_cs, &t); + unsigned t_acsnh_advnh = sysclk_ps + 3000; + + memset(dev_t, 0, sizeof(*dev_t)); + + dev_t->t_ceasu = 8 * 1000; + dev_t->t_avdasu = t_acsnh_advnh - 7000; + dev_t->t_ce_avd = 1000; + dev_t->t_avdp_r = t_acsnh_advnh; + dev_t->t_oeasu = t_acsnh_advnh + 1000; + dev_t->t_oe = 300; + dev_t->t_cez_r = 7000; + dev_t->t_cez_w = dev_t->t_cez_r; + dev_t->t_avdp_w = t_acsnh_advnh; + dev_t->t_weasu = t_acsnh_advnh + 1000; + dev_t->t_wpl = 300; + dev_t->cyc_aavdh_we = 1; } -static int tusb_set_sync_mode(unsigned sysclk_ps) +static void tusb_get_sync_timings(unsigned sysclk_ps, + struct gpmc_device_timings *dev_t) { - struct gpmc_device_timings dev_t; - struct gpmc_timings t; - unsigned t_scsnh_advnh = sysclk_ps + 3000; - - memset(&dev_t, 0, sizeof(dev_t)); - - dev_t.clk = 11100; - dev_t.t_bacc = 1000; - dev_t.t_ces = 1000; - dev_t.t_ceasu = 8 * 1000; - dev_t.t_avdasu = t_scsnh_advnh - 7000; - dev_t.t_ce_avd = 1000; - dev_t.t_avdp_r = t_scsnh_advnh; - dev_t.cyc_aavdh_oe = 3; - dev_t.cyc_oe = 5; - dev_t.t_ce_rdyz = 7000; - dev_t.t_avdp_w = t_scsnh_advnh; - dev_t.cyc_aavdh_we = 3; - dev_t.cyc_wpl = 6; - dev_t.t_ce_rdyz = 7000; - - gpmc_calc_timings(&t, &tusb_sync, &dev_t); - - return gpmc_cs_set_timings(sync_cs, &t); + unsigned t_scsnh_advnh = sysclk_ps + 3000; + + memset(dev_t, 0, sizeof(dev_t)); + + dev_t->clk = 11100; + dev_t->t_bacc = 1000; + dev_t->t_ces = 1000; + dev_t->t_ceasu = 8 * 1000; + dev_t->t_avdasu = t_scsnh_advnh - 7000; + dev_t->t_ce_avd = 1000; + dev_t->t_avdp_r = t_scsnh_advnh; + dev_t->cyc_aavdh_oe = 3; + dev_t->cyc_oe = 5; + dev_t->t_ce_rdyz = 7000; + dev_t->t_avdp_w = t_scsnh_advnh; + dev_t->cyc_aavdh_we = 3; + dev_t->cyc_wpl = 6; + dev_t->t_ce_rdyz = 7000; } /* tusb driver calls this when it changes the chip's clocking */ @@ -110,18 +100,22 @@ int tusb6010_platform_retime(unsigned is_refclk) unsigned sysclk_ps; int status; + struct gpmc_device_timings dev_t; if (!refclk_psec) return -ENODEV; sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; - status = tusb_set_async_mode(sysclk_ps); + tusb_get_async_timings(sysclk_ps, &dev_t); + status = omap_gpmc_retime(async_cs, &tusb_async, &dev_t); if (status < 0) { printk(error, "async", status); goto done; } - status = tusb_set_sync_mode(sysclk_ps); + + tusb_get_sync_timings(sysclk_ps, &dev_t); + status = omap_gpmc_retime(sync_cs, &tusb_sync, &dev_t); if (status < 0) printk(error, "sync", status); done: