From patchwork Wed Mar 12 18:07:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 3820181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A49109F2BB for ; Wed, 12 Mar 2014 18:15:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD15A2025B for ; Wed, 12 Mar 2014 18:15:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A3DA720163 for ; Wed, 12 Mar 2014 18:15:29 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNnfI-0001O1-IW; Wed, 12 Mar 2014 18:14:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNnaP-00069C-FU; Wed, 12 Mar 2014 18:09:01 +0000 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNnZk-00060Z-3t; Wed, 12 Mar 2014 18:08:29 +0000 Received: by mail-we0-f179.google.com with SMTP id x48so11625134wes.38 for ; Wed, 12 Mar 2014 11:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KDVXQyfffUuuGVcRQ1RyjaB0izXhEScyKky2nwmZp7Y=; b=lNZXvY4HtsB0B7nZwWU7/Z6wPTE11Amq1F9QHtkIl0XpZ2LvDlVzk10JsvDaxUqWWB RGPie10kN+mC5hiPjMKcQ38vR9guiIhI6/hw7/LoN86I+q9jOv/GlC5sIKCo3LtsVxoZ Z7t6RwpGvQaFT5M4urf71lIeYJiRG56n/R1mYAPZmFDlxxbiQ3x822X20rCS9xFzfGPM YD6dmCoHQ5KVeADIjtsXE6HqPX4yMydqUQyJ3l/AXI9+x25Y9yfsTs+q1pDAkekMtSCG uzHDuEE7R3TpbGyOWNMKSrHsnSuiDOJxEo+1hKkk0ryqdREJhVhqD4ifiN/cXr7cMSNw z22Q== X-Received: by 10.194.1.242 with SMTP id 18mr5321099wjp.22.1394647675346; Wed, 12 Mar 2014 11:07:55 -0700 (PDT) Received: from localhost.localdomain (col31-4-88-188-80-5.fbx.proxad.net. [88.188.80.5]) by mx.google.com with ESMTPSA id bj3sm71576119wjb.14.2014.03.12.11.07.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Mar 2014 11:07:54 -0700 (PDT) From: Boris BREZILLON To: Maxime Ripard , Rob Herring , David Woodhouse , Grant Likely , Brian Norris , Jason Gunthorpe , Arnd Bergmann Subject: [PATCH v3 3/9] of: mtd: add NAND timing mode retrieval support Date: Wed, 12 Mar 2014 19:07:38 +0100 Message-Id: <1394647664-8258-4-git-send-email-b.brezillon.dev@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394647664-8258-1-git-send-email-b.brezillon.dev@gmail.com> References: <1394647664-8258-1-git-send-email-b.brezillon.dev@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140312_140821_042905_4CC436BD X-CRM114-Status: GOOD ( 12.04 ) X-Spam-Score: -2.0 (--) Cc: devicetree@vger.kernel.org, Boris BREZILLON , linux-doc@vger.kernel.org, dev@linux-sunxi.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a function to retrieve NAND timing mode (ONFI timing mode) from a given DT node. Signed-off-by: Boris BREZILLON --- drivers/of/of_mtd.c | 19 +++++++++++++++++++ include/linux/of_mtd.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c index b7361ed..8bdaa0b 100644 --- a/drivers/of/of_mtd.c +++ b/drivers/of/of_mtd.c @@ -117,3 +117,22 @@ bool of_get_nand_on_flash_bbt(struct device_node *np) return of_property_read_bool(np, "nand-on-flash-bbt"); } EXPORT_SYMBOL_GPL(of_get_nand_on_flash_bbt); + +/** + * of_get_nand_timings - Get nand timings for the given device_node + * @np: Pointer to the given device_node + * + * return 0 on success errno other wise + */ +int of_get_nand_onfi_timing_mode(struct device_node *np) +{ + int err; + u32 mode; + + err = of_property_read_u32(np, "onfi,nand-timing-mode", &mode); + if (err) + return err; + + return mode; +} +EXPORT_SYMBOL_GPL(of_get_nand_onfi_timing_mode); diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h index e266caa..c8310ae 100644 --- a/include/linux/of_mtd.h +++ b/include/linux/of_mtd.h @@ -9,6 +9,8 @@ #ifndef __LINUX_OF_MTD_H #define __LINUX_OF_MTD_H +#include + #ifdef CONFIG_OF_MTD #include @@ -17,6 +19,7 @@ int of_get_nand_ecc_step_size(struct device_node *np); int of_get_nand_ecc_strength(struct device_node *np); int of_get_nand_bus_width(struct device_node *np); bool of_get_nand_on_flash_bbt(struct device_node *np); +int of_get_nand_onfi_timing_mode(struct device_node *np); #else /* CONFIG_OF_MTD */ @@ -45,6 +48,11 @@ static inline bool of_get_nand_on_flash_bbt(struct device_node *np) return false; } +static inline int of_get_nand_onfi_timing_mode(struct device_node *np) +{ + return -ENOSYS; +} + #endif /* CONFIG_OF_MTD */ #endif /* __LINUX_OF_MTD_H */