From patchwork Tue Nov 4 10:20:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 40100 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E7AB321894 for ; Tue, 4 Nov 2014 10:21:59 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf1975500lbi.8 for ; Tue, 04 Nov 2014 02:21:58 -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=v4qB8f7V7RwurTNJSWuwm5PKjwTQcqyvGJS3Y+EVU8U=; b=nIeP7QfQYuuoF1ecbMTcghoFSBUTw2fkM8wipdORd0Paq4hqw4T89iTq31zWcsmcnl bA764794sXNiSm1Stt47OBAjZuEuVjZAIzYJNznhxA6GY2rDvaNxn7dFQVUAjnN/eEvf ZtDdRm32XvPTU/Uytmlc20YeRifAaOrX7dGMLU8IAS9n1rJUdnfQRg9gDNkULlEd5Z5b XHBjyr7PRuNg27eaytUa14bCsZCfa7Mw2hoqyr4jrjHcrGTS8HetL2tMm4b0y9ogLewQ XsTMONF1aBx2xRTTqj4KbWbel6OIyjVisSv1SwVd+DiOxHlEZhJ9rZ6ydXjy1BC0UeMm tl3w== X-Gm-Message-State: ALoCoQl8e9qR8uiG5xQlW4M9SfuQ0DILHlbExt6wEc2UY4pCxynYIyvC4GGClsAvurbRDzYt7F9r X-Received: by 10.112.159.199 with SMTP id xe7mr213601lbb.21.1415096518682; Tue, 04 Nov 2014 02:21:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.177 with SMTP id k17ls40995laa.56.gmail; Tue, 04 Nov 2014 02:21:58 -0800 (PST) X-Received: by 10.112.169.6 with SMTP id aa6mr58964841lbc.29.1415096518440; Tue, 04 Nov 2014 02:21:58 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id bm5si36848644lbb.59.2014.11.04.02.21.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 02:21:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id z11so8659617lbi.7 for ; Tue, 04 Nov 2014 02:21:58 -0800 (PST) X-Received: by 10.112.130.41 with SMTP id ob9mr57108573lbb.74.1415096518083; Tue, 04 Nov 2014 02:21:58 -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 ew9csp92805lbc; Tue, 4 Nov 2014 02:21:57 -0800 (PST) X-Received: by 10.68.194.136 with SMTP id hw8mr49185022pbc.17.1415096516494; Tue, 04 Nov 2014 02:21:56 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id db2si17639561pbb.69.2014.11.04.02.21.55 for ; Tue, 04 Nov 2014 02:21:56 -0800 (PST) Received-SPF: none (google.com: netdev-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 S1752587AbaKDKVv (ORCPT + 3 others); Tue, 4 Nov 2014 05:21:51 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:59100 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751804AbaKDKVq (ORCPT ); Tue, 4 Nov 2014 05:21:46 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id sA4ALNJE018508; Tue, 4 Nov 2014 04:21:23 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id sA4ALN7s020724; Tue, 4 Nov 2014 04:21:23 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Tue, 4 Nov 2014 04:21:22 -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 sA4ALEGB020969; Tue, 4 Nov 2014 04:21:19 -0600 From: Roger Quadros To: , CC: , , , , , , , , , , , , Roger Quadros Subject: [PATCH v3 1/8] net: can: c_can: Add timeout to c_can_hw_raminit_ti() Date: Tue, 4 Nov 2014 12:20:54 +0200 Message-ID: <1415096461-25576-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415096461-25576-1-git-send-email-rogerq@ti.com> References: <1415096461-25576-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@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.217.176 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)