From patchwork Tue Sep 9 14:31:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 37119 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 149CC20566 for ; Tue, 9 Sep 2014 14:32:32 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 19sf6167320ykq.10 for ; Tue, 09 Sep 2014 07:32:31 -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=e6+MMTi8ObgMSTFVY9P5+QpbFJ30GqyLI9Wr53Yfxs0=; b=LLJAnYuU4nZ6arrofzeWN5rCAKzrIeCD0Fuf4vTj/obnk8pSne0V+Xnf0uhqUUI32C sLs6+ktrYqLX3ywHyNmoad57xCdj6dGfv0ZKRD/FLaGfQoj/Yw5OUNQU/CoD2ZIe4zVK Fs/+EQjD8w0lj2qlX2urxuJB2eD+AogJ14TL/5t37uHSPfDfBAIPnigNuTRqYyFO/7dI WCthNzsZ7ITfucXyyqbUg/eusvreGzbfMteDqFp0+ox+PT6GRnEULUtQ5lxVunQNEe94 +pZxHVQaWPjqwiUS/GB93RiIFm9SN0SxYe5WCwFjNm6th4646Z/mq2NDa4ciZKaJveKz SXDw== X-Gm-Message-State: ALoCoQlf8ZmavCiyX2j3lbhsdxqZmn9gcnKfH67nWnDyB0gi4q5C4HiQP2bV0DmOJuiqQxVf15e7 X-Received: by 10.236.227.169 with SMTP id d39mr21522501yhq.45.1410273151865; Tue, 09 Sep 2014 07:32:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.35 with SMTP id q32ls2189747qgq.50.gmail; Tue, 09 Sep 2014 07:32:31 -0700 (PDT) X-Received: by 10.221.23.198 with SMTP id rb6mr30534066vcb.19.1410273151647; Tue, 09 Sep 2014 07:32:31 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id xj13si5207109vcb.60.2014.09.09.07.32.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 07:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so16671415vcb.25 for ; Tue, 09 Sep 2014 07:32:31 -0700 (PDT) X-Received: by 10.221.26.70 with SMTP id rl6mr3173979vcb.0.1410273151567; Tue, 09 Sep 2014 07:32:31 -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.45.67 with SMTP id uj3csp293161vcb; Tue, 9 Sep 2014 07:32:31 -0700 (PDT) X-Received: by 10.68.253.34 with SMTP id zx2mr15041072pbc.152.1410273150484; Tue, 09 Sep 2014 07:32:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yt3si23542185pbb.99.2014.09.09.07.32.29 for ; Tue, 09 Sep 2014 07:32:29 -0700 (PDT) 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 S1756695AbaIIOc0 (ORCPT + 3 others); Tue, 9 Sep 2014 10:32:26 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:56050 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753329AbaIIOcZ (ORCPT ); Tue, 9 Sep 2014 10:32:25 -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 s89EVS0m021082; Tue, 9 Sep 2014 09:31:28 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s89EVSgZ004773; Tue, 9 Sep 2014 09:31:28 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Tue, 9 Sep 2014 09:31:28 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s89EVD16002296; Tue, 9 Sep 2014 09:31:25 -0500 From: Roger Quadros To: , CC: , , , , , , , , , , , Roger Quadros Subject: [PATCH v2 3/3] net: can: c_can: Add support for START pulse in RAMINIT sequence Date: Tue, 9 Sep 2014 17:31:10 +0300 Message-ID: <1410273070-22485-4-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1410273070-22485-1-git-send-email-rogerq@ti.com> References: <1410273070-22485-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.220.180 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 SoCs e.g. (TI DRA7xx) need a START pulse to start the RAMINIT sequence i.e. START bit must be set and cleared before checking for the DONE bit status. Add a new DT property "raminit-pulse" to specify if this mechanism must be used for RAMINIT. Signed-off-by: Roger Quadros --- Documentation/devicetree/bindings/net/can/c_can.txt | 3 +++ drivers/net/can/c_can/c_can.h | 1 + drivers/net/can/c_can/c_can_platform.c | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/net/can/c_can.txt b/Documentation/devicetree/bindings/net/can/c_can.txt index e12d1a1..705411f 100644 --- a/Documentation/devicetree/bindings/net/can/c_can.txt +++ b/Documentation/devicetree/bindings/net/can/c_can.txt @@ -19,6 +19,9 @@ Optional properties: register within the syscon region - ti,raminit-start-bit : Bit posistion of START bit in the RAMINIT register - ti,raminit-done-bit : Bit position of DONE bit in the RAMINIT register +- ti,raminit-pulse : Property must exist if START pulse is needed for RAMINIT + sequence i.e. START bit will be set and cleared before + checking for DONE bit. Note: "ti,hwmods" field is used to fetch the base address and irq resources from TI, omap hwmod data base during device registration. diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h index bf68822..85b5ad0 100644 --- a/drivers/net/can/c_can/c_can.h +++ b/drivers/net/can/c_can/c_can.h @@ -175,6 +175,7 @@ struct c_can_raminit { unsigned int reg; /* register index within syscon */ u8 start_bit; /* START bit position in raminit reg. */ u8 done_bit; /* DONE bit position in raminit reg. */ + bool needs_pulse; /* If set, sets and clears START bit (pulse) */ }; /* c_can private data structure */ diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index fb0c35b..5ae9eb3 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c @@ -120,6 +120,12 @@ static void c_can_hw_raminit_syscon(const struct c_can_priv *priv, bool enable) ctrl |= 1 << raminit->start_bit; regmap_write(raminit->syscon, raminit->reg, ctrl); + /* clear START bit if start pulse is needed */ + if (raminit->needs_pulse) { + ctrl &= ~(1 << raminit->start_bit); + regmap_write(raminit->syscon, raminit->reg, ctrl); + } + ctrl |= 1 << raminit->done_bit; c_can_hw_raminit_wait_syscon(priv, mask, ctrl); } @@ -340,6 +346,8 @@ static int c_can_plat_probe(struct platform_device *pdev) } priv->raminit_sys.done_bit = val; + priv->raminit_sys.needs_pulse = of_property_read_bool(np, + "ti,raminit-pulse"); priv->raminit = c_can_hw_raminit_syscon; break; default: