From patchwork Fri Nov 7 14:49:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 40417 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 76F8A240F7 for ; Fri, 7 Nov 2014 14:50:15 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf1963678lbi.6 for ; Fri, 07 Nov 2014 06:50:14 -0800 (PST) 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=RbdnwHwUh48m6acveukK84o3isCZ+TUXHRFRfqLaf2c=; b=Cj1wrOW92iY2kd/qxj/u6yTBcSyPwOeWi1V74LVEuWIVaIoNVFDVwtuxmfXxkmnpgc WLGicfCNMjk87r8JHpUOyOs7xX0Nvhp/3/wjDQy9/ZdEA4TaEBXSbUha1FaGMltIRl4T flKfWGLs5Yiju11m2tfeYb+yfFWEArsw2UxC4lIiWS0w/8l1Ke41LtD2GIjfhgbwDDdR VNGSvGSA44LEVD1lAIRW6IHBWYMEpLw0OaC0F9CYQpC8TO5lHsIiyVSPf6taxlWJgKfZ RlXVOmj6asfb/Y7e5CpBR1xQl4z00ET3TbKCyFJUapJJ5ZsoYkBp1K2BDSCRVaBLRUc5 I9xw== X-Gm-Message-State: ALoCoQl1NzXLd0trOkLFJNaUKxFk/OgVlUpd1xEmicS46Q3E4yAT+vxFzGCbJA4ZaGKr5VAA56ET X-Received: by 10.112.146.104 with SMTP id tb8mr81527lbb.22.1415371814456; Fri, 07 Nov 2014 06:50:14 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.161.234 with SMTP id xv10ls233961lab.99.gmail; Fri, 07 Nov 2014 06:50:14 -0800 (PST) X-Received: by 10.152.8.1 with SMTP id n1mr11587676laa.28.1415371814135; Fri, 07 Nov 2014 06:50:14 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id qf5si15243422lbb.105.2014.11.07.06.50.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Nov 2014 06:50:13 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id q1so4509455lam.24 for ; Fri, 07 Nov 2014 06:50:13 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr2491088lbc.66.1415371813861; Fri, 07 Nov 2014 06:50:13 -0800 (PST) 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.184.201 with SMTP id ew9csp210431lbc; Fri, 7 Nov 2014 06:50:12 -0800 (PST) X-Received: by 10.67.29.232 with SMTP id jz8mr12390293pad.25.1415371811638; Fri, 07 Nov 2014 06:50:11 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si9239665pdj.121.2014.11.07.06.50.11 for ; Fri, 07 Nov 2014 06:50:11 -0800 (PST) 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 S1752947AbaKGOuJ (ORCPT + 5 others); Fri, 7 Nov 2014 09:50:09 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:52472 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752562AbaKGOuE (ORCPT ); Fri, 7 Nov 2014 09:50:04 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id sA7Eng4I014612; Fri, 7 Nov 2014 08:49:42 -0600 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 sA7Eng31012997; Fri, 7 Nov 2014 08:49:42 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 7 Nov 2014 08:49:41 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id sA7EnX7D007870; Fri, 7 Nov 2014 08:49:37 -0600 From: Roger Quadros To: , CC: , , , , , , , , , , , , Roger Quadros Subject: [PATCH v4 1/8] net: can: c_can: Add timeout to c_can_hw_raminit_ti() Date: Fri, 7 Nov 2014 16:49:15 +0200 Message-ID: <1415371762-29885-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415371762-29885-1-git-send-email-rogerq@ti.com> References: <1415371762-29885-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.51 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: , TI's RAMINIT DONE mechanism is buggy on AM43xx SoC and may not always be set after the START bit is set. Although it seems to work fine even in that case. So add a timeout mechanism to c_can_hw_raminit_wait_ti(). Don't bail out in that failure case but just print an error message. Signed-off-by: Roger Quadros --- drivers/net/can/c_can/c_can_platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index fb279d6..b144e71 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c @@ -75,10 +75,18 @@ static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv, static void c_can_hw_raminit_wait_ti(const struct c_can_priv *priv, u32 mask, u32 val) { + int timeout = 0; /* We look only at the bits of our instance. */ val &= mask; - while ((readl(priv->raminit_ctrlreg) & mask) != val) + while ((readl(priv->raminit_ctrlreg) & mask) != val) { udelay(1); + timeout++; + + if (timeout == 1000) { + dev_err(&priv->dev->dev, "%s: time out\n", __func__); + break; + } + } } static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)