From patchwork Tue Oct 21 12:41:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 39113 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7ABCF202DB for ; Tue, 21 Oct 2014 12:42:04 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id b6sf748345lbj.7 for ; Tue, 21 Oct 2014 05:42:02 -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=1i3z4HKBG3xB562ltJLzx5kaZpVJDcvHL3L8NJoLKNY=; b=atg3b1LvBvYcQLgNd7ZG25M6UcsowoS3VskgBropUtbKDV5Vg/XBnyMVkgHVhaHbC3 +9FhaFTu8ZNxx0Dyg987O3Ghs+Js+EE2Fq/v2mvE4fyUgOqtaI+J3C6N30pjAyR6vNhs BiFLZPW8YVnlx/zjCfLk8XWwJ5kFDpM2T/MJJ4p9Y/cGNE2tNVKaPtmBiHVcsSpfEjZw TacV26VQeOdzyMZTxN7mD1LwkJZdqPJfSpwqXpgYLjQ0Lk7tYmTH8GiOpywAIdq5SQWj o5PVxFCd47ROP/46FM6BFVj9Vj+AtVaNPmzPG79UxmF/rQroZhQmCBkoG8tfZmZEHk4g Yzrw== X-Gm-Message-State: ALoCoQnb4BvfvY+F0jUGEjFIojURkiVn0tbX0Rp5jpG8Uc8SvEbhw+6nNNf3b6ru36k70ySpXccx X-Received: by 10.112.137.202 with SMTP id qk10mr410249lbb.11.1413895321781; Tue, 21 Oct 2014 05:42:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.200 with SMTP id y8ls54286lal.93.gmail; Tue, 21 Oct 2014 05:42:01 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr33991183laa.57.1413895321637; Tue, 21 Oct 2014 05:42:01 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id q1si18762859laj.42.2014.10.21.05.42.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 05:42:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id hs14so970655lab.3 for ; Tue, 21 Oct 2014 05:42:01 -0700 (PDT) X-Received: by 10.112.12.35 with SMTP id v3mr16246111lbb.80.1413895321149; Tue, 21 Oct 2014 05:42:01 -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.112.84.229 with SMTP id c5csp488768lbz; Tue, 21 Oct 2014 05:42:00 -0700 (PDT) X-Received: by 10.70.49.68 with SMTP id s4mr35532687pdn.6.1413895319555; Tue, 21 Oct 2014 05:41:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fa4si10878840pbc.238.2014.10.21.05.41.58 for ; Tue, 21 Oct 2014 05:41:59 -0700 (PDT) Received-SPF: none (google.com: linux-omap-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 S932403AbaJUMl6 (ORCPT + 5 others); Tue, 21 Oct 2014 08:41:58 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:47068 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932402AbaJUMl5 (ORCPT ); Tue, 21 Oct 2014 08:41:57 -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 s9LCftO1019001; Tue, 21 Oct 2014 07:41:55 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9LCfts8019029; Tue, 21 Oct 2014 07:41:55 -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; Tue, 21 Oct 2014 07:41:55 -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 s9LCfoo1012514; Tue, 21 Oct 2014 07:41:53 -0500 From: Roger Quadros To: CC: , , , Roger Quadros , Sekhar Nori Subject: [PATCH 1/5] ARM: OMAP2+: gpmc: Print error message in set_gpmc_timing_reg() Date: Tue, 21 Oct 2014 15:41:45 +0300 Message-ID: <1413895309-9152-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1413895309-9152-1-git-send-email-rogerq@ti.com> References: <1413895309-9152-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@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.215.44 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: , Simplify set_gpmc_timing_reg() and always print error message if the requested timing cannot be achieved due to a too fast GPMC functional clock, irrespective if whether DEBUG is defined or not. This should help us debug timing configuration issues, which were otherwise simply not being displayed in the kernel log. Signed-off-by: Roger Quadros Signed-off-by: Sekhar Nori --- arch/arm/mach-omap2/gpmc.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 5fa3755..45f680f 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c @@ -283,13 +283,8 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p) p->cycle2cyclediffcsen); } -#ifdef DEBUG static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int time, const char *name) -#else -static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, - int time) -#endif { u32 l; int ticks, mask, nr_bits; @@ -299,15 +294,15 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, else ticks = gpmc_ns_to_ticks(time); nr_bits = end_bit - st_bit + 1; - if (ticks >= 1 << nr_bits) { -#ifdef DEBUG - printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n", - cs, name, time, ticks, 1 << nr_bits); -#endif + mask = (1 << nr_bits) - 1; + + if (ticks > mask) { + pr_err("%s: GPMC error! CS%d: %s: %d ns, %d ticks > %d\n", + __func__, cs, name, time, ticks, mask); + return -1; } - mask = (1 << nr_bits) - 1; l = gpmc_cs_read_reg(cs, reg); #ifdef DEBUG printk(KERN_INFO @@ -322,16 +317,10 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, return 0; } -#ifdef DEBUG #define GPMC_SET_ONE(reg, st, end, field) \ if (set_gpmc_timing_reg(cs, (reg), (st), (end), \ t->field, #field) < 0) \ return -1 -#else -#define GPMC_SET_ONE(reg, st, end, field) \ - if (set_gpmc_timing_reg(cs, (reg), (st), (end), t->field) < 0) \ - return -1 -#endif int gpmc_calc_divider(unsigned int sync_clk) {